@g1cloud/bpmn-modeler-next 5.0.0-alpha.3 → 5.0.0-alpha.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,16 @@
1
- (function(me,We){typeof exports=="object"&&typeof module<"u"?We(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],We):(me=typeof globalThis<"u"?globalThis:me||self,We(me.BpmnModeler={},me.Vue))})(this,(function(me,We){"use strict";var QM=Object.defineProperty;var JM=(me,We,Tn)=>We in me?QM(me,We,{enumerable:!0,configurable:!0,writable:!0,value:Tn}):me[We]=Tn;var qi=(me,We,Tn)=>JM(me,typeof We!="symbol"?We+"":We,Tn);const Tn=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function lp(e){return Tn.includes(e)}const pp="http://g1project.net/spec/bpmn/bwl/1.0",ec="bwl",tc=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],fp={name:"bwl-hints",uri:pp,prefix:ec,xml:{tagAlias:"lowerCase"},types:[{name:"Placement",superClass:["Element"],properties:[{name:"anchor",isAttr:!0,type:"String"},{name:"side",isAttr:!0,type:"String"},{name:"offset",isAttr:!0,type:"Real"}]},{name:"Members",superClass:["Element"],properties:[{name:"refs",isAttr:!0,type:"String"}]},{name:"BandHint",extends:["bpmn:FlowNode"],properties:[{name:"band",isAttr:!0,type:"Integer"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]}]},nc="bwl.undoEpisode",dp=new WeakSet;function s_(e){dp.has(e)||(e.register(nc,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),dp.add(e))}function hp(e,t){s_(e);const n={run:t};if(e.execute(nc,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const mp=["participant.add","participant.update","node.add","node.update","sequenceFlow.add","sequenceFlow.update","messageFlow.add","messageFlow.update","dataStore.add","dataStore.update","dataAssociation.add","association.add","annotation.add","annotation.update","group.add","group.update","element.remove"],c_={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},u_={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},l_={type:"object",description:"풀(participant). 레인은 여기 선언하고 노드가 lane 인자로 배정된다 — 별도 레인 op 없음.",properties:{id:{type:"string",description:"문서 내 유일, XML NCName(공백 없이 문자/밑줄로 시작)."},name:{type:"string"},blackBox:{type:"boolean",description:"true = 내부 프로세스 없는 블랙박스 풀."},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"],additionalProperties:!1},p_={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Tn]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},f_={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},d_={type:"object",description:"시퀀스 플로우(같은 풀 안 노드 간).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},condition:{$ref:"#/$defs/irFlowCondition"}},required:["id","source","target"],additionalProperties:!1},h_={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},m_={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},g_={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},v_={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},y_={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},__={type:"object",description:"그룹 — members(요소 id 목록)가 bwl:members 힌트로 기록되고 바운즈는 멤버 bbox 로 산출된다.",properties:{id:{type:"string"},name:{type:"string"},members:{type:"array",items:{type:"string"}}},required:["id"],additionalProperties:!1},b_={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...tc]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function mt(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const E_={"participant.add":mt("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":mt("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":mt("node.add",{description:"플로우 노드 추가. band = 프로세스 내부 가로 밴드 순번 힌트(주 흐름 0, 보조 스트랜드 1…).",properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":mt("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Tn]}},required:["id"]}),"sequenceFlow.add":mt("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":mt("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건 갱신. condition: null = 조건 제거.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]}},required:["id"]}),"messageFlow.add":mt("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":mt("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":mt("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":mt("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":mt("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":mt("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":mt("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":mt("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":mt("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":mt("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":mt("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},gp={anyOf:mp.map(e=>E_[e])},x_={type:"object",description:"BPMN 문서에 요소를 추가·수정·삭제할 때 호출한다. 기존 요소는 describeProcess 가 노출하는 id 로 지정하고, 신규 요소 id 는 문서 내 유일한 XML NCName(공백 없이 문자/밑줄 시작)으로 짓는다. 좌표는 지정하지 않는다 — 배치는 서버가 결정하며, 필요하면 힌트(placement/band/order)로 의도만 전달하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{irLane:u_,irParticipant:l_,irNode:p_,irFlowCondition:f_,irSequenceFlow:d_,irMessageFlow:h_,irDataStore:m_,irDataAssociation:g_,irTextAnnotation:v_,irAssociation:y_,irGroup:__,bwlPlacement:b_,nullableString:c_,symbolicOp:gp}},w_={"bpmn:Participant":"participant","bpmn:Lane":"lane","bpmn:SequenceFlow":"sequenceFlow","bpmn:MessageFlow":"messageFlow","bpmn:DataStoreReference":"dataStore","bpmn:DataInputAssociation":"dataAssociation","bpmn:DataOutputAssociation":"dataAssociation","bpmn:TextAnnotation":"annotation","bpmn:Association":"association","bpmn:Group":"group"};function S_(e,t){const n=w_[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function vp(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function yp(e){const t=()=>e.getAll().filter(n=>n.type!=="label"&&!("labelTarget"in n&&n.labelTarget));return{isCollaboration:()=>t().some(n=>n.type==="bpmn:Participant"),categoryOf:n=>{const i=e.get(n);if(!(!i||i.type==="label"))return S_(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&vp(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?vp(i):void 0}}}const R_=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,_p=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),bp={"participant.add":[{path:"participant",shape:["id"]},{path:"participant.lanes[]",shape:["id"],optional:!0}],"participant.update":[{path:"id",shape:null},{path:"lanes[]",shape:["id"],optional:!0}],"node.add":[{path:"node",shape:["id","type"]}],"node.update":[{path:"id",shape:null}],"sequenceFlow.add":[{path:"flow",shape:["id","source","target"]}],"sequenceFlow.update":[{path:"id",shape:null}],"messageFlow.add":[{path:"flow",shape:["id","source","target"]}],"messageFlow.update":[{path:"id",shape:null}],"dataStore.add":[{path:"dataStore",shape:["id"]},{path:"associations[]",shape:["source","target"],optional:!0}],"dataStore.update":[{path:"id",shape:null}],"dataAssociation.add":[{path:"association",shape:["source","target"]}],"association.add":[{path:"association",shape:["source","target"]}],"annotation.add":[{path:"annotation",shape:["id","text"]},{path:"association",shape:["source","target"],optional:!0},{path:"placement",shape:["anchor","side"],optional:!0}],"annotation.update":[{path:"id",shape:null},{path:"placement",shape:["anchor","side"],optional:!0}],"group.add":[{path:"group",shape:["id"]},{path:"group.members[]",shape:null,optional:!0}],"group.update":[{path:"id",shape:null},{path:"members[]",shape:null,optional:!0}],"element.remove":[{path:"id",shape:null}]},Fo=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ic=e=>typeof e=="string"&&e!=="";function C_(e){const t=[];function n(i,r,o,a){if(a===null){ic(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!Fo(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)ic(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!Fo(i)||!ic(i.kind)||!(i.kind in bp)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of bp[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const p of c.slice(0,-1)){if(!Fo(u))break;u=u[p]}if(!Fo(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((p,f)=>n(r,`${s}[${f}]`,p,o.shape))}}}),t}function Ep(e,t){const n=C_(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!R_.test(d)){i.push({kind:"id-invalid",opIndex:f,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:f,id:d});return}r.set(d,{...h,opIndex:f})}e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(g=>g.id)});for(const g of f.participant.lanes??[])a(d,g.id,{category:"lane"});break;case"node.add":a(d,f.node.id,{category:"flowNode",participant:f.node.participant});break;case"sequenceFlow.add":a(d,f.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,f.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,f.dataStore.id,{category:"dataStore"});for(const g of f.associations??[])g.id&&a(d,g.id,{category:"dataAssociation"});break;case"dataAssociation.add":f.association.id&&a(d,f.association.id,{category:"dataAssociation"});break;case"association.add":f.association.id&&a(d,f.association.id,{category:"association"});break;case"annotation.add":a(d,f.annotation.id,{category:"annotation"}),(h=f.association)!=null&&h.id&&a(d,f.association.id,{category:"association"});break;case"group.add":a(d,f.group.id,{category:"group"});break;case"participant.update":if(f.lanes){o.set(f.id,f.lanes.map(g=>g.id));for(const g of f.lanes)t.categoryOf(g.id)===void 0&&a(d,g.id,{category:"lane"})}break}});const s=f=>{var d;return((d=r.get(f))==null?void 0:d.category)??t.categoryOf(f)},c=f=>{const d=r.get(f);return d?d.category==="participant"?f:d.participant:t.categoryOf(f)==="participant"?f:t.participantOf(f)};function u(f,d,h,g){const _=s(d);if(_===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:h});return}if(g&&!g.includes(_)){i.push({kind:"ref-category",opIndex:f,ref:d,role:h,expected:g.join("|"),actual:_});return}return _}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:g,lane:_}=f.node;if(g===void 0){(l||_!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,g,"participant",["participant"])===void 0)break;_!==void 0&&((((h=r.get(g))==null?void 0:h.lanes)??o.get(g)??t.lanesOf(g)).includes(_)||i.push({kind:"lane-unknown",opIndex:d,lane:_,participant:g}));break}case"sequenceFlow.add":{const{id:g,source:_,target:R,name:x,condition:E}=f.flow,b=u(d,_,"source",["flowNode"]),S=u(d,R,"target",["flowNode"]);b&&S&&c(_)!==c(R)&&i.push({kind:"flow-cross-pool",opIndex:d,id:g}),x!==void 0&&E!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:g});break}case"messageFlow.add":{const{id:g,source:_,target:R}=f.flow,x=u(d,_,"source",["flowNode","participant"]),E=u(d,R,"target",["flowNode","participant"]);if(x&&E){const b=c(_),S=c(R);b!==void 0&&b===S&&i.push({kind:"message-flow-same-pool",opIndex:d,id:g})}break}case"dataStore.add":{for(const g of f.associations??[]){if([g.source,g.target].filter(x=>x===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:g.source,target:g.target});continue}const R=g.source===f.dataStore.id?g.target:g.source;u(d,R,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:g,target:_}=f.association,R=u(d,g,"source"),x=u(d,_,"target");if(R&&x){const E=new Set([R,x]);E.has("dataStore")&&E.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:g,target:_})}break}case"association.add":{const{id:g,source:_,target:R}=f.association,x=u(d,_,"source"),E=u(d,R,"target");x&&E&&x!=="annotation"&&E!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:g??`${_}->${R}`});break}case"annotation.add":{if(f.association){const{source:g,target:_}=f.association;if(g!==f.annotation.id&&_!==f.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:f.annotation.id});else{const R=g===f.annotation.id?_:g;u(d,R,"association")}}f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.add":{for(const g of f.group.members??[]){const _=u(d,g,"member");_&&_p.has(_)&&i.push({kind:"ref-category",opIndex:d,ref:g,role:"member",expected:"shape",actual:_})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const g=t.lanesOf(f.id),_=f.lanes.map(x=>x.id);for(const x of g)_.includes(x)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:x});for(const x of _)t.categoryOf(x)!==void 0&&!g.includes(x)&&i.push({kind:"id-duplicate",opIndex:d,id:x});const R=_.filter(x=>g.includes(x));R.length===g.length&&R.some((x,E)=>x!==g[E])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:f.id})}break}case"node.update":{if(p(d,f.id,"flowNode")===void 0)break;if(f.lane!==void 0){const g=t.participantOf(f.id);(g?o.get(g)??t.lanesOf(g):[]).includes(f.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:f.lane,participant:g??""})}break}case"sequenceFlow.update":{if(p(d,f.id,"sequenceFlow")===void 0)break;f.name!==void 0&&f.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:f.id});break}case"messageFlow.update":p(d,f.id,"messageFlow");break;case"dataStore.update":p(d,f.id,"dataStore");break;case"annotation.update":{if(p(d,f.id,"annotation")===void 0)break;f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.update":{if(p(d,f.id,"group")===void 0)break;for(const g of f.members??[]){const _=u(d,g,"member");_&&_p.has(_)&&i.push({kind:"ref-category",opIndex:d,ref:g,role:"member",expected:"shape",actual:_})}break}case"element.remove":{p(d,f.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:f.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function p(f,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const g=t.categoryOf(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(h&&g!==h){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:h,actual:g});return}return g}}function xp(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function Ho(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const wp={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]};function gt(e,t){return e.filter(n=>n.kind===t)}function Sp(e,t){var Y,B,L,H;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=M=>o.get(M),p=M=>{const $=l(M);if(!$)throw new Error(`하강 참조 해소 실패: ${M}`);return $},f=M=>{let $=M.parent;for(;$;){if($.type==="bpmn:Participant")return $;$=$.parent}},d=gt(e,"participant.add"),h=gt(e,"node.add"),g=gt(e,"sequenceFlow.add"),_=gt(e,"messageFlow.add"),R=gt(e,"dataStore.add"),x=gt(e,"dataAssociation.add"),E=gt(e,"annotation.add"),b=gt(e,"group.add"),S=new Map(h.map(M=>[M.node.id,M])),T=(M,$,w)=>{var j;const v=M.businessObject,m=(((j=v.extensionElements)==null?void 0:j.values)??[]).filter(q=>q.$type!==$),P=w?[...m,i.create($,w)]:m;if(!P.length){v.extensionElements&&n.updateProperties(M,{extensionElements:void 0});return}const k=i.create("bpmn:ExtensionElements",{values:P});P.forEach(q=>{q.$parent=k}),n.updateProperties(M,{extensionElements:k})},O=M=>({anchor:M.anchor,side:M.side,...M.offset!==void 0?{offset:M.offset}:{}});for(const M of gt(e,"element.remove")){const $=l(M.id);$&&n.removeElements([$])}const C=M=>o.filter($=>{var w;return $.type==="bpmn:Lane"&&((w=f($))==null?void 0:w.id)===M}).sort(($,w)=>$.y-w.y);for(const M of gt(e,"participant.update")){const $=p(M.id);if(M.name!==void 0&&n.updateProperties($,{name:M.name??void 0}),!M.lanes)continue;const w=C(M.id);if(!w.length){n.splitLane($,M.lanes.length),C(M.id).forEach((m,P)=>{const k=M.lanes[P];k&&n.updateProperties(m,{id:k.id,name:k.name})});continue}const v=new Set(w.map(m=>m.id));M.lanes.forEach((m,P)=>{if(v.has(m.id)){n.updateProperties(p(m.id),{name:m.name});return}const k=P===0?n.addLane(C(M.id)[0],"top"):n.addLane(p(M.lanes[P-1].id),"bottom");n.updateProperties(k,{id:m.id,name:m.name})})}const F=d.map((M,$)=>({op:M,declared:$}));F.sort((M,$)=>{const w=M.op.order??Number.POSITIVE_INFINITY,v=$.op.order??Number.POSITIVE_INFINITY;return w!==v?w-v:M.declared-$.declared});let N=80;for(const M of o.getAll())M.parent===u()&&"height"in M&&typeof M.y=="number"&&(N=Math.max(N,M.y+M.height+60));for(const{op:M}of F){const $=M.participant,w=h.filter(J=>J.node.participant===$.id).length,v=((Y=$.lanes)==null?void 0:Y.length)??0,m=Math.max(1200,w*160+300),P=$.blackBox||w+v===0?120:Math.max(300,v*180),k=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:$.id,name:$.name,...M.order!==void 0?{"bwl:poolOrder":M.order}:{},...$.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:m,height:P,isExpanded:!0}),j=n.createShape(k,{x:100+m/2,y:N+P/2},u()),q=$.lanes??[];q.length&&n.splitLane(j,q.length),q.length&&o.filter(ve=>{var de;return ve.type==="bpmn:Lane"&&((de=f(ve))==null?void 0:de.id)===$.id}).sort((ve,de)=>ve.y-de.y).forEach((ve,de)=>{const _e=q[de];_e&&n.updateProperties(ve,{id:_e.id,name:_e.name})}),N=j.y+j.height+60}const I=M=>{var v;const $=S.get(M);if($)return $.node.participant??"";const w=l(M);return w?w.type==="bpmn:Participant"?w.id:((v=f(w))==null?void 0:v.id)??"":""},W=new Map,re=M=>{let $=W.get(M);return $||W.set(M,$={nodes:[],flows:[]}),$};for(const M of h)re(M.node.participant??"").nodes.push(M);for(const M of g)re(I(M.flow.source)).flows.push(M);const Pe=M=>{var $;return i.create("bpmn:SequenceFlow",{id:M.id,name:M.name??(($=M.condition)==null?void 0:$.label)})},Qe=(M,$)=>r.createShape({type:Ho(M.type),businessObject:i.create(Ho(M.type),{id:M.id,name:M.name,...$!==void 0?{"bwl:band":$}:{}})});for(const[M,$]of W){const w=M?p(M):void 0,v=w?w.x+150:250;let m=w?w.y+80:120;const P=de=>{const _e=p(de);return _e.y+_e.height/2},k=(de,_e)=>de.node.lane?P(de.node.lane):de.band!==void 0&&w?w.y+80+de.band*150:_e,j=de=>de.participant?p(de.participant):u(),q=new Set($.flows.map(de=>de.flow.target));for(const de of $.nodes)q.has(de.node.id)||(n.createShape(Qe(de.node,de.band),{x:v,y:k(de,m)},j(de.node)),!de.node.lane&&de.band===void 0&&(m+=160));const J=new Set;let ve=0;for(;ve++<$.nodes.length+2;){for(let Ve=0;Ve<$.nodes.length+$.flows.length+2;Ve++){let dt=!1;for(const Rt of $.flows){const Re=Rt.flow;if(J.has(Re.id))continue;const Ne=l(Re.source);if(!Ne)continue;const ht=l(Re.target),cn=S.get(Re.target);if(!ht&&cn){const Gt=Qe(cn.node,cn.band);if(cn.node.lane){const Pn=n.createShape(Gt,{x:Ne.x+Ne.width+130,y:P(cn.node.lane)},j(cn.node));n.connect(Ne,Pn,{type:"bpmn:SequenceFlow",businessObject:Pe(Re)})}else s.append(Ne,Gt,{connection:{type:"bpmn:SequenceFlow",businessObject:Pe(Re)}})}else if(ht)n.connect(Ne,ht,{type:"bpmn:SequenceFlow",businessObject:Pe(Re)});else continue;J.add(Re.id),dt=!0}if(!dt)break}const de=$.nodes.filter(Ve=>!l(Ve.node.id));if(!de.length)break;const _e=de[0];n.createShape(Qe(_e.node,_e.band),{x:v,y:k(_e,m)},j(_e.node)),!_e.node.lane&&_e.band===void 0&&(m+=160)}}const U=(M,$)=>{const w=$.target===M,v=p($.source),m=p($.target),P=w?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(v,m,$.id?{type:P,businessObject:i.create(P,{id:$.id})}:{type:P})};for(const M of R){const $=M.associations??[],w=$.map(P=>P.source===M.dataStore.id?P.target:P.source).map(l).find(Boolean),v=w?f(w)??u():u(),m=w?{x:w.x+w.width/2,y:w.y+w.height+110}:{x:200,y:N+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:M.dataStore.id,name:M.dataStore.name})},m,v);for(const P of $)U(M.dataStore.id,P)}for(const M of x){const w=p(M.association.target).type==="bpmn:DataStoreReference"?M.association.target:M.association.source;U(w,M.association)}for(const M of _){const $=M.flow;n.connect(p($.source),p($.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:$.id,name:$.name})})}let ee=0;for(const M of b){const $=(M.group.members??[]).map(l).filter(P=>!!P),w=40;let v;if($.length){const P=Math.min(...$.map(J=>J.x))-w,k=Math.min(...$.map(J=>J.y))-w,j=Math.max(...$.map(J=>J.x+J.width))+w,q=Math.max(...$.map(J=>J.y+J.height))+w;v={x:P,y:k,width:j-P,height:q-k}}else v={x:300+ee*350,y:40,width:300,height:200},ee++;const m=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:M.group.id}),width:v.width,height:v.height},{x:v.x+v.width/2,y:v.y+v.height/2},u());M.group.name&&n.updateLabel(m,M.group.name),(B=M.group.members)!=null&&B.length&&T(m,"bwl:Members",{refs:M.group.members.join(" ")})}const oe=M=>{const $=M.waypoints;if($!=null&&$.length){const v=$[Math.floor(($.length-1)/2)];return{x:v.x,y:v.y,width:0,height:0}}const w=M;return{x:w.x,y:w.y,width:w.width,height:w.height}};let Q=0;const ne={width:100,height:30};for(const M of E){const $=M.association,w=((L=M.placement)==null?void 0:L.anchor)??($?$.source===M.annotation.id?$.target:$.source:void 0),v=w?l(w):void 0,m=v?oe(v):void 0;let P;if(m&&M.placement){const[q,J]=wp[M.placement.side],ve=M.placement.offset??50;P={x:m.x+m.width/2+q*(m.width/2+ne.width/2+ve),y:m.y+m.height/2+J*(m.height/2+ne.height/2+ve)}}else m?(P={x:m.x+m.width/2+180+Q%3*260,y:m.y-110-Q%2*95},Q++):(P={x:300+Q*260,y:60},Q++);const k=v?f(v)??u():u(),j=n.createShape({type:"bpmn:TextAnnotation",businessObject:i.create("bpmn:TextAnnotation",{id:M.annotation.id,text:M.annotation.text})},P,k);if($){const q=J=>J===M.annotation.id?j:p(J);n.connect(q($.source),q($.target),$.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:$.id})}:{type:"bpmn:Association"})}M.placement&&T(j,"bwl:Placement",O(M.placement))}for(const M of gt(e,"association.add")){const $=M.association;n.connect(p($.source),p($.target),$.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:$.id})}:{type:"bpmn:Association"})}for(const M of gt(e,"node.update")){let $=p(M.id);if(M.type&&Ho(M.type)!==$.type&&($=c.replaceElement($,{type:Ho(M.type)})),M.name!==void 0&&n.updateProperties($,{name:M.name??void 0}),M.lane){const w=p(M.lane),v=w.y+w.height/2-($.y+$.height/2);v!==0&&n.moveElements([$],{x:0,y:v})}}for(const M of gt(e,"sequenceFlow.update")){const $=p(M.id);M.name!==void 0&&n.updateProperties($,{name:M.name??void 0}),M.condition!==void 0&&n.updateProperties($,{name:((H=M.condition)==null?void 0:H.label)??void 0})}for(const M of gt(e,"messageFlow.update"))M.name!==void 0&&n.updateProperties(p(M.id),{name:M.name??void 0});for(const M of gt(e,"dataStore.update"))M.name!==void 0&&n.updateProperties(p(M.id),{name:M.name??void 0});for(const M of gt(e,"annotation.update")){const $=p(M.id);if(M.text!==void 0&&n.updateProperties($,{text:M.text}),M.placement===null)T($,"bwl:Placement",null);else if(M.placement){const w=oe(p(M.placement.anchor)),[v,m]=wp[M.placement.side],P=M.placement.offset??50,k=w.x+w.width/2+v*(w.width/2+$.width/2+P),j=w.y+w.height/2+m*(w.height/2+$.height/2+P);n.moveElements([$],{x:k-($.x+$.width/2),y:j-($.y+$.height/2)}),T($,"bwl:Placement",O(M.placement))}}for(const M of gt(e,"group.update")){const $=p(M.id);if(M.name!==void 0&&n.updateLabel($,M.name??""),M.members){const w=M.members.map(l).filter(v=>!!v);if(w.length){const m=Math.min(...w.map(q=>q.x))-40,P=Math.min(...w.map(q=>q.y))-40,k=Math.max(...w.map(q=>q.x+q.width))+40,j=Math.max(...w.map(q=>q.y+q.height))+40;n.resizeShape($,{x:m,y:P,width:k-m,height:j-P})}T($,"bwl:Members",{refs:M.members.join(" ")})}}}function Rp(e,t,n=Sp){const i=xp(e),r=Ep(t,yp(i.elementRegistry));if(r.length)return{ok:!1,issues:r};const o=e.get("commandStack");try{return hp(o,()=>n(t,i)),{ok:!0,issues:[]}}catch(a){return{ok:!1,issues:[{kind:"lower-failed",message:a instanceof Error?a.message:String(a)}]}}}function rc(e){return Array.prototype.concat.apply([],e)}const Or=Object.prototype.toString,P_=Object.prototype.hasOwnProperty;function Ri(e){return e===void 0}function Je(e){return e!==void 0}function Yi(e){return e==null}function ae(e){return Or.call(e)==="[object Array]"}function rt(e){return Or.call(e)==="[object Object]"}function ue(e){return Or.call(e)==="[object Number]"}function ot(e){const t=Or.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Tt(e){return Or.call(e)==="[object String]"}function A_(e){if(!ae(e))throw new Error("must supply array")}function Mt(e,t){return!Yi(e)&&P_.call(e,t)}function Oe(e,t){const n=Vo(t);let i;return A(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Cp(e,t){const n=Vo(t);let i=ae(e)?-1:void 0;return A(e,function(r,o){if(n(r,o))return i=o,!1}),i}function ye(e,t){const n=Vo(t);let i=[];return A(e,function(r,o){n(r,o)&&i.push(r)}),i}function A(e,t){let n,i;if(Ri(e))return;const r=ae(e)?O_:D_;for(let o in e)if(Mt(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function T_(e,t){if(Ri(e))return[];A_(e);const n=Vo(t);return e.filter(function(i,r){return!n(i,r)})}function kt(e,t,n){return A(e,function(i,r){n=t(n,i,r)}),n}function Ci(e,t){return!!kt(e,function(n,i,r){return n&&t(i,r)},!0)}function qn(e,t){return!!Oe(e,t)}function vt(e,t){let n=[];return A(e,function(i,r){n.push(t(i,r))}),n}function zo(e){return e&&Object.keys(e)||[]}function M_(e){return zo(e).length}function Ki(e){return vt(e,t=>t)}function Xi(e,t,n={}){return t=oc(t),A(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Pp(e,...t){e=oc(e);let n={};return A(t,r=>Xi(r,e,n)),vt(n,function(r,o){return r[0]})}const k_=Pp;function ln(e,t){t=oc(t);let n=[];return A(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),vt(n,i=>i.v)}function Zi(e){return function(t){return Ci(e,function(n,i){return t[i]===n})}}function oc(e){return ot(e)?e:t=>t[e]}function Vo(e){return ot(e)?e:t=>t===e}function D_(e){return e}function O_(e){return Number(e)}function ac(e,t){let n,i,r,o;function a(p){let f=Date.now(),d=p?0:o+t-f;if(d>0)return s(d);e.apply(r,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...p){o=Date.now(),i=p,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function Ct(e,t){return e.bind(t)}function D(e,...t){return Object.assign(e,...t)}function I_(e,t,n){let i=e;return A(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];Je(a)&&Yi(s)&&(s=i[r]=isNaN(+a)?{}:[]),Ri(a)?Ri(n)?delete i[r]:i[r]=n:i=s}),e}function on(e,t){let n={},i=Object(e);return A(t,function(r){r in i&&(n[r]=e[r])}),n}function pn(e,t){let n={},i=Object(e);return A(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function sc(){}sc.prototype.get=function(e){return this.$model.properties.get(this,e)},sc.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Ap(e,t){this.model=e,this.properties=t}Ap.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(sc.prototype);A(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),A(a,Ct(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var L_=D(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Tp=D(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function cc(e,t){var n=Tp[e];return n?n(t):t}function uc(e){return!!L_[e]}function Mp(e){return!!Tp[e]}function yt(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function Ft(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Ft.prototype.build=function(){return on(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Ft.prototype.addProperty=function(e,t,n){typeof t=="boolean"&&(n=t,t=void 0),this.addNamedProperty(e,n!==!1);var i=this.properties;t!==void 0?i.splice(t,0,e):i.push(e)},Ft.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},Ft.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=yt(r[0],i),a=yt(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},Ft.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},Ft.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Ft.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},Ft.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},Ft.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Ft.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},Ft.prototype.hasProperty=function(e){return this.propertiesByName[e]},Ft.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(A(e.properties,Ct(function(o){o=D({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Yn(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,A(e,Ct(this.registerPackage,this))}Yn.prototype.getPackage=function(e){return this.packageMap[e]},Yn.prototype.getPackages=function(){return this.packages},Yn.prototype.registerPackage=function(e){e=D({},e);var t=this.packageMap;kp(t,e,"prefix"),kp(t,e,"uri"),A(e.types,Ct(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Yn.prototype.registerType=function(e,t){e=D({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:D({},e.meta||{})});var n=yt(e.name,t.prefix),i=n.name,r=Object.create(null);A(e.properties,Ct(function(o){var a=yt(o.name,n.prefix),s=a.name;uc(o.type)||(o.type=yt(o.type,a.prefix).name),D(o,{ns:a,name:s}),r[s]=o},this)),D(e,{ns:n,name:i,propertiesByName:r}),A(e.extends,Ct(function(o){var a=yt(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Yn.prototype.mapTypes=function(e,t,n){var i=uc(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=yt(c,uc(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");A(i.superClass,n?a:s),t(i,!n),A(i.traits,a)},Yn.prototype.getEffectiveDescriptor=function(e){var t=yt(e),n=new Ft(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Yn.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function kp(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Pi(e){this.model=e}Pi.prototype.set=function(e,t,n){if(!Tt(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;B_(n)?i?delete e[r]:delete e.$attrs[lc(t)]:i?r in e?e[r]=n:Dp(e,i,n):e.$attrs[lc(t)]=n},Pi.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[lc(t)];var i=n.name;return!e[i]&&n.isMany&&Dp(e,n,[]),e[i]},Pi.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=D({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Pi.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Pi.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Pi.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"&&console.warn(o)}return null};function B_(e){return typeof e>"u"}function Dp(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function lc(e){return e.replace(/^:/,"")}function Wt(e,t={}){this.properties=new Pi(this),this.factory=new Ap(this,this.properties),this.registry=new Yn(e,this.properties),this.typeCache=Object.create(null),this.config=t}Wt.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Wt.prototype.getType=function(e){var t=this.typeCache,n=Tt(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Wt.prototype.createAny=function(e,t,n){var i=yt(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){I_(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),A(n,function(a,s){rt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Wt.prototype.getPackage=function(e){return this.registry.getPackage(e)},Wt.prototype.getPackages=function(){return this.registry.getPackages()},Wt.prototype.getElementDescriptor=function(e){return e.$descriptor},Wt.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Wt.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Wt.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Op=String.fromCharCode,N_=Object.prototype.hasOwnProperty,$_=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Ir={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Ir).forEach(function(e){Ir[e.toUpperCase()]=Ir[e]});function j_(e,t,n,i){return i?N_.call(Ir,i)?Ir[i]:"&"+i+";":Op(t||parseInt(n,16))}function Ai(e){return e.length>3&&e.indexOf("&")!==-1?e.replace($_,j_):e}var Ip="non-whitespace outside of root node";function Kn(e){return new Error(e)}function F_(e){return"missing namespace for prefix <"+e+">"}function Go(e){return{get:e,enumerable:!0}}function H_(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Lp=Symbol("nameCache");function pc(e){return e+"$uri"}function z_(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[pc(i)]=n;return t}function Wo(){return{line:0,column:0}}function V_(e){throw e}function Bp(e){if(!this)return new Bp(e);var t=e&&e.proxy,n,i,r,o,a=V_,s,c,u,l,p=Wo,f=!1,d=!1,h="",g=!1,_=!1,R=null,x=!1,E,b,S,T;function O(I){I instanceof Error||(I=Kn(I)),R=I,a(I,p)}function C(I){s&&(I instanceof Error||(I=Kn(I)),s(I,p))}this.on=function(I,W){if(typeof W!="function")throw Kn("required args <name, cb>");switch(I){case"openTag":i=W;break;case"text":n=W;break;case"closeTag":r=W;break;case"error":a=W;break;case"warn":s=W;break;case"cdata":o=W;break;case"attention":l=W;break;case"question":u=W;break;case"comment":c=W;break;default:throw Kn("unsupported event: "+I)}return this},this.ns=function(I){if(typeof I>"u"&&(I={}),typeof I!="object")throw Kn("required args <nsMap={}>");var W=Object.create(null),re;for(re in I)W[re]=I[re];return _=!0,T=W,this};function F(){E=_?[]:null,b=_?z_(T):null,S=[],p=Wo,x=!1,R=null,d=!1,h=""}this.parse=function(I){if(typeof I!="string")throw Kn("required args <xml=string>");if(f)throw Kn("parse during stream; call end() first");return F(),N(I),p=Wo,x=!1,R},this.write=function(I){if(typeof I!="string")throw Kn("required args <xml=string>");return f||(F(),f=!0),R||(h=N(h+I,!0)||""),this},this.end=function(){return f||F(),f=!1,R||N(h),h="",p=Wo,x=!1,R},this.stop=function(){x=!0};function N(I,W=!1){var re=null,Pe=null,Qe,U=0,ee=!1,oe=!1,Q=0,ne=0,Y,B,L,H,M,$,w,v,m,P="",k=0,j;function q(_e,Ve){var dt=_e.indexOf(":");if(dt===-1)return _e;var Rt=b[_e.substring(0,dt)];return Rt?Ve===Rt?_e.substr(dt+1):Rt+_e.substr(dt):(C(F_(_e.substring(0,dt))),null)}function J(){if(j!==null)return j;var _e,Ve,dt=_&&b.xmlns,Rt=_&&g?[]:null,Re=k,Ne=P,ht=Ne.length,cn,Gt,Pn,An,ct,jo={},a_=new Set,un,Ce,De;e:for(;Re<ht;Re++)if(un=!1,Ce=Ne.charCodeAt(Re),!(Ce===32||Ce<14&&Ce>8)){for((Ce<65||Ce>122||Ce>90&&Ce<97)&&Ce!==95&&Ce!==58&&(C("illegal first char attribute name"),un=!0),De=Re+1;De<ht;De++)if(Ce=Ne.charCodeAt(De),!(Ce>96&&Ce<123||Ce>64&&Ce<91||Ce>47&&Ce<59||Ce===46||Ce===45||Ce===95)){if(Ce===32||Ce<14&&Ce>8){C("missing attribute value"),Re=De;continue e}if(Ce===61)break;C("illegal attribute name char"),un=!0}if(ct=Ne.substring(Re,De),ct==="xmlns:xmlns"&&(C("illegal declaration of xmlns"),un=!0),Ce=Ne.charCodeAt(De+1),Ce===34)De=Ne.indexOf('"',Re=De+2),De===-1&&(De=Ne.indexOf("'",Re),De!==-1&&(C("attribute value quote missmatch"),un=!0));else if(Ce===39)De=Ne.indexOf("'",Re=De+2),De===-1&&(De=Ne.indexOf('"',Re),De!==-1&&(C("attribute value quote missmatch"),un=!0));else for(C("missing attribute value quotes"),un=!0,De=De+1;De<ht&&(Ce=Ne.charCodeAt(De+1),!(Ce===32||Ce<14&&Ce>8));De++);for(De===-1&&(C("missing closing quotes"),De=ht,un=!0),un||(Pn=Ne.substring(Re,De)),Re=De;De+1<ht&&(Ce=Ne.charCodeAt(De+1),!(Ce===32||Ce<14&&Ce>8));De++)Re===De&&(C("illegal character after attribute end"),un=!0);if(Re=De+1,un)continue e;if(a_.has(ct)){C("attribute <"+ct+"> already defined");continue}if(a_.add(ct),!_){jo[ct]=Pn;continue}if(g){if(Gt=ct==="xmlns"?"xmlns":ct.charCodeAt(0)===120&&ct.substr(0,6)==="xmlns:"?ct.substr(6):null,Gt!==null){if(_e=Ai(Pn),Ve=pc(Gt),An=T[_e],!An){if(Gt==="xmlns"||Ve in b&&b[Ve]!==_e)do An="ns"+U++;while(typeof b[An]<"u");else An=Gt;T[_e]=An}b[Gt]!==An&&(cn||(b=H_(b),cn=!0),b[Gt]=An,Gt==="xmlns"&&(b[pc(An)]=_e,dt=An),b[Ve]=_e),jo[ct]=Pn;continue}Rt.push(ct,Pn);continue}ct=q(ct,dt),ct!==null&&(jo[ct]=Pn)}if(g)for(Re=0,ht=Rt.length;Re<ht;Re++)ct=q(Rt[Re++],dt),Pn=Rt[Re],ct!==null&&(jo[ct]=Pn);return j=jo}function ve(){for(var _e=/(\r\n|\r|\n)/g,Ve=0,dt=0,Rt=0,Re=ne,Ne,ht;Q>=Rt&&(Ne=_e.exec(I),!(!Ne||(Re=Ne[0].length+Ne.index,Re>Q)));)Ve+=1,Rt=Re;return Q==-1?(dt=Re,ht=I.substring(ne)):ne===0?ht=I.substring(ne,Q):(dt=Q-Rt,ht=ne==-1?I.substring(Q):I.substring(Q,ne+1)),{data:ht,line:Ve,column:dt}}for(p=ve,t&&(m=Object.create({},{name:Go(function(){return w}),originalName:Go(function(){return v}),attrs:Go(J),ns:Go(function(){return b})}));ne!==-1;){if(I.charCodeAt(ne)===60?Q=ne:Q=I.indexOf("<",ne),Q===-1){if(W)return I.substring(ne);if(S.length)return O("unexpected end of file");if(!d)return O("missing start tag");ne<I.length&&I.substring(ne).trim()&&C(Ip);return}if(d||(d=!0),ne!==Q){if(S.length){if(n&&(n(I.substring(ne,Q),Ai,p),x))return}else if(I.substring(ne,Q).trim()&&(C(Ip),x))return}if(H=I.charCodeAt(Q+1),H===33){if(L=I.charCodeAt(Q+2),L===91&&I.substr(Q+3,6)==="CDATA["){if(ne=I.indexOf("]]>",Q),ne===-1)return W?I.substring(Q):O("unclosed cdata");if(o&&(o(I.substring(Q+9,ne),p),x))return;ne+=3;continue}if(L===45&&I.charCodeAt(Q+3)===45){if(ne=I.indexOf("-->",Q),ne===-1)return W?I.substring(Q):O("unclosed comment");if(c&&(c(I.substring(Q+4,ne),Ai,p),x))return;ne+=3;continue}}if(H===63){if(ne=I.indexOf("?>",Q),ne===-1)return W?I.substring(Q):O("unclosed question");if(u&&(u(I.substring(Q,ne+2),p),x))return;ne+=2;continue}for(Y=Q+1;;Y++){if(M=I.charCodeAt(Y),isNaN(M))return W?I.substring(Q):(ne=-1,O("unclosed tag"));if(M===34)L=I.indexOf('"',Y+1),Y=L!==-1?L:Y;else if(M===39)L=I.indexOf("'",Y+1),Y=L!==-1?L:Y;else if(M===62){ne=Y;break}}if(H===33){if(l&&(l(I.substring(Q,ne+1),Ai,p),x))return;ne+=1;continue}if(j={},H===47){if(ee=!1,oe=!0,!S.length)return O("missing open tag");if(Y=w=S.pop(),L=Q+2+Y.length,I.substring(Q+2,L)!==Y)return O("closing tag mismatch");for(;L<ne;L++)if(H=I.charCodeAt(L),!(H===32||H>8&&H<14))return O("close tag")}else{if(I.charCodeAt(ne-1)===47?(Y=w=I.substring(Q+1,ne-1),ee=!0,oe=!0):(Y=w=I.substring(Q+1,ne),ee=!0,oe=!1),!(H>96&&H<123||H>64&&H<91||H===95||H===58))return O("illegal first char nodeName");for(L=1,B=Y.length;L<B;L++)if(H=Y.charCodeAt(L),!(H>96&&H<123||H>64&&H<91||H>47&&H<59||H===45||H===95||H==46)){if(H===32||H<14&&H>8){w=Y.substring(0,L),j=null;break}return O("invalid nodeName")}oe||S.push(w)}if(_){Qe=b,ee&&(oe||E.push(Qe),j===null&&(g=Y.indexOf("xmlns",L)!==-1)&&(k=L,P=Y,J(),g=!1)),v=w,Pe!==b&&(re=b[Lp],re===void 0&&(re=b[Lp]=Object.create(null)),Pe=b);var de=re[w];if(de!==void 0)w=de;else{if(H=w.indexOf(":"),H!==-1){if($=b[w.substring(0,H)],!$)return O("missing namespace on <"+v+">");w=w.substr(H+1)}else $=b.xmlns;$&&(w=$+":"+w),re[v]=w}}if(ee&&(k=L,P=Y,i&&(t?i(m,Ai,oe,p):i(w,J,Ai,oe,p),x)))return;if(oe){if(r&&(r(t?m:w,Ai,ee,p),x))return;_&&(ee?b=Qe:b=E.pop())}ne+=1}}}function Np(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var fc={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},$p="property";function jp(e){return e.xml&&e.xml.serialize}function G_(e){const t=jp(e);return t!==$p&&(t||null)}function W_(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Fp(e,t){return Np(t)?e.prefix+":"+W_(e.localName):e.name}function U_(e,t){var n=e.name,i=e.localName,r=t&&t.xml&&t.xml.typePrefix;return r&&i.indexOf(r)===0?e.prefix+":"+i.slice(r.length):n}function q_(e,t,n){const i=yt(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=yt(r);var a=n.getPackage(o.prefix);return U_(o,a)}function Xn(e){return new Error(e)}function Mn(e){return e.$descriptor}function Y_(e){D(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Xn("expected element");var n=this.elementsById,i=Mn(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Xn("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Lr(){}Lr.prototype.handleEnd=function(){},Lr.prototype.handleText=function(){},Lr.prototype.handleNode=function(){};function dc(){}dc.prototype=Object.create(Lr.prototype),dc.prototype.handleNode=function(){return this};function Qi(){}Qi.prototype=Object.create(Lr.prototype),Qi.prototype.handleText=function(e){this.body=(this.body||"")+e};function Br(e,t){this.property=e,this.context=t}Br.prototype=Object.create(Qi.prototype),Br.prototype.handleNode=function(e){if(this.element)throw Xn("expected no sub nodes");return this.element=this.createReference(e),this},Br.prototype.handleEnd=function(){this.element.id=this.body},Br.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function hc(e,t){this.element=t,this.propertyDesc=e}hc.prototype=Object.create(Qi.prototype),hc.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=cc(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Uo(){}Uo.prototype=Object.create(Qi.prototype),Uo.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function xt(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}xt.prototype=Object.create(Uo.prototype),xt.prototype.addReference=function(e){this.context.addReference(e)},xt.prototype.handleText=function(e){var t=this.element,n=Mn(t),i=n.bodyProperty;if(!i)throw Xn("unexpected body text <"+e+">");Qi.prototype.handleText.call(this,e)},xt.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Mn(t),i=n.bodyProperty;i&&e!==void 0&&(e=cc(i.type,e),t.set(i.name,e))},xt.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Mn(n),r=this.context,o=new n({}),a=this.model,s;return A(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),A(p,function(f){r.addReference({element:o,property:l.ns.name,id:f})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=cc(l.type,c):u==="xmlns"?u=":"+u:(s=yt(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},xt.prototype.getPropertyForNode=function(e){var t=e.name,n=yt(t),i=this.type,r=this.model,o=Mn(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=G_(s);if(u){const l=e.attributes[u];if(l){const p=q_(l,e.ns,r),f=r.getType(p);return D({},s,{effectiveType:Mn(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Fp(n,c),l=r.getType(u);if(s=Oe(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return D({},s,{effectiveType:Mn(l).name})}else if(s=Oe(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Xn("unrecognized element <"+n.name+">")},xt.prototype.toString=function(){return"ElementDescriptor["+Mn(this.type).name+"]"},xt.prototype.valueHandler=function(e,t){return new hc(e,t)},xt.prototype.referenceHandler=function(e){return new Br(e,this.context)},xt.prototype.handler=function(e){return e==="Element"?new Ji(this.model,e,this.context):new xt(this.model,e,this.context)},xt.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Mp(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(D(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function mc(e,t,n){xt.call(this,e,t,n)}mc.prototype=Object.create(xt.prototype),mc.prototype.createElement=function(e){var t=e.name,n=yt(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Fp(n,o)||t;if(!r.hasType(a))throw Xn("unexpected element <"+e.originalName+">");return xt.prototype.createElement.call(this,e)};function Ji(e,t,n){this.model=e,this.context=n}Ji.prototype=Object.create(Uo.prototype),Ji.prototype.createElement=function(e){var t=e.name,n=yt(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Ji.prototype.handleChild=function(e){var t=new Ji(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},Ji.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function gc(e){e instanceof Wt&&(e={model:e}),D(this,{lax:!1},e)}gc.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof xt?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new Y_(D({},t,{rootHandler:i})),s=new Bp({proxy:!0}),c=K_();i.context=a,c.push(i);function u(S,T,O){var C=T(),F=C.line,N=C.column,I=C.data;I.charAt(0)==="<"&&I.indexOf(" ")!==-1&&(I=I.slice(0,I.indexOf(" "))+">");var W="unparsable content "+(I?I+" ":"")+`detected
2
- line: `+F+`
3
- column: `+N+`
4
- nested error: `+S.message;if(O)return a.addWarning({message:W,error:S}),!0;throw Xn(W)}function l(S,T){return u(S,T,!0)}function p(){var S=a.elementsById,T=a.references,O,C;for(O=0;C=T[O];O++){var F=C.element,N=S[C.id],I=Mn(F).propertiesByName[C.property];if(N||a.addWarning({message:"unresolved reference <"+C.id+">",element:C.element,property:C.property,value:C.id}),I.isMany){var W=F.get(I.name),re=W.indexOf(C);re===-1&&(re=W.length),N?W[re]=N:W.splice(re,1)}else F.set(I.name,N)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,g=/^utf-8$/i;function _(S){if(d.test(S)){var T=h.exec(S),O=T&&T[1];!O||g.test(O)||a.addWarning({message:"unsupported document encoding <"+O+">, falling back to UTF-8"})}}function R(S,T){var O=c.peek();try{c.push(O.handleNode(S))}catch(C){u(C,T,o)&&c.push(new dc)}}function x(S,T){try{c.peek().handleText(S)}catch(O){l(O,T)}}function E(S,T){S.trim()&&x(S,T)}var b=r.getPackages().reduce(function(S,T){return S[T.uri]=T.prefix,S},Object.entries(fc).reduce(function(S,[T,O]){return S[O]=T,S},r.config&&r.config.nsMap||{}));return s.ns(b).on("openTag",function(S,T,O,C){var F=S.attrs||{},N=Object.keys(F).reduce(function(W,re){var Pe=T(F[re]);return W[re]=Pe,W},{}),I={name:S.name,originalName:S.originalName,attributes:N,ns:S.ns};R(I,C)}).on("question",_).on("closeTag",f).on("cdata",x).on("text",function(S,T,O){E(T(S),O)}).on("error",u).on("warn",l),new Promise(function(S,T){var O;try{s.parse(e),p()}catch(W){O=W}var C=i.element;!O&&!C&&(O=Xn("failed to parse document as <"+i.type.$descriptor.name+">"));var F=a.warnings,N=a.references,I=a.elementsById;return O?(O.warnings=F,T(O)):S({rootElement:C,elementsById:I,references:N,warnings:F})})},gc.prototype.handler=function(e){return new mc(this.model,e)};function K_(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var X_=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,Z_=/<|>|'|"|&|\n\r|\n/g,Hp=/<|>|&/g;function fn(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}fn.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},fn.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},fn.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},fn.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},fn.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},fn.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},fn.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},fn.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},fn.prototype.getUsed=function(e){var t=[].concat(this.wellknown,this.custom);return t.filter(n=>{var i=this.getNSKey(n);return this.used[i]})};function Q_(e){return e.charAt(0).toLowerCase()+e.slice(1)}function J_(e,t){return Np(t)?Q_(e):e}function zp(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Vp(e){return Tt(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function eb(e){return e.getUsed().filter(function(t){return t.prefix!=="xml"}).map(function(t){var n="xmlns"+(t.prefix?":"+t.prefix:"");return{name:n,value:t.uri}})}function tb(e,t){return t.isGeneric?D({localName:t.ns.localName},e):D({localName:J_(t.ns.localName,t.$pkg)},e)}function nb(e,t){return D({localName:t.ns.localName},e)}function ib(e){var t=e.$descriptor;return ye(t.properties,function(n){var i=n.name;if(n.isVirtual||!Mt(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var rb={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},ob={"<":"lt",">":"gt","&":"amp"};function Gp(e,t,n){return e=Tt(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function ab(e){return Gp(e,Z_,rb)}function sb(e){return Gp(e,Hp,ob)}function cb(e){return ye(e,function(t){return t.isAttr})}function ub(e){return ye(e,function(t){return!t.isAttr})}function vc(e){this.tagName=e}vc.prototype.build=function(e){return this.element=e,this},vc.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Ti(){}Ti.prototype.serializeValue=Ti.prototype.serializeTo=function(e){e.append(this.escape?sb(this.value):this.value)},Ti.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Hp)!==-1&&(this.escape=!0),this};function yc(e){this.tagName=e}zp(yc,Ti),yc.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Le(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Le.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,r,o=t.isGeneric;return o?i=this.parseGenericNsAttributes(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),o?this.parseGenericContainments(e):(r=ib(e),this.parseAttributes(cb(r)),this.parseContainments(ub(r))),this.parseGenericAttributes(e,i),this},Le.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return tb(t,e)},Le.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return nb(t,e)},Le.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Le.prototype.nsAttributeName=function(e){var t;if(Tt(e)?t=yt(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:D({localName:t.localName},n)},Le.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter(([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n)).map(([t,n])=>({name:t,value:n}))},Le.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Ti().build({type:"String"},t));var n=e.$children;n&&A(n,i=>{this.body.push(new Le(this).build(i))})},Le.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=yt(t),o;if(r.prefix==="xmlns"&&(o={prefix:r.localName,uri:n}),!r.prefix&&r.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},Le.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return A(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},Le.prototype.parseGenericAttributes=function(e,t){var n=this;A(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(r){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,r)}})},Le.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;A(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Ti().build(r,o[0]));else if(Mp(r.type))A(o,function(u){n.push(new yc(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)A(o,function(u){n.push(new vc(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=jp(r);A(o,function(u){var l;c?c===$p?l=new Le(t,r):l=new qo(t,r,c):l=new Le(t),n.push(l.build(u))})}})},Le.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new fn(i):t=i),t},Le.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix,a=i.byUri(r);return(!a||n)&&i.add(e,t),i.mapPrefix(o,r),e},Le.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,r=e.uri,o,a,s;if(!i&&!r)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),r=r||s||n.uriByPrefix(i),!r)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(r),!e&&!i&&(e=this.logNamespace({uri:r},s===r,!0)),!e){for(o=i,a=1;n.uriByPrefix(o);)o=i+"_"+a++;e=this.logNamespace({prefix:o,uri:r},s===r)}return i&&n.mapPrefix(i,r),e},Le.prototype.parseAttributes=function(e){var t=this,n=this.element;A(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];A(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},Le.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Vp(e)},Le.prototype.addAttribute=function(e,t){var n=this.attrs;Tt(t)&&(t=ab(t));var i=Cp(n,function(o){return o.name.localName===e.localName&&o.name.uri===e.uri&&o.name.prefix===e.prefix}),r={name:e,value:t};i!==-1?n.splice(i,1,r):n.push(r)},Le.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=eb(n).concat(t)),A(t,function(i){e.append(" ").append(Vp(i.name)).append('="').append(i.value).append('"')})},Le.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Ti;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),A(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function qo(e,t,n){Le.call(this,e,t),this.serialization=n}zp(qo,Le),qo.prototype.parseNsAttributes=function(e){var t=Le.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},qo.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function lb(){this.value="",this.write=function(e){this.value+=e}}function pb(e,t){var n=[""];this.append=function(i){return e.write(i),this},this.appendNewLine=function(){return t&&e.write(`
6
- `),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function fb(e){e=D({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new lb,o=new pb(r,e.format);e.preamble&&o.append(X_);var a=new Le,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(db(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function db(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in fc)n[i]=fc[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function Yo(e,t){Wt.call(this,e,t)}Yo.prototype=Object.create(Wt.prototype),Yo.prototype.fromXML=function(e,t,n){Tt(t)||(n=t,t="bpmn:Definitions");var i=new gc(D({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Yo.prototype.toXML=function(e,t){var n=new fb(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var hb="BPMN20",mb="http://www.omg.org/spec/BPMN/20100524/MODEL",gb="bpmn",vb=[],yb=[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",isMany:!0,replaces:"FlowElementsContainer#laneSets",type:"LaneSet"},{name:"flowElements",isMany:!0,replaces:"FlowElementsContainer#flowElements",type:"FlowElement"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}},{name:"assignment",type:"Assignment",isMany:!0}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",isBody:!0,type:"String"}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isMany:!0,isVirtual:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity","InteractionNode"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],_b=[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],bb={tagAlias:"lowerCase",typePrefix:"t"},Eb={name:hb,uri:mb,prefix:gb,associations:vb,types:yb,enumerations:_b,xml:bb},xb="BPMNDI",wb="http://www.omg.org/spec/BPMN/20100524/DI",Sb="bpmndi",Rb=[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],Cb=[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],Pb=[],Ab={name:xb,uri:wb,prefix:Sb,types:Rb,enumerations:Cb,associations:Pb},Tb="DC",Mb="http://www.omg.org/spec/DD/20100524/DC",kb="dc",Db=[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],Ob=[],Ib={name:Tb,uri:Mb,prefix:kb,types:Db,associations:Ob},Lb="DI",Bb="http://www.omg.org/spec/DD/20100524/DI",Nb="di",$b=[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],jb=[],Fb={tagAlias:"lowerCase"},Hb={name:Lb,uri:Bb,prefix:Nb,types:$b,associations:jb,xml:Fb},zb="bpmn.io colors for BPMN",Vb="http://bpmn.io/schema/bpmn/biocolor/1.0",Gb="bioc",Wb=[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],Ub=[],qb=[],Yb={name:zb,uri:Vb,prefix:Gb,types:Wb,enumerations:Ub,associations:qb},Kb="BPMN in Color",Xb="http://www.omg.org/spec/BPMN/non-normative/color/1.0",Zb="color",Qb=[{name:"ColoredLabel",extends:["bpmndi:BPMNLabel"],properties:[{name:"color",isAttr:!0,type:"String"}]},{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"background-color",isAttr:!0,type:"String"},{name:"border-color",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"border-color",isAttr:!0,type:"String"}]}],Jb=[],e0=[],t0={name:Kb,uri:Xb,prefix:Zb,types:Qb,enumerations:Jb,associations:e0};const n0={bpmn:Eb,bpmndi:Ab,dc:Ib,di:Hb,bioc:Yb,color:t0};function Wp(e,t){const n=D({},n0,e);return new Yo(n,t)}const i0={name:"bpmn-i18n",uri:"http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",prefix:"i18n",types:[{name:"Translation",superClass:["Element"],properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"body",isBody:!0,type:"String"},{name:"target",isAttr:!0,type:"String",default:"@name"},{name:"textFormat",isAttr:"true",type:"String",default:"text/plain"}]}],enumerations:[],associations:[],xml:{tagAlias:"lowerCase",typePrefix:"t"}},r0="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Up="i18n",Ko={[Up]:i0,[ec]:fp};function qp(){return Wp(Ko)}const Yp=qp();async function Kp(e){const{rootElement:t,warnings:n}=await Yp.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function o0(e){const{xml:t}=await Yp.toXML(e,{format:!0});return t}function _c(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}function a0(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function s0(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Xp(e,t){const n=s0(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Zp(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function c0(e){return typeof e=="string"&&tc.includes(e)}function dn(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Qp(e){const t=e.rootElements??[],n=t.find(U=>U.$type==="bpmn:Collaboration"),i=new Map(t.filter(U=>U.$type==="bpmn:Process").map(U=>[U.id,U])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],h=[],g=[],_=[],R=new Set,x=new Set,E=U=>{U&&R.add(U)},b=U=>{R.add(U),x.add(U)},S=U=>{const ee=Zp(U,"bwl:Placement");if(!ee)return;const oe=typeof ee.anchor=="string"?ee.anchor:void 0;if(!oe||!c0(ee.side))return;const Q=typeof ee.offset=="number"?ee.offset:void 0;g.push({owner:U.id,anchor:oe,side:ee.side,...Q!==void 0?{offset:Q}:{}})},T=U=>{const ee=Zp(U,"bwl:Members"),oe=typeof(ee==null?void 0:ee.refs)=="string"?ee.refs.split(/\s+/).filter(Boolean):[];oe.length&&_.push({owner:U.id,refs:oe})},O=U=>{var ee;for(const oe of U)switch(E(oe.id),oe.$type){case"bpmn:TextAnnotation":b(oe.id),s.push({id:oe.id,text:typeof oe.text=="string"?oe.text:""}),S(oe);break;case"bpmn:Association":d.push({id:oe.id,type:oe.$type,source:dn(oe.sourceRef),target:dn(oe.targetRef)});break;case"bpmn:Group":{b(oe.id);const Q=(ee=oe.categoryValueRef)==null?void 0:ee.value;c.push({id:oe.id,...typeof Q=="string"&&Q?{name:Q}:{}}),T(oe);break}default:u.push({id:oe.id,type:oe.$type,reason:"type-outside-mvp"})}},C=(U,ee)=>{const oe=U.flowElements??[],Q=(U.laneSets??[]).flatMap(Y=>Y.lanes??[]),ne=new Map;for(const Y of Q){E(Y.id);for(const B of Y.flowNodeRef??[]){const L=dn(B);L&&ne.set(L,Y.id)}}for(const Y of oe){if(E(Y.id),Y.$type==="bpmn:SequenceFlow"){p.push({id:Y.id,source:dn(Y.sourceRef),target:dn(Y.targetRef),...typeof Y.name=="string"&&Y.name?{name:Y.name}:{}});continue}if(Y.$type==="bpmn:DataStoreReference"){b(Y.id),a.push({id:Y.id,...Y.name?{name:Y.name}:{}});continue}const B=a0(Y.$type);if(!lp(B)){u.push({id:Y.id,type:Y.$type,reason:"type-outside-mvp"});continue}b(Y.id),o.push({id:Y.id,type:B,...Y.name?{name:Y.name}:{},...ee?{participant:ee}:{},...ne.has(Y.id)?{lane:ne.get(Y.id)}:{}});const L=Xp(Y,"bwl:band");L!==void 0&&(l.bands[Y.id]=L);for(const H of Y.dataOutputAssociations??[])E(H.id),h.push({id:H.id,type:H.$type,source:Y.id,target:dn(H.targetRef)});for(const H of Y.dataInputAssociations??[])E(H.id),h.push({id:H.id,type:H.$type,source:dn((H.sourceRef??[])[0]),target:Y.id})}O(U.artifacts??[])};if(n){const U=new Set;for(const ee of n.participants??[]){b(ee.id);const oe=dn(ee.processRef);oe&&U.add(oe);const Q=oe?i.get(oe):void 0,ne=((Q==null?void 0:Q.laneSets)??[]).flatMap(H=>H.lanes??[]),Y=ne.map(H=>({id:H.id,...H.name?{name:H.name}:{}}));for(const H of Y)b(H.id);const B=!Q||(Q.flowElements??[]).length===0&&ne.length===0&&(Q.artifacts??[]).length===0;r.push({id:ee.id,...ee.name?{name:ee.name}:{},...B?{blackBox:!0}:{},...Y.length?{lanes:Y}:{}});const L=Xp(ee,"bwl:poolOrder");L!==void 0&&(l.poolOrders[ee.id]=L),Q&&C(Q,ee.id)}for(const ee of n.messageFlows??[])E(ee.id),f.push({id:ee.id,source:dn(ee.sourceRef),target:dn(ee.targetRef),...typeof ee.name=="string"&&ee.name?{name:ee.name}:{}});O(n.artifacts??[]);for(const[ee,oe]of i)!U.has(ee)&&(oe.flowElements??[]).length>0&&u.push({id:ee,type:oe.$type,reason:"unreachable-process"})}else for(const U of i.values())C(U);const F=[],N=[],I=[],W=[],re=(U,ee)=>!!U&&!!ee&&x.has(U)&&x.has(ee);for(const U of p){if(!re(U.source,U.target)){u.push({id:U.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}F.push({id:U.id,source:U.source,target:U.target,...U.name?{name:U.name}:{}}),x.add(U.id)}for(const U of f){if(!re(U.source,U.target)){u.push({id:U.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}N.push({id:U.id,source:U.source,target:U.target,...U.name?{name:U.name}:{}}),x.add(U.id)}for(const U of h){if(!re(U.source,U.target)){u.push({id:U.id??"",type:U.type,reason:"endpoint-outside-mvp"});continue}W.push({...U.id?{id:U.id}:{},source:U.source,target:U.target}),U.id&&x.add(U.id)}for(const U of d){if(!re(U.source,U.target)){u.push({id:U.id??"",type:U.type,reason:"endpoint-outside-mvp"});continue}I.push({...U.id?{id:U.id}:{},source:U.source,target:U.target})}const Pe=new Map(c.map(U=>[U.id,U]));for(const{owner:U,refs:ee}of _){const oe=ee.filter(ne=>R.has(ne)),Q=Pe.get(U);Q&&oe.length&&(Q.members=oe)}for(const U of g)R.has(U.anchor)&&(l.placements[U.owner]={anchor:U.anchor,side:U.side,...U.offset!==void 0?{offset:U.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:F,...N.length?{messageFlows:N}:{},...a.length?{dataStores:a}:{},...W.length?{dataAssociations:W}:{},...s.length?{annotations:s}:{},...I.length?{associations:I}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function u0(e){const{definitions:t,warnings:n}=await Kp(e);return{...Qp(t),warnings:n}}function l0(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Jp(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Rp(e,t.ops);if(!i.ok)return{status:"rejected",issues:i.issues};const{xml:r}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:r??""}}const p0=Symbol("bpmn-editor");function f0(){const e=We.ref(!1),t=We.ref(!0),n=We.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const p=u.get("keyboard");l?(r&&p.bind(r),r=void 0):r||(r=p.getBinding(),p.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const p=s();n.value=!0;try{const f=await Jp(p,u,{currentVersion:l});return f.status==="applied"&&(e.value=!1),f}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:_c(l)}},async saveXml(){const{xml:u}=await s().saveXML({format:!0});return e.value=!1,u??""},undo:()=>{var u;return(u=c())==null?void 0:u.undo()},redo:()=>{var u;return(u=c())==null?void 0:u.redo()},canUndo:()=>{var u;return((u=c())==null?void 0:u.canUndo())??!1},canRedo:()=>{var u;return((u=c())==null?void 0:u.canRedo())??!1}}}function X(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function d0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var bc={exports:{}},ef;function h0(){if(ef)return bc.exports;ef=1;var e=bc.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o),s=Math.floor(Math.random()*c).toString(n);a=s+a}var u=parseInt(a,n);return u!==1/0&&u>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var r=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(o,c));return o[c]=a,c},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,s){return r.hats[a]=s,r},r.bits=t||128,r.base=n||16,r},bc.exports}var m0=h0(),g0=d0(m0);function hn(e){if(!(this instanceof hn))return new hn(e);e=e||[128,36,1],this._seed=e.length?g0.rack(e[0],e[1],e[2]):e}hn.prototype.next=function(e){return this._seed(e||!0)},hn.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},hn.prototype.claim=function(e,t){this._seed.set(e,t||!0)},hn.prototype.assigned=function(e){return this._seed.get(e)||!1},hn.prototype.unclaim=function(e){delete this._seed.hats[e]},hn.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const et={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};et.td=et.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],et.option=et.optgroup=[1,'<select multiple="multiple">',"</select>"],et.thead=et.tbody=et.colgroup=et.caption=et.tfoot=[1,"<table>","</table>"],et.polyline=et.ellipse=et.polygon=et.circle=et.text=et.line=et.path=et.rect=et.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Ie(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:p}=l;return p.remove(),p}let[r,o,a]=Object.hasOwn(et,i)?et[i]:et._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:l}=s;return l.remove(),l}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function v0(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function wt(e,...t){const n=e.style;return A(t,function(i){i&&A(i,function(r,o){n[o]=r})}),e}function _t(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const y0=Object.prototype.toString;function Be(e){return new Zn(e)}function Zn(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Zn.prototype.add=function(e){return this.list.add(e),this},Zn.prototype.remove=function(e){return y0.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Zn.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Zn.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Zn.prototype.array=function(){return Array.from(this.list)},Zn.prototype.has=Zn.prototype.contains=function(e){return this.list.contains(e)};function Xo(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Mi(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function _0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zo={},tf;function b0(){if(tf)return Zo;tf=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Zo.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Zo.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Zo}var nf=b0(),E0=_0(nf),le=v0({__proto__:null,default:E0},[nf]),rf=["focus","blur"];function x0(e,t,n,i,r){return rf.indexOf(n)!==-1&&(r=!0),le.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Mi(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function w0(e,t,n,i){return rf.indexOf(t)!==-1&&(i=!0),le.unbind(e,t,n,i)}var Dt={bind:x0,unbind:w0};function Ec(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Ae(e,t){return t=t||document,t.querySelector(e)}function Qo(e,t){return t=t||document,t.querySelectorAll(e)}function mn(e){e.parentNode&&e.parentNode.removeChild(e)}function S0(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function R0(e,t){return t.appendChild(S0(e,t))}function pe(e,t){return R0(t,e),e}var xc=2,of={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":xc,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":xc,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function C0(e,t){return of[t]?e.style[t]:e.getAttributeNS(null,t)}function af(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=of[i];r?(r===xc&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function P0(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)af(e,r,t[r])}function Z(e,t,n){if(typeof t=="string")if(n!==void 0)af(e,t,n);else return C0(e,t);else P0(e,t);return e}const A0=Object.prototype.toString;function xe(e){return new Qn(e)}function Qn(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Qn.prototype.add=function(e){return this.list.add(e),this},Qn.prototype.remove=function(e){return A0.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Qn.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Qn.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Qn.prototype.array=function(){return Array.from(this.list)},Qn.prototype.has=Qn.prototype.contains=function(e){return this.list.contains(e)};function Jo(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function sf(e){return e.cloneNode(!0)}var wc={svg:"http://www.w3.org/2000/svg"},cf='<svg xmlns="'+wc.svg+'"';function T0(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(wc.svg)===-1&&(e=cf+e.substring(4)):(e=cf+">"+e+"</svg>",t=!0);var n=M0(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function M0(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function te(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=T0(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(wc.svg,e),t&&Z(n,t),n}var Sc=null;function uf(){return Sc===null&&(Sc=te("svg")),Sc}function lf(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function k0(e,t,n,i,r,o){var a=uf().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return lf(a,e);case 6:return lf(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Nr(e){return uf().createSVGTransform()}var pf=/([&<>]{1})/g,D0=/([&<>\n\r"]{1})/g,O0={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Rc(e,t){function n(i,r){return O0[r]||r}return e.replace(t,n)}function ff(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Rc(e.textContent,pf));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=e.attributes,n=0,i=r.length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',Rc(o.value,D0),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)ff(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Rc(e.nodeValue,pf),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function I0(e){for(var t=e.firstChild,n=[];t;)ff(t,n),t=t.nextSibling;return n.join("")}function df(e,t){return I0(e)}function tt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function L0(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function B0(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(L0(e,i))}function $r(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),B0(n,t)),n.consolidate()}const N0=/^class[ {]/;function $0(e){return N0.test(e.toString())}function Cc(e){return Array.isArray(e)}function Pc(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ea(...e){e.length===1&&Cc(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const j0=/constructor\s*[^(]*\(\s*([^)]*)\)/m,F0=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,H0=/\/\*([^*]*)\*\//m;function z0(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match($0(e)?j0:F0);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(H0);return(r&&r[1]||i).trim()})||[]}function hf(e,t){const n=t||{get:function(E,b){if(i.push(E),b===!1)return null;throw s(`No provider for "${E}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(E){const b=i.join(" -> ");return i.length=0,new Error(b?`${E} (Resolving: ${b})`:E)};function c(E,b){if(!r[E]&&E.includes(".")){const S=E.split(".");let T=c(S.shift());for(;S.length;)T=T[S.shift()];return T}if(Pc(o,E))return o[E];if(Pc(r,E)){if(i.indexOf(E)!==-1)throw i.push(E),s("Cannot resolve circular dependency!");return i.push(E),o[E]=r[E][0](r[E][1]),i.pop(),o[E]}return n.get(E,b)}function u(E,b){if(typeof b>"u"&&(b={}),typeof E!="function")if(Cc(E))E=ea(E.slice());else throw s(`Cannot invoke "${E}". Expected a function!`);const T=(E.$inject||z0(E)).map(O=>Pc(b,O)?b[O]:c(O));return{fn:E,dependencies:T}}function l(E){const{fn:b,dependencies:S}=u(E),T=Function.prototype.bind.call(b,null,...S);return new T}function p(E,b,S){const{fn:T,dependencies:O}=u(E,S);return T.apply(b,O)}function f(E){return ea(b=>E.get(b))}function d(E,b){if(b&&b.length){const S=Object.create(null),T=Object.create(null),O=[],C=[],F=[];let N,I,W,re;for(let Pe in r)N=r[Pe],b.indexOf(Pe)!==-1&&(N[2]==="private"?(I=O.indexOf(N[3]),I===-1?(W=N[3].createChild([],b),re=f(W),O.push(N[3]),C.push(W),F.push(re),S[Pe]=[re,Pe,"private",W]):S[Pe]=[F[I],Pe,"private",C[I]]):S[Pe]=[N[2],N[1]],T[Pe]=!0),(N[2]==="factory"||N[2]==="type")&&N[1].$scope&&b.forEach(Qe=>{N[1].$scope.indexOf(Qe)!==-1&&(S[Pe]=[N[2],N[1]],T[Qe]=!0)});b.forEach(Pe=>{if(!T[Pe])throw new Error('No provider for "'+Pe+'". Cannot use provider from the parent!')}),E.unshift(S)}return new hf(E,a)}const h={factory:p,type:l,value:function(E){return E}};function g(E,b){const S=E.__init__||[];return function(){S.forEach(T=>{typeof T=="string"?b.get(T):b.invoke(T)})}}function _(E){const b=E.__exports__;if(b){const S=E.__modules__,T=Object.keys(E).reduce((I,W)=>(W!=="__exports__"&&W!=="__modules__"&&W!=="__init__"&&W!=="__depends__"&&(I[W]=E[W]),I),Object.create(null)),O=(S||[]).concat(T),C=d(O),F=ea(function(I){return C.get(I)});b.forEach(function(I){r[I]=[F,I,"private",C]});const N=(E.__init__||[]).slice();return N.unshift(function(){C.init()}),E=Object.assign({},E,{__init__:N}),g(E,C)}return Object.keys(E).forEach(function(S){if(S==="__init__"||S==="__depends__")return;const T=E[S];if(T[2]==="private"){r[S]=T;return}const O=T[0],C=T[1];r[S]=[h[O],V0(O,C),O]}),g(E,a)}function R(E,b){return E.indexOf(b)!==-1||(E=(b.__depends__||[]).reduce(R,E),E.indexOf(b)!==-1)?E:E.concat(b)}function x(E){const b=E.reduce(R,[]).map(_);let S=!1;return function(){S||(S=!0,b.forEach(T=>T()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=x(e)}function V0(e,t){return e!=="value"&&Cc(t)&&(t=ea(t.slice())),t}var G0=1e3;function kn(e,t){var n=this;t=t||G0,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}kn.prototype.canRender=function(e){},kn.prototype.drawShape=function(e,t){},kn.prototype.drawConnection=function(e,t){},kn.prototype.getShapePath=function(e){},kn.prototype.getConnectionPath=function(e){};function ki(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function W0(e){return["M",e.x,e.y]}function Ac(e){return["L",e.x,e.y]}function U0(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function q0(e,t){const n=e.length,i=[W0(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(Ac(a));continue}const c=Math.min(t,Tc(a.x-o.x,a.y-o.y),Tc(s.x-a.x,s.y-a.y));if(!c){i.push(Ac(a));continue}const u=ta(a,o,c),l=ta(a,o,c*.5),p=ta(a,s,c),f=ta(a,s,c*.5);i.push(Ac(u)),i.push(U0(l,f,p))}return i}function ta(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Tc(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Tc(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function jr(e,t,n){ue(t)&&(n=t,t=null),t||(t={});const i=te("path",t);return ue(n)&&(i.dataset.cornerRadius=String(n)),Mc(i,e)}function Mc(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Z(e,{d:ki(q0(t,n))}),e}function na(e){var t=new Set(e);return ye(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Di(e,t,n){n=n||0,ae(e)||(e=[e]),A(e,function(i,r){var o=t(i,r,n);ae(o)&&o.length&&Di(o,t,n+1)})}function kc(e,t,n){var i=new Set,r=new Set;return Di(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function Fr(e,t){return kc(e)}function Y0(e,t,n){Ri(t)&&(t=!0),rt(t)&&(n=t,t=!0),n=n||{};var i=Hr(n.allShapes),r=Hr(n.allConnections),o=Hr(n.enclosedElements),a=Hr(n.enclosedConnections),s=Hr(n.topLevel,t&&Xi(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,A(l.incoming,c),A(l.outgoing,c),l.children}return Di(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Ue(e,t){t=!!t,ae(e)||(e=[e]);var n,i,r,o;return A(e,function(a){var s=a;a.waypoints&&!t&&(s=Ue(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+p>r||r===void 0)&&(r=c+p),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function er(e,t){var n={};return A(e,function(i){var r=i;r.waypoints&&(r=Ue(r)),!ue(t.y)&&r.x>t.x&&(n[i.id]=i),!ue(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(ue(t.width)&&ue(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!ue(t.width)||!ue(t.height))&&(n[i.id]=i)}),n}function mf(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function gf(e){return!!(e&&e.isFrame)}function Hr(e,t){return D({},e||{},t||{})}var K0=1;function Jn(e,t){kn.call(this,e,K0),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}X(Jn,kn),Jn.prototype.canRender=function(){return!0},Jn.prototype.drawShape=function(t,n,i){var r=te("rect");return Z(r,{x:0,y:0,width:n.width||0,height:n.height||0}),gf(n)?Z(r,D({},this.FRAME_STYLE,i||{})):Z(r,D({},this.SHAPE_STYLE,i||{})),pe(t,r),r},Jn.prototype.drawConnection=function(t,n,i){var r=jr(n.waypoints,D({},this.CONNECTION_STYLE,i||{}));return pe(t,r),r},Jn.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return ki(a)},Jn.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return ki(o)},Jn.$inject=["eventBus","styles"];function X0(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return D(o,{class:n})},this.style=function(n,i){!ae(n)&&!i&&(i=n,n=[]);var r=kt(n,function(o,a){return D(o,e[a]||{})},{});return i?D(r,i):r},this.computeStyle=function(n,i,r){return ae(i)||(r=i,i=[]),t.style(i||[],D({},r,n||{}))}}const Z0={__init__:["defaultRenderer"],defaultRenderer:["type",Jn],styles:["type",X0]};function ze(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Ge(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function Dc(e,t){return!e||!t?-1:e.indexOf(t)}function zr(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Oc(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=zr(e,t);return Math.abs(r/o)<=i}var Q0=2;function Dn(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(J0(r,n))return o;return!1}function J0(e,t){const n=t[0];return Ci(t,function(i){return Math.abs(n[e]-i[e])<=Q0})}function vf(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function Ic(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var eE=/,?([a-z]),?/gi,yf=parseFloat,qe=Math,ei=qe.PI,gn=qe.min,vn=qe.max,_f=qe.pow,ti=qe.abs,tE=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,nE=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,bf=Array.isArray||function(e){return e instanceof Array};function iE(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function rE(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function oE(e){function t(){var n=Array.prototype.slice.call(arguments,0),i=n.join("␀"),r=t.cache=t.cache||{},o=t.count=t.count||[];return iE(r,i)?(rE(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function aE(e){if(!e)return null;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},n=[];return String(e).replace(tE,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(nE,function(c,u){u&&a.push(+u)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=Bc,n}function sE(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(typeof i=="string"&&i!==i.toUpperCase())return!1}return!0}function cE(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function Lc(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function Bc(){return this.join(",").replace(eE,"$1")}function uE(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var r=e[n],o=t[n]=new Array(r.length),a=0,s=r.length;a<s;a++)o[a]=r[a];return t.toString=Bc,t}function Ef(e,t,n,i,r,o,a,s,c){var u=1-c,l=_f(u,3),p=_f(u,2),f=c*c,d=f*c,h=l*e+p*3*c*n+u*3*c*c*r+d*a,g=l*t+p*3*c*i+u*3*c*c*o+d*s;return{x:ia(h),y:ia(g)}}function xf(e){var t=mE(...e);return Lc(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function ni(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function lE(e,t){return e=Lc(e),t=Lc(t),ni(t,e.x,e.y)||ni(t,e.x2,e.y)||ni(t,e.x,e.y2)||ni(t,e.x2,e.y2)||ni(e,t.x,t.y)||ni(e,t.x2,t.y)||ni(e,t.x,t.y2)||ni(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function wf(e,t,n,i,r){var o=-3*t+9*n-9*i+3*r,a=e*o+6*t-12*n+6*i;return e*a-3*t+3*n}function Sf(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<l;h++){var g=u*p[h]+u,_=wf(g,e,n,r,a),R=wf(g,t,i,o,s),x=_*_+R*R;d+=f[h]*qe.sqrt(x)}return u*d}function pE(e,t,n,i,r,o,a,s){if(!(vn(e,n)<gn(r,a)||gn(e,n)>vn(r,a)||vn(t,i)<gn(o,s)||gn(t,i)>vn(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var p=ia(c/l),f=ia(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+gn(e,n).toFixed(2)||d>+vn(e,n).toFixed(2)||d<+gn(r,a).toFixed(2)||d>+vn(r,a).toFixed(2)||h<+gn(t,i).toFixed(2)||h>+vn(t,i).toFixed(2)||h<+gn(o,s).toFixed(2)||h>+vn(o,s).toFixed(2)))return{x:p,y:f}}}}function ia(e){return Math.round(e*1e11)/1e11}function fE(e,t,n){var i=xf(e),r=xf(t);if(!lE(i,r))return[];var o=Sf(...e),a=Sf(...t),s=Cf(e)?1:~~(o/5)||1,c=Cf(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),p={},f=[],d,h;for(d=0;d<s+1;d++){var g=Ef(...e,d/s);u[d]={x:g.x,y:g.y,t:d/s}}for(d=0;d<c+1;d++)g=Ef(...t,d/c),l[d]={x:g.x,y:g.y,t:d/c};for(d=0;d<s;d++)for(h=0;h<c;h++){var _=u[d],R=u[d+1],x=l[h],E=l[h+1],b=ti(R.x-_.x)<.01?"y":"x",S=ti(E.x-x.x)<.01?"y":"x",T=pE(_.x,_.y,R.x,R.y,x.x,x.y,E.x,E.y),O;if(T){if(O=T.x.toFixed(9)+"#"+T.y.toFixed(9),p[O])continue;p[O]=!0;var C=_.t+ti((T[b]-_[b])/(R[b]-_[b]))*(R.t-_.t),F=x.t+ti((T[S]-x[S])/(E[S]-x[S]))*(E.t-x.t);C>=0&&C<=1&&F>=0&&F<=1&&f.push({x:T.x,y:T.y,t1:C,t2:F})}}return f}function Rf(e,t,n){e=Tf(e),t=Tf(t);for(var i,r,o,a,s,c,u,l,p,f,d=n?0:[],h=0,g=e.length;h<g;h++){var _=e[h];if(_[0]=="M")i=s=_[1],r=c=_[2];else{_[0]=="C"?(p=[i,r,..._.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var R=0,x=t.length;R<x;R++){var E=t[R];if(E[0]=="M")o=u=E[1],a=l=E[2];else{E[0]=="C"?(f=[o,a,...E.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,l,u,l],o=u,a=l);var b=fE(p,f);{for(var S=0,T=b.length;S<T;S++)b[S].segment1=h,b[S].segment2=R,b[S].bez1=p,b[S].bez2=f;d=d.concat(b)}}}}}return d}function dE(e){return bf(e)&&bf(e[0])}function hE(e){if(sE(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,p=e.length;l<p;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var f=1,d=u.length;f<d;f++)c[f]=+u[f]+(f%2?n:i)}else for(var h=0,g=u.length;h<g;h++)c[h]=u[h];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=Bc,t}function Cf(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function ra(e,t,n,i){return[e,t,n,i,n,i]}function Pf(e,t,n,i,r,o){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*r+s*n,a*o+s*i,r,o]}function Af(e,t,n,i,r,o,a,s,c,u){var l=ei*120/180,p=ei/180*(+r||0),f=[],d,h=oE(function(w,v,m){var P=w*qe.cos(m)-v*qe.sin(m),k=w*qe.sin(m)+v*qe.cos(m);return{x:P,y:k}});if(u)O=u[0],C=u[1],S=u[2],T=u[3];else{d=h(e,t,-p),e=d.x,t=d.y,d=h(s,c,-p),s=d.x,c=d.y;var g=(e-s)/2,_=(t-c)/2,R=g*g/(n*n)+_*_/(i*i);R>1&&(R=qe.sqrt(R),n=R*n,i=R*i);var x=n*n,E=i*i,b=(o==a?-1:1)*qe.sqrt(ti((x*E-x*_*_-E*g*g)/(x*_*_+E*g*g))),S=b*n*_/i+(e+s)/2,T=b*-i*g/n+(t+c)/2,O=qe.asin(((t-T)/i).toFixed(9)),C=qe.asin(((c-T)/i).toFixed(9));O=e<S?ei-O:O,C=s<S?ei-C:C,O<0&&(O=ei*2+O),C<0&&(C=ei*2+C),a&&O>C&&(O=O-ei*2),!a&&C>O&&(C=C-ei*2)}var F=C-O;if(ti(F)>l){var N=C,I=s,W=c;C=O+l*(a&&C>O?1:-1),s=S+n*qe.cos(C),c=T+i*qe.sin(C),f=Af(s,c,n,i,r,0,a,I,W,[C,N,S,T])}F=C-O;var re=qe.cos(O),Pe=qe.sin(O),Qe=qe.cos(C),U=qe.sin(C),ee=qe.tan(F/4),oe=4/3*n*ee,Q=4/3*i*ee,ne=[e,t],Y=[e+oe*Pe,t-Q*re],B=[s+oe*U,c-Q*Qe],L=[s,c];if(Y[0]=2*ne[0]-Y[0],Y[1]=2*ne[1]-Y[1],u)return[Y,B,L].concat(f);f=[Y,B,L].concat(f).join().split(",");for(var H=[],M=0,$=f.length;M<$;M++)H[M]=M%2?h(f[M-1],f[M],p).y:h(f[M],f[M+1],p).x;return H}function mE(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,h,g,_,R,x=0;x<2;++x){if(x==0?(p=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,f=3*i-3*t),ti(l)<1e-12){if(ti(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}_=p*p-4*f*l,R=qe.sqrt(_),!(_<0)&&(h=(-p+R)/(2*l),0<h&&h<1&&c.push(h),g=(-p-R)/(2*l),0<g&&g<1&&c.push(g))}for(var E=c.length,b=E,S;E--;)d=c[E],S=1-d,u[0][E]=S*S*S*e+3*S*S*d*n+3*S*d*d*r+d*d*d*a,u[1][E]=S*S*S*t+3*S*S*d*i+3*S*d*d*o+d*d*d*s;return u[0][b]=e,u[1][b]=t,u[0][b+1]=a,u[1][b+1]=s,u[0].length=u[1].length=b+2,{x0:gn(...u[0]),y0:gn(...u[1]),x1:vn(...u[0]),y1:vn(...u[1])}}function Tf(e){if(dE(e)||(e=aE(e)),cE(e))return e;for(var t=uE(hE(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,h){var g,_;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...Af(d.x,d.y,...f.slice(1))];break;case"S":h=="C"||h=="S"?(g=d.x*2-d.bx,_=d.y*2-d.by):(g=d.x,_=d.y),f=["C",g,_,...f.slice(1)];break;case"T":h=="Q"||h=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...Pf(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...Pf(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...ra(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...ra(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...ra(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...ra(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var h=f[d];h.length;)o[d]="A",f.splice(d++,0,["C",...h.splice(0,6)]);f.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],p=l.length;n.x=l[p-2],n.y=l[p-1],n.bx=yf(l[p-4])||n.x,n.by=yf(l[p-3])||n.y}return t}function Te(e){return rt(e)&&Mt(e,"waypoints")}function he(e){return rt(e)&&Mt(e,"labelTarget")}function gE(e){return rt(e)&&Yi(e.parent)}function Mf(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function On(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ie(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function oa(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function vE(e){return On({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function yE(e){for(var t=e.waypoints,n=t.reduce(function(u,l,p){var f=t[p-1];if(f){var d=u[u.length-1],h=d&&d.endLength||0,g=EE(f,l);u.push({start:f,end:l,startLength:h,endLength:h+g,length:g})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function se(e){return Te(e)?yE(e):vE(e)}function ut(e,t,n){n=n||0,rt(n)||(n={x:n,y:n});var i=ie(e),r=ie(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,u=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function Vr(e,t,n){var i=_E(e,t);return i.length===1||i.length===2&&zr(i[0],i[1])<1?On(i[0]):i.length>1?(i=ln(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),On(i[n?0:i.length-1])):null}function _E(e,t){return Rf(e,t)}function bE(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],zr(n,r)===0||Oc(i,r,n)?e.splice(t,1):t++;return e}function EE(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function aa(e,t){return Math.round(e*t)/t}function kf(e){return ue(e)?e+"px":e}function xE(e){for(;e.parent;)e=e.parent;return e}function wE(e){e=D({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),wt(n,{position:"relative",overflow:"hidden",width:kf(e.width),height:kf(e.height)}),t.appendChild(n),n}function Df(e,t,n){const i=te("g");xe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const SE="base",Of=0,RE=1,CE={shape:["x","y","width","height"],connection:["waypoints"]};function ce(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}ce.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],ce.prototype._init=function(e){const t=this._eventBus,n=this._container=wE(e),i=this._svg=te("svg");Z(i,{width:"100%",height:"100%"}),_t(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),pe(n,i);const r=this._viewport=Df(i,"viewport");e.deferUpdate&&(this._viewboxChanged=ac(this._viewboxChanged,300)),this._restoreFocus=ac(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},ce.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},ce.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},ce.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=mf(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},ce.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},ce.prototype.restoreFocus=function(){this._restoreFocus()},ce.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},ce.prototype.isFocused=function(){return this._focused},ce.prototype.getDefaultLayer=function(){return this.getLayer(SE,Of)},ce.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},ce.prototype._getChildIndex=function(e){return kt(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},ce.prototype._createLayer=function(e,t){typeof t>"u"&&(t=RE);const n=this._getChildIndex(t);return{group:Df(this._viewport,"layer-"+e,n),index:t,visible:!0}},ce.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},ce.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(tt(n),t.visible=!1),n},ce.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],tt(t.group))},ce.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},ce.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(xE(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},ce.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},ce.prototype._findPlaneForRoot=function(e){return Oe(this._planes,function(t){return t.rootElement===e})},ce.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},ce.prototype._resolveElements=function(e){return ae(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},ce.prototype.getContainer=function(){return this._container},ce.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(A([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),xe(r).add(t)):(e.markers.delete(t),xe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},ce.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},ce.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},ce.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},ce.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},ce.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},ce.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,Of);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},ce.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},ce.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},ce.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},ce.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},ce.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},ce.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=CE[e];if(!Ci(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},ce.prototype._setParent=function(e,t,n){Ge(t.children,e,n),e.parent=t},ce.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},ce.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},ce.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},ce.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),ze(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},ce.prototype.removeShape=function(e){return this._removeElement(e,"shape")},ce.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},ce.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},ce.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},ce.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},ce.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);$r(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=$r(t),r=a?a.matrix:k0(),s=aa(r.a,1e3),c=aa(-r.e||0,1e3),u=aa(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},ce.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=D({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),If(t,n)}),{x:n.e,y:n.f}},ce.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(h=>h!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=Ue(o),s=ie(a),c=this.viewbox(),u=this.zoom();let l,p;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const f=ie(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,p=a.y-c.y;else{const h=Math.max(0,s.right-f.right),g=Math.min(0,s.left-f.left),_=Math.max(0,s.bottom-f.bottom),R=Math.min(0,s.top-f.top);l=h||g,p=_||R}this.scroll({dx:-l*u,dy:-p*u})},ce.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),aa(i.a,1e3)};function If(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}ce.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},ce.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const p=c.a;return t?(a=D(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),If(this._viewport,l),l},ce.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},ce.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},ce.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var tr="data-element-id";function Ht(e){this._elements={},this._eventBus=e}Ht.$inject=["eventBus"],Ht.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Z(t,tr,i),n&&Z(n,tr,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Ht.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Z(i.gfx,tr,""),i.secondaryGfx&&Z(i.secondaryGfx,tr,""),delete t[n])},Ht.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},Ht.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Z(t,tr,i),t},Ht.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Z(e,tr);var n=this._elements[t];return n&&n.element},Ht.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Ht.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=n[i],o=t[r],a=o.element,s=o.gfx;if(e(a,s))return a}},Ht.prototype.getAll=function(){return this.filter(function(e){return e})},Ht.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},Ht.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Ht.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function PE(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(o){var a=this.indexOf(o);return a!==-1&&(this.splice(a,1),t.unset(o,r,i)),o}}),Object.defineProperty(e,"contains",{value:function(o){return this.indexOf(o)!==-1}}),Object.defineProperty(e,"add",{value:function(o,a){var s=this.indexOf(o);if(typeof a>"u"){if(s!==-1)return;a=this.length}s!==-1&&this.splice(s,1),this.splice(a,0,o),s===-1&&t.set(o,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function AE(e){return e.__refs_collection===!0}function TE(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Lf(e,t,n){var i=PE(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(r){e.set(r,t.inverse,n)})}function ME(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(o){if(o!==r){var a=r;r=null,a&&e.unset(a,i,n),r=o,e.set(r,i,n)}}})}function Ut(e,t){if(!(this instanceof Ut))return new Ut(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Ut.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?Lf(this,t,e):ME(this,t,e)},Ut.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return AE(n)||Lf(this,t,e),n},Ut.prototype.ensureBound=function(e,t){TE(e,t)||this.bind(e,t)},Ut.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Ut.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Nc=new Ut({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Bf=new Ut({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Nf=new Ut({name:"attachers",collection:!0},{name:"host"}),$f=new Ut({name:"outgoing",collection:!0},{name:"source"}),jf=new Ut({name:"incoming",collection:!0},{name:"target"});function nr(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),Nc.bind(this,"parent"),Bf.bind(this,"labels"),$f.bind(this,"outgoing"),jf.bind(this,"incoming")}function Gr(){nr.call(this),Nc.bind(this,"children"),Nf.bind(this,"host"),Nf.bind(this,"attachers")}X(Gr,nr);function Ff(){nr.call(this),Nc.bind(this,"children")}X(Ff,Gr);function Hf(){Gr.call(this),Bf.bind(this,"labelTarget")}X(Hf,Gr);function zf(){nr.call(this),$f.bind(this,"source"),jf.bind(this,"target")}X(zf,nr);var kE={connection:zf,shape:Gr,label:Hf,root:Ff};function DE(e,t){var n=kE[e];if(!n)throw new Error("unknown type: <"+e+">");return D(new n,t)}function OE(e){return e instanceof nr}function In(){this._uid=12}In.prototype.createRoot=function(e){return this.create("root",e)},In.prototype.createLabel=function(e){return this.create("label",e)},In.prototype.createShape=function(e){return this.create("shape",e)},In.prototype.createConnection=function(e){return this.create("connection",e)},In.prototype.create=function(e,t){return t=D({},t||{}),t.id||(t.id=e+"_"+this._uid++),DE(e,t)};var sa="__fn",Vf=1e3,IE=Array.prototype.slice;function Ot(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Ot.prototype.on=function(e,t,n,i){if(e=ae(e)?e:[e],ot(t)&&(i=n,n=t,t=Vf),!ue(t))throw new Error("priority must be a number");var r=n;i&&(r=Ct(n,i),r[sa]=n[sa]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Ot.prototype.once=function(e,t,n,i){var r=this;if(ot(t)&&(i=n,n=t,t=Vf),!ue(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[sa]=n,this.on(e,t,o)},Ot.prototype.off=function(e,t){e=ae(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Ot.prototype.createEvent=function(e){var t=new Wr;return t.init(e),t},Ot.prototype.fire=function(e,t){var n,i,r,o;if(o=IE.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof Wr?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Ot.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Ot.prototype._destroy=function(){this._listeners={}},Ot.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Ot.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=LE(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},Ot.prototype._addListener=function(e,t){var n=this._getListeners(e),i;if(!n){this._setListeners(e,t);return}for(;n;){if(n.priority<t.priority){t.next=n,i?i.next=t:this._setListeners(e,t);return}i=n,n=n.next}i.next=t},Ot.prototype._getListeners=function(e){return this._listeners[e]},Ot.prototype._setListeners=function(e,t){this._listeners[e]=t},Ot.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[sa]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Wr(){}Wr.prototype.stopPropagation=function(){this.cancelBubble=!0},Wr.prototype.preventDefault=function(){this.defaultPrevented=!0},Wr.prototype.init=function(e){D(this,e||{})};function LE(e,t){return e.apply(null,t)}function Oi(e){return e.childNodes[0]}function BE(e){return e.parentNode.childNodes[1]}function ca(e,t,n,i,r){var o=Nr();o.setTranslate(t,n);var a=Nr();a.setRotate(i||0,0,0);var s=Nr();s.setScale(1,1),$r(e,[o,a,s])}function lt(e,t,n){var i=Nr();i.setTranslate(t,n),$r(e,i)}function Gf(e,t){var n=Nr();n.setRotate(t,0,0),$r(e,n)}function zt(e,t){this._eventBus=e,this._elementRegistry=t}zt.$inject=["eventBus","elementRegistry"],zt.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=BE(t),n||(n=te("g"),xe(n).add("djs-children"),pe(t.parentNode,n))):n=t,n},zt.prototype._clear=function(e){var t=Oi(e);return Xo(t),t},zt.prototype._createContainer=function(e,t,n,i){var r=te("g");xe(r).add("djs-group"),typeof n<"u"?NE(r,t,t.childNodes[n]):pe(t,r);var o=te("g");xe(o).add("djs-element"),xe(o).add("djs-"+e),i&&xe(o).add("djs-frame"),pe(r,o);var a=te("g");return xe(a).add("djs-visual"),pe(o,a),o},zt.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,gf(t))},zt.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=kt(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),A(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;A(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},zt.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},zt.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},zt.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},zt.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},zt.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),lt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Z(n,"display","none"):Z(n,"display","block")}},zt.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);tt(t.parentNode)};function NE(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const $E={__depends__:[Z0],__init__:["canvas"],canvas:["type",ce],elementRegistry:["type",Ht],elementFactory:["type",In],eventBus:["type",Ot],graphicsFactory:["type",zt]};function jE(e){var t=new hf(e);return t.init(),t}function FE(e){e=e||{};var t={config:["value",e]},n=[t,$E].concat(e.modules||[]);return jE(n)}function ii(e,t){this._injector=t||FE(e),this.get("eventBus").fire("diagram.init")}ii.prototype.get=function(e,t){return this._injector.get(e,t)},ii.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ii.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ii.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function bt(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Pt(e,t){return e.$instanceOf(t)}function HE(e){return Oe(e.rootElements,function(t){return Pt(t,"bpmn:Process")||Pt(t,"bpmn:Collaboration")})}function zE(e){var t={},n=[],i={};function r(B,L){return function(H){B(H,L)}}function o(B){t[B.id]=B}function a(B){return t[B.id]}function s(B,L){var H=B.gfx;if(H)throw new Error(`already rendered ${bt(B)}`);return e.element(B,i[B.id],L)}function c(B,L){return e.root(B,i[B.id],L)}function u(B,L){try{var H=i[B.id]&&s(B,L);return o(B),H}catch(M){l(M.message,{element:B,error:M}),console.error(`failed to import ${bt(B)}`,M)}}function l(B,L){e.error(B,L)}var p=this.registerDi=function(L){var H=L.bpmnElement;H?i[H.id]?l(`multiple DI elements defined for ${bt(H)}`,{element:H}):i[H.id]=L:l(`no bpmnElement referenced in ${bt(L)}`,{element:L})};function f(B){d(B.plane)}function d(B){p(B),A(B.planeElement,h)}function h(B){p(B)}this.handleDefinitions=function(L,H){var M=L.diagrams;if(H&&M.indexOf(H)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!H&&M&&M.length&&(H=M[0]),!H)throw new Error("no diagram to display");i={},f(H);var $=H.plane;if(!$)throw new Error(`no plane for ${bt(H)}`);var w=$.bpmnElement;if(!w)if(w=HE(L),w)l(`correcting missing bpmnElement on ${bt($)} to ${bt(w)}`),$.bpmnElement=w,p($);else throw new Error("no process or collaboration to display");var v=c(w,$);if(Pt(w,"bpmn:Process")||Pt(w,"bpmn:SubProcess"))_(w,v);else if(Pt(w,"bpmn:Collaboration"))ne(w,v),R(L.rootElements,v);else throw new Error(`unsupported bpmnElement for ${bt($)}: ${bt(w)}`);g(n)};var g=this.handleDeferred=function(){for(var L;n.length;)L=n.shift(),L()};function _(B,L){ee(B,L),F(B.ioSpecification,L),C(B.artifacts,L),o(B)}function R(B,L){var H=ye(B,function(M){return!a(M)&&Pt(M,"bpmn:Process")&&M.laneSets});H.forEach(r(_,L))}function x(B,L){u(B,L)}function E(B,L){A(B,r(x,L))}function b(B,L){u(B,L)}function S(B,L){u(B,L)}function T(B,L){u(B,L)}function O(B,L){u(B,L)}function C(B,L){A(B,function(H){Pt(H,"bpmn:Association")?n.push(function(){O(H,L)}):O(H,L)})}function F(B,L){B&&(A(B.dataInputs,r(S,L)),A(B.dataOutputs,r(T,L)))}var N=this.handleSubProcess=function(L,H){ee(L,H),C(L.artifacts,H)};function I(B,L){var H=u(B,L);Pt(B,"bpmn:SubProcess")&&N(B,H||L),Pt(B,"bpmn:Activity")&&F(B.ioSpecification,L),n.push(function(){A(B.dataInputAssociations,r(b,L)),A(B.dataOutputAssociations,r(b,L))})}function W(B,L){u(B,L)}function re(B,L){u(B,L)}function Pe(B,L){n.push(function(){var H=u(B,L);B.childLaneSet&&Qe(B.childLaneSet,H||L),Y(B)})}function Qe(B,L){A(B.lanes,r(Pe,L))}function U(B,L){A(B,r(Qe,L))}function ee(B,L){oe(B.flowElements,L),B.laneSets&&U(B.laneSets,L)}function oe(B,L){A(B,function(H){Pt(H,"bpmn:SequenceFlow")?n.push(function(){W(H,L)}):Pt(H,"bpmn:BoundaryEvent")?n.unshift(function(){I(H,L)}):Pt(H,"bpmn:FlowNode")?I(H,L):Pt(H,"bpmn:DataObject")||(Pt(H,"bpmn:DataStoreReference")||Pt(H,"bpmn:DataObjectReference")?re(H,L):l(`unrecognized flowElement ${bt(H)} in context ${bt(L&&L.businessObject)}`,{element:H,context:L}))})}function Q(B,L){var H=u(B,L),M=B.processRef;M&&_(M,H||L)}function ne(B,L){A(B.participants,r(Q,L)),n.push(function(){E(B.messageFlows,L)}),C(B.artifacts,L)}function Y(B){A(B.flowNodeRef,function(L){var H=L.get("lanes");H&&H.push(B)})}}function y(e,t){var n=G(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function ge(e,t){return qn(t,function(n){return y(e,n)})}function G(e){return e&&e.businessObject||e}function we(e){return e&&e.di}function VE(e,t,n){var i,r,o,a,s=[];function c(u,l){var p={root:function(g,_){return i.add(g,_)},element:function(g,_,R){return i.add(g,_,R)},error:function(g,_){s.push({message:g,context:_})}},f=new zE(p);l=l||u.diagrams&&u.diagrams[0];var d=GE(u,l);if(!d)throw new Error("no diagram to display");A(d,function(g){f.handleDefinitions(u,g)});var h=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(h+"_plane")||o.findRoot(h))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(p){return p.warnings=s,l(p)}})}function GE(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!y(n,"bpmn:Process")&&!y(n,"bpmn:Collaboration")&&(i=WE(n));var r;y(i,"bpmn:Collaboration")?r=i:r=Oe(e.rootElements,function(u){if(y(u,"bpmn:Collaboration"))return Oe(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=vt(r.participants,function(u){return u.processRef}),o.push(r));var a=Wf(o),s=[t],c=[n];return A(e.diagrams,function(u){if(u.plane){var l=u.plane.bpmnElement;a.indexOf(l)!==-1&&c.indexOf(l)===-1&&(s.push(u),c.push(l))}}),s}}function Wf(e){var t=[];return A(e,function(n){n&&(t.push(n),t=t.concat(Wf(n.flowElements)))}),t}function WE(e){for(var t=e;t;){if(y(t,"bpmn:Process"))return t;t=t.$parent}}var UE='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>',Uf=UE,qf={verticalAlign:"middle"},Yf={color:"#404040"},qE={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},YE={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},KE={position:"absolute",left:"50%",top:"40%",transform:"translate(-50%)",width:"260px",padding:"10px",background:"white",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"14px",display:"flex",lineHeight:"1.3"},XE='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Uf+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',yn;function ZE(){yn=Ie(XE),wt(yn,qE),wt(Ae("svg",yn),qf),wt(Ae(".backdrop",yn),YE),wt(Ae(".notice",yn),KE),wt(Ae(".link",yn),Yf,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function QE(){yn||(ZE(),Dt.bind(yn,".backdrop","click",function(e){document.body.removeChild(yn)})),document.body.appendChild(yn)}const ua=5,Kf="djs-outline-hidden";function $e(e){e=D({},ex,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),nx(this._container)}X($e,ii),$e.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const p=await this.importDefinitions(s,n);return o=o.concat(p.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),la(s,o),s=JE(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},$e.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},$e.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw la(o,[]),o}if(typeof t=="string"&&(i=tx(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw la(o,[]),o}try{this.clear()}catch(o){throw la(o,[]),o}const{warnings:r}=await VE(this,n,i);return{warnings:r}},$e.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,r;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,r=(await this._moddle.toXML(n,t)).xml,r=this._emit("saveXML.serialized",{xml:r})||r}catch(a){i=a}const o=i?{error:i}:{xml:r};if(this._emit("saveXML.done",o),i)throw i;return o},$e.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=Ae(":scope > defs",i._svg),a=df(r),s=o?"<defs>"+df(o)+"</defs>":"",c=i.getContainer();Be(c).add(Kf);let u;try{u=r.getBBox()}finally{Be(c).remove(Kf)}const l=u.x-ua,p=u.y-ua,f=u.width+ua*2,d=u.height+ua*2;t=`<?xml version="1.0" encoding="utf-8"?>
1
+ (function(J,Ct){typeof exports=="object"&&typeof module<"u"?Ct(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ct):(J=typeof globalThis<"u"?globalThis:J||self,Ct(J.BpmnModeler={},J.Vue))})(this,(function(J,Ct){"use strict";var aO=Object.defineProperty;var sO=(J,Ct,Ei)=>Ct in J?aO(J,Ct,{enumerable:!0,configurable:!0,writable:!0,value:Ei}):J[Ct]=Ei;var Xr=(J,Ct,Ei)=>sO(J,typeof Ct!="symbol"?Ct+"":Ct,Ei);const Ei=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function zf(e){return Ei.includes(e)}const Vf="http://g1project.net/spec/bpmn/bwl/1.0",wu="bwl",Eu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Gf={name:"bwl-hints",uri:Vf,prefix:wu,xml:{tagAlias:"lowerCase"},types:[{name:"Placement",superClass:["Element"],properties:[{name:"anchor",isAttr:!0,type:"String"},{name:"side",isAttr:!0,type:"String"},{name:"offset",isAttr:!0,type:"Real"}]},{name:"Members",superClass:["Element"],properties:[{name:"refs",isAttr:!0,type:"String"}]},{name:"BandHint",extends:["bpmn:FlowNode"],properties:[{name:"band",isAttr:!0,type:"Integer"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]}]},Su="bwl.undoEpisode",Wf=new WeakSet;function Nx(e){Wf.has(e)||(e.register(Su,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Wf.add(e))}function Uf(e,t){Nx(e);const n={run:t};if(e.execute(Su,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Yf=["participant.add","participant.update","node.add","node.update","sequenceFlow.add","sequenceFlow.update","messageFlow.add","messageFlow.update","dataStore.add","dataStore.update","dataAssociation.add","association.add","annotation.add","annotation.update","group.add","group.update","element.remove"],Bx={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},$x={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},jx={type:"object",description:"풀(participant). 레인은 여기 선언하고 노드가 lane 인자로 배정된다 — 별도 레인 op 없음.",properties:{id:{type:"string",description:"문서 내 유일, XML NCName(공백 없이 문자/밑줄로 시작)."},name:{type:"string"},blackBox:{type:"boolean",description:"true = 내부 프로세스 없는 블랙박스 풀."},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"],additionalProperties:!1},Fx={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Ei]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},Hx={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},zx={type:"object",description:"시퀀스 플로우(같은 풀 안 노드 간).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"},condition:{$ref:"#/$defs/irFlowCondition"}},required:["id","source","target"],additionalProperties:!1},Vx={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Gx={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Wx={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Ux={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},Yx={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},qx={type:"object",description:"그룹 — members(요소 id 목록)가 bwl:members 힌트로 기록되고 바운즈는 멤버 bbox 로 산출된다.",properties:{id:{type:"string"},name:{type:"string"},members:{type:"array",items:{type:"string"}}},required:["id"],additionalProperties:!1},Kx={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Eu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function rn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Xx={"participant.add":rn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":rn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":rn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":rn("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Ei]}},required:["id"]}),"sequenceFlow.add":rn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":rn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":rn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":rn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":rn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":rn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":rn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":rn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":rn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":rn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":rn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":rn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":rn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},qf={anyOf:Yf.map(e=>Xx[e])},Zx={type:"object",description:"BPMN 문서에 요소를 추가·수정·삭제할 때 호출한다. 기존 요소는 describeProcess 가 노출하는 id 로 지정하고, 신규 요소 id 는 문서 내 유일한 XML NCName(공백 없이 문자/밑줄 시작)으로 짓는다. 좌표는 지정하지 않는다 — 배치는 서버가 결정하며, 필요하면 힌트(placement/band/order)로 의도만 전달하라.",properties:{ops:{type:"array",items:{$ref:"#/$defs/symbolicOp"}}},required:["ops"],additionalProperties:!1,$defs:{irLane:$x,irParticipant:jx,irNode:Fx,irFlowCondition:Hx,irSequenceFlow:zx,irMessageFlow:Vx,irDataStore:Gx,irDataAssociation:Wx,irTextAnnotation:Ux,irAssociation:Yx,irGroup:qx,bwlPlacement:Kx,nullableString:Bx,symbolicOp:qf}};function Ru(e){return Array.prototype.concat.apply([],e)}const Ho=Object.prototype.toString,Qx=Object.prototype.hasOwnProperty;function Rr(e){return e===void 0}function $t(e){return e!==void 0}function Zr(e){return e==null}function _e(e){return Ho.call(e)==="[object Array]"}function Gt(e){return Ho.call(e)==="[object Object]"}function Ee(e){return Ho.call(e)==="[object Number]"}function Wt(e){const t=Ho.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function wn(e){return Ho.call(e)==="[object String]"}function Jx(e){if(!_e(e))throw new Error("must supply array")}function En(e,t){return!Zr(e)&&Qx.call(e,t)}function ct(e,t){const n=Za(t);let i;return k(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Kf(e,t){const n=Za(t);let i=_e(e)?-1:void 0;return k(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ie(e,t){const n=Za(t);let i=[];return k(e,function(r,o){n(r,o)&&i.push(r)}),i}function k(e,t){let n,i;if(Rr(e))return;const r=_e(e)?r0:i0;for(let o in e)if(En(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function e0(e,t){if(Rr(e))return[];Jx(e);const n=Za(t);return e.filter(function(i,r){return!n(i,r)})}function Sn(e,t,n){return k(e,function(i,r){n=t(n,i,r)}),n}function Cr(e,t){return!!Sn(e,function(n,i,r){return n&&t(i,r)},!0)}function Wi(e,t){return!!ct(e,t)}function on(e,t){let n=[];return k(e,function(i,r){n.push(t(i,r))}),n}function Xa(e){return e&&Object.keys(e)||[]}function t0(e){return Xa(e).length}function Qr(e){return on(e,t=>t)}function Jr(e,t,n={}){return t=Cu(t),k(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Xf(e,...t){e=Cu(e);let n={};return k(t,r=>Jr(r,e,n)),on(n,function(r,o){return r[0]})}const n0=Xf;function ai(e,t){t=Cu(t);let n=[];return k(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),on(n,i=>i.v)}function eo(e){return function(t){return Cr(e,function(n,i){return t[i]===n})}}function Cu(e){return Wt(e)?e:t=>t[e]}function Za(e){return Wt(e)?e:t=>t===e}function i0(e){return e}function r0(e){return Number(e)}function Pu(e,t){let n,i,r,o;function a(p){let f=Date.now(),d=p?0:o+t-f;if(d>0)return s(d);e.apply(r,i),c()}function s(p){n=setTimeout(a,p)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...p){o=Date.now(),i=p,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function _n(e,t){return e.bind(t)}function O(e,...t){return Object.assign(e,...t)}function o0(e,t,n){let i=e;return k(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];$t(a)&&Zr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Rr(a)?Rr(n)?delete i[r]:i[r]=n:i=s}),e}function ii(e,t){let n={},i=Object(e);return k(t,function(r){r in i&&(n[r]=e[r])}),n}function si(e,t){let n={},i=Object(e);return k(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Au(){}Au.prototype.get=function(e){return this.$model.properties.get(this,e)},Au.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Zf(e,t){this.model=e,this.properties=t}Zf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Au.prototype);k(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),k(a,_n(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var a0=O(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Qf=O(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function Tu(e,t){var n=Qf[e];return n?n(t):t}function Mu(e){return!!a0[e]}function Jf(e){return!!Qf[e]}function an(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function $n(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}$n.prototype.build=function(){return ii(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},$n.prototype.addProperty=function(e,t,n){typeof t=="boolean"&&(n=t,t=void 0),this.addNamedProperty(e,n!==!1);var i=this.properties;t!==void 0?i.splice(t,0,e):i.push(e)},$n.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},$n.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=an(r[0],i),a=an(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},$n.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},$n.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},$n.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},$n.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},$n.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},$n.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},$n.prototype.hasProperty=function(e){return this.propertiesByName[e]},$n.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(k(e.properties,_n(function(o){o=O({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Ui(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,k(e,_n(this.registerPackage,this))}Ui.prototype.getPackage=function(e){return this.packageMap[e]},Ui.prototype.getPackages=function(){return this.packages},Ui.prototype.registerPackage=function(e){e=O({},e);var t=this.packageMap;ed(t,e,"prefix"),ed(t,e,"uri"),k(e.types,_n(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Ui.prototype.registerType=function(e,t){e=O({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:O({},e.meta||{})});var n=an(e.name,t.prefix),i=n.name,r=Object.create(null);k(e.properties,_n(function(o){var a=an(o.name,n.prefix),s=a.name;Mu(o.type)||(o.type=an(o.type,a.prefix).name),O(o,{ns:a,name:s}),r[s]=o},this)),O(e,{ns:n,name:i,propertiesByName:r}),k(e.extends,_n(function(o){var a=an(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Ui.prototype.mapTypes=function(e,t,n){var i=Mu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=an(c,Mu(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");k(i.superClass,n?a:s),t(i,!n),k(i.traits,a)},Ui.prototype.getEffectiveDescriptor=function(e){var t=an(e),n=new $n(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Ui.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function ed(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Pr(e){this.model=e}Pr.prototype.set=function(e,t,n){if(!wn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;s0(n)?i?delete e[r]:delete e.$attrs[ku(t)]:i?r in e?e[r]=n:td(e,i,n):e.$attrs[ku(t)]=n},Pr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[ku(t)];var i=n.name;return!e[i]&&n.isMany&&td(e,n,[]),e[i]},Pr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=O({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Pr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Pr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Pr.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"&&console.warn(o)}return null};function s0(e){return typeof e>"u"}function td(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function ku(e){return e.replace(/^:/,"")}function zn(e,t={}){this.properties=new Pr(this),this.factory=new Zf(this,this.properties),this.registry=new Ui(e,this.properties),this.typeCache=Object.create(null),this.config=t}zn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},zn.prototype.getType=function(e){var t=this.typeCache,n=wn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},zn.prototype.createAny=function(e,t,n){var i=an(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){o0(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),k(n,function(a,s){Gt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},zn.prototype.getPackage=function(e){return this.registry.getPackage(e)},zn.prototype.getPackages=function(){return this.registry.getPackages()},zn.prototype.getElementDescriptor=function(e){return e.$descriptor},zn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},zn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},zn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var nd=String.fromCharCode,c0=Object.prototype.hasOwnProperty,u0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,zo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(zo).forEach(function(e){zo[e.toUpperCase()]=zo[e]});function l0(e,t,n,i){return i?c0.call(zo,i)?zo[i]:"&"+i+";":nd(t||parseInt(n,16))}function Ar(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(u0,l0):e}var id="non-whitespace outside of root node";function Yi(e){return new Error(e)}function p0(e){return"missing namespace for prefix <"+e+">"}function Qa(e){return{get:e,enumerable:!0}}function f0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var rd=Symbol("nameCache");function Du(e){return e+"$uri"}function d0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Du(i)]=n;return t}function Ja(){return{line:0,column:0}}function h0(e){throw e}function od(e){if(!this)return new od(e);var t=e&&e.proxy,n,i,r,o,a=h0,s,c,u,l,p=Ja,f=!1,d=!1,h="",m=!1,g=!1,R=null,w=!1,b,x,S,M;function I($){$ instanceof Error||($=Yi($)),R=$,a($,p)}function A($){s&&($ instanceof Error||($=Yi($)),s($,p))}this.on=function($,G){if(typeof G!="function")throw Yi("required args <name, cb>");switch($){case"openTag":i=G;break;case"text":n=G;break;case"closeTag":r=G;break;case"error":a=G;break;case"warn":s=G;break;case"cdata":o=G;break;case"attention":l=G;break;case"question":u=G;break;case"comment":c=G;break;default:throw Yi("unsupported event: "+$)}return this},this.ns=function($){if(typeof $>"u"&&($={}),typeof $!="object")throw Yi("required args <nsMap={}>");var G=Object.create(null),pe;for(pe in $)G[pe]=$[pe];return g=!0,M=G,this};function H(){b=g?[]:null,x=g?d0(M):null,S=[],p=Ja,w=!1,R=null,d=!1,h=""}this.parse=function($){if(typeof $!="string")throw Yi("required args <xml=string>");if(f)throw Yi("parse during stream; call end() first");return H(),V($),p=Ja,w=!1,R},this.write=function($){if(typeof $!="string")throw Yi("required args <xml=string>");return f||(H(),f=!0),R||(h=V(h+$,!0)||""),this},this.end=function(){return f||H(),f=!1,R||V(h),h="",p=Ja,w=!1,R},this.stop=function(){w=!0};function V($,G=!1){var pe=null,ze=null,lt,Y=0,fe=!1,de=!1,ue=0,le=0,ne,z,F,U,Oe,Lt,P,_,y,D="",B=0,W;function ce(it,It){var ln=it.indexOf(":");if(ln===-1)return it;var pn=x[it.substring(0,ln)];return pn?It===pn?it.substr(ln+1):pn+it.substr(ln):(A(p0(it.substring(0,ln))),null)}function Ae(){if(W!==null)return W;var it,It,ln=g&&x.xmlns,pn=g&&m?[]:null,st=B,Nt=D,fn=Nt.length,Fo,dn,Ln,In,Et,Gi={},_u=new Set,Nn,Ye,Je;e:for(;st<fn;st++)if(Nn=!1,Ye=Nt.charCodeAt(st),!(Ye===32||Ye<14&&Ye>8)){for((Ye<65||Ye>122||Ye>90&&Ye<97)&&Ye!==95&&Ye!==58&&(A("illegal first char attribute name"),Nn=!0),Je=st+1;Je<fn;Je++)if(Ye=Nt.charCodeAt(Je),!(Ye>96&&Ye<123||Ye>64&&Ye<91||Ye>47&&Ye<59||Ye===46||Ye===45||Ye===95)){if(Ye===32||Ye<14&&Ye>8){A("missing attribute value"),st=Je;continue e}if(Ye===61)break;A("illegal attribute name char"),Nn=!0}if(Et=Nt.substring(st,Je),Et==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),Nn=!0),Ye=Nt.charCodeAt(Je+1),Ye===34)Je=Nt.indexOf('"',st=Je+2),Je===-1&&(Je=Nt.indexOf("'",st),Je!==-1&&(A("attribute value quote missmatch"),Nn=!0));else if(Ye===39)Je=Nt.indexOf("'",st=Je+2),Je===-1&&(Je=Nt.indexOf('"',st),Je!==-1&&(A("attribute value quote missmatch"),Nn=!0));else for(A("missing attribute value quotes"),Nn=!0,Je=Je+1;Je<fn&&(Ye=Nt.charCodeAt(Je+1),!(Ye===32||Ye<14&&Ye>8));Je++);for(Je===-1&&(A("missing closing quotes"),Je=fn,Nn=!0),Nn||(Ln=Nt.substring(st,Je)),st=Je;Je+1<fn&&(Ye=Nt.charCodeAt(Je+1),!(Ye===32||Ye<14&&Ye>8));Je++)st===Je&&(A("illegal character after attribute end"),Nn=!0);if(st=Je+1,Nn)continue e;if(_u.has(Et)){A("attribute <"+Et+"> already defined");continue}if(_u.add(Et),!g){Gi[Et]=Ln;continue}if(m){if(dn=Et==="xmlns"?"xmlns":Et.charCodeAt(0)===120&&Et.substr(0,6)==="xmlns:"?Et.substr(6):null,dn!==null){if(it=Ar(Ln),It=Du(dn),In=M[it],!In){if(dn==="xmlns"||It in x&&x[It]!==it)do In="ns"+Y++;while(typeof x[In]<"u");else In=dn;M[it]=In}x[dn]!==In&&(Fo||(x=f0(x),Fo=!0),x[dn]=In,dn==="xmlns"&&(x[Du(In)]=it,ln=In),x[It]=it),Gi[Et]=Ln;continue}pn.push(Et,Ln);continue}Et=ce(Et,ln),Et!==null&&(Gi[Et]=Ln)}if(m)for(st=0,fn=pn.length;st<fn;st++)Et=ce(pn[st++],ln),Ln=pn[st],Et!==null&&(Gi[Et]=Ln);return W=Gi}function Ue(){for(var it=/(\r\n|\r|\n)/g,It=0,ln=0,pn=0,st=le,Nt,fn;ue>=pn&&(Nt=it.exec($),!(!Nt||(st=Nt[0].length+Nt.index,st>ue)));)It+=1,pn=st;return ue==-1?(ln=st,fn=$.substring(le)):le===0?fn=$.substring(le,ue):(ln=ue-pn,fn=le==-1?$.substring(ue):$.substring(ue,le+1)),{data:fn,line:It,column:ln}}for(p=Ue,t&&(y=Object.create({},{name:Qa(function(){return P}),originalName:Qa(function(){return _}),attrs:Qa(Ae),ns:Qa(function(){return x})}));le!==-1;){if($.charCodeAt(le)===60?ue=le:ue=$.indexOf("<",le),ue===-1){if(G)return $.substring(le);if(S.length)return I("unexpected end of file");if(!d)return I("missing start tag");le<$.length&&$.substring(le).trim()&&A(id);return}if(d||(d=!0),le!==ue){if(S.length){if(n&&(n($.substring(le,ue),Ar,p),w))return}else if($.substring(le,ue).trim()&&(A(id),w))return}if(U=$.charCodeAt(ue+1),U===33){if(F=$.charCodeAt(ue+2),F===91&&$.substr(ue+3,6)==="CDATA["){if(le=$.indexOf("]]>",ue),le===-1)return G?$.substring(ue):I("unclosed cdata");if(o&&(o($.substring(ue+9,le),p),w))return;le+=3;continue}if(F===45&&$.charCodeAt(ue+3)===45){if(le=$.indexOf("-->",ue),le===-1)return G?$.substring(ue):I("unclosed comment");if(c&&(c($.substring(ue+4,le),Ar,p),w))return;le+=3;continue}}if(U===63){if(le=$.indexOf("?>",ue),le===-1)return G?$.substring(ue):I("unclosed question");if(u&&(u($.substring(ue,le+2),p),w))return;le+=2;continue}for(ne=ue+1;;ne++){if(Oe=$.charCodeAt(ne),isNaN(Oe))return G?$.substring(ue):(le=-1,I("unclosed tag"));if(Oe===34)F=$.indexOf('"',ne+1),ne=F!==-1?F:ne;else if(Oe===39)F=$.indexOf("'",ne+1),ne=F!==-1?F:ne;else if(Oe===62){le=ne;break}}if(U===33){if(l&&(l($.substring(ue,le+1),Ar,p),w))return;le+=1;continue}if(W={},U===47){if(fe=!1,de=!0,!S.length)return I("missing open tag");if(ne=P=S.pop(),F=ue+2+ne.length,$.substring(ue+2,F)!==ne)return I("closing tag mismatch");for(;F<le;F++)if(U=$.charCodeAt(F),!(U===32||U>8&&U<14))return I("close tag")}else{if($.charCodeAt(le-1)===47?(ne=P=$.substring(ue+1,le-1),fe=!0,de=!0):(ne=P=$.substring(ue+1,le),fe=!0,de=!1),!(U>96&&U<123||U>64&&U<91||U===95||U===58))return I("illegal first char nodeName");for(F=1,z=ne.length;F<z;F++)if(U=ne.charCodeAt(F),!(U>96&&U<123||U>64&&U<91||U>47&&U<59||U===45||U===95||U==46)){if(U===32||U<14&&U>8){P=ne.substring(0,F),W=null;break}return I("invalid nodeName")}de||S.push(P)}if(g){lt=x,fe&&(de||b.push(lt),W===null&&(m=ne.indexOf("xmlns",F)!==-1)&&(B=F,D=ne,Ae(),m=!1)),_=P,ze!==x&&(pe=x[rd],pe===void 0&&(pe=x[rd]=Object.create(null)),ze=x);var pt=pe[P];if(pt!==void 0)P=pt;else{if(U=P.indexOf(":"),U!==-1){if(Lt=x[P.substring(0,U)],!Lt)return I("missing namespace on <"+_+">");P=P.substr(U+1)}else Lt=x.xmlns;Lt&&(P=Lt+":"+P),pe[_]=P}}if(fe&&(B=F,D=ne,i&&(t?i(y,Ar,de,p):i(P,Ae,Ar,de,p),w)))return;if(de){if(r&&(r(t?y:P,Ar,fe,p),w))return;g&&(fe?x=lt:x=b.pop())}le+=1}}}function ad(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Ou={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},sd="property";function cd(e){return e.xml&&e.xml.serialize}function m0(e){const t=cd(e);return t!==sd&&(t||null)}function g0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ud(e,t){return ad(t)?e.prefix+":"+g0(e.localName):e.name}function y0(e,t){var n=e.name,i=e.localName,r=t&&t.xml&&t.xml.typePrefix;return r&&i.indexOf(r)===0?e.prefix+":"+i.slice(r.length):n}function v0(e,t,n){const i=an(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=an(r);var a=n.getPackage(o.prefix);return y0(o,a)}function qi(e){return new Error(e)}function Si(e){return e.$descriptor}function _0(e){O(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw qi("expected element");var n=this.elementsById,i=Si(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw qi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Vo(){}Vo.prototype.handleEnd=function(){},Vo.prototype.handleText=function(){},Vo.prototype.handleNode=function(){};function Lu(){}Lu.prototype=Object.create(Vo.prototype),Lu.prototype.handleNode=function(){return this};function to(){}to.prototype=Object.create(Vo.prototype),to.prototype.handleText=function(e){this.body=(this.body||"")+e};function Go(e,t){this.property=e,this.context=t}Go.prototype=Object.create(to.prototype),Go.prototype.handleNode=function(e){if(this.element)throw qi("expected no sub nodes");return this.element=this.createReference(e),this},Go.prototype.handleEnd=function(){this.element.id=this.body},Go.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Iu(e,t){this.element=t,this.propertyDesc=e}Iu.prototype=Object.create(to.prototype),Iu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Tu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function es(){}es.prototype=Object.create(to.prototype),es.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function hn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}hn.prototype=Object.create(es.prototype),hn.prototype.addReference=function(e){this.context.addReference(e)},hn.prototype.handleText=function(e){var t=this.element,n=Si(t),i=n.bodyProperty;if(!i)throw qi("unexpected body text <"+e+">");to.prototype.handleText.call(this,e)},hn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Si(t),i=n.bodyProperty;i&&e!==void 0&&(e=Tu(i.type,e),t.set(i.name,e))},hn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Si(n),r=this.context,o=new n({}),a=this.model,s;return k(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),k(p,function(f){r.addReference({element:o,property:l.ns.name,id:f})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Tu(l.type,c):u==="xmlns"?u=":"+u:(s=an(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},hn.prototype.getPropertyForNode=function(e){var t=e.name,n=an(t),i=this.type,r=this.model,o=Si(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=m0(s);if(u){const l=e.attributes[u];if(l){const p=v0(l,e.ns,r),f=r.getType(p);return O({},s,{effectiveType:Si(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=ud(n,c),l=r.getType(u);if(s=ct(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return O({},s,{effectiveType:Si(l).name})}else if(s=ct(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw qi("unrecognized element <"+n.name+">")},hn.prototype.toString=function(){return"ElementDescriptor["+Si(this.type).name+"]"},hn.prototype.valueHandler=function(e,t){return new Iu(e,t)},hn.prototype.referenceHandler=function(e){return new Go(e,this.context)},hn.prototype.handler=function(e){return e==="Element"?new no(this.model,e,this.context):new hn(this.model,e,this.context)},hn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Jf(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(O(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Nu(e,t,n){hn.call(this,e,t,n)}Nu.prototype=Object.create(hn.prototype),Nu.prototype.createElement=function(e){var t=e.name,n=an(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&ud(n,o)||t;if(!r.hasType(a))throw qi("unexpected element <"+e.originalName+">");return hn.prototype.createElement.call(this,e)};function no(e,t,n){this.model=e,this.context=n}no.prototype=Object.create(es.prototype),no.prototype.createElement=function(e){var t=e.name,n=an(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},no.prototype.handleChild=function(e){var t=new no(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element,r;return i!==void 0&&(r=n.$children=n.$children||[],r.push(i),i.$parent=n),t},no.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Bu(e){e instanceof zn&&(e={model:e}),O(this,{lax:!1},e)}Bu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof hn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new _0(O({},t,{rootHandler:i})),s=new od({proxy:!0}),c=b0();i.context=a,c.push(i);function u(S,M,I){var A=M(),H=A.line,V=A.column,$=A.data;$.charAt(0)==="<"&&$.indexOf(" ")!==-1&&($=$.slice(0,$.indexOf(" "))+">");var G="unparsable content "+($?$+" ":"")+`detected
2
+ line: `+H+`
3
+ column: `+V+`
4
+ nested error: `+S.message;if(I)return a.addWarning({message:G,error:S}),!0;throw qi(G)}function l(S,M){return u(S,M,!0)}function p(){var S=a.elementsById,M=a.references,I,A;for(I=0;A=M[I];I++){var H=A.element,V=S[A.id],$=Si(H).propertiesByName[A.property];if(V||a.addWarning({message:"unresolved reference <"+A.id+">",element:A.element,property:A.property,value:A.id}),$.isMany){var G=H.get($.name),pe=G.indexOf(A);pe===-1&&(pe=G.length),V?G[pe]=V:G.splice(pe,1)}else H.set($.name,V)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(S){if(d.test(S)){var M=h.exec(S),I=M&&M[1];!I||m.test(I)||a.addWarning({message:"unsupported document encoding <"+I+">, falling back to UTF-8"})}}function R(S,M){var I=c.peek();try{c.push(I.handleNode(S))}catch(A){u(A,M,o)&&c.push(new Lu)}}function w(S,M){try{c.peek().handleText(S)}catch(I){l(I,M)}}function b(S,M){S.trim()&&w(S,M)}var x=r.getPackages().reduce(function(S,M){return S[M.uri]=M.prefix,S},Object.entries(Ou).reduce(function(S,[M,I]){return S[I]=M,S},r.config&&r.config.nsMap||{}));return s.ns(x).on("openTag",function(S,M,I,A){var H=S.attrs||{},V=Object.keys(H).reduce(function(G,pe){var ze=M(H[pe]);return G[pe]=ze,G},{}),$={name:S.name,originalName:S.originalName,attributes:V,ns:S.ns};R($,A)}).on("question",g).on("closeTag",f).on("cdata",w).on("text",function(S,M,I){b(M(S),I)}).on("error",u).on("warn",l),new Promise(function(S,M){var I;try{s.parse(e),p()}catch(G){I=G}var A=i.element;!I&&!A&&(I=qi("failed to parse document as <"+i.type.$descriptor.name+">"));var H=a.warnings,V=a.references,$=a.elementsById;return I?(I.warnings=H,M(I)):S({rootElement:A,elementsById:$,references:V,warnings:H})})},Bu.prototype.handler=function(e){return new Nu(this.model,e)};function b0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var x0=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,w0=/<|>|'|"|&|\n\r|\n/g,ld=/<|>|&/g;function ci(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}ci.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},ci.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},ci.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},ci.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},ci.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},ci.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},ci.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},ci.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},ci.prototype.getUsed=function(e){var t=[].concat(this.wellknown,this.custom);return t.filter(n=>{var i=this.getNSKey(n);return this.used[i]})};function E0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function S0(e,t){return ad(t)?E0(e):e}function pd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function fd(e){return wn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function R0(e){return e.getUsed().filter(function(t){return t.prefix!=="xml"}).map(function(t){var n="xmlns"+(t.prefix?":"+t.prefix:"");return{name:n,value:t.uri}})}function C0(e,t){return t.isGeneric?O({localName:t.ns.localName},e):O({localName:S0(t.ns.localName,t.$pkg)},e)}function P0(e,t){return O({localName:t.ns.localName},e)}function A0(e){var t=e.$descriptor;return Ie(t.properties,function(n){var i=n.name;if(n.isVirtual||!En(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var T0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},M0={"<":"lt",">":"gt","&":"amp"};function dd(e,t,n){return e=wn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function k0(e){return dd(e,w0,T0)}function D0(e){return dd(e,ld,M0)}function O0(e){return Ie(e,function(t){return t.isAttr})}function L0(e){return Ie(e,function(t){return!t.isAttr})}function $u(e){this.tagName=e}$u.prototype.build=function(e){return this.element=e,this},$u.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Tr(){}Tr.prototype.serializeValue=Tr.prototype.serializeTo=function(e){e.append(this.escape?D0(this.value):this.value)},Tr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(ld)!==-1&&(this.escape=!0),this};function ju(e){this.tagName=e}pd(ju,Tr),ju.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function ht(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}ht.prototype.build=function(e){this.element=e;var t=e.$descriptor,n=this.propertyDescriptor,i,r,o=t.isGeneric;return o?i=this.parseGenericNsAttributes(e):i=this.parseNsAttributes(e),n?this.ns=this.nsPropertyTagName(n):this.ns=this.nsTagName(t),this.tagName=this.addTagName(this.ns),o?this.parseGenericContainments(e):(r=A0(e),this.parseAttributes(O0(r)),this.parseContainments(L0(r))),this.parseGenericAttributes(e,i),this},ht.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return C0(t,e)},ht.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return P0(t,e)},ht.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},ht.prototype.nsAttributeName=function(e){var t;if(wn(e)?t=an(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:O({localName:t.localName},n)},ht.prototype.parseGenericNsAttributes=function(e){return Object.entries(e).filter(([t,n])=>!t.startsWith("$")&&this.parseNsAttribute(e,t,n)).map(([t,n])=>({name:t,value:n}))},ht.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Tr().build({type:"String"},t));var n=e.$children;n&&k(n,i=>{this.body.push(new ht(this).build(i))})},ht.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=an(t),o;if(r.prefix==="xmlns"&&(o={prefix:r.localName,uri:n}),!r.prefix&&r.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},ht.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return k(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},ht.prototype.parseGenericAttributes=function(e,t){var n=this;k(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(r){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,r)}})},ht.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;k(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Tr().build(r,o[0]));else if(Jf(r.type))k(o,function(u){n.push(new ju(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)k(o,function(u){n.push(new $u(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=cd(r);k(o,function(u){var l;c?c===sd?l=new ht(t,r):l=new ts(t,r,c):l=new ht(t),n.push(l.build(u))})}})},ht.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new ci(i):t=i),t},ht.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix,a=i.byUri(r);return(!a||n)&&i.add(e,t),i.mapPrefix(o,r),e},ht.prototype.logNamespaceUsed=function(e,t){var n=this.getNamespaces(t),i=e.prefix,r=e.uri,o,a,s;if(!i&&!r)return{localName:e.localName};if(s=n.defaultUriByPrefix(i),r=r||s||n.uriByPrefix(i),!r)throw new Error("no namespace uri given for prefix <"+i+">");if(e=n.byUri(r),!e&&!i&&(e=this.logNamespace({uri:r},s===r,!0)),!e){for(o=i,a=1;n.uriByPrefix(o);)o=i+"_"+a++;e=this.logNamespace({prefix:o,uri:r},s===r)}return i&&n.mapPrefix(i,r),e},ht.prototype.parseAttributes=function(e){var t=this,n=this.element;k(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];k(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},ht.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),fd(e)},ht.prototype.addAttribute=function(e,t){var n=this.attrs;wn(t)&&(t=k0(t));var i=Kf(n,function(o){return o.name.localName===e.localName&&o.name.uri===e.uri&&o.name.prefix===e.prefix}),r={name:e,value:t};i!==-1?n.splice(i,1,r):n.push(r)},ht.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=R0(n).concat(t)),k(t,function(i){e.append(" ").append(fd(i.name)).append('="').append(i.value).append('"')})},ht.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Tr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),k(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function ts(e,t,n){ht.call(this,e,t),this.serialization=n}pd(ts,ht),ts.prototype.parseNsAttributes=function(e){var t=ht.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},ts.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function I0(){this.value="",this.write=function(e){this.value+=e}}function N0(e,t){var n=[""];this.append=function(i){return e.write(i),this},this.appendNewLine=function(){return t&&e.write(`
6
+ `),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function B0(e){e=O({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new I0,o=new N0(r,e.format);e.preamble&&o.append(x0);var a=new ht,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes($0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function $0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Ou)n[i]=Ou[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function ns(e,t){zn.call(this,e,t)}ns.prototype=Object.create(zn.prototype),ns.prototype.fromXML=function(e,t,n){wn(t)||(n=t,t="bpmn:Definitions");var i=new Bu(O({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},ns.prototype.toXML=function(e,t){var n=new B0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var j0="BPMN20",F0="http://www.omg.org/spec/BPMN/20100524/MODEL",H0="bpmn",z0=[],V0=[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",isMany:!0,replaces:"FlowElementsContainer#laneSets",type:"LaneSet"},{name:"flowElements",isMany:!0,replaces:"FlowElementsContainer#flowElements",type:"FlowElement"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}},{name:"assignment",type:"Assignment",isMany:!0}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",isBody:!0,type:"String"}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isMany:!0,isVirtual:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity","InteractionNode"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],G0=[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],W0={tagAlias:"lowerCase",typePrefix:"t"},U0={name:j0,uri:F0,prefix:H0,associations:z0,types:V0,enumerations:G0,xml:W0},Y0="BPMNDI",q0="http://www.omg.org/spec/BPMN/20100524/DI",K0="bpmndi",X0=[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],Z0=[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],Q0=[],J0={name:Y0,uri:q0,prefix:K0,types:X0,enumerations:Z0,associations:Q0},ew="DC",tw="http://www.omg.org/spec/DD/20100524/DC",nw="dc",iw=[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],rw=[],ow={name:ew,uri:tw,prefix:nw,types:iw,associations:rw},aw="DI",sw="http://www.omg.org/spec/DD/20100524/DI",cw="di",uw=[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isMany:!0,isVirtual:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isMany:!0,isVirtual:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",isAttr:!0,isId:!0,type:"String"}]},{name:"Extension",properties:[{name:"values",isMany:!0,type:"Element"}]}],lw=[],pw={tagAlias:"lowerCase"},fw={name:aw,uri:sw,prefix:cw,types:uw,associations:lw,xml:pw},dw="bpmn.io colors for BPMN",hw="http://bpmn.io/schema/bpmn/biocolor/1.0",mw="bioc",gw=[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],yw=[],vw=[],_w={name:dw,uri:hw,prefix:mw,types:gw,enumerations:yw,associations:vw},bw="BPMN in Color",xw="http://www.omg.org/spec/BPMN/non-normative/color/1.0",ww="color",Ew=[{name:"ColoredLabel",extends:["bpmndi:BPMNLabel"],properties:[{name:"color",isAttr:!0,type:"String"}]},{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"background-color",isAttr:!0,type:"String"},{name:"border-color",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"border-color",isAttr:!0,type:"String"}]}],Sw=[],Rw=[],Cw={name:bw,uri:xw,prefix:ww,types:Ew,enumerations:Sw,associations:Rw};const Pw={bpmn:U0,bpmndi:J0,dc:ow,di:fw,bioc:_w,color:Cw};function hd(e,t){const n=O({},Pw,e);return new ns(n,t)}const Aw={name:"bpmn-i18n",uri:"http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",prefix:"i18n",types:[{name:"Translation",superClass:["Element"],properties:[{name:"id",isAttr:!0,isId:!0,type:"String"},{name:"body",isBody:!0,type:"String"},{name:"target",isAttr:!0,type:"String",default:"@name"},{name:"textFormat",isAttr:"true",type:"String",default:"text/plain"}]}],enumerations:[],associations:[],xml:{tagAlias:"lowerCase",typePrefix:"t"}},Tw="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",md="i18n",is={[md]:Aw,[wu]:Gf};function gd(){return hd(is)}const yd=gd();async function Fu(e){const{rootElement:t,warnings:n}=await yd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function Mw(e){const{xml:t}=await yd.toXML(e,{format:!0});return t}function Hu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const io={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},kw=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function Dw(e){const t=io;return kw.test(e)?t.cjkEm:e===" "?t.spaceEm:e>="0"&&e<="9"?t.digitEm:e>="A"&&e<="Z"?t.upperEm:e>="a"&&e<="z"?t.lowerEm:t.otherEm}function ro(e,t){let n=0;for(const i of e)n+=t*Dw(i);return n}function vd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&Ow(e),Lw(e),Iw(e),Nw(e)}function Ow(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(r){var a;const o=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:ro(r,o),fontBoundingBoxAscent:o*io.ascentEm,fontBoundingBoxDescent:o*io.descentEm,actualBoundingBoxAscent:o*io.ascentEm,actualBoundingBoxDescent:o*io.descentEm}}};t.getContext=()=>n}function Lw(e){if(e.SVGMatrix)return;class t{constructor(){Xr(this,"a",1);Xr(this,"b",0);Xr(this,"c",0);Xr(this,"d",1);Xr(this,"e",0);Xr(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function Iw(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,p=Math.cos(l),f=Math.sin(l);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*u,a.f=u-f*c-p*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function Nw(e){const t=e.SVGElement.prototype;if(!t.getCTM){const n=()=>new e.SVGMatrix;t.getCTM=n,t.getScreenCTM=n}t.getBBox||(t.getBBox=function(){const n=String(this.textContent??"");return{x:0,y:0,width:ro(n,12),height:14}})}const rs=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),Bw=1,$w=2;function Ki(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const _d=20,bd=5,jw=3,xd=12,Fw=xd*1.2;function zu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>ro(o,xd))),r=n.length*Fw;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const wd=1;function mn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function os(e,t){let n=null;const i=e.type!==t.type;for(const r of mn(e))for(const o of mn(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>wd)continue;const a=r.dir!==o.dir?"opposite":i?"mixed":null;if(!a)continue;const s=Math.min(r.hi,o.hi)-Math.max(r.lo,o.lo);s>=_d&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function Ed(e,t){const n=os(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function Hw(e,t){let n=0;for(const i of t)i.id!==e.id&&Ed(e,i)&&n++;return n}function Mr(e,t){let n=0;for(const i of t)i.id!==e.id&&os(e,i)&&n++;return n}const Sd=15,Rd=20;function zw(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Rd||t.at>n[1]+Rd)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],r=Math.max(i[0],t.lo),o=Math.min(i[1],t.hi);return o>r?[r,o]:null}const Vu=20;function as(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>wd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<_d||n.push([r-Vu,o+Vu])}return n}function ss(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of mn(e)){const o=zw(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of as(r,mn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const Vw=1,Gw=(e,t,n)=>t.x>=e.x-n&&t.y>=e.y-n&&t.x+t.width<=e.x+e.width+n&&t.y+t.height<=e.y+e.height+n;function Ww(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,p=1;const f=(d,h)=>{if(h===0)return d<=0;const m=d/h;if(h>0){if(m>p)return!1;m>l&&(l=m)}else{if(m<l)return!1;m<p&&(p=m)}return!0};return f(r-e.x,c)&&f(e.x-a,-c)&&f(o-e.y,u)&&f(e.y-s,-u)&&p>l}function Gu(e,t,n){return e.x+n<t.x+t.width-n&&t.x+n<e.x+e.width-n&&e.y+n<t.y+t.height-n&&t.y+n<e.y+e.height-n}const Uw=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,oo=1;function Ri(e,t){const n=e.x+oo,i=e.x+e.width-oo,r=e.y+oo,o=e.y+e.height-oo;return t.axis==="h"?t.at>r&&t.at<o&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<o&&t.hi>r}function Wo(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function Cd(e,t){const n=e.label;if(!n)return null;if(mn(e).some(i=>Ri(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(mn(i).some(r=>Ri(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Wo(i).some(r=>Ri(n,r)))return i.id;return null}function Vn(e,t){const n=new Set(e.endpoints),i=[];for(const r of t)if(!n.has(r.id)){for(let o=0;o+1<e.waypoints.length;o++)if(Ww(e.waypoints[o],e.waypoints[o+1],r,$w)){i.push(r);break}}return i}function Yw(e,t,n,i){const r=(u,l,p)=>(l.x-u.x)*(p.y-u.y)-(l.y-u.y)*(p.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Pd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function cs(e,t){let n=0;for(const i of t){if(i.id===e.id||Pd(e,i))continue;let r=!1;for(let o=0;o+1<e.waypoints.length&&!r;o++)for(let a=0;a+1<i.waypoints.length&&!r;a++)Yw(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Ci(e,t){let n=0;for(const i of t)i.id===e.id||Pd(e,i)||cs(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Ad(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)cs(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Wu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(cs(n[i],[n[r]])>0){const o=n[i].id,a=n[r].id;t.push(o<a?[o,a]:[a,o])}return t.sort((i,r)=>`${i[0]}|${i[1]}`.localeCompare(`${r[0]}|${r[1]}`))}function Td(e){var n;const t=(n=mt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=mt(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const Md=e=>e?{members:e}:{},Pi=e=>e.shapes.filter(t=>!t.container);function qw(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const r=i.endpoints.find(a=>a!==e.id),o=r?n.get(r):void 0;if(o){if(o.container)return o.id;if(o.parent)return o.parent}}}function kd(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(mn(i).some(r=>Ri(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Wo(i).some(r=>Ri(n,r)))return i.id;return null}function Uo(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function Xi(e){const t=[],n=e.shapes.filter(p=>!p.container);for(const p of e.edges)for(const f of Vn(p,n))t.push({kind:"edge-crosses-shape",edge:p.id,shape:f.id});const i=n.filter(p=>!p.attached);for(let p=0;p<i.length;p++)for(let f=p+1;f<i.length;f++){const d=i[p],h=i[f];if(!Gu(d,h,Bw))continue;const m=d.id<h.id?[d.id,h.id]:[h.id,d.id];t.push({kind:"shape-overlap",shapes:m,identical:Uw(d,h)})}const r=e.shapes.filter(p=>p.type==="bpmn:Group"&&Array.isArray(p.members)&&p.members.length>0);for(let p=0;p<r.length;p++)for(let f=p+1;f<r.length;f++){const d=r[p],h=r[f],m=Math.min(d.x+d.width,h.x+h.width)-Math.max(d.x,h.x),g=Math.min(d.y+d.height,h.y+h.height)-Math.max(d.y,h.y);if(m<=bd||g<=bd)continue;const R=new Set(h.members);d.members.some(w=>R.has(w))||t.push({kind:"group-overlap-unintended",groups:d.id<h.id?[d.id,h.id]:[h.id,d.id]})}const o=e.shapes.filter(p=>p.container&&p.type!=="bpmn:Group"&&p.type!=="bpmn:Lane");for(const p of e.shapes.filter(f=>f.type==="bpmn:Group"))for(const f of o){const d=p.x<f.x+f.width&&f.x<p.x+p.width,h=p.y<f.y+f.height&&f.y<p.y+p.height,m=[["top",p.y,f.y,d],["bottom",p.y+p.height,f.y+f.height,d],["left",p.x,f.x,h],["right",p.x+p.width,f.x+f.width,h]];for(const[g,R,w,b]of m)b&&Math.abs(R-w)<=jw&&t.push({kind:"group-on-container-boundary",group:p.id,container:f.id,side:g})}for(let p=0;p<e.edges.length;p++)for(let f=p+1;f<e.edges.length;f++){const d=e.edges[p],h=e.edges[f],m=os(d,h);if(!m)continue;const g=d.id<h.id?[d.id,h.id]:[h.id,d.id];t.push({kind:m.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:g,axis:m.axis,length:Math.round(m.length)})}for(const p of e.edges){if(!p.label)continue;const f=ss(p,e.edges);f&&t.push({kind:"label-on-shared-segment",edge:p.id,other:f.other,axis:f.axis})}for(const p of e.edges){if(!p.label)continue;const f=Cd(p,e);f&&t.push({kind:"label-over-line",edge:p.id,line:f})}const a=new Set(n.map(p=>p.id)),s=e.shapes.filter(p=>p.type==="bpmn:Participant"&&p.label);for(const p of[...n,...s.filter(f=>!a.has(f.id))]){if(!p.label)continue;const f=kd(p,e);f&&t.push({kind:"label-over-line",edge:p.id,line:f})}const c=new Set(e.shapes.filter(p=>p.type==="bpmn:TextAnnotation").map(p=>p.id));for(const p of s)for(const{owner:f,rect:d}of Uo(e))f===p.id||c.has(f)||Gu(p.label,d,oo)&&t.push({kind:"pool-name-over-label",pool:p.id,label:f});const u=Uo(e);for(const p of n)if(p.type==="bpmn:TextAnnotation")for(const{owner:f,rect:d}of u)f!==p.id&&Gu(p,d,oo)&&t.push({kind:"annotation-over-label",annotation:p.id,label:f});const l=new Map(e.shapes.map(p=>[p.id,p]));for(const p of n){const f=p.parent??qw(p,e,l);if(!f)continue;const d=l.get(f);!d||!d.container||Gw(d,p,Vw)||t.push({kind:"shape-outside-container",shape:p.id,container:d.id})}return t.sort((p,f)=>Ki(p).localeCompare(Ki(f)))}const mt=e=>typeof e=="object"&&e!==null?e:void 0,xt=e=>typeof e=="number"?e:0,kr=e=>{const t=mt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function Kw(e){const t=mt(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=kr(o);a&&n.push(a)}}return n}function Xw(e,t){const n=mt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=kr(n);return r?t.get(r):void 0}if(rs.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return kr(n)}function Dd(e){var a,s,c,u,l;const t=[],n=[],i=((a=mt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=mt(e))==null?void 0:s.rootElements)??[]){const f=mt(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const h=mt(d),m=kr(h),g=kr(h==null?void 0:h.processRef);m&&g?r.set(g,m):m&&o.add(m)}}for(const p of i){const f=mt((c=mt(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const h of d){const m=mt(h);if(!m)continue;const g=mt(m.bpmnElement),R=typeof(g==null?void 0:g.id)=="string"?g.id:void 0;if(!R)continue;const w=typeof(g==null?void 0:g.$type)=="string"?g.$type:"",b=mt(m.bounds);if(b){const S=m.isExpanded===!1&&w!=="bpmn:Participant",M=mt((u=mt(m.label))==null?void 0:u.bounds),I={id:R,type:w,x:xt(b.x),y:xt(b.y),width:xt(b.width),height:xt(b.height),container:rs.has(w)&&!S,attached:(g==null?void 0:g.attachedToRef)!==void 0,...g?{parent:Xw(g,r)}:{},...M?{label:{x:xt(M.x),y:xt(M.y),width:xt(M.width),height:xt(M.height)}}:{},...w==="bpmn:Group"?Md(Td(g)):{}},A=m.isHorizontal!==!1,H=typeof(g==null?void 0:g.name)=="string"?g.name:"";o.has(R)&&A&&H&&(I.label=zu(I,H)),t.push(I);continue}const x=m.waypoint;if(Array.isArray(x)){const S=mt((l=mt(m.label))==null?void 0:l.bounds);n.push({id:R,type:w,waypoints:x.map(M=>{var I,A;return{x:xt((I=mt(M))==null?void 0:I.x),y:xt((A=mt(M))==null?void 0:A.y)}}),endpoints:Kw(g),...S?{label:{x:xt(S.x),y:xt(S.y),width:xt(S.width),height:xt(S.height)}}:{}})}}}return{shapes:t,edges:n}}function Od(e){return Xi(Dd(e))}async function Zw(e){const{definitions:t,warnings:n}=await Fu(e);return{findings:Od(t),warnings:n}}function jt(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const m=mt(o.label);n.push({id:o.id,type:a,waypoints:s.map(g=>({x:xt(g.x),y:xt(g.y)})),endpoints:[kr(o.source),kr(o.target)].filter(g=>!!g),...m&&typeof m.x=="number"?{label:{x:m.x,y:xt(m.y),width:xt(m.width),height:xt(m.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=mt(o.businessObject),u=mt(o.label);let l=mt(o.parent);for(;l&&l.type==="bpmn:Lane";)l=mt(l.parent);const p=typeof(l==null?void 0:l.type)=="string"?l.type:"",f=l&&rs.has(p)&&p!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:xt(o.width),height:xt(o.height),container:rs.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:xt(u.y),width:xt(u.width),height:xt(u.height)}}:{},...a==="bpmn:Group"?Md(Td(c)):{}},h=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&h&&((i=mt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=zu(d,h)),t.push(d)}return{shapes:t,edges:n}}const Qw={"bpmn:Participant":"participant","bpmn:Lane":"lane","bpmn:SequenceFlow":"sequenceFlow","bpmn:MessageFlow":"messageFlow","bpmn:DataStoreReference":"dataStore","bpmn:DataInputAssociation":"dataAssociation","bpmn:DataOutputAssociation":"dataAssociation","bpmn:TextAnnotation":"annotation","bpmn:Association":"association","bpmn:Group":"group"};function Jw(e,t){const n=Qw[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Ld(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Id(e){const t=()=>e.getAll().filter(n=>n.type!=="label"&&!("labelTarget"in n&&n.labelTarget));return{isCollaboration:()=>t().some(n=>n.type==="bpmn:Participant"),categoryOf:n=>{const i=e.get(n);if(!(!i||i.type==="label"))return Jw(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Ld(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Ld(i):void 0},endpointsOf:n=>{var r,o;const i=e.get(n);if(!(!i||i.type==="label")&&"waypoints"in i)return{source:(r=i.source)==null?void 0:r.id,target:(o=i.target)==null?void 0:o.id}}}}const Nd=20,eE=4,Pt=(e,t)=>Math.abs(e-t)<.5;function Bd(e,t,n,i=Nd){if(Pt(e.y,t.y)&&!Pt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=u=>[{x:a,y:e.y},{x:a,y:u},{x:s,y:u},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(Pt(e.x,t.x)&&!Pt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=u=>[{x:e.x,y:a},{x:u,y:a},{x:u,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function $d(e,t,n=Nd){if(e.length!==4)return null;const[i,r,o,a]=e;if(Pt(i.y,r.y)&&Pt(r.x,o.x)&&Pt(o.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(Pt(i.x,r.x)&&Pt(r.y,o.y)&&Pt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function Uu(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const jd=30,tE=[0,-25,25,-40,40];function nE(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+jd:s-jd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return tE.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const iE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],us=(e,t,n)=>Vn({...e,waypoints:t},n).length;function Fd(e,t,n,i){let r=[...e.waypoints],o=us(e,r,t);if(o===0)return null;let a=!1;for(const p of Uu(e,t))if(us(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(mn),c=p=>mn({...e,waypoints:p}).some(f=>as(f,s).length>0),u=nE(e,t).filter(p=>us(e,p,t)===0);if(u.length)return u.find(p=>!c(p))??u[0];const l=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);for(let p=0;p<eE&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const h=r[d],m=r[d+1];for(const g of t){if(e.endpoints.includes(g.id)||Vn({...e,waypoints:[h,m]},[g]).length===0)continue;const R=Bd(h,m,g),w=R?R.map(x=>iE(r,d,x)):$d(r,g)??[];if(!w.length)continue;const b=[...w].sort((x,S)=>Number(l(S))-Number(l(x)));for(const x of b){const S=us(e,x,t);if(S<o){r=x,o=S,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function Hd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=jt(n),o=Pi(r),a=Xi(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Ki(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const p=l.parent,f=p&&typeof p.x=="number"&&typeof p.width=="number"?{x:p.x,y:p.y,width:p.width,height:p.height}:void 0,d=Fd(u,o,f,r.edges);d&&i.updateWaypoints(l,d)}}const rE=10;function zd(e,t){if(e.parent){const r=t.find(o=>o.id===e.parent);if(r)return r}const n=e.x+e.width/2,i=e.y+e.height/2;return t.find(r=>n>=r.x&&n<=r.x+r.width&&i>=r.y&&i<=r.y+r.height)}function Vd(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(G=>G.type==="bpmn:Participant"&&G.container),i=t.shapes.find(G=>G.id===e.endpoints[0]),r=t.shapes.find(G=>G.id===e.endpoints[1]);if(!i||!r)return null;const o=zd(i,n),a=zd(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter(G=>G.id!==o.id&&G.id!==a.id&&G.y>=c.y+c.height&&G.y+G.height<=u.y).sort((G,pe)=>G.y-pe.y);if(!l.length)return null;const p=l[0],f=l[l.length-1],d=(c.y+c.height+p.y)/2,h=(f.y+f.height+u.y)/2,m=s?d:h,g=s?h:d,R=e.waypoints[0],w=e.waypoints[e.waypoints.length-1],b=Pi(t),x=t.edges.filter(G=>G.id!==e.id),S=Ci(e,x),M=Vn(e,b).length;if(S===0&&M===0||M===0&&e.waypoints.length===2)return null;const I=Math.min(...l.map(G=>G.x)),A=Math.max(...l.map(G=>G.x+G.width)),H=(R.x+w.x)/2,V=G=>G.filter((pe,ze)=>ze===0||!(Pt(pe.x,G[ze-1].x)&&Pt(pe.y,G[ze-1].y)));let $;for(let G=I;G<=A;G+=rE){const pe=V([R,{x:R.x,y:m},{x:G,y:m},{x:G,y:g},{x:w.x,y:g},w]),ze={...e,waypoints:pe};if(Vn(ze,b).length>0)continue;const lt=Ci(ze,x),Y=Math.abs(G-H);(!$||lt<$.cross||lt===$.cross&&Y<$.detour)&&($={pts:pe,cross:lt,detour:Y})}return $&&(M>0?$.cross<=S:$.cross<S)?$.pts:null}function Gd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=jt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=jt(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=Vd(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const ao=[25,-25,40,-40],ls=35;function Wd(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-ls:n.y+n.height+ls,p=[];for(const w of[0,...ao]){if(Math.abs(w)>=i.width/2-5)continue;const b=o+w;p.push({pts:[{x:n.x,y:r},{x:b,y:r},{x:b,y:c}],cost:Math.abs(w)});for(const x of[0,...ao]){if(Math.abs(x)>=n.width/2-5)continue;const S=a+x;p.push({pts:[{x:S,y:u},{x:S,y:l},{x:b,y:l},{x:b,y:c}],cost:Math.abs(w)+Math.abs(x)})}}const f=50,d=i.y+i.height/2,h=s?n.y+n.height:n.y;for(const w of[0,...ao]){if(Math.abs(w)>=n.width/2-5)continue;const b=a+w;p.push({pts:[{x:b,y:h},{x:b,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(w)})}const m=60,g=s?i.y+i.height:i.y,R=s?i.y+i.height+ls:i.y-ls;for(const w of[0,...ao]){if(Math.abs(w)>=i.width/2-5)continue;const b=o+w;for(const x of[0,...ao]){if(Math.abs(x)>=n.width/2-5)continue;const S=a+x;p.push({pts:[{x:S,y:h},{x:S,y:R},{x:b,y:R},{x:b,y:g}],cost:m+Math.abs(w)+Math.abs(x)})}}return p}const ps=30;function Ud(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Pt(i.y,r.y)&&!Pt(i.x,r.x),a=Pt(i.x,r.x)&&!Pt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<ps||Math.abs(i.y-(s.y+s.height))<ps)return!0}else{const c=Math.min(i.y,r.y);if(Math.max(i.y,r.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<ps||Math.abs(i.x-(s.x+s.width))<ps)return!0}}return!1}const fs=40;function oE(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-fs,a=r.x+r.width+fs,s=r.y-fs,c=r.y+r.height+fs;for(let u=1;u<e.length-2;u++){const l=e[u],p=e[u+1],f={x:Math.min(l.x,p.x),y:Math.min(l.y,p.y)},d={x:Math.max(l.x,p.x),y:Math.max(l.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function Yd(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(w=>w.container),i=new Map(t.shapes.map(w=>[w.id,w])),r=Pi(t),o=t.edges.filter(w=>w.id!==e.id),a=Mr(e,o),s=Ci(e,o),c=w=>oE(w,t.shapes,e.endpoints)+(Ud(w,n)?1:0),u=c(e.waypoints),l=w=>{if(!w)return;const b=w.x+w.width/2,x=w.y+w.height/2;return n.find(S=>S.type==="bpmn:Lane"&&b>=S.x&&b<=S.x+S.width&&x>=S.y&&x<=S.y+S.height)},p=l(i.get(e.endpoints[0]??"")),f=l(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,h=w=>{if(!d||!f)return!1;for(let b=1;b<w.length-2;b++){const x=w[b],S=w[b+1];if(Pt(x.y,S.y)&&!Pt(x.x,S.x)&&x.y>f.y&&x.y<f.y+f.height)return!0}return!1},m=h(e.waypoints);if(!Ud(e.waypoints,n)&&!(d&&!m))return null;const g=w=>w.reduce((b,x,S)=>S?b+Math.abs(x.x-w[S-1].x)+Math.abs(x.y-w[S-1].y):0,0);let R;for(const{pts:w,cost:b}of Wd(e,i)){const x={...e,waypoints:w};if(Vn(x,r).length>0||Mr(x,o)>a||Ci(x,o)>s)continue;const S=c(w),M=h(w);if(!(M&&!m)&&S>=u)continue;const A=M?0:1,H=g(w);(!R||A<R.lane||A===R.lane&&(S<R.sc||S===R.sc&&(b<R.cost||b===R.cost&&H<R.len)))&&(R={pts:w,sc:S,lane:A,cost:b,len:H})}return(R==null?void 0:R.pts)??null}function aE(e,t){const{elementRegistry:n}=e,i=e.modeling,r=jt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=jt(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=Pi(a),u=a.edges.filter(d=>d.id!==o),l=Vn(s,c).length,p=Mr(s,u),f=Ci(s,u);for(const d of Uu(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const h={...s,waypoints:d};if(Vn(h,c).length>l||Mr(h,u)>p||Ci(h,u)>f)continue;const m=n.get(o);m&&i.updateWaypoints(m,d);break}}}function qd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=jt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=jt(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=Yd(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function sE(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],r=t.get(e.endpoints[0]??""),o=t.get(e.endpoints[1]??""),a=Pt(n[0].x,n[1].x)&&!Pt(n[0].y,n[1].y),s=Pt(n[n.length-1].x,n[n.length-2].x)&&!Pt(n[n.length-1].y,n[n.length-2].y);for(const c of ao){if(a&&r&&Math.abs(c)<r.width/2-5){const u=n.map(l=>({...l}));u[0].x+=c,u[1].x+=c,i.push({pts:u,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const u=n.map(l=>({...l}));u[u.length-1].x+=c,u[u.length-2].x+=c,i.push({pts:u,cost:Math.abs(c)})}}return i}function Kd(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=Pi(t),r=t.edges.filter(l=>l.id!==e.id),o=Mr(e,r);if(o===0)return null;const a=Ci(e,r);let s;const c=l=>l.reduce((p,f,d)=>d?p+Math.abs(f.x-l[d-1].x)+Math.abs(f.y-l[d-1].y):0,0),u=[...Wd(e,n),...sE(e,n)];for(const{pts:l,cost:p}of u){const f={...e,waypoints:l};if(Vn(f,i).length>0)continue;const d=Mr(f,r),h=Ci(f,r);if(d>=o||h-a>o-d)continue;const m=c(l);(!s||d<s.opposite||d===s.opposite&&(h<s.cross||h===s.cross&&(p<s.cost||p===s.cost&&m<s.len)))&&(s={pts:l,opposite:d,cross:h,cost:p,len:m})}return(s==null?void 0:s.pts)??null}function Xd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=jt(i),a=Xi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(Ki(l)));if(!a.length)return;const s=new Set;for(const l of a)if(!(l.kind!=="edge-overlap-opposite"&&l.kind!=="edge-overlap-mixed"))for(const p of l.edges)n.has(p)||s.add(p);const c=l=>{var p;return((p=o.edges.find(f=>f.id===l))==null?void 0:p.type)??""},u=[...s].sort((l,p)=>{const f=c(l)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:l.localeCompare(p)});for(const l of u){const p=jt(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=Kd(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const cE=10,uE=(e,t)=>e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height;function Zd(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!ss(e,i))return null;const r=Pi(t),o=i.flatMap(mn);for(const a of mn(e)){let s=[[a.lo,a.hi]];for(const[d,h]of as(a,o))s=s.flatMap(([m,g])=>{const R=[];return d>m&&R.push([m,Math.min(g,d)]),h<g&&R.push([Math.max(m,h),g]),R.filter(([w,b])=>b>w)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+cE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-Sd}:{x:a.at+Rn+n.width/2,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!ss({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&uE(f,d)))return f}return null}const Rn=8;function Qd(e,t){const n=e.label;if(!n)return null;const i=mn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=f=>{const d=f.axis==="h"?r:o,h=f.axis==="h"?o-f.at:r-f.at,m=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(h,m)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(mn),...t.shapes.filter(f=>f.container).flatMap(Wo)],u=f=>!c.some(d=>Ri(f,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Rn,p=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const f of[s.at+Rn,s.at-Rn-n.width])for(const d of p){const h=n.y+d;if(h<s.lo||h+n.height>s.hi)continue;const m={...n,x:f,y:h};if(u(m))return m}else for(const f of[s.at-Rn-n.height,s.at+Rn])for(const d of p){const h=n.x+d;if(h<s.lo||h+n.width>s.hi)continue;const m={...n,x:h,y:f};if(u(m))return m}return null}function Jd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=jt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=Qd(o,r);if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function eh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=jt(i),a=Xi(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Ki(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(f=>f.id===s.edge);if(!c)continue;const u=Zd(c,o);if(!u)continue;const l=i.get(s.edge),p=l==null?void 0:l.label;p&&r.moveElements([p],{x:u.x-p.x,y:u.y-p.y})}}function th(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(mn),...t.shapes.filter(f=>f.container).flatMap(Wo)],r=i.filter(f=>Ri(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=Uo(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Ri(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),u=[];for(const f of r)f.axis==="h"?u.push({...n,y:f.at-Rn-n.height},{...n,y:f.at+Rn}):u.push({...n,x:f.at-Rn-n.width},{...n,x:f.at+Rn});const l=e.x+e.width/2,p=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Rn},{...n,x:l-n.width/2,y:e.y-Rn-n.height},{...n,x:e.x+e.width+Rn,y:p-n.height/2},{...n,x:e.x-Rn-n.width,y:p-n.height/2}),u.find(c)??null}function nh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=jt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=th(o,jt(n));if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}const lE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,ih=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),rh={"participant.add":[{path:"participant",shape:["id"]},{path:"participant.lanes[]",shape:["id"],optional:!0}],"participant.update":[{path:"id",shape:null},{path:"lanes[]",shape:["id"],optional:!0}],"node.add":[{path:"node",shape:["id","type"]}],"node.update":[{path:"id",shape:null}],"sequenceFlow.add":[{path:"flow",shape:["id","source","target"]}],"sequenceFlow.update":[{path:"id",shape:null}],"messageFlow.add":[{path:"flow",shape:["id","source","target"]}],"messageFlow.update":[{path:"id",shape:null}],"dataStore.add":[{path:"dataStore",shape:["id"]},{path:"associations[]",shape:["source","target"],optional:!0}],"dataStore.update":[{path:"id",shape:null}],"dataAssociation.add":[{path:"association",shape:["source","target"]}],"association.add":[{path:"association",shape:["source","target"]}],"annotation.add":[{path:"annotation",shape:["id","text"]},{path:"association",shape:["source","target"],optional:!0},{path:"placement",shape:["anchor","side"],optional:!0}],"annotation.update":[{path:"id",shape:null},{path:"placement",shape:["anchor","side"],optional:!0}],"group.add":[{path:"group",shape:["id"]},{path:"group.members[]",shape:null,optional:!0}],"group.update":[{path:"id",shape:null},{path:"members[]",shape:null,optional:!0}],"element.remove":[{path:"id",shape:null}]},ds=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Yu=e=>typeof e=="string"&&e!=="";function pE(e){const t=[];function n(i,r,o,a){if(a===null){Yu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ds(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Yu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!ds(i)||!Yu(i.kind)||!(i.kind in rh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of rh[i.kind]){const a=o.path.endsWith("[]"),s=a?o.path.slice(0,-2):o.path,c=s.split(".");let u=i;for(const p of c.slice(0,-1)){if(!ds(u))break;u=u[p]}if(!ds(u))continue;const l=u[c[c.length-1]];if(!(l===void 0&&o.optional)&&!(l===null&&o.optional)){if(!a){n(r,o.path,l,o.shape);continue}if(!Array.isArray(l)){t.push({kind:"payload-invalid",opIndex:r,field:o.path});continue}l.forEach((p,f)=>n(r,`${s}[${f}]`,p,o.shape))}}if(i.kind==="node.add"){const o=i.band;o!==void 0&&(!Number.isInteger(o)||o<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"})}}),t}function oh(e,t){const n=pE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!lE.test(d)){i.push({kind:"id-invalid",opIndex:f,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:f,id:d});return}r.set(d,{...h,opIndex:f})}e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(m=>m.id)});for(const m of f.participant.lanes??[])a(d,m.id,{category:"lane"});break;case"node.add":a(d,f.node.id,{category:"flowNode",participant:f.node.participant});break;case"sequenceFlow.add":a(d,f.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,f.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,f.dataStore.id,{category:"dataStore"});for(const m of f.associations??[])m.id&&a(d,m.id,{category:"dataAssociation"});break;case"dataAssociation.add":f.association.id&&a(d,f.association.id,{category:"dataAssociation"});break;case"association.add":f.association.id&&a(d,f.association.id,{category:"association"});break;case"annotation.add":a(d,f.annotation.id,{category:"annotation"}),(h=f.association)!=null&&h.id&&a(d,f.association.id,{category:"association"});break;case"group.add":a(d,f.group.id,{category:"group"});break;case"participant.update":if(f.lanes){o.set(f.id,f.lanes.map(m=>m.id));for(const m of f.lanes)t.categoryOf(m.id)===void 0&&a(d,m.id,{category:"lane"})}break}});const s=f=>{var d;return((d=r.get(f))==null?void 0:d.category)??t.categoryOf(f)},c=f=>{const d=r.get(f);return d?d.category==="participant"?f:d.participant:t.categoryOf(f)==="participant"?f:t.participantOf(f)};function u(f,d,h,m){const g=s(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:h});return}if(m&&!m.includes(g)){i.push({kind:"ref-category",opIndex:f,ref:d,role:h,expected:m.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var h;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:m,lane:g}=f.node;if(m===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,m,"participant",["participant"])===void 0)break;g!==void 0&&((((h=r.get(m))==null?void 0:h.lanes)??o.get(m)??t.lanesOf(m)).includes(g)||i.push({kind:"lane-unknown",opIndex:d,lane:g,participant:m}));break}case"sequenceFlow.add":{const{id:m,source:g,target:R,name:w,condition:b}=f.flow,x=u(d,g,"source",["flowNode"]),S=u(d,R,"target",["flowNode"]);x&&S&&c(g)!==c(R)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),w!==void 0&&b!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:m});break}case"messageFlow.add":{const{id:m,source:g,target:R}=f.flow,w=u(d,g,"source",["flowNode","participant"]),b=u(d,R,"target",["flowNode","participant"]);if(w&&b){const x=c(g),S=c(R);x!==void 0&&x===S&&i.push({kind:"message-flow-same-pool",opIndex:d,id:m})}break}case"dataStore.add":{for(const m of f.associations??[]){if([m.source,m.target].filter(w=>w===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const R=m.source===f.dataStore.id?m.target:m.source;u(d,R,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=f.association,R=u(d,m,"source"),w=u(d,g,"target");if(R&&w){const b=new Set([R,w]);b.has("dataStore")&&b.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:m,target:g})}break}case"association.add":{const{id:m,source:g,target:R}=f.association,w=u(d,g,"source"),b=u(d,R,"target");w&&b&&w!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${R}`});break}case"annotation.add":{if(f.association){const{source:m,target:g}=f.association;if(m!==f.annotation.id&&g!==f.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:f.annotation.id});else{const R=m===f.annotation.id?g:m;u(d,R,"association")}}f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.add":{for(const m of f.group.members??[]){const g=u(d,m,"member");g&&ih.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const m=t.lanesOf(f.id),g=f.lanes.map(w=>w.id);for(const w of m)g.includes(w)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:w});for(const w of g)t.categoryOf(w)!==void 0&&!m.includes(w)&&i.push({kind:"id-duplicate",opIndex:d,id:w});const R=g.filter(w=>m.includes(w));R.length===m.length&&R.some((w,b)=>w!==m[b])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:f.id})}break}case"node.update":{if(p(d,f.id,"flowNode")===void 0)break;if(f.lane!==void 0){const m=t.participantOf(f.id);(m?o.get(m)??t.lanesOf(m):[]).includes(f.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:f.lane,participant:m??""})}break}case"sequenceFlow.update":{if(p(d,f.id,"sequenceFlow")===void 0)break;if(f.name!==void 0&&f.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:f.id}),f.source!==void 0||f.target!==void 0){const m=f.source===void 0||u(d,f.source,"source",["flowNode"])!==void 0,g=f.target===void 0||u(d,f.target,"target",["flowNode"])!==void 0,R=t.endpointsOf(f.id),w=f.source??(R==null?void 0:R.source),b=f.target??(R==null?void 0:R.target);m&&g&&w!==void 0&&b!==void 0&&new Set([c(w),c(b),c(f.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:f.id})}break}case"messageFlow.update":p(d,f.id,"messageFlow");break;case"dataStore.update":p(d,f.id,"dataStore");break;case"annotation.update":{if(p(d,f.id,"annotation")===void 0)break;f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.update":{if(p(d,f.id,"group")===void 0)break;for(const m of f.members??[]){const g=u(d,m,"member");g&&ih.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:m,role:"member",expected:"shape",actual:g})}break}case"element.remove":{p(d,f.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:f.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function p(f,d,h){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const m=t.categoryOf(d);if(m===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(h&&m!==h){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:h,actual:m});return}return m}}function ah(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function hs(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const qu={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]};function Zt(e,t){return e.filter(n=>n.kind===t)}function sh(e,t){var Tx,Mx,kx,Dx,Ox,Lx;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=E=>o.get(E),p=E=>{const C=l(E);if(!C)throw new Error(`하강 참조 해소 실패: ${E}`);return C},f=E=>{let C=E.parent;for(;C;){if(C.type==="bpmn:Participant")return C;C=C.parent}},d=Zt(e,"participant.add"),h=Zt(e,"node.add"),m=Zt(e,"sequenceFlow.add"),g=Zt(e,"messageFlow.add"),R=Zt(e,"dataStore.add"),w=Zt(e,"dataAssociation.add"),b=Zt(e,"annotation.add"),x=Zt(e,"group.add"),S=new Map(h.map(E=>[E.node.id,E])),M=(E,C,T)=>{var ee;const N=E.businessObject,j=(((ee=N.extensionElements)==null?void 0:ee.values)??[]).filter(Q=>Q.$type!==C),L=T?[...j,i.create(C,T)]:j;if(!L.length){N.extensionElements&&n.updateProperties(E,{extensionElements:void 0});return}const X=i.create("bpmn:ExtensionElements",{values:L});L.forEach(Q=>{Q.$parent=X}),n.updateProperties(E,{extensionElements:X})},I=E=>({anchor:E.anchor,side:E.side,...E.offset!==void 0?{offset:E.offset}:{}});for(const E of Zt(e,"element.remove")){const C=l(E.id);C&&n.removeElements([C])}const A=E=>o.filter(C=>{var T;return C.type==="bpmn:Lane"&&((T=f(C))==null?void 0:T.id)===E}).sort((C,T)=>C.y-T.y);for(const E of Zt(e,"participant.update")){const C=p(E.id);if(E.name!==void 0&&n.updateProperties(C,{name:E.name??void 0}),!E.lanes)continue;const T=A(E.id);if(!T.length){n.splitLane(C,E.lanes.length),A(E.id).forEach((j,L)=>{const X=E.lanes[L];X&&n.updateProperties(j,{id:X.id,name:X.name})});continue}const N=new Set(T.map(j=>j.id));E.lanes.forEach((j,L)=>{if(N.has(j.id)){n.updateProperties(p(j.id),{name:j.name});return}const X=L===0?n.addLane(A(E.id)[0],"top"):n.addLane(p(E.lanes[L-1].id),"bottom");n.updateProperties(X,{id:j.id,name:j.name})})}const H=150,V=130,$=80,G=90,pe=180,ze=new Set;for(const E of d){ze.add(`pool:${E.participant.id}`);for(const C of E.participant.lanes??[])ze.add(C.id)}const lt=new Map;for(const E of h){const C=E.node.lane??`pool:${E.node.participant??""}`;let T=lt.get(C);T||lt.set(C,T=new Set([0])),E.band!==void 0&&T.add(E.band)}const Y=new Map;for(const[E,C]of lt){if(!ze.has(E))continue;const T=[...C].sort((L,X)=>L-X),N=T.map((L,X)=>X===0?0:X%2===1?Math.ceil(X/2):-(X/2)),j=Math.min(...N);Y.set(E,new Map(T.map((L,X)=>[L,N[X]-j])))}{const E=new Map;for(const C of d)(C.participant.lanes??[]).forEach((T,N)=>E.set(T.id,N));for(const[C,T]of Y){if(!E.has(C)||T.size<2)continue;const N=E.get(C),j=T.get(0)??0,L=new Set;for(const ke of h){if(ke.node.lane!==C||(ke.band??0)!==0||!ke.node.type.endsWith("Gateway"))continue;const we={in:new Set,out:new Set,cross:new Set};for(const ye of m){const Xe=ye.flow.source===ke.node.id;if(!Xe&&ye.flow.target!==ke.node.id)continue;const ft=S.get(Xe?ye.flow.target:ye.flow.source);if(!ft||ft.node.participant!==ke.node.participant||!ft.node.lane)continue;let Rt,Yt=!1;if(ft.node.lane!==C){const Bt=E.get(ft.node.lane);if(Bt===void 0)continue;Rt=Bt>N?"down":"up",Yt=!0}else{const Bt=T.get(ft.band??0)??j;Rt=Bt>j?"down":Bt<j?"up":void 0}Rt&&(we[Xe?"out":"in"].add(Rt),Yt&&we.cross.add(Rt))}for(const ye of["up","down"])we.in.has(ye)&&we.out.has(ye)&&we.cross.has(ye)&&L.add(ye)}if(L.size!==1)continue;const[X]=L,ee=Math.max(...T.values()),Q=X==="down"?ee:0;if(j===Q)continue;const re=[...T.entries()].filter(([ke])=>ke!==0).sort((ke,we)=>ke[1]-we[1]),Ke=[...Array(ee+1).keys()].filter(ke=>ke!==Q),Qe=new Map([[0,Q]]);re.forEach(([ke],we)=>Qe.set(ke,Ke[we])),Y.set(C,Qe)}}const fe=E=>{var C;return(((C=lt.get(E))==null?void 0:C.size)??0)>1},de=E=>E.band??(E.node.lane||!fe(`pool:${E.node.participant??""}`)?void 0:0),ue=new Map,le=E=>ue.get(E.node.id)??de(E),ne=new Set,z=new Set;{const E=new Map;for(const N of m)E.set(N.flow.target,(E.get(N.flow.target)??0)+1);const C=N=>{const j=[],L=new Set([N]),X=[N];for(;X.length;){const ee=X.shift();j.push(ee);for(const Q of m)Q.flow.source!==ee||L.has(Q.flow.target)||(E.get(Q.flow.target)??0)!==1||(L.add(Q.flow.target),X.push(Q.flow.target))}return j},T=(N,j)=>{var L;return((L=Y.get(N))==null?void 0:L.get(j))??j};for(const N of h){if(!N.node.type.endsWith("Gateway"))continue;const j=N.node.lane??`pool:${N.node.participant??""}`,L=Y.get(j);if(!L||L.size<2)continue;const X=le(N);if(X===void 0||T(j,X)!==T(j,0))continue;const ee=T(j,X),Q=m.filter(ye=>ye.flow.source===N.node.id).map(ye=>S.get(ye.flow.target)).filter(ye=>!!ye&&(ye.node.lane??`pool:${ye.node.participant??""}`)===j),re=Q.filter(ye=>{const Xe=le(ye);return Xe!==void 0&&T(j,Xe)===ee&&(E.get(ye.node.id)??0)===1}),Ke=Q.some(ye=>{const Xe=le(ye);return Xe!==void 0&&T(j,Xe)>ee});if(re.length!==1||!Ke)continue;const Qe=new Set(Q.flatMap(ye=>C(ye.node.id)));if(!m.some(ye=>ye.flow.target===N.node.id&&Qe.has(ye.flow.source)))continue;const we=new Map;for(const[ye,Xe]of L)we.set(ye,Xe+1);we.set(-1,0),Y.set(j,we);for(const ye of C(re[0].node.id))S.has(ye)&&(ue.set(ye,-1),z.add(ye));ne.add(N.node.id)}}const F=(E,C)=>{var T;return((T=Y.get(E))==null?void 0:T.get(C))??C},U=new Map;for(const[E,C]of lt){let T=0;for(const N of C)T=Math.max(T,F(E,N));U.set(E,T)}const Oe=E=>pe+H*E,Lt=d.map((E,C)=>({op:E,declared:C}));Lt.sort((E,C)=>{const T=E.op.order??Number.POSITIVE_INFINITY,N=C.op.order??Number.POSITIVE_INFINITY;return T!==N?T-N:E.declared-C.declared});let P=80;for(const E of o.getAll())E.parent===u()&&"height"in E&&typeof E.y=="number"&&(P=Math.max(P,E.y+E.height+60));for(const{op:E}of Lt){const C=E.participant,T=h.filter(ke=>ke.node.participant===C.id).length,N=((Tx=C.lanes)==null?void 0:Tx.length)??0,j=Math.max(1200,T*160+300),L=(C.lanes??[]).map(ke=>Oe(U.get(ke.id)??0)),X=L.reduce((ke,we)=>ke+we,0);N&&X<300&&(L[N-1]+=300-X);const ee=Math.max(300,H*((U.get(`pool:${C.id}`)??0)+1)),Q=C.blackBox||T+N===0?120:N?Math.max(300,X):ee,re=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:C.id,name:C.name,...E.order!==void 0?{"bwl:poolOrder":E.order}:{},...C.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:j,height:Q,isExpanded:!0}),Ke=n.createShape(re,{x:100+j/2,y:P+Q/2},u()),Qe=C.lanes??[];if(Qe.length&&n.splitLane(Ke,Qe.length),Qe.length){const ke=o.filter(we=>{var ye;return we.type==="bpmn:Lane"&&((ye=f(we))==null?void 0:ye.id)===C.id}).sort((we,ye)=>we.y-ye.y);if(ke.forEach((we,ye)=>{const Xe=Qe[ye];Xe&&n.updateProperties(we,{id:Xe.id,name:Xe.name})}),L.some(we=>we!==Ke.height/N)){let we=Ke.y;ke.forEach((ye,Xe)=>{const ft=L[Xe];n.resizeShape(ye,{x:ye.x,y:we,width:ye.width,height:ft}),we+=ft})}}P=Ke.y+Ke.height+60}const _=E=>{var N;const C=S.get(E);if(C)return C.node.participant??"";const T=l(E);return T?T.type==="bpmn:Participant"?T.id:((N=f(T))==null?void 0:N.id)??"":""},y=new Map,D=E=>{let C=y.get(E);return C||y.set(E,C={nodes:[],flows:[]}),C};for(const E of h)D(E.node.participant??"").nodes.push(E);for(const E of m)D(_(E.flow.source)).flows.push(E);const B=E=>{var C;return i.create("bpmn:SequenceFlow",{id:E.id,name:E.name??((C=E.condition)==null?void 0:C.label)})},W=(E,C)=>r.createShape({type:hs(E.type),businessObject:i.create(hs(E.type),{id:E.id,name:E.name,...C!==void 0?{"bwl:band":C}:{}})}),ce=[...Lt.map(({op:E})=>E.participant.id).filter(E=>y.has(E)),...[...y.keys()].filter(E=>!d.some(C=>C.participant.id===E))],Ae=E=>E.endsWith("Gateway");for(const E of ce){const C=y.get(E),T=E?p(E):void 0,N=T?T.x+150:250;let j=T?T.y+80:120;const L=(Be,Ne,oe)=>{const ve=u().children.filter(me=>!("waypoints"in me&&me.waypoints)&&me.id!==Ne&&typeof me.y=="number"&&me.y>=Be);ve.length&&n.moveElements(ve,{x:0,y:oe})},X=(Be,Ne)=>{if(Be){const $e=p(Be),Ze=Oe(Ne);if($e.height>=Ze)return;const Kt=Ze-$e.height,te=f($e),qe=te?te.y+te.height:$e.y+$e.height;n.resizeLane($e,{x:$e.x,y:$e.y,width:$e.width,height:Ze},!1),L(qe,te==null?void 0:te.id,Kt);return}if(!T)return;const oe=H*(Ne+1);if(T.height>=oe)return;const ve=oe-T.height,me=T.y+T.height;n.resizeShape(T,{x:T.x,y:T.y,width:T.width,height:oe}),L(me,T.id,ve)},ee=(Be,Ne,oe)=>{if(Be){const ve=p(Be);return ve.y+Math.min(ve.height/2,G)+F(Be,Ne??0)*H}return Ne!==void 0&&T?T.y+$+F(`pool:${E}`,Ne)*H:oe},Q=(Be,Ne,oe)=>{if(Be){const ve=p(Be);return ve.y+Math.min(ve.height/2,G)+Ne*H}return T?T.y+$+Ne*H:oe},re=Be=>Be.participant?p(Be.participant):u(),Ke=30,Qe=(Be,Ne,oe,ve)=>{const me=oe-Ne.width/2,$e=ve-Ne.height/2;return(Be.children??[]).find(Ze=>!("waypoints"in Ze&&Ze.waypoints)&&Ze.type!=="bpmn:Lane"&&Ze.type!=="label"&&typeof Ze.x=="number"&&me<Ze.x+Ze.width+Ke&&me+Ne.width+Ke>Ze.x&&$e<Ze.y+Ze.height&&$e+Ne.height>Ze.y)},ke=(Be,Ne,oe,ve,me,$e)=>{const Ze=oe!==void 0||ve!==void 0,Kt=F(oe??`pool:${E}`,ve??0);if(Ze)for(let Te=0;Te<4;Te++){const Me=Q(oe,Kt+Te,$e);if(!Qe(Be,Ne,me,Me))return X(oe,Kt+Te),{x:me,y:Me}}const te=ee(oe,ve,$e);Ze&&X(oe,Kt);let qe=me;for(let Te=0;Te<64;Te++){const Me=Qe(Be,Ne,qe,te);if(!Me)break;qe=Me.x+Me.width+V+Ne.width/2}return{x:qe,y:te}},we=new Set(C.flows.map(Be=>Be.flow.target)),ye=new Map;for(const Be of C.nodes){if(we.has(Be.node.id))continue;const Ne=W(Be.node,Be.band),oe=de(Be),ve=Be.node.lane?`${Be.node.lane}|${oe??""}`:oe!==void 0?`band:${oe}`:"",me=re(Be.node),$e=ke(me,Ne,Be.node.lane,oe,ye.get(ve)??N,j);n.createShape(Ne,$e,me),ye.set(ve,$e.x+Ne.width+V),!Be.node.lane&&oe===void 0&&(j+=160)}const Xe=new Set,ft=new Map,Rt=new Map,Yt=new Map;if(E&&ze.has(`pool:${E}`)){const Be=new Map;for(const te of C.flows)Be.set(te.flow.target,(Be.get(te.flow.target)??0)+1);const Ne=te=>ee(te.node.lane,le(te),Number.NaN),oe=new Set,ve=te=>{var Me;const qe=(Me=S.get(te))==null?void 0:Me.node.participant;if(qe)return l(qe);const Te=l(te);if(Te)return Te.type==="bpmn:Participant"?Te:f(Te)},me=te=>{const qe=[],Te=new Set([te]),Me=[te];for(;Me.length;){const dt=Me.shift(),et=S.get(dt);et&&qe.push(et);for(const Se of C.flows)Se.flow.source!==dt||Te.has(Se.flow.target)||(Be.get(Se.flow.target)??0)!==1||(Te.add(Se.flow.target),Me.push(Se.flow.target))}return qe},$e=te=>{if(!T)return;const qe=new Set(te.map(dt=>dt.node.id));let Te=!1,Me=!1;for(const dt of g){if(!qe.has(dt.flow.source))continue;const et=ve(dt.flow.target);!et||et.id===T.id||(et.y<T.y?Te=!0:Me=!0)}return Te&&!Me?"up":Me&&!Te?"down":void 0};for(const te of C.nodes){if(!Ae(te.node.type))continue;const qe=ee(te.node.lane,de(te),Number.NaN);if(Number.isNaN(qe))continue;const Te=[];for(const Se of C.flows){if(Se.flow.source!==te.node.id)continue;const Ve=S.get(Se.flow.target);if(!Ve||Ve.node.lane!==te.node.lane||(Be.get(Ve.node.id)??0)!==1)continue;const tt=de(Ve);if(tt===void 0)continue;const vn=ee(Ve.node.lane,tt,Number.NaN);if(Number.isNaN(vn))continue;const Kr=me(Ve.node.id),Xt=$e(Kr);Xt&&Te.push({subtree:Kr,band:tt,row:vn,dir:Xt})}if(!Te.some(Se=>Se.dir==="up")||!Te.some(Se=>Se.dir==="down")||!Te.some(Se=>Se.dir==="up"&&Te.some(Ve=>Ve.dir==="down"&&Ve.row<Se.row)))continue;const dt=[...Te].sort((Se,Ve)=>Se.row-Ve.row);[...Te.filter(Se=>Se.dir==="up"),...Te.filter(Se=>Se.dir==="down")].sort((Se,Ve)=>Se.dir===Ve.dir?Se.row-Ve.row:Se.dir==="up"?-1:1).forEach((Se,Ve)=>{const tt=dt[Ve].band;if(tt!==Se.band){oe.add(te.node.id);for(const vn of Se.subtree)de(vn)===Se.band&&ue.set(vn.node.id,tt)}})}const Ze=te=>{if(!T)return;const qe=new Set(te.map(dt=>dt.node.id));let Te=!1,Me=!1;for(const dt of g){if(!qe.has(dt.flow.target))continue;const et=ve(dt.flow.source);!et||et.id===T.id||(et.y<T.y?Te=!0:Me=!0)}return Te&&!Me?"up":Me&&!Te?"down":void 0};for(const te of C.nodes){if(!Ae(te.node.type))continue;const qe=te.node.lane??`pool:${E}`,Te=Y.get(qe);if(!Te||Te.size<2)continue;const Me=Te.get(0);if(Me===void 0)continue;const dt=Math.max(...Te.values()),et=Me===dt&&Me!==0?"down":void 0;if(!et)continue;const Se=[];for(const Xt of C.flows){if(Xt.flow.source!==te.node.id)continue;const ni=S.get(Xt.flow.target);if(!ni||ni.node.lane!==te.node.lane||(Be.get(ni.node.id)??0)!==1)continue;const Ix=le(ni);Ix!==void 0&&Se.push({t:ni,subtree:me(ni.node.id),band:Ix})}const Ve=Se.find(Xt=>(Te.get(Xt.band)??Xt.band)===Me);if(!Ve||Ze(Ve.subtree)===et||$e(Ve.subtree)===et)continue;const tt=Se.find(Xt=>Xt!==Ve&&Ze(Xt.subtree)===et);if(!tt)continue;const vn=Ve.band,Kr=tt.band;for(const Xt of Ve.subtree)le(Xt)===vn&&ue.set(Xt.node.id,Kr);for(const Xt of tt.subtree)le(Xt)===Kr&&ue.set(Xt.node.id,vn);oe.add(te.node.id)}for(const te of C.nodes){if(!Ae(te.node.type))continue;const qe=Ne(te);if(Number.isNaN(qe)||b.some(Se=>{var Ve,tt;return(((Ve=Se.placement)==null?void 0:Ve.anchor)??(Se.association?Se.association.source===Se.annotation.id?Se.association.target:Se.association.source:void 0))===te.node.id&&((tt=Se.placement)==null?void 0:tt.side.startsWith("bottom"))}))continue;let Me,dt=!1,et;for(const Se of C.flows){if(Se.flow.source!==te.node.id)continue;const Ve=S.get(Se.flow.target);if(!Ve||!Ve.node.lane&&de(Ve)===void 0)continue;const tt=Ne(Ve);Number.isNaN(tt)||(Math.abs(tt-qe)<.5&&(dt=!0),tt>qe?!Me||tt>Me.row?Me={id:Ve.node.id,row:tt,count:1}:tt===Me.row&&Me.count++:tt<qe&&Ve.node.lane===te.node.lane&&(!et||tt>et.row?et={op:Ve,row:tt,count:1}:tt===et.row&&et.count++))}Me&&Me.count===1&&(Be.get(Me.id)??0)===1&&!oe.has(te.node.id)&&Xe.add(Me.id),!dt&&et&&et.count===1&&(Be.get(et.op.node.id)??0)===1&&!ne.has(te.node.id)&&ft.set(et.op.node.id,{lane:te.node.lane,band:le(te)})}const Kt=new Map;for(const te of g)Kt.set(te.flow.target,[...Kt.get(te.flow.target)??[],te]);for(const te of C.nodes){const qe=Kt.get(te.node.id);if(!qe||qe.length!==1||!Be.get(te.node.id)||!te.node.lane&&de(te)===void 0||z.has(te.node.id))continue;const Te=(Mx=S.get(qe[0].flow.source))==null?void 0:Mx.node.participant,Me=Te?l(Te):void 0;if(!Me||!T||Me.id===T.id)continue;const dt=te.node.lane??`pool:${E}`,et=Y.get(dt);if(!et)continue;const Se=et.get(0)??0,Ve=(et.get(le(te)??0)??Se)-Se;if(Ve===0)continue;const tt=Me.y<T.y;if(tt&&Ve<0||!tt&&Ve>0)continue;let vn;for(const[Kr,Xt]of et){const ni=Xt-Se;(tt&&ni<0&&(!vn||ni<vn.row)||!tt&&ni>0&&(!vn||ni>vn.row))&&(vn={band:Kr,row:ni})}vn&&Rt.set(te.node.id,{lane:te.node.lane,band:vn.band})}}const Bt=new Set;let Bn=0;for(;Bn++<C.nodes.length+2;){for(let oe=0;oe<C.nodes.length+C.flows.length+2;oe++){let ve=!1;for(const me of C.flows){const $e=me.flow;if(Bt.has($e.id))continue;const Ze=l($e.source);if(!Ze)continue;const Kt=l($e.target),te=S.get($e.target);if(!Kt&&te){const qe=W(te.node,te.band),Te=le(te);if(te.node.lane||Te!==void 0){const Me=re(te.node),dt=Ze,et=dt.x+(Yt.get($e.source)??0)+dt.width+V,Se=ft.get($e.target)??Rt.get($e.target),Ve=ke(Me,qe,Se?Se.lane:te.node.lane,Se?Se.band:Te,Xe.has($e.target)?dt.x+dt.width/2:et,Number.NaN),tt=n.createShape(qe,Ve,Me);Xe.has($e.target)&&Yt.set($e.target,et-(tt.x+tt.width/2)),n.connect(Ze,tt,{type:"bpmn:SequenceFlow",businessObject:B($e)})}else s.append(Ze,qe,{connection:{type:"bpmn:SequenceFlow",businessObject:B($e)}})}else if(Kt)n.connect(Ze,Kt,{type:"bpmn:SequenceFlow",businessObject:B($e)});else continue;Bt.add($e.id),ve=!0}if(!ve)break}const Be=C.nodes.filter(oe=>!l(oe.node.id));if(!Be.length)break;const Ne=Be[0];{const oe=W(Ne.node,Ne.band),ve=re(Ne.node),me=de(Ne);n.createShape(oe,ke(ve,oe,Ne.node.lane,me,N,j),ve),!Ne.node.lane&&me===void 0&&(j+=160)}}}const Ue=40,pt=(E,C=()=>!0)=>{const T=l(E);if(!T)return[];const N=[T],j=new Set([E]);for(let L=0;L<N.length;L++){const X=N[L].id;for(const ee of m){const Q=ee.flow.target;if(ee.flow.source!==X||j.has(Q)||!S.has(Q))continue;j.add(Q);const re=l(Q);re&&C(re)&&N.push(re)}}return N},it=(E,C=()=>!0)=>{const T=l(E);if(!T)return[];const N=[T],j=new Set([E]);for(let L=0;L<N.length;L++){const X=N[L].id;for(const ee of m){const Q=ee.flow.source;if(ee.flow.target!==X||j.has(Q)||!S.has(Q))continue;j.add(Q);const re=l(Q);re&&C(re)&&N.push(re)}}return N};for(const E of Zt(e,"sequenceFlow.update")){if(E.target===void 0)continue;const C=S.get(E.target);if(!C)continue;const T=l(E.target),N=l(E.id);if(!T||!N)continue;const j=E.source!==void 0?l(E.source):N.source,L=N.target;if(!j||!L||L.id===T.id)continue;const X=pt(E.target),ee=new Set(X.map(we=>we.id)),Q=Math.min(...X.map(we=>we.x)),re=Math.max(...X.map(we=>we.x+we.width)),Ke=j.x+j.width,Qe=re-Q+Ue*2-(L.x-Ke);if(Qe>0){const we=f(T),ye=(we==null?void 0:we.children)??[],Xe=Yt=>Yt.type==="bpmn:Lane",ft=ye.filter(Yt=>!("waypoints"in Yt&&Yt.waypoints)&&!Xe(Yt)&&!ee.has(Yt.id)&&Yt.x>=L.x),Rt=we?[we,...ye.filter(Yt=>Xe(Yt))]:[];ft.length&&n.createSpace(ft,Rt,{x:Qe,y:0},"e",L.x-1)}const ke=C.node.lane||C.band!==void 0?T.y+T.height/2:j.y+j.height/2;n.moveElements(X,{x:Ke+Ue-Q,y:ke-(T.y+T.height/2)})}const It=(E,C)=>{const T=C.target===E,N=p(C.source),j=p(C.target),L=T?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(N,j,C.id?{type:L,businessObject:i.create(L,{id:C.id})}:{type:L})},ln=100,pn=E=>{for(const C of d){if(!C.participant.blackBox)continue;const T=l(C.participant.id);if(!T)continue;const N=[];for(const L of g){const X=L.flow.source===C.participant.id?L.flow.target:L.flow.target===C.participant.id?L.flow.source:void 0,ee=X?l(X):void 0;ee&&typeof ee.x=="number"&&ee.type!=="bpmn:Participant"&&N.push(ee)}if(!N.length)continue;const j=Math.max(...N.map(L=>L.x+L.width/2))+ln;if(j>T.x+T.width&&n.resizeShape(T,{x:T.x,y:T.y,width:j-T.x,height:T.height}),!!E)for(const L of g){const X=l(L.flow.id),ee=L.flow.source===C.participant.id?L.flow.target:L.flow.target===C.participant.id?L.flow.source:void 0,Q=ee?l(ee):void 0;if(!X||!Q||Q.type==="bpmn:Participant")continue;const re=Q.x+Q.width/2;if(re<T.x+10||re>T.x+T.width-10)continue;const Ke=T.y>Q.y,Qe=Ke?Q.y+Q.height:Q.y,ke=Ke?T.y:T.y+T.height,we=L.flow.source===C.participant.id?[{x:re,y:ke},{x:re,y:Qe}]:[{x:re,y:Qe},{x:re,y:ke}],ye=jt(o),Xe={...ye.edges.find(ft=>ft.id===L.flow.id),waypoints:we};Vn(Xe,Pi(ye)).length||n.updateWaypoints(X,we)}}};pn(!1);for(const E of g){const C=E.flow;n.connect(p(C.source),p(C.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:C.id,name:C.name})})}const st=20,Nt=30,fn=4,Fo=E=>!("waypoints"in E&&E.waypoints)&&E.type!=="bpmn:Lane"&&E.type!=="label"&&typeof E.x=="number",dn=()=>{const E=jt(o);return{bad:Xi(E).filter(C=>C.kind==="edge-crosses-shape"||C.kind==="edge-overlap-opposite"||C.kind==="edge-overlap-mixed").length,crossings:Ad(E),straight:E.edges.filter(C=>C.type==="bpmn:MessageFlow"&&C.waypoints.length===2).length}},Ln=E=>{const C=jt(o),T=C.edges.find(N=>N.id===E);return T?Vn(T,Pi(C)).length:0},In=E=>Ln(E)>0,Et=E=>jt(o).edges.filter(C=>C.type==="bpmn:MessageFlow"&&C.id!==E&&C.waypoints.length===2).length,Gi=(E,C)=>{const T=new Set(E.flatMap(L=>L.subtree.map(X=>X.id)));for(const L of E){const X=(L.pool.children??[]).filter(Fo).filter(Q=>!T.has(Q.id));if(L.subtree.some(Q=>X.some(re=>Q.x+C<re.x+re.width+Nt&&Q.x+C+Q.width+Nt>re.x&&Q.y<re.y+re.height&&Q.y+Q.height>re.y)))return null}const N=E.map(L=>L.pool.width);n.moveElements(E.flatMap(L=>L.subtree),{x:C,y:0});const j=E.map(L=>{const ee=Math.max(...L.subtree.map(Q=>Q.x+Q.width))+150-(L.pool.x+L.pool.width);return ee>0&&n.resizeShape(L.pool,{x:L.pool.x,y:L.pool.y,width:L.pool.width+ee,height:L.pool.height}),ee});return()=>{n.moveElements(E.flatMap(L=>L.subtree),{x:-C,y:0}),E.forEach((L,X)=>{j[X]>0&&n.resizeShape(L.pool,{x:L.pool.x,y:L.pool.y,width:N[X],height:L.pool.height})})}},_u=(E,C,T)=>Gi([{subtree:E,pool:C}],T),Nn=(E,C)=>C.bad>E.bad||C.crossings>E.crossings&&C.straight<=E.straight&&C.bad>=E.bad,Ye=(E,C)=>Nn(E,C)||C.straight<E.straight,Je=(E,C,T=()=>!0,N=Nn)=>{const j=dn(),L=Gi(E,C);if(!L)return!1;const X=dn();return N(j,X)||!T()?(L(),!1):!0},yx=(E,C,T,N=()=>!0)=>Je([{subtree:E,pool:C}],T,N),bu=E=>{var C;return!!((C=S.get(E))!=null&&C.node.participant)},qa=new Map;for(const E of g){if(!bu(E.flow.target))continue;const C=qa.get(E.flow.target)??[];C.push(E),qa.set(E.flow.target,C)}const jf=[...qa.keys()],vx=new Set(m.map(E=>E.flow.target)),_x=E=>Lt.findIndex(({op:C})=>C.participant.id===E);jf.sort((E,C)=>{var j,L;const T=vx.has(E)?1:0,N=vx.has(C)?1:0;return T!==N?T-N:_x((j=S.get(E))==null?void 0:j.node.participant)-_x((L=S.get(C))==null?void 0:L.node.participant)});const xu=E=>E.x+E.width/2,QD=E=>{const C=new Map;for(const j of o.getAll()){const L=j;if(!L.waypoints||!L.source||!L.target)continue;(C.get(L.source.id)??C.set(L.source.id,[]).get(L.source.id)).push(L.target.id)}const T=new Set([E]),N=[E];for(let j=0;j<N.length;j++)for(const L of C.get(N[j])??[])T.has(L)||(T.add(L),N.push(L));return T},JD=(E,C)=>{const T=QD(C);let N;for(const j of o.getAll()){const L=j;if(L.type!=="bpmn:MessageFlow"||!L.source||!L.target||L.target.id!==E||T.has(L.source.id))continue;const X=L.source;if(typeof X.x!="number"||X.type==="bpmn:Participant")continue;const ee=xu(X);(N===void 0||ee>N)&&(N=ee)}return N},Ff=(E,C)=>{const T=l(E.flow.source);if(T)return T.type==="bpmn:Participant"?JD(T.id,C):xu(T)},bx=E=>{let C;for(const T of qa.get(E)??[]){const N=Ff(T,E);N!==void 0&&(!C||N>C.cx)&&(C={op:T,cx:N})}return C==null?void 0:C.op},eO=E=>{const C=bx(E),T=l(E),N=C?Ff(C,E):void 0;return T&&N!==void 0?N-xu(T):void 0},tO=E=>{const C=eO(E);return C!==void 0&&Math.abs(C)<st},xx=(E,C,T,N,j)=>{var ee;const L=new Map([[C,[...E]]]),X=new Set(E.map(Q=>Q.id));for(let Q=!0;Q;){Q=!1;for(const re of g){if(re.flow.id===N)continue;const Ke=X.has(re.flow.source),Qe=X.has(re.flow.target);if(Ke===Qe||(Ke?re.flow.source:re.flow.target)===T)continue;const ke=Ke?re.flow.target:re.flow.source;if(ke===j||!bu(ke))continue;const we=l(re.flow.id);if(!(we!=null&&we.waypoints)||we.waypoints.length!==2)continue;const ye=l(ke),Xe=(ee=S.get(ke))==null?void 0:ee.node.participant;if(!ye||!Xe)continue;const ft=pt(ke,Rt=>Rt.x>=ye.x).filter(Rt=>!X.has(Rt.id));if(!(!ft.length||ft.some(Rt=>Rt.id===j))){for(const Rt of ft)X.add(Rt.id);L.set(Xe,[...L.get(Xe)??[],...ft]),Q=!0}}}return[...L].map(([Q,re])=>({subtree:re,pool:p(Q)}))},Hf=E=>{const C=bx(E);if(!C)return null;const T=l(E),N=l(C.flow.source),j=Ff(C,E);if(!T||!N||j===void 0)return null;const L=j-xu(T);if(L>=st){const X=S.get(E).node.participant,ee=pt(E,Q=>Q.x>=T.x);return{groups:xx(ee,X,E,C.flow.id,C.flow.source),dx:L}}if(-L>=st&&bu(C.flow.source)){const X=S.get(C.flow.source).node.participant,ee=pt(C.flow.source,Q=>Q.x>=N.x&&!tO(Q.id));return{groups:xx(ee,X,C.flow.source,C.flow.id,E),dx:-L}}return null},wx=()=>jf.map(E=>({id:E,plan:Hf(E)})).filter(E=>!!E.plan).sort((E,C)=>Math.min(...E.plan.groups.flatMap(T=>T.subtree.map(N=>N.x)))-Math.min(...C.plan.groups.flatMap(T=>T.subtree.map(N=>N.x)))).map(E=>E.id);for(let E=0;E<3;E++){const C=dn(),T=[];for(const j of wx()){const L=Hf(j);if(!L)continue;const X=Gi(L.groups,L.dx);X&&T.push(X)}if(!T.length)break;if(!Ye(C,dn()))continue;for(const j of T.reverse())j();let N=!1;for(const j of wx()){const L=Hf(j);L&&Je(L.groups,L.dx,()=>!0,Ye)&&(N=!0)}if(!N)break}for(const E of jf.flatMap(C=>qa.get(C)??[])){if(!In(E.flow.id))continue;const C=l(E.flow.target);if(!C)continue;const T=p(S.get(E.flow.target).node.participant),N=pt(E.flow.target,ee=>ee.x>=C.x),j=C.width+V,L=Ln(E.flow.id),X=Et(E.flow.id);for(let ee=1;ee<=fn;ee++){const Q=()=>Ln(E.flow.id)<L&&Et(E.flow.id)>=X;if(yx(N,T,j*ee,Q))break}}for(const E of g){if(!In(E.flow.id))continue;const C=l(E.flow.source),T=l(E.flow.target);if(!C||!T||C.type==="bpmn:Participant"||T.type==="bpmn:Participant")continue;const N=C.x+C.width/2;if(Math.abs(N-(T.x+T.width/2))>15)continue;const[j,L]=C.y<T.y?[C.y+C.height,T.y]:[T.y+T.height,C.y],X=[...S.values()].map(ee=>l(ee.node.id)).filter(ee=>!!ee&&ee.id!==C.id&&ee.id!==T.id).filter(ee=>ee.x<=N&&N<=ee.x+ee.width&&ee.y+ee.height>j&&ee.y<L).sort((ee,Q)=>ee.x-Q.x);for(const ee of X){const Q=(kx=S.get(ee.id))==null?void 0:kx.node.participant,re=Q?l(Q):void 0;if(!re)continue;const Ke=[...S.values()].filter(Bt=>Bt.node.participant===Q).map(Bt=>Bt.node.id),Qe=Bt=>Bt.map(Bn=>l(Bn)).filter(Bn=>!!Bn),we=[it(ee.id,Bt=>{var Bn;return((Bn=S.get(Bt.id))==null?void 0:Bn.node.participant)===Q}),Qe(Ke)].filter(Bt=>Bt.length),ye=ee.width+V,Xe=Ln(E.flow.id),ft=Et(E.flow.id),Rt=()=>Ln(E.flow.id)<Xe&&Et(E.flow.id)>=ft;let Yt=!1;for(const Bt of we){for(let Bn=1;Bn<=fn;Bn++)if(yx(Bt,re,ye*Bn,Rt)){Yt=!0;break}if(Yt)break}if(!In(E.flow.id))break}}{const E=T=>T.y+T.height/2,C=[];for(const T of S.keys()){if(!bu(T))continue;const N=m.filter(X=>X.flow.target===T);if(N.length!==1)continue;const j=l(N[0].flow.source),L=l(T);!j||!L||!S.has(j.id)||Math.abs(E(j)-E(L))>1||L.x-(j.x+j.width)<=V+1||C.push({id:T,pred:j,node:L})}C.sort((T,N)=>T.node.x-N.node.x);for(const{id:T}of C){const N=S.get(T),j=l(T),L=l(m.find(ke=>ke.flow.target===T).flow.source);if(!j||!L)continue;const X=j.x-(L.x+L.width);if(X<=V+1)continue;const ee=p(N.node.participant),Q=pt(T,ke=>ke.x>=j.x),re=dn(),Ke=_u(Q,ee,-(X-V));if(!Ke)continue;const Qe=dn();(Qe.bad>re.bad||Qe.crossings>=re.crossings||Qe.straight<re.straight)&&Ke()}}pn(!0);for(const E of R){const C=E.associations??[],T=C.map(L=>L.source===E.dataStore.id?L.target:L.source).map(l).find(Boolean),N=T?f(T)??u():u(),j=T?{x:T.x+T.width/2,y:T.y+T.height+110}:{x:200,y:P+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:E.dataStore.id,name:E.dataStore.name})},j,N);for(const L of C)It(E.dataStore.id,L)}for(const E of w){const T=p(E.association.target).type==="bpmn:DataStoreReference"?E.association.target:E.association.source;It(T,E.association)}let Ex=0;const nO=10,Sx=(E,C)=>{for(const T of C.map(N=>f(N)).filter(N=>!!N)){const N=nO,j=T.y,L=T.y+T.height,X=T.x,ee=T.x+T.width;if(Math.abs(E.y-j)<N){const Q=j+N-E.y;E.y+=Q,E.height-=Q}if(Math.abs(E.y+E.height-L)<N&&(E.height=L-N-E.y),Math.abs(E.x-X)<N){const Q=X+N-E.x;E.x+=Q,E.width-=Q}Math.abs(E.x+E.width-ee)<N&&(E.width=ee-N-E.x)}};for(const E of x){const C=(E.group.members??[]).map(l).filter(L=>!!L),T=40;let N;if(C.length){const L=Math.min(...C.map(re=>re.x))-T,X=Math.min(...C.map(re=>re.y))-T,ee=Math.max(...C.map(re=>re.x+re.width))+T,Q=Math.max(...C.map(re=>re.y+re.height))+T;N={x:L,y:X,width:ee-L,height:Q-X},Sx(N,C)}else N={x:300+Ex*350,y:40,width:300,height:200},Ex++;const j=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:E.group.id}),width:N.width,height:N.height},{x:N.x+N.width/2,y:N.y+N.height/2},u());E.group.name&&n.updateLabel(j,E.group.name),(Dx=E.group.members)!=null&&Dx.length&&M(j,"bwl:Members",{refs:E.group.members.join(" ")})}const Rx=E=>{const C=E.waypoints;if(C!=null&&C.length){const N=C[Math.floor((C.length-1)/2)];return{x:N.x,y:N.y,width:0,height:0}}const T=E;return{x:T.x,y:T.y,width:T.width,height:T.height}},Cx=(E,C,T,N)=>{const j=C,L=(oe,ve)=>{const[me,$e]=qu[oe];let Ze={x:E.x+E.width/2+me*(E.width/2+j.width/2+ve),y:E.y+E.height/2+$e*(E.height/2+j.height/2+ve)};const Kt=T.x+nn+j.width/2,te=T.x+T.width-nn-j.width/2,qe=T.y+nn+j.height/2,Te=T.y+T.height-nn-j.height/2,Me={x:Math.min(te,Math.max(Kt,Ze.x)),y:Math.min(Te,Math.max(qe,Ze.y))};return(Me.x!==Ze.x||Me.y!==Ze.y)&&(Ze=Math.abs(Me.x-(E.x+E.width/2))<(E.width+j.width)/2+nn&&Math.abs(Me.y-(E.y+E.height/2))<(E.height+j.height)/2+nn?{x:E.x+E.width+nn+j.width/2,y:Me.y}:Me),Ze},X=(T.children??[]).filter(oe=>!("waypoints"in oe&&oe.waypoints)&&oe.type!=="bpmn:Lane"&&oe.type!=="label"&&typeof oe.x=="number"&&oe.id!==N.selfId),ee=jt(o),Q=oe=>{var me,$e;if(!N.selfId)return!1;const ve=o.get(oe);return!!ve&&(((me=ve.source)==null?void 0:me.id)===N.selfId||(($e=ve.target)==null?void 0:$e.id)===N.selfId)},re=ee.edges.filter(oe=>!Q(oe.id)).flatMap(mn),Ke=Uo(ee).filter(oe=>oe.owner!==N.selfId).map(oe=>oe.rect),Qe=oe=>({x0:oe.x-j.width/2-nn,x1:oe.x+j.width/2+nn,y0:oe.y-j.height/2-nn,y1:oe.y+j.height/2+nn}),ke=oe=>{const ve=Qe(oe);return X.some(me=>ve.x0<me.x+me.width&&ve.x1>me.x&&ve.y0<me.y+me.height&&ve.y1>me.y)},we=oe=>{const ve=Qe(oe);return re.some(me=>me.axis==="h"?me.at>ve.y0&&me.at<ve.y1&&me.lo<ve.x1&&me.hi>ve.x0:me.at>ve.x0&&me.at<ve.x1&&me.lo<ve.y1&&me.hi>ve.y0)},ye=oe=>{const ve=Qe(oe);return Ke.some(me=>ve.x0<me.x+me.width&&ve.x1>me.x&&ve.y0<me.y+me.height&&ve.y1>me.y)},Xe=oe=>ke(oe)||we(oe)||ye(oe),ft=oe=>oe.x-j.width/2>=T.x&&oe.x+j.width/2<=T.x+T.width&&oe.y-j.height/2>=T.y&&oe.y+j.height/2<=T.y+T.height;if(N.placement){const oe=te=>te.startsWith("top")?te.replace(/^top/,"bottom"):te.replace(/^bottom/,"top"),ve=te=>te.endsWith("left")?te.replace(/left$/,"right"):te.replace(/right$/,"left"),me=N.placement.side,$e=[me,oe(me),ve(me),oe(ve(me)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],Ze=N.placement.offset??50;let Kt=L(me,Ze);if(Xe(Kt)){const te=new Set;for(const qe of $e){if(te.has(qe))continue;te.add(qe);const Te=L(qe,Ze);if(ft(Te)&&!Xe(Te)){Kt=Te;break}}}return Kt}const Rt=N.from,Yt=T.x+nn+j.width/2,Bt=T.x+T.width-nn-j.width/2,Bn=T.y+nn+j.height/2,Be=T.y+T.height-nn-j.height/2;let Ne={x:Math.min(Bt,Math.max(Yt,Rt.x)),y:Math.min(Be,Math.max(Bn,Rt.y))};if(Xe(Ne)){const oe=(E.width+j.width)/2+nn,me=[{x:Ne.x+oe,y:Ne.y},{x:Ne.x-oe,y:Ne.y},{x:Ne.x,y:Ne.y-j.height-nn},{x:Ne.x,y:Ne.y+j.height+nn}].filter(ft).find($e=>!Xe($e));me&&(Ne=me)}return Ne};let Ka=0;const Px=12,Ax=14,iO=15,rO=300,oO=E=>{const C=E.split(`
7
+ `),T=Math.max(...C.map(L=>ro(L,Px))),N=Math.max(100,Math.min(rO,Math.ceil(T)+Ax)),j=C.reduce((L,X)=>L+Math.max(1,Math.ceil((ro(X,Px)+Ax)/N)),0);return{width:N,height:Math.max(30,j*iO+10)}},nn=10;for(const E of b){const C=E.association,T=((Ox=E.placement)==null?void 0:Ox.anchor)??(C?C.source===E.annotation.id?C.target:C.source:void 0),N=T?l(T):void 0,j=N?Rx(N):void 0,L=oO(E.annotation.text??"");let X;if(j&&E.placement){const[Ke,Qe]=qu[E.placement.side],ke=E.placement.offset??50;X={x:j.x+j.width/2+Ke*(j.width/2+L.width/2+ke),y:j.y+j.height/2+Qe*(j.height/2+L.height/2+ke)}}else j?(X={x:j.x+j.width/2+180+Ka%3*260,y:j.y-110-Ka%2*95},Ka++):(X={x:300+Ka*260,y:60},Ka++);const ee=N?f(N)??u():u(),Q=ee;j&&typeof Q.x=="number"&&typeof Q.width=="number"&&Q.type==="bpmn:Participant"&&(X=Cx(j,L,Q,E.placement?{placement:E.placement}:{from:X}));const re=n.createShape({type:"bpmn:TextAnnotation",width:L.width,height:L.height,businessObject:i.create("bpmn:TextAnnotation",{id:E.annotation.id,text:E.annotation.text})},X,ee);if(C){const Ke=Qe=>Qe===E.annotation.id?re:p(Qe);n.connect(Ke(C.source),Ke(C.target),C.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:C.id})}:{type:"bpmn:Association"})}E.placement&&M(re,"bwl:Placement",I(E.placement))}for(const E of Zt(e,"association.add")){const C=E.association;n.connect(p(C.source),p(C.target),C.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:C.id})}:{type:"bpmn:Association"})}for(const E of Zt(e,"node.update")){let C=p(E.id);if(E.type&&hs(E.type)!==C.type&&(C=c.replaceElement(C,{type:hs(E.type)})),E.name!==void 0&&n.updateProperties(C,{name:E.name??void 0}),E.lane){const T=p(E.lane),N=T.y+T.height/2-(C.y+C.height/2);N!==0&&n.moveElements([C],{x:0,y:N})}}for(const E of Zt(e,"sequenceFlow.update")){const C=p(E.id);if(E.source!==void 0||E.target!==void 0){const T=C,N=E.source!==void 0?p(E.source):T.source,j=E.target!==void 0?p(E.target):T.target,L=X=>({x:X.x+X.width/2,y:X.y+X.height/2});n.reconnect(T,N,j,[L(N),L(j)])}E.name!==void 0&&n.updateProperties(C,{name:E.name??void 0}),E.condition!==void 0&&n.updateProperties(C,{name:((Lx=E.condition)==null?void 0:Lx.label)??void 0})}for(const E of Zt(e,"messageFlow.update"))E.name!==void 0&&n.updateProperties(p(E.id),{name:E.name??void 0});for(const E of Zt(e,"dataStore.update"))E.name!==void 0&&n.updateProperties(p(E.id),{name:E.name??void 0});for(const E of Zt(e,"annotation.update")){const C=p(E.id);if(E.text!==void 0&&n.updateProperties(C,{text:E.text}),E.placement===null)M(C,"bwl:Placement",null);else if(E.placement){const T=p(E.placement.anchor),N=Rx(T),j=f(T)??u(),L=typeof j.x=="number"&&typeof j.width=="number"&&j.type==="bpmn:Participant",[X,ee]=qu[E.placement.side],Q=E.placement.offset??50,re={x:N.x+N.width/2+X*(N.width/2+C.width/2+Q),y:N.y+N.height/2+ee*(N.height/2+C.height/2+Q)},Ke=L?Cx(N,{width:C.width,height:C.height},j,{placement:E.placement,selfId:E.id}):re;n.moveElements([C],{x:Ke.x-(C.x+C.width/2),y:Ke.y-(C.y+C.height/2)}),M(C,"bwl:Placement",I(E.placement))}}for(const E of Zt(e,"group.update")){const C=p(E.id);if(E.name!==void 0&&n.updateLabel(C,E.name??""),E.members){const T=E.members.map(l).filter(N=>!!N);if(T.length){const j=Math.min(...T.map(re=>re.x))-40,L=Math.min(...T.map(re=>re.y))-40,X=Math.max(...T.map(re=>re.x+re.width))+40,ee=Math.max(...T.map(re=>re.y+re.height))+40,Q={x:j,y:L,width:X-j,height:ee-L};Sx(Q,T),n.resizeShape(C,Q)}M(C,"bwl:Members",{refs:E.members.join(" ")})}}}function ch(e,t,n=sh){const i=ah(e),r=oh(t,Id(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[]}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=jt(i.elementRegistry),s=new Set(Xi(a).map(Ki)),c=new Set(a.edges.map(m=>m.id)),u=new Set(a.shapes.map(m=>m.id)),l=Wu(a).length,p=e.get("commandStack");try{Uf(p,()=>{n(t,i),Gd(i,c),Hd(i,s),Xd(i,s,c),qd(i,c),aE(i,c),eh(i,s,c),Jd(i,c),nh(i,u)})}catch(m){return{ok:!1,issues:[{kind:"lower-failed",message:m instanceof Error?m.message:String(m)}],findings:[],stats:o}}const f=jt(i.elementRegistry),d=Xi(f).filter(m=>!s.has(Ki(m))),h=Wu(f);return{ok:!0,issues:[],findings:d,stats:{edgeCrossings:{before:l,after:h.length,pairs:h}}}}function fE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function dE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function uh(e,t){const n=dE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function lh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function hE(e){return typeof e=="string"&&Eu.includes(e)}function ui(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function ph(e){const t=e.rootElements??[],n=t.find(Y=>Y.$type==="bpmn:Collaboration"),i=new Map(t.filter(Y=>Y.$type==="bpmn:Process").map(Y=>[Y.id,Y])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],h=[],m=[],g=[],R=new Set,w=new Set,b=Y=>{Y&&R.add(Y)},x=Y=>{R.add(Y),w.add(Y)},S=Y=>{const fe=lh(Y,"bwl:Placement");if(!fe)return;const de=typeof fe.anchor=="string"?fe.anchor:void 0;if(!de||!hE(fe.side))return;const ue=typeof fe.offset=="number"?fe.offset:void 0;m.push({owner:Y.id,anchor:de,side:fe.side,...ue!==void 0?{offset:ue}:{}})},M=Y=>{const fe=lh(Y,"bwl:Members"),de=typeof(fe==null?void 0:fe.refs)=="string"?fe.refs.split(/\s+/).filter(Boolean):[];de.length&&g.push({owner:Y.id,refs:de})},I=Y=>{var fe;for(const de of Y)switch(b(de.id),de.$type){case"bpmn:TextAnnotation":x(de.id),s.push({id:de.id,text:typeof de.text=="string"?de.text:""}),S(de);break;case"bpmn:Association":d.push({id:de.id,type:de.$type,source:ui(de.sourceRef),target:ui(de.targetRef)});break;case"bpmn:Group":{x(de.id);const ue=(fe=de.categoryValueRef)==null?void 0:fe.value;c.push({id:de.id,...typeof ue=="string"&&ue?{name:ue}:{}}),M(de);break}default:u.push({id:de.id,type:de.$type,reason:"type-outside-mvp"})}},A=(Y,fe)=>{const de=Y.flowElements??[],ue=(Y.laneSets??[]).flatMap(ne=>ne.lanes??[]),le=new Map;for(const ne of ue){b(ne.id);for(const z of ne.flowNodeRef??[]){const F=ui(z);F&&le.set(F,ne.id)}}for(const ne of de){if(b(ne.id),ne.$type==="bpmn:SequenceFlow"){p.push({id:ne.id,source:ui(ne.sourceRef),target:ui(ne.targetRef),...typeof ne.name=="string"&&ne.name?{name:ne.name}:{}});continue}if(ne.$type==="bpmn:DataStoreReference"){x(ne.id),a.push({id:ne.id,...ne.name?{name:ne.name}:{}});continue}const z=fE(ne.$type);if(!zf(z)){u.push({id:ne.id,type:ne.$type,reason:"type-outside-mvp"});continue}x(ne.id),o.push({id:ne.id,type:z,...ne.name?{name:ne.name}:{},...fe?{participant:fe}:{},...le.has(ne.id)?{lane:le.get(ne.id)}:{}});const F=uh(ne,"bwl:band");F!==void 0&&(l.bands[ne.id]=F);for(const U of ne.dataOutputAssociations??[])b(U.id),h.push({id:U.id,type:U.$type,source:ne.id,target:ui(U.targetRef)});for(const U of ne.dataInputAssociations??[])b(U.id),h.push({id:U.id,type:U.$type,source:ui((U.sourceRef??[])[0]),target:ne.id})}I(Y.artifacts??[])};if(n){const Y=new Set;for(const fe of n.participants??[]){x(fe.id);const de=ui(fe.processRef);de&&Y.add(de);const ue=de?i.get(de):void 0,le=((ue==null?void 0:ue.laneSets)??[]).flatMap(U=>U.lanes??[]),ne=le.map(U=>({id:U.id,...U.name?{name:U.name}:{}}));for(const U of ne)x(U.id);const z=!ue||(ue.flowElements??[]).length===0&&le.length===0&&(ue.artifacts??[]).length===0;r.push({id:fe.id,...fe.name?{name:fe.name}:{},...z?{blackBox:!0}:{},...ne.length?{lanes:ne}:{}});const F=uh(fe,"bwl:poolOrder");F!==void 0&&(l.poolOrders[fe.id]=F),ue&&A(ue,fe.id)}for(const fe of n.messageFlows??[])b(fe.id),f.push({id:fe.id,source:ui(fe.sourceRef),target:ui(fe.targetRef),...typeof fe.name=="string"&&fe.name?{name:fe.name}:{}});I(n.artifacts??[]);for(const[fe,de]of i)!Y.has(fe)&&(de.flowElements??[]).length>0&&u.push({id:fe,type:de.$type,reason:"unreachable-process"})}else for(const Y of i.values())A(Y);const H=[],V=[],$=[],G=[],pe=(Y,fe)=>!!Y&&!!fe&&w.has(Y)&&w.has(fe);for(const Y of p){if(!pe(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}H.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),w.add(Y.id)}for(const Y of f){if(!pe(Y.source,Y.target)){u.push({id:Y.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}V.push({id:Y.id,source:Y.source,target:Y.target,...Y.name?{name:Y.name}:{}}),w.add(Y.id)}for(const Y of h){if(!pe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}G.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target}),Y.id&&w.add(Y.id)}for(const Y of d){if(!pe(Y.source,Y.target)){u.push({id:Y.id??"",type:Y.type,reason:"endpoint-outside-mvp"});continue}$.push({...Y.id?{id:Y.id}:{},source:Y.source,target:Y.target})}const ze=new Map(c.map(Y=>[Y.id,Y]));for(const{owner:Y,refs:fe}of g){const de=fe.filter(le=>R.has(le)),ue=ze.get(Y);ue&&de.length&&(ue.members=de)}for(const Y of m)R.has(Y.anchor)&&(l.placements[Y.owner]={anchor:Y.anchor,side:Y.side,...Y.offset!==void 0?{offset:Y.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:H,...V.length?{messageFlows:V}:{},...a.length?{dataStores:a}:{},...G.length?{dataAssociations:G}:{},...s.length?{annotations:s}:{},...$.length?{associations:$}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function mE(e){const{definitions:t,warnings:n}=await Fu(e);return{...ph(t),warnings:n}}function gE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function fh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=ch(e,t.ops);if(!i.ok)return{status:"rejected",issues:i.issues};const{xml:r}=await e.saveXML({format:!0});return{status:"applied",version:n+1,xml:r??"",findings:i.findings,stats:i.stats}}const yE=Symbol("bpmn-editor");function vE(){const e=Ct.ref(!1),t=Ct.ref(!0),n=Ct.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const p=u.get("keyboard");l?(r&&p.bind(r),r=void 0):r||(r=p.getBinding(),p.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const p=s();n.value=!0;try{const f=await fh(p,u,{currentVersion:l});return f.status==="applied"&&(e.value=!1),f}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:Hu(l)}},async saveXml(){const{xml:u}=await s().saveXML({format:!0});return e.value=!1,u??""},undo:()=>{var u;return(u=c())==null?void 0:u.undo()},redo:()=>{var u;return(u=c())==null?void 0:u.redo()},canUndo:()=>{var u;return((u=c())==null?void 0:u.canUndo())??!1},canRedo:()=>{var u;return((u=c())==null?void 0:u.canRedo())??!1}}}function ae(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function _E(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ku={exports:{}},dh;function bE(){if(dh)return Ku.exports;dh=1;var e=Ku.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o),s=Math.floor(Math.random()*c).toString(n);a=s+a}var u=parseInt(a,n);return u!==1/0&&u>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var r=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(o,c));return o[c]=a,c},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,s){return r.hats[a]=s,r},r.bits=t||128,r.base=n||16,r},Ku.exports}var xE=bE(),wE=_E(xE);function li(e){if(!(this instanceof li))return new li(e);e=e||[128,36,1],this._seed=e.length?wE.rack(e[0],e[1],e[2]):e}li.prototype.next=function(e){return this._seed(e||!0)},li.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},li.prototype.claim=function(e,t){this._seed.set(e,t||!0)},li.prototype.assigned=function(e){return this._seed.get(e)||!1},li.prototype.unclaim=function(e){delete this._seed.hats[e]},li.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Ft={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Ft.td=Ft.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Ft.option=Ft.optgroup=[1,'<select multiple="multiple">',"</select>"],Ft.thead=Ft.tbody=Ft.colgroup=Ft.caption=Ft.tfoot=[1,"<table>","</table>"],Ft.polyline=Ft.ellipse=Ft.polygon=Ft.circle=Ft.text=Ft.line=Ft.path=Ft.rect=Ft.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function ut(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:p}=l;return p.remove(),p}let[r,o,a]=Object.hasOwn(Ft,i)?Ft[i]:Ft._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:l}=s;return l.remove(),l}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function EE(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function gn(e,...t){const n=e.style;return k(t,function(i){i&&k(i,function(r,o){n[o]=r})}),e}function sn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const SE=Object.prototype.toString;function gt(e){return new Zi(e)}function Zi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Zi.prototype.add=function(e){return this.list.add(e),this},Zi.prototype.remove=function(e){return SE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Zi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Zi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Zi.prototype.array=function(){return Array.from(this.list)},Zi.prototype.has=Zi.prototype.contains=function(e){return this.list.contains(e)};function ms(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Dr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function RE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gs={},hh;function CE(){if(hh)return gs;hh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return gs.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},gs.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},gs}var mh=CE(),PE=RE(mh),Re=EE({__proto__:null,default:PE},[mh]),gh=["focus","blur"];function AE(e,t,n,i,r){return gh.indexOf(n)!==-1&&(r=!0),Re.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Dr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function TE(e,t,n,i){return gh.indexOf(t)!==-1&&(i=!0),Re.unbind(e,t,n,i)}var Cn={bind:AE,unbind:TE};function Xu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function nt(e,t){return t=t||document,t.querySelector(e)}function ys(e,t){return t=t||document,t.querySelectorAll(e)}function pi(e){e.parentNode&&e.parentNode.removeChild(e)}function ME(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function kE(e,t){return t.appendChild(ME(e,t))}function Ce(e,t){return kE(t,e),e}var Zu=2,yh={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":Zu,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":Zu,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function DE(e,t){return yh[t]?e.style[t]:e.getAttributeNS(null,t)}function vh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=yh[i];r?(r===Zu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function OE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)vh(e,r,t[r])}function se(e,t,n){if(typeof t=="string")if(n!==void 0)vh(e,t,n);else return DE(e,t);else OE(e,t);return e}const LE=Object.prototype.toString;function He(e){return new Qi(e)}function Qi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Qi.prototype.add=function(e){return this.list.add(e),this},Qi.prototype.remove=function(e){return LE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Qi.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Qi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Qi.prototype.array=function(){return Array.from(this.list)},Qi.prototype.has=Qi.prototype.contains=function(e){return this.list.contains(e)};function vs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function _h(e){return e.cloneNode(!0)}var Qu={svg:"http://www.w3.org/2000/svg"},bh='<svg xmlns="'+Qu.svg+'"';function IE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Qu.svg)===-1&&(e=bh+e.substring(4)):(e=bh+">"+e+"</svg>",t=!0);var n=NE(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function NE(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function he(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=IE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Qu.svg,e),t&&se(n,t),n}var Ju=null;function xh(){return Ju===null&&(Ju=he("svg")),Ju}function wh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function BE(e,t,n,i,r,o){var a=xh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return wh(a,e);case 6:return wh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Yo(e){return xh().createSVGTransform()}var Eh=/([&<>]{1})/g,$E=/([&<>\n\r"]{1})/g,jE={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function el(e,t){function n(i,r){return jE[r]||r}return e.replace(t,n)}function Sh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(el(e.textContent,Eh));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=e.attributes,n=0,i=r.length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',el(o.value,$E),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Sh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",el(e.nodeValue,Eh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function FE(e){for(var t=e.firstChild,n=[];t;)Sh(t,n),t=t.nextSibling;return n.join("")}function Rh(e,t){return FE(e)}function Ht(e){var t=e.parentNode;return t&&t.removeChild(e),e}function HE(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function zE(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(HE(e,i))}function qo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),zE(n,t)),n.consolidate()}const VE=/^class[ {]/;function GE(e){return VE.test(e.toString())}function tl(e){return Array.isArray(e)}function nl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function _s(...e){e.length===1&&tl(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const WE=/constructor\s*[^(]*\(\s*([^)]*)\)/m,UE=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,YE=/\/\*([^*]*)\*\//m;function qE(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(GE(e)?WE:UE);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(YE);return(r&&r[1]||i).trim()})||[]}function Ch(e,t){const n=t||{get:function(b,x){if(i.push(b),x===!1)return null;throw s(`No provider for "${b}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(b){const x=i.join(" -> ");return i.length=0,new Error(x?`${b} (Resolving: ${x})`:b)};function c(b,x){if(!r[b]&&b.includes(".")){const S=b.split(".");let M=c(S.shift());for(;S.length;)M=M[S.shift()];return M}if(nl(o,b))return o[b];if(nl(r,b)){if(i.indexOf(b)!==-1)throw i.push(b),s("Cannot resolve circular dependency!");return i.push(b),o[b]=r[b][0](r[b][1]),i.pop(),o[b]}return n.get(b,x)}function u(b,x){if(typeof x>"u"&&(x={}),typeof b!="function")if(tl(b))b=_s(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const M=(b.$inject||qE(b)).map(I=>nl(x,I)?x[I]:c(I));return{fn:b,dependencies:M}}function l(b){const{fn:x,dependencies:S}=u(b),M=Function.prototype.bind.call(x,null,...S);return new M}function p(b,x,S){const{fn:M,dependencies:I}=u(b,S);return M.apply(x,I)}function f(b){return _s(x=>b.get(x))}function d(b,x){if(x&&x.length){const S=Object.create(null),M=Object.create(null),I=[],A=[],H=[];let V,$,G,pe;for(let ze in r)V=r[ze],x.indexOf(ze)!==-1&&(V[2]==="private"?($=I.indexOf(V[3]),$===-1?(G=V[3].createChild([],x),pe=f(G),I.push(V[3]),A.push(G),H.push(pe),S[ze]=[pe,ze,"private",G]):S[ze]=[H[$],ze,"private",A[$]]):S[ze]=[V[2],V[1]],M[ze]=!0),(V[2]==="factory"||V[2]==="type")&&V[1].$scope&&x.forEach(lt=>{V[1].$scope.indexOf(lt)!==-1&&(S[ze]=[V[2],V[1]],M[lt]=!0)});x.forEach(ze=>{if(!M[ze])throw new Error('No provider for "'+ze+'". Cannot use provider from the parent!')}),b.unshift(S)}return new Ch(b,a)}const h={factory:p,type:l,value:function(b){return b}};function m(b,x){const S=b.__init__||[];return function(){S.forEach(M=>{typeof M=="string"?x.get(M):x.invoke(M)})}}function g(b){const x=b.__exports__;if(x){const S=b.__modules__,M=Object.keys(b).reduce(($,G)=>(G!=="__exports__"&&G!=="__modules__"&&G!=="__init__"&&G!=="__depends__"&&($[G]=b[G]),$),Object.create(null)),I=(S||[]).concat(M),A=d(I),H=_s(function($){return A.get($)});x.forEach(function($){r[$]=[H,$,"private",A]});const V=(b.__init__||[]).slice();return V.unshift(function(){A.init()}),b=Object.assign({},b,{__init__:V}),m(b,A)}return Object.keys(b).forEach(function(S){if(S==="__init__"||S==="__depends__")return;const M=b[S];if(M[2]==="private"){r[S]=M;return}const I=M[0],A=M[1];r[S]=[h[I],KE(I,A),I]}),m(b,a)}function R(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(R,b),b.indexOf(x)!==-1)?b:b.concat(x)}function w(b){const x=b.reduce(R,[]).map(g);let S=!1;return function(){S||(S=!0,x.forEach(M=>M()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=w(e)}function KE(e,t){return e!=="value"&&tl(t)&&(t=_s(t.slice())),t}var XE=1e3;function Ai(e,t){var n=this;t=t||XE,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}Ai.prototype.canRender=function(e){},Ai.prototype.drawShape=function(e,t){},Ai.prototype.drawConnection=function(e,t){},Ai.prototype.getShapePath=function(e){},Ai.prototype.getConnectionPath=function(e){};function Or(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function ZE(e){return["M",e.x,e.y]}function il(e){return["L",e.x,e.y]}function QE(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function JE(e,t){const n=e.length,i=[ZE(e[0])];for(let r=1;r<n;r++){const o=e[r-1],a=e[r],s=e[r+1];if(!s||!t){i.push(il(a));continue}const c=Math.min(t,rl(a.x-o.x,a.y-o.y),rl(s.x-a.x,s.y-a.y));if(!c){i.push(il(a));continue}const u=bs(a,o,c),l=bs(a,o,c*.5),p=bs(a,s,c),f=bs(a,s,c*.5);i.push(il(u)),i.push(QE(l,f,p))}return i}function bs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=rl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function rl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Ko(e,t,n){Ee(t)&&(n=t,t=null),t||(t={});const i=he("path",t);return Ee(n)&&(i.dataset.cornerRadius=String(n)),ol(i,e)}function ol(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return se(e,{d:Or(JE(t,n))}),e}function xs(e){var t=new Set(e);return Ie(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Lr(e,t,n){n=n||0,_e(e)||(e=[e]),k(e,function(i,r){var o=t(i,r,n);_e(o)&&o.length&&Lr(o,t,n+1)})}function al(e,t,n){var i=new Set,r=new Set;return Lr(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function Xo(e,t){return al(e)}function e1(e,t,n){Rr(t)&&(t=!0),Gt(t)&&(n=t,t=!0),n=n||{};var i=Zo(n.allShapes),r=Zo(n.allConnections),o=Zo(n.enclosedElements),a=Zo(n.enclosedConnections),s=Zo(n.topLevel,t&&Jr(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,k(l.incoming,c),k(l.outgoing,c),l.children}return Lr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function At(e,t){t=!!t,_e(e)||(e=[e]);var n,i,r,o;return k(e,function(a){var s=a;a.waypoints&&!t&&(s=At(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,p=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+p>r||r===void 0)&&(r=c+p),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function so(e,t){var n={};return k(e,function(i){var r=i;r.waypoints&&(r=At(r)),!Ee(t.y)&&r.x>t.x&&(n[i.id]=i),!Ee(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Ee(t.width)&&Ee(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Ee(t.width)||!Ee(t.height))&&(n[i.id]=i)}),n}function Ph(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Ah(e){return!!(e&&e.isFrame)}function Zo(e,t){return O({},e||{},t||{})}var t1=1;function Ji(e,t){Ai.call(this,e,t1),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}ae(Ji,Ai),Ji.prototype.canRender=function(){return!0},Ji.prototype.drawShape=function(t,n,i){var r=he("rect");return se(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Ah(n)?se(r,O({},this.FRAME_STYLE,i||{})):se(r,O({},this.SHAPE_STYLE,i||{})),Ce(t,r),r},Ji.prototype.drawConnection=function(t,n,i){var r=Ko(n.waypoints,O({},this.CONNECTION_STYLE,i||{}));return Ce(t,r),r},Ji.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return Or(a)},Ji.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return Or(o)},Ji.$inject=["eventBus","styles"];function n1(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return O(o,{class:n})},this.style=function(n,i){!_e(n)&&!i&&(i=n,n=[]);var r=Sn(n,function(o,a){return O(o,e[a]||{})},{});return i?O(r,i):r},this.computeStyle=function(n,i,r){return _e(i)||(r=i,i=[]),t.style(i||[],O({},r,n||{}))}}const i1={__init__:["defaultRenderer"],defaultRenderer:["type",Ji],styles:["type",n1]};function wt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function St(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function sl(e,t){return!e||!t?-1:e.indexOf(t)}function Qo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function cl(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=Qo(e,t);return Math.abs(r/o)<=i}var r1=2;function Ti(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(o1(r,n))return o;return!1}function o1(e,t){const n=t[0];return Cr(t,function(i){return Math.abs(n[e]-i[e])<=r1})}function Th(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function ul(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var a1=/,?([a-z]),?/gi,Mh=parseFloat,Tt=Math,er=Tt.PI,fi=Tt.min,di=Tt.max,kh=Tt.pow,tr=Tt.abs,s1=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,c1=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Dh=Array.isArray||function(e){return e instanceof Array};function u1(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function l1(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}function p1(e){function t(){var n=Array.prototype.slice.call(arguments,0),i=n.join("␀"),r=t.cache=t.cache||{},o=t.count=t.count||[];return u1(r,i)?(l1(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function f1(e){if(!e)return null;var t={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},n=[];return String(e).replace(s1,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(c1,function(c,u){u&&a.push(+u)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=pl,n}function d1(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(typeof i=="string"&&i!==i.toUpperCase())return!1}return!0}function h1(e){for(var t=0,n=e.length;t<n;t++){var i=e[t][0];if(i!=="M"&&i!=="C")return!1}return!0}function ll(e,t,n,i){return arguments.length===1&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,height:i,x2:e+n,y2:t+i}}function pl(){return this.join(",").replace(a1,"$1")}function m1(e){for(var t=new Array(e.length),n=0,i=e.length;n<i;n++)for(var r=e[n],o=t[n]=new Array(r.length),a=0,s=r.length;a<s;a++)o[a]=r[a];return t.toString=pl,t}function Oh(e,t,n,i,r,o,a,s,c){var u=1-c,l=kh(u,3),p=kh(u,2),f=c*c,d=f*c,h=l*e+p*3*c*n+u*3*c*c*r+d*a,m=l*t+p*3*c*i+u*3*c*c*o+d*s;return{x:ws(h),y:ws(m)}}function Lh(e){var t=x1(...e);return ll(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function nr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function g1(e,t){return e=ll(e),t=ll(t),nr(t,e.x,e.y)||nr(t,e.x2,e.y)||nr(t,e.x,e.y2)||nr(t,e.x2,e.y2)||nr(e,t.x,t.y)||nr(e,t.x2,t.y)||nr(e,t.x,t.y2)||nr(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function Ih(e,t,n,i,r){var o=-3*t+9*n-9*i+3*r,a=e*o+6*t-12*n+6*i;return e*a-3*t+3*n}function Nh(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,p=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,h=0;h<l;h++){var m=u*p[h]+u,g=Ih(m,e,n,r,a),R=Ih(m,t,i,o,s),w=g*g+R*R;d+=f[h]*Tt.sqrt(w)}return u*d}function y1(e,t,n,i,r,o,a,s){if(!(di(e,n)<fi(r,a)||fi(e,n)>di(r,a)||di(t,i)<fi(o,s)||fi(t,i)>di(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var p=ws(c/l),f=ws(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+fi(e,n).toFixed(2)||d>+di(e,n).toFixed(2)||d<+fi(r,a).toFixed(2)||d>+di(r,a).toFixed(2)||h<+fi(t,i).toFixed(2)||h>+di(t,i).toFixed(2)||h<+fi(o,s).toFixed(2)||h>+di(o,s).toFixed(2)))return{x:p,y:f}}}}function ws(e){return Math.round(e*1e11)/1e11}function v1(e,t,n){var i=Lh(e),r=Lh(t);if(!g1(i,r))return[];var o=Nh(...e),a=Nh(...t),s=$h(e)?1:~~(o/5)||1,c=$h(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),p={},f=[],d,h;for(d=0;d<s+1;d++){var m=Oh(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=Oh(...t,d/c),l[d]={x:m.x,y:m.y,t:d/c};for(d=0;d<s;d++)for(h=0;h<c;h++){var g=u[d],R=u[d+1],w=l[h],b=l[h+1],x=tr(R.x-g.x)<.01?"y":"x",S=tr(b.x-w.x)<.01?"y":"x",M=y1(g.x,g.y,R.x,R.y,w.x,w.y,b.x,b.y),I;if(M){if(I=M.x.toFixed(9)+"#"+M.y.toFixed(9),p[I])continue;p[I]=!0;var A=g.t+tr((M[x]-g[x])/(R[x]-g[x]))*(R.t-g.t),H=w.t+tr((M[S]-w[S])/(b[S]-w[S]))*(b.t-w.t);A>=0&&A<=1&&H>=0&&H<=1&&f.push({x:M.x,y:M.y,t1:A,t2:H})}}return f}function Bh(e,t,n){e=Hh(e),t=Hh(t);for(var i,r,o,a,s,c,u,l,p,f,d=n?0:[],h=0,m=e.length;h<m;h++){var g=e[h];if(g[0]=="M")i=s=g[1],r=c=g[2];else{g[0]=="C"?(p=[i,r,...g.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var R=0,w=t.length;R<w;R++){var b=t[R];if(b[0]=="M")o=u=b[1],a=l=b[2];else{b[0]=="C"?(f=[o,a,...b.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,l,u,l],o=u,a=l);var x=v1(p,f);{for(var S=0,M=x.length;S<M;S++)x[S].segment1=h,x[S].segment2=R,x[S].bez1=p,x[S].bez2=f;d=d.concat(x)}}}}}return d}function _1(e){return Dh(e)&&Dh(e[0])}function b1(e){if(d1(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,p=e.length;l<p;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var f=1,d=u.length;f<d;f++)c[f]=+u[f]+(f%2?n:i)}else for(var h=0,m=u.length;h<m;h++)c[h]=u[h];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=pl,t}function $h(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Es(e,t,n,i){return[e,t,n,i,n,i]}function jh(e,t,n,i,r,o){var a=.3333333333333333,s=2/3;return[a*e+s*n,a*t+s*i,a*r+s*n,a*o+s*i,r,o]}function Fh(e,t,n,i,r,o,a,s,c,u){var l=er*120/180,p=er/180*(+r||0),f=[],d,h=p1(function(P,_,y){var D=P*Tt.cos(y)-_*Tt.sin(y),B=P*Tt.sin(y)+_*Tt.cos(y);return{x:D,y:B}});if(u)I=u[0],A=u[1],S=u[2],M=u[3];else{d=h(e,t,-p),e=d.x,t=d.y,d=h(s,c,-p),s=d.x,c=d.y;var m=(e-s)/2,g=(t-c)/2,R=m*m/(n*n)+g*g/(i*i);R>1&&(R=Tt.sqrt(R),n=R*n,i=R*i);var w=n*n,b=i*i,x=(o==a?-1:1)*Tt.sqrt(tr((w*b-w*g*g-b*m*m)/(w*g*g+b*m*m))),S=x*n*g/i+(e+s)/2,M=x*-i*m/n+(t+c)/2,I=Tt.asin(((t-M)/i).toFixed(9)),A=Tt.asin(((c-M)/i).toFixed(9));I=e<S?er-I:I,A=s<S?er-A:A,I<0&&(I=er*2+I),A<0&&(A=er*2+A),a&&I>A&&(I=I-er*2),!a&&A>I&&(A=A-er*2)}var H=A-I;if(tr(H)>l){var V=A,$=s,G=c;A=I+l*(a&&A>I?1:-1),s=S+n*Tt.cos(A),c=M+i*Tt.sin(A),f=Fh(s,c,n,i,r,0,a,$,G,[A,V,S,M])}H=A-I;var pe=Tt.cos(I),ze=Tt.sin(I),lt=Tt.cos(A),Y=Tt.sin(A),fe=Tt.tan(H/4),de=4/3*n*fe,ue=4/3*i*fe,le=[e,t],ne=[e+de*ze,t-ue*pe],z=[s+de*Y,c-ue*lt],F=[s,c];if(ne[0]=2*le[0]-ne[0],ne[1]=2*le[1]-ne[1],u)return[ne,z,F].concat(f);f=[ne,z,F].concat(f).join().split(",");for(var U=[],Oe=0,Lt=f.length;Oe<Lt;Oe++)U[Oe]=Oe%2?h(f[Oe-1],f[Oe],p).y:h(f[Oe],f[Oe+1],p).x;return U}function x1(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,h,m,g,R,w=0;w<2;++w){if(w==0?(p=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,f=3*n-3*e):(p=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,f=3*i-3*t),tr(l)<1e-12){if(tr(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*l,R=Tt.sqrt(g),!(g<0)&&(h=(-p+R)/(2*l),0<h&&h<1&&c.push(h),m=(-p-R)/(2*l),0<m&&m<1&&c.push(m))}for(var b=c.length,x=b,S;b--;)d=c[b],S=1-d,u[0][b]=S*S*S*e+3*S*S*d*n+3*S*d*d*r+d*d*d*a,u[1][b]=S*S*S*t+3*S*S*d*i+3*S*d*d*o+d*d*d*s;return u[0][x]=e,u[1][x]=t,u[0][x+1]=a,u[1][x+1]=s,u[0].length=u[1].length=x+2,{x0:fi(...u[0]),y0:fi(...u[1]),x1:di(...u[0]),y1:di(...u[1])}}function Hh(e){if(_1(e)||(e=f1(e)),h1(e))return e;for(var t=m1(b1(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,h){var m,g;if(!f)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(f[0]in{T:1,Q:1})&&(d.qx=d.qy=null),f[0]){case"M":d.X=f[1],d.Y=f[2];break;case"A":f=["C",...Fh(d.x,d.y,...f.slice(1))];break;case"S":h=="C"||h=="S"?(m=d.x*2-d.bx,g=d.y*2-d.by):(m=d.x,g=d.y),f=["C",m,g,...f.slice(1)];break;case"T":h=="Q"||h=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...jh(d.x,d.y,d.qx,d.qy,f[1],f[2])];break;case"Q":d.qx=f[1],d.qy=f[2],f=["C",...jh(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Es(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Es(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Es(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Es(d.x,d.y,d.X,d.Y)];break}return f},r=function(f,d){if(f[d].length>7){f[d].shift();for(var h=f[d];h.length;)o[d]="A",f.splice(d++,0,["C",...h.splice(0,6)]);f.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],p=l.length;n.x=l[p-2],n.y=l[p-1],n.bx=Mh(l[p-4])||n.x,n.by=Mh(l[p-3])||n.y}return t}function rt(e){return Gt(e)&&En(e,"waypoints")}function De(e){return Gt(e)&&En(e,"labelTarget")}function w1(e){return Gt(e)&&Zr(e.parent)}function zh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Mi(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ge(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ss(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function E1(e){return Mi({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function S1(e){for(var t=e.waypoints,n=t.reduce(function(u,l,p){var f=t[p-1];if(f){var d=u[u.length-1],h=d&&d.endLength||0,m=P1(f,l);u.push({start:f,end:l,startLength:h,endLength:h+m,length:m})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function be(e){return rt(e)?S1(e):E1(e)}function Qt(e,t,n){n=n||0,Gt(n)||(n={x:n,y:n});var i=ge(e),r=ge(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,u=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function Jo(e,t,n){var i=R1(e,t);return i.length===1||i.length===2&&Qo(i[0],i[1])<1?Mi(i[0]):i.length>1?(i=ai(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Mi(i[n?0:i.length-1])):null}function R1(e,t){return Bh(e,t)}function C1(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Qo(n,r)===0||cl(i,r,n)?e.splice(t,1):t++;return e}function P1(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Rs(e,t){return Math.round(e*t)/t}function Vh(e){return Ee(e)?e+"px":e}function A1(e){for(;e.parent;)e=e.parent;return e}function T1(e){e=O({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),gn(n,{position:"relative",overflow:"hidden",width:Vh(e.width),height:Vh(e.height)}),t.appendChild(n),n}function Gh(e,t,n){const i=he("g");He(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const M1="base",Wh=0,k1=1,D1={shape:["x","y","width","height"],connection:["waypoints"]};function xe(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}xe.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],xe.prototype._init=function(e){const t=this._eventBus,n=this._container=T1(e),i=this._svg=he("svg");se(i,{width:"100%",height:"100%"}),sn(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),Ce(n,i);const r=this._viewport=Gh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Pu(this._viewboxChanged,300)),this._restoreFocus=Pu(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},xe.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},xe.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},xe.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Ph(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},xe.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},xe.prototype.restoreFocus=function(){this._restoreFocus()},xe.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},xe.prototype.isFocused=function(){return this._focused},xe.prototype.getDefaultLayer=function(){return this.getLayer(M1,Wh)},xe.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},xe.prototype._getChildIndex=function(e){return Sn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},xe.prototype._createLayer=function(e,t){typeof t>"u"&&(t=k1);const n=this._getChildIndex(t);return{group:Gh(this._viewport,"layer-"+e,n),index:t,visible:!0}},xe.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},xe.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(Ht(n),t.visible=!1),n},xe.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Ht(t.group))},xe.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},xe.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(A1(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},xe.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},xe.prototype._findPlaneForRoot=function(e){return ct(this._planes,function(t){return t.rootElement===e})},xe.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},xe.prototype._resolveElements=function(e){return _e(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},xe.prototype.getContainer=function(){return this._container},xe.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(k([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),He(r).add(t)):(e.markers.delete(t),He(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},xe.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},xe.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},xe.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},xe.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},xe.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},xe.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,Wh);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},xe.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},xe.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},xe.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},xe.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},xe.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},xe.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=D1[e];if(!Cr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},xe.prototype._setParent=function(e,t,n){St(t.children,e,n),e.parent=t},xe.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},xe.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},xe.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},xe.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),wt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},xe.prototype.removeShape=function(e){return this._removeElement(e,"shape")},xe.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},xe.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},xe.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},xe.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},xe.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);qo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=qo(t),r=a?a.matrix:BE(),s=Rs(r.a,1e3),c=Rs(-r.e||0,1e3),u=Rs(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},xe.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=O({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Uh(t,n)}),{x:n.e,y:n.f}},xe.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(h=>h!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=At(o),s=ge(a),c=this.viewbox(),u=this.zoom();let l,p;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const f=ge(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,p=a.y-c.y;else{const h=Math.max(0,s.right-f.right),m=Math.min(0,s.left-f.left),g=Math.max(0,s.bottom-f.bottom),R=Math.min(0,s.top-f.top);l=h||m,p=g||R}this.scroll({dx:-l*u,dy:-p*u})},xe.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Rs(i.a,1e3)};function Uh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}xe.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},xe.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const p=c.a;return t?(a=O(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),Uh(this._viewport,l),l},xe.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},xe.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},xe.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var co="data-element-id";function jn(e){this._elements={},this._eventBus=e}jn.$inject=["eventBus"],jn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),se(t,co,i),n&&se(n,co,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},jn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(se(i.gfx,co,""),i.secondaryGfx&&se(i.secondaryGfx,co,""),delete t[n])},jn.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},jn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&se(t,co,i),t},jn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&se(e,co);var n=this._elements[t];return n&&n.element},jn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},jn.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=n[i],o=t[r],a=o.element,s=o.gfx;if(e(a,s))return a}},jn.prototype.getAll=function(){return this.filter(function(e){return e})},jn.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},jn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},jn.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function O1(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(o){var a=this.indexOf(o);return a!==-1&&(this.splice(a,1),t.unset(o,r,i)),o}}),Object.defineProperty(e,"contains",{value:function(o){return this.indexOf(o)!==-1}}),Object.defineProperty(e,"add",{value:function(o,a){var s=this.indexOf(o);if(typeof a>"u"){if(s!==-1)return;a=this.length}s!==-1&&this.splice(s,1),this.splice(a,0,o),s===-1&&t.set(o,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e}function L1(e){return e.__refs_collection===!0}function I1(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Yh(e,t,n){var i=O1(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach(function(r){e.set(r,t.inverse,n)})}function N1(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(o){if(o!==r){var a=r;r=null,a&&e.unset(a,i,n),r=o,e.set(r,i,n)}}})}function Gn(e,t){if(!(this instanceof Gn))return new Gn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Gn.prototype.bind=function(e,t){if(typeof t=="string"){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?Yh(this,t,e):N1(this,t,e)},Gn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return L1(n)||Yh(this,t,e),n},Gn.prototype.ensureBound=function(e,t){I1(e,t)||this.bind(e,t)},Gn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Gn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var fl=new Gn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),qh=new Gn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Kh=new Gn({name:"attachers",collection:!0},{name:"host"}),Xh=new Gn({name:"outgoing",collection:!0},{name:"source"}),Zh=new Gn({name:"incoming",collection:!0},{name:"target"});function uo(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),fl.bind(this,"parent"),qh.bind(this,"labels"),Xh.bind(this,"outgoing"),Zh.bind(this,"incoming")}function ea(){uo.call(this),fl.bind(this,"children"),Kh.bind(this,"host"),Kh.bind(this,"attachers")}ae(ea,uo);function Qh(){uo.call(this),fl.bind(this,"children")}ae(Qh,ea);function Jh(){ea.call(this),qh.bind(this,"labelTarget")}ae(Jh,ea);function em(){uo.call(this),Xh.bind(this,"source"),Zh.bind(this,"target")}ae(em,uo);var B1={connection:em,shape:ea,label:Jh,root:Qh};function $1(e,t){var n=B1[e];if(!n)throw new Error("unknown type: <"+e+">");return O(new n,t)}function j1(e){return e instanceof uo}function ki(){this._uid=12}ki.prototype.createRoot=function(e){return this.create("root",e)},ki.prototype.createLabel=function(e){return this.create("label",e)},ki.prototype.createShape=function(e){return this.create("shape",e)},ki.prototype.createConnection=function(e){return this.create("connection",e)},ki.prototype.create=function(e,t){return t=O({},t||{}),t.id||(t.id=e+"_"+this._uid++),$1(e,t)};var Cs="__fn",tm=1e3,F1=Array.prototype.slice;function Pn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Pn.prototype.on=function(e,t,n,i){if(e=_e(e)?e:[e],Wt(t)&&(i=n,n=t,t=tm),!Ee(t))throw new Error("priority must be a number");var r=n;i&&(r=_n(n,i),r[Cs]=n[Cs]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Pn.prototype.once=function(e,t,n,i){var r=this;if(Wt(t)&&(i=n,n=t,t=tm),!Ee(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[Cs]=n,this.on(e,t,o)},Pn.prototype.off=function(e,t){e=_e(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Pn.prototype.createEvent=function(e){var t=new ta;return t.init(e),t},Pn.prototype.fire=function(e,t){var n,i,r,o;if(o=F1.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof ta?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Pn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Pn.prototype._destroy=function(){this._listeners={}},Pn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Pn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=H1(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},Pn.prototype._addListener=function(e,t){var n=this._getListeners(e),i;if(!n){this._setListeners(e,t);return}for(;n;){if(n.priority<t.priority){t.next=n,i?i.next=t:this._setListeners(e,t);return}i=n,n=n.next}i.next=t},Pn.prototype._getListeners=function(e){return this._listeners[e]},Pn.prototype._setListeners=function(e,t){this._listeners[e]=t},Pn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[Cs]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ta(){}ta.prototype.stopPropagation=function(){this.cancelBubble=!0},ta.prototype.preventDefault=function(){this.defaultPrevented=!0},ta.prototype.init=function(e){O(this,e||{})};function H1(e,t){return e.apply(null,t)}function Ir(e){return e.childNodes[0]}function z1(e){return e.parentNode.childNodes[1]}function Ps(e,t,n,i,r){var o=Yo();o.setTranslate(t,n);var a=Yo();a.setRotate(i||0,0,0);var s=Yo();s.setScale(1,1),qo(e,[o,a,s])}function Jt(e,t,n){var i=Yo();i.setTranslate(t,n),qo(e,i)}function nm(e,t){var n=Yo();n.setRotate(t,0,0),qo(e,n)}function Fn(e,t){this._eventBus=e,this._elementRegistry=t}Fn.$inject=["eventBus","elementRegistry"],Fn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=z1(t),n||(n=he("g"),He(n).add("djs-children"),Ce(t.parentNode,n))):n=t,n},Fn.prototype._clear=function(e){var t=Ir(e);return ms(t),t},Fn.prototype._createContainer=function(e,t,n,i){var r=he("g");He(r).add("djs-group"),typeof n<"u"?V1(r,t,t.childNodes[n]):Ce(t,r);var o=he("g");He(o).add("djs-element"),He(o).add("djs-"+e),i&&He(o).add("djs-frame"),Ce(r,o);var a=he("g");return He(a).add("djs-visual"),Ce(o,a),o},Fn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Ah(t))},Fn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Sn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),k(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;k(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Fn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Fn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Fn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Fn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Fn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Jt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?se(n,"display","none"):se(n,"display","block")}},Fn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Ht(t.parentNode)};function V1(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const G1={__depends__:[i1],__init__:["canvas"],canvas:["type",xe],elementRegistry:["type",jn],elementFactory:["type",ki],eventBus:["type",Pn],graphicsFactory:["type",Fn]};function W1(e){var t=new Ch(e);return t.init(),t}function U1(e){e=e||{};var t={config:["value",e]},n=[t,G1].concat(e.modules||[]);return W1(n)}function ir(e,t){this._injector=t||U1(e),this.get("eventBus").fire("diagram.init")}ir.prototype.get=function(e,t){return this._injector.get(e,t)},ir.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ir.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ir.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function cn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function bn(e,t){return e.$instanceOf(t)}function Y1(e){return ct(e.rootElements,function(t){return bn(t,"bpmn:Process")||bn(t,"bpmn:Collaboration")})}function q1(e){var t={},n=[],i={};function r(z,F){return function(U){z(U,F)}}function o(z){t[z.id]=z}function a(z){return t[z.id]}function s(z,F){var U=z.gfx;if(U)throw new Error(`already rendered ${cn(z)}`);return e.element(z,i[z.id],F)}function c(z,F){return e.root(z,i[z.id],F)}function u(z,F){try{var U=i[z.id]&&s(z,F);return o(z),U}catch(Oe){l(Oe.message,{element:z,error:Oe}),console.error(`failed to import ${cn(z)}`,Oe)}}function l(z,F){e.error(z,F)}var p=this.registerDi=function(F){var U=F.bpmnElement;U?i[U.id]?l(`multiple DI elements defined for ${cn(U)}`,{element:U}):i[U.id]=F:l(`no bpmnElement referenced in ${cn(F)}`,{element:F})};function f(z){d(z.plane)}function d(z){p(z),k(z.planeElement,h)}function h(z){p(z)}this.handleDefinitions=function(F,U){var Oe=F.diagrams;if(U&&Oe.indexOf(U)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!U&&Oe&&Oe.length&&(U=Oe[0]),!U)throw new Error("no diagram to display");i={},f(U);var Lt=U.plane;if(!Lt)throw new Error(`no plane for ${cn(U)}`);var P=Lt.bpmnElement;if(!P)if(P=Y1(F),P)l(`correcting missing bpmnElement on ${cn(Lt)} to ${cn(P)}`),Lt.bpmnElement=P,p(Lt);else throw new Error("no process or collaboration to display");var _=c(P,Lt);if(bn(P,"bpmn:Process")||bn(P,"bpmn:SubProcess"))g(P,_);else if(bn(P,"bpmn:Collaboration"))le(P,_),R(F.rootElements,_);else throw new Error(`unsupported bpmnElement for ${cn(Lt)}: ${cn(P)}`);m(n)};var m=this.handleDeferred=function(){for(var F;n.length;)F=n.shift(),F()};function g(z,F){fe(z,F),H(z.ioSpecification,F),A(z.artifacts,F),o(z)}function R(z,F){var U=Ie(z,function(Oe){return!a(Oe)&&bn(Oe,"bpmn:Process")&&Oe.laneSets});U.forEach(r(g,F))}function w(z,F){u(z,F)}function b(z,F){k(z,r(w,F))}function x(z,F){u(z,F)}function S(z,F){u(z,F)}function M(z,F){u(z,F)}function I(z,F){u(z,F)}function A(z,F){k(z,function(U){bn(U,"bpmn:Association")?n.push(function(){I(U,F)}):I(U,F)})}function H(z,F){z&&(k(z.dataInputs,r(S,F)),k(z.dataOutputs,r(M,F)))}var V=this.handleSubProcess=function(F,U){fe(F,U),A(F.artifacts,U)};function $(z,F){var U=u(z,F);bn(z,"bpmn:SubProcess")&&V(z,U||F),bn(z,"bpmn:Activity")&&H(z.ioSpecification,F),n.push(function(){k(z.dataInputAssociations,r(x,F)),k(z.dataOutputAssociations,r(x,F))})}function G(z,F){u(z,F)}function pe(z,F){u(z,F)}function ze(z,F){n.push(function(){var U=u(z,F);z.childLaneSet&&lt(z.childLaneSet,U||F),ne(z)})}function lt(z,F){k(z.lanes,r(ze,F))}function Y(z,F){k(z,r(lt,F))}function fe(z,F){de(z.flowElements,F),z.laneSets&&Y(z.laneSets,F)}function de(z,F){k(z,function(U){bn(U,"bpmn:SequenceFlow")?n.push(function(){G(U,F)}):bn(U,"bpmn:BoundaryEvent")?n.unshift(function(){$(U,F)}):bn(U,"bpmn:FlowNode")?$(U,F):bn(U,"bpmn:DataObject")||(bn(U,"bpmn:DataStoreReference")||bn(U,"bpmn:DataObjectReference")?pe(U,F):l(`unrecognized flowElement ${cn(U)} in context ${cn(F&&F.businessObject)}`,{element:U,context:F}))})}function ue(z,F){var U=u(z,F),Oe=z.processRef;Oe&&g(Oe,U||F)}function le(z,F){k(z.participants,r(ue,F)),n.push(function(){b(z.messageFlows,F)}),A(z.artifacts,F)}function ne(z){k(z.flowNodeRef,function(F){var U=F.get("lanes");U&&U.push(z)})}}function v(e,t){var n=Z(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Le(e,t){return Wi(t,function(n){return v(e,n)})}function Z(e){return e&&e.businessObject||e}function Ge(e){return e&&e.di}function K1(e,t,n){var i,r,o,a,s=[];function c(u,l){var p={root:function(m,g){return i.add(m,g)},element:function(m,g,R){return i.add(m,g,R)},error:function(m,g){s.push({message:m,context:g})}},f=new q1(p);l=l||u.diagrams&&u.diagrams[0];var d=X1(u,l);if(!d)throw new Error("no diagram to display");k(d,function(m){f.handleDefinitions(u,m)});var h=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(h+"_plane")||o.findRoot(h))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(p){return p.warnings=s,l(p)}})}function X1(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!v(n,"bpmn:Process")&&!v(n,"bpmn:Collaboration")&&(i=Z1(n));var r;v(i,"bpmn:Collaboration")?r=i:r=ct(e.rootElements,function(u){if(v(u,"bpmn:Collaboration"))return ct(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=on(r.participants,function(u){return u.processRef}),o.push(r));var a=im(o),s=[t],c=[n];return k(e.diagrams,function(u){if(u.plane){var l=u.plane.bpmnElement;a.indexOf(l)!==-1&&c.indexOf(l)===-1&&(s.push(u),c.push(l))}}),s}}function im(e){var t=[];return k(e,function(n){n&&(t.push(n),t=t.concat(im(n.flowElements)))}),t}function Z1(e){for(var t=e;t;){if(v(t,"bpmn:Process"))return t;t=t.$parent}}var Q1='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.02 5.57" width="53" height="21"><path fill="currentColor" d="M1.88.92v.14c0 .41-.13.68-.4.8.33.14.46.44.46.86v.33c0 .61-.33.95-.95.95H0V0h.95c.65 0 .93.3.93.92zM.63.57v1.06h.24c.24 0 .38-.1.38-.43V.98c0-.28-.1-.4-.32-.4zm0 1.63v1.22h.36c.2 0 .32-.1.32-.39v-.35c0-.37-.12-.48-.4-.48H.63zM4.18.99v.52c0 .64-.31.98-.94.98h-.3V4h-.62V0h.92c.63 0 .94.35.94.99zM2.94.57v1.35h.3c.2 0 .3-.09.3-.37v-.6c0-.29-.1-.38-.3-.38h-.3zm2.89 2.27L6.25 0h.88v4h-.6V1.12L6.1 3.99h-.6l-.46-2.82v2.82h-.55V0h.87zM8.14 1.1V4h-.56V0h.79L9 2.4V0h.56v4h-.64zm2.49 2.29v.6h-.6v-.6zM12.12 1c0-.63.33-1 .95-1 .61 0 .95.37.95 1v2.04c0 .64-.34 1-.95 1-.62 0-.95-.37-.95-1zm.62 2.08c0 .28.13.39.33.39s.32-.1.32-.4V.98c0-.29-.12-.4-.32-.4s-.33.11-.33.4z"/><path fill="currentColor" d="M0 4.53h14.02v1.04H0zM11.08 0h.63v.62h-.63zm.63 4V1h-.63v2.98z"/></svg>',rm=Q1,om={verticalAlign:"middle"},am={color:"#404040"},J1={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},eS={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},tS={position:"absolute",left:"50%",top:"40%",transform:"translate(-50%)",width:"260px",padding:"10px",background:"white",boxShadow:"0 1px 4px rgba(0,0,0,0.3)",fontFamily:"Helvetica, Arial, sans-serif",fontSize:"14px",display:"flex",lineHeight:"1.3"},nS='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+rm+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',hi;function iS(){hi=ut(nS),gn(hi,J1),gn(nt("svg",hi),om),gn(nt(".backdrop",hi),eS),gn(nt(".notice",hi),tS),gn(nt(".link",hi),am,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function rS(){hi||(iS(),Cn.bind(hi,".backdrop","click",function(e){document.body.removeChild(hi)})),document.body.appendChild(hi)}const As=5,sm="djs-outline-hidden";function yt(e){e=O({},aS,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),cS(this._container)}ae(yt,ir),yt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(f){throw this._emit("import.parse.complete",{error:f}),f}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const p=await this.importDefinitions(s,n);return o=o.concat(p.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Ts(s,o),s=oS(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},yt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},yt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ts(o,[]),o}if(typeof t=="string"&&(i=sS(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ts(o,[]),o}try{this.clear()}catch(o){throw Ts(o,[]),o}const{warnings:r}=await K1(this,n,i);return{warnings:r}},yt.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,r;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,r=(await this._moddle.toXML(n,t)).xml,r=this._emit("saveXML.serialized",{xml:r})||r}catch(a){i=a}const o=i?{error:i}:{xml:r};if(this._emit("saveXML.done",o),i)throw i;return o},yt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=nt(":scope > defs",i._svg),a=Rh(r),s=o?"<defs>"+Rh(o)+"</defs>":"",c=i.getContainer();gt(c).add(sm);let u;try{u=r.getBBox()}finally{gt(c).remove(sm)}const l=u.x-As,p=u.y-As,f=u.width+As*2,d=u.height+As*2;t=`<?xml version="1.0" encoding="utf-8"?>
7
8
  <!-- created with bpmn-js / http://bpmn.io -->
8
9
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
9
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+l+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},$e.prototype._setDefinitions=function(e){this._definitions=e},$e.prototype.getModules=function(){return this._modules},$e.prototype.clear=function(){this.getDefinitions()&&ii.prototype.clear.call(this)},$e.prototype.destroy=function(){ii.prototype.destroy.call(this),mn(this._container)},$e.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},$e.prototype.off=function(e,t){this.get("eventBus").off(e,t)},$e.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=Ae(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},$e.prototype.getDefinitions=function(){return this._definitions},$e.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},$e.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=D(pn(n,["additionalModules"]),{canvas:D({},n.canvas,{container:e}),modules:a});ii.call(this,s),n&&n.container&&this.attachTo(n.container)},$e.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},$e.prototype._createContainer=function(e){const t=Ie('<div class="bjs-container"></div>');return wt(t,{width:Xf(e.width),height:Xf(e.height),position:e.position}),t},$e.prototype._createModdle=function(e){const t=D({},this._moddleExtensions,e.moddleExtensions);return new Wp(t)},$e.prototype._modules=[];function la(e,t){return e.warnings=t,e}function JE(e){const n=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return n&&(e.message="unparsable content <"+n[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+n[2]),e}const ex={width:"100%",height:"100%",position:"relative"};function Xf(e){return e+(ue(e)?"px":"")}function tx(e,t){return t&&Oe(e.diagrams,function(n){return n.id===t})||null}function nx(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Uf+"</a>",i=Ie(n);wt(Ae("svg",i),qf),wt(i,Yf,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),le.bind(i,"click",function(r){QE(),r.preventDefault()})}function ir(e){$e.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}X(ir,$e),ir.prototype._createModdle=function(e){var t=$e.prototype._createModdle.call(this,e);return t.ids=new hn([32,36,1]),t},ir.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function Ee(e,t){return y(e,"bpmn:CallActivity")?!1:y(e,"bpmn:SubProcess")?(t=t||we(e),t&&y(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):y(e,"bpmn:Participant")?!!G(e).processRef:!0}function at(e){if(!(!y(e,"bpmn:Participant")&&!y(e,"bpmn:Lane"))){var t=we(e).isHorizontal;return t===void 0?!0:t}}function ix(e){return e&&G(e).isInterrupting!==!1}function Et(e){return e&&!!G(e).triggeredByEvent}function rr(e,t){var n=G(e).eventDefinitions;return qn(n,function(i){return y(i,t)})}function rx(e){return rr(e,"bpmn:ErrorEventDefinition")}function ox(e){return rr(e,"bpmn:EscalationEventDefinition")}function ax(e){return rr(e,"bpmn:CompensateEventDefinition")}var Ii={width:90,height:20},Zf=15;function ri(e){return y(e,"bpmn:Event")||y(e,"bpmn:Gateway")||y(e,"bpmn:DataStoreReference")||y(e,"bpmn:DataObjectReference")||y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput")||y(e,"bpmn:SequenceFlow")||y(e,"bpmn:MessageFlow")||y(e,"bpmn:Group")}function pa(e){return he(e.label)}function sx(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=cx(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=Zf:a+=Zf,{x:a,y:s}}function cx(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function $c(e){return e.waypoints?sx(e.waypoints):y(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Ii.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Ii.height/2}}function ux(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Ii.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=$c(t),i=Ii),D({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Qf(e){if(y(e,"bpmn:FlowElement")||y(e,"bpmn:Participant")||y(e,"bpmn:Lane")||y(e,"bpmn:SequenceFlow")||y(e,"bpmn:MessageFlow")||y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput"))return"name";if(y(e,"bpmn:TextAnnotation"))return"text";if(y(e,"bpmn:Group"))return"categoryValueRef"}function lx(e){var t=e.categoryValueRef;return t&&t.value||""}function Vt(e){var t=e.businessObject,n=Qf(t);if(n)return n==="categoryValueRef"?lx(t):t[n]||""}function px(e,t){var n=e.businessObject,i=Qf(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function fx(e){return he(e)&&ri(e.labelTarget)}var or=7;function Jf(e){let t=[];return A(e.incoming,n=>{y(n,"bpmn:Association")&&y(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),A(e.outgoing,n=>{y(n,"bpmn:Association")&&y(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Ur(e){const t=new Map;return A(kc(e),n=>{A(Jf(n),i=>{t.has(i.annotation)||t.set(i.annotation,{annotation:i.annotation,associations:[]}),t.get(i.annotation).associations.push(i.association)})}),[...t.values()]}var jc="hsl(225, 10%, 15%)",dx="white";function _n(e,t){return qn(e.eventDefinitions,function(n){return n.$type===t})}function hx(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function mx(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function be(e,t,n){var i=we(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||dx}function K(e,t,n){var i=we(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||jc}function qr(e,t,n,i){var r=we(e),o=r.get("label");return i||o&&o.get("color:color")||t||K(e,n)}function ed(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return ki(r)}function Fc(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return ki(a)}function gx(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return ki(s)}function vx(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return ki(o)}function Yr(e,t={}){return{width:qt(e,t),height:It(e,t)}}function qt(e,t={}){return Mt(t,"width")?t.width:e.width}function It(e,t={}){return Mt(t,"height")?t.height:e.height}var yx=new hn,_x=10,fa=3,bx=1.5,da=10,Ex=4,ar=.95,xx=1,wx=.25;function Li(e,t,n,i,r,o,a){kn.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(w){return n.computeStyle(w,{strokeLinecap:"round",strokeLinejoin:"round",stroke:jc,strokeWidth:2,fill:"white"})}function p(w){return n.computeStyle(w,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:jc,strokeWidth:2})}function f(w,v){var{ref:m={x:0,y:0},scale:P=1,element:k,parentGfx:j=r._svg}=v,q=te("marker",{id:w,viewBox:"0 0 20 20",refX:m.x,refY:m.y,markerWidth:20*P,markerHeight:20*P,orient:"auto"});pe(q,k);var J=Ae(":scope > defs",j);J||(J=te("defs"),pe(j,J)),pe(J,q)}function d(w,v,m,P){var k=yx.nextPrefixed("marker-");return h(w,k,v,m,P),"url(#"+k+")"}function h(w,v,m,P,k){if(m==="sequenceflow-end"){var j=te("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:k,stroke:k,strokeWidth:1})});f(v,{element:j,ref:{x:11,y:10},scale:.5,parentGfx:w})}if(m==="messageflow-start"){var q=te("circle",{cx:6,cy:6,r:3.5,...l({fill:P,stroke:k,strokeWidth:1,strokeDasharray:[1e4,1]})});f(v,{element:q,ref:{x:6,y:6},parentGfx:w})}if(m==="messageflow-end"){var J=te("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:P,stroke:k,strokeWidth:1,strokeDasharray:[1e4,1]})});f(v,{element:J,ref:{x:8.5,y:5},parentGfx:w})}if(m==="association-start"){var ve=te("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:k,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(v,{element:ve,ref:{x:1,y:10},scale:.5,parentGfx:w})}if(m==="association-end"){var de=te("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:k,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(v,{element:de,ref:{x:11,y:10},scale:.5,parentGfx:w})}if(m==="conditional-flow-marker"){var _e=te("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:P,stroke:k})});f(v,{element:_e,ref:{x:-1,y:10},scale:.5,parentGfx:w})}if(m==="conditional-default-flow-marker"){var Ve=te("path",{d:"M 6 4 L 10 16",...l({stroke:k,fill:"none"})});f(v,{element:Ve,ref:{x:0,y:10},scale:.5,parentGfx:w})}}function g(w,v,m,P,k={}){rt(P)&&(k=P,P=0),P=P||0,k=l(k);var j=v/2,q=m/2,J=te("circle",{cx:j,cy:q,r:Math.round((v+m)/4-P),...k});return pe(w,J),J}function _(w,v,m,P,k,j){rt(k)&&(j=k,k=0),k=k||0,j=l(j);var q=te("rect",{x:k,y:k,width:v-k*2,height:m-k*2,rx:P,ry:P,...j});return pe(w,q),q}function R(w,v,m,P){var k=v/2,j=m/2,q=[{x:k,y:0},{x:v,y:j},{x:k,y:m},{x:0,y:j}],J=q.map(function(de){return de.x+","+de.y}).join(" ");P=l(P);var ve=te("polygon",{...P,points:J});return pe(w,ve),ve}function x(w,v,m,P){m=p(m);var k=jr(v,m,P);return pe(w,k),k}function E(w,v,m){return x(w,v,m,5)}function b(w,v,m){m=p(m);var P=te("path",{...m,d:v});return pe(w,P),P}function S(w,v,m,P){return b(v,m,D({"data-marker":w},P))}function T(w){return $[w]}function O(w){return function(v,m,P){return T(w)(v,m,P)}}var C={"bpmn:MessageEventDefinition":function(w,v,m={},P){var k=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:m.width||v.width,containerHeight:m.height||v.height,position:{mx:.235,my:.315}}),j=P?K(v,c,m.stroke):be(v,s,m.fill),q=P?be(v,s,m.fill):K(v,c,m.stroke),J=b(w,k,{fill:j,stroke:q,strokeWidth:1});return J},"bpmn:TimerEventDefinition":function(w,v,m={}){var P=m.width||v.width,k=m.height||v.height,j=m.width?1:2,q=g(w,P,k,.2*k,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke),strokeWidth:j}),J=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:P,containerHeight:k,position:{mx:.5,my:.5}});b(w,J,{stroke:K(v,c,m.stroke),strokeWidth:j});for(var ve=0;ve<12;ve++){var de=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:P,containerHeight:k,position:{mx:.5,my:.5}}),_e=P/2,Ve=k/2;b(w,de,{strokeWidth:1,stroke:K(v,c,m.stroke),transform:"rotate("+ve*30+","+Ve+","+_e+")"})}return q},"bpmn:EscalationEventDefinition":function(w,v,m={},P){var k=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width||v.width,containerHeight:m.height||v.height,position:{mx:.5,my:.2}}),j=P?K(v,c,m.stroke):be(v,s,m.fill);return b(w,k,{fill:j,stroke:K(v,c,m.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(w,v,m={}){var P=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width||v.width,containerHeight:m.height||v.height,position:{mx:.5,my:.222}});return b(w,P,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(w,v,m={},P){var k=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width,containerHeight:v.height,position:{mx:.57,my:.263}}),j=P?K(v,c,m.stroke):be(v,s,m.fill);return b(w,k,{fill:j,stroke:K(v,c,m.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(w,v,m={},P){var k=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:m.width||v.width,containerHeight:m.height||v.height,position:{mx:.2,my:.722}}),j=P?K(v,c,m.stroke):be(v,s,m.fill);return b(w,k,{fill:j,stroke:K(v,c,m.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(w,v,m={},P){var k=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width,containerHeight:v.height,position:{mx:.638,my:-.055}}),j=P?K(v,c,m.stroke):"none",q=b(w,k,{fill:j,stroke:K(v,c,m.stroke),strokeWidth:1});return Gf(q,45),q},"bpmn:CompensateEventDefinition":function(w,v,m={},P){var k=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:m.width||v.width,containerHeight:m.height||v.height,position:{mx:.22,my:.5}}),j=P?K(v,c,m.stroke):be(v,s,m.fill);return b(w,k,{fill:j,stroke:K(v,c,m.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(w,v,m={},P){var k=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:m.width||v.width,containerHeight:m.height||v.height,position:{mx:.5,my:.2}}),j=P?K(v,c,m.stroke):be(v,s,m.fill);return b(w,k,{strokeWidth:1,fill:j,stroke:K(v,c,m.stroke)})},"bpmn:MultipleEventDefinition":function(w,v,m={},P){var k=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:m.width||v.width,containerHeight:m.height||v.height,position:{mx:.211,my:.36}}),j=P?K(v,c,m.stroke):be(v,s,m.fill);return b(w,k,{fill:j,stroke:K(v,c,m.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(w,v,m={}){var P=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:m.width||v.width,containerHeight:m.height||v.height,position:{mx:.458,my:.194}});return b(w,P,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(w,v,m={}){var P=g(w,v.width,v.height,8,{fill:K(v,c,m.stroke),stroke:K(v,c,m.stroke),strokeWidth:4});return P}};function F(w,v,m={},P){var k=G(w),j=hx(k),q=P||w;return k.get("eventDefinitions")&&k.get("eventDefinitions").length>1?k.get("parallelMultiple")?C["bpmn:ParallelMultipleEventDefinition"](v,q,m,j):C["bpmn:MultipleEventDefinition"](v,q,m,j):_n(k,"bpmn:MessageEventDefinition")?C["bpmn:MessageEventDefinition"](v,q,m,j):_n(k,"bpmn:TimerEventDefinition")?C["bpmn:TimerEventDefinition"](v,q,m,j):_n(k,"bpmn:ConditionalEventDefinition")?C["bpmn:ConditionalEventDefinition"](v,q,m,j):_n(k,"bpmn:SignalEventDefinition")?C["bpmn:SignalEventDefinition"](v,q,m,j):_n(k,"bpmn:EscalationEventDefinition")?C["bpmn:EscalationEventDefinition"](v,q,m,j):_n(k,"bpmn:LinkEventDefinition")?C["bpmn:LinkEventDefinition"](v,q,m,j):_n(k,"bpmn:ErrorEventDefinition")?C["bpmn:ErrorEventDefinition"](v,q,m,j):_n(k,"bpmn:CancelEventDefinition")?C["bpmn:CancelEventDefinition"](v,q,m,j):_n(k,"bpmn:CompensateEventDefinition")?C["bpmn:CompensateEventDefinition"](v,q,m,j):_n(k,"bpmn:TerminateEventDefinition")?C["bpmn:TerminateEventDefinition"](v,q,m,j):null}var N={ParticipantMultiplicityMarker:function(w,v,m={}){var P=qt(v,m),k=It(v,m),j=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:P,containerHeight:k,position:{mx:(P/2-6)/P,my:(k-15)/k}});S("participant-multiplicity",w,j,{strokeWidth:2,fill:be(v,s,m.fill),stroke:K(v,c,m.stroke)})},SubProcessMarker:function(w,v,m={}){var P=_(w,14,14,0,{strokeWidth:1,fill:be(v,s,m.fill),stroke:K(v,c,m.stroke)});lt(P,v.width/2-7.5,v.height-20);var k=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:v.width,containerHeight:v.height,position:{mx:(v.width/2-7.5)/v.width,my:(v.height-20)/v.height}});S("sub-process",w,k,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke)})},ParallelMarker:function(w,v,m){var P=qt(v,m),k=It(v,m),j=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:P,containerHeight:k,position:{mx:(P/2+m.parallel)/P,my:(k-20)/k}});S("parallel",w,j,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke)})},SequentialMarker:function(w,v,m){var P=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width,containerHeight:v.height,position:{mx:(v.width/2+m.seq)/v.width,my:(v.height-19)/v.height}});S("sequential",w,P,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke)})},CompensationMarker:function(w,v,m){var P=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width,containerHeight:v.height,position:{mx:(v.width/2+m.compensation)/v.width,my:(v.height-13)/v.height}});S("compensation",w,P,{strokeWidth:1,fill:be(v,s,m.fill),stroke:K(v,c,m.stroke)})},LoopMarker:function(w,v,m){var P=qt(v,m),k=It(v,m),j=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:P,containerHeight:k,position:{mx:(P/2+m.loop)/P,my:(k-7)/k}});S("loop",w,j,{strokeWidth:1.5,fill:"none",stroke:K(v,c,m.stroke),strokeMiterlimit:.5})},AdhocMarker:function(w,v,m){var P=qt(v,m),k=It(v,m),j=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:P,containerHeight:k,position:{mx:(P/2+m.adhoc)/P,my:(k-15)/k}});S("adhoc",w,j,{strokeWidth:1,fill:K(v,c,m.stroke),stroke:K(v,c,m.stroke)})}};function I(w,v,m,P){N[w](v,m,P)}function W(w,v,m=[],P={}){P={fill:P.fill,stroke:P.stroke,width:qt(v,P),height:It(v,P)};var k=G(v),j=m.includes("SubProcessMarker");j?P={...P,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:P={...P,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},k.get("isForCompensation")&&m.push("CompensationMarker"),y(k,"bpmn:AdHocSubProcess")&&(m.push("AdhocMarker"),j||D(P,{compensation:P.compensation-18}));var q=k.get("loopCharacteristics"),J=q&&q.get("isSequential");q&&(D(P,{compensation:P.compensation-18}),m.includes("AdhocMarker")&&D(P,{seq:-23,loop:-18,parallel:-24}),J===void 0&&m.push("LoopMarker"),J===!1&&m.push("ParallelMarker"),J===!0&&m.push("SequentialMarker")),m.includes("CompensationMarker")&&m.length===1&&D(P,{compensation:-8}),A(m,function(ve){I(ve,w,v,P)})}function re(w,v,m={}){m=D({size:{width:100}},m);var P=o.createText(v||"",m);return xe(P).add("djs-label"),pe(w,P),P}function Pe(w,v,m,P={}){var k=G(v),j=Yr({x:v.x,y:v.y,width:v.width,height:v.height},P);return re(w,k.name,{align:m,box:j,padding:7,style:{fill:qr(v,u,c,P.stroke)}})}function Qe(w,v,m={}){var P={width:v.width,height:v.height,x:v.width/2+v.x,y:v.height/2+v.y};return re(w,Vt(v),{box:P,style:D({},o.getExternalStyle(),{fill:qr(v,u,c,m.stroke)})})}function U(w,v,m,P={}){var k=at(m),j=re(w,v,{box:{height:30,width:k?It(m,P):qt(m,P)},align:"center-middle",style:{fill:qr(m,u,c,P.stroke)}});if(k){var q=-1*It(m,P);ca(j,0,-q,270)}}function ee(w,v,m={}){var{width:P,height:k}=Yr(v,m);return _(w,P,k,da,{...m,fill:be(v,s,m.fill),fillOpacity:ar,stroke:K(v,c,m.stroke)})}function oe(w,v,m={}){var P=G(v),k=be(v,s,m.fill),j=K(v,c,m.stroke);return(P.get("associationDirection")==="One"||P.get("associationDirection")==="Both")&&(m.markerEnd=d(w,"association-end",k,j)),P.get("associationDirection")==="Both"&&(m.markerStart=d(w,"association-start",k,j)),m=Se(m,["markerStart","markerEnd"]),E(w,v.waypoints,{...m,stroke:j,strokeDasharray:"0, 5"})}function Q(w,v,m={}){var P=be(v,s,m.fill),k=K(v,c,m.stroke),j=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width,containerHeight:v.height,position:{mx:.474,my:.296}}),q=b(w,j,{fill:P,fillOpacity:ar,stroke:k}),J=G(v);if(mx(J)){var ve=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width,containerHeight:v.height,position:{mx:.33,my:(v.height-18)/v.height}});b(w,ve,{strokeWidth:2,fill:P,stroke:k})}return q}function ne(w,v,m={}){return g(w,v.width,v.height,{fillOpacity:ar,...m,fill:be(v,s,m.fill),stroke:K(v,c,m.stroke)})}function Y(w,v,m={}){return R(w,v.width,v.height,{fill:be(v,s,m.fill),fillOpacity:ar,stroke:K(v,c,m.stroke)})}function B(w,v,m={}){var P=_(w,qt(v,m),It(v,m),0,{fill:be(v,s,m.fill),fillOpacity:m.fillOpacity||ar,stroke:K(v,c,m.stroke),strokeWidth:1.5}),k=G(v);if(y(k,"bpmn:Lane")){var j=k.get("name");U(w,j,v,m)}return P}function L(w,v,m={}){var P=ee(w,v,m),k=Ee(v);if(Et(v)&&(Z(P,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!k)){var j=G(v).flowElements||[],q=j.filter(J=>y(J,"bpmn:StartEvent"));q.length===1&&H(q[0],w,m,v)}return Pe(w,v,k?"center-top":"center-middle",m),k?W(w,v,void 0,m):W(w,v,["SubProcessMarker"],m),P}function H(w,v,m,P){var k=22,j={fill:be(P,s,m.fill),stroke:K(P,c,m.stroke),width:k,height:k},q=G(w).isInterrupting,J=q?0:3,ve=q?1:1.2,de=20,_e=(k-de)/2,Ve="translate("+_e+","+_e+")";g(v,de,de,{fill:j.fill,stroke:j.stroke,strokeWidth:ve,strokeDasharray:J,transform:Ve}),F(w,v,j,P)}function M(w,v,m={}){var P=ee(w,v,m);return Pe(w,v,"center-middle",m),W(w,v,void 0,m),P}var $=this.handlers={"bpmn:AdHocSubProcess":function(w,v,m={}){return Ee(v)?m=Se(m,["fill","stroke","width","height"]):m=Se(m,["fill","stroke"]),L(w,v,m)},"bpmn:Association":function(w,v,m={}){return m=Se(m,["fill","stroke"]),oe(w,v,m)},"bpmn:BoundaryEvent":function(w,v,m={}){var{renderIcon:P=!0}=m;m=Se(m,["fill","stroke"]);var k=G(v),j=k.get("cancelActivity");m={strokeWidth:1.5,fill:be(v,s,m.fill),fillOpacity:xx,stroke:K(v,c,m.stroke)},j||(m.strokeDasharray="6");var q=ne(w,v,m);return g(w,v.width,v.height,fa,{...m,fill:"none"}),P&&F(v,w,m),q},"bpmn:BusinessRuleTask":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=M(w,v,m),k=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),j=b(w,k);Z(j,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke),strokeWidth:1});var q=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),J=b(w,q);return Z(J,{fill:K(v,c,m.stroke),stroke:K(v,c,m.stroke),strokeWidth:1}),P},"bpmn:CallActivity":function(w,v,m={}){return m=Se(m,["fill","stroke"]),L(w,v,{strokeWidth:5,...m})},"bpmn:ComplexGateway":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=Y(w,v,m),k=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:v.width,containerHeight:v.height,position:{mx:.46,my:.26}});return b(w,k,{fill:K(v,c,m.stroke),stroke:K(v,c,m.stroke),strokeWidth:1}),P},"bpmn:DataInput":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=i.getRawPath("DATA_ARROW"),k=Q(w,v,m);return b(w,P,{fill:"none",stroke:K(v,c,m.stroke),strokeWidth:1}),k},"bpmn:DataInputAssociation":function(w,v,m={}){return m=Se(m,["fill","stroke"]),oe(w,v,{...m,markerEnd:d(w,"association-end",be(v,s,m.fill),K(v,c,m.stroke))})},"bpmn:DataObject":function(w,v,m={}){return m=Se(m,["fill","stroke"]),Q(w,v,m)},"bpmn:DataObjectReference":O("bpmn:DataObject"),"bpmn:DataOutput":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=i.getRawPath("DATA_ARROW"),k=Q(w,v,m);return b(w,P,{strokeWidth:1,fill:K(v,c,m.stroke),stroke:K(v,c,m.stroke)}),k},"bpmn:DataOutputAssociation":function(w,v,m={}){return m=Se(m,["fill","stroke"]),oe(w,v,{...m,markerEnd:d(w,"association-end",be(v,s,m.fill),K(v,c,m.stroke))})},"bpmn:DataStoreReference":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width,containerHeight:v.height,position:{mx:0,my:.133}});return b(w,P,{fill:be(v,s,m.fill),fillOpacity:ar,stroke:K(v,c,m.stroke),strokeWidth:2})},"bpmn:EndEvent":function(w,v,m={}){var{renderIcon:P=!0}=m;m=Se(m,["fill","stroke"]);var k=ne(w,v,{...m,strokeWidth:4});return P&&F(v,w,m),k},"bpmn:EventBasedGateway":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=G(v),k=Y(w,v,m);g(w,v.width,v.height,v.height*.2,{fill:be(v,"none",m.fill),stroke:K(v,c,m.stroke),strokeWidth:1});var j=P.get("eventGatewayType"),q=!!P.get("instantiate");function J(){var de=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:v.width,containerHeight:v.height,position:{mx:.36,my:.44}});b(w,de,{fill:"none",stroke:K(v,c,m.stroke),strokeWidth:2})}if(j==="Parallel"){var ve=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:v.width,containerHeight:v.height,position:{mx:.474,my:.296}});b(w,ve,{fill:"none",stroke:K(v,c,m.stroke),strokeWidth:1})}else j==="Exclusive"&&(q||g(w,v.width,v.height,v.height*.26,{fill:"none",stroke:K(v,c,m.stroke),strokeWidth:1}),J());return k},"bpmn:ExclusiveGateway":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=Y(w,v,m),k=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:v.width,containerHeight:v.height,position:{mx:.32,my:.3}}),j=we(v);return j.get("isMarkerVisible")&&b(w,k,{fill:K(v,c,m.stroke),stroke:K(v,c,m.stroke),strokeWidth:1}),P},"bpmn:Gateway":function(w,v,m={}){return m=Se(m,["fill","stroke"]),Y(w,v,m)},"bpmn:Group":function(w,v,m={}){return m=Se(m,["fill","stroke","width","height"]),_(w,v.width,v.height,da,{stroke:K(v,c,m.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:qt(v,m),height:It(v,m)})},"bpmn:InclusiveGateway":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=Y(w,v,m);return g(w,v.width,v.height,v.height*.24,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke),strokeWidth:2.5}),P},"bpmn:IntermediateEvent":function(w,v,m={}){var{renderIcon:P=!0}=m;m=Se(m,["fill","stroke"]);var k=ne(w,v,{...m,strokeWidth:1.5});return g(w,v.width,v.height,fa,{fill:"none",stroke:K(v,c,m.stroke),strokeWidth:1.5}),P&&F(v,w,m),k},"bpmn:IntermediateCatchEvent":O("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":O("bpmn:IntermediateEvent"),"bpmn:Lane":function(w,v,m={}){return m=Se(m,["fill","stroke","width","height"]),B(w,v,{...m,fillOpacity:wx})},"bpmn:ManualTask":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=M(w,v,m),k=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return b(w,k,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke),strokeWidth:.5}),P},"bpmn:MessageFlow":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=G(v),k=we(v),j=be(v,s,m.fill),q=K(v,c,m.stroke),J=E(w,v.waypoints,{markerEnd:d(w,"messageflow-end",j,q),markerStart:d(w,"messageflow-start",j,q),stroke:q,strokeDasharray:"10, 11",strokeWidth:1.5});if(P.get("messageRef")){var ve=J.getPointAtLength(J.getTotalLength()/2),de=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ve.x,y:ve.y}}),_e={strokeWidth:1};k.get("messageVisibleKind")==="initiating"?(_e.fill=j,_e.stroke=q):(_e.fill=q,_e.stroke=j);var Ve=b(w,de,_e),dt=P.get("messageRef"),Rt=dt.get("name"),Re=re(w,Rt,{align:"center-top",fitBox:!0,style:{fill:q}}),Ne=Ve.getBBox(),ht=Re.getBBox(),cn=ve.x-ht.width/2,Gt=ve.y+Ne.height/2+_x;ca(Re,cn,Gt,0)}return J},"bpmn:ParallelGateway":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=Y(w,v,m),k=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:v.width,containerHeight:v.height,position:{mx:.46,my:.2}});return b(w,k,{fill:K(v,c,m.stroke),stroke:K(v,c,m.stroke),strokeWidth:1}),P},"bpmn:Participant":function(w,v,m={}){m=Se(m,["fill","stroke","width","height"]);var P=B(w,v,m),k=Ee(v),j=at(v),q=G(v),J=q.get("name");if(k){var ve=j?[{x:30,y:0},{x:30,y:It(v,m)}]:[{x:0,y:30},{x:qt(v,m),y:30}];x(w,ve,{stroke:K(v,c,m.stroke),strokeWidth:bx}),U(w,J,v,m)}else{var de=Yr(v,m);j||(de.height=qt(v,m),de.width=It(v,m));var _e=re(w,J,{box:de,align:"center-middle",style:{fill:qr(v,u,c,m.stroke)}});if(!j){var Ve=-1*It(v,m);ca(_e,0,-Ve,270)}}return q.get("participantMultiplicity")&&I("ParticipantMultiplicityMarker",w,v,m),P},"bpmn:ReceiveTask":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=G(v),k=M(w,v,m),j;return P.get("instantiate")?(g(w,28,28,20*.22,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke),strokeWidth:1}),j=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):j=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),b(w,j,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke),strokeWidth:1}),k},"bpmn:ScriptTask":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=M(w,v,m),k=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return b(w,k,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke),strokeWidth:1}),P},"bpmn:SendTask":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=M(w,v,m),k=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return b(w,k,{fill:K(v,c,m.stroke),stroke:be(v,s,m.fill),strokeWidth:1}),P},"bpmn:SequenceFlow":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=be(v,s,m.fill),k=K(v,c,m.stroke),j=E(w,v.waypoints,{markerEnd:d(w,"sequenceflow-end",P,k),stroke:k}),q=G(v),{source:J}=v;if(J){var ve=G(J);q.get("conditionExpression")&&y(ve,"bpmn:Activity")&&Z(j,{markerStart:d(w,"conditional-flow-marker",P,k)}),ve.get("default")&&(y(ve,"bpmn:Gateway")||y(ve,"bpmn:Activity"))&&ve.get("default")===q&&Z(j,{markerStart:d(w,"conditional-default-flow-marker",P,k)})}return j},"bpmn:ServiceTask":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=M(w,v,m);g(w,10,10,{fill:be(v,s,m.fill),stroke:"none",transform:"translate(6, 6)"});var k=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});b(w,k,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke),strokeWidth:1}),g(w,10,10,{fill:be(v,s,m.fill),stroke:"none",transform:"translate(11, 10)"});var j=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return b(w,j,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke),strokeWidth:1}),P},"bpmn:StartEvent":function(w,v,m={}){var{renderIcon:P=!0}=m;m=Se(m,["fill","stroke"]);var k=G(v);k.get("isInterrupting")||(m={...m,strokeDasharray:"6"});var j=ne(w,v,m);return P&&F(v,w,m),j},"bpmn:SubProcess":function(w,v,m={}){return Ee(v)?m=Se(m,["fill","stroke","width","height"]):m=Se(m,["fill","stroke"]),L(w,v,m)},"bpmn:Task":function(w,v,m={}){return m=Se(m,["fill","stroke"]),M(w,v,m)},"bpmn:TextAnnotation":function(w,v,m={}){m=Se(m,["fill","stroke"]);var{width:P,height:k}=Yr(v,m),j=_(w,P,k,0,0,{fill:"none",stroke:"none"}),q=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:P,containerHeight:k,position:{mx:0,my:0}});b(w,q,{stroke:K(v,c,m.stroke)});var J=G(v),ve=J.get("text")||"";return re(w,ve,{align:"left-top",box:Yr(v,m),padding:or,style:{fill:qr(v,u,c,m.stroke)}}),j},"bpmn:Transaction":function(w,v,m={}){Ee(v)?m=Se(m,["fill","stroke","width","height"]):m=Se(m,["fill","stroke"]);var P=L(w,v,{strokeWidth:1.5,...m}),k=n.style(["no-fill","no-events"],{stroke:K(v,c,m.stroke),strokeWidth:1.5}),j=Ee(v);return j||(m={}),_(w,qt(v,m),It(v,m),da-fa,fa,k),P},"bpmn:UserTask":function(w,v,m={}){m=Se(m,["fill","stroke"]);var P=M(w,v,m),k=15,j=12,q=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:k,y:j}});b(w,q,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke),strokeWidth:.5});var J=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:k,y:j}});b(w,J,{fill:be(v,s,m.fill),stroke:K(v,c,m.stroke),strokeWidth:.5});var ve=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:k,y:j}});return b(w,ve,{fill:K(v,c,m.stroke),stroke:K(v,c,m.stroke),strokeWidth:.5}),P},label:function(w,v,m={}){return Qe(w,v,m)}};this._drawPath=b,this._renderer=T}X(Li,kn),Li.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Li.prototype.canRender=function(e){return y(e,"bpmn:BaseElement")},Li.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Li.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Li.prototype.getShapePath=function(e){return he(e)?Fc(e,Ex):y(e,"bpmn:Event")?ed(e):y(e,"bpmn:Activity")?Fc(e,da):y(e,"bpmn:Gateway")?gx(e):vx(e)};function Se(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var Sx=0,Rx={width:150,height:50};function Cx(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function Px(e){return rt(e)?D({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Hc=null;function Ax(){return Hc||(Hc=document.createElement("canvas").getContext("2d")),Hc}function Tx(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(td(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function td(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function Mx(e,t){var n=Ax();if(!n)return{width:0,height:0};n.font=Tx(t),"letterSpacing"in n&&(n.letterSpacing=td(t.letterSpacing)||"0px");var i=e==="",r=i?"dummy":e.replace(/\s+$/,""),o=n.measureText(r);return{width:i?0:o.width,height:"fontBoundingBoxAscent"in o?o.fontBoundingBoxAscent+o.fontBoundingBoxDescent:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}function kx(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=Mx(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return Dx(e,r,i,o);r=Ix(r,o.width,t)}}function Dx(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var nd="­";function Ox(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,r=[],o=0;if(n.length>1)for(;i=n.shift();)if(i.length+o<t)r.push(i),o+=i.length;else{(i==="-"||i===nd)&&r.pop();break}var a=r[r.length-1];return a&&a===nd&&(r[r.length-1]="-"),r.join("")}function Ix(e,t,n){var i=Math.max(e.length*(n/t),1),r=Ox(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function ha(e){this._config=D({},{size:Rx,padding:Sx,style:{},align:"center-top"},e||{})}ha.prototype.createText=function(e,t){return this.layoutText(e,t).element},ha.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},ha.prototype.layoutText=function(e,t){for(var n=D({},this._config.size,t.box),i=D({},this._config.style,t.style),r=Cx(t.align||this._config.align),o=Px(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=Lx(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(kx(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=kt(u,function(_,R,x){return _+(s||R.height)},0)+o.top+o.bottom,f=kt(u,function(_,R,x){return R.width>_?R.width:_},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var h=te("text");Z(h,i),A(u,function(_){var R;switch(d+=s||_.height,r.horizontal){case"left":R=o.left;break;case"right":R=(a?f:l)-o.right-_.width;break;default:R=Math.max(((a?f:l)-_.width)/2+o.left,0)}var x=te("tspan");Z(x,{x:R,y:d}),x.textContent=_.text,pe(h,x)});var g={width:f,height:p};return{dimensions:g,element:h}};function Lx(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var Bx=12,Nx=1.2,$x=40;function id(e){var t=D({fontFamily:"Arial, sans-serif",fontSize:Bx,fontWeight:"normal",lineHeight:Nx},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=D({},t,{fontSize:n},e&&e.externalStyle||{}),r=new ha({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Ii.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:or});return{x:a.x,y:a.y,width:a.width,height:Math.max($x,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,D({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}id.$inject=["config.textRenderer"];function jx(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var p=Vx(i.d,{mx:r,my:o,e:a});return p}}var Fx=/\{([^{}]+)\}/g,Hx=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function zx(e,t,n){var i=n;return t.replace(Hx,function(r,o,a,s,c){o=o||s,i&&(o in i&&(i=i[o]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function Vx(e,t){return String(e).replace(Fx,function(n,i){return zx(n,i,t)})}const Gx={__init__:["bpmnRenderer"],bpmnRenderer:["type",Li],textRenderer:["type",id],pathMap:["type",jx]};function Wx(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Kr={translate:["value",Wx]};function ma(e,t,n){return D({id:e.id,type:e.$type,businessObject:e,di:t},n)}function Ux(e,t,n){var i=e.waypoint;return!i||i.length<2?[se(t),se(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function rd(e,t,n){return new Error(`element ${bt(t)} referenced by ${bt(e)}#${n} not yet drawn`)}function Ln(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Ln.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Ln.prototype.add=function(e,t,n){var i,r,o;if(y(t,"bpmndi:BPMNPlane")){var a=y(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(ma(e,t,a)),this._canvas.addRootElement(i)}else if(y(t,"bpmndi:BPMNShape")){var s=!Ee(e,t),c=Yx(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(ma(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),y(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),y(e,"bpmn:Lane")&&(o=0),y(e,"bpmn:DataStoreReference")&&(qx(n,se(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(y(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(ma(e,t,{hidden:r,source:l,target:p,waypoints:Ux(t,l,p)})),y(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${bt(t)} for element ${bt(e)}`);return ri(e)&&Vt(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Ln.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${bt(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw rd(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Ln.prototype.addLabel=function(e,t,n){var i,r,o;return i=ux(t,n),r=Vt(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(ma(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Vt(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},Ln.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?rd(e,i,t+"Ref"):new Error(`${bt(e)}#${t} Ref not specified`)},Ln.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Ln.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Ln.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function qx(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function Yx(e){return y(e,"bpmn:Group")}const od={__depends__:[Gx,{__depends__:[Kr],bpmnImporter:["type",Ln]}]};function Xr(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function an(e,t){return{x:e.x-t.x,y:e.y-t.y}}function zc(e){return Math.log(e)/Math.log(10)}var Kx=1e3;function V(e){this._eventBus=e}V.$inject=["eventBus"];function Xx(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}V.prototype.on=function(e,t,n,i,r,o){if((ot(t)||ue(t))&&(o=r,r=i,i=n,n=t,t=null),ot(n)&&(o=r,r=i,i=n,n=Kx),rt(r)&&(o=r,r=!1),!ot(i))throw new Error("handlerFn must be a function");ae(e)||(e=[e]);var a=this._eventBus;A(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?Xx(i,o):i,o)})},V.prototype.canExecute=Bn("canExecute"),V.prototype.preExecute=Bn("preExecute"),V.prototype.preExecuted=Bn("preExecuted"),V.prototype.execute=Bn("execute"),V.prototype.executed=Bn("executed"),V.prototype.postExecute=Bn("postExecute"),V.prototype.postExecuted=Bn("postExecuted"),V.prototype.revert=Bn("revert"),V.prototype.reverted=Bn("reverted");function Bn(e){return function(n,i,r,o,a){(ot(n)||ue(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Vc=["top","bottom","left","right"],ga=10;function Gc(e,t){V.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(pa(r)&&!Te(r)){var o=Jx(r);o&&i(r,o)}}function i(r,o){var a=se(r),s=r.label,c=se(s);if(s.parent){var u=ie(r),l;switch(o){case"top":l={x:a.x,y:u.top-ga-s.height/2};break;case"left":l={x:u.left-ga-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+ga+s.height/2};break;case"right":l={x:u.right+ga+s.width/2,y:a.y};break}var p=an(l,c);t.moveShape(s,p)}}}X(Gc,V),Gc.$inject=["eventBus","modeling"];function Zx(e){var t=e.host,n=se(e),i=ut(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Vc.filter(function(a){return r.indexOf(a)===-1});return o}function Qx(e){var t=se(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return ad(t,i)});return n}function Jx(e){var t=se(e.label),n=se(e),i=ad(n,t);if(ew(i)){var r=Qx(e);if(e.host){var o=Zx(e);r=r.concat(o)}var a=Vc.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?ut(e.label,e)!=="intersect"?void 0:i:a[0]}}function ad(e,t){return ut(t,e,5)}function ew(e){return Vc.indexOf(e)!==-1}function Wc(e){V.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(y(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}X(Wc,V),Wc.$inject=["eventBus"];var tw=1500;function Uc(e,t,n){e.invoke(V,this),this.preExecute("elements.delete",tw,function(r){var o=r.context,a=o.elements,s=i(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=ye(r,u=>y(u,"bpmn:Participant")||y(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>y(u,"bpmn:Artifact"))),c=new Set;return A(o,u=>{const l=new Set(Ki(er(Array.from(s),Ue(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}X(Uc,V),Uc.$inject=["injector","eventBus","canvas"];function qc(e,t){e.invoke(V,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=ye(r.incoming.concat(r.outgoing),function(a){return y(a,"bpmn:Association")});A(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}X(qc,V),qc.$inject=["injector","modeling"];function sr(e,t){for(Tt(t)&&(t=[t]);e=e.parent;)if(ge(e,t))return e;return null}function sd(e,t){var n=sr(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=sr(e,i),n)return at(n);if(ge(e,i))return at(e);var r;for(r=G(e);r&&!y(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=G(a);return s&&s.get("processRef")===r});return o?at(o):!0}var cd=500;function va(e,t){t.invoke(V,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",cd,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return ud(o,a)}),r.length===1&&r.map(function(o){return r.indexOf(o)}).forEach(function(o){var a=r[o];i.elements[o]=n._replaceShape(r[o],a)})},!0),this.preExecute("elements.move",cd,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];ud(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}va.$inject=["bpmnReplace","injector"],X(va,V),va.prototype._replaceShape=function(e,t){var n=nw(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function nw(e){var t=G(e),n=t.eventDefinitions;return n&&n[0]}function ud(e,t){return!he(e)&&ge(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Yc(e,t){V.call(this,e);function n(i){return ye(i.attachers,function(r){return y(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);y(r,"bpmn:EventBasedGateway")&&y(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;y(r,"bpmn:Gateway")&&y(o,"bpmn:EventBasedGateway")&&A(o.outgoing,function(a){var s=a.target,c=n(s);y(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Yc.$inject=["eventBus","modeling"],X(Yc,V);function ld(e){return e.create("bpmn:Category")}function iw(e){return e.create("bpmn:CategoryValue")}function pd(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=iw(e)),n.$parent||(n.$parent=ld(e)),n}function rw(e,t,n){return Ge(t.get("categoryValue"),e),e.$parent=t,Ge(n.get("rootElements"),t),t.$parent=n,e}function ow(e){var t=e.$parent;return t&&(ze(t.get("categoryValue"),e),e.$parent=null),e}function aw(e){var t=e.$parent;return t&&(ze(t.get("rootElements"),e),e.$parent=null),e}var sw=500;function Kc(e,t,n){n.invoke(V,this);function i(c){return t.filter(function(u){return y(u,"bpmn:Group")&&!u.labelTarget}).map(G).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var p=l.get("categoryValueRef");return p&&p.$parent===c})}function a(c,u){c&&u&&rw(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&aw(u),c&&!r(c,l)&&ow(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!y(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!y(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,G(u))},!0),this.executed(["shape.move","shape.resize"],sw,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var u=c.shape;c.categoryValue&&s(c.categoryValue,c.category,G(u))},!0),this.executed("group.updateRefs",function(c){fd(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){fd(c).forEach(function(u){s(u.categoryValue,u.category,G(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,G(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Kc.$inject=["bpmnjs","elementRegistry","injector"],X(Kc,V);function fd(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Xc(e,t,n){V.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(_){const R=_.source,x=_.target;cr(R)&&Zr(x)&&l(x)}function r(_){const R=_.connection,x=_.source,E=_.target;cr(x)&&ya(E)&&(u(E),f(x,[R]))}function o(_){const R=_.newTarget,x=_.oldSource,E=_.oldTarget;if(E!==R){const b=x;Zr(E)&&l(E),cr(b)&&ya(R)&&u(R)}}function a(_){const{element:R}=_;Zr(R)?(p(R),d(R)):ya(R)&&h(R)}function s(_){const{newData:R,oldShape:x}=_;if(cr(_.oldShape)&&R.eventDefinitionType!=="bpmn:CompensateEventDefinition"||R.type!=="bpmn:BoundaryEvent"){const E=x.outgoing.find(({target:b})=>Zr(b));E&&E.target&&(_._connectionTarget=E.target)}else if(!cr(_.oldShape)&&R.eventDefinitionType==="bpmn:CompensateEventDefinition"&&R.type==="bpmn:BoundaryEvent"){const E=x.outgoing.find(({target:b})=>ya(b));E&&E.target&&(_._connectionTarget=E.target),g(x)}}function c(_){const{_connectionTarget:R,newShape:x}=_;R&&t.connect(x,R)}function u(_){t.updateProperties(_,{isForCompensation:!0})}function l(_){t.updateProperties(_,{isForCompensation:void 0})}function p(_){for(const R of _.incoming)n.canConnect(R.source,_)||t.removeConnection(R);for(const R of _.outgoing)n.canConnect(_,R.target)||t.removeConnection(R)}function f(_,R){_.outgoing.filter(b=>y(b,"bpmn:Association")).filter(b=>Zr(b.target)&&!R.includes(b)).forEach(b=>t.removeConnection(b))}function d(_){const R=_.attachers.slice();R.length&&t.removeElements(R)}function h(_){const R=_.incoming.filter(x=>cr(x.source));t.removeElements(R)}function g(_){const R=_.outgoing.filter(x=>y(x,"bpmn:SequenceFlow"));t.removeElements(R)}}X(Xc,V),Xc.$inject=["eventBus","modeling","bpmnRules"];function Zr(e){const t=G(e);return t&&t.get("isForCompensation")}function cr(e){return e&&y(e,"bpmn:BoundaryEvent")&&rr(e,"bpmn:CompensateEventDefinition")}function ya(e){return e&&y(e,"bpmn:Activity")&&!Et(e)}function Zc(e){e.invoke(V,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;y(i,"bpmn:Lane")&&!y(r,"bpmn:Lane")&&(n.parent=sr(i,"bpmn:Participant"))})}Zc.$inject=["injector"],X(Zc,V);function Qc(e,t){V.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(y(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}Qc.$inject=["eventBus","bpmnFactory"],X(Qc,V);var Jc=20,eu=20,dd=30,_a=2e3;function tu(e,t,n){V.call(this,t),t.on(["create.start","shape.move.start"],_a,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!y(a,"bpmn:Participant")||!y(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!y(p,"bpmn:Group")&&!he(p)&&!Te(p)});if(c.length){var u=Ue(c),l=cw(a,u);D(a,l),o.createConstraints=uw(a,u)}}}),t.on("create.start",_a,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}y(a,"bpmn:Participant")&&y(s,"bpmn:Process")&&(t.on("element.hover",_a,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return y(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",_a,function(r){var o=r.elements,a=r.parent,s=lw(o),c;s&&y(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=G(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;y(a,"bpmn:Participant")&&y(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=G(a).get("processRef"))},!0),this.execute("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.shape,c=o.participant;a&&(!c||s===c)&&G(s).set("processRef",G(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.processRef||o.processRef,c=r.shape,u=o.participant;a&&(!u||c===u)&&G(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var u=a.children.slice();c?s===c&&n.moveElements(u,{x:0,y:0},c):n.moveElements(u,{x:0,y:0},s)}},!0)}tu.$inject=["canvas","eventBus","modeling"],X(tu,V);function cw(e,t){t={width:t.width+Jc*2+dd,height:t.height+eu*2};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}function uw(e,t){return t=ie(t),{bottom:t.top+e.height/2-eu,left:t.right-e.width/2+Jc,top:t.bottom-e.height/2+eu,right:t.left+e.width/2-Jc-dd}}function lw(e){return Oe(e,function(t){return y(t,"bpmn:Participant")})}var hd="__targetRef_placeholder";function nu(e,t){V.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],md(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],md(o));function n(a,s,c){var u=a.get("dataInputAssociations");return Oe(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=Oe(c,function(l){return l.name===hd});return!u&&s&&(u=t.create("bpmn:Property",{name:hd}),Ge(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||ze(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,p=l&&l.businessObject,f=s.newTarget,d=f&&f.businessObject,h=s.oldTarget||s.target,g=h&&h.businessObject,_=c.businessObject,R;g&&g!==p&&r(g,u),d&&d!==p&&r(d,u),p?(R=i(p,!0),_.targetRef=R):_.targetRef=null}}nu.$inject=["eventBus","bpmnFactory"],X(nu,V);function md(e){return function(t){var n=t.context,i=n.connection;if(y(i,"bpmn:DataInputAssociation"))return e(t)}}function ba(e){this._bpmnUpdater=e}ba.$inject=["bpmnUpdater"],ba.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},ba.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function iu(e,t,n,i){V.call(this,i),t.registerHandler("dataStore.updateContainment",ba);function r(){return n.filter(function(s){return y(s,"bpmn:Participant")&&G(s).processRef})[0]}function o(s){return s.children.filter(function(c){return y(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:we(s),newSemanticParent:l.processRef||l,newDiParent:we(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;y(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(p){return y(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!y(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;y(u,"bpmn:DataStoreReference")&&u.type!=="label"&&y(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,p=u.parent;if(!y(l,"bpmn:Collaboration")&&y(u,"bpmn:DataStoreReference")&&u.type!=="label"&&y(p,"bpmn:Collaboration")){var f=y(l,"bpmn:Participant")?l:fw(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();ge(u,["bpmn:Participant","bpmn:SubProcess"])&&y(l,"bpmn:Collaboration")&&o(l).filter(function(p){return pw(p,u)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,p=o(u);p.forEach(function(f){y(l,"bpmn:Process")&&a(f,l)})})}iu.$inject=["canvas","commandStack","elementRegistry","eventBus"],X(iu,V);function pw(e,t){for(var n=e.businessObject||e,i=t.businessObject||t;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}function fw(e,t){for(;e.parent;){if(y(e.parent,t))return e.parent;e=e.parent}}var Ea=Math.max,xa=Math.min,dw=20;function gd(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function hw(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(o.y=e.y+r,o.height=e.height-r):t.indexOf("s")!==-1&&(o.height=e.height+r),t.indexOf("e")!==-1?o.width=e.width+i:t.indexOf("w")!==-1&&(o.x=e.x+i,o.width=e.width-i),o}function mw(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}function wa(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return ue(r)&&(i=(/top|left/.test(e)?xa:Ea)(i,r)),ue(o)&&(i=(/top|left/.test(e)?Ea:xa)(i,o)),i}function gw(e,t){if(!t)return e;var n=ie(e);return oa({top:wa("top",n,t),right:wa("right",n,t),bottom:wa("bottom",n,t),left:wa("left",n,t)})}function vw(e,t,n,i){var r=ie(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?ie(i):o,s={top:xa(o.top,a.top),left:xa(o.left,a.left),bottom:Ea(o.bottom,a.bottom),right:Ea(o.right,a.right)};return oa(s)}function Qr(e,t){return typeof e<"u"?e:dw}function yw(e,t){var n,i,r,o;return typeof t=="object"?(n=Qr(t.left),i=Qr(t.right),r=Qr(t.top),o=Qr(t.bottom)):n=i=r=o=Qr(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function _w(e){return!(e.waypoints||e.type==="label")}function vd(e,t){var n;if(e.length===void 0?n=ye(e.children,_w):n=e,n.length)return yw(Ue(n),t)}var oi=Math.abs;function bw(e,t){return gd(ie(t),ie(e))}var Ew=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Yt=30;function Sa(e,t){return t=t||[],e.children.filter(function(n){y(n,"bpmn:Lane")&&(Sa(n,t),t.push(n))}),t}function ai(e){return e.children.filter(function(t){return y(t,"bpmn:Lane")})}function Kt(e){return sr(e,Ew)||e}function xw(e,t){var n=Kt(e),i=y(n,"bpmn:Process")?[]:[n],r=Sa(n,i),o=ie(e),a=ie(t),s=bw(e,t),c=[],u=at(e);return r.forEach(function(l){if(l!==e){var p=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,g=ie(l);s.top&&(oi(g.bottom-o.top)<10&&(d=a.top-g.bottom),oi(g.top-o.top)<5&&(p=a.top-g.top)),s.left&&(oi(g.right-o.left)<10&&(f=a.left-g.right),oi(g.left-o.left)<5&&(h=a.left-g.left)),s.bottom&&(oi(g.top-o.bottom)<10&&(p=a.bottom-g.top),oi(g.bottom-o.bottom)<5&&(d=a.bottom-g.bottom)),s.right&&(oi(g.left-o.right)<10&&(h=a.right-g.left),oi(g.right-o.right)<5&&(f=a.right-g.right)),(p||f||d||h)&&c.push({shape:l,newBounds:mw(l,{top:p,right:f,bottom:d,left:h})})}}),c}var ww=500;function ru(e,t){V.call(this,e);function n(i,r){var o=at(i),a=ai(r),s=[],c=[],u=[],l=[];if(Di(a,function(_){return o?_.y>i.y?c.push(_):s.push(_):_.x>i.x?l.push(_):u.push(_),_.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:l.length&&u.length?p=i.width/2:p=i.width;var f,d,h,g;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),u.length&&(h=t.calculateAdjustments(u,"x",p,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:p,y:0},"e")),l.length&&(g=t.calculateAdjustments(l,"x",-p,i.x+i.width+10),t.makeSpace(g.movingShapes,g.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",ww,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;y(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}ru.$inject=["eventBus","spaceTool"],X(ru,V);var yd=500;function Ra(e,t){t.invoke(V,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",yd,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return _d(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",yd,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;_d(a,Rw(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Ra.$inject=["bpmnReplace","injector"],X(Ra,V),Ra.prototype._replaceShape=function(e){var t=Sw(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function Sw(e){var t=G(e),n=t.eventDefinitions;return n&&n[0]}function _d(e,t){return!he(e)&&y(e,"bpmn:BoundaryEvent")&&!t}function Rw(e,t){return e.indexOf(t)!==-1}var Ca=Math.round,Cw=Math.max;function Pw(e,t){var n=e.x,i=e.y;return[["M",n,i],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function Aw(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var bd=10;function Tw(e,t){var n,i;for(n=0;i=e[n];n++)if(zr(i,t)<=bd)return{point:e[n],bendpoint:!0,index:n};return null}function Mw(e,t){var n=Rf(Pw(t,bd),Aw(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=Cw(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ca(i.x+r.x)/2,y:Ca(i.y+r.y)/2},index:i.segment2}:{point:{x:Ca(i.x),y:Ca(i.y)},index:i.segment2}:null}function ou(e,t){return Tw(e,t)||Mw(e,t)}function au(e,t,n){V.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,p,f,d,h,g=r.outgoing.slice(),_=r.incoming.slice(),R;ue(a.width)?R=se(a):R=a;var x=ou(s,R);if(x){if(c=s.slice(0,x.index),u=s.slice(x.index+(x.bendpoint?1:0)),!c.length||!u.length)return;l=x.bendpoint?s[x.index]:R,(c.length===1||!Ed(r,c[c.length-1]))&&c.push(xd(l)),(u.length===1||!Ed(r,u[0]))&&u.unshift(xd(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||R),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||R),h=o));var E=[].concat(d&&ye(_,function(b){return b.source===d.source})||[],h&&ye(g,function(b){return b.target===h.target})||[]);E.length&&n.removeElements(E)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=se(c),l={x:u.x+s.x,y:u.y+s.y},p=Oe(o.children,function(f){var d=t.canInsert(a,f);return d&&ou(f.waypoints,l)});p&&(r.targetFlow=p,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}X(au,V),au.$inject=["eventBus","bpmnRules","modeling"];function Ed(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function xd(e){return D({},e)}function su(e,t){V.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&ur(r)){var c=[];y(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&ur(u)):c=a.incoming.filter(u=>u!==r&&ur(u)&&y(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(y(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(ur).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(ur).forEach(function(s){const c=a.incoming.filter(ur).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}su.$inject=["eventBus","modeling"],X(su,V);function ur(e){return y(e,"bpmn:SequenceFlow")}var Pa=1500,wd=2e3;function Sd(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],Pa,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;y(a,"bpmn:Lane")&&!ge(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Kt(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||ge(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Pa,function(i){var r=i.hover;y(r,"bpmn:Lane")&&(i.hover=Kt(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Pa,function(i){var r=i.context,o=i.hover,a=r.type;y(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Kt(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Pa,function(i){var r=i.context,o=r.start;y(o,"bpmn:Lane")&&(r.start=Kt(o)||o)}),t.on("shape.move.start",wd,function(i){var r=i.shape;y(r,"bpmn:Lane")&&(i.shape=Kt(r)||r)}),t.on("spaceTool.move",wd,function(i){var r=i.hover;r&&y(r,"bpmn:Lane")&&(i.hover=Kt(r))})}Sd.$inject=["elementRegistry","eventBus","canvas"];var Rd=770;function cu(e,t,n,i){n.invoke(V,this);function r(s,c){var u=G(s),l=c.categoryValue||u.categoryValueRef;l||(l=pd(e,u));var p=c.category||l.$parent||ld(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=G(s),l=c.categoryValue||u.categoryValueRef,p=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=p,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;y(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;y(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=G(u);if(!(!y(u,"bpmn:Group")||u.labelTarget)){var p=c.categoryValue=l.categoryValueRef;p&&(c.category=p.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!y(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=G(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!y(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!G(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!y(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!G(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||G(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",Rd,function(s){var c=s.descriptor,u=s.element;if(!(!y(u,"bpmn:Group")||u.labelTarget)){var l=G(u);if(l.categoryValueRef){var p=l.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",Rd,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,p=c.category;l&&(l=u.categoryValueRef=a(l)),p&&(l.$parent=a(p)),delete c.category,delete c.categoryValue})}cu.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],X(cu,V);function uu(e,t,n,i){var r,o,a,s,c;return r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),r==0?null:(o=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*o-(i.y-n.y)*a,s=c/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Cd(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=uu(i,r,o,a),u=uu(i,r,o,s),l;c&&u?Pd(c,o)>Pd(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],se(i.source)),t(r[r.length-1],r[r.length-2],se(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Cd.$inject=["eventBus"];function Pd(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function lu(e){V.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,r=G(i),o=we(i);if(ge(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}lu.$inject=["eventBus"],X(lu,V);function Ad(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Td(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function kw(e,t){return t?{x:Math.cos(t)*e.x-Math.sin(t)*e.y,y:Math.sin(t)*e.x+Math.cos(t)*e.y}:e}function Dw(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],r=i[0].n*t[0]+i[1].n*t[1],o=i[0].lambda*t[0]+i[1].lambda*t[1];return-r/o}function pu(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=Dw([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function Md(e,t){var n=pu(e,t),i={x:n.x-e.x,y:n.y-e.y};return Ad(i)}function Jr(e,t){return Ad({x:e.x-t.x,y:e.y-t.y})}var kd=Math.sqrt,Dd=Math.min,Ow=Math.max,Od=Math.abs;function Id(e){return Math.pow(e,2)}function eo(e,t){return kd(Id(e.x-t.x)+Id(e.y-t.y))}function Iw(e,t){var n=0,i,r,o,a,s,c,u,l,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Bd(i,r)?u=[i]:(o=eo(e,i),a=eo(e,r),c=Dd(o,a),u=Lw(i,r,e,c)),u.length<1)throw new Error("expected between [1, 2] circle -> line intersections");u.length===1&&(l={type:"bendpoint",position:u[0],segmentIndex:n,bendpointIndex:Bd(i,u[0])?n:n+1}),u.length===2&&(s=Nw(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:eo(i,s)/eo(i,r)}),p=eo(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function Lw(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,p=u/c,f=l/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=kd(d),g=-p+h,_=-p-h,R={x:e.x-r*g,y:e.y-o*g};if(d===0)return[R];var x={x:e.x-r*_,y:e.y-o*_};return[R,x].filter(function(E){return Bw(E,e,t)})}function Bw(e,t,n){return Ld(e.x,t.x,n.x)&&Ld(e.y,t.y,n.y)}function Ld(e,t,n){return e>=Dd(t,n)-Aa&&e<=Ow(t,n)+Aa}function Nw(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Aa=.1;function Bd(e,t){return Od(e.x-t.x)<=Aa&&Od(e.y-t.y)<=Aa}function $w(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var p=$d(t,u);p<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Nd(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=Iw(e,n),c=s.segmentIndex,u=$w(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=jd(n,c),p=jd(t,u),f=s.position,d=Fw(l,f),h=jw(l,p);if(s.type==="bendpoint"){var g=t.length-n.length,_=s.bendpointIndex,R=n[_];if(t.indexOf(R)!==-1)return a;if(g===0){var x=t[_];return r=x.x-s.position.x,o=x.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}g<0&&_!==0&&_<n.length-1&&(d=$d(n,_))}var E={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},b=kw({x:e.x-f.x,y:e.y-f.y},h);return r=E.x+b.x-e.x,o=E.y+b.y-e.y,{point:On(E),delta:On({x:r,y:o})}}function $d(e,t){var n=Jr(e[t-1],e[t]),i=Jr(e[t],e[t+1]),r=n/(n+i);return r}function jw(e,t){var n=Td(e),i=Td(t);return i-n}function jd(e,t){return[e[t],e[t+1]]}function Fw(e,t){var n=Jr(e[0],e[1]),i=Jr(e[0],t);return n===0?0:i/n}function Hw(e,t,n,i){var r=se(e);return Nd(r,t,n,i).delta}function to(e,t,n){var i=Xr(t),r=Xr(n),o=an(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return On({x:r.x+a.x,y:r.y+a.y})}function Fd(e,t,n){var i=Xr(e),r=Xr(t),o=Xr(n),a=an(e,i),s=an(i,r),c=zw(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return On({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function zw(e,t,n){var i=ie(t),r=ie(n);if(Vw(i,r))return null;var o=ut(t,e),a,s,c;if(o==="top")a={x:0,y:r.bottom-i.bottom};else if(o==="bottom")a={x:0,y:r.top-i.top};else if(o==="right")a={x:r.left-i.left,y:0};else if(o==="left")a={x:r.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=ut(n,s),c!==o?null:a}function Vw(e,t){return Gw(e,t)||Ww(e,t)}function Gw(e,t){return e.right!==t.right&&e.left!==t.left}function Ww(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Hd="name",zd="text";function fu(e,t,n,i){V.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{G(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(Hd in u&&t.updateLabel(c,u[Hd]),zd in u&&y(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[zd]||"");t.updateLabel(c,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;he(u)||!ri(u)||Vt(u)&&t.updateLabel(u,Vt(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=D({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),Hw(u,p,f,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,p;!l||!l.parent||(p=o(a),t.moveShape(l,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=G(c);l&&ri(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!he(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(Vt(c)||"",{box:l,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=l.y!==c.y,h=c.y+c.height;s.newBounds={width:l.width,height:f,x:l.x,y:d?h-f:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(pa(c)){var p=c.label,f=se(p),d=Yw(l),h=qw(f,d),g=Uw(h,l,u);t.moveShape(p,g)}})}X(fu,V),fu.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function Uw(e,t,n){var i=to(e,t,n);return On(an(i,e))}function qw(e,t){if(t.length){var n=Kw(e,t);return pu(e,n)}}function Yw(e){return[[{x:e.x,y:e.y},{x:e.x+(e.width||0),y:e.y}],[{x:e.x+(e.width||0),y:e.y},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y+(e.height||0)},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y},{x:e.x,y:e.y+(e.height||0)}]]}function Kw(e,t){var n=t.map(function(r){return{line:r,distance:Md(e,r)}}),i=ln(n,"distance");return i[0].line}function Xw(e,t,n,i){return Nd(e,t,n,i).point}function du(e,t){V.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=D({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),Xw(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),p=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,p)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),p=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],p={x:l.x+c.x,y:l.y+c.y},f=[].concat(u.waypoints.slice(0,-1),[p]);t.updateWaypoints(u,f)}),a.forEach(function(u){var l=u.waypoints[0],p={x:l.x+c.x,y:l.y+c.y},f=[].concat([p],u.waypoints.slice(1));t.updateWaypoints(u,f)})})}X(du,V),du.$inject=["eventBus","modeling"];function Ta(e,t,n){var i=ka(e),r=Gd(i,t),o=i[0];return r.length?r[r.length-1]:to(o.original||o,n,t)}function Ma(e,t,n){var i=ka(e),r=Gd(i,t),o=i[i.length-1];return r.length?r[0]:to(o.original||o,n,t)}function hu(e,t,n){var i=ka(e),r=Vd(t,n),o=i[0];return to(o.original||o,r,t)}function mu(e,t,n){var i=ka(e),r=Vd(t,n),o=i[i.length-1];return to(o.original||o,r,t)}function Vd(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ka(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Gd(e,t){var n=vt(e,Qw);return ye(n,function(i){return Zw(i,t)})}function Zw(e,t){return ut(t,e,1)==="intersect"}function Qw(e){return e.original||e}function gu(e,t){V.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(Jw(i,r)){var o=e1(i);o.incoming.forEach(function(a){var s=Ma(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Ta(a,r,i);t.reconnectStart(a,r,s)})}},!0)}gu.$inject=["eventBus","modeling"],X(gu,V);function Jw(e,t){return y(e,"bpmn:Participant")&&Ee(e)&&y(t,"bpmn:Participant")&&!Ee(t)}function e1(e){var t=Fr([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){y(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){y(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const t1=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Wd(e){const t=G(e);if(!y(t,"bpmn:BoundaryEvent")&&!(y(t,"bpmn:StartEvent")&&Et(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:t1.some(i=>y(n[0],i))}function Ud(e){return y(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function vu(e,t){e.invoke(V,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Wd(r))return;const a=Ud(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=G(i).get(a),u=G(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}vu.$inject=["injector","modeling"],X(vu,V);function yu(e,t){V.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=we(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}X(yu,V),yu.$inject=["eventBus","modeling"];function _u(e,t,n){V.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!y(o,"bpmn:SequenceFlow")||!y(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=n1(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}X(_u,V),_u.$inject=["eventBus","bpmnRules","modeling"];function lr(e){return e.original||e}function n1(e,t){var n=uu(lr(e[e.length-2]),lr(e[e.length-1]),lr(t[1]),lr(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[lr(e[0]),lr(t[t.length-1])]}function bu(e,t){V.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;y(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}bu.$inject=["eventBus","modeling"],X(bu,V);function Eu(e,t,n,i){V.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,p=c.parent;if(p){var f,d;y(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),y(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(u,l,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,p=u.newSource||l.source,f=u.newTarget||l.target,d,h;d=n.canConnect(p,f),!(!d||d.type===l.type)&&(h=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=h,r&&s(l,h))}function s(c,u){var l=r.context(),p=l&&l.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;A(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,p=u.element,f=p.businessObject,d;l.default&&(d=Oe(p.outgoing,Zi({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}X(Eu,V),Eu.$inject=["eventBus","modeling","bpmnRules","injector"];function Da(e,t,n,i,r,o){i.invoke(V,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=kt(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];A(s.closure.topLevel,function(f){Et(f)?l=l.concat(f.children):l=l.concat(f)}),l.length===1&&u&&(c=u);var p=t.canReplace(l,c);p&&this._replaceElements(l,p.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,p;l&&l.length&&(p=t.canReplace(l,u),this._replaceElements(l,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}X(Da,V),Da.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;A(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},Da.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var i1=1500,r1={width:140,height:120},xu={width:300,height:60},wu={width:60,height:300},Oa={width:300,height:150},Ia={width:150,height:300},qd={width:140,height:120},Yd={width:100,height:40};function Kd(e){e.on("resize.start",i1,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(y(i,"bpmn:Lane")||y(i,"bpmn:Participant"))&&(n.resizeConstraints=u1(i,r,o)),y(i,"bpmn:SubProcess")&&Ee(i)&&(n.minDimensions=qd),y(i,"bpmn:TextAnnotation")&&(n.minDimensions=Yd)})}Kd.$inject=["eventBus"];var si=Math.abs,o1=Math.min,a1=Math.max;function Xd(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function pr(e,t,n){return Xd(e,t,n,o1)}function fr(e,t,n){return Xd(e,t,n,a1)}var s1={top:20,left:50,right:20,bottom:20},c1={top:50,left:20,right:20,bottom:20};function u1(e,t,n){var i=Kt(e),r=!0,o=!0,a=Sa(i,[i]),s=ie(e),c={},u={},l=at(e),p=l?xu:wu;/n/.test(t)?u.top=s.bottom-p.height:/e/.test(t)?u.right=s.left+p.width:/s/.test(t)?u.bottom=s.top+p.height:/w/.test(t)&&(u.left=s.right-p.width),a.forEach(function(h){var g=ie(h);l?(g.top<s.top-10&&(r=!1),g.bottom>s.bottom+10&&(o=!1)):(g.left<s.left-10&&(r=!1),g.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&si(s.top-g.bottom)<10&&fr(c,"top",g.top+p.height),si(s.top-g.top)<5&&pr(u,"top",g.bottom-p.height)),/e/.test(t)&&(n&&si(s.right-g.left)<10&&pr(c,"right",g.right-p.width),si(s.right-g.right)<5&&fr(u,"right",g.left+p.width)),/s/.test(t)&&(n&&si(s.bottom-g.top)<10&&pr(c,"bottom",g.bottom-p.height),si(s.bottom-g.bottom)<5&&fr(u,"bottom",g.top+p.height)),/w/.test(t)&&(n&&si(s.left-g.right)<10&&fr(c,"left",g.left+p.width),si(s.left-g.left)<5&&pr(u,"left",g.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(y(h,"bpmn:FlowElement")||y(h,"bpmn:Artifact"))}),d=l?s1:c1;return f.forEach(function(h){var g=ie(h);/n/.test(t)&&(!l||r)&&pr(u,"top",g.top-d.top),/e/.test(t)&&(l||o)&&fr(u,"right",g.right+d.right),/s/.test(t)&&(!l||o)&&fr(u,"bottom",g.bottom+d.bottom),/w/.test(t)&&(l||r)&&pr(u,"left",g.left-d.left)}),{min:u,max:c}}function Zd(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function dr(e){return e.originalEvent||e.srcEvent}function Su(e){Zd(e),Zd(dr(e))}function Bi(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function Qd(){return/mac/i.test(navigator.platform)}function Jd(e,t){return(dr(e)||e).button===t}function ci(e){return Jd(e,0)}function l1(e){return Jd(e,1)}function no(e){var t=dr(e)||e;return ci(e)?Qd()?t.metaKey:t.ctrlKey:!1}function La(e){var t=dr(e)||e;return ci(e)&&t.shiftKey}var eh=1001;function th(e,t){e.on("resize.start",eh+500,function(n){var i=n.context,r=i.shape;(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))&&(i.balanced=!no(n))}),e.on("resize.end",eh,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))return o&&(a=Mf(a),t.resizeLane(r,a,i.balanced)),!1})}th.$inject=["eventBus","modeling"];var p1=500;function Ru(e,t,n,i,r){n.invoke(V,this);function o(l){return ge(l,["bpmn:ReceiveTask","bpmn:SendTask"])||f1(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!Oe(f,Zi({id:l.id}))}function s(l){if(y(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(y(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(y(l,"bpmn:MessageEventDefinition"))return"messageRef";if(y(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(ge(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var p=l.get("eventDefinitions"),f=p[0];return f.get(s(f))}function u(l,p){if(ge(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",p);var f=l.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.shape||l.element;if(o(p)){var f=G(p),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),Ge(h,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");ze(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=G(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",p1,function(l){var p=l.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(f,d),delete p.referencedRootElement)})}Ru.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],X(Ru,V);function f1(e,t){return ae(t)||(t=[t]),qn(t,function(n){return rr(e,n)})}var nh=Math.max;function ih(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return A(n,function(a){var s=a.id;y(a,"bpmn:Participant")&&(o[s]=h1(a,i,r)),y(a,"bpmn:Lane")&&(o[s]=at(a)?xu:wu),y(a,"bpmn:SubProcess")&&Ee(a)&&(o[s]=qd),y(a,"bpmn:TextAnnotation")&&(o[s]=Yd),y(a,"bpmn:Group")&&(o[s]=r1)}),o})}ih.$inject=["eventBus"];function d1(e){return e==="x"}function h1(e,t,n){var i=at(e);if(!v1(e))return i?Oa:Ia;var r=d1(t),o={};return r?i?o=Oa:o={width:g1(e,n,r),height:Ia.height}:i?o={width:Oa.width,height:m1(e,n,r)}:o=Ia,o}function m1(e,t,n){var i;return i=y1(e,t,n),nh(Oa.height,i)}function g1(e,t,n){var i;return i=_1(e,t,n),nh(Ia.width,i)}function v1(e){return!!ai(e).length}function y1(e,t,n){var i=ai(e),r;return r=Cu(i,t,n),e.height-r.height+xu.height}function _1(e,t,n){var i=ai(e),r;return r=Cu(i,t,n),e.width-r.width+wu.width}function Cu(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=ai(r),o.length?Cu(o,t,n):r}var rh="_plane";function oh(e){var t=e.id;return b1(t)}function bn(e){var t=e.id;return y(e,"bpmn:SubProcess")?ah(t):t}function Ni(e){return ah(e)}function Ba(e){var t=we(e);return y(t,"bpmndi:BPMNPlane")}function ah(e){return e+rh}function b1(e){return e.replace(new RegExp(rh+"$"),"")}var sh=400,E1=600,ch={x:180,y:160};function Nn(e,t,n,i,r,o,a){V.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return y(p,"bpmn:SubProcess")&&!Ee(p)}function u(p){var f=p.shape,d=p.newRootElement,h=G(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=G(f);s._removeDiagram(d);var h=p.newRootElement=a.get(bn(d));e.removeRootElement(h)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;A(f,function(d){if(c(d)){var h=a.get(bn(d));if(!(!h||!d.children||!d.children.length)){var g=uh(d);s._showRecursively(g),s._moveChildrenToShape(g,h)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!y(f,"bpmn:SubProcess")||!Ee(f)||A(Ur([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(bn(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(bn(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(bn(f));if(!(!d||!h)){var g=d.children;n.moveElements(g,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(y(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,g=h.id,_=d.id;if(g!==_){if(Ba(f)){a.updateId(f,Ni(_)),a.updateId(g,_);return}var R=a.get(Ni(g));R&&a.updateId(Ni(g),Ni(_))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(y(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,g=h.id,_=d.id;if(g!==_){if(Ba(f)){a.updateId(f,Ni(g)),a.updateId(_,g);return}var R=a.get(Ni(_));R&&a.updateId(R,Ni(g))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Ba(f)){var d=f,h=a.get(oh(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",sh,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Ee(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",sh,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Ee(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",E1,function(p){var f=p.shape;if(y(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Ee(f))s._moveChildrenToShape(d.children.slice(),f),A(Ur(f.children),g=>{n.moveShape(g.annotation,{x:0,y:0},f.parent),A(g.associations,_=>{n.moveConnection(_,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=uh(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=bn(f),g=a.get(h);g&&d.push.apply(d,g.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,h=p.elements,g=d.parent,_=y(we(g),"bpmndi:BPMNPlane");if(_){var R=oh(g),x=Oe(h,function(E){return E.id===R});x&&(f.parent=x.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}X(Nn,V),Nn.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=Ue(i),o;if(!t.x)o={x:ch.x-r.x,y:ch.y-r.y};else{var a=se(t),s=se(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Nn.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Jf(e).map(i=>i.annotation));n.size&&A(Ur(e.children),i=>{n.has(i.annotation)&&A(i.associations,r=>{t.removeConnection(r)})})},Nn.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},Nn.prototype._addDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),n.push(e.di.$parent),e},Nn.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:bn(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Nn.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=Oe(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Nn.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function x1(e){var t=[];return A(Ur(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function uh(e){return e.children.slice().concat(x1(e.children)).concat(w1(e))}function w1(e){return kc(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Pu(e,t){e.invoke(V,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!y(r,"bpmn:SubProcess")||y(r,"bpmn:AdHocSubProcess")||!(y(i,"bpmn:Task")||y(i,"bpmn:CallActivity"))||!Ee(r))){var o=S1(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Pu.$inject=["injector","modeling"],X(Pu,V);function S1(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Au(e,t){V.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;y(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&y(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!y(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,Vt(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}X(Au,V),Au.$inject=["eventBus","textRenderer"];function Tu(e,t){V.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Ee(i))return;var r=Fr(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();A(s,function(u){o(u,!0)}),A(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||y(a,"bpmn:Association")&&(y(a.source,"bpmn:TextAnnotation")||y(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,se(i)):t.reconnectStart(a,i,se(i)))}},!0)}X(Tu,V),Tu.$inject=["eventBus","modeling"];var Mu=500;function ku(e,t,n){V.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,p;return l=R1(c).concat([a]),p=vd(l),p?(u.width=Math.max(p.width,u.width),u.height=Math.max(p.height,u.height),u.x=p.x+(p.width-u.width)/2,u.y=p.y+(p.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],Mu,function(a){var s=a.context,c=s.shape;y(c,"bpmn:SubProcess")&&(c.collapsed?we(c).isExpanded=!1:(i(c.children),we(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Mu,function(a){var s=a.context,c=s.shape;c.collapsed?we(c).isExpanded=!1:we(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Mu,function(a){var s=a.context.shape,c=t.getDefaultSize(s),u;s.collapsed?u=o(s,c):u=r(s,c),n.resizeShape(s,u,null,{autoResize:s.collapsed?!1:"nwse"})})}X(ku,V),ku.$inject=["eventBus","elementFactory","modeling"];function R1(e){return e.filter(function(t){return!t.hidden})}function Du(e,t,n,i){t.invoke(V,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;he(a)||(y(a,"bpmn:Participant")&&Ee(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;y(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}X(Du,V),Du.$inject=["canvas","injector","moddle","modeling"];function Ou(e,t){V.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;C1(r,o)&&t.updateProperties(o,{default:null})})}X(Ou,V),Ou.$inject=["eventBus","modeling"];function C1(e,t){if(!y(e,"bpmn:SequenceFlow"))return!1;var n=G(t),i=G(e);return n.get("default")===i}var P1=500,A1=5e3,lh=["shape.create","shape.delete","shape.move","shape.resize"],ph=[...lh,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Iu(e,t){V.call(this,e);var n;function i(){return n=n||new T1,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(ph,A1,function(){i()}),this.postExecuted(ph,P1,function(){o()}),this.preExecute(lh,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(y(c,"bpmn:Lane")&&u.addLane(c),y(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}Iu.$inject=["eventBus","modeling"],X(Iu,V);function T1(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}var M1=500,k1=5e3,fh=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],dh=[...fh,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Lu(e,t){V.call(this,e);var n;function i(){return n=n||new D1,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(dh,k1,function(){i()}),this.postExecuted(dh,M1,function(){o()}),this.preExecute(fh,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(y(s,"bpmn:FlowElement")&&c.addFlowElement(s),y(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;y(s,"bpmn:Group")&&r().addGroup(s)})}Lu.$inject=["eventBus","modeling"],X(Lu,V);function D1(){this.affectedFlowElements=new Set,this.affectedGroupEntries=new Map,this.counter=0,this.addFlowElement=function(e){this.affectedFlowElements.add(e)},this.addGroup=function(e){this.affectedGroupEntries.has(e)||this.affectedGroupEntries.set(e,{categoryValue:e.businessObject.categoryValueRef,groupShape:e})},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function Bu(e,t){V.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)O1(o)&&!L1(o)&&t.updateProperties(o,{isForCompensation:void 0})})}X(Bu,V),Bu.$inject=["eventBus","modeling"];function O1(e){const t=G(e);return t&&t.isForCompensation}function I1(e){return e&&y(e,"bpmn:BoundaryEvent")&&rr(e,"bpmn:CompensateEventDefinition")}function L1(e){return e.incoming.filter(n=>I1(n.source)).length>0}const B1={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","artifactBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","categoryRootElementReferenceBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","updateCategoryValueRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",Gc],appendBehavior:["type",Wc],associationBehavior:["type",qc],attachEventBehavior:["type",va],artifactBehavior:["type",Uc],boundaryEventBehavior:["type",Yc],categoryRootElementReferenceBehavior:["type",Kc],compensateBoundaryEventBehaviour:["type",Xc],createBehavior:["type",Zc],createDataObjectBehavior:["type",Qc],createParticipantBehavior:["type",tu],dataInputAssociationBehavior:["type",nu],dataStoreBehavior:["type",iu],deleteLaneBehavior:["type",ru],detachEventBehavior:["type",Ra],dropOnFlowBehavior:["type",au],eventBasedGatewayBehavior:["type",su],fixHoverBehavior:["type",Sd],groupBehavior:["type",cu],importDockingFix:["type",Cd],isHorizontalFix:["type",lu],labelBehavior:["type",fu],layoutConnectionBehavior:["type",du],messageFlowBehavior:["type",gu],nonInterruptingBehavior:["type",vu],removeElementBehavior:["type",_u],removeEmbeddedLabelBoundsBehavior:["type",yu],removeParticipantBehavior:["type",bu],replaceConnectionBehavior:["type",Eu],replaceElementBehaviour:["type",Da],resizeBehavior:["type",Kd],resizeLaneBehavior:["type",th],rootElementReferenceBehavior:["type",Ru],spaceToolBehavior:["type",ih],subProcessPlaneBehavior:["type",Nn],subProcessStartEventBehavior:["type",Pu],textAnnotationBehavior:["type",Au],toggleCollapseConnectionBehaviour:["type",Tu],toggleElementCollapseBehaviour:["type",ku],unclaimIdBehavior:["type",Du],unsetDefaultFlowBehavior:["type",Ou],updateFlowNodeRefsBehavior:["type",Iu],updateCategoryValueRefsBehavior:["type",Lu],setCompensationActivityAfterPasteBehavior:["type",Bu]};function Nu(e){this._commandStack=e.get("commandStack",!1)}Nu.$inject=["injector"],Nu.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const En={__init__:["rules"],rules:["type",Nu]};function Xt(e){V.call(this,e),this.init()}Xt.$inject=["eventBus"],X(Xt,V),Xt.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,s){return n(o)},!0)})},Xt.prototype.init=function(){};function hh(e,t){var n=ut(e,t,-15);return n!=="intersect"?n:null}function pt(e){Xt.call(this,e)}X(pt,Xt),pt.$inject=["eventBus"],pt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return N1(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return $a(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return $a(n,i,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,i=e.direction;return Ph(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Te(i)&&!ja(t,i)?!1:Ci(t,function(r){return Te(r)?$a(r.source,r.target,r):r.host?io(r,r.host,null,n):Hu(r,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,r=e.hints;return r!=null&&r.keyboardMove&&n.some(function(a){return Eh(a)&&!n.includes(a.host)})?!1:io(n,t,null,i)||Rh(n,t,i)||Ch(n,t)||ja(n,t)}),this.addRule("shape.create",function(e){return Hu(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return io(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Dh(n,t)})},pt.prototype.canConnectMessageFlow=Mh,pt.prototype.canConnectSequenceFlow=kh,pt.prototype.canConnectDataAssociation=zu,pt.prototype.canConnectAssociation=Ah,pt.prototype.canConnectCompensationAssociation=Th,pt.prototype.canMove=Ch,pt.prototype.canAttach=io,pt.prototype.canReplace=Rh,pt.prototype.canDrop=hr,pt.prototype.canInsert=ja,pt.prototype.canCreate=Hu,pt.prototype.canConnect=$a,pt.prototype.canResize=Ph,pt.prototype.canCopy=Dh;function N1(e){return $u(e)?null:ge(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function $u(e){return!e||he(e)}function mh(e){do{if(y(e,"bpmn:Process"))return G(e);if(y(e,"bpmn:Participant"))return G(e).processRef||G(e)}while(e=e.parent)}function ju(e){return y(e,"bpmn:TextAnnotation")}function Fu(e){return y(e,"bpmn:Group")&&!e.labelTarget}function gh(e){return y(e,"bpmn:BoundaryEvent")&&xn(e,"bpmn:CompensateEventDefinition")}function Na(e){return G(e).isForCompensation}function $1(e,t){var n=mh(e),i=mh(t);return n===i}function j1(e){return y(e,"bpmn:InteractionNode")&&!y(e,"bpmn:BoundaryEvent")&&(!y(e,"bpmn:Event")||y(e,"bpmn:ThrowEvent")&&_h(e,"bpmn:MessageEventDefinition"))}function F1(e){return y(e,"bpmn:InteractionNode")&&!Na(e)&&(!y(e,"bpmn:Event")||y(e,"bpmn:CatchEvent")&&_h(e,"bpmn:MessageEventDefinition"))&&!(y(e,"bpmn:BoundaryEvent")&&!xn(e,"bpmn:MessageEventDefinition"))}function vh(e){for(var t=e;t=t.parent;){if(y(t,"bpmn:FlowElementsContainer"))return G(t);if(y(t,"bpmn:Participant"))return G(t).processRef}return null}function yh(e,t){var n=vh(e),i=vh(t);return n===i}function xn(e,t){var n=G(e);return!!Oe(n.eventDefinitions||[],function(i){return y(i,t)})}function _h(e,t){var n=G(e);return(n.eventDefinitions||[]).every(function(i){return y(i,t)})}function H1(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:EndEvent")&&!Et(e)&&!(y(e,"bpmn:IntermediateThrowEvent")&&xn(e,"bpmn:LinkEventDefinition"))&&!gh(e)&&!Na(e)}function z1(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:StartEvent")&&!y(e,"bpmn:BoundaryEvent")&&!Et(e)&&!(y(e,"bpmn:IntermediateCatchEvent")&&xn(e,"bpmn:LinkEventDefinition"))&&!Na(e)}function V1(e){return y(e,"bpmn:ReceiveTask")||y(e,"bpmn:IntermediateCatchEvent")&&(xn(e,"bpmn:MessageEventDefinition")||xn(e,"bpmn:TimerEventDefinition")||xn(e,"bpmn:ConditionalEventDefinition")||xn(e,"bpmn:SignalEventDefinition"))}function G1(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function bh(e,t){var n=G1(t);return n.indexOf(e)!==-1}function $a(e,t,n){if($u(e)||$u(t))return null;if(!y(n,"bpmn:DataAssociation")){if(Mh(e,t))return{type:"bpmn:MessageFlow"};if(kh(e,t))return{type:"bpmn:SequenceFlow"}}var i=zu(e,t);return i||(Th(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Ah(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function hr(e,t){return he(e)||Fu(e)?!0:y(t,"bpmn:Participant")&&!Ee(t)?!1:y(e,"bpmn:Participant")?y(t,"bpmn:Process")||y(t,"bpmn:Collaboration"):ge(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:y(e,"bpmn:Lane")?y(t,"bpmn:Participant")||y(t,"bpmn:Lane"):y(e,"bpmn:BoundaryEvent")&&!W1(e)?!1:y(e,"bpmn:FlowElement")&&!y(e,"bpmn:DataStoreReference")?y(t,"bpmn:FlowElementsContainer")?Ee(t):ge(t,["bpmn:Participant","bpmn:Lane"]):y(e,"bpmn:DataStoreReference")&&y(t,"bpmn:Collaboration")?qn(G(t).get("participants"),function(n){return!!n.get("processRef")}):ge(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ge(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):y(e,"bpmn:MessageFlow")?y(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function W1(e){return G(e).cancelActivity&&(xh(e)||wh(e))}function Eh(e){return!he(e)&&y(e,"bpmn:BoundaryEvent")}function U1(e){return y(e,"bpmn:Lane")}function q1(e){return Eh(e)||y(e,"bpmn:IntermediateThrowEvent")&&xh(e)?!0:y(e,"bpmn:IntermediateCatchEvent")&&wh(e)}function xh(e){var t=G(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function wh(e){return Sh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Sh(e,t){return t.some(function(n){return xn(e,n)})}function Y1(e){return y(e,"bpmn:ReceiveTask")&&Oe(e.incoming,function(t){return y(t.source,"bpmn:EventBasedGateway")})}function io(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return he(r)||!q1(r)||Et(t)||!y(t,"bpmn:Activity")||Na(t)||i&&!hh(i,t)||Y1(t)?!1:"attach"}function Rh(e,t,n){if(!t)return!1;var i={replacements:[]};return A(e,function(r){Et(t)||y(r,"bpmn:StartEvent")&&r.type!=="label"&&hr(r,t)&&(ix(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(rx(r)||ox(r)||ax(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Sh(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&y(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),y(t,"bpmn:Transaction")||xn(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(y(r,"bpmn:EndEvent")&&hr(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),y(r,"bpmn:BoundaryEvent")&&io(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Ch(e,t){return qn(e,U1)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return hr(n,t)})}function Hu(e,t,n,i){return t?he(e)||Fu(e)?!0:hr(e,t)||ja(e,t):!1}function Ph(e,t,n){return y(e,"bpmn:SubProcess")?Ee(e)&&(!t||t.width>=100&&t.height>=80):y(e,"bpmn:Lane")||y(e,"bpmn:Participant")?!0:ju(e)?n?n==="e"||n==="w":!0:Fu(e)?!0:he(e)?n?n==="e"||n==="w":!0:!1}function K1(e,t){var n=ju(e),i=ju(t);return(n||i)&&n!==i}function Ah(e,t){return bh(t,e)||bh(e,t)?!1:K1(e,t)?!0:!!zu(e,t)}function Th(e,t){return yh(e,t)&&gh(e)&&y(t,"bpmn:Activity")&&!Z1(t,e)&&!Et(t)}function Mh(e,t){return Ih(e)&&!Ih(t)?!1:j1(e)&&F1(t)&&!$1(e,t)}function kh(e,t){return H1(e)&&z1(t)&&yh(e,t)&&!(y(e,"bpmn:EventBasedGateway")&&!V1(t))}function zu(e,t){return ge(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ge(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:ge(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ge(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function ja(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:ge(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!he(t)&&y(e,"bpmn:FlowNode")&&!y(e,"bpmn:BoundaryEvent")&&hr(e,t.parent)}function Vu(e,t){return e&&t&&e.indexOf(t)!==-1}function Dh(e,t){return he(t)?!0:!(y(t,"bpmn:Lane")&&!Vu(e,t.parent)||y(t,"bpmn:MessageFlow")&&!X1(e,t))}function X1(e,t){var n=Oh(t.source),i=Oh(t.target);return Vu(e,n)&&Vu(e,i)}function Oh(e){for(;e;e=e.parent)if(y(e,"bpmn:Participant"))return e;return null}function Ih(e){return sr(e,"bpmn:Process")||sr(e,"bpmn:Collaboration")}function Z1(e,t){return e.attachers.includes(t)}const Q1={__depends__:[En],__init__:["bpmnRules"],bpmnRules:["type",pt]};var J1=2e3;function Lh(e,t){e.on("saveXML.start",J1,n);function n(){var i=t.getRootElements();A(i,function(r){var o=we(r),a,s;a=Fr([r]),a=ye(a,function(c){return c!==r&&!c.labelTarget}),s=vt(a,we),o.set("planeElement",s)})}}Lh.$inject=["eventBus","canvas"];const eS={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Lh]};function Fa(e){V.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}Fa.prototype.getOrdering=function(e,t){return null},X(Fa,V);function Gu(e,t){Fa.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=Oe(n,function(c){return ge(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!ge(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||y(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=Cp(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}Gu.$inject=["eventBus","canvas"],X(Gu,Fa);const tS={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Gu]};function ro(){}ro.prototype.get=function(){return this._data},ro.prototype.set=function(e){this._data=e},ro.prototype.clear=function(){var e=this._data;return delete this._data,e},ro.prototype.isEmpty=function(){return!this._data};const nS={clipboard:["type",ro]};var Bh=1500;function Nh(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),u=c&&e.get(c);c&&u&&(a.stopPropagation(),r.hover({element:u,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",Bh,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Bh,function(c){s&&t.fire("element.out",{element:s,gfx:a})}),t.on("element.out",function(){a=null,s=null})})(),this._findTargetGfx=function(a){var s,c;if(a instanceof MouseEvent)return s=Bi(a),c=document.elementFromPoint(s.x,s.y),iS(c)}}Nh.$inject=["elementRegistry","eventBus","injector"];function iS(e){return Mi(e,"svg, .djs-element",!0)}const rS={__init__:["hoverFix"],hoverFix:["type",Nh]};function oS(e){return!0}function Ha(e){return ci(e)||l1(e)}var $h=500;function jh(e,t,n){var i=this;function r(C,F,N){if(!s(C,F)){var I,W,re;N?W=t.getGraphics(N):(I=F.delegateTarget||F.target,I&&(W=I,N=t.get(W))),!(!W||!N)&&(re=e.fire(C,{element:N,gfx:W,originalEvent:F}),re===!1&&(F.stopPropagation(),F.preventDefault()))}}var o={};function a(C){return o[C]}function s(C,F){var N=u[C]||ci;return!N(F)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},u={"element.contextmenu":oS,"element.mousedown":Ha,"element.mouseup":Ha,"element.click":Ha,"element.dblclick":Ha};function l(C,F,N){var I=c[C];if(!I)throw new Error("unmapped DOM event name <"+C+">");return r(I,F,N)}var p="svg, .djs-element";function f(C,F,N,I){var W=o[N]=function(re){r(N,re)};I&&(u[N]=I),W.$delegate=Dt.bind(C,p,F,W)}function d(C,F,N){var I=a(N);I&&Dt.unbind(C,F,I.$delegate)}function h(C){A(c,function(F,N){f(C,N,F)})}function g(C){A(c,function(F,N){d(C,N,F)})}e.on("canvas.destroy",function(C){g(C.svg)}),e.on("canvas.init",function(C){h(C.svg)}),e.on(["shape.added","connection.added"],function(C){var F=C.element,N=C.gfx;e.fire("interactionEvents.createHit",{element:F,gfx:N})}),e.on(["shape.changed","connection.changed"],$h,function(C){var F=C.element,N=C.gfx;e.fire("interactionEvents.updateHit",{element:F,gfx:N})}),e.on("interactionEvents.createHit",$h,function(C){var F=C.element,N=C.gfx;i.createDefaultHit(F,N)}),e.on("interactionEvents.updateHit",function(C){var F=C.element,N=C.gfx;i.updateDefaultHit(F,N)});var _=S("djs-hit djs-hit-stroke"),R=S("djs-hit djs-hit-click-stroke"),x=S("djs-hit djs-hit-all"),E=S("djs-hit djs-hit-no-move"),b={all:x,"click-stroke":R,stroke:_,"no-move":E};function S(C,F){return F=D({stroke:"white",strokeWidth:15},F||{}),n.cls(C,["no-fill","no-border"],F)}function T(C,F){var N=b[F];if(!N)throw new Error("invalid hit type <"+F+">");return Z(C,N),C}function O(C,F){pe(C,F)}this.removeHits=function(C){var F=Qo(".djs-hit",C);A(F,tt)},this.createDefaultHit=function(C,F){var N=C.waypoints,I=C.isFrame,W;return N?this.createWaypointsHit(F,N):(W=I?"stroke":"all",this.createBoxHit(F,W,{width:C.width,height:C.height}))},this.createWaypointsHit=function(C,F){var N=jr(F);return T(N,"stroke"),O(C,N),N},this.createBoxHit=function(C,F,N){N=D({x:0,y:0},N);var I=te("rect");return T(I,F),Z(I,N),O(C,I),I},this.updateDefaultHit=function(C,F){var N=Ae(".djs-hit",F);if(N)return C.waypoints?Mc(N,C.waypoints):Z(N,{width:C.width,height:C.height}),N},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}jh.$inject=["eventBus","elementRegistry","styles"];const za={__init__:["interactionEvents"],interactionEvents:["type",jh]};function mr(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var r=i.element;n.deselect(r)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}mr.$inject=["eventBus","canvas"],mr.prototype.deselect=function(e){if(this._selectedElements.has(e)){var t=this.get();this._selectedElements.delete(e),this._eventBus.fire("selection.changed",{oldSelection:t,newSelection:this.get()})}},mr.prototype.get=function(){return Array.from(this._selectedElements)},mr.prototype.isSelected=function(e){return this._selectedElements.has(e)},mr.prototype.select=function(e,t){var n=this.get();ae(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?A(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Fh="hover",Hh="selected";function zh(e,t){this._canvas=e;function n(r,o){e.addMarker(r,o)}function i(r,o){e.removeMarker(r,o)}t.on("element.hover",function(r){n(r.element,Fh)}),t.on("element.out",function(r){i(r.element,Fh)}),t.on("selection.changed",function(r){function o(u){i(u,Hh)}function a(u){n(u,Hh)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let u of s)c.has(u)||o(u);for(let u of c)s.has(u)||a(u)})}zh.$inject=["canvas","eventBus"];function Vh(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;ae(u)?t.select(u):t.select(s.filter(aS))}}),e.on("connect.end",500,function(r){var o=r.context,a=o.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(r){var o=r.previousSelection||[],a=i.get(r.context.shape.id),s=Oe(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(ci(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=La(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Vh.$inject=["eventBus","selection","canvas","elementRegistry"];function aS(e){return!e.hidden}const Zt={__init__:["selectionVisuals","selectionBehavior"],__depends__:[za],selection:["type",mr],selectionVisuals:["type",zh],selectionBehavior:["type",Vh]};var sS=/^djs-cursor-.*$/;function Va(e){var t=Be(document.body);t.removeMatching(sS),e&&t.add("djs-cursor-"+e)}function Gh(){Va(null)}var cS=5e3;function Wh(e,t){t=t||"element.click";function n(){return!1}return e.once(t,cS,n),function(){e.off(t,n)}}var uS=["c","C"],lS=["v","V"],pS=["d","D"],fS=["x","X"],dS=["y","Y"],Uh=["z","Z"];function hS(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Lt(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function nt(e,t){return e=ae(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Wu(e){return e.shiftKey}function mS(e){return Lt(e)&&nt(uS,e)}function gS(e){return Lt(e)&&nt(lS,e)}function vS(e){return Lt(e)&&nt(pS,e)}function yS(e){return Lt(e)&&nt(fS,e)}function _S(e){return Lt(e)&&!Wu(e)&&nt(Uh,e)}function bS(e){return Lt(e)&&(nt(dS,e)||nt(Uh,e)&&Wu(e))}var gr=Math.round,qh="djs-drag-active";function $i(e){e.preventDefault()}function ES(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function xS(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Yh(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(E){var b=t.viewbox(),S=t._container.getBoundingClientRect();return{x:b.x+(E.x-S.left)/b.scale,y:b.y+(E.y-S.top)/b.scale}}function s(E,b){b=b||o;var S=e.createEvent(D({},b.payload,b.data,{isTouch:b.isTouch}));return e.fire("drag."+E,S)===!1?!1:e.fire(b.prefix+"."+E,S)}function c(E){var b=E.filter(function(S){return i.get(S.id)});b.length&&n.select(b)}function u(E,b){var S=o.payload,T=o.displacement,O=o.globalStart,C=Bi(E),F=an(C,O),N=o.localStart,I=a(C),W=an(I,N);if(!o.active&&(b||xS(F)>o.threshold)){if(D(S,{x:gr(N.x+T.x),y:gr(N.y+T.y),dx:0,dy:0},{originalEvent:E}),s("start")===!1)return _();o.active=!0,o.keepSelection||(S.previousSelection=n.get(),n.select(null)),o.cursor&&Va(o.cursor),t.addMarker(t.getRootElement(),qh)}Su(E),o.active&&(D(S,{x:gr(I.x+T.x),y:gr(I.y+T.y),dx:gr(W.x),dy:gr(W.y)},{originalEvent:E}),s("move"))}function l(E){var b,S=!0;o.active&&(E&&(o.payload.originalEvent=E,Su(E)),S=s("end")),S===!1&&s("rejected"),b=R(S!==!0),s("ended",b)}function p(E){nt("Escape",E)&&($i(E),_())}function f(E){var b;o.active&&(b=Wh(e),setTimeout(b,400),$i(E)),l(E)}function d(E){u(E)}function h(E){var b=o.payload;b.hoverGfx=E.gfx,b.hover=E.element,s("hover")}function g(E){s("out");var b=o.payload;b.hoverGfx=null,b.hover=null}function _(E){var b;if(o){var S=o.active;S&&s("cancel"),b=R(E),S&&s("canceled",b)}}function R(E){var b,S;s("cleanup"),Gh(),o.trapClick?S=f:S=l,le.unbind(document,"mousemove",u),le.unbind(document,"dragstart",$i),le.unbind(document,"selectstart",$i),le.unbind(document,"mousedown",S,!0),le.unbind(document,"mouseup",S,!0),le.unbind(document,"keyup",p),le.unbind(document,"touchstart",d,!0),le.unbind(document,"touchcancel",_,!0),le.unbind(document,"touchmove",u,!0),le.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",g),t.removeMarker(t.getRootElement(),qh);var T=o.payload.previousSelection;return E!==!1&&T&&!n.get().length&&c(T),b=o,o=null,b}function x(E,b,S,T){o&&_(!1),typeof b=="string"&&(T=S,S=b,b=null),T=D({},r,T||{});var O=T.data||{},C,F,N,I,W;if(T.trapClick?I=f:I=l,E?(C=dr(E)||E,F=Bi(E),Su(E),C.type==="dragstart"&&$i(C)):(C=null,F={x:0,y:0}),N=a(F),b||(b=N),W=ES(C),o=D({prefix:S,data:O,payload:{},globalStart:F,displacement:an(b,N),localStart:N,isTouch:W},T),T.manual||(W?(le.bind(document,"touchstart",d,!0),le.bind(document,"touchcancel",_,!0),le.bind(document,"touchmove",u,!0),le.bind(document,"touchend",l,!0)):(le.bind(document,"mousemove",u),le.bind(document,"dragstart",$i),le.bind(document,"selectstart",$i),le.bind(document,"mousedown",I,!0),le.bind(document,"mouseup",I,!0)),le.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",g)),s("init")===!1)return _(),!1;T.autoActivate&&u(E,!0)}e.on("diagram.destroy",_),this.init=x,this.move=u,this.hover=h,this.out=g,this.end=l,this.cancel=_,this.context=function(){return o},this.setOptions=function(E){D(r,E)}}Yh.$inject=["eventBus","canvas","selection","elementRegistry"];const $n={__depends__:[rS,Zt],dragging:["type",Yh]};function vr(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}vr.prototype.next=function(){return this._prefix+ ++this._counter};const wS=new vr("ps");var SS=["marker-start","marker-mid","marker-end"],RS=["circle","ellipse","line","path","polygon","polyline","path","rect"];function ui(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}ui.$inject=["elementRegistry","eventBus","canvas","styles"],ui.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},ui.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},ui.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=sf(n);return this._cloneMarkers(Oi(r),i),Z(r,this._styles.cls(i,[])),pe(t,r),Z(r,"data-preview-support-element-id",e.id),r},ui.prototype.addFrame=function(e,t){var n=te("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return pe(t,n),Z(n,"data-preview-support-element-id",e.id),n},ui.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),TS(e)&&SS.forEach(function(r){if(Z(e,r)){var o=CS(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},ui.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,wS.next()].join("-"),a=Ae("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||sf(n);s.id=o,xe(s).add(r);var c=Ae(":scope > defs",e);c||(c=te("defs"),pe(e,c)),pe(c,s);var u=AS(s.id);Z(t,i,u)};function CS(e,t,n){var i=PS(Z(e,t));return Ae("marker#"+i,n||document)}function PS(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function AS(e){return"url(#"+e+")"}function TS(e){return RS.indexOf(e.nodeName)!==-1}const yr={__init__:["previewSupport"],previewSupport:["type",ui]};var MS="drop-ok",Kh="drop-not-ok",Xh="attach-ok",Zh="new-parent",Qh="create",kS=2e3;function Jh(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=ye(c,function(x){var E=x.labelTarget;return!x.parent&&!(he(x)&&c.indexOf(E)!==-1)});var d=Oe(c,function(x){return!Te(x)}),h=!1,g=!1,_=!1;tm(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(tm(c)?_=r.allowed("shape.create",{position:l,shape:d,source:p,target:u}):_=r.allowed("elements.create",{elements:c,position:l,target:u}));var R=f.connectionTarget;return _||h?(d&&p&&(g=r.allowed("connection.create",{source:R===p?d:p,target:R===p?p:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:g}):_===null||h===null?null:!1}function a(c,u){[Xh,MS,Kh,Zh].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,p=c.hover,f=u.source,d=u.hints||{};if(!p){u.canExecute=!1,u.target=null;return}em(c);var h={x:c.x,y:c.y},g=u.canExecute=p&&o(l,p,h,f,d);p&&g!==null&&(u.target=p,g&&g.attach?a(p,Xh):a(p,g?Zh:Kh))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,p=u.shape,f=u.elements,d=u.target,h=u.canExecute,g=h&&h.attach,_=h&&h.connect,R=u.hints||{};if(h===!1||!d)return!1;em(c);var x={x:c.x,y:c.y};_?p=i.appendShape(l,p,x,d,{attach:g,connection:_===!0?{}:_,connectionTarget:R.connectionTarget}):(f=i.createElements(f,x,d,D({},R,{attach:g})),p=Oe(f,function(E){return!Te(E)})),D(u,{elements:f,shape:p}),D(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Qh&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],kS,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){ae(u)||(u=[u]);var p=Oe(u,function(h){return!Te(h)});if(p){l=D({elements:u,hints:{},shape:p},l||{}),A(u,function(h){ue(h.x)||(h.x=0),ue(h.y)||(h.y=0)});var f=ye(u,function(h){return!h.hidden}),d=Ue(f);A(u,function(h){Te(h)&&(h.waypoints=vt(h.waypoints,function(g){return{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2}})),D(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,Qh,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}Jh.$inject=["canvas","dragging","eventBus","modeling","rules"];function em(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function tm(e){return e&&e.length===1&&!Te(e[0])}var DS=750;function nm(e,t,n,i,r){function o(a){var s=te("g");Z(s,r.cls("djs-drag-group",["no-events"]));var c=te("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Oi(l),u)):(l=n._createContainer("shape",c),n.drawShape(Oi(l),u),lt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",DS,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var p;s?(l.parentNode||(p=e.getActiveLayer(),pe(p,l)),lt(l,a.x,a.y)):tt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&tt(c)})}nm.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Ga={__depends__:[$n,yr,En,Zt],__init__:["create","createPreview"],create:["type",Jh],createPreview:["type",nm]};function Uu(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var r=t._svg=i.svg;r.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}Uu.$inject=["eventBus"],Uu.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||OS(0,0)};function OS(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const oo={__init__:["mouse"],mouse:["type",Uu]};var im=2e3;function Bt(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,p=c.elementsSet;u.priority=1,u.id=l.id,p.has(l.parent)&&(u.parent=l.parent.id),IS(l)&&(u.priority=2,u.host=l.host.id),Te(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=LS(l)),he(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),A(["x","y","width","height"],function(f){ue(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",im,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",im,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;D(u,{createElementsBehavior:!1})})}Bt.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Bt.prototype.copy=function(e,t={}){var n,i;return ae(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(ae(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Bt.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},Bt.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Bt.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},Bt.prototype._getElementIdsFromTree=function(e){var t={};return A(e,function(n){A(n,function(i){i.id&&(t[i.id]=!0)})}),t},Bt.prototype._paste=function(e,t,n,i){A(e,function(o){ue(o.x)||(o.x=0),ue(o.y)||(o.y=0)});var r=Ue(e);return A(e,function(o){Te(o)&&(o.waypoints=vt(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),D(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,D({},i))},Bt.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return A(e,function(o,a){o=ln(o,"priority"),A(o,function(s){var c=D({},pn(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(Te(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(he(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},Bt.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(pn(e,["id"]));return t},Bt.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(pn(e,["id"]));return t},Bt.prototype.createShape=function(e){var t=this._elementFactory.createShape(pn(e,["id"]));return t},Bt.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Te(e)&&(!n.has(e.source)||!n.has(e.target))||he(e)&&!n.has(e.labelTarget))},Bt.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=na(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=o.get(p);if(!d){var h={element:p,depth:f};r.push(h),o.set(p,h);return}if(d.depth<f){r=u(d,r);var g={element:d.element,depth:f};r.push(g),o.set(p,g)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Di(a,function(p,f,d){if(he(p))return;A(p.labels,function(_){c(_,d)});function h(_){_&&_.length&&A(_,function(R){A(R.labels,function(x){c(x,d)}),c(R,d)})}A([p.attachers,p.incoming,p.outgoing],h),c(p,d);var g=[];return p.children&&(g=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:g}),g}),e=vt(r,function(p){return p.element});var l=new Set(e);return r=vt(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=ln(r,function(p){return p.descriptor.priority}),e=vt(r,function(p){return p.element}),A(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){om(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){om(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function IS(e){return!!e.host}function LS(e){return vt(e.waypoints,function(t){return t=rm(t),t.original&&(t.original=rm(t.original)),t})}function rm(e){return D({},e)}function om(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const BS={__depends__:[nS,Ga,oo,En],__init__:["copyPaste"],copyPaste:["type",Bt]};function qu(e,t,n){ae(n)||(n=[n]),A(n,function(i){Ri(e[i])||(t[i]=e[i])})}var Yu=750;function am(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Yu,function(c){var u=c.descriptor,l=c.element,p=G(l);if(he(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(we(l),!0);d.bpmnElement=f,qu(f,u,"name"),qu(d,u,"isExpanded"),p.default&&(u.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var p=G(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(G(c).attachedToRef=G(u[c.host])),pn(l,kt(l,function(f,d,h){var g=d.element,_=d.property;return h===c.id&&(g.set(_,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,p=l.businessObject,f=l.di;if(he(l)){l.businessObject=G(u[l.labelTarget]),l.di=we(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,qu(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",Yu,function(c){var u=c.descriptor,l=c.element;if(y(l,"bpmn:Participant")){var p=G(l);p.processRef&&(u.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;y(u,"bpmn:SubProcess")&&A(Ur(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",Yu,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}am.$inject=["bpmnFactory","eventBus","moddleCopy"];const NS=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],$S=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ao(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return ln(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=rt(r)&&r.$descriptor;if(a&&$S.includes(a))return o;if(a&&NS.includes(a)||a&&s&&!Oe(s.properties,Zi({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(y(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ao.$inject=["eventBus","bpmnFactory","moddle"],ao.prototype.copyElement=function(e,t,n,i=!1){n&&!ae(n)&&(n=[n]),n=n||Ku(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(ae(r)&&(n=r),A(n,o=>{let a;Mt(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Je(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ao.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return rt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):ae(e)?kt(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):rt(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},ao.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function Ku(e,t){return kt(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const sm={__depends__:[BS],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",am],moddleCopy:["type",ao]};var cm=Math.round;function Xu(e,t){this._modeling=e,this._eventBus=t}Xu.$inject=["modeling","eventBus"],Xu.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,u=cm(s+o/2),l=cm(c+a/2),p=i.replaceShape(e,D({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function um(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}um.$inject=["selection","eventBus"];const jS={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",um],replace:["type",Xu]};function FS(e,t,n){ae(n)||(n=[n]),A(n,function(i){Ri(e[i])||(t[i]=e[i])})}var HS=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function zS(e,t){var n=e&&Mt(e,"collapsed")?e.collapsed:!Ee(e),i;return t&&(Mt(t,"collapsed")||Mt(t,"isExpanded"))?i=Mt(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function lm(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(Wa(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&zS(s,c))return i.toggleCollapse(s),s;var f=e.create(l),d={type:l,businessObject:f};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),FS(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=Ku(p.$descriptor),g=Ku(f.$descriptor,!0),_=VS(h,g);D(f,on(c,HS));var R=ye(_,function(b){return b==="eventDefinitions"?pm(s,c.eventDefinitionType):b==="loopCharacteristics"?!Et(f):Mt(f,b)||b==="processRef"&&c.isExpanded===!1||b==="triggeredByEvent"?!1:b==="isForCompensation"?!Et(f):!0});if(f=n.copyElement(p,f,R),c.eventDefinitionType&&(pm(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),y(p,"bpmn:Activity")){if(Wa(p))d.isExpanded=Ee(s);else if(c&&Mt(c,"isExpanded")){d.isExpanded=c.isExpanded;var x=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=x.width,d.height=x.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Ee(s)&&!y(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Wa(p)&&!Wa(f)&&(u.moveChildren=!1),y(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var E=at(s);we(s).isHorizontal||(we(d).isHorizontal=E),d.width=E?s.width:t.getDefaultSize(d).width,d.height=E?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,ge(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ge(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!y(p,"bpmn:BoundaryEvent")&&y(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}lm.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Wa(e){return y(e,"bpmn:SubProcess")}function pm(e,t){var n=G(e);return t&&n.get("eventDefinitions").some(function(i){return y(i,t)})}function VS(e,t){return e.filter(function(n){return t.includes(n)})}const fm={__depends__:[sm,jS,Zt],bpmnReplace:["type",lm]};var GS=250;function ji(e){this._eventBus=e,this._tools=[],this._active=null}ji.$inject=["eventBus"],ji.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},ji.prototype.isActive=function(e){return e&&this._active===e},ji.prototype.length=function(e){return this._tools.length},ji.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},ji.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),A(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,GS,function(r){this._active&&(WS(r)||this.setActive(null))},this)};function WS(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Mi(t,'.group[data-group="tools"]')}const Ua={__depends__:[$n],__init__:["toolManager"],toolManager:["type",ji]};function US(e,t){if(e==="x"){if(t>0)return"e";if(t<0)return"w"}if(e==="y"){if(t>0)return"s";if(t<0)return"n"}return null}function qS(e,t){var n=[],i=new Set(e);A(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;A(a.concat(s),function(c){var u=c.source,l=c.target;(i.has(u)||i.has(l))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function YS(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var Zu=Math.abs,KS=Math.round,jn={x:"width",y:"height"},dm="crosshair",li={n:"top",w:"left",s:"bottom",e:"right"},XS=1500,qa={n:"s",w:"e",s:"n",e:"w"},Ya=20;function Qt(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",XS,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&mm(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){mm(c);var g={x:0,y:0};g[l]=KS(c["d"+l]),s.makeSpace(f,d,g,p,h),n.once("spaceTool.ended",function(_){s.activateSelection(_.originalEvent,!0,!0)})}})}Qt.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Qt.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:dm,data:{context:{reactivate:n}},trapClick:!1})},Qt.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:dm,data:{context:{}}})},Qt.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Qt.prototype.init=function(e,t){var n=Zu(e.dx)>Zu(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Zu(i)<5)return!1;i<0&&(i*=-1),no(e)&&(i*=-1);var o=US(n,i),a=this._canvas.getRootElement();!La(e)&&e.hover&&(a=e.hover);var s=[...Fr(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=ZS(c,n,o,r,u);return D(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),Va("resize-"+(n==="x"?"ew":"ns")),!0},Qt.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function p(d){s.has(d)||(s.add(d),o.push(d));var h=d.label;h&&!s.has(h)&&(s.add(h),o.push(h))}function f(d){c.has(d)||(c.add(d),a.push(d))}return A(e,function(d){if(!(!d.parent||he(d))){if(Te(d)){l.push(d);return}var h=d[t],g=h+d[jn[t]];if(QS(d)&&(n>0&&se(d)[t]>i||n<0&&se(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&g<i){p(d);return}if(h<i&&g>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),A(o,function(d){var h=d.attachers;h&&A(h,function(g){p(g)})}),A(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&p(d)}),A(l,function(d){var h=d.source,g=d.target,_=d.label;(s.has(h)||c.has(h))&&(s.has(g)||c.has(g))&&_&&p(_)}),{movingShapes:o,resizingShapes:a}},Qt.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Qt.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function hm(e){return{top:e.top-Ya,right:e.right+Ya,bottom:e.bottom+Ya,left:e.left-Ya}}function mm(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;ue(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),ue(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),ue(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),ue(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function ZS(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),p=new Set(a);return A(a,function(f){var d=f.attachers,h=f.children,g=ie(f),_=ye(h,function(W){return!Te(W)&&!he(W)&&!l.has(W)&&!p.has(W)}),R=ye(h,function(W){return!Te(W)&&!he(W)&&l.has(W)}),x,E,b,S=[],T=[],O,C,F,N;_.length&&(E=hm(ie(Ue(_))),x=i-g[li[n]]+E[li[n]],n==="n"?s.bottom=u=ue(u)?Math.min(u,x):x:n==="w"?s.right=u=ue(u)?Math.min(u,x):x:n==="s"?s.top=c=ue(c)?Math.max(c,x):x:n==="e"&&(s.left=c=ue(c)?Math.max(c,x):x)),R.length&&(b=hm(ie(Ue(R))),x=i-b[li[qa[n]]]+g[li[qa[n]]],n==="n"?s.bottom=u=ue(u)?Math.min(u,x):x:n==="w"?s.right=u=ue(u)?Math.min(u,x):x:n==="s"?s.top=c=ue(c)?Math.max(c,x):x:n==="e"&&(s.left=c=ue(c)?Math.max(c,x):x)),d&&d.length&&(d.forEach(function(W){l.has(W)?S.push(W):T.push(W)}),S.length&&(O=ie(Ue(S.map(se))),C=g[li[qa[n]]]-(O[li[qa[n]]]-i)),T.length&&(F=ie(Ue(T.map(se))),N=F[li[n]]-(g[li[n]]-i)),n==="n"?(x=Math.min(C||1/0,N||1/0),s.bottom=u=ue(u)?Math.min(u,x):x):n==="w"?(x=Math.min(C||1/0,N||1/0),s.right=u=ue(u)?Math.min(u,x):x):n==="s"?(x=Math.max(C||-1/0,N||-1/0),s.top=c=ue(c)?Math.max(c,x):x):n==="e"&&(x=Math.max(C||-1/0,N||-1/0),s.left=c=ue(c)?Math.max(c,x):x));var I=r&&r[f.id];I&&(n==="n"?(x=i+f[jn[t]]-I[jn[t]],s.bottom=u=ue(u)?Math.min(u,x):x):n==="w"?(x=i+f[jn[t]]-I[jn[t]],s.right=u=ue(u)?Math.min(u,x):x):n==="s"?(x=i-f[jn[t]]+I[jn[t]],s.top=c=ue(c)?Math.max(c,x):x):n==="e"&&(x=i-f[jn[t]]+I[jn[t]],s.left=c=ue(c)?Math.max(c,x):x))}),s}}function QS(e){return!!e.host}var Qu="djs-dragging",gm="djs-resizing",JS=250,Ka=Math.max;function vm(e,t,n,i,r){function o(a,s){A(a,function(c){r.addDragger(c,s),n.addMarker(c,Qu)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=te("g");Z(l,i.cls("djs-crosshair-group",["no-events"])),pe(s,l);var p=te("path");Z(p,"d",u.x),xe(p).add("djs-crosshair"),pe(l,p);var f=te("path");Z(f,"d",u.y),xe(f).add("djs-crosshair"),pe(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;lt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&tt(c)}),e.on("spaceTool.move",JS,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=te("path"),Z(c,"d","M0,0 L0,0"),xe(c).add("djs-crosshair"),pe(f,c),s.line=c;var d=te("g");Z(d,i.cls("djs-drag-group",["no-events"])),pe(n.getActiveLayer(),d),o(l,d);var h=new Set(l);A(p,function(T){h.add(T)});var g=new Set,_=s.movingConnections=[];h.forEach(function(T){A(T.outgoing,function(O){g.has(O)||!Te(O)||!h.has(O.target)||(g.add(O),_.push(O))})}),o(_,d),s.dragGroup=d}if(!s.frameGroup){var R=te("g");Z(R,i.cls("djs-frame-group",["no-events"])),pe(n.getActiveLayer(),R);var x=[];A(p,function(T){var O=r.addFrame(T,R),C=O.getBBox();x.push({element:O,initialBounds:C}),n.addMarker(T,gm)}),s.frameGroup=R,s.frames=x}var E={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Z(c,{d:E[u]});var b={x:"y",y:"x"},S={x:a.dx,y:a.dy};S[b[s.axis]]=0,lt(s.dragGroup,S.x,S.y),A(s.frames,function(T){var O=T.element,C=T.initialBounds,F,N;s.direction==="e"?Z(O,{width:Ka(C.width+S.x,5)}):(F=Ka(C.width-S.x,5),Z(O,{width:F,x:C.x+C.width-F})),s.direction==="s"?Z(O,{height:Ka(C.height+S.y,5)}):(N=Ka(C.height-S.y,5),Z(O,{height:N,y:C.y+C.height-N}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;A(c,function(h){n.removeMarker(h,Qu)}),A(u,function(h){n.removeMarker(h,Qu)}),f&&(tt(p),tt(f)),A(l,function(h){n.removeMarker(h,gm)}),d&&tt(d)})}vm.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const eR={__init__:["spaceToolPreview"],__depends__:[$n,En,Ua,yr,oo],spaceTool:["type",Qt],spaceToolPreview:["type",vm]};function Xa(e,t){e.invoke(Qt,this),this._canvas=t}Xa.$inject=["injector","canvas"],X(Xa,Qt),Xa.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Ki(er(r.children.filter(u=>y(u,"bpmn:Artifact")),Ue(o))));const s=[...e,...a];var c=Qt.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(y(u,"bpmn:TextAnnotation")||tR(u)&&(t==="y"&&at(u)||t==="x"&&!at(u)))}),c};function tR(e){return y(e,"bpmn:Participant")&&!G(e).processRef}const ym={__depends__:[eR],spaceTool:["type",Xa]};function je(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}je.$inject=["eventBus","injector"],je.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},je.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},je.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},je.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},je.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},je.prototype.register=function(e,t){this._setHandler(e,t)},je.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},je.prototype.canUndo=function(){return!!this._getUndoAction()},je.prototype.canRedo=function(){return!!this._getRedoAction()},je.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},je.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},je.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},je.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},je.prototype._createId=function(){return this._uid++},je.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},je.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},je.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},je.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Pp("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},je.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=ae(e)?e:[e],t.dirty=t.dirty.concat(e))},je.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},je.prototype._revertedAction=function(e){this._stackIdx--},je.prototype._getHandler=function(e){return this._handlerMap[e]},je.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const nR={commandStack:["type",je]};function pi(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var iR=250,_m=1400;function Ju(e,t,n){V.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",_m,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=bm(a),o.validatedShapes=bm(s)}),i&&t.on("shape.move.start",iR,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const u of c.labels)!u.hidden&&!a.has(u)&&s.add(u),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",_m,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];A(s,function(u){A(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;pi(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=Dc(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Ge(s.labels,a,c),a.labelTarget=s)})}X(Ju,V),Ju.$inject=["injector","eventBus","modeling"];function bm(e){var t=new Set(e);return ye(e,function(n){return!t.has(n.labelTarget)})}const rR={__init__:["labelSupport"],labelSupport:["type",Ju]};var oR=251,Em=1401,xm="attach-ok";function el(e,t,n,i,r){V.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Em,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=aR(c),s.validatedShapes=sR(u)}),o&&t.on("shape.move.start",oR,function(a){var s=a.context,c=s.shapes,u=tl(c);A(u,function(l){o.makeDraggable(s,l,!0),A(l.labels,function(p){o.makeDraggable(s,p,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,xm),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,xm)}))}}),this.preExecuted("elements.move",Em,function(a){var s=a.context,c=s.closure,u=s.shapes,l=tl(u);A(l,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=ye(c,function(p){var f=p.host;return cR(p)&&!uR(c,f)}),A(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;A(s,function(c){A(c.attachers,function(u){A(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),A(u.incoming.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;pi(c.attachers,function(l){var p=i.allowed("elements.move",{target:u,shapes:[l]});p==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&A(u.attachers,function(l){var p=Fd(l,c,u);r.moveShape(l,p,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&A(p,function(d){var h=Fd(d,u,l);r.moveShape(d,h,d.parent),A(d.labels,function(g){r.moveShape(g,h,g.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;pi(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}X(el,V),el.$inject=["injector","eventBus","canvas","rules","modeling"];function tl(e){return rc(vt(e,function(t){return t.attachers||[]}))}function aR(e){var t=tl(e);return k_("id",e,t)}function sR(e){var t=Xi(e,"id");return ye(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function cR(e){return!!e.host}function uR(e,t){return e.indexOf(t)!==-1}const lR={__depends__:[En],__init__:["attachSupport"],attachSupport:["type",el]};function wm(e,t,n,i){e.on("element.changed",function(r){var o=r.element;(o.parent||o===t.getRootElement())&&(r.gfx=n.getGraphics(o)),r.gfx&&e.fire(mf(o)+".changed",r)}),e.on("elements.changed",function(r){var o=r.elements;o.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(o)}),e.on("shape.changed",function(r){i.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){i.update("connection",r.element,r.gfx)})}wm.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const nl={__init__:["changeSupport"],changeSupport:["type",wm]};function Jt(e){this._model=e}Jt.$inject=["moddle"],Jt.prototype._needsId=function(e){return ge(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},Jt.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;y(e,"bpmn:Activity")?t="Activity":y(e,"bpmn:Event")?t="Event":y(e,"bpmn:Gateway")?t="Gateway":ge(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Jt.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Jt.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Jt.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",D({bpmnElement:e,bounds:this.createDiBounds()},t))},Jt.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Jt.prototype.createDiWaypoints=function(e){var t=this;return vt(e,function(n){return t.createDiWaypoint(n)})},Jt.prototype.createDiWaypoint=function(e){return this.create("dc:Point",on(e,["x","y"]))},Jt.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",D({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Jt.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",D({bpmnElement:e},t))};function Nt(e,t,n){V.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,g=h.hints||{},_;!h.cropped&&g.createElementsBehavior!==!1&&(_=h.connection,_.waypoints=n.getCroppedWaypoints(_),h.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;i.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,g=h.shape||h.connection,_=h.parent||h.newParent;i.updateParent(g,_)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$t(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$t(a));function s(d){var h=d.context,g=h.oldRoot,_=g.children;A(_,function(R){y(R,"bpmn:BaseElement")&&i.updateParent(R)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;y(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],$t(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],$t(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],$t(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],$t(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],$t(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],$t(l)),this.executed("connection.reconnect",$t(function(d){var h=d.context,g=h.connection,_=h.oldSource,R=h.newSource,x=G(g),E=G(_),b=G(R);x.conditionExpression&&!ge(b,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=x.conditionExpression,delete x.conditionExpression),_!==R&&E.default===x&&(h.oldDefault=E.default,delete E.default)})),this.reverted("connection.reconnect",$t(function(d){var h=d.context,g=h.connection,_=h.oldSource,R=h.newSource,x=G(g),E=G(_),b=G(R);h.oldConditionExpression&&(x.conditionExpression=h.oldConditionExpression),h.oldDefault&&(E.default=h.oldDefault,delete b.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],$t(p)),this.reverted(["element.updateAttachment"],$t(p)),this.executed("element.updateLabel",$t(f)),this.reverted("element.updateLabel",$t(f));function f(d){const{element:h}=d.context,g=Vt(h),_=we(h),R=_&&_.get("label");ri(h)||Ba(h)||(g&&!R?_.set("label",t.create("bpmndi:BPMNLabel")):!g&&R&&_.set("label",void 0))}}X(Nt,V),Nt.$inject=["eventBus","bpmnFactory","connectionDocking"],Nt.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Nt.prototype.updateParent=function(e,t){if(!he(e)&&!(y(e,"bpmn:DataStoreReference")&&e.parent&&y(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=we(e),o=n&&n.businessObject,a=we(n);y(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),y(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),y(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),y(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Nt.prototype.updateBounds=function(e){var t=we(e),n=fR(e);if(n){var i=an(n,t.get("bounds"));D(n,{x:e.x+i.x,y:e.y+i.y})}var r=he(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),D(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Nt.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;y(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),ze(i,e)),y(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Ge(r,e))}},Nt.prototype.updateDiConnection=function(e,t,n){var i=we(e),r=we(t),o=we(n);i.sourceElement&&i.sourceElement.bpmnElement!==G(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==G(n)&&(i.targetElement=n&&o)},Nt.prototype.updateDiParent=function(e,t){if(t&&!y(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(ze(n,e),e.$parent=null)}};function pR(e){for(;e&&!y(e,"bpmn:Definitions");)e=e.$parent;return e}Nt.prototype.getLaneSet=function(e){var t,n;return y(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(y(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},Nt.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((y(e,"bpmn:DataInput")||y(e,"bpmn:DataOutput"))&&(y(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(y(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(y(e,"bpmn:FlowElement")){if(t){if(y(t,"bpmn:Participant"))t=t.processRef;else if(y(t,"bpmn:Lane"))do t=t.$parent.$parent;while(y(t,"bpmn:Lane"))}i="flowElements"}else if(y(e,"bpmn:Artifact")){for(;t&&!y(t,"bpmn:Process")&&!y(t,"bpmn:SubProcess")&&!y(t,"bpmn:Collaboration");)if(y(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(y(e,"bpmn:MessageFlow"))i="messageFlows";else if(y(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=pR(e.$parent||t),e.$parent&&(ze(o.get("rootElements"),r),r.$parent=null),t&&(Ge(o.get("rootElements"),r),r.$parent=o))}else y(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":y(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),ze(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);ze(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Nt.prototype.updateConnectionWaypoints=function(e){var t=we(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Nt.prototype.updateConnection=function(e){var t=e.connection,n=G(t),i=t.source,r=G(i),o=t.target,a=G(t.target),s;if(y(n,"bpmn:DataAssociation"))y(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):y(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=y(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(ze(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(ze(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},Nt.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function $t(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;y(i,"bpmn:BaseElement")&&e(t)}}function fR(e){if(y(e,"bpmn:Activity")){var t=we(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function fi(e,t){In.call(this),this._bpmnFactory=e,this._moddle=t}X(fi,In),fi.$inject=["bpmnFactory","moddle"],fi.prototype._baseCreate=In.prototype.create,fi.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,D({type:"label",di:n},Ii,t))}return this.createElement(e,t)},fi.prototype.createElement=function(e,t){t=D({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!hR(r)){var o=D({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}y(i,"bpmn:Group")&&(t=D({isFrame:!0},t)),t=dR(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=il(r,t,"isExpanded")),ge(i,["bpmn:Lane","bpmn:Participant"])&&(t=il(r,t,"isHorizontal")),y(i,"bpmn:SubProcess")&&(t.collapsed=!Ee(i,r)),y(i,"bpmn:ExclusiveGateway")&&(Mt(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Je(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Je(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=D({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},fi.prototype.getDefaultSize=function(e,t){var n=G(e);if(t=t||we(e),y(n,"bpmn:SubProcess"))return Ee(n,t)?{width:350,height:200}:{width:100,height:80};if(y(n,"bpmn:Task"))return{width:100,height:80};if(y(n,"bpmn:Gateway"))return{width:50,height:50};if(y(n,"bpmn:Event"))return{width:36,height:36};if(y(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Ee(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return y(n,"bpmn:Lane")?{width:400,height:100}:y(n,"bpmn:DataObjectReference")?{width:36,height:50}:y(n,"bpmn:DataStoreReference")?{width:50,height:50}:y(n,"bpmn:TextAnnotation")?{width:100,height:40}:y(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},fi.prototype.createParticipantShape=function(e){return rt(e)||(e={isExpanded:e}),e=D({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function dR(e,t,n){return A(n,function(i){t=il(e,t,i)}),t}function il(e,t,n){return t[n]===void 0?t:(e[n]=t[n],pn(t,[n]))}function hR(e){return ge(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Za(e,t){this._modeling=e,this._canvas=t}Za.$inject=["modeling","canvas"],Za.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;A(n,function(r){var o={x:0,y:0};Je(i.left)?o.x=i.left-r.x:Je(i.right)?o.x=i.right-r.width-r.x:Je(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Je(i.top)?o.y=i.top-r.y:Je(i.bottom)?o.y=i.bottom-r.height-r.y:Je(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Za.prototype.postExecute=function(e){};function Qa(e){this._modeling=e}Qa.$inject=["modeling"],Qa.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},Qa.prototype.postExecute=function(e){var t=e.hints||{};mR(e.source,e.shape)||(t.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))};function mR(e,t){return qn(e.outgoing,function(n){return n.target===t})}function Ja(e,t){this._canvas=e,this._layouter=t}Ja.$inject=["canvas","layouter"],Ja.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},Ja.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var es=Math.round;function rl(e){this._modeling=e}rl.$inject=["modeling"],rl.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;A(t,function(p){ue(p.x)||(p.x=0),ue(p.y)||(p.y=0)});var s=ye(t,function(p){return!p.hidden}),c=Ue(s);A(t,function(p){Te(p)&&(p.waypoints=vt(p.waypoints,function(f){return{x:es(f.x-c.x-c.width/2+r.x),y:es(f.y-c.y-c.height/2+r.y)}})),D(p,{x:es(p.x-c.x-c.width/2+r.x),y:es(p.y-c.y-c.height/2+r.y)})});var u=new Set(na(t)),l={};A(t,function(p){if(Te(p)){l[p.id]=ue(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=D({},o);u.has(p)||(f.autoResize=!1),he(p)&&(f=pn(f,["attach"])),l[p.id]=ue(i)?a.createShape(p,on(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,on(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Ki(l)};var Sm=Math.round;function di(e){this._canvas=e}di.$inject=["canvas"],di.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?D(t,n):D(t,{x:n.x-Sm(t.width/2),y:n.y-Sm(t.height/2)}),this._canvas.addShape(t,i,r),t},di.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function so(e){di.call(this,e)}X(so,di),so.$inject=["canvas"];var gR=di.prototype.execute;so.prototype.execute=function(e){var t=e.shape;return yR(t),t.labelTarget=e.labelTarget,gR.call(this,e)};var vR=di.prototype.revert;so.prototype.revert=function(e){return e.shape.labelTarget=null,vR.call(this,e)};function yR(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function co(e,t){this._canvas=e,this._modeling=t}co.$inject=["canvas","modeling"],co.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;pi(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pi(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},co.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Dc(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},co.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Ge(n.children,t,i),this._canvas.addConnection(t,n),t};function ol(e,t){this._modeling=e,this._elementRegistry=t}ol.$inject=["modeling","elementRegistry"],ol.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;A(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function uo(e,t){this._canvas=e,this._modeling=t}uo.$inject=["canvas","modeling"],uo.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;pi(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pi(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),pi(n.children,function(i){Te(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},uo.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Dc(i.children,n),t.removeShape(n),n},uo.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Ge(i.children,n,r),t.addShape(n,i),n};function ts(e){this._modeling=e}ts.$inject=["modeling"];var Rm={x:"y",y:"x"};ts.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(_,R){_.range.min=Math.min(R[i],_.range.min),_.range.max=Math.max(R[i]+R[r],_.range.max)}function a(_){return _[i]+_[r]/2}function s(_){return _.length-1}function c(_){return _.max-_.min}function u(_,R){var x={y:0};x[i]=_-a(R),x[i]&&(x[Rm[i]]=0,t.moveElements([R],x,R.parent))}var l=n[0],p=s(n),f=n[p],d,h,g=0;A(n,function(_,R){var x,E,b;if(_.elements.length<2){R&&R!==n.length-1&&(o(_,_.elements[0]),g+=c(_.range));return}x=ln(_.elements,i),E=x[0],R===p&&(E=x[s(x)]),b=a(E),_.range=null,A(x,function(S){if(u(b,S),_.range===null){_.range={min:S[i],max:S[i]+S[r]};return}o(_,S)}),R&&R!==n.length-1&&(g+=c(_.range))}),h=Math.abs(f.range.min-l.range.max),d=Math.round((h-g)/(n.length-1)),!(d<n.length-1)&&A(n,function(_,R){var x={},E;_===l||_===f||(E=n[R-1],_.range.max=0,A(_.elements,function(b,S){x[Rm[i]]=0,x[i]=E.range.max-b[i]+d,_.range.min!==b[i]&&(x[i]+=b[i]-_.range.min),x[i]&&t.moveElements([b],x,b.parent),_.range.max=Math.max(b[i]+b[r],S?_.range.max:0)}))})},ts.prototype.postExecute=function(e){};function ns(e,t){this._layouter=e,this._canvas=t}ns.$inject=["layouter","canvas"],ns.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return D(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},ns.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function al(){}al.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=ze(o.children,t),Ge(i.children,t,r),t.parent=i,A(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},al.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return ze(n.children,t),Ge(i.children,t,r),t.parent=i,A(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function sl(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}sl.prototype.add=function(e,t){return this.addAll([e],t)},sl.prototype.addAll=function(e,t){var n=Y0(e,!!t,this);return D(this,n),this};function lo(e){this._modeling=e}lo.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},lo.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),A(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),A(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,u[p.id]&&!l&&n):o.layoutConnection(p,{connectionStart:f&&hu(p,p.source,t),connectionEnd:d&&mu(p,p.target,t)})})},lo.prototype.getClosure=function(e){return new sl().addAll(e,!0)};function is(e){this._helper=new lo(e)}is.$inject=["modeling"],is.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},is.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Fi(e){this._modeling=e,this._helper=new lo(e)}Fi.$inject=["modeling"],Fi.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=on(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=ze(o.children,t),Ge(i.children,t,r),D(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Fi.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(A(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:mu(o,t,n)})}),A(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:hu(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Fi.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Ge(n.children,t,i),D(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Fi.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Fi.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function po(e){this._modeling=e}po.$inject=["modeling"],po.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return ae(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},po.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||Cm(ae(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Cm(ae(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},po.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function Cm(e){return e.original||e}function Fn(e,t){this._modeling=e,this._rules=t}Fn.$inject=["modeling","rules"],Fn.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(h,g,_){return i.allowed("connection.reconnect",{connection:_,source:h,target:g})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();A(f,function(h){var g=h.source,_=c(g,s,h);_&&t.reconnectEnd(h,s,Ma(h,s,l),a)}),A(d,function(h){var g=h.target,_=c(s,g,h);_&&t.reconnectStart(h,s,Ta(h,s,l),a)})},Fn.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Fn.prototype.execute=function(e){},Fn.prototype.revert=function(e){},Fn.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Fn.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Fn.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function fo(e){this._modeling=e}fo.$inject=["modeling"],fo.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},fo.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(A(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Ma(o,n,i)})}),A(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Ta(o,n,i)})}))},fo.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function hi(e){this._modeling=e}hi.$inject=["modeling"],hi.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),A(r,function(s){a[s.id]=bR(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(qS(i,r),t,n,o,i,r,a)},hi.prototype.execute=function(){},hi.prototype.revert=function(){},hi.prototype.moveShapes=function(e,t){var n=this;A(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},hi.prototype.resizeShapes=function(e,t,n){var i=this;A(e,function(r){var o=YS(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},hi.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);A(e,function(l){var p=l.source,f=l.target,d=_R(l),h=Am(n),g={},_=c.has(p)||u.has(p),R=c.has(f)||u.has(f);_&&R?(d=vt(d,function(x){return Tm(x,i,n)&&(x[h]=x[h]+t[h]),x.original&&Tm(x.original,i,n)&&(x.original[h]=x.original[h]+t[h]),x}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(_||R)&&(c.has(p)?g.connectionStart=hu(l,p,t):c.has(f)?g.connectionEnd=mu(l,f,t):u.has(p)?g.connectionStart=Ta(l,p,a[p.id]):u.has(f)&&(g.connectionEnd=Ma(l,f,a[f.id])),s._modeling.layoutConnection(l,g))})};function Pm(e){return D({},e)}function _R(e){return vt(e.waypoints,function(t){return t=Pm(t),t.original&&(t.original=Pm(t.original)),t})}function Am(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Tm(e,t,n){var i=Am(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function bR(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function rs(e){this._modeling=e}rs.$inject=["modeling"],rs.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Mm(n),t.collapsed=!t.collapsed;var i=km(n,t.collapsed);return[t].concat(i)},rs.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Dm(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Mm(e){var t={};return A(e,function(n){t[n.id]=n.hidden,n.children&&(t=D({},t,Mm(n.children)))}),t}function km(e,t){var n=[];return A(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(km(i.children,i.collapsed||t)))}),n}function Dm(e,t){var n=[];return A(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Dm(i.children,t)))}),n}function os(e){this._modeling=e}os.$inject=["modeling"],os.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Om(i,t),Im(n,t),t.host=n,t},os.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Om(n,t),Im(i,t,r),t};function Om(e,t){return ze(e&&e.attachers,t)}function Im(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Ge(i,t,n)}}function cl(){}cl.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},cl.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Me(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Me.$inject=["eventBus","elementFactory","commandStack"],Me.prototype.getHandlers=function(){return{"shape.append":Qa,"shape.create":di,"shape.delete":uo,"shape.move":Fi,"shape.resize":fo,"shape.replace":Fn,"shape.toggleCollapse":rs,spaceTool:hi,"label.create":so,"connection.create":Ja,"connection.delete":co,"connection.move":al,"connection.layout":ns,"connection.updateWaypoints":cl,"connection.reconnect":po,"elements.create":rl,"elements.move":is,"elements.delete":ol,"elements.distribute":ts,"elements.align":Za,"element.updateAttachment":os}},Me.prototype.registerHandlers=function(e){A(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Me.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},Me.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Me.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},Me.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},Me.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Me.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},Me.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},Me.prototype.createElements=function(e,t,n,i,r){ae(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},Me.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},Me.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},Me.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Me.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Me.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Me.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Me.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Me.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Me.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Me.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},Me.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Me.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},Me.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,D(i,{docking:"source"}))},Me.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,D(i,{docking:"target"}))},Me.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Me.prototype._create=function(e,t){return OE(t)?t:this._elementFactory.create(e,t)},Me.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function ho(e){this._elementRegistry=e}ho.$inject=["elementRegistry"],ho.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||ER(n,zo(i));return Lm(n,i),e.oldProperties=o,e.changed=r,r},ho.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Lm(n,t),i},ho.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return y(e,"bpmn:DataObject")?xR(e,t):[]};function ER(e,t){return kt(t,function(n,i){return n[i]=e.get(i),n},{})}function Lm(e,t){A(t,function(n,i){e.set(i,n)})}function xR(e,t){return t.filter(function(n){return y(n,"bpmn:DataObjectReference")&&G(n).dataObjectRef===e})}var mo="default",Hn="id",Bm="di",wR={width:0,height:0};function go(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}go.$inject=["elementRegistry","moddle","modeling","textRenderer"],go.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=AR(e.properties),s=e.oldProperties||SR(t,a);return Nm(a,o)&&(r.unclaim(o[Hn]),i.updateId(t,a[Hn]),r.claim(a[Hn],o)),mo in a&&(a[mo]&&n.push(i.get(a[mo].id)),o[mo]&&n.push(i.get(o[mo].id))),$m(t,a),e.oldProperties=s,e.changed=n,n},go.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&G(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,wR)}},go.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return $m(t,i),Nm(n,r)&&(a.unclaim(n[Hn]),o.updateId(t,i[Hn]),a.claim(i[Hn],r)),e.changed};function Nm(e,t){return Hn in e&&e[Hn]!==t[Hn]}function SR(e,t){var n=zo(t),i=e.businessObject,r=we(e);return kt(n,function(o,a){return a!==Bm?o[a]=i.get(a):o[a]=RR(r,zo(t.di)),o},{})}function RR(e,t){return kt(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function $m(e,t){var n=e.businessObject,i=we(e);A(t,function(r,o){o!==Bm?n.set(o,r):i&&CR(i,r)})}function CR(e,t){A(t,function(n,i){e.set(i,n)})}var PR=["default"];function AR(e){var t=D({},e);return PR.forEach(function(n){n in e&&(t[n]=G(t[n]))}),t}function as(e,t){this._canvas=e,this._modeling=t}as.$inject=["canvas","modeling"],as.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=we(r);return t.setRootElement(n),t.removeRootElement(r),Ge(a.rootElements,i),i.$parent=a,ze(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},as.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=we(n);return t.setRootElement(r),t.removeRootElement(n),ze(a.rootElements,i),i.$parent=null,Ge(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function ul(e,t){this._modeling=e,this._spaceTool=t}ul.$inject=["modeling","spaceTool"],ul.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Kt(i),a=o===i,s=a?i:i.parent,c=ai(s),u=at(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+Yt,y:i.y,width:i.width-Yt,height:i.height}:{x:i.x,y:i.y+Yt,width:i.width,height:i.height-Yt};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Di(o,function(b){return p.push(b),b.label&&p.push(b.label),b===i?[]:ye(b.children,function(S){return S!==i})});var f,d,h,g,_;r==="top"?(f=-120,d=i.y,h=d+10,g="n",_="y"):r==="left"?(f=-120,d=i.x,h=d+10,g="w",_="x"):r==="bottom"?(f=120,d=i.y+i.height,h=d-10,g="s",_="y"):r==="right"&&(f=120,d=i.x+i.width,h=d-10,g="e",_="x");var R=t.calculateAdjustments(p,_,f,h),x=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(R.movingShapes,R.resizingShapes,x,g,h);var E=u?{x:i.x+(a?Yt:0),y:d-(r==="top"?120:0),width:i.width-(a?Yt:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Yt:0),width:120,height:i.height-(a?Yt:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},E,s)};function ll(e){this._modeling=e}ll.$inject=["modeling"],ll.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=ai(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=at(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,p,f;for(f=0;f<i;f++)f===i-1?u=s-c*f:u=c,l=a?{x:n.x+Yt,y:n.y+f*c,width:n.width-Yt,height:u}:{x:n.x+f*c,y:n.y+Yt,width:u,height:n.height-Yt},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function vo(e,t){this._modeling=e,this._spaceTool=t}vo.$inject=["modeling","spaceTool"],vo.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},vo.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=xw(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},vo.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ie(e),r=ie(t),o=gd(r,i),a=Kt(e),s=[],c=[];Di(a,function(h){return s.push(h),(y(h,"bpmn:Lane")||y(h,"bpmn:Participant"))&&c.push(h),h.children});var u,l,p,f,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},p)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},p))};var yo="flowNodeRef",pl="lanes";function ss(){}ss.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=ie(p),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var p=Kt(l);return r[p.id]||(r[p.id]=Sa(p)),r[p.id]}function u(l){if(!l.parent)return[];var p=c(l);return p.filter(function(f){return a(l,f)}).map(function(f){return f.businessObject})}return t.forEach(function(l){var p=Kt(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return y(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get(pl),d=f.slice(),h=u(l);i.push({flowNode:p,remove:d,add:h})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get(yo).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},ss.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(pl);n.remove.forEach(function(o){ze(r,o),ze(o.get(yo),i)}),n.add.forEach(function(o){Ge(r,o),Ge(o.get(yo),i)})}),[]},ss.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(pl);n.add.forEach(function(o){ze(r,o),ze(o.get(yo),i)}),n.remove.forEach(function(o){Ge(r,o),Ge(o.get(yo),i)})}),[]};var fl="categoryValueRef";function _o(e,t){this._bpmnFactory=e,this._elementRegistry=t}_o.$inject=["bpmnFactory","elementRegistry"],_o.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(x,E,b){if(E){var S=a.get(x);S||(S={},a.set(x,S)),!(b&&S.present)&&(!b&&S.past||(b?S.present={categoryValue:E,root:dl(x)}:S.past={categoryValue:E}))}}function c(x){r.set(x,G(x))}function u(){n.filter(function(x){return y(x,"bpmn:FlowElement")&&!he(x)&&x.parent}).forEach(c)}function l(x){var E=G(x),b=E.get("categoryValueRef");return b||(b=pd(i,E),o.push(TR(x,b))),b}function p(x){return x.reduce(function(E,b){var S=dl(b),T=E.get(S);return T||(T=[],E.set(S,T)),T.push(b),E},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(x){return y(x,"bpmn:Group")&&!he(x)&&x.parent}).forEach(function(x){var E=G(x).get("categoryValueRef");if(!E){var b=dl(x),S=f.get(b)||[],T=er(S,x),O=Object.keys(T).length>0;O&&(E=l(x))}s(x,E,!0)}),t.forEach(function(x){s(x.groupShape,x.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(x,E){return E.present&&x.add(E.present.categoryValue),E.past&&x.add(E.past.categoryValue),x},new Set),g=new Map,_=p(d);a.forEach(function(x,E){var b=x.present;if(b){var S=_.get(b.root)||[],T=er(S,E);S.forEach(function(O){if(T[O.id]){var C=g.get(O);C||(C=new Set,g.set(O,C)),C.add(b.categoryValue)}})}});var R=d.reduce(function(x,E){var b=r.get(E),S=b.get(fl),T=new Set(S),O=g.get(E)||new Set,C=Array.from(O).filter(function(N){return!T.has(N)}),F=S.filter(function(N){return h.has(N)&&!O.has(N)});return(C.length||F.length)&&x.push({businessObject:b,categoryValuesToAdd:C,categoryValuesToRemove:F}),x},[]);return{flowElements:R,groups:o}},_o.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),MR(t.groups),DR(t.flowElements),[]},_o.prototype.revert=function(e){var t=e.updates;return OR(t.flowElements),kR(t.groups),[]};function TR(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function MR(e){e.forEach(function(t){G(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function kR(e){e.forEach(function(t){G(t.groupShape).categoryValueRef=null})}function DR(e){e.forEach(function(t){var n=t.businessObject,i=n.get(fl);t.categoryValuesToRemove.forEach(function(r){ze(i,r)}),t.categoryValuesToAdd.forEach(function(r){Ge(i,r,!0)})})}function OR(e){e.forEach(function(t){var n=t.businessObject,i=n.get(fl);t.categoryValuesToAdd.forEach(function(r){ze(i,r)}),t.categoryValuesToRemove.forEach(function(r){Ge(i,r,!0)})})}function dl(e){for(;e.parent;)e=e.parent;return e}function cs(e){this._moddle=e}cs.$inject=["moddle"],cs.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},cs.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var IR={fill:void 0,stroke:void 0};function hl(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Tt(t)){var n=LR(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}hl.$inject=["commandStack"],hl.prototype.postExecute=function(e){var t=e.elements,n=e.colors||IR,i=this,r={};"fill"in n&&D(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&D(r,{"border-color":this._normalizeColor(n.stroke)}),A(t,function(o){var a=Te(o)?on(r,["border-color"]):r,s=we(o);if(BR(a),he(o)){if(!s||!y(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!ge(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function LR(e){var t=document.createElement("canvas").getContext("2d");return t.fillStyle="transparent",t.fillStyle=e,/^#[0-9a-fA-F]{6}$/.test(t.fillStyle)?t.fillStyle:null}function BR(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var NR={width:0,height:0};function jm(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return px(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!he(u)&&ri(u)&&!pa(u)&&!Fm(p)){var f=7,d=$c(u);d={x:d.x,y:d.y+f},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=Vt(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!he(l)&&!y(l,"bpmn:TextAnnotation"))){if(he(l)&&Fm(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=Vt(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,NR)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}jm.$inject=["modeling","textRenderer","bpmnFactory"];function Fm(e){return!e||!e.trim()}function ft(e,t,n,i){Me.call(this,e,t,n),this._bpmnRules=i}X(ft,Me),ft.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],ft.prototype.getHandlers=function(){var e=Me.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=ho,e["element.updateProperties"]=go,e["canvas.updateRoot"]=as,e["lane.add"]=ul,e["lane.resize"]=vo,e["lane.split"]=ll,e["lane.updateRefs"]=ss,e["group.updateRefs"]=_o,e["id.updateClaim"]=cs,e["element.setColor"]=hl,e["element.updateLabel"]=jm,e},ft.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},ft.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},ft.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},ft.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},ft.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},ft.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},ft.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},ft.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},ft.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},ft.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},ft.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},ft.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},ft.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},ft.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Hm(){}Hm.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||se(t.source||e.source),t.connectionEnd||se(t.target||e.target)]};var us=20,$R=5,ls=Math.round,zm=20,jR={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function FR(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function HR(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Vm(e,t,n){var i=ut(t,e,$R),r=n.split(":")[0],o=ls((t.x-e.x)/2+e.x),a=ls((t.y-e.y)/2+e.y),s,c,u=HR(r,i),l=/h|r|l/.test(r),p=!1,f=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(p=FR(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+us*(/l/.test(r)?-1:1),y:f?a+us:a}):(f=o===e.x,s={x:f?o+us:o,y:e.y+us*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:ml(e,s,c).concat(s),directions:c,turnNextDirections:f}}function zR(e,t,n){return Vm(e,t,n)}function VR(e,t,n){var i=Vm(t,e,Gm(n));return{waypoints:i.waypoints.slice().reverse(),directions:Gm(i.directions),turnNextDirections:i.turnNextDirections}}function GR(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var r=n+":"+i,o=ml(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Gm(e){return e.split(":").reverse().join(":")}function WR(e,t,n){var i=ls((t.x-e.x)/2+e.x),r=ls((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function ml(e,t,n){if(n=n||"h:h",!eC(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Um(n)){var i=zR(e,t,n),r=VR(e,t,n),o=GR(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return WR(e,t,n)}function UR(e,t,n){var i=ml(e,t,n);return i.unshift(e),i.push(t),Ym(i)}function qR(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=T_(o,"straight")[0]||"h:h",s=jR[a]||0,c=ut(e,t,s),u=JR(c,a);n=n||se(e),i=i||se(t);var l=u.split(":"),p=qm(n,e,l[0],tC(c)),f=qm(i,t,l[1],c);return UR(p,f,u)}function YR(e,t,n,i,r,o){ae(n)&&(r=n,o=i,n=se(e),i=se(t)),o=D({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&XR(e,t,n,i,o),c||(c=o.connectionEnd&&QR(t,e,i,r),c)||(c=o.connectionStart&&ZR(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:qR(e,t,n,i,o)}function KR(e,t,n){return e>=t&&e<=n}function Wm(e,t,n){var i={x:"width",y:"height"};return KR(t[e],n[e],n[e]+n[i[e]])}function XR(e,t,n,i,r){var o={},a,s;return s=ut(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Wm(a,i,e)?(o[a]=i[a],[{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y,original:{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y}},{x:i.x,y:i.y}]):null:Wm(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y,original:{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y}}]):null):null}function ZR(e,t,n,i){return gl(e,t,n,i)}function QR(e,t,n,i){var r=i.slice().reverse();return r=gl(e,t,n,r),r?r.reverse():null}function gl(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!Oe(l,function(p,f){var d=l[f-1];return d&&zr(p,d)<3})}function o(l,p,f){var d=Dn(p,l);switch(d){case"v":return{x:f.x,y:l.y};case"h":return{x:l.x,y:f.y}}return{x:l.x,y:l.y}}function a(l,p,f){var d;for(d=l.length-2;d!==0;d--)if(vf(l[d],p,zm)||vf(l[d],f,zm))return l.slice(d);return l}if(r(i))return null;var s=i[0],c=i.slice(),u;return c[0]=n,c[1]=o(c[1],s,n),u=a(c,e,t),u!==c&&(c=gl(e,t,n,u)),c&&Dn(c)?null:c}function JR(e,t){if(Um(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function eC(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Um(e){return e&&/t|r|b|l/.test(e)}function tC(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function qm(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Ym(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return Oc(r,o,n,0)||t.push(n),t},[])}var nC=-10,iC=40,rC={default:["h:h"],fromGateway:["v:h"],toGateway:["h:v"],loop:{fromTop:["t:r"],fromRight:["r:b"],fromLeft:["l:t"],fromBottom:["b:l"]},boundaryLoop:{alternateHorizontalSide:"b",alternateVerticalSide:"l",default:"v"},messageFlow:["straight","v:v"],subProcess:["straight","h:h"],isHorizontal:!0},oC={default:["v:v"],fromGateway:["h:v"],toGateway:["v:h"],loop:{fromTop:["t:l"],fromRight:["r:t"],fromLeft:["l:b"],fromBottom:["b:r"]},boundaryLoop:{alternateHorizontalSide:"t",alternateVerticalSide:"r",default:"h"},messageFlow:["straight","h:h"],subProcess:["straight","v:v"],isHorizontal:!1},vl={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},bo={top:"t",right:"r",bottom:"b",left:"l"};function ps(e){this._elementRegistry=e}X(ps,Hm),ps.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=Km(r&&r[0],n)),a||(a=Km(r&&r[r.length-1],i)),(y(e,"bpmn:Association")||y(e,"bpmn:DataAssociation"))&&r&&!Xm(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=sd(n,s)?rC:oC;return y(e,"bpmn:MessageFlow")?c=sC(n,i,l):(y(e,"bpmn:SequenceFlow")||Xm(n,i))&&(n===i?c={preferredLayouts:dC(n,e,l)}:y(n,"bpmn:BoundaryEvent")?c={preferredLayouts:hC(n,i,a,l)}:Eo(n)||Eo(i)?c={preferredLayouts:l.subProcess,preserveDocking:uC(n)}:y(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:y(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=D(c,t),u=Ym(YR(n,i,o,a,r,c))),u||[o,a]};function aC(e){var t=e.host;return ut(se(e),t,nC)}function sC(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:cC(e,t)}}function cC(e,t){return y(t,"bpmn:Participant")?"source":y(e,"bpmn:Participant")?"target":Eo(t)?"source":Eo(e)||y(t,"bpmn:Event")?"target":y(e,"bpmn:Event")?"source":null}function uC(e){return Eo(e)?"target":"source"}function Km(e,t){return e?e.original||e:se(t)}function Xm(e,t){return y(t,"bpmn:Activity")&&y(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Eo(e){return y(e,"bpmn:SubProcess")&&Ee(e)}function Hi(e,t){return e===t}function lC(e,t){return t.indexOf(e)!==-1}function _r(e){var t=/right|left/.exec(e);return t&&t[0]}function br(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Zm(e,t){return vl[e]===t}function pC(e,t){var n=_r(e),i=vl[n];return t.indexOf(i)!==-1}function fC(e,t){var n=br(e),i=vl[n];return t.indexOf(i)!==-1}function Qm(e){return e==="right"||e==="left"}function dC(e,t,n){var i=t.waypoints,r=i&&i.length&&ut(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function hC(e,t,n,i){var r=se(e),o=se(t),a=aC(e),s,c,u=Hi(e.host,t),l=lC(a,["top","right","bottom","left"]),p=ut(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?mC(a,l,e,t,n,i):(s=gC(a,p,l,i.isHorizontal),c=vC(a,p,l,i.isHorizontal),[s+":"+c])}function mC(e,t,n,i,r,o){var a=t?e:o.isHorizontal?br(e):_r(e),s=bo[a],c;return t?Qm(e)?c=Jm("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Jm("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Jm(e,t,n,i){var r=iC;return!(yl(e,i,n,r)||yl(e,i,{x:n.x+n.width,y:n.y+n.height},r)||yl(e,i,se(t),r))}function yl(e,t,n,i){return Math.abs(t[e]-n[e])<i}function gC(e,t,n,i){if(n)return bo[e];var r=br(e),o=_r(e),a=br(t),s=_r(t);if(i){if(Hi(r,a)||Zm(o,s))return bo[r]}else if(Hi(o,s)||Zm(r,a))return bo[o];return bo[i?o:r]}function vC(e,t,n,i){if(n)return Qm(e)?pC(e,t)||Hi(e,t)?"h":"v":fC(e,t)||Hi(e,t)?"v":"h";var r=br(e),o=_r(e),a=br(t),s=_r(t);return a&&!s?"v":s&&!a?"h":i?Hi(r,a)?"h":"v":Hi(o,s)?"v":"h"}ps.$inject=["elementRegistry"];function eg(e){return D({original:e.point.original||e.point},e.actual)}function mi(e,t){this._elementRegistry=e,this._graphicsFactory=t}mi.$inject=["elementRegistry","graphicsFactory"],mi.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(eg(i)),o.push(eg(r)),o},mi.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},mi.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Vr(i,r,n)},mi.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},mi.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},mi.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const _l={__init__:["modeling","bpmnUpdater"],__depends__:[B1,Q1,eS,tS,fm,nR,rR,lR,Zt,nl,ym],bpmnFactory:["type",Jt],bpmnUpdater:["type",Nt],elementFactory:["type",fi],modeling:["type",ft],layouter:["type",ps],connectionDocking:["type",mi]};var yC=10,tg=50,_C=250;function bl(e,t,n,i){for(var r;r=bC(e,n,t);)n=i(t,n,r);return n}function El(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,u=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-u+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+u+c)}}),r}}function bC(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=xC(e);return Oe(r,function(o){if(o===n)return!1;var a=ut(o,i,yC);return a==="intersect"})}function EC(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||tg,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||_C,c=t.reference||"start";o||(o=RC);function u(h,g){return r==="n"?c==="start"?ie(h).top-ie(g).bottom:c==="center"?ie(h).top-se(g).y:ie(h).top-ie(g).top:r==="w"?c==="start"?ie(h).left-ie(g).right:c==="center"?ie(h).left-se(g).x:ie(h).left-ie(g).left:r==="s"?c==="start"?ie(g).top-ie(h).bottom:c==="center"?se(g).y-ie(h).bottom:ie(g).bottom-ie(h).bottom:c==="start"?ie(g).left-ie(h).right:c==="center"?se(g).x-ie(h).right:ie(g).right-ie(h).right}var l=e.incoming.filter(o).map(function(h){var g=a(h),_=g<0?u(h.source,e):u(e,h.source);return{id:h.source.id,distance:_,weight:g}}),p=e.outgoing.filter(o).map(function(h){var g=a(h),_=g>0?u(e,h.target):u(h.target,e);return{id:h.target.id,distance:_,weight:g}}),f=l.concat(p).reduce(function(h,g){return h[g.id+"__weight_"+g.weight]=g,h},{}),d=kt(f,function(h,g){var _=g.distance,R=g.weight;return _<0||_>s||(h[String(_)]||(h[String(_)]=0),h[String(_)]+=1*R,(!h.distance||h[h.distance]<h[String(_)])&&(h.distance=_)),h},{});return d.distance||i}function xC(e){var t=xl(e);return e.host&&(t=t.concat(xl(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(xl(i))},[]))),t}function xl(e){return SC(e).concat(wC(e))}function wC(e){return e.incoming.map(function(t){return t.source})}function SC(e){return e.outgoing.map(function(t){return t.target})}function RC(){return!0}var CC=100;function ng(e,t,n){e.on("autoPlace",CC,function(i){var r=i.shape,o=i.source;return PC(o,r)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,r,o){e.fire("autoPlace.start",{source:i,shape:r});var a=e.fire("autoPlace",{source:i,shape:r}),s=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:s}),s}}ng.$inject=["eventBus","modeling","canvas"];function PC(e,t,n){n||(n={});var i=n.defaultDistance||tg,r=se(e),o=ie(e);return{x:o.right+i+t.width/2,y:r.y}}function ig(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}ig.$inject=["eventBus","selection"];const AC={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ng],autoPlaceSelectionBehavior:["type",ig]};function rg(e,t,n){var i=sd(e,n);if(y(t,"bpmn:TextAnnotation"))return MC(e,t,i);if(ge(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return kC(e,t,i);if(y(t,"bpmn:FlowNode"))return TC(e,t,i)}function TC(e,t,n){var i=ie(e),r=se(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=EC(e,{filter:function(d){return y(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;y(e,"bpmn:BoundaryEvent")&&(u=ut(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+og(u,c,o)}:{x:r.x+og(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return bl(e,t,l,El(f))}function og(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function MC(e,t,n){var i=ie(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};Te(e)&&(r=se(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return bl(e,t,r,El(a))}function kC(e,t,n){var i=ie(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return bl(e,t,r,El(a))}function ag(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return rg(r,i,t)})}ag.$inject=["eventBus","elementRegistry"];const fs={__depends__:[AC],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",ag]},Er={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},DC=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function OC(e){const t=Er;return DC.test(e)?t.cjkEm:e===" "?t.spaceEm:e>="0"&&e<="9"?t.digitEm:e>="A"&&e<="Z"?t.upperEm:e>="a"&&e<="z"?t.lowerEm:t.otherEm}function wl(e,t){let n=0;for(const i of e)n+=t*OC(i);return n}function sg(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&IC(e),LC(e),BC(e),NC(e)}function IC(e){var i;const t=(i=e.HTMLCanvasElement)==null?void 0:i.prototype;if(!t||t.__headlessTextMeasurement)return;t.__headlessTextMeasurement=!0;const n={font:"12px sans-serif",letterSpacing:"0px",measureText(r){var a;const o=Number.parseFloat(((a=String(n.font).match(/(\d+(?:\.\d+)?)px/))==null?void 0:a[1])??"12");return{width:wl(r,o),fontBoundingBoxAscent:o*Er.ascentEm,fontBoundingBoxDescent:o*Er.descentEm,actualBoundingBoxAscent:o*Er.ascentEm,actualBoundingBoxDescent:o*Er.descentEm}}};t.getContext=()=>n}function LC(e){if(e.SVGMatrix)return;class t{constructor(){qi(this,"a",1);qi(this,"b",0);qi(this,"c",0);qi(this,"d",1);qi(this,"e",0);qi(this,"f",0)}static of(i,r,o,a,s,c){return Object.assign(new t,{a:i,b:r,c:o,d:a,e:s,f:c})}multiply(i){return t.of(this.a*i.a+this.c*i.b,this.b*i.a+this.d*i.b,this.a*i.c+this.c*i.d,this.b*i.c+this.d*i.d,this.a*i.e+this.c*i.f+this.e,this.b*i.e+this.d*i.f+this.f)}translate(i,r){return this.multiply(t.of(1,0,0,1,i,r))}scale(i,r=i){return this.multiply(t.of(i,0,0,r,0,0))}inverse(){const i=this.a*this.d-this.b*this.c;return t.of(this.d/i,-this.b/i,-this.c/i,this.a/i,(this.c*this.f-this.d*this.e)/i,(this.b*this.e-this.a*this.f)/i)}}e.SVGMatrix=t}function BC(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,p=Math.cos(l),f=Math.sin(l);a.a=p,a.b=f,a.c=-f,a.d=p,a.e=c-p*c+f*u,a.f=u-f*c-p*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function NC(e){const t=e.SVGElement.prototype;if(!t.getCTM){const n=()=>new e.SVGMatrix;t.getCTM=n,t.getScreenCTM=n}t.getBBox||(t.getBBox=function(){const n=String(this.textContent??"");return{x:0,y:0,width:wl(n,12),height:14}})}const cg=[od,Kr,_l,fs];function $C(e={}){sg(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new ir({container:t,moddleExtensions:e.moddleExtensions??Ko,additionalModules:[...cg,...e.additionalModules??[]]})}var jC=new vr("ov"),FC=500;function st(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=jC,this._overlayDefaults=D({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=HC(n.getContainer()),this._init()}st.$inject=["config.overlays","eventBus","canvas","elementRegistry"],st.prototype.get=function(e){if(Tt(e)&&(e={id:e}),Tt(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?ye(t.overlays,Zi({type:e.type})):t.overlays.slice():[]}else return e.type?ye(this._overlays,Zi({type:e.type})):e.id?this._overlays[e.id]:null},st.prototype.add=function(e,t,n){if(rt(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=D({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},st.prototype.remove=function(e){var t=this.get(e)||[];ae(t)||(t=[t]);var n=this;A(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(mn(i.html),mn(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},st.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},st.prototype.show=function(){ds(this._overlayRoot)},st.prototype.hide=function(){ds(this._overlayRoot,!1)},st.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Xo(this._overlayRoot)},st.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Ue(t);i=o.x,r=o.y}ug(n,i,r),_t(e.html,"data-container-id",t.id)},st.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=Ue(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Ue(i).height:s=i.height,o=t.bottom*-1+s}ug(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},st.prototype._createOverlayContainer=function(e){var t=Ie('<div class="djs-overlays" />');wt(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},st.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";lg(this._overlayRoot,n)},st.prototype._getOverlayContainer=function(e,t){var n=Oe(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},st.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),Tt(i)&&(i=Ie(i)),o=this._getOverlayContainer(n),r=Ie('<div class="djs-overlay" data-overlay-id="'+t+'">'),wt(r,{position:"absolute"}),r.appendChild(i),e.type&&Be(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();ds(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},st.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(Je(r)&&r>t.scale||Je(o)&&o<t.scale))&&(c=!1),ds(a,c),this._updateOverlayScale(e,t)},st.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),Je(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Je(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Je(a)&&(s="scale("+a+","+a+")"),lg(o,s)},st.prototype._updateOverlaysVisibilty=function(e){var t=this;A(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},st.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});A(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){mn(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",FC,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(A(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&Be(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function HC(e){var t=Ie('<div class="djs-overlay-container" />');return wt(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function ug(e,t,n){wt(e,{left:t+"px",top:n+"px"})}function ds(e,t){e.style.display=t===!1?"none":""}function lg(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const hs={__init__:["overlays"],overlays:["type",st]};function Sl(e,t){t.invoke(V,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}X(Sl,V),Sl.$inject=["canvas","injector"];const zC={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Sl]};function xo(e){return CSS.escape(e)}var VC={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function pg(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return VC[t]})}var GC="bjs-breadcrumbs-shown";function fg(e,t,n){var i=Ie('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Be(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=G(u),p=Oe(a,function(f){return f===l});p&&s()});function s(c){c&&(a=WC(c));var u=a.flatMap(function(p){var f=n.findRoot(bn(p))||n.findRoot(p.id);if(!f&&y(p,"bpmn:Process")){var d=t.find(function(_){var R=G(_);return R&&R.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=pg(p.name||p.id),g=Ie('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return g.addEventListener("click",function(){n.setRootElement(f)}),g});i.innerHTML="";var l=u.length>1;o.toggle(GC,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}fg.$inject=["eventBus","elementRegistry","canvas"];function WC(e){for(var t=G(e),n=[],i=t;i;i=i.$parent)(y(i,"bpmn:SubProcess")||y(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function dg(e,t){var n=null,i=new UC;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!y(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}dg.$inject=["eventBus","canvas"];function UC(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}t!==-1&&this._entries.splice(t,1)}}var hg={x:180,y:160};function zi(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}zi.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(i){!i.plane||!i.plane.bpmnElement||(t._processToDiagramMap[i.plane.bpmnElement.id]=i)});var n=e.diagrams.filter(i=>i.plane).flatMap(i=>t._createNewDiagrams(i.plane));n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},zi.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;y(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),YC(a,e)&&i.push({diElement:o,parent:s})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),r},zi.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=qC(e),i={x:n.x-hg.x,y:n.y-hg.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},zi.prototype._moveToDiPlane=function(e,t){var n=mg(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},zi.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},zi.$inject=["eventBus","moddle"];function mg(e){return y(e,"bpmndi:BPMNDiagram")?e:mg(e.$parent)}function qC(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=ie(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),oa(t)}function YC(e,t){var n=e.$parent;return!(!y(n,"bpmn:SubProcess")||n===t.bpmnElement||ge(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var ms=250,KC='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>',XC="bjs-drilldown-empty";function gi(e,t,n,i,r){V.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",ms,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",ms,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],ms,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],ms,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}X(gi,V),gi.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},gi.prototype._canDrillDown=function(e){var t=this._canvas;return y(e,"bpmn:SubProcess")&&t.findRoot(bn(e))},gi.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=G(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Be(i.html).toggle(XC,!r)}},gi.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=G(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=Ie('<button type="button" class="bjs-drilldown">'+KC+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(bn(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},gi.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},gi.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const ZC={__depends__:[hs,nl,zC],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",fg],drilldownCentering:["type",dg],drilldownOverlayBehavior:["type",gi],subprocessCompatibility:["type",zi]};function vi(e){$e.call(this,e)}X(vi,$e),vi.prototype._modules=[od,ZC,hs,Zt,Kr],vi.prototype._moddleExtensions={};var gs="keyboard.keydown",QC="keyboard.keyup",JC=1e3,gg="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function St(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(gg));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}St.$inject=["config.keyboard","eventBus"],St.prototype._keydownHandler=function(e){this._keyHandler(e,gs)},St.prototype._keyupHandler=function(e){this._keyHandler(e,QC)},St.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||gs,i),n&&e.preventDefault()}},St.prototype._isEventIgnored=function(e){return!1},St.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(gg)),this.unbind(),e=this._node=this._target,le.bind(e,"keydown",this._keydownHandler),le.bind(e,"keyup",this._keyupHandler),this._fire("bind")},St.prototype.getBinding=function(){return this._node},St.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),le.unbind(e,"keydown",this._keydownHandler),le.unbind(e,"keyup",this._keyupHandler)),this._node=null},St.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},St.prototype.addListener=function(e,t,n){ot(e)&&(n=t,t=e,e=JC),this._eventBus.on(n||gs,e,t)},St.prototype.removeListener=function(e,t){this._eventBus.off(t||gs,e)},St.prototype.hasModifier=hS,St.prototype.isCmd=Lt,St.prototype.isShift=Wu,St.prototype.isKey=nt;var eP=500;function xr(e,t){var n=this;e.on("editorActions.init",eP,function(i){var r=i.editorActions;n.registerBindings(t,r)})}xr.$inject=["eventBus","keyboard"],xr.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(_S(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(bS(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(mS(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(gS(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(vS(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(yS(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(nt(["+","Add","="],r)&&Lt(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(nt(["-","Subtract"],r)&&Lt(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(nt("0",r)&&Lt(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(nt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Rl={__init__:["keyboard","keyboardBindings"],keyboard:["type",St],keyboardBindings:["type",xr]};var tP={moveSpeed:50,moveSpeedAccelerated:200};function vg(e,t,n){var i=this;this._config=D({},tP,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,u;switch(a.key){case"ArrowLeft":case"Left":u="left";break;case"ArrowUp":case"Up":u="up";break;case"ArrowRight":case"Right":u="right";break;case"ArrowDown":case"Down":u="down";break}return i.moveCanvas({speed:c,direction:u}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,u=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=u;break;case"up":s=u;break;case"right":a=-u;break;case"down":s=-u;break}n.scroll({dx:a,dy:s})}}vg.$inject=["config.keyboardMove","keyboard","canvas"];const yg={__depends__:[Rl],__init__:["keyboardMove"],keyboardMove:["type",vg]};var nP=15;function _g(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=Bi(s),p=an(l,c);if(!n.dragging&&iP(p)>nP&&(n.dragging=!0,u===0&&Wh(e),Va("grab")),n.dragging){var f=n.last||n.start;p=an(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){le.unbind(document,"mousemove",r),le.unbind(document,"mouseup",o),n=null,Gh()}function a(s){if(!Mi(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Bi(s)},le.bind(document,"mousemove",r),le.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}_g.$inject=["eventBus","canvas"];function iP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const bg={__init__:["moveCanvas"],moveCanvas:["type",_g]};function Eg(e,t){var n=zc(e.min),i=zc(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function rP(e,t){return Math.max(e.min,Math.min(e.max,t))}var oP=Math.sign||function(e){return e>=0?1:-1},Cl={min:.2,max:4},xg=10,aP=.1,sP=.75;function wn(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Ct(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||sP;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}wn.$inject=["config.zoomScroll","eventBus","canvas"],wn.prototype.scroll=function(t){this._canvas.scroll(t)},wn.prototype.reset=function(){this._canvas.zoom("fit-viewport")},wn.prototype.zoom=function(t,n){var i=Eg(Cl,xg*2);this._totalDelta+=t,Math.abs(this._totalDelta)>aP&&(this._zoom(t,n,i),this._totalDelta=0)},wn.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Qd()&&t.metaKey,r=t.shiftKey,o=-1*this._scale,a;if(i?o*=t.deltaMode===0?.02:.32:o*=t.deltaMode===0?1:16,i){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*oP(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},wn.prototype.stepZoom=function(t,n){var i=Eg(Cl,xg);this._zoom(t,n,i)},wn.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=zc(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(rP(Cl,s),t)},wn.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&le[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},wn.prototype._init=function(e){this.toggle(e)};const wg={__init__:["zoomScroll"],zoomScroll:["type",wn]};function wo(e){vi.call(this,e)}X(wo,vi),wo.prototype._navigationModules=[yg,bg,wg],wo.prototype._modules=[].concat(vi.prototype._modules,wo.prototype._navigationModules);function Pl(e){return e&&e[e.length-1]}function Sg(e){return e.y}function Rg(e){return e.x}var cP={left:Rg,center:Rg,right:function(e){return e.x+e.width},top:Sg,middle:Sg,bottom:function(e){return e.y+e.height}};function wr(e,t){this._modeling=e,this._rules=t}wr.$inject=["modeling","rules"],wr.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}},wr.prototype._isType=function(e,t){return t.indexOf(e)!==-1},wr.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function p(f,d){return Math.round((f[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=Pl(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(A(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=ln(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Pl(c).center,o;u=t[0],t=ln(t,function(f){return f[i]+f[r]}),l=Pl(t),o[e]=p(u,l)}return o},wr.prototype.trigger=function(e,t){var n=this._modeling,i,r=ye(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),ae(i)&&(r=i),!(r.length<2||!i)){var o=cP[t],a=ln(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const uP={__init__:["alignElements"],alignElements:["type",wr]},lP=new vr;function Sr(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Sr.$inject=["eventBus"],Sr.prototype.schedule=function(e,t=lP.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Sr.prototype._schedule=function(e,t){const n=pP();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(r){n.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:n.promise}},Sr.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Sr.prototype._cancel=function(e){clearTimeout(e.executionId)};function pP(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const fP={scheduler:["type",Sr]};var dP="djs-element-hidden",vs=".entry",hP=1e3,Cg=8,mP=300;function Ye(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Ye.$inject=["canvas","elementRegistry","eventBus","scheduler"],Ye.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=ae(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=ae(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Ye.prototype._createContainer=function(){var e=Ie('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Ye.prototype.registerProvider=function(e,t){t||(t=e,e=hP),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Ye.prototype.getEntries=function(e){var t=this._getProviders(),n=ae(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return A(t,function(r){if(ot(r[n])){var o=r[n](e);ot(o)?i=o(i):A(o,function(a,s){i[s]=a})}}),i},Ye.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=_t(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},mP);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Ye.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(ot(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Ye.prototype.open=function(e,t){if(!(!t&&this.isOpen(e))){var n=this._eventBus.fire("contextPad.open.allowed",{target:e});n!==!1&&(this.close(),this._updateAndOpen(e))}},Ye.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ye.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;A(t,function(r,o){var a=r.group||"default",s=Ie(r.html||'<div class="entry" draggable="true"></div>'),c;_t(s,"data-action",o),c=Ae("[data-group="+xo(a)+"]",n),c||(c=Ie('<div class="group"></div>'),_t(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&gP(s,r.className),r.title&&_t(s,"title",r.title),r.imageUrl&&(i=Ie("<img>"),_t(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Be(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Ye.prototype._createHtml=function(e){var t=this,n=Ie('<div class="djs-context-pad"></div>');return Dt.bind(n,vs,"click",function(i){t.trigger("click",i)}),Dt.bind(n,vs,"dragstart",function(i){t.trigger("dragstart",i)}),Dt.bind(n,vs,"mouseover",function(i){t.trigger("mouseover",i)}),Dt.bind(n,vs,"mouseout",function(i){t.trigger("mouseout",i)}),le.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Ye.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&yP(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Ye.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Ye.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return ae(e)!==ae(n)?!1:ae(e)?e.length===n.length&&Ci(e,function(i){return n.includes(i)}):n===e},Ye.prototype.isShown=function(){return this.isOpen()&&Be(this._current.html).has("open")},Ye.prototype.show=function(){this.isOpen()&&(Be(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Ye.prototype.hide=function(){this.isOpen()&&(Be(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Ye.prototype._getPosition=function(e){if(!ae(e)&&Te(e)){var t=this._canvas.viewbox(),n=vP(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Cg*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Cg*this._canvas.zoom(),top:s.top-a.top}},Ye.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(i){i in n&&(t.style[i]=n[i]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Ye.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=ae(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,dP)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Ye.prototype._getTargetBounds=function(e){var t=this,n=ae(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function gP(e,t){var n=Be(e);t=ae(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function vP(e){return e.waypoints[e.waypoints.length-1]}function yP(e,t){return e=ae(e)?e:[e],t=ae(t)?t:[t],e.length===t.length&&Ci(e,function(n){return t.includes(n)})}const Pg={__depends__:[za,fP,hs],contextPad:["type",Ye]};var ys,Fe,Ag,yi,Tg,Mg,kg,Al,_s,So,Dg,Tl,Ml,kl,bs={},Es=[],_P=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,xs=Array.isArray;function zn(e,t){for(var n in t)e[n]=t[n];return e}function Dl(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Og(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?ys.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return ws(e,a,i,r,null)}function ws(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Ag,__i:-1,__u:0};return r==null&&Fe.vnode!=null&&Fe.vnode(o),o}function Ss(e){return e.children}function Rs(e,t){this.props=e,this.context=t}function Vi(e,t){if(t==null)return e.__?Vi(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Vi(e):null}function bP(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=zn({},t);o.__v=t.__v+1,Fe.vnode&&Fe.vnode(o),Ol(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Vi(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Hg(i,o,r),t.__e=t.__=null,o.__e!=n&&Ig(o)}}function Ig(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Ig(e)}function Lg(e){(!e.__d&&(e.__d=!0)&&yi.push(e)&&!Cs.__r++||Tg!=Fe.debounceRendering)&&((Tg=Fe.debounceRendering)||Mg)(Cs)}function Cs(){try{for(var e,t=1;yi.length;)yi.length>t&&yi.sort(kg),e=yi.shift(),t=yi.length,bP(e)}finally{yi.length=Cs.__r=0}}function Bg(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,g,_,R=i&&i.__k||Es,x=t.length;for(c=EP(n,t,R,c,x),p=0;p<x;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&R[d.__i]||bs,d.__i=p,_=Ol(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Il(f.ref,null,d),l.push(d.ref,d.__c||h,d)),g==null&&h!=null&&(g=h),4&d.__u?(c=Ng(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&_!==void 0?c=_:h&&(c=h.nextSibling),d.__u&=-7);return n.__e=g,c}function EP(e,t,n,i,r){var o,a,s,c,u,l=n.length,p=l,f=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=ws(null,a,null,null,null):xs(a)?a=e.__k[o]=ws(Ss,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=ws(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=xP(a,n,c,p))!=-1&&(p--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?f--:r<l&&f++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?f--:u==c+1?f++:(u>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Vi(s)),Vg(s,s));return i}function Ng(e,t,n){var i,r;if(typeof e.type=="function"){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=Ng(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Vi(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function xP(e,t,n,i){var r,o,a,s=e.key,c=e.type,u=t[n],l=u!=null&&(2&u.__u)==0;if(u===null&&s==null||l&&s==u.key&&c==u.type)return n;if(i>(l?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((u=t[a=r>=0?r--:o++])!=null&&(2&u.__u)==0&&s==u.key&&c==u.type)return a}return-1}function $g(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||_P.test(t)?n:n+"px"}function Ps(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||$g(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||$g(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Dg,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[So]=i[So]:(n[So]=Tl,e.addEventListener(t,o?kl:Ml,o)):e.removeEventListener(t,o?kl:Ml,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function jg(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[_s]==null)t[_s]=Tl++;else if(t[_s]<n[So])return;return n(Fe.event?Fe.event(t):t)}}}function Ol(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,h,g,_,R,x,E,b,S,T,O,C,F,N=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=Fe.__b)&&l(t);e:if(typeof N=="function"){p=a.length;try{if(x=t.props,E=N.prototype&&N.prototype.render,b=(l=N.contextType)&&i[l.__c],S=l?b?b.props.value:l.__:i,n.__c?R=(f=t.__c=n.__c).__=f.__E:(E?t.__c=f=new N(x,S):(t.__c=f=new Rs(x,S),f.constructor=N,f.render=SP),b&&b.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),E&&f.__s==null&&(f.__s=f.state),E&&N.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=zn({},f.__s)),zn(f.__s,N.getDerivedStateFromProps(x,f.__s))),h=f.props,g=f.state,f.__v=t,d)E&&N.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),E&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(E&&N.getDerivedStateFromProps==null&&x!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(x,S),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(x,f.__s,S)===!1){t.__v!=n.__v&&(f.props=x,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(I){I&&(I.__=t)}),Es.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Vi(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(x,f.__s,S),E&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,g,_)})}if(f.context=S,f.props=x,f.__P=e,f.__e=!1,T=Fe.__r,O=0,E)f.state=f.__s,f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),Es.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++O<25);f.state=f.__s,f.getChildContext!=null&&(i=zn(zn({},i),f.getChildContext())),E&&!d&&f.getSnapshotBeforeUpdate!=null&&(_=f.getSnapshotBeforeUpdate(h,g)),C=l!=null&&l.type===Ss&&l.key==null?zg(l.props.children):l,s=Bg(e,xs(C)?C:[C],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),R&&(f.__E=f.__=null)}catch(I){if(a.length=p,t.__v=null,c||o!=null){if(I.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(F=o.length;F--;)Dl(o[F])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),I.then||Fg(t),Fe.__e(I,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=wP(n.__e,t,n,i,r,o,a,c,u);return(l=Fe.diffed)&&l(t),128&t.__u?void 0:s}function Fg(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Fg))}function Hg(e,t,n){for(var i=0;i<n.length;i++)Il(n[i],n[++i],n[++i]);Fe.__c&&Fe.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Fe.__e(o,r.__v)}})}function zg(e){return typeof e!="object"||e==null||e.__b>0?e:xs(e)?e.map(zg):e.constructor!==void 0?null:zn({},e)}function wP(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,g,_=n.props||bs,R=t.props,x=t.type;if(x=="svg"?r="http://www.w3.org/2000/svg":x=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!x&&(x?d.localName==x:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(x==null)return document.createTextNode(R);e=document.createElementNS(r,x,R.is&&R),s&&(Fe.__m&&Fe.__m(t,o),s=!1),o=null}if(x==null)_===R||s&&e.data==R||(e.data=R);else{if(o=x=="textarea"&&R.defaultValue!=null?null:o&&ys.call(e.childNodes),!s&&o!=null)for(_={},u=0;u<e.attributes.length;u++)_[(d=e.attributes[u]).name]=d.value;for(u in _)d=_[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in R||u=="value"&&"defaultValue"in R||u=="checked"&&"defaultChecked"in R||Ps(e,u,null,d,r);for(u in R)d=R[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?g=d:s&&typeof d!="function"||_[u]===d||Ps(e,u,d,_[u],r);if(l)s||p&&(l.__html==p.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(p&&(e.innerHTML=""),Bg(t.type=="template"?e.content:e,xs(f)?f:[f],t,n,i,x=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Vi(n,0),s,c),o!=null)for(u=o.length;u--;)Dl(o[u]);s&&x!="textarea"||(u="value",x=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||x=="progress"&&!h||x=="option"&&h!=_[u])&&Ps(e,u,h,_[u],r),u="checked",g!=null&&g!=e[u]&&Ps(e,u,g,_[u],r))}return e}function Il(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){Fe.__e(r,n)}}function Vg(e,t,n){var i,r;if(Fe.unmount&&Fe.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Il(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Fe.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Vg(i[r],t,n||typeof e.type!="function");n||Dl(e.__e),e.__c=e.__=e.__e=void 0}function SP(e,t,n){return this.constructor(e,n)}function Gg(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Fe.__&&Fe.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Ol(t,e=t.__k=Og(Ss,null,[e]),r||bs,bs,t.namespaceURI,r?null:t.firstChild?ys.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Hg(o,e,a),e.props.children=null}ys=Es.slice,Fe={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},Ag=0,Rs.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=zn({},this.state),typeof e=="function"&&(e=e(zn({},n),this.props)),e&&zn(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Lg(this))},Rs.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Lg(this))},Rs.prototype.render=Ss,yi=[],Mg=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,kg=function(e,t){return e.__v.__b-t.__v.__b},Cs.__r=0,Al=Math.random().toString(8),_s="__d"+Al,So="__a"+Al,Dg=/(PointerCapture)$|Capture$/i,Tl=0,Ml=jg(!1),kl=jg(!0);var Wg=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],s=t[o]?(t[0]|=a?1:2,n[t[o++]]):t[++o];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++o]]=s:a===6?i[1][t[++o]]+=s+"":a?(r=e.apply(s,Wg(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Ug=new Map;function RP(e){var t=Ug.get(this);return t||(t=new Map,Ug.set(this,t)),(t=Wg(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
10
- `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ke=RP.bind(Og),Rr,Ke,Ll,qg,Ro=0,Yg=[],it=Fe,Kg=it.__b,Xg=it.__r,Zg=it.diffed,Qg=it.__c,Jg=it.unmount,ev=it.__;function As(e,t){it.__h&&it.__h(Ke,e,Ro||t),Ro=0;var n=Ke.__H||(Ke.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Bl(e){return Ro=1,CP(nv,e)}function CP(e,t,n){var i=As(Rr++,2);if(i.t=e,!i.__c&&(i.__=[nv(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],u=i.t(c,s);c!==u&&(i.__N=[u,i.__[1]],i.__c.setState({}))}],i.__c=Ke,!Ke.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,s,c,u);return l?f||p:f}return!l||p};Ke.__f=!0;var o=Ke.shouldComponentUpdate,a=Ke.componentWillUpdate;Ke.componentWillUpdate=function(s,c,u){if(this.__e){var l=o;o=void 0,r(s,c,u),o=l}a&&a.call(this,s,c,u)},Ke.shouldComponentUpdate=r}return i.__N||i.__}function Ts(e,t){var n=As(Rr++,3);!it.__s&&jl(n.__H,t)&&(n.__=e,n.u=t,Ke.__H.__h.push(n))}function Nl(e,t){var n=As(Rr++,4);!it.__s&&jl(n.__H,t)&&(n.__=e,n.u=t,Ke.__h.push(n))}function Ms(e){return Ro=5,Vn(function(){return{current:e}},[])}function Vn(e,t){var n=As(Rr++,7);return jl(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Co(e,t){return Ro=8,Vn(function(){return e},t)}function PP(){for(var e;e=Yg.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ks),t.__h.some($l),t.__h=[]}catch(n){t.__h=[],it.__e(n,e.__v)}}}it.__b=function(e){Ke=null,Kg&&Kg(e)},it.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ev&&ev(e,t)},it.__r=function(e){Xg&&Xg(e),Rr=0;var t=(Ke=e.__c).__H;t&&(Ll===Ke?(t.__h=[],Ke.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(ks),t.__h.some($l),t.__h=[],Rr=0)),Ll=Ke},it.diffed=function(e){Zg&&Zg(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Yg.push(t)!==1&&qg===it.requestAnimationFrame||((qg=it.requestAnimationFrame)||AP)(PP)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Ll=Ke=null},it.__c=function(e,t){t.some(function(n){try{n.__h.some(ks),n.__h=n.__h.filter(function(i){return!i.__||$l(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],it.__e(i,n.__v)}}),Qg&&Qg(e,t)},it.unmount=function(e){Jg&&Jg(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{ks(i)}catch(r){t=r}}),n.__H=void 0,t&&it.__e(t,n.__v))};var tv=typeof requestAnimationFrame=="function";function AP(e){var t,n=function(){clearTimeout(i),tv&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);tv&&(t=requestAnimationFrame(n))}function ks(e){var t=Ke,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ke=t}function $l(e){var t=Ke;e.__c=e.__(),Ke=t}function jl(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function nv(e,t){return typeof t=="function"?t(e):t}function TP(e){const{navigationStack:t,setNavigationStack:n}=e,i=Vn(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return ke`
10
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+l+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},yt.prototype._setDefinitions=function(e){this._definitions=e},yt.prototype.getModules=function(){return this._modules},yt.prototype.clear=function(){this.getDefinitions()&&ir.prototype.clear.call(this)},yt.prototype.destroy=function(){ir.prototype.destroy.call(this),pi(this._container)},yt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},yt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},yt.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=nt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},yt.prototype.getDefinitions=function(){return this._definitions},yt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},yt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=O(si(n,["additionalModules"]),{canvas:O({},n.canvas,{container:e}),modules:a});ir.call(this,s),n&&n.container&&this.attachTo(n.container)},yt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},yt.prototype._createContainer=function(e){const t=ut('<div class="bjs-container"></div>');return gn(t,{width:cm(e.width),height:cm(e.height),position:e.position}),t},yt.prototype._createModdle=function(e){const t=O({},this._moddleExtensions,e.moddleExtensions);return new hd(t)},yt.prototype._modules=[];function Ts(e,t){return e.warnings=t,e}function oS(e){const n=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return n&&(e.message="unparsable content <"+n[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+n[2]),e}const aS={width:"100%",height:"100%",position:"relative"};function cm(e){return e+(Ee(e)?"px":"")}function sS(e,t){return t&&ct(e.diagrams,function(n){return n.id===t})||null}function cS(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+rm+"</a>",i=ut(n);gn(nt("svg",i),om),gn(i,am,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Re.bind(i,"click",function(r){rS(),r.preventDefault()})}function lo(e){yt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}ae(lo,yt),lo.prototype._createModdle=function(e){var t=yt.prototype._createModdle.call(this,e);return t.ids=new li([32,36,1]),t},lo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function Fe(e,t){return v(e,"bpmn:CallActivity")?!1:v(e,"bpmn:SubProcess")?(t=t||Ge(e),t&&v(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):v(e,"bpmn:Participant")?!!Z(e).processRef:!0}function Ut(e){if(!(!v(e,"bpmn:Participant")&&!v(e,"bpmn:Lane"))){var t=Ge(e).isHorizontal;return t===void 0?!0:t}}function uS(e){return e&&Z(e).isInterrupting!==!1}function un(e){return e&&!!Z(e).triggeredByEvent}function po(e,t){var n=Z(e).eventDefinitions;return Wi(n,function(i){return v(i,t)})}function lS(e){return po(e,"bpmn:ErrorEventDefinition")}function pS(e){return po(e,"bpmn:EscalationEventDefinition")}function fS(e){return po(e,"bpmn:CompensateEventDefinition")}var Nr={width:90,height:20},um=15;function rr(e){return v(e,"bpmn:Event")||v(e,"bpmn:Gateway")||v(e,"bpmn:DataStoreReference")||v(e,"bpmn:DataObjectReference")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:Group")}function Ms(e){return De(e.label)}function dS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=hS(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=um:a+=um,{x:a,y:s}}function hS(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function dl(e){return e.waypoints?dS(e.waypoints):v(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Nr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Nr.height/2}}function mS(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Nr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=dl(t),i=Nr),O({x:n.x-i.width/2,y:n.y-i.height/2},i)}function lm(e){if(v(e,"bpmn:FlowElement")||v(e,"bpmn:Participant")||v(e,"bpmn:Lane")||v(e,"bpmn:SequenceFlow")||v(e,"bpmn:MessageFlow")||v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))return"name";if(v(e,"bpmn:TextAnnotation"))return"text";if(v(e,"bpmn:Group"))return"categoryValueRef"}function gS(e){var t=e.categoryValueRef;return t&&t.value||""}function Hn(e){var t=e.businessObject,n=lm(t);if(n)return n==="categoryValueRef"?gS(t):t[n]||""}function yS(e,t){var n=e.businessObject,i=lm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function vS(e){return De(e)&&rr(e.labelTarget)}var fo=7;function pm(e){let t=[];return k(e.incoming,n=>{v(n,"bpmn:Association")&&v(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),k(e.outgoing,n=>{v(n,"bpmn:Association")&&v(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function na(e){const t=new Map;return k(al(e),n=>{k(pm(n),i=>{t.has(i.annotation)||t.set(i.annotation,{annotation:i.annotation,associations:[]}),t.get(i.annotation).associations.push(i.association)})}),[...t.values()]}var hl="hsl(225, 10%, 15%)",_S="white";function mi(e,t){return Wi(e.eventDefinitions,function(n){return n.$type===t})}function bS(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function xS(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function je(e,t,n){var i=Ge(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||_S}function ie(e,t,n){var i=Ge(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||hl}function ia(e,t,n,i){var r=Ge(e),o=r.get("label");return i||o&&o.get("color:color")||t||ie(e,n)}function fm(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2,r=[["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]];return Or(r)}function ml(e,t){var n=e.x,i=e.y,r=e.width,o=e.height,a=[["M",n+t,i],["l",r-t*2,0],["a",t,t,0,0,1,t,t],["l",0,o-t*2],["a",t,t,0,0,1,-t,t],["l",t*2-r,0],["a",t,t,0,0,1,-t,-t],["l",0,t*2-o],["a",t,t,0,0,1,t,-t],["z"]];return Or(a)}function wS(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2,s=[["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]];return Or(s)}function ES(e){var t=e.x,n=e.y,i=e.width,r=e.height,o=[["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]];return Or(o)}function ra(e,t={}){return{width:Wn(e,t),height:An(e,t)}}function Wn(e,t={}){return En(t,"width")?t.width:e.width}function An(e,t={}){return En(t,"height")?t.height:e.height}var SS=new li,RS=10,ks=3,CS=1.5,Ds=10,PS=4,ho=.95,AS=1,TS=.25;function Br(e,t,n,i,r,o,a){Ai.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(P){return n.computeStyle(P,{strokeLinecap:"round",strokeLinejoin:"round",stroke:hl,strokeWidth:2,fill:"white"})}function p(P){return n.computeStyle(P,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:hl,strokeWidth:2})}function f(P,_){var{ref:y={x:0,y:0},scale:D=1,element:B,parentGfx:W=r._svg}=_,ce=he("marker",{id:P,viewBox:"0 0 20 20",refX:y.x,refY:y.y,markerWidth:20*D,markerHeight:20*D,orient:"auto"});Ce(ce,B);var Ae=nt(":scope > defs",W);Ae||(Ae=he("defs"),Ce(W,Ae)),Ce(Ae,ce)}function d(P,_,y,D){var B=SS.nextPrefixed("marker-");return h(P,B,_,y,D),"url(#"+B+")"}function h(P,_,y,D,B){if(y==="sequenceflow-end"){var W=he("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:B,stroke:B,strokeWidth:1})});f(_,{element:W,ref:{x:11,y:10},scale:.5,parentGfx:P})}if(y==="messageflow-start"){var ce=he("circle",{cx:6,cy:6,r:3.5,...l({fill:D,stroke:B,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:ce,ref:{x:6,y:6},parentGfx:P})}if(y==="messageflow-end"){var Ae=he("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:D,stroke:B,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:Ae,ref:{x:8.5,y:5},parentGfx:P})}if(y==="association-start"){var Ue=he("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:B,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:Ue,ref:{x:1,y:10},scale:.5,parentGfx:P})}if(y==="association-end"){var pt=he("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:B,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:pt,ref:{x:11,y:10},scale:.5,parentGfx:P})}if(y==="conditional-flow-marker"){var it=he("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:D,stroke:B})});f(_,{element:it,ref:{x:-1,y:10},scale:.5,parentGfx:P})}if(y==="conditional-default-flow-marker"){var It=he("path",{d:"M 6 4 L 10 16",...l({stroke:B,fill:"none"})});f(_,{element:It,ref:{x:0,y:10},scale:.5,parentGfx:P})}}function m(P,_,y,D,B={}){Gt(D)&&(B=D,D=0),D=D||0,B=l(B);var W=_/2,ce=y/2,Ae=he("circle",{cx:W,cy:ce,r:Math.round((_+y)/4-D),...B});return Ce(P,Ae),Ae}function g(P,_,y,D,B,W){Gt(B)&&(W=B,B=0),B=B||0,W=l(W);var ce=he("rect",{x:B,y:B,width:_-B*2,height:y-B*2,rx:D,ry:D,...W});return Ce(P,ce),ce}function R(P,_,y,D){var B=_/2,W=y/2,ce=[{x:B,y:0},{x:_,y:W},{x:B,y},{x:0,y:W}],Ae=ce.map(function(pt){return pt.x+","+pt.y}).join(" ");D=l(D);var Ue=he("polygon",{...D,points:Ae});return Ce(P,Ue),Ue}function w(P,_,y,D){y=p(y);var B=Ko(_,y,D);return Ce(P,B),B}function b(P,_,y){return w(P,_,y,5)}function x(P,_,y){y=p(y);var D=he("path",{...y,d:_});return Ce(P,D),D}function S(P,_,y,D){return x(_,y,O({"data-marker":P},D))}function M(P){return Lt[P]}function I(P){return function(_,y,D){return M(P)(_,y,D)}}var A={"bpmn:MessageEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.235,my:.315}}),W=D?ie(_,c,y.stroke):je(_,s,y.fill),ce=D?je(_,s,y.fill):ie(_,c,y.stroke),Ae=x(P,B,{fill:W,stroke:ce,strokeWidth:1});return Ae},"bpmn:TimerEventDefinition":function(P,_,y={}){var D=y.width||_.width,B=y.height||_.height,W=y.width?1:2,ce=m(P,D,B,.2*B,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke),strokeWidth:W}),Ae=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:B,position:{mx:.5,my:.5}});x(P,Ae,{stroke:ie(_,c,y.stroke),strokeWidth:W});for(var Ue=0;Ue<12;Ue++){var pt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:D,containerHeight:B,position:{mx:.5,my:.5}}),it=D/2,It=B/2;x(P,pt,{strokeWidth:1,stroke:ie(_,c,y.stroke),transform:"rotate("+Ue*30+","+It+","+it+")"})}return ce},"bpmn:EscalationEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?ie(_,c,y.stroke):je(_,s,y.fill);return x(P,B,{fill:W,stroke:ie(_,c,y.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(P,_,y={}){var D=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.222}});return x(P,D,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),W=D?ie(_,c,y.stroke):je(_,s,y.fill);return x(P,B,{fill:W,stroke:ie(_,c,y.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.2,my:.722}}),W=D?ie(_,c,y.stroke):je(_,s,y.fill);return x(P,B,{fill:W,stroke:ie(_,c,y.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),W=D?ie(_,c,y.stroke):"none",ce=x(P,B,{fill:W,stroke:ie(_,c,y.stroke),strokeWidth:1});return nm(ce,45),ce},"bpmn:CompensateEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.22,my:.5}}),W=D?ie(_,c,y.stroke):je(_,s,y.fill);return x(P,B,{fill:W,stroke:ie(_,c,y.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.5,my:.2}}),W=D?ie(_,c,y.stroke):je(_,s,y.fill);return x(P,B,{strokeWidth:1,fill:W,stroke:ie(_,c,y.stroke)})},"bpmn:MultipleEventDefinition":function(P,_,y={},D){var B=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.211,my:.36}}),W=D?ie(_,c,y.stroke):je(_,s,y.fill);return x(P,B,{fill:W,stroke:ie(_,c,y.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(P,_,y={}){var D=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:y.width||_.width,containerHeight:y.height||_.height,position:{mx:.458,my:.194}});return x(P,D,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(P,_,y={}){var D=m(P,_.width,_.height,8,{fill:ie(_,c,y.stroke),stroke:ie(_,c,y.stroke),strokeWidth:4});return D}};function H(P,_,y={},D){var B=Z(P),W=bS(B),ce=D||P;return B.get("eventDefinitions")&&B.get("eventDefinitions").length>1?B.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](_,ce,y,W):A["bpmn:MultipleEventDefinition"](_,ce,y,W):mi(B,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](_,ce,y,W):mi(B,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](_,ce,y,W):mi(B,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](_,ce,y,W):mi(B,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](_,ce,y,W):mi(B,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](_,ce,y,W):mi(B,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](_,ce,y,W):mi(B,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](_,ce,y,W):mi(B,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](_,ce,y,W):mi(B,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](_,ce,y,W):mi(B,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](_,ce,y,W):null}var V={ParticipantMultiplicityMarker:function(P,_,y={}){var D=Wn(_,y),B=An(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:B,position:{mx:(D/2-6)/D,my:(B-15)/B}});S("participant-multiplicity",P,W,{strokeWidth:2,fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke)})},SubProcessMarker:function(P,_,y={}){var D=g(P,14,14,0,{strokeWidth:1,fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke)});Jt(D,_.width/2-7.5,_.height-20);var B=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2-7.5)/_.width,my:(_.height-20)/_.height}});S("sub-process",P,B,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke)})},ParallelMarker:function(P,_,y){var D=Wn(_,y),B=An(_,y),W=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:B,position:{mx:(D/2+y.parallel)/D,my:(B-20)/B}});S("parallel",P,W,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke)})},SequentialMarker:function(P,_,y){var D=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.seq)/_.width,my:(_.height-19)/_.height}});S("sequential",P,D,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke)})},CompensationMarker:function(P,_,y){var D=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+y.compensation)/_.width,my:(_.height-13)/_.height}});S("compensation",P,D,{strokeWidth:1,fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke)})},LoopMarker:function(P,_,y){var D=Wn(_,y),B=An(_,y),W=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:B,position:{mx:(D/2+y.loop)/D,my:(B-7)/B}});S("loop",P,W,{strokeWidth:1.5,fill:"none",stroke:ie(_,c,y.stroke),strokeMiterlimit:.5})},AdhocMarker:function(P,_,y){var D=Wn(_,y),B=An(_,y),W=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:B,position:{mx:(D/2+y.adhoc)/D,my:(B-15)/B}});S("adhoc",P,W,{strokeWidth:1,fill:ie(_,c,y.stroke),stroke:ie(_,c,y.stroke)})}};function $(P,_,y,D){V[P](_,y,D)}function G(P,_,y=[],D={}){D={fill:D.fill,stroke:D.stroke,width:Wn(_,D),height:An(_,D)};var B=Z(_),W=y.includes("SubProcessMarker");W?D={...D,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:D={...D,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},B.get("isForCompensation")&&y.push("CompensationMarker"),v(B,"bpmn:AdHocSubProcess")&&(y.push("AdhocMarker"),W||O(D,{compensation:D.compensation-18}));var ce=B.get("loopCharacteristics"),Ae=ce&&ce.get("isSequential");ce&&(O(D,{compensation:D.compensation-18}),y.includes("AdhocMarker")&&O(D,{seq:-23,loop:-18,parallel:-24}),Ae===void 0&&y.push("LoopMarker"),Ae===!1&&y.push("ParallelMarker"),Ae===!0&&y.push("SequentialMarker")),y.includes("CompensationMarker")&&y.length===1&&O(D,{compensation:-8}),k(y,function(Ue){$(Ue,P,_,D)})}function pe(P,_,y={}){y=O({size:{width:100}},y);var D=o.createText(_||"",y);return He(D).add("djs-label"),Ce(P,D),D}function ze(P,_,y,D={}){var B=Z(_),W=ra({x:_.x,y:_.y,width:_.width,height:_.height},D);return pe(P,B.name,{align:y,box:W,padding:7,style:{fill:ia(_,u,c,D.stroke)}})}function lt(P,_,y={}){var D={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return pe(P,Hn(_),{box:D,style:O({},o.getExternalStyle(),{fill:ia(_,u,c,y.stroke)})})}function Y(P,_,y,D={}){var B=Ut(y),W=pe(P,_,{box:{height:30,width:B?An(y,D):Wn(y,D)},align:"center-middle",style:{fill:ia(y,u,c,D.stroke)}});if(B){var ce=-1*An(y,D);Ps(W,0,-ce,270)}}function fe(P,_,y={}){var{width:D,height:B}=ra(_,y);return g(P,D,B,Ds,{...y,fill:je(_,s,y.fill),fillOpacity:ho,stroke:ie(_,c,y.stroke)})}function de(P,_,y={}){var D=Z(_),B=je(_,s,y.fill),W=ie(_,c,y.stroke);return(D.get("associationDirection")==="One"||D.get("associationDirection")==="Both")&&(y.markerEnd=d(P,"association-end",B,W)),D.get("associationDirection")==="Both"&&(y.markerStart=d(P,"association-start",B,W)),y=We(y,["markerStart","markerEnd"]),b(P,_.waypoints,{...y,stroke:W,strokeDasharray:"0, 5"})}function ue(P,_,y={}){var D=je(_,s,y.fill),B=ie(_,c,y.stroke),W=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),ce=x(P,W,{fill:D,fillOpacity:ho,stroke:B}),Ae=Z(_);if(xS(Ae)){var Ue=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});x(P,Ue,{strokeWidth:2,fill:D,stroke:B})}return ce}function le(P,_,y={}){return m(P,_.width,_.height,{fillOpacity:ho,...y,fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke)})}function ne(P,_,y={}){return R(P,_.width,_.height,{fill:je(_,s,y.fill),fillOpacity:ho,stroke:ie(_,c,y.stroke)})}function z(P,_,y={}){var D=g(P,Wn(_,y),An(_,y),0,{fill:je(_,s,y.fill),fillOpacity:y.fillOpacity||ho,stroke:ie(_,c,y.stroke),strokeWidth:1.5}),B=Z(_);if(v(B,"bpmn:Lane")){var W=B.get("name");Y(P,W,_,y)}return D}function F(P,_,y={}){var D=fe(P,_,y),B=Fe(_);if(un(_)&&(se(D,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!B)){var W=Z(_).flowElements||[],ce=W.filter(Ae=>v(Ae,"bpmn:StartEvent"));ce.length===1&&U(ce[0],P,y,_)}return ze(P,_,B?"center-top":"center-middle",y),B?G(P,_,void 0,y):G(P,_,["SubProcessMarker"],y),D}function U(P,_,y,D){var B=22,W={fill:je(D,s,y.fill),stroke:ie(D,c,y.stroke),width:B,height:B},ce=Z(P).isInterrupting,Ae=ce?0:3,Ue=ce?1:1.2,pt=20,it=(B-pt)/2,It="translate("+it+","+it+")";m(_,pt,pt,{fill:W.fill,stroke:W.stroke,strokeWidth:Ue,strokeDasharray:Ae,transform:It}),H(P,_,W,D)}function Oe(P,_,y={}){var D=fe(P,_,y);return ze(P,_,"center-middle",y),G(P,_,void 0,y),D}var Lt=this.handlers={"bpmn:AdHocSubProcess":function(P,_,y={}){return Fe(_)?y=We(y,["fill","stroke","width","height"]):y=We(y,["fill","stroke"]),F(P,_,y)},"bpmn:Association":function(P,_,y={}){return y=We(y,["fill","stroke"]),de(P,_,y)},"bpmn:BoundaryEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=We(y,["fill","stroke"]);var B=Z(_),W=B.get("cancelActivity");y={strokeWidth:1.5,fill:je(_,s,y.fill),fillOpacity:AS,stroke:ie(_,c,y.stroke)},W||(y.strokeDasharray="6");var ce=le(P,_,y);return m(P,_.width,_.height,ks,{...y,fill:"none"}),D&&H(_,P,y),ce},"bpmn:BusinessRuleTask":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Oe(P,_,y),B=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),W=x(P,B);se(W,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke),strokeWidth:1});var ce=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ae=x(P,ce);return se(Ae,{fill:ie(_,c,y.stroke),stroke:ie(_,c,y.stroke),strokeWidth:1}),D},"bpmn:CallActivity":function(P,_,y={}){return y=We(y,["fill","stroke"]),F(P,_,{strokeWidth:5,...y})},"bpmn:ComplexGateway":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=ne(P,_,y),B=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return x(P,B,{fill:ie(_,c,y.stroke),stroke:ie(_,c,y.stroke),strokeWidth:1}),D},"bpmn:DataInput":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),B=ue(P,_,y);return x(P,D,{fill:"none",stroke:ie(_,c,y.stroke),strokeWidth:1}),B},"bpmn:DataInputAssociation":function(P,_,y={}){return y=We(y,["fill","stroke"]),de(P,_,{...y,markerEnd:d(P,"association-end",je(_,s,y.fill),ie(_,c,y.stroke))})},"bpmn:DataObject":function(P,_,y={}){return y=We(y,["fill","stroke"]),ue(P,_,y)},"bpmn:DataObjectReference":I("bpmn:DataObject"),"bpmn:DataOutput":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=i.getRawPath("DATA_ARROW"),B=ue(P,_,y);return x(P,D,{strokeWidth:1,fill:ie(_,c,y.stroke),stroke:ie(_,c,y.stroke)}),B},"bpmn:DataOutputAssociation":function(P,_,y={}){return y=We(y,["fill","stroke"]),de(P,_,{...y,markerEnd:d(P,"association-end",je(_,s,y.fill),ie(_,c,y.stroke))})},"bpmn:DataStoreReference":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return x(P,D,{fill:je(_,s,y.fill),fillOpacity:ho,stroke:ie(_,c,y.stroke),strokeWidth:2})},"bpmn:EndEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=We(y,["fill","stroke"]);var B=le(P,_,{...y,strokeWidth:4});return D&&H(_,P,y),B},"bpmn:EventBasedGateway":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Z(_),B=ne(P,_,y);m(P,_.width,_.height,_.height*.2,{fill:je(_,"none",y.fill),stroke:ie(_,c,y.stroke),strokeWidth:1});var W=D.get("eventGatewayType"),ce=!!D.get("instantiate");function Ae(){var pt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});x(P,pt,{fill:"none",stroke:ie(_,c,y.stroke),strokeWidth:2})}if(W==="Parallel"){var Ue=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});x(P,Ue,{fill:"none",stroke:ie(_,c,y.stroke),strokeWidth:1})}else W==="Exclusive"&&(ce||m(P,_.width,_.height,_.height*.26,{fill:"none",stroke:ie(_,c,y.stroke),strokeWidth:1}),Ae());return B},"bpmn:ExclusiveGateway":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=ne(P,_,y),B=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),W=Ge(_);return W.get("isMarkerVisible")&&x(P,B,{fill:ie(_,c,y.stroke),stroke:ie(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Gateway":function(P,_,y={}){return y=We(y,["fill","stroke"]),ne(P,_,y)},"bpmn:Group":function(P,_,y={}){return y=We(y,["fill","stroke","width","height"]),g(P,_.width,_.height,Ds,{stroke:ie(_,c,y.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Wn(_,y),height:An(_,y)})},"bpmn:InclusiveGateway":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=ne(P,_,y);return m(P,_.width,_.height,_.height*.24,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke),strokeWidth:2.5}),D},"bpmn:IntermediateEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=We(y,["fill","stroke"]);var B=le(P,_,{...y,strokeWidth:1.5});return m(P,_.width,_.height,ks,{fill:"none",stroke:ie(_,c,y.stroke),strokeWidth:1.5}),D&&H(_,P,y),B},"bpmn:IntermediateCatchEvent":I("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":I("bpmn:IntermediateEvent"),"bpmn:Lane":function(P,_,y={}){return y=We(y,["fill","stroke","width","height"]),z(P,_,{...y,fillOpacity:TS})},"bpmn:ManualTask":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Oe(P,_,y),B=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(P,B,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke),strokeWidth:.5}),D},"bpmn:MessageFlow":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Z(_),B=Ge(_),W=je(_,s,y.fill),ce=ie(_,c,y.stroke),Ae=b(P,_.waypoints,{markerEnd:d(P,"messageflow-end",W,ce),markerStart:d(P,"messageflow-start",W,ce),stroke:ce,strokeDasharray:"10, 11",strokeWidth:1.5});if(D.get("messageRef")){var Ue=Ae.getPointAtLength(Ae.getTotalLength()/2),pt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ue.x,y:Ue.y}}),it={strokeWidth:1};B.get("messageVisibleKind")==="initiating"?(it.fill=W,it.stroke=ce):(it.fill=ce,it.stroke=W);var It=x(P,pt,it),ln=D.get("messageRef"),pn=ln.get("name"),st=pe(P,pn,{align:"center-top",fitBox:!0,style:{fill:ce}}),Nt=It.getBBox(),fn=st.getBBox(),Fo=Ue.x-fn.width/2,dn=Ue.y+Nt.height/2+RS;Ps(st,Fo,dn,0)}return Ae},"bpmn:ParallelGateway":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=ne(P,_,y),B=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return x(P,B,{fill:ie(_,c,y.stroke),stroke:ie(_,c,y.stroke),strokeWidth:1}),D},"bpmn:Participant":function(P,_,y={}){y=We(y,["fill","stroke","width","height"]);var D=z(P,_,y),B=Fe(_),W=Ut(_),ce=Z(_),Ae=ce.get("name");if(B){var Ue=W?[{x:30,y:0},{x:30,y:An(_,y)}]:[{x:0,y:30},{x:Wn(_,y),y:30}];w(P,Ue,{stroke:ie(_,c,y.stroke),strokeWidth:CS}),Y(P,Ae,_,y)}else{var pt=ra(_,y);W||(pt.height=Wn(_,y),pt.width=An(_,y));var it=pe(P,Ae,{box:pt,align:"center-middle",style:{fill:ia(_,u,c,y.stroke)}});if(!W){var It=-1*An(_,y);Ps(it,0,-It,270)}}return ce.get("participantMultiplicity")&&$("ParticipantMultiplicityMarker",P,_,y),D},"bpmn:ReceiveTask":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Z(_),B=Oe(P,_,y),W;return D.get("instantiate")?(m(P,28,28,20*.22,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke),strokeWidth:1}),W=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):W=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(P,W,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke),strokeWidth:1}),B},"bpmn:ScriptTask":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Oe(P,_,y),B=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(P,B,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke),strokeWidth:1}),D},"bpmn:SendTask":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Oe(P,_,y),B=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(P,B,{fill:ie(_,c,y.stroke),stroke:je(_,s,y.fill),strokeWidth:1}),D},"bpmn:SequenceFlow":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=je(_,s,y.fill),B=ie(_,c,y.stroke),W=b(P,_.waypoints,{markerEnd:d(P,"sequenceflow-end",D,B),stroke:B}),ce=Z(_),{source:Ae}=_;if(Ae){var Ue=Z(Ae);ce.get("conditionExpression")&&v(Ue,"bpmn:Activity")&&se(W,{markerStart:d(P,"conditional-flow-marker",D,B)}),Ue.get("default")&&(v(Ue,"bpmn:Gateway")||v(Ue,"bpmn:Activity"))&&Ue.get("default")===ce&&se(W,{markerStart:d(P,"conditional-default-flow-marker",D,B)})}return W},"bpmn:ServiceTask":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Oe(P,_,y);m(P,10,10,{fill:je(_,s,y.fill),stroke:"none",transform:"translate(6, 6)"});var B=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(P,B,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke),strokeWidth:1}),m(P,10,10,{fill:je(_,s,y.fill),stroke:"none",transform:"translate(11, 10)"});var W=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(P,W,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke),strokeWidth:1}),D},"bpmn:StartEvent":function(P,_,y={}){var{renderIcon:D=!0}=y;y=We(y,["fill","stroke"]);var B=Z(_);B.get("isInterrupting")||(y={...y,strokeDasharray:"6"});var W=le(P,_,y);return D&&H(_,P,y),W},"bpmn:SubProcess":function(P,_,y={}){return Fe(_)?y=We(y,["fill","stroke","width","height"]):y=We(y,["fill","stroke"]),F(P,_,y)},"bpmn:Task":function(P,_,y={}){return y=We(y,["fill","stroke"]),Oe(P,_,y)},"bpmn:TextAnnotation":function(P,_,y={}){y=We(y,["fill","stroke"]);var{width:D,height:B}=ra(_,y),W=g(P,D,B,0,0,{fill:"none",stroke:"none"}),ce=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:D,containerHeight:B,position:{mx:0,my:0}});x(P,ce,{stroke:ie(_,c,y.stroke)});var Ae=Z(_),Ue=Ae.get("text")||"";return pe(P,Ue,{align:"left-top",box:ra(_,y),padding:fo,style:{fill:ia(_,u,c,y.stroke)}}),W},"bpmn:Transaction":function(P,_,y={}){Fe(_)?y=We(y,["fill","stroke","width","height"]):y=We(y,["fill","stroke"]);var D=F(P,_,{strokeWidth:1.5,...y}),B=n.style(["no-fill","no-events"],{stroke:ie(_,c,y.stroke),strokeWidth:1.5}),W=Fe(_);return W||(y={}),g(P,Wn(_,y),An(_,y),Ds-ks,ks,B),D},"bpmn:UserTask":function(P,_,y={}){y=We(y,["fill","stroke"]);var D=Oe(P,_,y),B=15,W=12,ce=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:B,y:W}});x(P,ce,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke),strokeWidth:.5});var Ae=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:B,y:W}});x(P,Ae,{fill:je(_,s,y.fill),stroke:ie(_,c,y.stroke),strokeWidth:.5});var Ue=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:B,y:W}});return x(P,Ue,{fill:ie(_,c,y.stroke),stroke:ie(_,c,y.stroke),strokeWidth:.5}),D},label:function(P,_,y={}){return lt(P,_,y)}};this._drawPath=x,this._renderer=M}ae(Br,Ai),Br.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Br.prototype.canRender=function(e){return v(e,"bpmn:BaseElement")},Br.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.getShapePath=function(e){return De(e)?ml(e,PS):v(e,"bpmn:Event")?fm(e):v(e,"bpmn:Activity")?ml(e,Ds):v(e,"bpmn:Gateway")?wS(e):ES(e)};function We(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var MS=0,kS={width:150,height:50};function DS(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function OS(e){return Gt(e)?O({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var gl=null;function LS(){return gl||(gl=document.createElement("canvas").getContext("2d")),gl}function IS(e){var t=[];return e.fontStyle&&t.push(e.fontStyle),e.fontVariant&&t.push(e.fontVariant),e.fontWeight&&t.push(e.fontWeight),e.fontStretch&&t.push(e.fontStretch),t.push(dm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function dm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function NS(e,t){var n=LS();if(!n)return{width:0,height:0};n.font=IS(t),"letterSpacing"in n&&(n.letterSpacing=dm(t.letterSpacing)||"0px");var i=e==="",r=i?"dummy":e.replace(/\s+$/,""),o=n.measureText(r);return{width:i?0:o.width,height:"fontBoundingBoxAscent"in o?o.fontBoundingBoxAscent+o.fontBoundingBoxDescent:o.actualBoundingBoxAscent+o.actualBoundingBoxDescent}}function BS(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=NS(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return $S(e,r,i,o);r=FS(r,o.width,t)}}function $S(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var hm="­";function jS(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,r=[],o=0;if(n.length>1)for(;i=n.shift();)if(i.length+o<t)r.push(i),o+=i.length;else{(i==="-"||i===hm)&&r.pop();break}var a=r[r.length-1];return a&&a===hm&&(r[r.length-1]="-"),r.join("")}function FS(e,t,n){var i=Math.max(e.length*(n/t),1),r=jS(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Os(e){this._config=O({},{size:kS,padding:MS,style:{},align:"center-top"},e||{})}Os.prototype.createText=function(e,t){return this.layoutText(e,t).element},Os.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Os.prototype.layoutText=function(e,t){for(var n=O({},this._config.size,t.box),i=O({},this._config.style,t.style),r=DS(t.align||this._config.align),o=OS(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=HS(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(BS(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Sn(u,function(g,R,w){return g+(s||R.height)},0)+o.top+o.bottom,f=Sn(u,function(g,R,w){return R.width>g?R.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var h=he("text");se(h,i),k(u,function(g){var R;switch(d+=s||g.height,r.horizontal){case"left":R=o.left;break;case"right":R=(a?f:l)-o.right-g.width;break;default:R=Math.max(((a?f:l)-g.width)/2+o.left,0)}var w=he("tspan");se(w,{x:R,y:d}),w.textContent=g.text,Ce(h,w)});var m={width:f,height:p};return{dimensions:m,element:h}};function HS(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var zS=12,VS=1.2,GS=40;function mm(e){var t=O({fontFamily:"Arial, sans-serif",fontSize:zS,fontWeight:"normal",lineHeight:VS},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=O({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Os({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Nr.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:fo});return{x:a.x,y:a.y,width:a.width,height:Math.max(GS,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,O({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}mm.$inject=["config.textRenderer"];function WS(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var p=KS(i.d,{mx:r,my:o,e:a});return p}}var US=/\{([^{}]+)\}/g,YS=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function qS(e,t,n){var i=n;return t.replace(YS,function(r,o,a,s,c){o=o||s,i&&(o in i&&(i=i[o]),typeof i=="function"&&c&&(i=i()))}),i=(i==null||i==n?e:i)+"",i}function KS(e,t){return String(e).replace(US,function(n,i){return qS(n,i,t)})}const XS={__init__:["bpmnRenderer"],bpmnRenderer:["type",Br],textRenderer:["type",mm],pathMap:["type",WS]};function ZS(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const oa={translate:["value",ZS]};function Ls(e,t,n){return O({id:e.id,type:e.$type,businessObject:e,di:t},n)}function QS(e,t,n){var i=e.waypoint;return!i||i.length<2?[be(t),be(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function gm(e,t,n){return new Error(`element ${cn(t)} referenced by ${cn(e)}#${n} not yet drawn`)}function Di(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Di.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Di.prototype.add=function(e,t,n){var i,r,o;if(v(t,"bpmndi:BPMNPlane")){var a=v(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Ls(e,t,a)),this._canvas.addRootElement(i)}else if(v(t,"bpmndi:BPMNShape")){var s=!Fe(e,t),c=eR(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Ls(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),v(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),v(e,"bpmn:Lane")&&(o=0),v(e,"bpmn:DataStoreReference")&&(JS(n,be(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(v(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Ls(e,t,{hidden:r,source:l,target:p,waypoints:QS(t,l,p)})),v(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${cn(t)} for element ${cn(e)}`);return rr(e)&&Hn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Di.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${cn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw gm(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Di.prototype.addLabel=function(e,t,n){var i,r,o;return i=mS(t,n),r=Hn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Ls(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Hn(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},Di.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?gm(e,i,t+"Ref"):new Error(`${cn(e)}#${t} Ref not specified`)},Di.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Di.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Di.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function JS(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function eR(e){return v(e,"bpmn:Group")}const ym={__depends__:[XS,{__depends__:[oa],bpmnImporter:["type",Di]}]};function aa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ri(e,t){return{x:e.x-t.x,y:e.y-t.y}}function yl(e){return Math.log(e)/Math.log(10)}var tR=1e3;function K(e){this._eventBus=e}K.$inject=["eventBus"];function nR(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}K.prototype.on=function(e,t,n,i,r,o){if((Wt(t)||Ee(t))&&(o=r,r=i,i=n,n=t,t=null),Wt(n)&&(o=r,r=i,i=n,n=tR),Gt(r)&&(o=r,r=!1),!Wt(i))throw new Error("handlerFn must be a function");_e(e)||(e=[e]);var a=this._eventBus;k(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?nR(i,o):i,o)})},K.prototype.canExecute=Oi("canExecute"),K.prototype.preExecute=Oi("preExecute"),K.prototype.preExecuted=Oi("preExecuted"),K.prototype.execute=Oi("execute"),K.prototype.executed=Oi("executed"),K.prototype.postExecute=Oi("postExecute"),K.prototype.postExecuted=Oi("postExecuted"),K.prototype.revert=Oi("revert"),K.prototype.reverted=Oi("reverted");function Oi(e){return function(n,i,r,o,a){(Wt(n)||Ee(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var vl=["top","bottom","left","right"],Is=10;function _l(e,t){K.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Ms(r)&&!rt(r)){var o=oR(r);o&&i(r,o)}}function i(r,o){var a=be(r),s=r.label,c=be(s);if(s.parent){var u=ge(r),l;switch(o){case"top":l={x:a.x,y:u.top-Is-s.height/2};break;case"left":l={x:u.left-Is-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Is+s.height/2};break;case"right":l={x:u.right+Is+s.width/2,y:a.y};break}var p=ri(l,c);t.moveShape(s,p)}}}ae(_l,K),_l.$inject=["eventBus","modeling"];function iR(e){var t=e.host,n=be(e),i=Qt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=vl.filter(function(a){return r.indexOf(a)===-1});return o}function rR(e){var t=be(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return vm(t,i)});return n}function oR(e){var t=be(e.label),n=be(e),i=vm(n,t);if(aR(i)){var r=rR(e);if(e.host){var o=iR(e);r=r.concat(o)}var a=vl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Qt(e.label,e)!=="intersect"?void 0:i:a[0]}}function vm(e,t){return Qt(t,e,5)}function aR(e){return vl.indexOf(e)!==-1}function bl(e){K.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(v(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}ae(bl,K),bl.$inject=["eventBus"];var sR=1500;function xl(e,t,n){e.invoke(K,this),this.preExecute("elements.delete",sR,function(r){var o=r.context,a=o.elements,s=i(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=Ie(r,u=>v(u,"bpmn:Participant")||v(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>v(u,"bpmn:Artifact"))),c=new Set;return k(o,u=>{const l=new Set(Qr(so(Array.from(s),At(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ae(xl,K),xl.$inject=["injector","eventBus","canvas"];function wl(e,t){e.invoke(K,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ie(r.incoming.concat(r.outgoing),function(a){return v(a,"bpmn:Association")});k(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}ae(wl,K),wl.$inject=["injector","modeling"];function mo(e,t){for(wn(t)&&(t=[t]);e=e.parent;)if(Le(e,t))return e;return null}function _m(e,t){var n=mo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=mo(e,i),n)return Ut(n);if(Le(e,i))return Ut(e);var r;for(r=Z(e);r&&!v(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=Z(a);return s&&s.get("processRef")===r});return o?Ut(o):!0}var bm=500;function Ns(e,t){t.invoke(K,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",bm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return xm(o,a)}),r.length===1&&r.map(function(o){return r.indexOf(o)}).forEach(function(o){var a=r[o];i.elements[o]=n._replaceShape(r[o],a)})},!0),this.preExecute("elements.move",bm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];xm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Ns.$inject=["bpmnReplace","injector"],ae(Ns,K),Ns.prototype._replaceShape=function(e,t){var n=cR(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function cR(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function xm(e,t){return!De(e)&&Le(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function El(e,t){K.call(this,e);function n(i){return Ie(i.attachers,function(r){return v(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);v(r,"bpmn:EventBasedGateway")&&v(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;v(r,"bpmn:Gateway")&&v(o,"bpmn:EventBasedGateway")&&k(o.outgoing,function(a){var s=a.target,c=n(s);v(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}El.$inject=["eventBus","modeling"],ae(El,K);function wm(e){return e.create("bpmn:Category")}function uR(e){return e.create("bpmn:CategoryValue")}function Em(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=uR(e)),n.$parent||(n.$parent=wm(e)),n}function lR(e,t,n){return St(t.get("categoryValue"),e),e.$parent=t,St(n.get("rootElements"),t),t.$parent=n,e}function pR(e){var t=e.$parent;return t&&(wt(t.get("categoryValue"),e),e.$parent=null),e}function fR(e){var t=e.$parent;return t&&(wt(t.get("rootElements"),e),e.$parent=null),e}var dR=500;function Sl(e,t,n){n.invoke(K,this);function i(c){return t.filter(function(u){return v(u,"bpmn:Group")&&!u.labelTarget}).map(Z).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var p=l.get("categoryValueRef");return p&&p.$parent===c})}function a(c,u){c&&u&&lR(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&fR(u),c&&!r(c,l)&&pR(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,Z(u))},!0),this.executed(["shape.move","shape.resize"],dR,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var u=c.shape;c.categoryValue&&s(c.categoryValue,c.category,Z(u))},!0),this.executed("group.updateRefs",function(c){Sm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Sm(c).forEach(function(u){s(u.categoryValue,u.category,Z(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,Z(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Sl.$inject=["bpmnjs","elementRegistry","injector"],ae(Sl,K);function Sm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Rl(e,t,n){K.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(g){const R=g.source,w=g.target;go(R)&&sa(w)&&l(w)}function r(g){const R=g.connection,w=g.source,b=g.target;go(w)&&Bs(b)&&(u(b),f(w,[R]))}function o(g){const R=g.newTarget,w=g.oldSource,b=g.oldTarget;if(b!==R){const x=w;sa(b)&&l(b),go(x)&&Bs(R)&&u(R)}}function a(g){const{element:R}=g;sa(R)?(p(R),d(R)):Bs(R)&&h(R)}function s(g){const{newData:R,oldShape:w}=g;if(go(g.oldShape)&&R.eventDefinitionType!=="bpmn:CompensateEventDefinition"||R.type!=="bpmn:BoundaryEvent"){const b=w.outgoing.find(({target:x})=>sa(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!go(g.oldShape)&&R.eventDefinitionType==="bpmn:CompensateEventDefinition"&&R.type==="bpmn:BoundaryEvent"){const b=w.outgoing.find(({target:x})=>Bs(x));b&&b.target&&(g._connectionTarget=b.target),m(w)}}function c(g){const{_connectionTarget:R,newShape:w}=g;R&&t.connect(w,R)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function p(g){for(const R of g.incoming)n.canConnect(R.source,g)||t.removeConnection(R);for(const R of g.outgoing)n.canConnect(g,R.target)||t.removeConnection(R)}function f(g,R){g.outgoing.filter(x=>v(x,"bpmn:Association")).filter(x=>sa(x.target)&&!R.includes(x)).forEach(x=>t.removeConnection(x))}function d(g){const R=g.attachers.slice();R.length&&t.removeElements(R)}function h(g){const R=g.incoming.filter(w=>go(w.source));t.removeElements(R)}function m(g){const R=g.outgoing.filter(w=>v(w,"bpmn:SequenceFlow"));t.removeElements(R)}}ae(Rl,K),Rl.$inject=["eventBus","modeling","bpmnRules"];function sa(e){const t=Z(e);return t&&t.get("isForCompensation")}function go(e){return e&&v(e,"bpmn:BoundaryEvent")&&po(e,"bpmn:CompensateEventDefinition")}function Bs(e){return e&&v(e,"bpmn:Activity")&&!un(e)}function Cl(e){e.invoke(K,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;v(i,"bpmn:Lane")&&!v(r,"bpmn:Lane")&&(n.parent=mo(i,"bpmn:Participant"))})}Cl.$inject=["injector"],ae(Cl,K);function Pl(e,t){K.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(v(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}Pl.$inject=["eventBus","bpmnFactory"],ae(Pl,K);var Al=20,Tl=20,Rm=30,$s=2e3;function Ml(e,t,n){K.call(this,t),t.on(["create.start","shape.move.start"],$s,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!v(a,"bpmn:Participant")||!v(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!v(p,"bpmn:Group")&&!De(p)&&!rt(p)});if(c.length){var u=At(c),l=hR(a,u);O(a,l),o.createConstraints=mR(a,u)}}}),t.on("create.start",$s,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}v(a,"bpmn:Participant")&&v(s,"bpmn:Process")&&(t.on("element.hover",$s,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return v(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",$s,function(r){var o=r.elements,a=r.parent,s=gR(o),c;s&&v(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=Z(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;v(a,"bpmn:Participant")&&v(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=Z(a).get("processRef"))},!0),this.execute("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.shape,c=o.participant;a&&(!c||s===c)&&Z(s).set("processRef",Z(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.processRef||o.processRef,c=r.shape,u=o.participant;a&&(!u||c===u)&&Z(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var u=a.children.slice();c?s===c&&n.moveElements(u,{x:0,y:0},c):n.moveElements(u,{x:0,y:0},s)}},!0)}Ml.$inject=["canvas","eventBus","modeling"],ae(Ml,K);function hR(e,t){t={width:t.width+Al*2+Rm,height:t.height+Tl*2};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}function mR(e,t){return t=ge(t),{bottom:t.top+e.height/2-Tl,left:t.right-e.width/2+Al,top:t.bottom-e.height/2+Tl,right:t.left+e.width/2-Al-Rm}}function gR(e){return ct(e,function(t){return v(t,"bpmn:Participant")})}var Cm="__targetRef_placeholder";function kl(e,t){K.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Pm(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Pm(o));function n(a,s,c){var u=a.get("dataInputAssociations");return ct(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=ct(c,function(l){return l.name===Cm});return!u&&s&&(u=t.create("bpmn:Property",{name:Cm}),St(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||wt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,p=l&&l.businessObject,f=s.newTarget,d=f&&f.businessObject,h=s.oldTarget||s.target,m=h&&h.businessObject,g=c.businessObject,R;m&&m!==p&&r(m,u),d&&d!==p&&r(d,u),p?(R=i(p,!0),g.targetRef=R):g.targetRef=null}}kl.$inject=["eventBus","bpmnFactory"],ae(kl,K);function Pm(e){return function(t){var n=t.context,i=n.connection;if(v(i,"bpmn:DataInputAssociation"))return e(t)}}function js(e){this._bpmnUpdater=e}js.$inject=["bpmnUpdater"],js.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},js.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function Dl(e,t,n,i){K.call(this,i),t.registerHandler("dataStore.updateContainment",js);function r(){return n.filter(function(s){return v(s,"bpmn:Participant")&&Z(s).processRef})[0]}function o(s){return s.children.filter(function(c){return v(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Ge(s),newSemanticParent:l.processRef||l,newDiParent:Ge(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(p){return v(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!v(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,p=u.parent;if(!v(l,"bpmn:Collaboration")&&v(u,"bpmn:DataStoreReference")&&u.type!=="label"&&v(p,"bpmn:Collaboration")){var f=v(l,"bpmn:Participant")?l:vR(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Le(u,["bpmn:Participant","bpmn:SubProcess"])&&v(l,"bpmn:Collaboration")&&o(l).filter(function(p){return yR(p,u)}).forEach(function(p){a(p)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,p=o(u);p.forEach(function(f){v(l,"bpmn:Process")&&a(f,l)})})}Dl.$inject=["canvas","commandStack","elementRegistry","eventBus"],ae(Dl,K);function yR(e,t){for(var n=e.businessObject||e,i=t.businessObject||t;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}function vR(e,t){for(;e.parent;){if(v(e.parent,t))return e.parent;e=e.parent}}var Fs=Math.max,Hs=Math.min,_R=20;function Am(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function bR(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return t.indexOf("n")!==-1?(o.y=e.y+r,o.height=e.height-r):t.indexOf("s")!==-1&&(o.height=e.height+r),t.indexOf("e")!==-1?o.width=e.width+i:t.indexOf("w")!==-1&&(o.x=e.x+i,o.width=e.width-i),o}function xR(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}function zs(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Ee(r)&&(i=(/top|left/.test(e)?Hs:Fs)(i,r)),Ee(o)&&(i=(/top|left/.test(e)?Fs:Hs)(i,o)),i}function wR(e,t){if(!t)return e;var n=ge(e);return Ss({top:zs("top",n,t),right:zs("right",n,t),bottom:zs("bottom",n,t),left:zs("left",n,t)})}function ER(e,t,n,i){var r=ge(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?ge(i):o,s={top:Hs(o.top,a.top),left:Hs(o.left,a.left),bottom:Fs(o.bottom,a.bottom),right:Fs(o.right,a.right)};return Ss(s)}function ca(e,t){return typeof e<"u"?e:_R}function SR(e,t){var n,i,r,o;return typeof t=="object"?(n=ca(t.left),i=ca(t.right),r=ca(t.top),o=ca(t.bottom)):n=i=r=o=ca(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function RR(e){return!(e.waypoints||e.type==="label")}function Tm(e,t){var n;if(e.length===void 0?n=Ie(e.children,RR):n=e,n.length)return SR(At(n),t)}var or=Math.abs;function CR(e,t){return Am(ge(t),ge(e))}var PR=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Un=30;function Vs(e,t){return t=t||[],e.children.filter(function(n){v(n,"bpmn:Lane")&&(Vs(n,t),t.push(n))}),t}function ar(e){return e.children.filter(function(t){return v(t,"bpmn:Lane")})}function Yn(e){return mo(e,PR)||e}function AR(e,t){var n=Yn(e),i=v(n,"bpmn:Process")?[]:[n],r=Vs(n,i),o=ge(e),a=ge(t),s=CR(e,t),c=[],u=Ut(e);return r.forEach(function(l){if(l!==e){var p=u?0:s.top,f=u?s.right:0,d=u?0:s.bottom,h=u?s.left:0,m=ge(l);s.top&&(or(m.bottom-o.top)<10&&(d=a.top-m.bottom),or(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(or(m.right-o.left)<10&&(f=a.left-m.right),or(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(or(m.top-o.bottom)<10&&(p=a.bottom-m.top),or(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(or(m.left-o.right)<10&&(h=a.right-m.left),or(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:xR(l,{top:p,right:f,bottom:d,left:h})})}}),c}var TR=500;function Ol(e,t){K.call(this,e);function n(i,r){var o=Ut(i),a=ar(r),s=[],c=[],u=[],l=[];if(Lr(a,function(g){return o?g.y>i.y?c.push(g):s.push(g):g.x>i.x?l.push(g):u.push(g),g.children}),!!a.length){var p;o?c.length&&s.length?p=i.height/2:p=i.height:l.length&&u.length?p=i.width/2:p=i.width;var f,d,h,m;s.length&&(f=t.calculateAdjustments(s,"y",p,i.y-10),t.makeSpace(f.movingShapes,f.resizingShapes,{x:0,y:p},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-p,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-p},"n")),u.length&&(h=t.calculateAdjustments(u,"x",p,i.x-10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:p,y:0},"e")),l.length&&(m=t.calculateAdjustments(l,"x",-p,i.x+i.width+10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",TR,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;v(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Ol.$inject=["eventBus","spaceTool"],ae(Ol,K);var Mm=500;function Gs(e,t){t.invoke(K,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Mm,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return km(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Mm,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;km(a,kR(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Gs.$inject=["bpmnReplace","injector"],ae(Gs,K),Gs.prototype._replaceShape=function(e){var t=MR(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function MR(e){var t=Z(e),n=t.eventDefinitions;return n&&n[0]}function km(e,t){return!De(e)&&v(e,"bpmn:BoundaryEvent")&&!t}function kR(e,t){return e.indexOf(t)!==-1}var Ws=Math.round,DR=Math.max;function OR(e,t){var n=e.x,i=e.y;return[["M",n,i],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}function LR(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Dm=10;function IR(e,t){var n,i;for(n=0;i=e[n];n++)if(Qo(i,t)<=Dm)return{point:e[n],bendpoint:!0,index:n};return null}function NR(e,t){var n=Bh(OR(t,Dm),LR(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=DR(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ws(i.x+r.x)/2,y:Ws(i.y+r.y)/2},index:i.segment2}:{point:{x:Ws(i.x),y:Ws(i.y)},index:i.segment2}:null}function Ll(e,t){return IR(e,t)||NR(e,t)}function Il(e,t,n){K.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,p,f,d,h,m=r.outgoing.slice(),g=r.incoming.slice(),R;Ee(a.width)?R=be(a):R=a;var w=Ll(s,R);if(w){if(c=s.slice(0,w.index),u=s.slice(w.index+(w.bendpoint?1:0)),!c.length||!u.length)return;l=w.bendpoint?s[w.index]:R,(c.length===1||!Om(r,c[c.length-1]))&&c.push(Lm(l)),(u.length===1||!Om(r,u[0]))&&u.unshift(Lm(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||R),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||R),h=o));var b=[].concat(d&&Ie(g,function(x){return x.source===d.source})||[],h&&Ie(m,function(x){return x.target===h.target})||[]);b.length&&n.removeElements(b)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=be(c),l={x:u.x+s.x,y:u.y+s.y},p=ct(o.children,function(f){var d=t.canInsert(a,f);return d&&Ll(f.waypoints,l)});p&&(r.targetFlow=p,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}ae(Il,K),Il.$inject=["eventBus","bpmnRules","modeling"];function Om(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function Lm(e){return O({},e)}function Nl(e,t){K.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&yo(r)){var c=[];v(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&yo(u)):c=a.incoming.filter(u=>u!==r&&yo(u)&&v(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(v(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(yo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(yo).forEach(function(s){const c=a.incoming.filter(yo).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Nl.$inject=["eventBus","modeling"],ae(Nl,K);function yo(e){return v(e,"bpmn:SequenceFlow")}var Us=1500,Im=2e3;function Nm(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],Us,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;v(a,"bpmn:Lane")&&!Le(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Yn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Le(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Us,function(i){var r=i.hover;v(r,"bpmn:Lane")&&(i.hover=Yn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Us,function(i){var r=i.context,o=i.hover,a=r.type;v(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Yn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Us,function(i){var r=i.context,o=r.start;v(o,"bpmn:Lane")&&(r.start=Yn(o)||o)}),t.on("shape.move.start",Im,function(i){var r=i.shape;v(r,"bpmn:Lane")&&(i.shape=Yn(r)||r)}),t.on("spaceTool.move",Im,function(i){var r=i.hover;r&&v(r,"bpmn:Lane")&&(i.hover=Yn(r))})}Nm.$inject=["elementRegistry","eventBus","canvas"];var Bm=770;function Bl(e,t,n,i){n.invoke(K,this);function r(s,c){var u=Z(s),l=c.categoryValue||u.categoryValueRef;l||(l=Em(e,u));var p=c.category||l.$parent||wm(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=Z(s),l=c.categoryValue||u.categoryValueRef,p=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=p,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;v(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=Z(u);if(!(!v(u,"bpmn:Group")||u.labelTarget)){var p=c.categoryValue=l.categoryValueRef;p&&(c.category=p.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=Z(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!v(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!Z(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||Z(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!v(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",Bm,function(s){var c=s.descriptor,u=s.element;if(!(!v(u,"bpmn:Group")||u.labelTarget)){var l=Z(u);if(l.categoryValueRef){var p=l.categoryValueRef;c.categoryValue=a(p,!0),p.$parent&&(c.category=a(p.$parent,!0))}}}),t.on("copyPaste.pasteElement",Bm,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,p=c.category;l&&(l=u.categoryValueRef=a(l)),p&&(l.$parent=a(p)),delete c.category,delete c.categoryValue})}Bl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ae(Bl,K);function $l(e,t,n,i){var r,o,a,s,c;return r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y),r==0?null:(o=e.y-n.y,a=e.x-n.x,c=(i.x-n.x)*o-(i.y-n.y)*a,s=c/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function $m(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=$l(i,r,o,a),u=$l(i,r,o,s),l;c&&u?jm(c,o)>jm(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],be(i.source)),t(r[r.length-1],r[r.length-2],be(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}$m.$inject=["eventBus"];function jm(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function jl(e){K.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,r=Z(i),o=Ge(i);if(Le(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}jl.$inject=["eventBus"],ae(jl,K);function Fm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Hm(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function BR(e,t){return t?{x:Math.cos(t)*e.x-Math.sin(t)*e.y,y:Math.sin(t)*e.x+Math.cos(t)*e.y}:e}function $R(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}],r=i[0].n*t[0]+i[1].n*t[1],o=i[0].lambda*t[0]+i[1].lambda*t[1];return-r/o}function Fl(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=$R([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function zm(e,t){var n=Fl(e,t),i={x:n.x-e.x,y:n.y-e.y};return Fm(i)}function ua(e,t){return Fm({x:e.x-t.x,y:e.y-t.y})}var Vm=Math.sqrt,Gm=Math.min,jR=Math.max,Wm=Math.abs;function Um(e){return Math.pow(e,2)}function la(e,t){return Vm(Um(e.x-t.x)+Um(e.y-t.y))}function FR(e,t){var n=0,i,r,o,a,s,c,u,l,p,f,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],qm(i,r)?u=[i]:(o=la(e,i),a=la(e,r),c=Gm(o,a),u=HR(i,r,e,c)),u.length<1)throw new Error("expected between [1, 2] circle -> line intersections");u.length===1&&(l={type:"bendpoint",position:u[0],segmentIndex:n,bendpointIndex:qm(i,u[0])?n:n+1}),u.length===2&&(s=VR(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:la(i,s)/la(i,r)}),p=la(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function HR(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,p=u/c,f=l/c,d=p*p-f;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var h=Vm(d),m=-p+h,g=-p-h,R={x:e.x-r*m,y:e.y-o*m};if(d===0)return[R];var w={x:e.x-r*g,y:e.y-o*g};return[R,w].filter(function(b){return zR(b,e,t)})}function zR(e,t,n){return Ym(e.x,t.x,n.x)&&Ym(e.y,t.y,n.y)}function Ym(e,t,n){return e>=Gm(t,n)-Ys&&e<=jR(t,n)+Ys}function VR(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Ys=.1;function qm(e,t){return Wm(e.x-t.x)<=Ys&&Wm(e.y-t.y)<=Ys}function GR(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var p=Xm(t,u);p<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Km(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=FR(e,n),c=s.segmentIndex,u=GR(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Zm(n,c),p=Zm(t,u),f=s.position,d=UR(l,f),h=WR(l,p);if(s.type==="bendpoint"){var m=t.length-n.length,g=s.bendpointIndex,R=n[g];if(t.indexOf(R)!==-1)return a;if(m===0){var w=t[g];return r=w.x-s.position.x,o=w.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}m<0&&g!==0&&g<n.length-1&&(d=Xm(n,g))}var b={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},x=BR({x:e.x-f.x,y:e.y-f.y},h);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:Mi(b),delta:Mi({x:r,y:o})}}function Xm(e,t){var n=ua(e[t-1],e[t]),i=ua(e[t],e[t+1]),r=n/(n+i);return r}function WR(e,t){var n=Hm(e),i=Hm(t);return i-n}function Zm(e,t){return[e[t],e[t+1]]}function UR(e,t){var n=ua(e[0],e[1]),i=ua(e[0],t);return n===0?0:i/n}function YR(e,t,n,i){var r=be(e);return Km(r,t,n,i).delta}function pa(e,t,n){var i=aa(t),r=aa(n),o=ri(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Mi({x:r.x+a.x,y:r.y+a.y})}function Qm(e,t,n){var i=aa(e),r=aa(t),o=aa(n),a=ri(e,i),s=ri(i,r),c=qR(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return Mi({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function qR(e,t,n){var i=ge(t),r=ge(n);if(KR(i,r))return null;var o=Qt(t,e),a,s,c;if(o==="top")a={x:0,y:r.bottom-i.bottom};else if(o==="bottom")a={x:0,y:r.top-i.top};else if(o==="right")a={x:r.left-i.left,y:0};else if(o==="left")a={x:r.right-i.right,y:0};else return null;return s={x:e.x+a.x,y:e.y+a.y},c=Qt(n,s),c!==o?null:a}function KR(e,t){return XR(e,t)||ZR(e,t)}function XR(e,t){return e.right!==t.right&&e.left!==t.left}function ZR(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Jm="name",eg="text";function Hl(e,t,n,i){K.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{Z(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(Jm in u&&t.updateLabel(c,u[Jm]),eg in u&&v(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[eg]||"");t.updateLabel(c,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;De(u)||!rr(u)||Hn(u)&&t.updateLabel(u,Hn(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=O({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),YR(u,p,f,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,p;!l||!l.parent||(p=o(a),t.moveShape(l,p))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=Z(c);l&&rr(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!De(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(Hn(c)||"",{box:l,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=l.y!==c.y,h=c.y+c.height;s.newBounds={width:l.width,height:f,x:l.x,y:d?h-f:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Ms(c)){var p=c.label,f=be(p),d=eC(l),h=JR(f,d),m=QR(h,l,u);t.moveShape(p,m)}})}ae(Hl,K),Hl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function QR(e,t,n){var i=pa(e,t,n);return Mi(ri(i,e))}function JR(e,t){if(t.length){var n=tC(e,t);return Fl(e,n)}}function eC(e){return[[{x:e.x,y:e.y},{x:e.x+(e.width||0),y:e.y}],[{x:e.x+(e.width||0),y:e.y},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y+(e.height||0)},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y},{x:e.x,y:e.y+(e.height||0)}]]}function tC(e,t){var n=t.map(function(r){return{line:r,distance:zm(e,r)}}),i=ai(n,"distance");return i[0].line}function nC(e,t,n,i){return Km(e,t,n,i).point}function zl(e,t){K.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=O({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),nC(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),p=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,p)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),p=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,p)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],p={x:l.x+c.x,y:l.y+c.y},f=[].concat(u.waypoints.slice(0,-1),[p]);t.updateWaypoints(u,f)}),a.forEach(function(u){var l=u.waypoints[0],p={x:l.x+c.x,y:l.y+c.y},f=[].concat([p],u.waypoints.slice(1));t.updateWaypoints(u,f)})})}ae(zl,K),zl.$inject=["eventBus","modeling"];function qs(e,t,n){var i=Xs(e),r=ng(i,t),o=i[0];return r.length?r[r.length-1]:pa(o.original||o,n,t)}function Ks(e,t,n){var i=Xs(e),r=ng(i,t),o=i[i.length-1];return r.length?r[0]:pa(o.original||o,n,t)}function Vl(e,t,n){var i=Xs(e),r=tg(t,n),o=i[0];return pa(o.original||o,r,t)}function Gl(e,t,n){var i=Xs(e),r=tg(t,n),o=i[i.length-1];return pa(o.original||o,r,t)}function tg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Xs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function ng(e,t){var n=on(e,rC);return Ie(n,function(i){return iC(i,t)})}function iC(e,t){return Qt(t,e,1)==="intersect"}function rC(e){return e.original||e}function Wl(e,t){K.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(oC(i,r)){var o=aC(i);o.incoming.forEach(function(a){var s=Ks(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=qs(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Wl.$inject=["eventBus","modeling"],ae(Wl,K);function oC(e,t){return v(e,"bpmn:Participant")&&Fe(e)&&v(t,"bpmn:Participant")&&!Fe(t)}function aC(e){var t=Xo([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){v(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){v(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const sC=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function ig(e){const t=Z(e);if(!v(t,"bpmn:BoundaryEvent")&&!(v(t,"bpmn:StartEvent")&&un(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:sC.some(i=>v(n[0],i))}function rg(e){return v(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Ul(e,t){e.invoke(K,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!ig(r))return;const a=rg(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=Z(i).get(a),u=Z(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Ul.$inject=["injector","modeling"],ae(Ul,K);function Yl(e,t){K.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ge(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ae(Yl,K),Yl.$inject=["eventBus","modeling"];function ql(e,t,n){K.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!v(o,"bpmn:SequenceFlow")||!v(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=cC(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ae(ql,K),ql.$inject=["eventBus","bpmnRules","modeling"];function vo(e){return e.original||e}function cC(e,t){var n=$l(vo(e[e.length-2]),vo(e[e.length-1]),vo(t[1]),vo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[vo(e[0]),vo(t[t.length-1])]}function Kl(e,t){K.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;v(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}Kl.$inject=["eventBus","modeling"],ae(Kl,K);function Xl(e,t,n,i){K.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,p=c.parent;if(p){var f,d;v(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),v(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(f="bpmn:SequenceFlow")),d&&t.removeConnection(c),f&&t.connect(u,l,{type:f,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,p=u.newSource||l.source,f=u.newTarget||l.target,d,h;d=n.canConnect(p,f),!(!d||d.type===l.type)&&(h=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=h,r&&s(l,h))}function s(c,u){var l=r.context(),p=l&&l.payload.previousSelection,f;!p||!p.length||(f=p.indexOf(c),f!==-1&&p.splice(f,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;k(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,p=u.element,f=p.businessObject,d;l.default&&(d=ct(p.outgoing,eo({id:p.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&f.sourceRef.default===f&&t.updateProperties(p.source,{default:void 0})})}ae(Xl,K),Xl.$inject=["eventBus","modeling","bpmnRules","injector"];function Zs(e,t,n,i,r,o){i.invoke(K,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=Sn(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];k(s.closure.topLevel,function(f){un(f)?l=l.concat(f.children):l=l.concat(f)}),l.length===1&&u&&(c=u);var p=t.canReplace(l,c);p&&this._replaceElements(l,p.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,p;l&&l.length&&(p=t.canReplace(l,u),this._replaceElements(l,p.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}ae(Zs,K),Zs.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;k(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},Zs.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var uC=1500,lC={width:140,height:120},Zl={width:300,height:60},Ql={width:60,height:300},Qs={width:300,height:150},Js={width:150,height:300},og={width:140,height:120},ag={width:100,height:40};function sg(e){e.on("resize.start",uC,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(v(i,"bpmn:Lane")||v(i,"bpmn:Participant"))&&(n.resizeConstraints=mC(i,r,o)),v(i,"bpmn:SubProcess")&&Fe(i)&&(n.minDimensions=og),v(i,"bpmn:TextAnnotation")&&(n.minDimensions=ag)})}sg.$inject=["eventBus"];var sr=Math.abs,pC=Math.min,fC=Math.max;function cg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function _o(e,t,n){return cg(e,t,n,pC)}function bo(e,t,n){return cg(e,t,n,fC)}var dC={top:20,left:50,right:20,bottom:20},hC={top:50,left:20,right:20,bottom:20};function mC(e,t,n){var i=Yn(e),r=!0,o=!0,a=Vs(i,[i]),s=ge(e),c={},u={},l=Ut(e),p=l?Zl:Ql;/n/.test(t)?u.top=s.bottom-p.height:/e/.test(t)?u.right=s.left+p.width:/s/.test(t)?u.bottom=s.top+p.height:/w/.test(t)&&(u.left=s.right-p.width),a.forEach(function(h){var m=ge(h);l?(m.top<s.top-10&&(r=!1),m.bottom>s.bottom+10&&(o=!1)):(m.left<s.left-10&&(r=!1),m.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&sr(s.top-m.bottom)<10&&bo(c,"top",m.top+p.height),sr(s.top-m.top)<5&&_o(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&sr(s.right-m.left)<10&&_o(c,"right",m.right-p.width),sr(s.right-m.right)<5&&bo(u,"right",m.left+p.width)),/s/.test(t)&&(n&&sr(s.bottom-m.top)<10&&_o(c,"bottom",m.bottom-p.height),sr(s.bottom-m.bottom)<5&&bo(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&sr(s.left-m.right)<10&&bo(c,"left",m.left+p.width),sr(s.left-m.left)<5&&_o(u,"left",m.right-p.width))});var f=i.children.filter(function(h){return!h.hidden&&!h.waypoints&&(v(h,"bpmn:FlowElement")||v(h,"bpmn:Artifact"))}),d=l?dC:hC;return f.forEach(function(h){var m=ge(h);/n/.test(t)&&(!l||r)&&_o(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&bo(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&bo(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&_o(u,"left",m.left-d.left)}),{min:u,max:c}}function ug(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function xo(e){return e.originalEvent||e.srcEvent}function Jl(e){ug(e),ug(xo(e))}function $r(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function lg(){return/mac/i.test(navigator.platform)}function pg(e,t){return(xo(e)||e).button===t}function cr(e){return pg(e,0)}function gC(e){return pg(e,1)}function fa(e){var t=xo(e)||e;return cr(e)?lg()?t.metaKey:t.ctrlKey:!1}function ec(e){var t=xo(e)||e;return cr(e)&&t.shiftKey}var fg=1001;function dg(e,t){e.on("resize.start",fg+500,function(n){var i=n.context,r=i.shape;(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))&&(i.balanced=!fa(n))}),e.on("resize.end",fg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(v(r,"bpmn:Lane")||v(r,"bpmn:Participant"))return o&&(a=zh(a),t.resizeLane(r,a,i.balanced)),!1})}dg.$inject=["eventBus","modeling"];var yC=500;function ep(e,t,n,i,r){n.invoke(K,this);function o(l){return Le(l,["bpmn:ReceiveTask","bpmn:SendTask"])||vC(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!ct(f,eo({id:l.id}))}function s(l){if(v(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(v(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(v(l,"bpmn:MessageEventDefinition"))return"messageRef";if(v(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(Le(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var p=l.get("eventDefinitions"),f=p[0];return f.get(s(f))}function u(l,p){if(Le(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",p);var f=l.get("eventDefinitions"),d=f[0];return d.set(s(d),p)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.shape||l.element;if(o(p)){var f=Z(p),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),St(h,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");wt(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=Z(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",yC,function(l){var p=l.descriptor,f=p.businessObject,d=p.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(f,d),delete p.referencedRootElement)})}ep.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ae(ep,K);function vC(e,t){return _e(t)||(t=[t]),Wi(t,function(n){return po(e,n)})}var hg=Math.max;function mg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return k(n,function(a){var s=a.id;v(a,"bpmn:Participant")&&(o[s]=bC(a,i,r)),v(a,"bpmn:Lane")&&(o[s]=Ut(a)?Zl:Ql),v(a,"bpmn:SubProcess")&&Fe(a)&&(o[s]=og),v(a,"bpmn:TextAnnotation")&&(o[s]=ag),v(a,"bpmn:Group")&&(o[s]=lC)}),o})}mg.$inject=["eventBus"];function _C(e){return e==="x"}function bC(e,t,n){var i=Ut(e);if(!EC(e))return i?Qs:Js;var r=_C(t),o={};return r?i?o=Qs:o={width:wC(e,n,r),height:Js.height}:i?o={width:Qs.width,height:xC(e,n,r)}:o=Js,o}function xC(e,t,n){var i;return i=SC(e,t,n),hg(Qs.height,i)}function wC(e,t,n){var i;return i=RC(e,t,n),hg(Js.width,i)}function EC(e){return!!ar(e).length}function SC(e,t,n){var i=ar(e),r;return r=tp(i,t,n),e.height-r.height+Zl.height}function RC(e,t,n){var i=ar(e),r;return r=tp(i,t,n),e.width-r.width+Ql.width}function tp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=ar(r),o.length?tp(o,t,n):r}var gg="_plane";function yg(e){var t=e.id;return CC(t)}function gi(e){var t=e.id;return v(e,"bpmn:SubProcess")?vg(t):t}function jr(e){return vg(e)}function tc(e){var t=Ge(e);return v(t,"bpmndi:BPMNPlane")}function vg(e){return e+gg}function CC(e){return e.replace(new RegExp(gg+"$"),"")}var _g=400,PC=600,bg={x:180,y:160};function Li(e,t,n,i,r,o,a){K.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return v(p,"bpmn:SubProcess")&&!Fe(p)}function u(p){var f=p.shape,d=p.newRootElement,h=Z(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=Z(f);s._removeDiagram(d);var h=p.newRootElement=a.get(gi(d));e.removeRootElement(h)}this.executed("shape.create",function(p){var f=p.shape;c(f)&&u(p)},!0),this.postExecuted("elements.create",function(p){var f=p.elements;k(f,function(d){if(c(d)){var h=a.get(gi(d));if(!(!h||!d.children||!d.children.length)){var m=xg(d);s._showRecursively(m),s._moveChildrenToShape(m,h)}}})},!0),this.reverted("shape.create",function(p){var f=p.shape;c(f)&&l(p)},!0),this.preExecute("shape.delete",function(p){var f=p.shape;!v(f,"bpmn:SubProcess")||!Fe(f)||k(na([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get(gi(f));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(p){var f=p.shape;c(f)&&l(p)},!0),this.reverted("shape.delete",function(p){var f=p.shape;c(f)&&u(p)},!0),this.preExecuted("shape.replace",function(p){var f=p.oldShape,d=p.newShape;!c(f)||!c(d)||(p.oldRoot=e.removeRootElement(gi(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(gi(f));if(!(!d||!h)){var m=d.children;n.moveElements(m,{x:0,y:0},h)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(v(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(tc(f)){a.updateId(f,jr(g)),a.updateId(m,g);return}var R=a.get(jr(m));R&&a.updateId(jr(m),jr(g))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(v(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(tc(f)){a.updateId(f,jr(m)),a.updateId(g,m);return}var R=a.get(jr(g));R&&a.updateId(R,jr(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(tc(f)){var d=f,h=a.get(yg(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",_g,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&(Fe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",_g,function(p){var f=p.shape;v(f,"bpmn:SubProcess")&&(Fe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",PC,function(p){var f=p.shape;if(v(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Fe(f))s._moveChildrenToShape(d.children.slice(),f),k(na(f.children),m=>{n.moveShape(m.annotation,{x:0,y:0},f.parent),k(m.associations,g=>{n.moveConnection(g,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=xg(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=gi(f),m=a.get(h);m&&d.push.apply(d,m.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,h=p.elements,m=d.parent,g=v(Ge(m),"bpmndi:BPMNPlane");if(g){var R=yg(m),w=ct(h,function(b){return b.id===R});w&&(f.parent=w.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}ae(Li,K),Li.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=At(i),o;if(!t.x)o={x:bg.x-r.x,y:bg.y-r.y};else{var a=be(t),s=be(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Li.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(pm(e).map(i=>i.annotation));n.size&&k(na(e.children),i=>{n.has(i.annotation)&&k(i.associations,r=>{t.removeConnection(r)})})},Li.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},Li.prototype._addDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),n.push(e.di.$parent),e},Li.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:gi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Li.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=ct(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Li.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function AC(e){var t=[];return k(na(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function xg(e){return e.children.slice().concat(AC(e.children)).concat(TC(e))}function TC(e){return al(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function np(e,t){e.invoke(K,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!v(r,"bpmn:SubProcess")||v(r,"bpmn:AdHocSubProcess")||!(v(i,"bpmn:Task")||v(i,"bpmn:CallActivity"))||!Fe(r))){var o=MC(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}np.$inject=["injector","modeling"],ae(np,K);function MC(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function ip(e,t){K.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;v(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&v(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!v(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,Hn(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}ae(ip,K),ip.$inject=["eventBus","textRenderer"];function rp(e,t){K.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Fe(i))return;var r=Xo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();k(s,function(u){o(u,!0)}),k(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||v(a,"bpmn:Association")&&(v(a.source,"bpmn:TextAnnotation")||v(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,be(i)):t.reconnectStart(a,i,be(i)))}},!0)}ae(rp,K),rp.$inject=["eventBus","modeling"];var op=500;function ap(e,t,n){K.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,p;return l=kC(c).concat([a]),p=Tm(l),p?(u.width=Math.max(p.width,u.width),u.height=Math.max(p.height,u.height),u.x=p.x+(p.width-u.width)/2,u.y=p.y+(p.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],op,function(a){var s=a.context,c=s.shape;v(c,"bpmn:SubProcess")&&(c.collapsed?Ge(c).isExpanded=!1:(i(c.children),Ge(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],op,function(a){var s=a.context,c=s.shape;c.collapsed?Ge(c).isExpanded=!1:Ge(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],op,function(a){var s=a.context.shape,c=t.getDefaultSize(s),u;s.collapsed?u=o(s,c):u=r(s,c),n.resizeShape(s,u,null,{autoResize:s.collapsed?!1:"nwse"})})}ae(ap,K),ap.$inject=["eventBus","elementFactory","modeling"];function kC(e){return e.filter(function(t){return!t.hidden})}function sp(e,t,n,i){t.invoke(K,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;De(a)||(v(a,"bpmn:Participant")&&Fe(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;v(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}ae(sp,K),sp.$inject=["canvas","injector","moddle","modeling"];function cp(e,t){K.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;DC(r,o)&&t.updateProperties(o,{default:null})})}ae(cp,K),cp.$inject=["eventBus","modeling"];function DC(e,t){if(!v(e,"bpmn:SequenceFlow"))return!1;var n=Z(t),i=Z(e);return n.get("default")===i}var OC=500,LC=5e3,wg=["shape.create","shape.delete","shape.move","shape.resize"],Eg=[...wg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function up(e,t){K.call(this,e);var n;function i(){return n=n||new IC,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null),a}this.preExecute(Eg,LC,function(){i()}),this.postExecuted(Eg,OC,function(){o()}),this.preExecute(wg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(v(c,"bpmn:Lane")&&u.addLane(c),v(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}up.$inject=["eventBus","modeling"],ae(up,K);function IC(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}var NC=500,BC=5e3,Sg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Rg=[...Sg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function lp(e,t){K.call(this,e);var n;function i(){return n=n||new $C,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(Rg,BC,function(){i()}),this.postExecuted(Rg,NC,function(){o()}),this.preExecute(Sg,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(v(s,"bpmn:FlowElement")&&c.addFlowElement(s),v(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;v(s,"bpmn:Group")&&r().addGroup(s)})}lp.$inject=["eventBus","modeling"],ae(lp,K);function $C(){this.affectedFlowElements=new Set,this.affectedGroupEntries=new Map,this.counter=0,this.addFlowElement=function(e){this.affectedFlowElements.add(e)},this.addGroup=function(e){this.affectedGroupEntries.has(e)||this.affectedGroupEntries.set(e,{categoryValue:e.businessObject.categoryValueRef,groupShape:e})},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function pp(e,t){K.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)jC(o)&&!HC(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ae(pp,K),pp.$inject=["eventBus","modeling"];function jC(e){const t=Z(e);return t&&t.isForCompensation}function FC(e){return e&&v(e,"bpmn:BoundaryEvent")&&po(e,"bpmn:CompensateEventDefinition")}function HC(e){return e.incoming.filter(n=>FC(n.source)).length>0}const zC={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","artifactBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","categoryRootElementReferenceBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","updateCategoryValueRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",_l],appendBehavior:["type",bl],associationBehavior:["type",wl],attachEventBehavior:["type",Ns],artifactBehavior:["type",xl],boundaryEventBehavior:["type",El],categoryRootElementReferenceBehavior:["type",Sl],compensateBoundaryEventBehaviour:["type",Rl],createBehavior:["type",Cl],createDataObjectBehavior:["type",Pl],createParticipantBehavior:["type",Ml],dataInputAssociationBehavior:["type",kl],dataStoreBehavior:["type",Dl],deleteLaneBehavior:["type",Ol],detachEventBehavior:["type",Gs],dropOnFlowBehavior:["type",Il],eventBasedGatewayBehavior:["type",Nl],fixHoverBehavior:["type",Nm],groupBehavior:["type",Bl],importDockingFix:["type",$m],isHorizontalFix:["type",jl],labelBehavior:["type",Hl],layoutConnectionBehavior:["type",zl],messageFlowBehavior:["type",Wl],nonInterruptingBehavior:["type",Ul],removeElementBehavior:["type",ql],removeEmbeddedLabelBoundsBehavior:["type",Yl],removeParticipantBehavior:["type",Kl],replaceConnectionBehavior:["type",Xl],replaceElementBehaviour:["type",Zs],resizeBehavior:["type",sg],resizeLaneBehavior:["type",dg],rootElementReferenceBehavior:["type",ep],spaceToolBehavior:["type",mg],subProcessPlaneBehavior:["type",Li],subProcessStartEventBehavior:["type",np],textAnnotationBehavior:["type",ip],toggleCollapseConnectionBehaviour:["type",rp],toggleElementCollapseBehaviour:["type",ap],unclaimIdBehavior:["type",sp],unsetDefaultFlowBehavior:["type",cp],updateFlowNodeRefsBehavior:["type",up],updateCategoryValueRefsBehavior:["type",lp],setCompensationActivityAfterPasteBehavior:["type",pp]};function fp(e){this._commandStack=e.get("commandStack",!1)}fp.$inject=["injector"],fp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const yi={__init__:["rules"],rules:["type",fp]};function qn(e){K.call(this,e),this.init()}qn.$inject=["eventBus"],ae(qn,K),qn.prototype.addRule=function(e,t,n){var i=this;typeof e=="string"&&(e=[e]),e.forEach(function(r){i.canExecute(r,t,function(o,a,s){return n(o)},!0)})},qn.prototype.init=function(){};function Cg(e,t){var n=Qt(e,t,-15);return n!=="intersect"?n:null}function en(e){qn.call(this,e)}ae(en,qn),en.$inject=["eventBus"],en.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return VC(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return ic(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ic(n,i,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,i=e.direction;return jg(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return rt(i)&&!rc(t,i)?!1:Cr(t,function(r){return rt(r)?ic(r.source,r.target,r):r.host?da(r,r.host,null,n):gp(r,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,r=e.hints;return r!=null&&r.keyboardMove&&n.some(function(a){return Og(a)&&!n.includes(a.host)})?!1:da(n,t,null,i)||Bg(n,t,i)||$g(n,t)||rc(n,t)}),this.addRule("shape.create",function(e){return gp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return da(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Gg(n,t)})},en.prototype.canConnectMessageFlow=zg,en.prototype.canConnectSequenceFlow=Vg,en.prototype.canConnectDataAssociation=yp,en.prototype.canConnectAssociation=Fg,en.prototype.canConnectCompensationAssociation=Hg,en.prototype.canMove=$g,en.prototype.canAttach=da,en.prototype.canReplace=Bg,en.prototype.canDrop=wo,en.prototype.canInsert=rc,en.prototype.canCreate=gp,en.prototype.canConnect=ic,en.prototype.canResize=jg,en.prototype.canCopy=Gg;function VC(e){return dp(e)?null:Le(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function dp(e){return!e||De(e)}function Pg(e){do{if(v(e,"bpmn:Process"))return Z(e);if(v(e,"bpmn:Participant"))return Z(e).processRef||Z(e)}while(e=e.parent)}function hp(e){return v(e,"bpmn:TextAnnotation")}function mp(e){return v(e,"bpmn:Group")&&!e.labelTarget}function Ag(e){return v(e,"bpmn:BoundaryEvent")&&vi(e,"bpmn:CompensateEventDefinition")}function nc(e){return Z(e).isForCompensation}function GC(e,t){var n=Pg(e),i=Pg(t);return n===i}function WC(e){return v(e,"bpmn:InteractionNode")&&!v(e,"bpmn:BoundaryEvent")&&(!v(e,"bpmn:Event")||v(e,"bpmn:ThrowEvent")&&kg(e,"bpmn:MessageEventDefinition"))}function UC(e){return v(e,"bpmn:InteractionNode")&&!nc(e)&&(!v(e,"bpmn:Event")||v(e,"bpmn:CatchEvent")&&kg(e,"bpmn:MessageEventDefinition"))&&!(v(e,"bpmn:BoundaryEvent")&&!vi(e,"bpmn:MessageEventDefinition"))}function Tg(e){for(var t=e;t=t.parent;){if(v(t,"bpmn:FlowElementsContainer"))return Z(t);if(v(t,"bpmn:Participant"))return Z(t).processRef}return null}function Mg(e,t){var n=Tg(e),i=Tg(t);return n===i}function vi(e,t){var n=Z(e);return!!ct(n.eventDefinitions||[],function(i){return v(i,t)})}function kg(e,t){var n=Z(e);return(n.eventDefinitions||[]).every(function(i){return v(i,t)})}function YC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:EndEvent")&&!un(e)&&!(v(e,"bpmn:IntermediateThrowEvent")&&vi(e,"bpmn:LinkEventDefinition"))&&!Ag(e)&&!nc(e)}function qC(e){return v(e,"bpmn:FlowNode")&&!v(e,"bpmn:StartEvent")&&!v(e,"bpmn:BoundaryEvent")&&!un(e)&&!(v(e,"bpmn:IntermediateCatchEvent")&&vi(e,"bpmn:LinkEventDefinition"))&&!nc(e)}function KC(e){return v(e,"bpmn:ReceiveTask")||v(e,"bpmn:IntermediateCatchEvent")&&(vi(e,"bpmn:MessageEventDefinition")||vi(e,"bpmn:TimerEventDefinition")||vi(e,"bpmn:ConditionalEventDefinition")||vi(e,"bpmn:SignalEventDefinition"))}function XC(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Dg(e,t){var n=XC(t);return n.indexOf(e)!==-1}function ic(e,t,n){if(dp(e)||dp(t))return null;if(!v(n,"bpmn:DataAssociation")){if(zg(e,t))return{type:"bpmn:MessageFlow"};if(Vg(e,t))return{type:"bpmn:SequenceFlow"}}var i=yp(e,t);return i||(Hg(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Fg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function wo(e,t){return De(e)||mp(e)?!0:v(t,"bpmn:Participant")&&!Fe(t)?!1:v(e,"bpmn:Participant")?v(t,"bpmn:Process")||v(t,"bpmn:Collaboration"):Le(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:v(e,"bpmn:Lane")?v(t,"bpmn:Participant")||v(t,"bpmn:Lane"):v(e,"bpmn:BoundaryEvent")&&!ZC(e)?!1:v(e,"bpmn:FlowElement")&&!v(e,"bpmn:DataStoreReference")?v(t,"bpmn:FlowElementsContainer")?Fe(t):Le(t,["bpmn:Participant","bpmn:Lane"]):v(e,"bpmn:DataStoreReference")&&v(t,"bpmn:Collaboration")?Wi(Z(t).get("participants"),function(n){return!!n.get("processRef")}):Le(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Le(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):v(e,"bpmn:MessageFlow")?v(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function ZC(e){return Z(e).cancelActivity&&(Lg(e)||Ig(e))}function Og(e){return!De(e)&&v(e,"bpmn:BoundaryEvent")}function QC(e){return v(e,"bpmn:Lane")}function JC(e){return Og(e)||v(e,"bpmn:IntermediateThrowEvent")&&Lg(e)?!0:v(e,"bpmn:IntermediateCatchEvent")&&Ig(e)}function Lg(e){var t=Z(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Ig(e){return Ng(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Ng(e,t){return t.some(function(n){return vi(e,n)})}function eP(e){return v(e,"bpmn:ReceiveTask")&&ct(e.incoming,function(t){return v(t.source,"bpmn:EventBasedGateway")})}function da(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return De(r)||!JC(r)||un(t)||!v(t,"bpmn:Activity")||nc(t)||i&&!Cg(i,t)||eP(t)?!1:"attach"}function Bg(e,t,n){if(!t)return!1;var i={replacements:[]};return k(e,function(r){un(t)||v(r,"bpmn:StartEvent")&&r.type!=="label"&&wo(r,t)&&(uS(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(lS(r)||pS(r)||fS(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Ng(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&v(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),v(t,"bpmn:Transaction")||vi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(v(r,"bpmn:EndEvent")&&wo(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),v(r,"bpmn:BoundaryEvent")&&da(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function $g(e,t){return Wi(e,QC)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return wo(n,t)})}function gp(e,t,n,i){return t?De(e)||mp(e)?!0:wo(e,t)||rc(e,t):!1}function jg(e,t,n){return v(e,"bpmn:SubProcess")?Fe(e)&&(!t||t.width>=100&&t.height>=80):v(e,"bpmn:Lane")||v(e,"bpmn:Participant")?!0:hp(e)?n?n==="e"||n==="w":!0:mp(e)?!0:De(e)?n?n==="e"||n==="w":!0:!1}function tP(e,t){var n=hp(e),i=hp(t);return(n||i)&&n!==i}function Fg(e,t){return Dg(t,e)||Dg(e,t)?!1:tP(e,t)?!0:!!yp(e,t)}function Hg(e,t){return Mg(e,t)&&Ag(e)&&v(t,"bpmn:Activity")&&!iP(t,e)&&!un(t)}function zg(e,t){return Ug(e)&&!Ug(t)?!1:WC(e)&&UC(t)&&!GC(e,t)}function Vg(e,t){return YC(e)&&qC(t)&&Mg(e,t)&&!(v(e,"bpmn:EventBasedGateway")&&!KC(t))}function yp(e,t){return Le(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Le(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Le(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Le(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function rc(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:Le(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!De(t)&&v(e,"bpmn:FlowNode")&&!v(e,"bpmn:BoundaryEvent")&&wo(e,t.parent)}function vp(e,t){return e&&t&&e.indexOf(t)!==-1}function Gg(e,t){return De(t)?!0:!(v(t,"bpmn:Lane")&&!vp(e,t.parent)||v(t,"bpmn:MessageFlow")&&!nP(e,t))}function nP(e,t){var n=Wg(t.source),i=Wg(t.target);return vp(e,n)&&vp(e,i)}function Wg(e){for(;e;e=e.parent)if(v(e,"bpmn:Participant"))return e;return null}function Ug(e){return mo(e,"bpmn:Process")||mo(e,"bpmn:Collaboration")}function iP(e,t){return e.attachers.includes(t)}const rP={__depends__:[yi],__init__:["bpmnRules"],bpmnRules:["type",en]};var oP=2e3;function Yg(e,t){e.on("saveXML.start",oP,n);function n(){var i=t.getRootElements();k(i,function(r){var o=Ge(r),a,s;a=Xo([r]),a=Ie(a,function(c){return c!==r&&!c.labelTarget}),s=on(a,Ge),o.set("planeElement",s)})}}Yg.$inject=["eventBus","canvas"];const aP={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Yg]};function oc(e){K.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}oc.prototype.getOrdering=function(e,t){return null},ae(oc,K);function _p(e,t){oc.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=ct(n,function(c){return Le(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!Le(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||v(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=Kf(s.children,function(p){return!a.labelTarget&&p.labelTarget?!1:c.level<r(p).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}_p.$inject=["eventBus","canvas"],ae(_p,oc);const sP={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",_p]};function ha(){}ha.prototype.get=function(){return this._data},ha.prototype.set=function(e){this._data=e},ha.prototype.clear=function(){var e=this._data;return delete this._data,e},ha.prototype.isEmpty=function(){return!this._data};const cP={clipboard:["type",ha]};var qg=1500;function Kg(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),u=c&&e.get(c);c&&u&&(a.stopPropagation(),r.hover({element:u,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",qg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",qg,function(c){s&&t.fire("element.out",{element:s,gfx:a})}),t.on("element.out",function(){a=null,s=null})})(),this._findTargetGfx=function(a){var s,c;if(a instanceof MouseEvent)return s=$r(a),c=document.elementFromPoint(s.x,s.y),uP(c)}}Kg.$inject=["elementRegistry","eventBus","injector"];function uP(e){return Dr(e,"svg, .djs-element",!0)}const lP={__init__:["hoverFix"],hoverFix:["type",Kg]};function pP(e){return!0}function ac(e){return cr(e)||gC(e)}var Xg=500;function Zg(e,t,n){var i=this;function r(A,H,V){if(!s(A,H)){var $,G,pe;V?G=t.getGraphics(V):($=H.delegateTarget||H.target,$&&(G=$,V=t.get(G))),!(!G||!V)&&(pe=e.fire(A,{element:V,gfx:G,originalEvent:H}),pe===!1&&(H.stopPropagation(),H.preventDefault()))}}var o={};function a(A){return o[A]}function s(A,H){var V=u[A]||cr;return!V(H)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},u={"element.contextmenu":pP,"element.mousedown":ac,"element.mouseup":ac,"element.click":ac,"element.dblclick":ac};function l(A,H,V){var $=c[A];if(!$)throw new Error("unmapped DOM event name <"+A+">");return r($,H,V)}var p="svg, .djs-element";function f(A,H,V,$){var G=o[V]=function(pe){r(V,pe)};$&&(u[V]=$),G.$delegate=Cn.bind(A,p,H,G)}function d(A,H,V){var $=a(V);$&&Cn.unbind(A,H,$.$delegate)}function h(A){k(c,function(H,V){f(A,V,H)})}function m(A){k(c,function(H,V){d(A,V,H)})}e.on("canvas.destroy",function(A){m(A.svg)}),e.on("canvas.init",function(A){h(A.svg)}),e.on(["shape.added","connection.added"],function(A){var H=A.element,V=A.gfx;e.fire("interactionEvents.createHit",{element:H,gfx:V})}),e.on(["shape.changed","connection.changed"],Xg,function(A){var H=A.element,V=A.gfx;e.fire("interactionEvents.updateHit",{element:H,gfx:V})}),e.on("interactionEvents.createHit",Xg,function(A){var H=A.element,V=A.gfx;i.createDefaultHit(H,V)}),e.on("interactionEvents.updateHit",function(A){var H=A.element,V=A.gfx;i.updateDefaultHit(H,V)});var g=S("djs-hit djs-hit-stroke"),R=S("djs-hit djs-hit-click-stroke"),w=S("djs-hit djs-hit-all"),b=S("djs-hit djs-hit-no-move"),x={all:w,"click-stroke":R,stroke:g,"no-move":b};function S(A,H){return H=O({stroke:"white",strokeWidth:15},H||{}),n.cls(A,["no-fill","no-border"],H)}function M(A,H){var V=x[H];if(!V)throw new Error("invalid hit type <"+H+">");return se(A,V),A}function I(A,H){Ce(A,H)}this.removeHits=function(A){var H=ys(".djs-hit",A);k(H,Ht)},this.createDefaultHit=function(A,H){var V=A.waypoints,$=A.isFrame,G;return V?this.createWaypointsHit(H,V):(G=$?"stroke":"all",this.createBoxHit(H,G,{width:A.width,height:A.height}))},this.createWaypointsHit=function(A,H){var V=Ko(H);return M(V,"stroke"),I(A,V),V},this.createBoxHit=function(A,H,V){V=O({x:0,y:0},V);var $=he("rect");return M($,H),se($,V),I(A,$),$},this.updateDefaultHit=function(A,H){var V=nt(".djs-hit",H);if(V)return A.waypoints?ol(V,A.waypoints):se(V,{width:A.width,height:A.height}),V},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Zg.$inject=["eventBus","elementRegistry","styles"];const sc={__init__:["interactionEvents"],interactionEvents:["type",Zg]};function Eo(e,t){this._eventBus=e,this._canvas=t,this._selectedElements=new Set;var n=this;e.on(["shape.remove","connection.remove"],function(i){var r=i.element;n.deselect(r)}),e.on(["diagram.clear","root.set"],function(i){n.select(null)})}Eo.$inject=["eventBus","canvas"],Eo.prototype.deselect=function(e){if(this._selectedElements.has(e)){var t=this.get();this._selectedElements.delete(e),this._eventBus.fire("selection.changed",{oldSelection:t,newSelection:this.get()})}},Eo.prototype.get=function(){return Array.from(this._selectedElements)},Eo.prototype.isSelected=function(e){return this._selectedElements.has(e)},Eo.prototype.select=function(e,t){var n=this.get();_e(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?k(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Qg="hover",Jg="selected";function ey(e,t){this._canvas=e;function n(r,o){e.addMarker(r,o)}function i(r,o){e.removeMarker(r,o)}t.on("element.hover",function(r){n(r.element,Qg)}),t.on("element.out",function(r){i(r.element,Qg)}),t.on("selection.changed",function(r){function o(u){i(u,Jg)}function a(u){n(u,Jg)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let u of s)c.has(u)||o(u);for(let u of c)s.has(u)||a(u)})}ey.$inject=["canvas","eventBus"];function ty(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;_e(u)?t.select(u):t.select(s.filter(fP))}}),e.on("connect.end",500,function(r){var o=r.context,a=o.connection;a&&t.select(a)}),e.on("shape.move.end",500,function(r){var o=r.previousSelection||[],a=i.get(r.context.shape.id),s=ct(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(cr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=ec(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}ty.$inject=["eventBus","selection","canvas","elementRegistry"];function fP(e){return!e.hidden}const Kn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[sc],selection:["type",Eo],selectionVisuals:["type",ey],selectionBehavior:["type",ty]};var dP=/^djs-cursor-.*$/;function cc(e){var t=gt(document.body);t.removeMatching(dP),e&&t.add("djs-cursor-"+e)}function ny(){cc(null)}var hP=5e3;function iy(e,t){t=t||"element.click";function n(){return!1}return e.once(t,hP,n),function(){e.off(t,n)}}var mP=["c","C"],gP=["v","V"],yP=["d","D"],vP=["x","X"],_P=["y","Y"],ry=["z","Z"];function bP(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Tn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function zt(e,t){return e=_e(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function bp(e){return e.shiftKey}function xP(e){return Tn(e)&&zt(mP,e)}function wP(e){return Tn(e)&&zt(gP,e)}function EP(e){return Tn(e)&&zt(yP,e)}function SP(e){return Tn(e)&&zt(vP,e)}function RP(e){return Tn(e)&&!bp(e)&&zt(ry,e)}function CP(e){return Tn(e)&&(zt(_P,e)||zt(ry,e)&&bp(e))}var So=Math.round,oy="djs-drag-active";function Fr(e){e.preventDefault()}function PP(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function AP(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function ay(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),S=t._container.getBoundingClientRect();return{x:x.x+(b.x-S.left)/x.scale,y:x.y+(b.y-S.top)/x.scale}}function s(b,x){x=x||o;var S=e.createEvent(O({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,S)===!1?!1:e.fire(x.prefix+"."+b,S)}function c(b){var x=b.filter(function(S){return i.get(S.id)});x.length&&n.select(x)}function u(b,x){var S=o.payload,M=o.displacement,I=o.globalStart,A=$r(b),H=ri(A,I),V=o.localStart,$=a(A),G=ri($,V);if(!o.active&&(x||AP(H)>o.threshold)){if(O(S,{x:So(V.x+M.x),y:So(V.y+M.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return g();o.active=!0,o.keepSelection||(S.previousSelection=n.get(),n.select(null)),o.cursor&&cc(o.cursor),t.addMarker(t.getRootElement(),oy)}Jl(b),o.active&&(O(S,{x:So($.x+M.x),y:So($.y+M.y),dx:So(G.x),dy:So(G.y)},{originalEvent:b}),s("move"))}function l(b){var x,S=!0;o.active&&(b&&(o.payload.originalEvent=b,Jl(b)),S=s("end")),S===!1&&s("rejected"),x=R(S!==!0),s("ended",x)}function p(b){zt("Escape",b)&&(Fr(b),g())}function f(b){var x;o.active&&(x=iy(e),setTimeout(x,400),Fr(b)),l(b)}function d(b){u(b)}function h(b){var x=o.payload;x.hoverGfx=b.gfx,x.hover=b.element,s("hover")}function m(b){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function g(b){var x;if(o){var S=o.active;S&&s("cancel"),x=R(b),S&&s("canceled",x)}}function R(b){var x,S;s("cleanup"),ny(),o.trapClick?S=f:S=l,Re.unbind(document,"mousemove",u),Re.unbind(document,"dragstart",Fr),Re.unbind(document,"selectstart",Fr),Re.unbind(document,"mousedown",S,!0),Re.unbind(document,"mouseup",S,!0),Re.unbind(document,"keyup",p),Re.unbind(document,"touchstart",d,!0),Re.unbind(document,"touchcancel",g,!0),Re.unbind(document,"touchmove",u,!0),Re.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),oy);var M=o.payload.previousSelection;return b!==!1&&M&&!n.get().length&&c(M),x=o,o=null,x}function w(b,x,S,M){o&&g(!1),typeof x=="string"&&(M=S,S=x,x=null),M=O({},r,M||{});var I=M.data||{},A,H,V,$,G;if(M.trapClick?$=f:$=l,b?(A=xo(b)||b,H=$r(b),Jl(b),A.type==="dragstart"&&Fr(A)):(A=null,H={x:0,y:0}),V=a(H),x||(x=V),G=PP(A),o=O({prefix:S,data:I,payload:{},globalStart:H,displacement:ri(x,V),localStart:V,isTouch:G},M),M.manual||(G?(Re.bind(document,"touchstart",d,!0),Re.bind(document,"touchcancel",g,!0),Re.bind(document,"touchmove",u,!0),Re.bind(document,"touchend",l,!0)):(Re.bind(document,"mousemove",u),Re.bind(document,"dragstart",Fr),Re.bind(document,"selectstart",Fr),Re.bind(document,"mousedown",$,!0),Re.bind(document,"mouseup",$,!0)),Re.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;M.autoActivate&&u(b,!0)}e.on("diagram.destroy",g),this.init=w,this.move=u,this.hover=h,this.out=m,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(b){O(r,b)}}ay.$inject=["eventBus","canvas","selection","elementRegistry"];const Ii={__depends__:[lP,Kn],dragging:["type",ay]};function Ro(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Ro.prototype.next=function(){return this._prefix+ ++this._counter};const TP=new Ro("ps");var MP=["marker-start","marker-mid","marker-end"],kP=["circle","ellipse","line","path","polygon","polyline","path","rect"];function ur(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}ur.$inject=["elementRegistry","eventBus","canvas","styles"],ur.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},ur.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},ur.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=_h(n);return this._cloneMarkers(Ir(r),i),se(r,this._styles.cls(i,[])),Ce(t,r),se(r,"data-preview-support-element-id",e.id),r},ur.prototype.addFrame=function(e,t){var n=he("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ce(t,n),se(n,"data-preview-support-element-id",e.id),n},ur.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),IP(e)&&MP.forEach(function(r){if(se(e,r)){var o=DP(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},ur.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,TP.next()].join("-"),a=nt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||_h(n);s.id=o,He(s).add(r);var c=nt(":scope > defs",e);c||(c=he("defs"),Ce(e,c)),Ce(c,s);var u=LP(s.id);se(t,i,u)};function DP(e,t,n){var i=OP(se(e,t));return nt("marker#"+i,n||document)}function OP(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function LP(e){return"url(#"+e+")"}function IP(e){return kP.indexOf(e.nodeName)!==-1}const Co={__init__:["previewSupport"],previewSupport:["type",ur]};var NP="drop-ok",sy="drop-not-ok",cy="attach-ok",uy="new-parent",ly="create",BP=2e3;function py(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Ie(c,function(w){var b=w.labelTarget;return!w.parent&&!(De(w)&&c.indexOf(b)!==-1)});var d=ct(c,function(w){return!rt(w)}),h=!1,m=!1,g=!1;dy(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(dy(c)?g=r.allowed("shape.create",{position:l,shape:d,source:p,target:u}):g=r.allowed("elements.create",{elements:c,position:l,target:u}));var R=f.connectionTarget;return g||h?(d&&p&&(m=r.allowed("connection.create",{source:R===p?d:p,target:R===p?p:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[cy,NP,sy,uy].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,p=c.hover,f=u.source,d=u.hints||{};if(!p){u.canExecute=!1,u.target=null;return}fy(c);var h={x:c.x,y:c.y},m=u.canExecute=p&&o(l,p,h,f,d);p&&m!==null&&(u.target=p,m&&m.attach?a(p,cy):a(p,m?uy:sy))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,p=u.shape,f=u.elements,d=u.target,h=u.canExecute,m=h&&h.attach,g=h&&h.connect,R=u.hints||{};if(h===!1||!d)return!1;fy(c);var w={x:c.x,y:c.y};g?p=i.appendShape(l,p,w,d,{attach:m,connection:g===!0?{}:g,connectionTarget:R.connectionTarget}):(f=i.createElements(f,w,d,O({},R,{attach:m})),p=ct(f,function(b){return!rt(b)})),O(u,{elements:f,shape:p}),O(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===ly&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],BP,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){_e(u)||(u=[u]);var p=ct(u,function(h){return!rt(h)});if(p){l=O({elements:u,hints:{},shape:p},l||{}),k(u,function(h){Ee(h.x)||(h.x=0),Ee(h.y)||(h.y=0)});var f=Ie(u,function(h){return!h.hidden}),d=At(f);k(u,function(h){rt(h)&&(h.waypoints=on(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),O(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,ly,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}py.$inject=["canvas","dragging","eventBus","modeling","rules"];function fy(e){var t=e.context,n=t.createConstraints;n&&(n.left&&(e.x=Math.max(e.x,n.left)),n.right&&(e.x=Math.min(e.x,n.right)),n.top&&(e.y=Math.max(e.y,n.top)),n.bottom&&(e.y=Math.min(e.y,n.bottom)))}function dy(e){return e&&e.length===1&&!rt(e[0])}var $P=750;function hy(e,t,n,i,r){function o(a){var s=he("g");se(s,r.cls("djs-drag-group",["no-events"]));var c=he("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Ir(l),u)):(l=n._createContainer("shape",c),n.drawShape(Ir(l),u),Jt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",$P,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var p;s?(l.parentNode||(p=e.getActiveLayer(),Ce(p,l)),Jt(l,a.x,a.y)):Ht(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Ht(c)})}hy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const uc={__depends__:[Ii,Co,yi,Kn],__init__:["create","createPreview"],create:["type",py],createPreview:["type",hy]};function xp(e){var t=this;this._lastMoveEvent=null;function n(i){t._lastMoveEvent=i}e.on("canvas.init",function(i){var r=t._svg=i.svg;r.addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}xp.$inject=["eventBus"],xp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||jP(0,0)};function jP(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const ma={__init__:["mouse"],mouse:["type",xp]};var my=2e3;function Mn(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,p=c.elementsSet;u.priority=1,u.id=l.id,p.has(l.parent)&&(u.parent=l.parent.id),FP(l)&&(u.priority=2,u.host=l.host.id),rt(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=HP(l)),De(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),k(["x","y","width","height"],function(f){Ee(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",my,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",my,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;O(u,{createElementsBehavior:!1})})}Mn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Mn.prototype.copy=function(e,t={}){var n,i;return _e(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(_e(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Mn.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},Mn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Mn.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},Mn.prototype._getElementIdsFromTree=function(e){var t={};return k(e,function(n){k(n,function(i){i.id&&(t[i.id]=!0)})}),t},Mn.prototype._paste=function(e,t,n,i){k(e,function(o){Ee(o.x)||(o.x=0),Ee(o.y)||(o.y=0)});var r=At(e);return k(e,function(o){rt(o)&&(o.waypoints=on(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),O(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,O({},i))},Mn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return k(e,function(o,a){o=ai(o,"priority"),k(o,function(s){var c=O({},si(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(rt(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(De(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},Mn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(si(e,["id"]));return t},Mn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(si(e,["id"]));return t},Mn.prototype.createShape=function(e){var t=this._elementFactory.createShape(si(e,["id"]));return t},Mn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(rt(e)&&(!n.has(e.source)||!n.has(e.target))||De(e)&&!n.has(e.labelTarget))},Mn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=xs(e);function s(p,f){return t.allowed("element.copy",{element:p,elements:f})}function c(p,f){var d=o.get(p);if(!d){var h={element:p,depth:f};r.push(h),o.set(p,h);return}if(d.depth<f){r=u(d,r);var m={element:d.element,depth:f};r.push(m),o.set(p,m)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Lr(a,function(p,f,d){if(De(p))return;k(p.labels,function(g){c(g,d)});function h(g){g&&g.length&&k(g,function(R){k(R.labels,function(w){c(w,d)}),c(R,d)})}k([p.attachers,p.incoming,p.outgoing],h),c(p,d);var m=[];return p.children&&(m=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:m}),m}),e=on(r,function(p){return p.element});var l=new Set(e);return r=on(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=ai(r,function(p){return p.descriptor.priority}),e=on(r,function(p){return p.element}),k(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){yy(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){yy(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function FP(e){return!!e.host}function HP(e){return on(e.waypoints,function(t){return t=gy(t),t.original&&(t.original=gy(t.original)),t})}function gy(e){return O({},e)}function yy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const zP={__depends__:[cP,uc,ma,yi],__init__:["copyPaste"],copyPaste:["type",Mn]};function wp(e,t,n){_e(n)||(n=[n]),k(n,function(i){Rr(e[i])||(t[i]=e[i])})}var Ep=750;function vy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Ep,function(c){var u=c.descriptor,l=c.element,p=Z(l);if(De(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Ge(l),!0);d.bpmnElement=f,wp(f,u,"name"),wp(d,u,"isExpanded"),p.default&&(u.default=p.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var p=Z(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(Z(c).attachedToRef=Z(u[c.host])),si(l,Sn(l,function(f,d,h){var m=d.element,g=d.property;return h===c.id&&(m.set(g,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,p=l.businessObject,f=l.di;if(De(l)){l.businessObject=Z(u[l.labelTarget]),l.di=Ge(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,wp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",Ep,function(c){var u=c.descriptor,l=c.element;if(v(l,"bpmn:Participant")){var p=Z(l);p.processRef&&(u.processRef=i(p.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;v(u,"bpmn:SubProcess")&&k(na(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",Ep,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}vy.$inject=["bpmnFactory","eventBus","moddleCopy"];const VP=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],GP=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function ga(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return ai(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Gt(r)&&r.$descriptor;if(a&&GP.includes(a))return o;if(a&&VP.includes(a)||a&&s&&!ct(s.properties,eo({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(v(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}ga.$inject=["eventBus","bpmnFactory","moddle"],ga.prototype.copyElement=function(e,t,n,i=!1){n&&!_e(n)&&(n=[n]),n=n||Sp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(_e(r)&&(n=r),k(n,o=>{let a;En(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!$t(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},ga.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return Gt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):_e(e)?Sn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Gt(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},ga.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function Sp(e,t){return Sn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const _y={__depends__:[zP],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",vy],moddleCopy:["type",ga]};var by=Math.round;function Rp(e,t){this._modeling=e,this._eventBus=t}Rp.$inject=["modeling","eventBus"],Rp.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,u=by(s+o/2),l=by(c+a/2),p=i.replaceShape(e,O({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function xy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}xy.$inject=["selection","eventBus"];const WP={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",xy],replace:["type",Rp]};function UP(e,t,n){_e(n)||(n=[n]),k(n,function(i){Rr(e[i])||(t[i]=e[i])})}var YP=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function qP(e,t){var n=e&&En(e,"collapsed")?e.collapsed:!Fe(e),i;return t&&(En(t,"collapsed")||En(t,"isExpanded"))?i=En(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function wy(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(lc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&qP(s,c))return i.toggleCollapse(s),s;var f=e.create(l),d={type:l,businessObject:f};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),UP(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=Sp(p.$descriptor),m=Sp(f.$descriptor,!0),g=KP(h,m);O(f,ii(c,YP));var R=Ie(g,function(x){return x==="eventDefinitions"?Ey(s,c.eventDefinitionType):x==="loopCharacteristics"?!un(f):En(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!un(f):!0});if(f=n.copyElement(p,f,R),c.eventDefinitionType&&(Ey(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),v(p,"bpmn:Activity")){if(lc(p))d.isExpanded=Fe(s);else if(c&&En(c,"isExpanded")){d.isExpanded=c.isExpanded;var w=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=w.width,d.height=w.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Fe(s)&&!v(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(lc(p)&&!lc(f)&&(u.moveChildren=!1),v(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=Ut(s);Ge(s).isHorizontal||(Ge(d).isHorizontal=b),d.width=b?s.width:t.getDefaultSize(d).width,d.height=b?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:f})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),f.name=p.name,Le(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Le(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!v(p,"bpmn:BoundaryEvent")&&v(f,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}wy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function lc(e){return v(e,"bpmn:SubProcess")}function Ey(e,t){var n=Z(e);return t&&n.get("eventDefinitions").some(function(i){return v(i,t)})}function KP(e,t){return e.filter(function(n){return t.includes(n)})}const Sy={__depends__:[_y,WP,Kn],bpmnReplace:["type",wy]};var XP=250;function Hr(e){this._eventBus=e,this._tools=[],this._active=null}Hr.$inject=["eventBus"],Hr.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error(`A tool has to be registered with it's "events"`);n.push(e),this.bindEvents(e,t)},Hr.prototype.isActive=function(e){return e&&this._active===e},Hr.prototype.length=function(e){return this._tools.length},Hr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Hr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),k(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,XP,function(r){this._active&&(ZP(r)||this.setActive(null))},this)};function ZP(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Dr(t,'.group[data-group="tools"]')}const pc={__depends__:[Ii],__init__:["toolManager"],toolManager:["type",Hr]};function QP(e,t){if(e==="x"){if(t>0)return"e";if(t<0)return"w"}if(e==="y"){if(t>0)return"s";if(t<0)return"n"}return null}function JP(e,t){var n=[],i=new Set(e);k(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;k(a.concat(s),function(c){var u=c.source,l=c.target;(i.has(u)||i.has(l))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function eA(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var Cp=Math.abs,tA=Math.round,Ni={x:"width",y:"height"},Ry="crosshair",lr={n:"top",w:"left",s:"bottom",e:"right"},nA=1500,fc={n:"s",w:"e",s:"n",e:"w"},dc=20;function Xn(e,t,n,i,r,o,a){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,this._toolManager=o,this._mouse=a;var s=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",function(c){n.once("spaceTool.selection.ended",function(){s.activateMakeSpace(c.originalEvent)})}),n.on("spaceTool.move",nA,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Py(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,h=u.start;if(u.initialized){Py(c);var m={x:0,y:0};m[l]=tA(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Xn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Xn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Ry,data:{context:{reactivate:n}},trapClick:!1})},Xn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Ry,data:{context:{}}})},Xn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Xn.prototype.init=function(e,t){var n=Cp(e.dx)>Cp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Cp(i)<5)return!1;i<0&&(i*=-1),fa(e)&&(i*=-1);var o=QP(n,i),a=this._canvas.getRootElement();!ec(e)&&e.hover&&(a=e.hover);var s=[...Xo(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=iA(c,n,o,r,u);return O(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),cc("resize-"+(n==="x"?"ew":"ns")),!0},Xn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function p(d){s.has(d)||(s.add(d),o.push(d));var h=d.label;h&&!s.has(h)&&(s.add(h),o.push(h))}function f(d){c.has(d)||(c.add(d),a.push(d))}return k(e,function(d){if(!(!d.parent||De(d))){if(rt(d)){l.push(d);return}var h=d[t],m=h+d[Ni[t]];if(rA(d)&&(n>0&&be(d)[t]>i||n<0&&be(d)[t]<i)){u.push(d);return}if(n>0&&h>i||n<0&&m<i){p(d);return}if(h<i&&m>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),k(o,function(d){var h=d.attachers;h&&k(h,function(m){p(m)})}),k(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&p(d)}),k(l,function(d){var h=d.source,m=d.target,g=d.label;(s.has(h)||c.has(h))&&(s.has(m)||c.has(m))&&g&&p(g)}),{movingShapes:o,resizingShapes:a}},Xn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Xn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Cy(e){return{top:e.top-dc,right:e.right+dc,bottom:e.bottom+dc,left:e.left-dc}}function Py(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Ee(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Ee(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Ee(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Ee(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function iA(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),p=new Set(a);return k(a,function(f){var d=f.attachers,h=f.children,m=ge(f),g=Ie(h,function(G){return!rt(G)&&!De(G)&&!l.has(G)&&!p.has(G)}),R=Ie(h,function(G){return!rt(G)&&!De(G)&&l.has(G)}),w,b,x,S=[],M=[],I,A,H,V;g.length&&(b=Cy(ge(At(g))),w=i-m[lr[n]]+b[lr[n]],n==="n"?s.bottom=u=Ee(u)?Math.min(u,w):w:n==="w"?s.right=u=Ee(u)?Math.min(u,w):w:n==="s"?s.top=c=Ee(c)?Math.max(c,w):w:n==="e"&&(s.left=c=Ee(c)?Math.max(c,w):w)),R.length&&(x=Cy(ge(At(R))),w=i-x[lr[fc[n]]]+m[lr[fc[n]]],n==="n"?s.bottom=u=Ee(u)?Math.min(u,w):w:n==="w"?s.right=u=Ee(u)?Math.min(u,w):w:n==="s"?s.top=c=Ee(c)?Math.max(c,w):w:n==="e"&&(s.left=c=Ee(c)?Math.max(c,w):w)),d&&d.length&&(d.forEach(function(G){l.has(G)?S.push(G):M.push(G)}),S.length&&(I=ge(At(S.map(be))),A=m[lr[fc[n]]]-(I[lr[fc[n]]]-i)),M.length&&(H=ge(At(M.map(be))),V=H[lr[n]]-(m[lr[n]]-i)),n==="n"?(w=Math.min(A||1/0,V||1/0),s.bottom=u=Ee(u)?Math.min(u,w):w):n==="w"?(w=Math.min(A||1/0,V||1/0),s.right=u=Ee(u)?Math.min(u,w):w):n==="s"?(w=Math.max(A||-1/0,V||-1/0),s.top=c=Ee(c)?Math.max(c,w):w):n==="e"&&(w=Math.max(A||-1/0,V||-1/0),s.left=c=Ee(c)?Math.max(c,w):w));var $=r&&r[f.id];$&&(n==="n"?(w=i+f[Ni[t]]-$[Ni[t]],s.bottom=u=Ee(u)?Math.min(u,w):w):n==="w"?(w=i+f[Ni[t]]-$[Ni[t]],s.right=u=Ee(u)?Math.min(u,w):w):n==="s"?(w=i-f[Ni[t]]+$[Ni[t]],s.top=c=Ee(c)?Math.max(c,w):w):n==="e"&&(w=i-f[Ni[t]]+$[Ni[t]],s.left=c=Ee(c)?Math.max(c,w):w))}),s}}function rA(e){return!!e.host}var Pp="djs-dragging",Ay="djs-resizing",oA=250,hc=Math.max;function Ty(e,t,n,i,r){function o(a,s){k(a,function(c){r.addDragger(c,s),n.addMarker(c,Pp)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=he("g");se(l,i.cls("djs-crosshair-group",["no-events"])),Ce(s,l);var p=he("path");se(p,"d",u.x),He(p).add("djs-crosshair"),Ce(l,p);var f=he("path");se(f,"d",u.y),He(f).add("djs-crosshair"),Ce(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Jt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Ht(c)}),e.on("spaceTool.move",oA,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=he("path"),se(c,"d","M0,0 L0,0"),He(c).add("djs-crosshair"),Ce(f,c),s.line=c;var d=he("g");se(d,i.cls("djs-drag-group",["no-events"])),Ce(n.getActiveLayer(),d),o(l,d);var h=new Set(l);k(p,function(M){h.add(M)});var m=new Set,g=s.movingConnections=[];h.forEach(function(M){k(M.outgoing,function(I){m.has(I)||!rt(I)||!h.has(I.target)||(m.add(I),g.push(I))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var R=he("g");se(R,i.cls("djs-frame-group",["no-events"])),Ce(n.getActiveLayer(),R);var w=[];k(p,function(M){var I=r.addFrame(M,R),A=I.getBBox();w.push({element:I,initialBounds:A}),n.addMarker(M,Ay)}),s.frameGroup=R,s.frames=w}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};se(c,{d:b[u]});var x={x:"y",y:"x"},S={x:a.dx,y:a.dy};S[x[s.axis]]=0,Jt(s.dragGroup,S.x,S.y),k(s.frames,function(M){var I=M.element,A=M.initialBounds,H,V;s.direction==="e"?se(I,{width:hc(A.width+S.x,5)}):(H=hc(A.width-S.x,5),se(I,{width:H,x:A.x+A.width-H})),s.direction==="s"?se(I,{height:hc(A.height+S.y,5)}):(V=hc(A.height-S.y,5),se(I,{height:V,y:A.y+A.height-V}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,p=s.line,f=s.dragGroup,d=s.frameGroup;k(c,function(h){n.removeMarker(h,Pp)}),k(u,function(h){n.removeMarker(h,Pp)}),f&&(Ht(p),Ht(f)),k(l,function(h){n.removeMarker(h,Ay)}),d&&Ht(d)})}Ty.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const aA={__init__:["spaceToolPreview"],__depends__:[Ii,yi,pc,Co,ma],spaceTool:["type",Xn],spaceToolPreview:["type",Ty]};function mc(e,t){e.invoke(Xn,this),this._canvas=t}mc.$inject=["injector","canvas"],ae(mc,Xn),mc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Qr(so(r.children.filter(u=>v(u,"bpmn:Artifact")),At(o))));const s=[...e,...a];var c=Xn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(v(u,"bpmn:TextAnnotation")||sA(u)&&(t==="y"&&Ut(u)||t==="x"&&!Ut(u)))}),c};function sA(e){return v(e,"bpmn:Participant")&&!Z(e).processRef}const My={__depends__:[aA],spaceTool:["type",mc]};function vt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}vt.$inject=["eventBus","injector"],vt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},vt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},vt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},vt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},vt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},vt.prototype.register=function(e,t){this._setHandler(e,t)},vt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},vt.prototype.canUndo=function(){return!!this._getUndoAction()},vt.prototype.canRedo=function(){return!!this._getRedoAction()},vt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},vt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},vt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},vt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},vt.prototype._createId=function(){return this._uid++},vt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},vt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},vt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},vt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Xf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},vt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=_e(e)?e:[e],t.dirty=t.dirty.concat(e))},vt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},vt.prototype._revertedAction=function(e){this._stackIdx--},vt.prototype._getHandler=function(e){return this._handlerMap[e]},vt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const cA={commandStack:["type",vt]};function pr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var uA=250,ky=1400;function Ap(e,t,n){K.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",ky,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Dy(a),o.validatedShapes=Dy(s)}),i&&t.on("shape.move.start",uA,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const u of c.labels)!u.hidden&&!a.has(u)&&s.add(u),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",ky,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];k(s,function(u){k(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;pr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=sl(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(St(s.labels,a,c),a.labelTarget=s)})}ae(Ap,K),Ap.$inject=["injector","eventBus","modeling"];function Dy(e){var t=new Set(e);return Ie(e,function(n){return!t.has(n.labelTarget)})}const lA={__init__:["labelSupport"],labelSupport:["type",Ap]};var pA=251,Oy=1401,Ly="attach-ok";function Tp(e,t,n,i,r){K.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Oy,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=fA(c),s.validatedShapes=dA(u)}),o&&t.on("shape.move.start",pA,function(a){var s=a.context,c=s.shapes,u=Mp(c);k(u,function(l){o.makeDraggable(s,l,!0),k(l.labels,function(p){o.makeDraggable(s,p,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,Ly),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Ly)}))}}),this.preExecuted("elements.move",Oy,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Mp(u);k(l,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Ie(c,function(p){var f=p.host;return hA(p)&&!mA(c,f)}),k(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;k(s,function(c){k(c.attachers,function(u){k(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),k(u.incoming.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;pr(c.attachers,function(l){var p=i.allowed("elements.move",{target:u,shapes:[l]});p==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&k(u.attachers,function(l){var p=Qm(l,c,u);r.moveShape(l,p,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,p=c.attachers,f=s.hints||{};f.attachSupport!==!1&&k(p,function(d){var h=Qm(d,u,l);r.moveShape(d,h,d.parent),k(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;pr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ae(Tp,K),Tp.$inject=["injector","eventBus","canvas","rules","modeling"];function Mp(e){return Ru(on(e,function(t){return t.attachers||[]}))}function fA(e){var t=Mp(e);return n0("id",e,t)}function dA(e){var t=Jr(e,"id");return Ie(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function hA(e){return!!e.host}function mA(e,t){return e.indexOf(t)!==-1}const gA={__depends__:[yi],__init__:["attachSupport"],attachSupport:["type",Tp]};function Iy(e,t,n,i){e.on("element.changed",function(r){var o=r.element;(o.parent||o===t.getRootElement())&&(r.gfx=n.getGraphics(o)),r.gfx&&e.fire(Ph(o)+".changed",r)}),e.on("elements.changed",function(r){var o=r.elements;o.forEach(function(a){e.fire("element.changed",{element:a})}),i.updateContainments(o)}),e.on("shape.changed",function(r){i.update("shape",r.element,r.gfx)}),e.on("connection.changed",function(r){i.update("connection",r.element,r.gfx)})}Iy.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const kp={__init__:["changeSupport"],changeSupport:["type",Iy]};function Zn(e){this._model=e}Zn.$inject=["moddle"],Zn.prototype._needsId=function(e){return Le(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},Zn.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;v(e,"bpmn:Activity")?t="Activity":v(e,"bpmn:Event")?t="Event":v(e,"bpmn:Gateway")?t="Gateway":Le(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Zn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Zn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Zn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",O({bpmnElement:e,bounds:this.createDiBounds()},t))},Zn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Zn.prototype.createDiWaypoints=function(e){var t=this;return on(e,function(n){return t.createDiWaypoint(n)})},Zn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ii(e,["x","y"]))},Zn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",O({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},Zn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",O({bpmnElement:e},t))};function kn(e,t,n){K.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var h=d.context,m=h.hints||{},g;!h.cropped&&m.createElementsBehavior!==!1&&(g=h.connection,g.waypoints=n.getCroppedWaypoints(g),h.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var h=d.context;i.updateParent(h.shape||h.connection,h.oldParent)}function a(d){var h=d.context,m=h.shape||h.connection,g=h.parent||h.newParent;i.updateParent(m,g)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Dn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;k(g,function(R){v(R,"bpmn:BaseElement")&&i.updateParent(R)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var h=d.context.shape;v(h,"bpmn:BaseElement")&&i.updateBounds(h)}this.executed(["shape.move","shape.create","shape.resize"],Dn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Dn(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Dn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Dn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Dn(l)),this.executed("connection.reconnect",Dn(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,w=Z(m),b=Z(g),x=Z(R);w.conditionExpression&&!Le(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=w.conditionExpression,delete w.conditionExpression),g!==R&&b.default===w&&(h.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",Dn(function(d){var h=d.context,m=h.connection,g=h.oldSource,R=h.newSource,w=Z(m),b=Z(g),x=Z(R);h.oldConditionExpression&&(w.conditionExpression=h.oldConditionExpression),h.oldDefault&&(b.default=h.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Dn(p)),this.reverted(["element.updateAttachment"],Dn(p)),this.executed("element.updateLabel",Dn(f)),this.reverted("element.updateLabel",Dn(f));function f(d){const{element:h}=d.context,m=Hn(h),g=Ge(h),R=g&&g.get("label");rr(h)||tc(h)||(m&&!R?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&R&&g.set("label",void 0))}}ae(kn,K),kn.$inject=["eventBus","bpmnFactory","connectionDocking"],kn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},kn.prototype.updateParent=function(e,t){if(!De(e)&&!(v(e,"bpmn:DataStoreReference")&&e.parent&&v(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ge(e),o=n&&n.businessObject,a=Ge(n);v(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),v(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),v(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),v(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},kn.prototype.updateBounds=function(e){var t=Ge(e),n=vA(e);if(n){var i=ri(n,t.get("bounds"));O(n,{x:e.x+i.x,y:e.y+i.y})}var r=De(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),O(o,{x:e.x,y:e.y,width:e.width,height:e.height})},kn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;v(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),wt(i,e)),v(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),St(r,e))}},kn.prototype.updateDiConnection=function(e,t,n){var i=Ge(e),r=Ge(t),o=Ge(n);i.sourceElement&&i.sourceElement.bpmnElement!==Z(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Z(n)&&(i.targetElement=n&&o)},kn.prototype.updateDiParent=function(e,t){if(t&&!v(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(wt(n,e),e.$parent=null)}};function yA(e){for(;e&&!v(e,"bpmn:Definitions");)e=e.$parent;return e}kn.prototype.getLaneSet=function(e){var t,n;return v(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(v(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},kn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((v(e,"bpmn:DataInput")||v(e,"bpmn:DataOutput"))&&(v(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(v(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(v(e,"bpmn:FlowElement")){if(t){if(v(t,"bpmn:Participant"))t=t.processRef;else if(v(t,"bpmn:Lane"))do t=t.$parent.$parent;while(v(t,"bpmn:Lane"))}i="flowElements"}else if(v(e,"bpmn:Artifact")){for(;t&&!v(t,"bpmn:Process")&&!v(t,"bpmn:SubProcess")&&!v(t,"bpmn:Collaboration");)if(v(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(v(e,"bpmn:MessageFlow"))i="messageFlows";else if(v(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=yA(e.$parent||t),e.$parent&&(wt(o.get("rootElements"),r),r.$parent=null),t&&(St(o.get("rootElements"),r),r.$parent=o))}else v(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":v(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),wt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);wt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},kn.prototype.updateConnectionWaypoints=function(e){var t=Ge(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},kn.prototype.updateConnection=function(e){var t=e.connection,n=Z(t),i=t.source,r=Z(i),o=t.target,a=Z(t.target),s;if(v(n,"bpmn:DataAssociation"))v(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):v(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=v(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(wt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(wt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},kn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Dn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;v(i,"bpmn:BaseElement")&&e(t)}}function vA(e){if(v(e,"bpmn:Activity")){var t=Ge(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function fr(e,t){ki.call(this),this._bpmnFactory=e,this._moddle=t}ae(fr,ki),fr.$inject=["bpmnFactory","moddle"],fr.prototype._baseCreate=ki.prototype.create,fr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,O({type:"label",di:n},Nr,t))}return this.createElement(e,t)},fr.prototype.createElement=function(e,t){t=O({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!bA(r)){var o=O({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}v(i,"bpmn:Group")&&(t=O({isFrame:!0},t)),t=_A(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Dp(r,t,"isExpanded")),Le(i,["bpmn:Lane","bpmn:Participant"])&&(t=Dp(r,t,"isHorizontal")),v(i,"bpmn:SubProcess")&&(t.collapsed=!Fe(i,r)),v(i,"bpmn:ExclusiveGateway")&&(En(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),$t(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),$t(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=O({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},fr.prototype.getDefaultSize=function(e,t){var n=Z(e);if(t=t||Ge(e),v(n,"bpmn:SubProcess"))return Fe(n,t)?{width:350,height:200}:{width:100,height:80};if(v(n,"bpmn:Task"))return{width:100,height:80};if(v(n,"bpmn:Gateway"))return{width:50,height:50};if(v(n,"bpmn:Event"))return{width:36,height:36};if(v(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Fe(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return v(n,"bpmn:Lane")?{width:400,height:100}:v(n,"bpmn:DataObjectReference")?{width:36,height:50}:v(n,"bpmn:DataStoreReference")?{width:50,height:50}:v(n,"bpmn:TextAnnotation")?{width:100,height:40}:v(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},fr.prototype.createParticipantShape=function(e){return Gt(e)||(e={isExpanded:e}),e=O({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function _A(e,t,n){return k(n,function(i){t=Dp(e,t,i)}),t}function Dp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],si(t,[n]))}function bA(e){return Le(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function gc(e,t){this._modeling=e,this._canvas=t}gc.$inject=["modeling","canvas"],gc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;k(n,function(r){var o={x:0,y:0};$t(i.left)?o.x=i.left-r.x:$t(i.right)?o.x=i.right-r.width-r.x:$t(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:$t(i.top)?o.y=i.top-r.y:$t(i.bottom)?o.y=i.bottom-r.height-r.y:$t(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},gc.prototype.postExecute=function(e){};function yc(e){this._modeling=e}yc.$inject=["modeling"],yc.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},yc.prototype.postExecute=function(e){var t=e.hints||{};xA(e.source,e.shape)||(t.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))};function xA(e,t){return Wi(e.outgoing,function(n){return n.target===t})}function vc(e,t){this._canvas=e,this._layouter=t}vc.$inject=["canvas","layouter"],vc.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},vc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var _c=Math.round;function Op(e){this._modeling=e}Op.$inject=["modeling"],Op.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;k(t,function(p){Ee(p.x)||(p.x=0),Ee(p.y)||(p.y=0)});var s=Ie(t,function(p){return!p.hidden}),c=At(s);k(t,function(p){rt(p)&&(p.waypoints=on(p.waypoints,function(f){return{x:_c(f.x-c.x-c.width/2+r.x),y:_c(f.y-c.y-c.height/2+r.y)}})),O(p,{x:_c(p.x-c.x-c.width/2+r.x),y:_c(p.y-c.y-c.height/2+r.y)})});var u=new Set(xs(t)),l={};k(t,function(p){if(rt(p)){l[p.id]=Ee(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=O({},o);u.has(p)||(f.autoResize=!1),De(p)&&(f=si(f,["attach"])),l[p.id]=Ee(i)?a.createShape(p,ii(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,ii(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Qr(l)};var Ny=Math.round;function dr(e){this._canvas=e}dr.$inject=["canvas"],dr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?O(t,n):O(t,{x:n.x-Ny(t.width/2),y:n.y-Ny(t.height/2)}),this._canvas.addShape(t,i,r),t},dr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function ya(e){dr.call(this,e)}ae(ya,dr),ya.$inject=["canvas"];var wA=dr.prototype.execute;ya.prototype.execute=function(e){var t=e.shape;return SA(t),t.labelTarget=e.labelTarget,wA.call(this,e)};var EA=dr.prototype.revert;ya.prototype.revert=function(e){return e.shape.labelTarget=null,EA.call(this,e)};function SA(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function va(e,t){this._canvas=e,this._modeling=t}va.$inject=["canvas","modeling"],va.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},va.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=sl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},va.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,St(n.children,t,i),this._canvas.addConnection(t,n),t};function Lp(e,t){this._modeling=e,this._elementRegistry=t}Lp.$inject=["modeling","elementRegistry"],Lp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;k(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function _a(e,t){this._canvas=e,this._modeling=t}_a.$inject=["canvas","modeling"],_a.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),pr(n.children,function(i){rt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},_a.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=sl(i.children,n),t.removeShape(n),n},_a.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return St(i.children,n,r),t.addShape(n,i),n};function bc(e){this._modeling=e}bc.$inject=["modeling"];var By={x:"y",y:"x"};bc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,R){g.range.min=Math.min(R[i],g.range.min),g.range.max=Math.max(R[i]+R[r],g.range.max)}function a(g){return g[i]+g[r]/2}function s(g){return g.length-1}function c(g){return g.max-g.min}function u(g,R){var w={y:0};w[i]=g-a(R),w[i]&&(w[By[i]]=0,t.moveElements([R],w,R.parent))}var l=n[0],p=s(n),f=n[p],d,h,m=0;k(n,function(g,R){var w,b,x;if(g.elements.length<2){R&&R!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}w=ai(g.elements,i),b=w[0],R===p&&(b=w[s(w)]),x=a(b),g.range=null,k(w,function(S){if(u(x,S),g.range===null){g.range={min:S[i],max:S[i]+S[r]};return}o(g,S)}),R&&R!==n.length-1&&(m+=c(g.range))}),h=Math.abs(f.range.min-l.range.max),d=Math.round((h-m)/(n.length-1)),!(d<n.length-1)&&k(n,function(g,R){var w={},b;g===l||g===f||(b=n[R-1],g.range.max=0,k(g.elements,function(x,S){w[By[i]]=0,w[i]=b.range.max-x[i]+d,g.range.min!==x[i]&&(w[i]+=x[i]-g.range.min),w[i]&&t.moveElements([x],w,x.parent),g.range.max=Math.max(x[i]+x[r],S?g.range.max:0)}))})},bc.prototype.postExecute=function(e){};function xc(e,t){this._layouter=e,this._canvas=t}xc.$inject=["layouter","canvas"],xc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return O(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},xc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Ip(){}Ip.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=wt(o.children,t),St(i.children,t,r),t.parent=i,k(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},Ip.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return wt(n.children,t),St(i.children,t,r),t.parent=i,k(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function Np(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Np.prototype.add=function(e,t){return this.addAll([e],t)},Np.prototype.addAll=function(e,t){var n=e1(e,!!t,this);return O(this,n),this};function ba(e){this._modeling=e}ba.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ba.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),k(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),k(s,function(p){var f=!!a[p.source.id],d=!!a[p.target.id];c[p.id]&&f&&d?o.moveConnection(p,t,u[p.id]&&!l&&n):o.layoutConnection(p,{connectionStart:f&&Vl(p,p.source,t),connectionEnd:d&&Gl(p,p.target,t)})})},ba.prototype.getClosure=function(e){return new Np().addAll(e,!0)};function wc(e){this._helper=new ba(e)}wc.$inject=["modeling"],wc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},wc.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function zr(e){this._modeling=e,this._helper=new ba(e)}zr.$inject=["modeling"],zr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=ii(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=wt(o.children,t),St(i.children,t,r),O(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},zr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(k(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Gl(o,t,n)})}),k(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Vl(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},zr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return St(n.children,t,i),O(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},zr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},zr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function xa(e){this._modeling=e}xa.$inject=["modeling"],xa.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return _e(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},xa.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||$y(_e(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||$y(_e(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},xa.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function $y(e){return e.original||e}function Bi(e,t){this._modeling=e,this._rules=t}Bi.$inject=["modeling","rules"],Bi.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(h,m,g){return i.allowed("connection.reconnect",{connection:g,source:h,target:m})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();k(f,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,Ks(h,s,l),a)}),k(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,qs(h,s,l),a)})},Bi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Bi.prototype.execute=function(e){},Bi.prototype.revert=function(e){},Bi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Bi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Bi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function wa(e){this._modeling=e}wa.$inject=["modeling"],wa.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},O(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},wa.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(k(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Ks(o,n,i)})}),k(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:qs(o,n,i)})}))},wa.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return O(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function hr(e){this._modeling=e}hr.$inject=["modeling"],hr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),k(r,function(s){a[s.id]=CA(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(JP(i,r),t,n,o,i,r,a)},hr.prototype.execute=function(){},hr.prototype.revert=function(){},hr.prototype.moveShapes=function(e,t){var n=this;k(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},hr.prototype.resizeShapes=function(e,t,n){var i=this;k(e,function(r){var o=eA(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},hr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);k(e,function(l){var p=l.source,f=l.target,d=RA(l),h=Fy(n),m={},g=c.has(p)||u.has(p),R=c.has(f)||u.has(f);g&&R?(d=on(d,function(w){return Hy(w,i,n)&&(w[h]=w[h]+t[h]),w.original&&Hy(w.original,i,n)&&(w.original[h]=w.original[h]+t[h]),w}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||R)&&(c.has(p)?m.connectionStart=Vl(l,p,t):c.has(f)?m.connectionEnd=Gl(l,f,t):u.has(p)?m.connectionStart=qs(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=Ks(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function jy(e){return O({},e)}function RA(e){return on(e.waypoints,function(t){return t=jy(t),t.original&&(t.original=jy(t.original)),t})}function Fy(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Hy(e,t,n){var i=Fy(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function CA(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Ec(e){this._modeling=e}Ec.$inject=["modeling"],Ec.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=zy(n),t.collapsed=!t.collapsed;var i=Vy(n,t.collapsed);return[t].concat(i)},Ec.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Gy(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function zy(e){var t={};return k(e,function(n){t[n.id]=n.hidden,n.children&&(t=O({},t,zy(n.children)))}),t}function Vy(e,t){var n=[];return k(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Vy(i.children,i.collapsed||t)))}),n}function Gy(e,t){var n=[];return k(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Gy(i.children,t)))}),n}function Sc(e){this._modeling=e}Sc.$inject=["modeling"],Sc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Wy(i,t),Uy(n,t),t.host=n,t},Sc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Wy(n,t),Uy(i,t,r),t};function Wy(e,t){return wt(e&&e.attachers,t)}function Uy(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),St(i,t,n)}}function Bp(){}Bp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Bp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function ot(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}ot.$inject=["eventBus","elementFactory","commandStack"],ot.prototype.getHandlers=function(){return{"shape.append":yc,"shape.create":dr,"shape.delete":_a,"shape.move":zr,"shape.resize":wa,"shape.replace":Bi,"shape.toggleCollapse":Ec,spaceTool:hr,"label.create":ya,"connection.create":vc,"connection.delete":va,"connection.move":Ip,"connection.layout":xc,"connection.updateWaypoints":Bp,"connection.reconnect":xa,"elements.create":Op,"elements.move":wc,"elements.delete":Lp,"elements.distribute":bc,"elements.align":gc,"element.updateAttachment":Sc}},ot.prototype.registerHandlers=function(e){k(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},ot.prototype.moveShape=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},ot.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},ot.prototype.moveElements=function(e,t,n,i){i=i||{};var r=i.attach,o=n,a;r===!0?(a=n,o=n.parent):r===!1&&(a=null);var s={shapes:e,delta:t,newParent:o,newHost:a,hints:i};this._commandStack.execute("elements.move",s)},ot.prototype.moveConnection=function(e,t,n,i,r){typeof i=="object"&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},ot.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},ot.prototype.createConnection=function(e,t,n,i,r,o){typeof n=="object"&&(o=r,r=i,i=n,n=void 0),i=this._create("connection",i);var a={source:e,target:t,parent:r,parentIndex:n,connection:i,hints:o};return this._commandStack.execute("connection.create",a),a.connection},ot.prototype.createShape=function(e,t,n,i,r){typeof i!="number"&&(r=i,i=void 0),r=r||{};var o=r.attach,a,s;e=this._create("shape",e),o?(a=n.parent,s=n):a=n;var c={position:t,shape:e,parent:a,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",c),c.shape},ot.prototype.createElements=function(e,t,n,i,r){_e(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},ot.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},ot.prototype.appendShape=function(e,t,n,i,r){r=r||{},t=this._create("shape",t);var o={source:e,position:n,target:i,shape:t,connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},ot.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},ot.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},ot.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},ot.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},ot.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},ot.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},ot.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},ot.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},ot.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},ot.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},ot.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,O(i,{docking:"source"}))},ot.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,O(i,{docking:"target"}))},ot.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},ot.prototype._create=function(e,t){return j1(t)?t:this._elementFactory.create(e,t)},ot.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ea(e){this._elementRegistry=e}Ea.$inject=["elementRegistry"],Ea.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||PA(n,Xa(i));return Yy(n,i),e.oldProperties=o,e.changed=r,r},Ea.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Yy(n,t),i},Ea.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return v(e,"bpmn:DataObject")?AA(e,t):[]};function PA(e,t){return Sn(t,function(n,i){return n[i]=e.get(i),n},{})}function Yy(e,t){k(t,function(n,i){e.set(i,n)})}function AA(e,t){return t.filter(function(n){return v(n,"bpmn:DataObjectReference")&&Z(n).dataObjectRef===e})}var Sa="default",$i="id",qy="di",TA={width:0,height:0};function Ra(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ra.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ra.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=LA(e.properties),s=e.oldProperties||MA(t,a);return Ky(a,o)&&(r.unclaim(o[$i]),i.updateId(t,a[$i]),r.claim(a[$i],o)),Sa in a&&(a[Sa]&&n.push(i.get(a[Sa].id)),o[Sa]&&n.push(i.get(o[Sa].id))),Xy(t,a),e.oldProperties=s,e.changed=n,n},Ra.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&Z(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,TA)}},Ra.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Xy(t,i),Ky(n,r)&&(a.unclaim(n[$i]),o.updateId(t,i[$i]),a.claim(i[$i],r)),e.changed};function Ky(e,t){return $i in e&&e[$i]!==t[$i]}function MA(e,t){var n=Xa(t),i=e.businessObject,r=Ge(e);return Sn(n,function(o,a){return a!==qy?o[a]=i.get(a):o[a]=kA(r,Xa(t.di)),o},{})}function kA(e,t){return Sn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Xy(e,t){var n=e.businessObject,i=Ge(e);k(t,function(r,o){o!==qy?n.set(o,r):i&&DA(i,r)})}function DA(e,t){k(t,function(n,i){e.set(i,n)})}var OA=["default"];function LA(e){var t=O({},e);return OA.forEach(function(n){n in e&&(t[n]=Z(t[n]))}),t}function Rc(e,t){this._canvas=e,this._modeling=t}Rc.$inject=["canvas","modeling"],Rc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ge(r);return t.setRootElement(n),t.removeRootElement(r),St(a.rootElements,i),i.$parent=a,wt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Rc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ge(n);return t.setRootElement(r),t.removeRootElement(n),wt(a.rootElements,i),i.$parent=null,St(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function $p(e,t){this._modeling=e,this._spaceTool=t}$p.$inject=["modeling","spaceTool"],$p.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Yn(i),a=o===i,s=a?i:i.parent,c=ar(s),u=Ut(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+Un,y:i.y,width:i.width-Un,height:i.height}:{x:i.x,y:i.y+Un,width:i.width,height:i.height-Un};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Lr(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:Ie(x.children,function(S){return S!==i})});var f,d,h,m,g;r==="top"?(f=-120,d=i.y,h=d+10,m="n",g="y"):r==="left"?(f=-120,d=i.x,h=d+10,m="w",g="x"):r==="bottom"?(f=120,d=i.y+i.height,h=d-10,m="s",g="y"):r==="right"&&(f=120,d=i.x+i.width,h=d-10,m="e",g="x");var R=t.calculateAdjustments(p,g,f,h),w=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(R.movingShapes,R.resizingShapes,w,m,h);var b=u?{x:i.x+(a?Un:0),y:d-(r==="top"?120:0),width:i.width-(a?Un:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Un:0),width:120,height:i.height-(a?Un:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function jp(e){this._modeling=e}jp.$inject=["modeling"],jp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=ar(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Ut(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,p,f;for(f=0;f<i;f++)f===i-1?u=s-c*f:u=c,l=a?{x:n.x+Un,y:n.y+f*c,width:n.width-Un,height:u}:{x:n.x+f*c,y:n.y+Un,width:u,height:n.height-Un},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function Ca(e,t){this._modeling=e,this._spaceTool=t}Ca.$inject=["modeling","spaceTool"],Ca.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ca.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=AR(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ca.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ge(e),r=ge(t),o=Am(r,i),a=Yn(e),s=[],c=[];Lr(a,function(h){return s.push(h),(v(h,"bpmn:Lane")||v(h,"bpmn:Participant"))&&c.push(h),h.children});var u,l,p,f,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),p=o.bottom?"s":"n",f=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},p)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),p=o.right?"e":"w",f=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",f,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},p))};var Pa="flowNodeRef",Fp="lanes";function Cc(){}Cc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=ge(p),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>f.left&&d.x<f.right&&d.y>f.top&&d.y<f.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var p=Yn(l);return r[p.id]||(r[p.id]=Vs(p)),r[p.id]}function u(l){if(!l.parent)return[];var p=c(l);return p.filter(function(f){return a(l,f)}).map(function(f){return f.businessObject})}return t.forEach(function(l){var p=Yn(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return v(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get(Fp),d=f.slice(),h=u(l);i.push({flowNode:p,remove:d,add:h})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get(Pa).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},Cc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(Fp);n.remove.forEach(function(o){wt(r,o),wt(o.get(Pa),i)}),n.add.forEach(function(o){St(r,o),St(o.get(Pa),i)})}),[]},Cc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Fp);n.add.forEach(function(o){wt(r,o),wt(o.get(Pa),i)}),n.remove.forEach(function(o){St(r,o),St(o.get(Pa),i)})}),[]};var Hp="categoryValueRef";function Aa(e,t){this._bpmnFactory=e,this._elementRegistry=t}Aa.$inject=["bpmnFactory","elementRegistry"],Aa.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(w,b,x){if(b){var S=a.get(w);S||(S={},a.set(w,S)),!(x&&S.present)&&(!x&&S.past||(x?S.present={categoryValue:b,root:zp(w)}:S.past={categoryValue:b}))}}function c(w){r.set(w,Z(w))}function u(){n.filter(function(w){return v(w,"bpmn:FlowElement")&&!De(w)&&w.parent}).forEach(c)}function l(w){var b=Z(w),x=b.get("categoryValueRef");return x||(x=Em(i,b),o.push(IA(w,x))),x}function p(w){return w.reduce(function(b,x){var S=zp(x),M=b.get(S);return M||(M=[],b.set(S,M)),M.push(x),b},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(w){return v(w,"bpmn:Group")&&!De(w)&&w.parent}).forEach(function(w){var b=Z(w).get("categoryValueRef");if(!b){var x=zp(w),S=f.get(x)||[],M=so(S,w),I=Object.keys(M).length>0;I&&(b=l(w))}s(w,b,!0)}),t.forEach(function(w){s(w.groupShape,w.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(w,b){return b.present&&w.add(b.present.categoryValue),b.past&&w.add(b.past.categoryValue),w},new Set),m=new Map,g=p(d);a.forEach(function(w,b){var x=w.present;if(x){var S=g.get(x.root)||[],M=so(S,b);S.forEach(function(I){if(M[I.id]){var A=m.get(I);A||(A=new Set,m.set(I,A)),A.add(x.categoryValue)}})}});var R=d.reduce(function(w,b){var x=r.get(b),S=x.get(Hp),M=new Set(S),I=m.get(b)||new Set,A=Array.from(I).filter(function(V){return!M.has(V)}),H=S.filter(function(V){return h.has(V)&&!I.has(V)});return(A.length||H.length)&&w.push({businessObject:x,categoryValuesToAdd:A,categoryValuesToRemove:H}),w},[]);return{flowElements:R,groups:o}},Aa.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),NA(t.groups),$A(t.flowElements),[]},Aa.prototype.revert=function(e){var t=e.updates;return jA(t.flowElements),BA(t.groups),[]};function IA(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function NA(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function BA(e){e.forEach(function(t){Z(t.groupShape).categoryValueRef=null})}function $A(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Hp);t.categoryValuesToRemove.forEach(function(r){wt(i,r)}),t.categoryValuesToAdd.forEach(function(r){St(i,r,!0)})})}function jA(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Hp);t.categoryValuesToAdd.forEach(function(r){wt(i,r)}),t.categoryValuesToRemove.forEach(function(r){St(i,r,!0)})})}function zp(e){for(;e.parent;)e=e.parent;return e}function Pc(e){this._moddle=e}Pc.$inject=["moddle"],Pc.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},Pc.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var FA={fill:void 0,stroke:void 0};function Vp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(wn(t)){var n=HA(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Vp.$inject=["commandStack"],Vp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||FA,i=this,r={};"fill"in n&&O(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&O(r,{"border-color":this._normalizeColor(n.stroke)}),k(t,function(o){var a=rt(o)?ii(r,["border-color"]):r,s=Ge(o);if(zA(a),De(o)){if(!s||!v(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!Le(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function HA(e){var t=document.createElement("canvas").getContext("2d");return t.fillStyle="transparent",t.fillStyle=e,/^#[0-9a-fA-F]{6}$/.test(t.fillStyle)?t.fillStyle:null}function zA(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var VA={width:0,height:0};function Zy(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return yS(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!De(u)&&rr(u)&&!Ms(u)&&!Qy(p)){var f=7,d=dl(u);d={x:d.x,y:d.y+f},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=Hn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!De(l)&&!v(l,"bpmn:TextAnnotation"))){if(De(l)&&Qy(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=Hn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,VA)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Zy.$inject=["modeling","textRenderer","bpmnFactory"];function Qy(e){return!e||!e.trim()}function tn(e,t,n,i){ot.call(this,e,t,n),this._bpmnRules=i}ae(tn,ot),tn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],tn.prototype.getHandlers=function(){var e=ot.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ea,e["element.updateProperties"]=Ra,e["canvas.updateRoot"]=Rc,e["lane.add"]=$p,e["lane.resize"]=Ca,e["lane.split"]=jp,e["lane.updateRefs"]=Cc,e["group.updateRefs"]=Aa,e["id.updateClaim"]=Pc,e["element.setColor"]=Vp,e["element.updateLabel"]=Zy,e},tn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},tn.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},tn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},tn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},tn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},tn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},tn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},tn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},tn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},tn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},tn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},tn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},tn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},tn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Jy(){}Jy.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||be(t.source||e.source),t.connectionEnd||be(t.target||e.target)]};var Ac=20,GA=5,Tc=Math.round,ev=20,WA={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function UA(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function YA(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function tv(e,t,n){var i=Qt(t,e,GA),r=n.split(":")[0],o=Tc((t.x-e.x)/2+e.x),a=Tc((t.y-e.y)/2+e.y),s,c,u=YA(r,i),l=/h|r|l/.test(r),p=!1,f=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(p=UA(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Ac*(/l/.test(r)?-1:1),y:f?a+Ac:a}):(f=o===e.x,s={x:f?o+Ac:o,y:e.y+Ac*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Gp(e,s,c).concat(s),directions:c,turnNextDirections:f}}function qA(e,t,n){return tv(e,t,n)}function KA(e,t,n){var i=tv(t,e,nv(n));return{waypoints:i.waypoints.slice().reverse(),directions:nv(i.directions),turnNextDirections:i.turnNextDirections}}function XA(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n=n=="h"?"v":"h"),t.turnNextDirections&&(i=i=="h"?"v":"h");var r=n+":"+i,o=Gp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function nv(e){return e.split(":").reverse().join(":")}function ZA(e,t,n){var i=Tc((t.x-e.x)/2+e.x),r=Tc((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function Gp(e,t,n){if(n=n||"h:h",!aT(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(rv(n)){var i=qA(e,t,n),r=KA(e,t,n),o=XA(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return ZA(e,t,n)}function QA(e,t,n){var i=Gp(e,t,n);return i.unshift(e),i.push(t),av(i)}function JA(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=e0(o,"straight")[0]||"h:h",s=WA[a]||0,c=Qt(e,t,s),u=oT(c,a);n=n||be(e),i=i||be(t);var l=u.split(":"),p=ov(n,e,l[0],sT(c)),f=ov(i,t,l[1],c);return QA(p,f,u)}function eT(e,t,n,i,r,o){_e(n)&&(r=n,o=i,n=be(e),i=be(t)),o=O({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&nT(e,t,n,i,o),c||(c=o.connectionEnd&&rT(t,e,i,r),c)||(c=o.connectionStart&&iT(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:JA(e,t,n,i,o)}function tT(e,t,n){return e>=t&&e<=n}function iv(e,t,n){var i={x:"width",y:"height"};return tT(t[e],n[e],n[e]+n[i[e]])}function nT(e,t,n,i,r){var o={},a,s;return s=Qt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?iv(a,i,e)?(o[a]=i[a],[{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y,original:{x:o.x!==void 0?o.x:n.x,y:o.y!==void 0?o.y:n.y}},{x:i.x,y:i.y}]):null:iv(a,n,t)?(o[a]=n[a],[{x:n.x,y:n.y},{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y,original:{x:o.x!==void 0?o.x:i.x,y:o.y!==void 0?o.y:i.y}}]):null):null}function iT(e,t,n,i){return Wp(e,t,n,i)}function rT(e,t,n,i){var r=i.slice().reverse();return r=Wp(e,t,n,r),r?r.reverse():null}function Wp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!ct(l,function(p,f){var d=l[f-1];return d&&Qo(p,d)<3})}function o(l,p,f){var d=Ti(p,l);switch(d){case"v":return{x:f.x,y:l.y};case"h":return{x:l.x,y:f.y}}return{x:l.x,y:l.y}}function a(l,p,f){var d;for(d=l.length-2;d!==0;d--)if(Th(l[d],p,ev)||Th(l[d],f,ev))return l.slice(d);return l}if(r(i))return null;var s=i[0],c=i.slice(),u;return c[0]=n,c[1]=o(c[1],s,n),u=a(c,e,t),u!==c&&(c=Wp(e,t,n,u)),c&&Ti(c)?null:c}function oT(e,t){if(rv(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}function aT(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function rv(e){return e&&/t|r|b|l/.test(e)}function sT(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function ov(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function av(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return cl(r,o,n,0)||t.push(n),t},[])}var cT=-10,uT=40,lT={default:["h:h"],fromGateway:["v:h"],toGateway:["h:v"],loop:{fromTop:["t:r"],fromRight:["r:b"],fromLeft:["l:t"],fromBottom:["b:l"]},boundaryLoop:{alternateHorizontalSide:"b",alternateVerticalSide:"l",default:"v"},messageFlow:["straight","v:v"],subProcess:["straight","h:h"],isHorizontal:!0},pT={default:["v:v"],fromGateway:["h:v"],toGateway:["v:h"],loop:{fromTop:["t:l"],fromRight:["r:t"],fromLeft:["l:b"],fromBottom:["b:r"]},boundaryLoop:{alternateHorizontalSide:"t",alternateVerticalSide:"r",default:"h"},messageFlow:["straight","h:h"],subProcess:["straight","v:v"],isHorizontal:!1},Up={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Ta={top:"t",right:"r",bottom:"b",left:"l"};function Mc(e){this._elementRegistry=e}ae(Mc,Jy),Mc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=sv(r&&r[0],n)),a||(a=sv(r&&r[r.length-1],i)),(v(e,"bpmn:Association")||v(e,"bpmn:DataAssociation"))&&r&&!cv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=_m(n,s)?lT:pT;return v(e,"bpmn:MessageFlow")?c=dT(n,i,l):(v(e,"bpmn:SequenceFlow")||cv(n,i))&&(n===i?c={preferredLayouts:_T(n,e,l)}:v(n,"bpmn:BoundaryEvent")?c={preferredLayouts:bT(n,i,a,l)}:Ma(n)||Ma(i)?c={preferredLayouts:l.subProcess,preserveDocking:mT(n)}:v(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:v(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=O(c,t),u=av(eT(n,i,o,a,r,c))),u||[o,a]};function fT(e){var t=e.host;return Qt(be(e),t,cT)}function dT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:hT(e,t)}}function hT(e,t){return v(t,"bpmn:Participant")?"source":v(e,"bpmn:Participant")?"target":Ma(t)?"source":Ma(e)||v(t,"bpmn:Event")?"target":v(e,"bpmn:Event")?"source":null}function mT(e){return Ma(e)?"target":"source"}function sv(e,t){return e?e.original||e:be(t)}function cv(e,t){return v(t,"bpmn:Activity")&&v(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Ma(e){return v(e,"bpmn:SubProcess")&&Fe(e)}function Vr(e,t){return e===t}function gT(e,t){return t.indexOf(e)!==-1}function Po(e){var t=/right|left/.exec(e);return t&&t[0]}function Ao(e){var t=/top|bottom/.exec(e);return t&&t[0]}function uv(e,t){return Up[e]===t}function yT(e,t){var n=Po(e),i=Up[n];return t.indexOf(i)!==-1}function vT(e,t){var n=Ao(e),i=Up[n];return t.indexOf(i)!==-1}function lv(e){return e==="right"||e==="left"}function _T(e,t,n){var i=t.waypoints,r=i&&i.length&&Qt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function bT(e,t,n,i){var r=be(e),o=be(t),a=fT(e),s,c,u=Vr(e.host,t),l=gT(a,["top","right","bottom","left"]),p=Qt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?xT(a,l,e,t,n,i):(s=wT(a,p,l,i.isHorizontal),c=ET(a,p,l,i.isHorizontal),[s+":"+c])}function xT(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Ao(e):Po(e),s=Ta[a],c;return t?lv(e)?c=pv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=pv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function pv(e,t,n,i){var r=uT;return!(Yp(e,i,n,r)||Yp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Yp(e,i,be(t),r))}function Yp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function wT(e,t,n,i){if(n)return Ta[e];var r=Ao(e),o=Po(e),a=Ao(t),s=Po(t);if(i){if(Vr(r,a)||uv(o,s))return Ta[r]}else if(Vr(o,s)||uv(r,a))return Ta[o];return Ta[i?o:r]}function ET(e,t,n,i){if(n)return lv(e)?yT(e,t)||Vr(e,t)?"h":"v":vT(e,t)||Vr(e,t)?"v":"h";var r=Ao(e),o=Po(e),a=Ao(t),s=Po(t);return a&&!s?"v":s&&!a?"h":i?Vr(r,a)?"h":"v":Vr(o,s)?"v":"h"}Mc.$inject=["elementRegistry"];function fv(e){return O({original:e.point.original||e.point},e.actual)}function mr(e,t){this._elementRegistry=e,this._graphicsFactory=t}mr.$inject=["elementRegistry","graphicsFactory"],mr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(fv(i)),o.push(fv(r)),o},mr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},mr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Jo(i,r,n)},mr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},mr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},mr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const qp={__init__:["modeling","bpmnUpdater"],__depends__:[zC,rP,aP,sP,Sy,cA,lA,gA,Kn,kp,My],bpmnFactory:["type",Zn],bpmnUpdater:["type",kn],elementFactory:["type",fr],modeling:["type",tn],layouter:["type",Mc],connectionDocking:["type",mr]};var ST=10,dv=50,RT=250;function Kp(e,t,n,i){for(var r;r=CT(e,n,t);)n=i(t,n,r);return n}function Xp(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,u=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-u+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+u+c)}}),r}}function CT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=AT(e);return ct(r,function(o){if(o===n)return!1;var a=Qt(o,i,ST);return a==="intersect"})}function PT(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||dv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||RT,c=t.reference||"start";o||(o=kT);function u(h,m){return r==="n"?c==="start"?ge(h).top-ge(m).bottom:c==="center"?ge(h).top-be(m).y:ge(h).top-ge(m).top:r==="w"?c==="start"?ge(h).left-ge(m).right:c==="center"?ge(h).left-be(m).x:ge(h).left-ge(m).left:r==="s"?c==="start"?ge(m).top-ge(h).bottom:c==="center"?be(m).y-ge(h).bottom:ge(m).bottom-ge(h).bottom:c==="start"?ge(m).left-ge(h).right:c==="center"?be(m).x-ge(h).right:ge(m).right-ge(h).right}var l=e.incoming.filter(o).map(function(h){var m=a(h),g=m<0?u(h.source,e):u(e,h.source);return{id:h.source.id,distance:g,weight:m}}),p=e.outgoing.filter(o).map(function(h){var m=a(h),g=m>0?u(e,h.target):u(h.target,e);return{id:h.target.id,distance:g,weight:m}}),f=l.concat(p).reduce(function(h,m){return h[m.id+"__weight_"+m.weight]=m,h},{}),d=Sn(f,function(h,m){var g=m.distance,R=m.weight;return g<0||g>s||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*R,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function AT(e){var t=Zp(e);return e.host&&(t=t.concat(Zp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Zp(i))},[]))),t}function Zp(e){return MT(e).concat(TT(e))}function TT(e){return e.incoming.map(function(t){return t.source})}function MT(e){return e.outgoing.map(function(t){return t.target})}function kT(){return!0}var DT=100;function hv(e,t,n){e.on("autoPlace",DT,function(i){var r=i.shape,o=i.source;return OT(o,r)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,r,o){e.fire("autoPlace.start",{source:i,shape:r});var a=e.fire("autoPlace",{source:i,shape:r}),s=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:s}),s}}hv.$inject=["eventBus","modeling","canvas"];function OT(e,t,n){n||(n={});var i=n.defaultDistance||dv,r=be(e),o=ge(e);return{x:o.right+i+t.width/2,y:r.y}}function mv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}mv.$inject=["eventBus","selection"];const LT={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",hv],autoPlaceSelectionBehavior:["type",mv]};function gv(e,t,n){var i=_m(e,n);if(v(t,"bpmn:TextAnnotation"))return NT(e,t,i);if(Le(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return BT(e,t,i);if(v(t,"bpmn:FlowNode"))return IT(e,t,i)}function IT(e,t,n){var i=ge(e),r=be(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=PT(e,{filter:function(d){return v(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;v(e,"bpmn:BoundaryEvent")&&(u=Qt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+yv(u,c,o)}:{x:r.x+yv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Kp(e,t,l,Xp(f))}function yv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function NT(e,t,n){var i=ge(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};rt(e)&&(r=be(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return Kp(e,t,r,Xp(a))}function BT(e,t,n){var i=ge(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return Kp(e,t,r,Xp(a))}function vv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return gv(r,i,t)})}vv.$inject=["eventBus","elementRegistry"];const kc={__depends__:[LT],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",vv]},_v=[ym,oa,qp,kc];function $T(e={}){vd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new lo({container:t,moddleExtensions:e.moddleExtensions??is,additionalModules:[..._v,...e.additionalModules??[]]})}var jT=new Ro("ov"),FT=500;function qt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=jT,this._overlayDefaults=O({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=HT(n.getContainer()),this._init()}qt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],qt.prototype.get=function(e){if(wn(e)&&(e={id:e}),wn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ie(t.overlays,eo({type:e.type})):t.overlays.slice():[]}else return e.type?Ie(this._overlays,eo({type:e.type})):e.id?this._overlays[e.id]:null},qt.prototype.add=function(e,t,n){if(Gt(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=O({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},qt.prototype.remove=function(e){var t=this.get(e)||[];_e(t)||(t=[t]);var n=this;k(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(pi(i.html),pi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},qt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},qt.prototype.show=function(){Dc(this._overlayRoot)},qt.prototype.hide=function(){Dc(this._overlayRoot,!1)},qt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ms(this._overlayRoot)},qt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=At(t);i=o.x,r=o.y}bv(n,i,r),sn(e.html,"data-container-id",t.id)},qt.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=At(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=At(i).height:s=i.height,o=t.bottom*-1+s}bv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},qt.prototype._createOverlayContainer=function(e){var t=ut('<div class="djs-overlays" />');gn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},qt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";xv(this._overlayRoot,n)},qt.prototype._getOverlayContainer=function(e,t){var n=ct(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},qt.prototype._addOverlay=function(e){var t=e.id,n=e.element,i=e.html,r,o;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),wn(i)&&(i=ut(i)),o=this._getOverlayContainer(n),r=ut('<div class="djs-overlay" data-overlay-id="'+t+'">'),gn(r,{position:"absolute"}),r.appendChild(i),e.type&&gt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Dc(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},qt.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&($t(r)&&r>t.scale||$t(o)&&o<t.scale))&&(c=!1),Dc(a,c),this._updateOverlayScale(e,t)},qt.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),$t(i)&&t.scale<i&&(a=(1/t.scale||1)*i),$t(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),$t(a)&&(s="scale("+a+","+a+")"),xv(o,s)},qt.prototype._updateOverlaysVisibilty=function(e){var t=this;k(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},qt.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});k(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){pi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",FT,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(k(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&gt(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function HT(e){var t=ut('<div class="djs-overlay-container" />');return gn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function bv(e,t,n){gn(e,{left:t+"px",top:n+"px"})}function Dc(e,t){e.style.display=t===!1?"none":""}function xv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Oc={__init__:["overlays"],overlays:["type",qt]};function Qp(e,t){t.invoke(K,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}ae(Qp,K),Qp.$inject=["canvas","injector"];const zT={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Qp]};function ka(e){return CSS.escape(e)}var VT={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function wv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return VT[t]})}var GT="bjs-breadcrumbs-shown";function Ev(e,t,n){var i=ut('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=gt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=Z(u),p=ct(a,function(f){return f===l});p&&s()});function s(c){c&&(a=WT(c));var u=a.flatMap(function(p){var f=n.findRoot(gi(p))||n.findRoot(p.id);if(!f&&v(p,"bpmn:Process")){var d=t.find(function(g){var R=Z(g);return R&&R.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=wv(p.name||p.id),m=ut('<li><span class="bjs-crumb"><a title="'+h+'">'+h+"</a></span></li>");return m.addEventListener("click",function(){n.setRootElement(f)}),m});i.innerHTML="";var l=u.length>1;o.toggle(GT,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}Ev.$inject=["eventBus","elementRegistry","canvas"];function WT(e){for(var t=Z(e),n=[],i=t;i;i=i.$parent)(v(i,"bpmn:SubProcess")||v(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Sv(e,t){var n=null,i=new UT;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!v(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Sv.$inject=["eventBus","canvas"];function UT(){this._entries=[],this.set=function(e,t){var n=!1;for(var i in this._entries)if(this._entries[i][0]===e){this._entries[i][1]=t,n=!0;break}n||this._entries.push([e,t])},this.get=function(e){for(var t in this._entries)if(this._entries[t][0]===e)return this._entries[t][1];return null},this.clear=function(){this._entries.length=0},this.remove=function(e){var t=-1;for(var n in this._entries)if(this._entries[n][0]===e){t=n;break}t!==-1&&this._entries.splice(t,1)}}var Rv={x:180,y:160};function Gr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Gr.prototype._handleImport=function(e){if(e.diagrams){var t=this;this._definitions=e,this._processToDiagramMap={},e.diagrams.forEach(function(i){!i.plane||!i.plane.bpmnElement||(t._processToDiagramMap[i.plane.bpmnElement.id]=i)});var n=e.diagrams.filter(i=>i.plane).flatMap(i=>t._createNewDiagrams(i.plane));n.forEach(function(i){t._movePlaneElementsToOrigin(i.plane)})}},Gr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;v(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),qT(a,e)&&i.push({diElement:o,parent:s})}});var r=[];return n.forEach(function(o){if(!t._processToDiagramMap[o.id]){var a=t._createDiagram(o);t._processToDiagramMap[o.id]=a,r.push(a)}}),i.forEach(function(o){for(var a=o.diElement,s=o.parent;s&&n.indexOf(s)===-1;)s=s.$parent;if(s){var c=t._processToDiagramMap[s.id];t._moveToDiPlane(a,c.plane)}}),r},Gr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=YT(e),i={x:n.x-Rv.x,y:n.y-Rv.y};t.forEach(function(r){r.waypoint?r.waypoint.forEach(function(o){o.x=o.x-i.x,o.y=o.y-i.y}):r.bounds&&(r.bounds.x=r.bounds.x-i.x,r.bounds.y=r.bounds.y-i.y)})},Gr.prototype._moveToDiPlane=function(e,t){var n=Cv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Gr.prototype._createDiagram=function(e){var t=this._moddle.create("bpmndi:BPMNPlane",{bpmnElement:e}),n=this._moddle.create("bpmndi:BPMNDiagram",{plane:t});return t.$parent=n,t.bpmnElement=e,n.$parent=this._definitions,this._definitions.diagrams.push(n),n},Gr.$inject=["eventBus","moddle"];function Cv(e){return v(e,"bpmndi:BPMNDiagram")?e:Cv(e.$parent)}function YT(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=ge(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Ss(t)}function qT(e,t){var n=e.$parent;return!(!v(n,"bpmn:SubProcess")||n===t.bpmnElement||Le(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Lc=250,KT='<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 16 16"><path fill-rule="evenodd" d="M4.81801948,3.50735931 L10.4996894,9.1896894 L10.5,4 L12,4 L12,12 L4,12 L4,10.5 L9.6896894,10.4996894 L3.75735931,4.56801948 C3.46446609,4.27512627 3.46446609,3.80025253 3.75735931,3.50735931 C4.05025253,3.21446609 4.52512627,3.21446609 4.81801948,3.50735931 Z"/></svg>',XT="bjs-drilldown-empty";function gr(e,t,n,i,r){K.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",Lc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Lc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Lc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],Lc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}ae(gr,K),gr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},gr.prototype._canDrillDown=function(e){var t=this._canvas;return v(e,"bpmn:SubProcess")&&t.findRoot(gi(e))},gr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=Z(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;gt(i.html).toggle(XT,!r)}},gr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=Z(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=ut('<button type="button" class="bjs-drilldown">'+KT+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(gi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},gr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},gr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const ZT={__depends__:[Oc,kp,zT],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Ev],drilldownCentering:["type",Sv],drilldownOverlayBehavior:["type",gr],subprocessCompatibility:["type",Gr]};function yr(e){yt.call(this,e)}ae(yr,yt),yr.prototype._modules=[ym,ZT,Oc,Kn,oa],yr.prototype._moddleExtensions={};var Ic="keyboard.keydown",QT="keyboard.keyup",JT=1e3,Pv="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function yn(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(Pv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}yn.$inject=["config.keyboard","eventBus"],yn.prototype._keydownHandler=function(e){this._keyHandler(e,Ic)},yn.prototype._keyupHandler=function(e){this._keyHandler(e,QT)},yn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Ic,i),n&&e.preventDefault()}},yn.prototype._isEventIgnored=function(e){return!1},yn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Pv)),this.unbind(),e=this._node=this._target,Re.bind(e,"keydown",this._keydownHandler),Re.bind(e,"keyup",this._keyupHandler),this._fire("bind")},yn.prototype.getBinding=function(){return this._node},yn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Re.unbind(e,"keydown",this._keydownHandler),Re.unbind(e,"keyup",this._keyupHandler)),this._node=null},yn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},yn.prototype.addListener=function(e,t,n){Wt(e)&&(n=t,t=e,e=JT),this._eventBus.on(n||Ic,e,t)},yn.prototype.removeListener=function(e,t){this._eventBus.off(t||Ic,e)},yn.prototype.hasModifier=bP,yn.prototype.isCmd=Tn,yn.prototype.isShift=bp,yn.prototype.isKey=zt;var eM=500;function To(e,t){var n=this;e.on("editorActions.init",eM,function(i){var r=i.editorActions;n.registerBindings(t,r)})}To.$inject=["eventBus","keyboard"],To.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(RP(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(CP(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(xP(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(wP(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(EP(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(SP(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(zt(["+","Add","="],r)&&Tn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(zt(["-","Subtract"],r)&&Tn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(zt("0",r)&&Tn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(zt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Jp={__init__:["keyboard","keyboardBindings"],keyboard:["type",yn],keyboardBindings:["type",To]};var tM={moveSpeed:50,moveSpeedAccelerated:200};function Av(e,t,n){var i=this;this._config=O({},tM,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,u;switch(a.key){case"ArrowLeft":case"Left":u="left";break;case"ArrowUp":case"Up":u="up";break;case"ArrowRight":case"Right":u="right";break;case"ArrowDown":case"Down":u="down";break}return i.moveCanvas({speed:c,direction:u}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,u=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=u;break;case"up":s=u;break;case"right":a=-u;break;case"down":s=-u;break}n.scroll({dx:a,dy:s})}}Av.$inject=["config.keyboardMove","keyboard","canvas"];const Tv={__depends__:[Jp],__init__:["keyboardMove"],keyboardMove:["type",Av]};var nM=15;function Mv(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=$r(s),p=ri(l,c);if(!n.dragging&&iM(p)>nM&&(n.dragging=!0,u===0&&iy(e),cc("grab")),n.dragging){var f=n.last||n.start;p=ri(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){Re.unbind(document,"mousemove",r),Re.unbind(document,"mouseup",o),n=null,ny()}function a(s){if(!Dr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:$r(s)},Re.bind(document,"mousemove",r),Re.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Mv.$inject=["eventBus","canvas"];function iM(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const kv={__init__:["moveCanvas"],moveCanvas:["type",Mv]};function Dv(e,t){var n=yl(e.min),i=yl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function rM(e,t){return Math.max(e.min,Math.min(e.max,t))}var oM=Math.sign||function(e){return e>=0?1:-1},ef={min:.2,max:4},Ov=10,aM=.1,sM=.75;function _i(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=_n(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||sM;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}_i.$inject=["config.zoomScroll","eventBus","canvas"],_i.prototype.scroll=function(t){this._canvas.scroll(t)},_i.prototype.reset=function(){this._canvas.zoom("fit-viewport")},_i.prototype.zoom=function(t,n){var i=Dv(ef,Ov*2);this._totalDelta+=t,Math.abs(this._totalDelta)>aM&&(this._zoom(t,n,i),this._totalDelta=0)},_i.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||lg()&&t.metaKey,r=t.shiftKey,o=-1*this._scale,a;if(i?o*=t.deltaMode===0?.02:.32:o*=t.deltaMode===0?1:16,i){var s=n.getBoundingClientRect(),c={x:t.clientX-s.left,y:t.clientY-s.top};a=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*oM(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},_i.prototype.stepZoom=function(t,n){var i=Dv(ef,Ov);this._zoom(t,n,i)},_i.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=yl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(rM(ef,s),t)},_i.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Re[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},_i.prototype._init=function(e){this.toggle(e)};const Lv={__init__:["zoomScroll"],zoomScroll:["type",_i]};function Da(e){yr.call(this,e)}ae(Da,yr),Da.prototype._navigationModules=[Tv,kv,Lv],Da.prototype._modules=[].concat(yr.prototype._modules,Da.prototype._navigationModules);function tf(e){return e&&e[e.length-1]}function Iv(e){return e.y}function Nv(e){return e.x}var cM={left:Nv,center:Nv,right:function(e){return e.x+e.width},top:Iv,middle:Iv,bottom:function(e){return e.y+e.height}};function Mo(e,t){this._modeling=e,this._rules=t}Mo.$inject=["modeling","rules"],Mo.prototype._getOrientationDetails=function(e){var t=["top","bottom","middle"],n="x",i="width";return t.indexOf(e)!==-1&&(n="y",i="height"),{axis:n,dimension:i}},Mo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Mo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function p(f,d){return Math.round((f[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=tf(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(k(t,function(f){var d=f[i]+Math.round(f[r]/2);a[d]?a[d].elements.push(f):a[d]={elements:[f],center:d}}),c=ai(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=tf(c).center,o;u=t[0],t=ai(t,function(f){return f[i]+f[r]}),l=tf(t),o[e]=p(u,l)}return o},Mo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ie(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),_e(i)&&(r=i),!(r.length<2||!i)){var o=cM[t],a=ai(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const uM={__init__:["alignElements"],alignElements:["type",Mo]},lM=new Ro;function ko(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}ko.$inject=["eventBus"],ko.prototype.schedule=function(e,t=lM.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},ko.prototype._schedule=function(e,t){const n=pM();return{executionId:setTimeout(()=>{try{this._scheduled[t]=null;try{n.resolve(e())}catch(r){n.reject(r)}}catch(r){console.error("Scheduler#_schedule execution failed",r)}}),promise:n.promise}},ko.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},ko.prototype._cancel=function(e){clearTimeout(e.executionId)};function pM(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const fM={scheduler:["type",ko]};var dM="djs-element-hidden",Nc=".entry",hM=1e3,Bv=8,mM=300;function Mt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Mt.$inject=["canvas","elementRegistry","eventBus","scheduler"],Mt.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=_e(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=_e(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Mt.prototype._createContainer=function(){var e=ut('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Mt.prototype.registerProvider=function(e,t){t||(t=e,e=hM),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Mt.prototype.getEntries=function(e){var t=this._getProviders(),n=_e(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return k(t,function(r){if(Wt(r[n])){var o=r[n](e);Wt(o)?i=o(i):k(o,function(a,s){i[s]=a})}}),i},Mt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=sn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},mM);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Mt.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(Wt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Mt.prototype.open=function(e,t){if(!(!t&&this.isOpen(e))){var n=this._eventBus.fire("contextPad.open.allowed",{target:e});n!==!1&&(this.close(),this._updateAndOpen(e))}},Mt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Mt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;k(t,function(r,o){var a=r.group||"default",s=ut(r.html||'<div class="entry" draggable="true"></div>'),c;sn(s,"data-action",o),c=nt("[data-group="+ka(a)+"]",n),c||(c=ut('<div class="group"></div>'),sn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&gM(s,r.className),r.title&&sn(s,"title",r.title),r.imageUrl&&(i=ut("<img>"),sn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),gt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},Mt.prototype._createHtml=function(e){var t=this,n=ut('<div class="djs-context-pad"></div>');return Cn.bind(n,Nc,"click",function(i){t.trigger("click",i)}),Cn.bind(n,Nc,"dragstart",function(i){t.trigger("dragstart",i)}),Cn.bind(n,Nc,"mouseover",function(i){t.trigger("mouseover",i)}),Cn.bind(n,Nc,"mouseout",function(i){t.trigger("mouseout",i)}),Re.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Mt.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&vM(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Mt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Mt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return _e(e)!==_e(n)?!1:_e(e)?e.length===n.length&&Cr(e,function(i){return n.includes(i)}):n===e},Mt.prototype.isShown=function(){return this.isOpen()&&gt(this._current.html).has("open")},Mt.prototype.show=function(){this.isOpen()&&(gt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Mt.prototype.hide=function(){this.isOpen()&&(gt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Mt.prototype._getPosition=function(e){if(!_e(e)&&rt(e)){var t=this._canvas.viewbox(),n=yM(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Bv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Bv*this._canvas.zoom(),top:s.top-a.top}},Mt.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(i){i in n&&(t.style[i]=n[i]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},Mt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=_e(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,dM)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Mt.prototype._getTargetBounds=function(e){var t=this,n=_e(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function gM(e,t){var n=gt(e);t=_e(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function yM(e){return e.waypoints[e.waypoints.length-1]}function vM(e,t){return e=_e(e)?e:[e],t=_e(t)?t:[t],e.length===t.length&&Cr(e,function(n){return t.includes(n)})}const $v={__depends__:[sc,fM,Oc],contextPad:["type",Mt]};var Bc,_t,jv,vr,Fv,Hv,zv,nf,$c,Oa,Vv,rf,of,af,jc={},Fc=[],_M=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Hc=Array.isArray;function ji(e,t){for(var n in t)e[n]=t[n];return e}function sf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Gv(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?Bc.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return zc(e,a,i,r,null)}function zc(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++jv,__i:-1,__u:0};return r==null&&_t.vnode!=null&&_t.vnode(o),o}function Vc(e){return e.children}function Gc(e,t){this.props=e,this.context=t}function Wr(e,t){if(t==null)return e.__?Wr(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Wr(e):null}function bM(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=ji({},t);o.__v=t.__v+1,_t.vnode&&_t.vnode(o),cf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Wr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Qv(i,o,r),t.__e=t.__=null,o.__e!=n&&Wv(o)}}function Wv(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Wv(e)}function Uv(e){(!e.__d&&(e.__d=!0)&&vr.push(e)&&!Wc.__r++||Fv!=_t.debounceRendering)&&((Fv=_t.debounceRendering)||Hv)(Wc)}function Wc(){try{for(var e,t=1;vr.length;)vr.length>t&&vr.sort(zv),e=vr.shift(),t=vr.length,bM(e)}finally{vr.length=Wc.__r=0}}function Yv(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,R=i&&i.__k||Fc,w=t.length;for(c=xM(n,t,R,c,w),p=0;p<w;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&R[d.__i]||jc,d.__i=p,g=cf(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&uf(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=qv(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&g!==void 0?c=g:h&&(c=h.nextSibling),d.__u&=-7);return n.__e=m,c}function xM(e,t,n,i,r){var o,a,s,c,u,l=n.length,p=l,f=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=zc(null,a,null,null,null):Hc(a)?a=e.__k[o]=zc(Vc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=zc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=wM(a,n,c,p))!=-1&&(p--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?f--:r<l&&f++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?f--:u==c+1?f++:(u>c?f--:f++,a.__u|=4))):e.__k[o]=null;if(p)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Wr(s)),e_(s,s));return i}function qv(e,t,n){var i,r;if(typeof e.type=="function"){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=qv(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Wr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function wM(e,t,n,i){var r,o,a,s=e.key,c=e.type,u=t[n],l=u!=null&&(2&u.__u)==0;if(u===null&&s==null||l&&s==u.key&&c==u.type)return n;if(i>(l?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((u=t[a=r>=0?r--:o++])!=null&&(2&u.__u)==0&&s==u.key&&c==u.type)return a}return-1}function Kv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||_M.test(t)?n:n+"px"}function Uc(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Kv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Kv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Vv,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[Oa]=i[Oa]:(n[Oa]=rf,e.addEventListener(t,o?af:of,o)):e.removeEventListener(t,o?af:of,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Xv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[$c]==null)t[$c]=rf++;else if(t[$c]<n[Oa])return;return n(_t.event?_t.event(t):t)}}}function cf(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,h,m,g,R,w,b,x,S,M,I,A,H,V=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=_t.__b)&&l(t);e:if(typeof V=="function"){p=a.length;try{if(w=t.props,b=V.prototype&&V.prototype.render,x=(l=V.contextType)&&i[l.__c],S=l?x?x.props.value:l.__:i,n.__c?R=(f=t.__c=n.__c).__=f.__E:(b?t.__c=f=new V(w,S):(t.__c=f=new Gc(w,S),f.constructor=V,f.render=SM),x&&x.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),b&&f.__s==null&&(f.__s=f.state),b&&V.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=ji({},f.__s)),ji(f.__s,V.getDerivedStateFromProps(w,f.__s))),h=f.props,m=f.state,f.__v=t,d)b&&V.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),b&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(b&&V.getDerivedStateFromProps==null&&w!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(w,S),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(w,f.__s,S)===!1){t.__v!=n.__v&&(f.props=w,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function($){$&&($.__=t)}),Fc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Wr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(w,f.__s,S),b&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,g)})}if(f.context=S,f.props=w,f.__P=e,f.__e=!1,M=_t.__r,I=0,b)f.state=f.__s,f.__d=!1,M&&M(t),l=f.render(f.props,f.state,f.context),Fc.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,M&&M(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++I<25);f.state=f.__s,f.getChildContext!=null&&(i=ji(ji({},i),f.getChildContext())),b&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),A=l!=null&&l.type===Vc&&l.key==null?Jv(l.props.children):l,s=Yv(e,Hc(A)?A:[A],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),R&&(f.__E=f.__=null)}catch($){if(a.length=p,t.__v=null,c||o!=null){if($.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(H=o.length;H--;)sf(o[H])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),$.then||Zv(t),_t.__e($,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=EM(n.__e,t,n,i,r,o,a,c,u);return(l=_t.diffed)&&l(t),128&t.__u?void 0:s}function Zv(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Zv))}function Qv(e,t,n){for(var i=0;i<n.length;i++)uf(n[i],n[++i],n[++i]);_t.__c&&_t.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){_t.__e(o,r.__v)}})}function Jv(e){return typeof e!="object"||e==null||e.__b>0?e:Hc(e)?e.map(Jv):e.constructor!==void 0?null:ji({},e)}function EM(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||jc,R=t.props,w=t.type;if(w=="svg"?r="http://www.w3.org/2000/svg":w=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!w&&(w?d.localName==w:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(w==null)return document.createTextNode(R);e=document.createElementNS(r,w,R.is&&R),s&&(_t.__m&&_t.__m(t,o),s=!1),o=null}if(w==null)g===R||s&&e.data==R||(e.data=R);else{if(o=w=="textarea"&&R.defaultValue!=null?null:o&&Bc.call(e.childNodes),!s&&o!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in R||u=="value"&&"defaultValue"in R||u=="checked"&&"defaultChecked"in R||Uc(e,u,null,d,r);for(u in R)d=R[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||Uc(e,u,d,g[u],r);if(l)s||p&&(l.__html==p.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(p&&(e.innerHTML=""),Yv(t.type=="template"?e.content:e,Hc(f)?f:[f],t,n,i,w=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Wr(n,0),s,c),o!=null)for(u=o.length;u--;)sf(o[u]);s&&w!="textarea"||(u="value",w=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||w=="progress"&&!h||w=="option"&&h!=g[u])&&Uc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Uc(e,u,m,g[u],r))}return e}function uf(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){_t.__e(r,n)}}function e_(e,t,n){var i,r;if(_t.unmount&&_t.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||uf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){_t.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&e_(i[r],t,n||typeof e.type!="function");n||sf(e.__e),e.__c=e.__=e.__e=void 0}function SM(e,t,n){return this.constructor(e,n)}function t_(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),_t.__&&_t.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],cf(t,e=t.__k=Gv(Vc,null,[e]),r||jc,jc,t.namespaceURI,r?null:t.firstChild?Bc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Qv(o,e,a),e.props.children=null}Bc=Fc.slice,_t={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},jv=0,Gc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ji({},this.state),typeof e=="function"&&(e=e(ji({},n),this.props)),e&&ji(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Uv(this))},Gc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Uv(this))},Gc.prototype.render=Vc,vr=[],Hv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,zv=function(e,t){return e.__v.__b-t.__v.__b},Wc.__r=0,nf=Math.random().toString(8),$c="__d"+nf,Oa="__a"+nf,Vv=/(PointerCapture)$|Capture$/i,rf=0,of=Xv(!1),af=Xv(!0);var n_=function(e,t,n,i){var r;t[0]=0;for(var o=1;o<t.length;o++){var a=t[o++],s=t[o]?(t[0]|=a?1:2,n[t[o++]]):t[++o];a===3?i[0]=s:a===4?i[1]=Object.assign(i[1]||{},s):a===5?(i[1]=i[1]||{})[t[++o]]=s:a===6?i[1][t[++o]]+=s+"":a?(r=e.apply(s,n_(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},i_=new Map;function RM(e){var t=i_.get(this);return t||(t=new Map,i_.set(this,t)),(t=n_(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
+ `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var at=RM.bind(Gv),Do,kt,lf,r_,La=0,o_=[],Vt=_t,a_=Vt.__b,s_=Vt.__r,c_=Vt.diffed,u_=Vt.__c,l_=Vt.unmount,p_=Vt.__;function Yc(e,t){Vt.__h&&Vt.__h(kt,e,La||t),La=0;var n=kt.__H||(kt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function pf(e){return La=1,CM(d_,e)}function CM(e,t,n){var i=Yc(Do++,2);if(i.t=e,!i.__c&&(i.__=[d_(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],u=i.t(c,s);c!==u&&(i.__N=[u,i.__[1]],i.__c.setState({}))}],i.__c=kt,!kt.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,s,c,u);return l?f||p:f}return!l||p};kt.__f=!0;var o=kt.shouldComponentUpdate,a=kt.componentWillUpdate;kt.componentWillUpdate=function(s,c,u){if(this.__e){var l=o;o=void 0,r(s,c,u),o=l}a&&a.call(this,s,c,u)},kt.shouldComponentUpdate=r}return i.__N||i.__}function qc(e,t){var n=Yc(Do++,3);!Vt.__s&&hf(n.__H,t)&&(n.__=e,n.u=t,kt.__H.__h.push(n))}function ff(e,t){var n=Yc(Do++,4);!Vt.__s&&hf(n.__H,t)&&(n.__=e,n.u=t,kt.__h.push(n))}function Kc(e){return La=5,Fi(function(){return{current:e}},[])}function Fi(e,t){var n=Yc(Do++,7);return hf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ia(e,t){return La=8,Fi(function(){return e},t)}function PM(){for(var e;e=o_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Xc),t.__h.some(df),t.__h=[]}catch(n){t.__h=[],Vt.__e(n,e.__v)}}}Vt.__b=function(e){kt=null,a_&&a_(e)},Vt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),p_&&p_(e,t)},Vt.__r=function(e){s_&&s_(e),Do=0;var t=(kt=e.__c).__H;t&&(lf===kt?(t.__h=[],kt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Xc),t.__h.some(df),t.__h=[],Do=0)),lf=kt},Vt.diffed=function(e){c_&&c_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(o_.push(t)!==1&&r_===Vt.requestAnimationFrame||((r_=Vt.requestAnimationFrame)||AM)(PM)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),lf=kt=null},Vt.__c=function(e,t){t.some(function(n){try{n.__h.some(Xc),n.__h=n.__h.filter(function(i){return!i.__||df(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Vt.__e(i,n.__v)}}),u_&&u_(e,t)},Vt.unmount=function(e){l_&&l_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Xc(i)}catch(r){t=r}}),n.__H=void 0,t&&Vt.__e(t,n.__v))};var f_=typeof requestAnimationFrame=="function";function AM(e){var t,n=function(){clearTimeout(i),f_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);f_&&(t=requestAnimationFrame(n))}function Xc(e){var t=kt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),kt=t}function df(e){var t=kt;e.__c=e.__(),kt=t}function hf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function d_(e,t){return typeof t=="function"?t(e):t}function TM(e){const{navigationStack:t,setNavigationStack:n}=e,i=Fi(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return at`
11
12
  <div class="djs-popup-breadcrumbs">
12
- ${r&&ke`
13
+ ${r&&at`
13
14
  <button
14
15
  type="button"
15
16
  class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--back"
@@ -22,7 +23,7 @@
22
23
  </svg>
23
24
  </button>
24
25
  `}
25
- ${i.map((a,s)=>ke`
26
+ ${i.map((a,s)=>at`
26
27
  <button
27
28
  key=${s}
28
29
  type="button"
@@ -34,22 +35,22 @@
34
35
  </button>
35
36
  <span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
36
37
  `)}
37
- ${o&&ke`
38
+ ${o&&at`
38
39
  <span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${o}>
39
40
  ${o}
40
41
  </span>
41
42
  `}
42
43
  </div>
43
- `}function iv(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=iv(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Ds(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=iv(e))&&(i&&(i+=" "),i+=t);return i}function MP(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Vn(()=>kP(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return ke`
44
+ `}function h_(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=h_(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Zc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=h_(e))&&(i&&(i+=" "),i+=t);return i}function MM(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Fi(()=>kM(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return at`
44
45
  <div class="djs-popup-header">
45
46
  <h3 class="djs-popup-title" title=${o}>${o}</h3>
46
- ${a.map(u=>ke`
47
+ ${a.map(u=>at`
47
48
  <ul key=${u.id} class="djs-popup-header-group" data-header-group=${u.id}>
48
49
 
49
- ${u.entries.map(l=>ke`
50
+ ${u.entries.map(l=>at`
50
51
  <li key=${l.id}>
51
52
  <${s(l)?"button":"span"}
52
- class=${DP(l,l===i)}
53
+ class=${DM(l,l===i)}
53
54
  onClick=${p=>c(p,l)}
54
55
  title=${l.title||l.label}
55
56
  data-id=${l.id}
@@ -59,8 +60,8 @@
59
60
  onFocus=${()=>s(l)&&r(l)}
60
61
  onBlur=${()=>s(l)&&r(null)}
61
62
  >
62
- ${l.imageUrl&&ke`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&ke`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
63
- ${l.label?ke`
63
+ ${l.imageUrl&&at`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&at`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
64
+ ${l.label?at`
64
65
  <span class="djs-popup-label">${l.label}</span>
65
66
  `:null}
66
67
  </${l.action?"button":"span"}>
@@ -69,11 +70,11 @@
69
70
  </ul>
70
71
  `)}
71
72
  </div>
72
- `}function kP(e){return e.reduce((t,n)=>{const i=n.group||"default",r=t.find(o=>o.id===i);return r?r.entries.push(n):t.push({id:i,entries:[n]}),t},[])}function DP(e,t){return Ds("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function rv(e,t){return`${e}-entry-${t.id}`}function OP(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(u,l)=>{if(!n.disabled)return a(u,n,l)},c=!n.entries;return ke`
73
+ `}function kM(e){return e.reduce((t,n)=>{const i=n.group||"default",r=t.find(o=>o.id===i);return r?r.entries.push(n):t.push({id:i,entries:[n]}),t},[])}function DM(e,t){return Zc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function m_(e,t){return`${e}-entry-${t.id}`}function OM(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(u,l)=>{if(!n.disabled)return a(u,n,l)},c=!n.entries;return at`
73
74
  <li
74
- class=${Ds("entry",{selected:i,disabled:n.disabled})}
75
+ class=${Zc("entry",{selected:i,disabled:n.disabled})}
75
76
  data-id=${n.id}
76
- id=${rv(t,n)}
77
+ id=${m_(t,n)}
77
78
  role="option"
78
79
  aria-selected=${i||void 0}
79
80
  aria-haspopup=${n.entries?"true":void 0}
@@ -87,17 +88,17 @@
87
88
  >
88
89
  <div class="djs-popup-entry-content">
89
90
  <span
90
- class=${Ds("djs-popup-entry-name",n.className)}
91
+ class=${Zc("djs-popup-entry-name",n.className)}
91
92
  >
92
- ${n.imageUrl&&ke`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&ke`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
93
+ ${n.imageUrl&&at`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&at`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
93
94
 
94
- ${n.label?ke`
95
+ ${n.label?at`
95
96
  <span class="djs-popup-label">
96
97
  ${n.label}
97
98
  </span>
98
99
  `:null}
99
100
 
100
- ${n.documentationRef&&ke`
101
+ ${n.documentationRef&&at`
101
102
  <a
102
103
  class="djs-popup-entry-docs"
103
104
  href=${n.documentationRef}
@@ -114,7 +115,7 @@
114
115
  </a>
115
116
  `}
116
117
  </span>
117
- ${n.description&&ke`
118
+ ${n.description&&at`
118
119
  <span
119
120
  class="djs-popup-entry-description"
120
121
  >
@@ -122,7 +123,7 @@
122
123
  </span>
123
124
  `}
124
125
  </div>
125
- ${n.entries&&ke`
126
+ ${n.entries&&at`
126
127
  <div class="djs-popup-entry-chevron" aria-hidden="true">
127
128
  <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
128
129
  <path fill-rule="evenodd" clip-rule="evenodd" d="M3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L9.03033 5.46967C9.32322 5.76256 9.32322 6.23744 9.03033 6.53033L5.03033 10.5303C4.73744 10.8232 4.26256 10.8232 3.96967 10.5303C3.67678 10.2374 3.67678 9.76256 3.96967 9.46967L7.43934 6L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967Z" fill="currentColor"/>
@@ -130,7 +131,7 @@
130
131
  </div>
131
132
  `}
132
133
  </li>
133
- `}function IP(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=Ms();Nl(()=>{if(!r||!r.current)return;const g=p.current;if(!g)return;const _=g.querySelector(".selected");_&&LP(_)},[t]);const f=()=>{r.current=!1},d=g=>{r.current||n(g)},h=()=>{r.current||n(null)};return ke`
134
+ `}function LM(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=Kc();ff(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const g=m.querySelector(".selected");g&&IM(g)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return at`
134
135
  <div
135
136
  class="djs-popup-results"
136
137
  ref=${p}
@@ -141,25 +142,25 @@
141
142
  aria-activedescendant=${u}
142
143
  onMouseMove=${f}
143
144
  >
144
- ${i.map(g=>ke`
145
- ${g.name&&ke`
146
- <div key=${g.id} id=${ov(o,g)} class="entry-header" title=${g.name}>
147
- ${g.name}
145
+ ${i.map(m=>at`
146
+ ${m.name&&at`
147
+ <div key=${m.id} id=${g_(o,m)} class="entry-header" title=${m.name}>
148
+ ${m.name}
148
149
  </div>
149
150
  `}
150
151
  <ul
151
152
  class="djs-popup-group"
152
- data-group=${g.id}
153
+ data-group=${m.id}
153
154
  role="group"
154
- aria-labelledby=${g.name?ov(o,g):void 0}
155
+ aria-labelledby=${m.name?g_(o,m):void 0}
155
156
  >
156
- ${g.entries.map(_=>ke`
157
- <${OP}
158
- key=${_.id}
157
+ ${m.entries.map(g=>at`
158
+ <${OM}
159
+ key=${g.id}
159
160
  idPrefix=${o}
160
- entry=${_}
161
- selected=${_===t}
162
- onMouseEnter=${()=>d(_)}
161
+ entry=${g}
162
+ selected=${g===t}
163
+ onMouseEnter=${()=>d(g)}
163
164
  onMouseLeave=${h}
164
165
  ...${l}
165
166
  />
@@ -167,36 +168,36 @@
167
168
  </ul>
168
169
  `)}
169
170
  </div>
170
- `}function ov(e,t){return`${e}-group-${t.id}`}function LP(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const BP=new vr("djs-popup");function NP(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:p,entries:f,onOpened:d,onClosed:h}=e,[g,_]=Bl([]);Ts(()=>{_([])},[f]);const[R,x]=Bl(""),E=R.trim().length>0,b=Vn(()=>FP(f),[f]),S=Vn(()=>Je(u)?b.length>5:!1,[u,b]),T=Vn(()=>{const B=g.length?g[g.length-1].entries:f;return S?E?p(b.filter(({searchable:L})=>L!==!1),R,{keys:["label","search","description"]}).map(({item:L})=>L):B.filter(({rank:L=0})=>L>=0):B},[S,E,b,R,p,g,f]),O=Vn(()=>E?T.length?[{id:"default",entries:T}]:[]:HP(T),[T,E]),[C,F]=Bl(T[0]),N=Ms(null),I=Ms(!1),W=Vn(()=>BP.next(),[]),re=`${W}-results`,Pe=C&&rv(W,C);Ts(()=>{const B=N.current;B&&T.includes(B)?F(B):F(T[0]),N.current=null},[T]);const Qe=Co(B=>{const L=jP(O);let M=L.indexOf(C)+B;M<0&&(M=L.length-1),M>=L.length&&(M=0),I.current=!0,F(L[M])},[O,C]),U=Co(B=>{B>0&&C&&C.entries&&(I.current=!0,_(L=>[...L,C])),B<0&&g.length>0&&(I.current=!0,N.current=g[g.length+B],_(L=>L.slice(0,B)))},[C,g]),ee=Co((B,L,H)=>{if(!(!L||L.disabled))return L.entries?(B.preventDefault(),U(1)):n(B,L,H)},[n,U]),oe=Co(B=>{if(B.key==="Enter"&&C){const L=B.target;return!!Mi(L,"a, button",!0)||C.disabled?void 0:ee(B,C)}if(B.key==="Backspace"){const L=B.target;if(!(Ec(L,"input")&&L.value!==""))return U(-1),B.preventDefault()}if(B.key==="ArrowUp")return Qe(-1),B.preventDefault();if(B.key==="ArrowDown")return Qe(1),B.preventDefault();if(B.key==="ArrowRight")return U(1),B.preventDefault();if(B.key==="ArrowLeft")return U(-1),B.preventDefault()},[C,Qe,U,ee]),Q=Co(B=>{Ec(B.target,"input")&&x(()=>B.target.value)},[x]);Ts(()=>(d(),()=>{h()}),[]);const ne=!E&&g.length>0,Y=(a||r.length>0)&&!ne;return ke`
171
- <${av}
171
+ `}function g_(e,t){return`${e}-group-${t.id}`}function IM(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const NM=new Ro("djs-popup");function BM(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:p,entries:f,onOpened:d,onClosed:h}=e,[m,g]=pf([]);qc(()=>{g([])},[f]);const[R,w]=pf(""),b=R.trim().length>0,x=Fi(()=>FM(f),[f]),S=Fi(()=>$t(u)?x.length>5:!1,[u,x]),M=Fi(()=>{const z=m.length?m[m.length-1].entries:f;return S?b?p(x.filter(({searchable:F})=>F!==!1),R,{keys:["label","search","description"]}).map(({item:F})=>F):z.filter(({rank:F=0})=>F>=0):z},[S,b,x,R,p,m,f]),I=Fi(()=>b?M.length?[{id:"default",entries:M}]:[]:HM(M),[M,b]),[A,H]=pf(M[0]),V=Kc(null),$=Kc(!1),G=Fi(()=>NM.next(),[]),pe=`${G}-results`,ze=A&&m_(G,A);qc(()=>{const z=V.current;z&&M.includes(z)?H(z):H(M[0]),V.current=null},[M]);const lt=Ia(z=>{const F=jM(I);let Oe=F.indexOf(A)+z;Oe<0&&(Oe=F.length-1),Oe>=F.length&&(Oe=0),$.current=!0,H(F[Oe])},[I,A]),Y=Ia(z=>{z>0&&A&&A.entries&&($.current=!0,g(F=>[...F,A])),z<0&&m.length>0&&($.current=!0,V.current=m[m.length+z],g(F=>F.slice(0,z)))},[A,m]),fe=Ia((z,F,U)=>{if(!(!F||F.disabled))return F.entries?(z.preventDefault(),Y(1)):n(z,F,U)},[n,Y]),de=Ia(z=>{if(z.key==="Enter"&&A){const F=z.target;return!!Dr(F,"a, button",!0)||A.disabled?void 0:fe(z,A)}if(z.key==="Backspace"){const F=z.target;if(!(Xu(F,"input")&&F.value!==""))return Y(-1),z.preventDefault()}if(z.key==="ArrowUp")return lt(-1),z.preventDefault();if(z.key==="ArrowDown")return lt(1),z.preventDefault();if(z.key==="ArrowRight")return Y(1),z.preventDefault();if(z.key==="ArrowLeft")return Y(-1),z.preventDefault()},[A,lt,Y,fe]),ue=Ia(z=>{Xu(z.target,"input")&&w(()=>z.target.value)},[w]);qc(()=>(d(),()=>{h()}),[]);const le=!b&&m.length>0,ne=(a||r.length>0)&&!le;return at`
172
+ <${y_}
172
173
  onClose=${t}
173
- onKeyup=${Q}
174
- onKeydown=${oe}
174
+ onKeyup=${ue}
175
+ onKeydown=${de}
175
176
  className=${i}
176
177
  position=${o}
177
178
  width=${s}
178
179
  scale=${c}
179
- navigationStack=${g}
180
+ navigationStack=${m}
180
181
  >
181
- ${Y&&ke`
182
- <${MP}
182
+ ${ne&&at`
183
+ <${MM}
183
184
  headerEntries=${r}
184
185
  onSelect=${n}
185
- selectedEntry=${C}
186
- setSelectedEntry=${F}
186
+ selectedEntry=${A}
187
+ setSelectedEntry=${H}
187
188
  title=${a}
188
189
  />
189
190
  `}
190
- ${ne&&ke`
191
- <${TP}
192
- navigationStack=${g}
193
- setNavigationStack=${_}
191
+ ${le&&at`
192
+ <${TM}
193
+ navigationStack=${m}
194
+ setNavigationStack=${g}
194
195
  />
195
196
  `}
196
- ${f.length>0&&ke`
197
+ ${f.length>0&&at`
197
198
  <div class="djs-popup-body">
198
199
 
199
- ${S&&ke`
200
+ ${S&&at`
200
201
  <div class="djs-popup-search">
201
202
  <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
202
203
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -207,39 +208,39 @@
207
208
  role="combobox"
208
209
  aria-label="${a||"Search"}"
209
210
  aria-expanded="true"
210
- aria-controls=${re}
211
- aria-activedescendant=${Pe||void 0}
211
+ aria-controls=${pe}
212
+ aria-activedescendant=${ze||void 0}
212
213
  aria-autocomplete="list"
213
214
  />
214
215
  </div>
215
216
  `}
216
217
 
217
- ${E&&ke`
218
+ ${b&&at`
218
219
  <div class="djs-popup-search-count" aria-live="polite">
219
- ${T.length} ${T.length===1?"result":"results"} found
220
+ ${M.length} ${M.length===1?"result":"results"} found
220
221
  </div>
221
222
  `}
222
223
 
223
- <${IP}
224
- groupedEntries=${O}
225
- selectedEntry=${C}
226
- setSelectedEntry=${F}
227
- keyboardSelection=${I}
228
- onAction=${ee}
229
- idPrefix=${W}
230
- id=${re}
224
+ <${LM}
225
+ groupedEntries=${I}
226
+ selectedEntry=${A}
227
+ setSelectedEntry=${H}
228
+ keyboardSelection=${$}
229
+ onAction=${fe}
230
+ idPrefix=${G}
231
+ id=${pe}
231
232
  ariaLabel=${a||"Results"}
232
233
  tabIndex=${S?-1:0}
233
- ariaActivedescendant=${S?void 0:Pe||void 0}
234
+ ariaActivedescendant=${S?void 0:ze||void 0}
234
235
  />
235
236
 
236
- ${C&&C.documentationRef&&ke`
237
+ ${A&&A.documentationRef&&at`
237
238
  <div class="djs-popup-footer">
238
239
  <a
239
240
  class="djs-popup-footer-docs"
240
- href=${C.documentationRef}
241
- onClick=${B=>B.stopPropagation()}
242
- aria-label=${C.label?`Open entry documentation for ${C.label}`:"Open entry documentation"}
241
+ href=${A.documentationRef}
242
+ onClick=${z=>z.stopPropagation()}
243
+ aria-label=${A.label?`Open entry documentation for ${A.label}`:"Open entry documentation"}
243
244
  target="_blank"
244
245
  rel="noopener"
245
246
  >
@@ -253,14 +254,14 @@
253
254
  `}
254
255
  </div>
255
256
  `}
256
- ${l&&T.length===0&&ke`
257
- <div class="djs-popup-no-results">${ot(l)?l(R):l}</div>
257
+ ${l&&M.length===0&&at`
258
+ <div class="djs-popup-no-results">${Wt(l)?l(R):l}</div>
258
259
  `}
259
- </${av}>
260
- `}function av(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Ms();return Nl(()=>{if(typeof s!="function")return;const u=c.current,l=s(u);u.style.left=`${l.x}px`,u.style.top=`${l.y}px`},[c.current,s]),Nl(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),Ts(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!Mi(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),ke`
260
+ </${y_}>
261
+ `}function y_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Kc();return ff(()=>{if(typeof s!="function")return;const u=c.current,l=s(u);u.style.left=`${l.x}px`,u.style.top=`${l.y}px`},[c.current,s]),ff(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),qc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!Dr(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),at`
261
262
  <div
262
- class=${Ds("djs-popup",r)}
263
- style=${$P(e)}
263
+ class=${Zc("djs-popup",r)}
264
+ style=${$M(e)}
264
265
  onKeydown=${n}
265
266
  onKeyup=${i}
266
267
  ref=${c}
@@ -268,8 +269,8 @@
268
269
  >
269
270
  ${o}
270
271
  </div>
271
- `}function $P(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Je(t)?n:void 0,maxWidth:Je(t)?"unset":void 0,"transform-origin":"top left"}}function jP(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function FP(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function HP(e){const t=[],n=o=>t.find(a=>o.id===a.id),i=o=>!!n(o),r=o=>typeof o=="string"?{id:o}:o;return e.forEach(o=>{const a=o.group?r(o.group):{id:"default"};i(a)?n(a).entries.push(o):t.push({...a,entries:[o]})}),t}var zP="data-id",sv=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],VP=1e3;function He(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Je(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:r},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",o=>{const a=this.isOpen()&&this._current.target;o.element===a&&this.refresh()})}He.$inject=["config.popupMenu","eventBus","canvas","search"],He.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=cv(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);Gg(ke`
272
- <${NP}
272
+ `}function $M(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:$t(t)?n:void 0,maxWidth:$t(t)?"unset":void 0,"transform-origin":"top left"}}function jM(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function FM(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function HM(e){const t=[],n=o=>t.find(a=>o.id===a.id),i=o=>!!n(o),r=o=>typeof o=="string"?{id:o}:o;return e.forEach(o=>{const a=o.group?r(o.group):{id:"default"};i(a)?n(a).entries.push(o):t.push({...a,entries:[o]})}),t}var zM="data-id",v_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],VM=1e3;function bt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=$t(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:r},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",o=>{const a=this.isOpen()&&this._current.target;o.element===a&&this.refresh()})}bt.$inject=["config.popupMenu","eventBus","canvas","search"],bt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=__(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);t_(at`
273
+ <${BM}
273
274
  onClose=${f=>this.close(f)}
274
275
  onSelect=${(f,d,h)=>this.trigger(f,d,h)}
275
276
  position=${c}
@@ -283,7 +284,7 @@
283
284
  searchFn=${this._search}
284
285
  ...${{...o}}
285
286
  />
286
- `,this._current.container)},He.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var r=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(r===!1)return;this.isOpen()&&this.close();const{entries:o,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:o,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},He.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:r}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:r},this._emit("refresh"),this._render()},He.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n),o=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:r,emptyPlaceholder:o,empty:!(Object.keys(i).length||Object.keys(r).length)}},He.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},He.prototype.reset=function(){const e=this._current.container;Gg(null,e),mn(e)},He.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},He.prototype._onOpened=function(){this._emit("opened")},He.prototype._onClosed=function(){this._emit("closed")},He.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Ie(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},He.prototype._bindAutoClose=function(){this._eventBus.once(sv,this.close,this)},He.prototype._unbindAutoClose=function(){this._eventBus.off(sv,this.close,this)},He.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,r=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),Je(n)&&e<n&&(r=n),Je(i)&&e>i&&(r=i)),r},He.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,a=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,a=t.y-i.height):r.x?(o=t.x-i.width,a=t.y):r.y&&t.y<i.height?(o=t.x,a=10):r.y&&(o=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:o,y:a}},He.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length?!0:this._getContext(e,t).empty},He.prototype.registerProvider=function(e,t,n){n||(n=t,t=VP),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},He.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},He.prototype._getEntries=function(e,t){var n={};return A(t,function(i){if(!i.getPopupMenuEntries){A(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=pn(o,["id"])});return}var r=i.getPopupMenuEntries(e);ot(r)?n=r(n):A(r,function(o,a){n[a]=o})}),n},He.prototype._getHeaderEntries=function(e,t){var n={};return A(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;A(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=pn(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);ot(r)?n=r(n):A(r,function(o,a){n[a]=o})}),n},He.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>ot(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},He.prototype.isOpen=function(){return!!this._current},He.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Mi(e.delegateTarget||e.target,".entry",!0),o=_t(r,zP);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(ot(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},He.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function cv(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=cv(r.entries,[...t,...uv(r.search)]):t.length&&(r.search=[...t,...uv(r.search)]),r})}function uv(e){return e?ae(e)?e:[e]:[]}function GP(e,t,n){const{keys:i}=n;if(t=t.trim().toLowerCase(),!t)throw new Error("<pattern> must not be empty");const r=t.trim().toLowerCase().split(/\s+/);return e.flatMap(o=>{const a=WP(o,r,i);return a?{item:o,tokens:a}:[]}).sort(UP(i))}function WP(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=ae(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=hv(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):hv(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function UP(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=qP(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=lv;continue}const s=YP(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=lv;continue}}return i}}function qP(e,t){return pv(t)-pv(e)}const lv=.5,Cr={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function pv(e){const t=e.reduce((s,c)=>s+fv(c),0),n=e.flat(),i=n.reduce((s,c)=>s+c.value.length,0),r=n.reduce((s,c)=>s+(c.match?c.value.length:0),0),o=i?r/i:0;return t*(1+o)}function fv(e){if(ae(e))return Math.max(...e.map(fv));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Cr.FULL:e.wordEnd?Cr.START_FULL_WORD:Cr.START_WORD_PART:e.wordStart?Cr.WORD_START:Cr.WORD_PART)*t:Cr.NO_MATCH*t}function dv(e=""){return ae(e)?e.join(", "):e}function YP(e,t){return dv(e).localeCompare(dv(t))}function hv(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(KP),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,p=s.index,f=s.index+l.length,d=p===0,h=f===e.length,g=!!((u=s.groups)!=null&&u.all),_=d||/\s/.test(e.charAt(p-1)),R=h||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:_,wordEnd:R,start:d,end:h,all:g});const x=g?t:[l];for(const E of x)i[E.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function KP(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const mv={search:["value",GP]},Fl={__depends__:[mv],__init__:["popupMenu"],popupMenu:["type",He]};var gv={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},bt.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var r=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(r===!1)return;this.isOpen()&&this.close();const{entries:o,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:o,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},bt.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:r}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:r},this._emit("refresh"),this._render()},bt.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n),o=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:r,emptyPlaceholder:o,empty:!(Object.keys(i).length||Object.keys(r).length)}},bt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},bt.prototype.reset=function(){const e=this._current.container;t_(null,e),pi(e)},bt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},bt.prototype._onOpened=function(){this._emit("opened")},bt.prototype._onClosed=function(){this._emit("closed")},bt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=ut(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},bt.prototype._bindAutoClose=function(){this._eventBus.once(v_,this.close,this)},bt.prototype._unbindAutoClose=function(){this._eventBus.off(v_,this.close,this)},bt.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,r=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),$t(n)&&e<n&&(r=n),$t(i)&&e>i&&(r=i)),r},bt.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,a=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,a=t.y-i.height):r.x?(o=t.x-i.width,a=t.y):r.y&&t.y<i.height?(o=t.x,a=10):r.y&&(o=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:o,y:a}},bt.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length?!0:this._getContext(e,t).empty},bt.prototype.registerProvider=function(e,t,n){n||(n=t,t=VM),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},bt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},bt.prototype._getEntries=function(e,t){var n={};return k(t,function(i){if(!i.getPopupMenuEntries){k(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=si(o,["id"])});return}var r=i.getPopupMenuEntries(e);Wt(r)?n=r(n):k(r,function(o,a){n[a]=o})}),n},bt.prototype._getHeaderEntries=function(e,t){var n={};return k(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;k(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=si(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Wt(r)?n=r(n):k(r,function(o,a){n[a]=o})}),n},bt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Wt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},bt.prototype.isOpen=function(){return!!this._current},bt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Dr(e.delegateTarget||e.target,".entry",!0),o=sn(r,zM);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Wt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},bt.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function __(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=__(r.entries,[...t,...b_(r.search)]):t.length&&(r.search=[...t,...b_(r.search)]),r})}function b_(e){return e?_e(e)?e:[e]:[]}function GM(e,t,n){const{keys:i}=n;if(t=t.trim().toLowerCase(),!t)throw new Error("<pattern> must not be empty");const r=t.trim().toLowerCase().split(/\s+/);return e.flatMap(o=>{const a=WM(o,r,i);return a?{item:o,tokens:a}:[]}).sort(UM(i))}function WM(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=_e(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=R_(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):R_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function UM(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=YM(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=x_;continue}const s=qM(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=x_;continue}}return i}}function YM(e,t){return w_(t)-w_(e)}const x_=.5,Oo={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function w_(e){const t=e.reduce((s,c)=>s+E_(c),0),n=e.flat(),i=n.reduce((s,c)=>s+c.value.length,0),r=n.reduce((s,c)=>s+(c.match?c.value.length:0),0),o=i?r/i:0;return t*(1+o)}function E_(e){if(_e(e))return Math.max(...e.map(E_));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Oo.FULL:e.wordEnd?Oo.START_FULL_WORD:Oo.START_WORD_PART:e.wordStart?Oo.WORD_START:Oo.WORD_PART)*t:Oo.NO_MATCH*t}function S_(e=""){return _e(e)?e.join(", "):e}function qM(e,t){return S_(e).localeCompare(S_(t))}function R_(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(KM),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,p=s.index,f=s.index+l.length,d=p===0,h=f===e.length,m=!!((u=s.groups)!=null&&u.all),g=d||/\s/.test(e.charAt(p-1)),R=h||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:g,wordEnd:R,start:d,end:h,all:m});const w=m?t:[l];for(const b of w)i[b.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function KM(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const C_={search:["value",GM]},mf={__depends__:[C_],__init__:["popupMenu"],popupMenu:["type",bt]};var P_={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
288
  <line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
288
289
  <rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
289
290
  <rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -311,8 +312,8 @@
311
312
  <line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
312
313
  <rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
313
314
  <rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
314
- </svg>`},XP=900;function Pr(e,t,n,i){e.registerProvider(XP,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Pr.$inject=["contextPad","popupMenu","translate","canvas"],Pr.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Pr.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Pr.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${gv.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);D(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Pr.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var ZP=["left","center","right","top","middle","bottom"];function Po(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Po.$inject=["popupMenu","alignElements","translate","rules"],Po.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Po.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Po.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return A(ZP,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:gv[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Os(e){Xt.call(this,e)}Os.$inject=["eventBus"],X(Os,Xt),Os.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=ye(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=na(n),n.length<2?!1:n})};const QP={__depends__:[uP,Pg,Fl],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Pr],alignElementsMenuProvider:["type",Po],bpmnAlignElements:["type",Os]};function Gn(e,t,n,i){V.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=rc(Ki(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Xi(s,function(p){return p.parent.id});A(l,function(p,f){ae(u)&&(p=p.filter(function(d){return Oe(u,Zi({id:d.id}))})),r._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}Gn.$inject=["eventBus","elementRegistry","modeling","rules"],X(Gn,V),Gn.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ie(Ue(e)),o=ie(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),oa(D({},o,a))},Gn.prototype._expand=function(e,t){typeof t=="string"&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var i=this._getOptimalBounds(e,t);if(JP(i,t)){var r=eA(on(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Gn.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Gn.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Gn.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function JP(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function eA(e,t){var n="";return e=ie(e),t=ie(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function Is(e){e.invoke(Gn,this)}Is.$inject=["injector"],X(Is,Gn),Is.prototype.resize=function(e,t,n){y(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Ao(e){Xt.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Ao.$inject=["eventBus"],X(Ao,Xt),Ao.prototype.canResize=function(e,t){return!1};function Ls(e,t){Ao.call(this,e),this._modeling=t}X(Ls,Ao),Ls.$inject=["eventBus","modeling"],Ls.prototype.canResize=function(e,t){if(y(t.di,"bpmndi:BPMNPlane")||!y(t,"bpmn:Participant")&&!y(t,"bpmn:Lane")&&!y(t,"bpmn:SubProcess"))return!1;var n=!0;return A(e,function(i){if(y(i,"bpmn:Lane")||he(i)){n=!1;return}}),n};const tA={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Is],bpmnAutoResizeProvider:["type",Ls]};function Ar(e,t,n){this._canvas=n,this._opts=D({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Ar.$inject=["config.autoScroll","eventBus","canvas"],Ar.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)nA(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?a=n.scrollStep:c==1?s=n.scrollStep:c==2?a=-n.scrollStep:c==3&&(s=-n.scrollStep));(a!==0||s!==0)&&(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))};function nA(e,t,n){return t<e&&e<n}Ar.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ar.prototype.setOptions=function(e){this._opts=D({},this._opts,e)},Ar.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Bi(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const iA={__depends__:[$n],__init__:["autoScroll"],autoScroll:["type",Ar]};var vv="djs-bendpoint",yv="djs-segment-dragger";function rA(e,t){var n=Bi(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function Hl(e,t,n){var i=rA(e,n),r=ou(t,i);return r}function zl(e,t){var n=te("g");xe(n).add(vv),pe(e,n);var i=te("circle");Z(i,{cx:0,cy:0,r:4}),xe(i).add("djs-visual"),pe(n,i);var r=te("circle");return Z(r,{cx:0,cy:0,r:10}),xe(r).add("djs-hit"),pe(n,r),t&&xe(n).add(t),n}function oA(e,t,n,i){var r=te("g");pe(e,r);var o=18,a=6,s=11,c=sA(t,n,i),u=a+s,l=te("rect");Z(l,{x:-o/2,y:-a/2,width:o,height:a}),xe(l).add("djs-visual"),pe(r,l);var p=te("rect");return Z(p,{x:-c/2,y:-u/2,width:c,height:u}),xe(p).add("djs-hit"),pe(r,p),Gf(r,i==="v"?90:0),r}function _v(e,t,n){var i=te("g"),r=Ic(t,n),o=Dn(t,n);return pe(e,i),oA(i,t,n,o),xe(i).add(yv),xe(i).add(o==="h"?"horizontal":"vertical"),lt(i,r.x,r.y),i}function Vl(e){return Math.abs(Math.round(e*2/3))}function aA(e,t){var n=cA(e,t);return pu(e,n)}function sA(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Vl(n==="h"?i:r)}function cA(e,t){for(var n=t.waypoints,i=1/0,r,o=0;o<n.length-1;o++){var a=n[o],s=n[o+1],c=Md(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function bv(e,t,n,i,r){function o(E,b,S){var T=E.index,O=E.point,C,F,N,I,W,re;return T<=0||E.bendpoint?!1:(C=b[T-1],F=b[T],N=Ic(C,F),I=Dn(C,F),W=Math.abs(O.x-N.x),re=Math.abs(O.y-N.y),I&&W<=S&&re<=S)}function a(E,b){var S=E.waypoints,T,O,C,F;return b.index<=0||b.bendpoint||(T={start:S[b.index-1],end:S[b.index]},O=Dn(T.start,T.end),!O)?null:(O==="h"?C=T.end.x-T.start.x:C=T.end.y-T.start.y,F=Vl(C)/2,F)}function s(E,b){var S=b.waypoints,T=Hl(t,S,E),O;if(T){O=a(b,T);var C;if(o(T,S,O)?C=r.start(E,b,T.index):C=i.start(E,b,T.index,!T.bendpoint),C!==!1)return!0}}function c(E,b,S){le.bind(E,b,function(T){n.triggerMouseEvent(b,T,S),T.stopPropagation()})}function u(E,b){var S=t.getLayer("overlays"),T=Ae('.djs-bendpoints[data-element-id="'+xo(E.id)+'"]',S);return!T&&b&&(T=te("g"),Z(T,{"data-element-id":E.id}),xe(T).add("djs-bendpoints"),pe(S,T),c(T,"mousedown",E),c(T,"click",E),c(T,"dblclick",E)),T}function l(E,b){return Ae('.djs-segment-dragger[data-segment-idx="'+E+'"]',b)}function p(E,b){b.waypoints.forEach(function(S,T){var O=zl(E);pe(E,O),lt(O,S.x,S.y)}),zl(E,"floating")}function f(E,b){for(var S=b.waypoints,T,O,C,F=1;F<S.length;F++)T=S[F-1],O=S[F],Dn(T,O)&&(C=_v(E,T,O),Z(C,{"data-segment-idx":F}),c(C,"mousemove",b))}function d(E){A(Qo("."+vv,E),function(b){tt(b)})}function h(E){A(Qo("."+yv,E),function(b){tt(b)})}function g(E){var b=u(E);return b||(b=u(E,!0),p(b,E),f(b,E)),b}function _(E){var b=u(E);b&&(h(b),d(b),f(b,E),p(b,E))}function R(E,b){var S=Ae(".floating",E),T=b.point;S&&(lt(S,T.x,T.y),xe(S).add("positioned"))}function x(E,b,S){var T=l(b.index,E),O=S[b.index-1],C=S[b.index],F=b.point,N=Ic(O,C),I=Dn(O,C),W,re;T&&(W=uA(T),re={x:F.x-N.x,y:F.y-N.y},I==="v"&&(re={x:re.y,y:re.x}),lt(W,re.x,re.y))}e.on("connection.changed",function(E){_(E.element)}),e.on("connection.remove",function(E){var b=u(E.element);b&&tt(b)}),e.on("element.marker.update",function(E){var b=E.element,S;b.waypoints&&(S=g(b),E.add?xe(S).add(E.marker):xe(S).remove(E.marker))}),e.on("element.mousemove",function(E){var b=E.element,S=b.waypoints,T,O;if(S){if(T=u(b,!0),O=Hl(t,S,E.originalEvent),!O)return;R(T,O),O.bendpoint||x(T,O,S)}}),e.on("element.mousedown",function(E){if(ci(E)){var b=E.originalEvent,S=E.element;if(S.waypoints)return s(b,S)}}),e.on("selection.changed",function(E){var b=E.newSelection,S=b[0];S&&S.waypoints&&g(S)}),e.on("element.hover",function(E){var b=E.element;b.waypoints&&g(b)}),e.on("element.out",function(E){var b=E.element;if(b.waypoints){var S=u(b);if(S){var T=Ae(".floating",S);T&&xe(T).remove("positioned")}}}),e.on("element.updateId",function(E){var b=E.element,S=E.newId;if(b.waypoints){var T=u(b);T&&Z(T,{"data-element-id":S})}}),this.addHandles=g,this.updateHandles=_,this.getBendpointsContainer=u,this.getSegmentDragger=l}bv.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function uA(e){return Ae(".djs-visual",e)}var Ev=Math.round,Gi="reconnectStart",Wi="reconnectEnd",To="updateWaypoints";function Gl(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,h;!u&&c===0?h=Gi:!u&&c===d.length-1?h=Wi:h=To;var g=h===To?"connection.updateWaypoints":"connection.reconnect",_=r.allowed(g,{connection:s,source:p,target:f});if(_===!1&&(_=r.allowed(g,{connection:s,source:f,target:p})),_!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:_,bendpointIndex:c,connection:s,source:p,target:f,insert:u,type:h}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var h=f===To?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Gi?p:u,target:f===Wi?p:l}),d){s.source=f===Gi?p:u,s.target=f===Wi?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===Wi?p:l,target:f===Gi?p:u})),d&&(s.source=f===Wi?p:l,s.target=f===Gi?p:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==To&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,p=s.insert,f=l.waypoints.slice(),d=s.source,h=s.target,g=s.type,_=s.hints||{},R={x:Ev(a.x),y:Ev(a.y)};if(!c)return!1;g===To?(p?f.splice(u,0,R):f[u]=R,_.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,bE(f),_)):(g===Gi?(_.docking="source",Bs(s)&&(_.docking="target",_.newWaypoints=f.reverse())):g===Wi&&(_.docking="target",Bs(s)&&(_.docking="source",_.newWaypoints=f.reverse())),o.reconnect(l,d,h,R,_))},this)}Gl.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Gl.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function Bs(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Gi)return t&&i&&t===i&&n!==i;if(r===Wi)return t&&n&&t===n&&n!==i}var lA="reconnectStart",pA="reconnectEnd",xv="updateWaypoints",Mo="connect-ok",Ns="connect-not-ok",wv="connect-hover",Sv="djs-updating",Rv="djs-dragging",Cv=1100;function Pv(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,p=l.slice();a.waypoints=l,u&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=zl(i.getLayer("overlays"));xe(f).add("djs-dragging"),i.addMarker(c,Rv),i.addMarker(c,Sv)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,u=a.type;if(c){if(i.addMarker(c,wv),u===xv)return;s?(i.removeMarker(c,Ns),i.addMarker(c,Mo)):s===!1&&(i.removeMarker(c,Mo),i.addMarker(c,Ns))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],Cv,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,wv),i.removeMarker(s,c?Mo:Ns))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,p=a.type,f=a.connection,d=f.source,h=f.target,g=f.waypoints.slice(),_={x:o.x,y:o.y},R=a.hints||{},x={};r&&(R.connectionStart&&(x.connectionStart=R.connectionStart),R.connectionEnd&&(x.connectionEnd=R.connectionEnd),p===lA?Bs(a)?(x.connectionEnd=x.connectionEnd||_,x.source=h,x.target=l||d,g=g.reverse()):(x.connectionStart=x.connectionStart||_,x.source=l||d,x.target=h):p===pA?Bs(a)?(x.connectionStart=x.connectionStart||_,x.source=l||h,x.target=d,g=g.reverse()):(x.connectionEnd=x.connectionEnd||_,x.source=d,x.target=l||h):(x.noCropping=!0,x.noLayout=!0,g[c]=_),p===xv&&(g=e.cropWaypoints(f,g)),x.waypoints=g,r.drawPreview(a,s,x)),lt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],Cv,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,tt(c),i.removeMarker(s,Sv),i.removeMarker(s,Rv),u&&(i.removeMarker(u,Mo),i.removeMarker(u,l?Mo:Ns)),r&&r.cleanUp(a)})}Pv.$inject=["bendpointMove","injector","eventBus","canvas"];var Av="connect-hover",Tv="djs-updating";function Mv(e,t,n){return Wl(e,t,e[t]+n)}function Wl(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function fA(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(o+a,e[i]),r-a);return Wl(t,i,s)}function kv(e){return e==="x"?"y":"x"}function Dv(e,t,n){var i,r;return e.original?e.original:(i=se(t),r=kv(n),Wl(e,r,i[r]))}function Ov(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var h,g=n.getGraphics(f),_=d-1,R=d,x=f.waypoints,E=x[_],b=x[R],S=Hl(n,x,p),T,O,C;if(T=Dn(E,b),!!T)return O=T==="v"?"x":"y",_===0&&(E=Dv(E,f.source,O)),R===x.length-1&&(b=Dv(b,f.target,O)),S?C=S.point:C={x:(E.x+b.x)/2,y:(E.y+b.y)/2},h={connection:f,segmentStartIndex:_,segmentEndIndex:R,segmentStart:E,segmentEnd:b,axis:O,dragPosition:C},i.init(p,C,"connectionSegment.move",{cursor:O==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:g,context:h}})};function s(p,f){if(!a)return f;var d=p.waypoints,h;return p.waypoints=f,h=a.getCroppedWaypoints(p),p.waypoints=d,h}function c(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var h=p.newWaypoints,g=p.segmentStartIndex+f,_=h[g],R=p.segmentEndIndex+f,x=h[R],E=kv(p.axis),b=fA(d,_,x,E);lt(p.draggerGfx,b.x,b.y)}function l(p,f){var d=0,h=p.filter(function(g,_){return Oc(p[_-1],p[_+1],g)?(d=_<=f?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,h=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=_v(h,f.segmentStart,f.segmentEnd),xe(f.draggerGfx).add("djs-dragging"),n.addMarker(d,Tv)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,g=f.segmentEndIndex,_=f.segmentStart,R=f.segmentEnd,x=f.axis,E=f.originalWaypoints.slice(),b=Mv(_,x,p["d"+x]),S=Mv(R,x,p["d"+x]),T=E.length,O=0;E[h]=b,E[g]=S;var C,F;h<2&&(C=ut(d.source,b),h===1?C==="intersect"&&(E.shift(),E[0]=b,O--):C!=="intersect"&&(E.unshift(_),O++)),g>T-3&&(F=ut(d.target,S),g===T-2?F==="intersect"&&(E.pop(),E[E.length-1]=S):F!=="intersect"&&E.push(R)),f.newWaypoints=d.waypoints=s(d,E),u(f,O,p),f.newSegmentStartIndex=h+O,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,Av)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,Av)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&tt(f.draggerGfx),n.removeMarker(d,Tv)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,h=f.newWaypoints,g=f.newSegmentStartIndex;h=h.map(function(S){return{original:S.original,x:Math.round(S.x),y:Math.round(S.y)}});var _=l(h,g),R=_.waypoints,x=s(d,R),E=_.segmentOffset,b={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:g+E}};o.updateWaypoints(d,x,b)})}Ov.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var dA=Math.abs,Iv=Math.round;function hA(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],dA(r-e)<=n)return r}function Lv(e){return{x:e.x,y:e.y}}function Bv(e){return{x:e.x+e.width,y:e.y+e.height}}function en(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Iv(e.x+e.width/2),y:Iv(e.y+e.height/2)}}function Tr(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Xe(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function Nv(e){return e.children||[]}var mA=Math.abs,$v=Math.round,Ul=10;function jv(e){function t(o,a){if(ae(o)){for(var s=o.length;s--;)if(mA(o[s]-a)<=Ul)return o[s]}else{o=+o;var c=a%o;if(c<Ul)return a-c;if(c>o-Ul)return a-c+o}return a}function n(o,a){if(o.waypoints)return aA(a,o);if(o.width)return{x:$v(o.width/2+o.x),y:$v(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var g=[u[p-1],l,f,u[d+1]];return p<2&&g.unshift(n(c.source,o)),d>u.length-3&&g.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},A(g,function(_){_&&(_=_.original||_,h==="y"&&s.horizontal.push(_.y),h==="x"&&s.vertical.push(_.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var p=s-u,f=c-l;D(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&Xe(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&Xe(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},A(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!Te(s)||!c||!c.x||!c.y||(Xe(o,"x",c.x),Xe(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,p=o.y,f,d;if(s){f=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,p);var h=l-f,g=p-d;D(o,{dx:o.dx-h,dy:o.dy-g,x:o.x-h,y:o.y-g}),(h||s.vertical.indexOf(l)!==-1)&&Xe(o,"x",f),(g||s.horizontal.indexOf(p)!==-1)&&Xe(o,"y",d)}})}jv.$inject=["eventBus"];const gA={__depends__:[$n,En],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",bv],bendpointMove:["type",Gl],bendpointMovePreview:["type",Pv],connectionSegmentMove:["type",Ov],bendpointSnapping:["type",jv]};function Fv(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!Yi(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Yi(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,h={connectionStart:ql(s)?l:u,connectionEnd:ql(s)?u:l};rt(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){rt(c)||(u=c,c=se(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}Fv.$inject=["eventBus","dragging","modeling","rules"];function ql(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var vA=1100,yA=900,Hv="connect-ok",zv="connect-not-ok";function Vv(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,p=o.target,f=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},h=f,g=d;ql(o)&&(h=d,g=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:g})}),t.on("connect.hover",yA,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?Hv:zv)}),t.on(["connect.out","connect.cleanup"],vA,function(r){var o=r.hover;o&&(n.removeMarker(o,Hv),n.removeMarker(o,zv))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Vv.$inject=["injector","eventBus","canvas"];const Yl={__depends__:[Zt,En,$n],__init__:["connectPreview"],connect:["type",Fv],connectPreview:["type",Vv]};var _A="djs-dragger";function Wn(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Wn.$inject=["injector","canvas","graphicsFactory","elementFactory"],Wn.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,p=n.noCropping,f=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Jo(i),r||(r=e.getConnection=bA(function(g,_,R){return h.getConnection(g,_,R)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?se(o):c,a?se(a):u]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Wn.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||se(n),o=t.connectionEnd||se(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);pe(e,s)},Wn.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&Vr(o,s,!0)||e,t=i&&Vr(a,s,!1)||t,[e,t]},Wn.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&tt(e.connectionPreviewGfx)},Wn.prototype.getConnection=function(e){var t=EA(e);return this._elementFactory.createConnection(t)},Wn.prototype.createConnectionPreviewGfx=function(){var e=te("g");return Z(e,{pointerEvents:"none"}),xe(e).add(_A),pe(this._canvas.getActiveLayer(),e),e},Wn.prototype.createNoopConnection=function(e,t){return jr([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function bA(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}function EA(e){return rt(e)?e:{}}const xA={__init__:["connectionPreview"],connectionPreview:["type",Wn]},$s="complex-preview";class Gv{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer($s);n.filter(s=>!wA(s)).forEach(s=>{let c;Te(s)?(c=this._graphicsFactory._createContainer("connection",te("g")),this._graphicsFactory.drawConnection(Oi(c),s)):(c=this._graphicsFactory._createContainer("shape",te("g")),this._graphicsFactory.drawShape(Oi(c),s),lt(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);Te(s)?lt(u,c.x,c.y):lt(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",te("g"));this._graphicsFactory.drawShape(Oi(u),s,{width:c.width,height:c.height}),lt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Jo(this._canvas.getLayer($s)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer($s)}hide(){this._canvas.hideLayer($s)}}Gv.$inject=["canvas","graphicsFactory","previewSupport"];function wA(e){return e.hidden}const SA={__depends__:[yr],__init__:["complexPreview"],complexPreview:["type",Gv]},Wv=Math.round;function js(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}js.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(D({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;D(u,{x:l.x-Wv(u.width/2),y:l.y-Wv(u.height/2)});const p=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:u}),f.waypoints=r.getCroppedWaypoints(f,e,u)),i.create({created:[u,f].filter(d=>!Yi(d))})},js.prototype.cleanUp=function(){this._complexPreview.cleanUp()},js.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const RA={__depends__:[fs,SA,_l],__init__:["appendPreview"],appendPreview:["type",js]};var Uv=Math.min,qv=Math.max;function Kl(e){e.preventDefault()}function ko(e){e.stopPropagation()}function CA(e){return e.nodeType===Node.TEXT_NODE}function PA(e){return[].slice.call(e)}function sn(e){this.container=e.container,this.parent=Ie('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Ae("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Ct(this.autoResize,this),this.handlePaste=Ct(this.handlePaste,this)}sn.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=on(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);D(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=on(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return D(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&D(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,le.bind(a,"keydown",this.keyHandler),le.bind(a,"mousedown",ko),le.bind(a,"paste",r.handlePaste),le.bind(a,"focusout",this.focusoutHandler),i.autoResize&&le.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},sn.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var r=this.autoResize(n);r&&this.resizeHandler(r)}},sn.prototype.insertText=function(e){e=AA(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},sn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=PA(a.childNodes),c,u;if(CA(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,u=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(h,g){g===f?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):g>f&&g<=d&&mn(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},sn.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},sn.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=Ie('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){Kl(h),ko(h),s=h.clientX,c=h.clientY;var g=t.getBoundingClientRect();u=g.width,l=g.height,le.bind(document,"mousemove",f),le.bind(document,"mouseup",d)},f=function(h){Kl(h),ko(h);var g=Uv(qv(u+h.clientX-s,i),o),_=Uv(qv(l+h.clientY-c,r),a);t.style.width=g+"px",t.style.height=_+"px",e.resizeHandler({width:u,height:l,dx:h.clientX-s,dy:h.clientY-c})},d=function(h){Kl(h),ko(h),le.unbind(document,"mousemove",f,!1),le.unbind(document,"mouseup",d,!1)};le.bind(n,"mousedown",p)}D(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},sn.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),le.unbind(t,"keydown",this.keyHandler),le.unbind(t,"mousedown",ko),le.unbind(t,"input",this.autoResize),le.unbind(t,"paste",this.handlePaste),le.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),mn(n)),mn(e)},sn.prototype.getValue=function(){return this.content.innerText.trim()},sn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},sn.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function AA(e){return e.replace(/\r\n|\r|\n/g,`
315
- `)}function jt(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new sn({container:t.getContainer(),keyHandler:Ct(this._handleKey,this),resizeHandler:Ct(this._handleResize,this),focusoutHandler:Ct(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}jt.$inject=["eventBus","canvas"],jt.prototype.registerProvider=function(e){this._providers.push(e)},jt.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},jt.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},jt.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},jt.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},jt.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},jt.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;(r!==o||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},jt.prototype.getValue=function(){return this._textbox.getValue()},jt.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;if(t===27)return e.preventDefault(),this.cancel();if(t===13&&!e.shiftKey)return e.preventDefault(),this.complete()},jt.prototype._handleResize=function(e){this._fire("resize",e)},jt.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},jt.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=Oe(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const Yv={__depends__:[za],__init__:["directEditing"],directEditing:["type",jt]};function TA(e){return function(t){var n=t.target,i=G(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===Ee(e);return!o||!a||!s||!c}}const MA={task:{label:"Task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},"user-task":{label:"User task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},"service-task":{label:"Service task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},"send-task":{label:"Send task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},"receive-task":{label:"Receive task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},"manual-task":{label:"Manual task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},"rule-task":{label:"Business rule task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},"script-task":{label:"Script task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},"call-activity":{label:"Call activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},transaction:{label:"Transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},"event-subprocess":{label:"Event sub-process",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},"collapsed-subprocess":{label:"Sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},"expanded-subprocess":{label:"Sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},"collapsed-ad-hoc-subprocess":{label:"Ad-hoc sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},"expanded-ad-hoc-subprocess":{label:"Ad-hoc sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},"exclusive-gateway":{label:"Exclusive gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},"parallel-gateway":{label:"Parallel gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},"inclusive-gateway":{label:"Inclusive gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},"complex-gateway":{label:"Complex gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},"event-based-gateway":{label:"Event-based gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}},"data-store-reference":{label:"Data store reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}},"data-object-reference":{label:"Data object reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}},"expanded-pool":{label:"Expanded pool/participant",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},"collapsed-pool":{label:"Empty pool/participant",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}},"none-start-event":{label:"Start event",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},"none-intermediate-throwing":{label:"Intermediate throw event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},"none-boundary-event":{label:"Boundary event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:BoundaryEvent"}},"none-end-event":{label:"End event",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},"message-start":{label:"Message start event",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},"timer-start":{label:"Timer start event",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},"conditional-start":{label:"Conditional start event",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},"signal-start":{label:"Signal start event",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},"error-start":{label:"Error start event",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},"escalation-start":{label:"Escalation start event",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},"compensation-start":{label:"Compensation start event",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},"non-interrupting-message-start":{label:"Message start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},"non-interrupting-timer-start":{label:"Timer start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},"non-interrupting-conditional-start":{label:"Conditional start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},"non-interrupting-signal-start":{label:"Signal start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},"non-interrupting-escalation-start":{label:"Escalation start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}},"message-intermediate-catch":{label:"Message intermediate catch event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"message-intermediate-throw":{label:"Message intermediate throw event",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"timer-intermediate-catch":{label:"Timer intermediate catch event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},"escalation-intermediate-throw":{label:"Escalation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"conditional-intermediate-catch":{label:"Conditional intermediate catch event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},"link-intermediate-catch":{label:"Link intermediate catch event",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"link-intermediate-throw":{label:"Link intermediate throw event",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"compensation-intermediate-throw":{label:"Compensation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-intermediate-catch":{label:"Signal intermediate catch event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"signal-intermediate-throw":{label:"Signal intermediate throw event",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"message-boundary":{label:"Message boundary event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},"timer-boundary":{label:"Timer boundary event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},"escalation-boundary":{label:"Escalation boundary event",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},"conditional-boundary":{label:"Conditional boundary event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},"error-boundary":{label:"Error boundary event",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},"cancel-boundary":{label:"Cancel boundary event",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},"signal-boundary":{label:"Signal boundary event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},"compensation-boundary":{label:"Compensation boundary event",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},"non-interrupting-message-boundary":{label:"Message boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},"non-interrupting-timer-boundary":{label:"Timer boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},"non-interrupting-escalation-boundary":{label:"Escalation boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},"non-interrupting-conditional-boundary":{label:"Conditional boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},"non-interrupting-signal-boundary":{label:"Signal boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}},"message-end":{label:"Message end event",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"escalation-end":{label:"Escalation end event",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"error-end":{label:"Error end event",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},"cancel-end":{label:"Cancel end event",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},"compensation-end":{label:"Compensation end event",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-end":{label:"Signal end event",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"terminate-end":{label:"Terminate end event",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}};function z(e,t={}){var n=MA[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var kA=[z("none-start-event",{actionName:"replace-with-none-start"}),z("none-intermediate-throwing"),z("none-end-event",{actionName:"replace-with-none-end"}),z("message-start"),z("timer-start"),z("conditional-start"),z("signal-start")],DA=[z("none-start-event",{actionName:"replace-with-none-start"}),z("none-intermediate-throwing"),z("none-end-event",{actionName:"replace-with-none-end"})],OA=[z("none-start-event",{actionName:"replace-with-none-start"}),z("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),z("none-end-event",{actionName:"replace-with-none-end"}),z("message-intermediate-catch"),z("message-intermediate-throw"),z("timer-intermediate-catch"),z("escalation-intermediate-throw"),z("conditional-intermediate-catch"),z("link-intermediate-catch"),z("link-intermediate-throw"),z("compensation-intermediate-throw"),z("signal-intermediate-catch"),z("signal-intermediate-throw")],IA=[z("none-start-event",{actionName:"replace-with-none-start"}),z("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),z("none-end-event",{actionName:"replace-with-none-end"}),z("message-end"),z("escalation-end"),z("error-end"),z("cancel-end"),z("compensation-end"),z("signal-end"),z("terminate-end")],LA=[z("exclusive-gateway"),z("parallel-gateway"),z("inclusive-gateway"),z("complex-gateway"),z("event-based-gateway")],BA=[z("transaction"),z("event-subprocess"),z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),z("collapsed-subprocess")],NA=[z("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),z("transaction"),z("event-subprocess"),z("collapsed-ad-hoc-subprocess")],Kv=[z("transaction"),z("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),z("event-subprocess")],$A=Kv,Xv=[z("task"),z("user-task"),z("service-task"),z("send-task"),z("receive-task"),z("manual-task"),z("rule-task"),z("script-task"),z("call-activity"),z("collapsed-subprocess"),z("expanded-subprocess"),z("collapsed-ad-hoc-subprocess"),z("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],jA=[z("data-store-reference")],FA=[z("data-object-reference")],HA=[z("message-boundary"),z("timer-boundary"),z("escalation-boundary"),z("conditional-boundary"),z("error-boundary"),z("cancel-boundary"),z("signal-boundary"),z("compensation-boundary"),z("non-interrupting-message-boundary"),z("non-interrupting-timer-boundary"),z("non-interrupting-escalation-boundary"),z("non-interrupting-conditional-boundary"),z("non-interrupting-signal-boundary")],zA=[z("message-start"),z("timer-start"),z("conditional-start"),z("signal-start"),z("error-start"),z("escalation-start"),z("compensation-start"),z("non-interrupting-message-start"),z("non-interrupting-timer-start"),z("non-interrupting-conditional-start"),z("non-interrupting-signal-start"),z("non-interrupting-escalation-start")],VA=[{label:"Sequence flow",actionName:"replace-with-sequence-flow",className:"bpmn-icon-connection"},{label:"Default flow",actionName:"replace-with-default-flow",className:"bpmn-icon-default-flow"},{label:"Conditional flow",actionName:"replace-with-conditional-flow",className:"bpmn-icon-conditional-flow"}],GA=[z("expanded-pool"),z("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],WA={"bpmn:MessageEventDefinition":[z("message-start"),z("message-intermediate-catch"),z("message-intermediate-throw"),z("message-end")],"bpmn:TimerEventDefinition":[z("timer-start"),z("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[z("conditional-start"),z("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[z("signal-start"),z("signal-intermediate-catch"),z("signal-intermediate-throw"),z("signal-end")],"bpmn:ErrorEventDefinition":[z("error-start"),z("error-end")],"bpmn:EscalationEventDefinition":[z("escalation-start"),z("escalation-intermediate-throw"),z("escalation-end")],"bpmn:CompensateEventDefinition":[z("compensation-start"),z("compensation-intermediate-throw"),z("compensation-end")]};const Zv={"start-event-non-interrupting":`
315
+ </svg>`},XM=900;function Lo(e,t,n,i){e.registerProvider(XM,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Lo.$inject=["contextPad","popupMenu","translate","canvas"],Lo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Lo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Lo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${P_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);O(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Lo.prototype._getMenuPosition=function(e){var t=5,n=this._contextPad.getPad(e).html,i=n.getBoundingClientRect(),r={x:i.left,y:i.bottom+t};return r};var ZM=["left","center","right","top","middle","bottom"];function Na(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Na.$inject=["popupMenu","alignElements","translate","rules"],Na.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},Na.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Na.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return k(ZM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:P_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Qc(e){qn.call(this,e)}Qc.$inject=["eventBus"],ae(Qc,qn),Qc.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Ie(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=xs(n),n.length<2?!1:n})};const QM={__depends__:[uM,$v,mf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Lo],alignElementsMenuProvider:["type",Na],bpmnAlignElements:["type",Qc]};function Hi(e,t,n,i){K.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=Ru(Qr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=Jr(s,function(p){return p.parent.id});k(l,function(p,f){_e(u)&&(p=p.filter(function(d){return ct(u,eo({id:d.id}))})),r._expand(p,f)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}Hi.$inject=["eventBus","elementRegistry","modeling","rules"],ae(Hi,K),Hi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ge(At(e)),o=ge(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),Ss(O({},o,a))},Hi.prototype._expand=function(e,t){typeof t=="string"&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var i=this._getOptimalBounds(e,t);if(JM(i,t)){var r=e2(ii(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Hi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Hi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Hi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function JM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function e2(e,t){var n="";return e=ge(e),t=ge(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function Jc(e){e.invoke(Hi,this)}Jc.$inject=["injector"],ae(Jc,Hi),Jc.prototype.resize=function(e,t,n){v(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Ba(e){qn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Ba.$inject=["eventBus"],ae(Ba,qn),Ba.prototype.canResize=function(e,t){return!1};function eu(e,t){Ba.call(this,e),this._modeling=t}ae(eu,Ba),eu.$inject=["eventBus","modeling"],eu.prototype.canResize=function(e,t){if(v(t.di,"bpmndi:BPMNPlane")||!v(t,"bpmn:Participant")&&!v(t,"bpmn:Lane")&&!v(t,"bpmn:SubProcess"))return!1;var n=!0;return k(e,function(i){if(v(i,"bpmn:Lane")||De(i)){n=!1;return}}),n};const t2={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Jc],bpmnAutoResizeProvider:["type",eu]};function Io(e,t,n){this._canvas=n,this._opts=O({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Io.$inject=["config.autoScroll","eventBus","canvas"],Io.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)n2(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(c===0?a=n.scrollStep:c==1?s=n.scrollStep:c==2?a=-n.scrollStep:c==3&&(s=-n.scrollStep));(a!==0||s!==0)&&(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))};function n2(e,t,n){return t<e&&e<n}Io.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Io.prototype.setOptions=function(e){this._opts=O({},this._opts,e)},Io.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=$r(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const i2={__depends__:[Ii],__init__:["autoScroll"],autoScroll:["type",Io]};var A_="djs-bendpoint",T_="djs-segment-dragger";function r2(e,t){var n=$r(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function gf(e,t,n){var i=r2(e,n),r=Ll(t,i);return r}function yf(e,t){var n=he("g");He(n).add(A_),Ce(e,n);var i=he("circle");se(i,{cx:0,cy:0,r:4}),He(i).add("djs-visual"),Ce(n,i);var r=he("circle");return se(r,{cx:0,cy:0,r:10}),He(r).add("djs-hit"),Ce(n,r),t&&He(n).add(t),n}function o2(e,t,n,i){var r=he("g");Ce(e,r);var o=18,a=6,s=11,c=s2(t,n,i),u=a+s,l=he("rect");se(l,{x:-o/2,y:-a/2,width:o,height:a}),He(l).add("djs-visual"),Ce(r,l);var p=he("rect");return se(p,{x:-c/2,y:-u/2,width:c,height:u}),He(p).add("djs-hit"),Ce(r,p),nm(r,i==="v"?90:0),r}function M_(e,t,n){var i=he("g"),r=ul(t,n),o=Ti(t,n);return Ce(e,i),o2(i,t,n,o),He(i).add(T_),He(i).add(o==="h"?"horizontal":"vertical"),Jt(i,r.x,r.y),i}function vf(e){return Math.abs(Math.round(e*2/3))}function a2(e,t){var n=c2(e,t);return Fl(e,n)}function s2(e,t,n){var i=t.x-e.x,r=t.y-e.y;return vf(n==="h"?i:r)}function c2(e,t){for(var n=t.waypoints,i=1/0,r,o=0;o<n.length-1;o++){var a=n[o],s=n[o+1],c=zm(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function k_(e,t,n,i,r){function o(b,x,S){var M=b.index,I=b.point,A,H,V,$,G,pe;return M<=0||b.bendpoint?!1:(A=x[M-1],H=x[M],V=ul(A,H),$=Ti(A,H),G=Math.abs(I.x-V.x),pe=Math.abs(I.y-V.y),$&&G<=S&&pe<=S)}function a(b,x){var S=b.waypoints,M,I,A,H;return x.index<=0||x.bendpoint||(M={start:S[x.index-1],end:S[x.index]},I=Ti(M.start,M.end),!I)?null:(I==="h"?A=M.end.x-M.start.x:A=M.end.y-M.start.y,H=vf(A)/2,H)}function s(b,x){var S=x.waypoints,M=gf(t,S,b),I;if(M){I=a(x,M);var A;if(o(M,S,I)?A=r.start(b,x,M.index):A=i.start(b,x,M.index,!M.bendpoint),A!==!1)return!0}}function c(b,x,S){Re.bind(b,x,function(M){n.triggerMouseEvent(x,M,S),M.stopPropagation()})}function u(b,x){var S=t.getLayer("overlays"),M=nt('.djs-bendpoints[data-element-id="'+ka(b.id)+'"]',S);return!M&&x&&(M=he("g"),se(M,{"data-element-id":b.id}),He(M).add("djs-bendpoints"),Ce(S,M),c(M,"mousedown",b),c(M,"click",b),c(M,"dblclick",b)),M}function l(b,x){return nt('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function p(b,x){x.waypoints.forEach(function(S,M){var I=yf(b);Ce(b,I),Jt(I,S.x,S.y)}),yf(b,"floating")}function f(b,x){for(var S=x.waypoints,M,I,A,H=1;H<S.length;H++)M=S[H-1],I=S[H],Ti(M,I)&&(A=M_(b,M,I),se(A,{"data-segment-idx":H}),c(A,"mousemove",x))}function d(b){k(ys("."+A_,b),function(x){Ht(x)})}function h(b){k(ys("."+T_,b),function(x){Ht(x)})}function m(b){var x=u(b);return x||(x=u(b,!0),p(x,b),f(x,b)),x}function g(b){var x=u(b);x&&(h(x),d(x),f(x,b),p(x,b))}function R(b,x){var S=nt(".floating",b),M=x.point;S&&(Jt(S,M.x,M.y),He(S).add("positioned"))}function w(b,x,S){var M=l(x.index,b),I=S[x.index-1],A=S[x.index],H=x.point,V=ul(I,A),$=Ti(I,A),G,pe;M&&(G=u2(M),pe={x:H.x-V.x,y:H.y-V.y},$==="v"&&(pe={x:pe.y,y:pe.x}),Jt(G,pe.x,pe.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&Ht(x)}),e.on("element.marker.update",function(b){var x=b.element,S;x.waypoints&&(S=m(x),b.add?He(S).add(b.marker):He(S).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,S=x.waypoints,M,I;if(S){if(M=u(x,!0),I=gf(t,S,b.originalEvent),!I)return;R(M,I),I.bendpoint||w(M,I,S)}}),e.on("element.mousedown",function(b){if(cr(b)){var x=b.originalEvent,S=b.element;if(S.waypoints)return s(x,S)}}),e.on("selection.changed",function(b){var x=b.newSelection,S=x[0];S&&S.waypoints&&m(S)}),e.on("element.hover",function(b){var x=b.element;x.waypoints&&m(x)}),e.on("element.out",function(b){var x=b.element;if(x.waypoints){var S=u(x);if(S){var M=nt(".floating",S);M&&He(M).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,S=b.newId;if(x.waypoints){var M=u(x);M&&se(M,{"data-element-id":S})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}k_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function u2(e){return nt(".djs-visual",e)}var D_=Math.round,Ur="reconnectStart",Yr="reconnectEnd",$a="updateWaypoints";function _f(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),p=s.source,f=s.target,d=s.waypoints,h;!u&&c===0?h=Ur:!u&&c===d.length-1?h=Yr:h=$a;var m=h===$a?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(m,{connection:s,source:p,target:f});if(g===!1&&(g=r.allowed(m,{connection:s,source:f,target:p})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:g,bendpointIndex:c,connection:s,source:p,target:f,insert:u,type:h}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,p=a.hover,f=s.type;s.hover=p;var d;if(p){var h=f===$a?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Ur?p:u,target:f===Yr?p:l}),d){s.source=f===Ur?p:u,s.target=f===Yr?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===Yr?p:l,target:f===Ur?p:u})),d&&(s.source=f===Yr?p:l,s.target=f===Ur?p:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==$a&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,p=s.insert,f=l.waypoints.slice(),d=s.source,h=s.target,m=s.type,g=s.hints||{},R={x:D_(a.x),y:D_(a.y)};if(!c)return!1;m===$a?(p?f.splice(u,0,R):f[u]=R,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,C1(f),g)):(m===Ur?(g.docking="source",tu(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===Yr&&(g.docking="target",tu(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,R,g))},this)}_f.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],_f.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function tu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Ur)return t&&i&&t===i&&n!==i;if(r===Yr)return t&&n&&t===n&&n!==i}var l2="reconnectStart",p2="reconnectEnd",O_="updateWaypoints",ja="connect-ok",nu="connect-not-ok",L_="connect-hover",I_="djs-updating",N_="djs-dragging",B_=1100;function $_(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,p=l.slice();a.waypoints=l,u&&p.splice(s,0,{x:o.x,y:o.y}),c.waypoints=p;var f=a.draggerGfx=yf(i.getLayer("overlays"));He(f).add("djs-dragging"),i.addMarker(c,N_),i.addMarker(c,I_)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,u=a.type;if(c){if(i.addMarker(c,L_),u===O_)return;s?(i.removeMarker(c,nu),i.addMarker(c,ja)):s===!1&&(i.removeMarker(c,ja),i.addMarker(c,nu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],B_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,L_),i.removeMarker(s,c?ja:nu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,p=a.type,f=a.connection,d=f.source,h=f.target,m=f.waypoints.slice(),g={x:o.x,y:o.y},R=a.hints||{},w={};r&&(R.connectionStart&&(w.connectionStart=R.connectionStart),R.connectionEnd&&(w.connectionEnd=R.connectionEnd),p===l2?tu(a)?(w.connectionEnd=w.connectionEnd||g,w.source=h,w.target=l||d,m=m.reverse()):(w.connectionStart=w.connectionStart||g,w.source=l||d,w.target=h):p===p2?tu(a)?(w.connectionStart=w.connectionStart||g,w.source=l||h,w.target=d,m=m.reverse()):(w.connectionEnd=w.connectionEnd||g,w.source=d,w.target=l||h):(w.noCropping=!0,w.noLayout=!0,m[c]=g),p===O_&&(m=e.cropWaypoints(f,m)),w.waypoints=m,r.drawPreview(a,s,w)),Jt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],B_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,Ht(c),i.removeMarker(s,I_),i.removeMarker(s,N_),u&&(i.removeMarker(u,ja),i.removeMarker(u,l?ja:nu)),r&&r.cleanUp(a)})}$_.$inject=["bendpointMove","injector","eventBus","canvas"];var j_="connect-hover",F_="djs-updating";function H_(e,t,n){return bf(e,t,e[t]+n)}function bf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function f2(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]),a=20,s=Math.min(Math.max(o+a,e[i]),r-a);return bf(t,i,s)}function z_(e){return e==="x"?"y":"x"}function V_(e,t,n){var i,r;return e.original?e.original:(i=be(t),r=z_(n),bf(e,r,i[r]))}function G_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var h,m=n.getGraphics(f),g=d-1,R=d,w=f.waypoints,b=w[g],x=w[R],S=gf(n,w,p),M,I,A;if(M=Ti(b,x),!!M)return I=M==="v"?"x":"y",g===0&&(b=V_(b,f.source,I)),R===w.length-1&&(x=V_(x,f.target,I)),S?A=S.point:A={x:(b.x+x.x)/2,y:(b.y+x.y)/2},h={connection:f,segmentStartIndex:g,segmentEndIndex:R,segmentStart:b,segmentEnd:x,axis:I,dragPosition:A},i.init(p,A,"connectionSegment.move",{cursor:I==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:m,context:h}})};function s(p,f){if(!a)return f;var d=p.waypoints,h;return p.waypoints=f,h=a.getCroppedWaypoints(p),p.waypoints=d,h}function c(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var h=p.newWaypoints,m=p.segmentStartIndex+f,g=h[m],R=p.segmentEndIndex+f,w=h[R],b=z_(p.axis),x=f2(d,g,w,b);Jt(p.draggerGfx,x.x,x.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return cl(p[g-1],p[g+1],m)?(d=g<=f?d-1:d,!1):!0});return{waypoints:h,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,h=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=M_(h,f.segmentStart,f.segmentEnd),He(f.draggerGfx).add("djs-dragging"),n.addMarker(d,F_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,g=f.segmentStart,R=f.segmentEnd,w=f.axis,b=f.originalWaypoints.slice(),x=H_(g,w,p["d"+w]),S=H_(R,w,p["d"+w]),M=b.length,I=0;b[h]=x,b[m]=S;var A,H;h<2&&(A=Qt(d.source,x),h===1?A==="intersect"&&(b.shift(),b[0]=x,I--):A!=="intersect"&&(b.unshift(g),I++)),m>M-3&&(H=Qt(d.target,S),m===M-2?H==="intersect"&&(b.pop(),b[b.length-1]=S):H!=="intersect"&&b.push(R)),f.newWaypoints=d.waypoints=s(d,b),u(f,I,p),f.newSegmentStartIndex=h+I,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,j_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,j_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&Ht(f.draggerGfx),n.removeMarker(d,F_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(p){var f=p.context,d=f.connection;d.waypoints=f.originalWaypoints,c(p)}),t.on("connectionSegment.move.end",function(p){var f=p.context,d=f.connection,h=f.newWaypoints,m=f.newSegmentStartIndex;h=h.map(function(S){return{original:S.original,x:Math.round(S.x),y:Math.round(S.y)}});var g=l(h,m),R=g.waypoints,w=s(d,R),b=g.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+b}};o.updateWaypoints(d,w,x)})}G_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var d2=Math.abs,W_=Math.round;function h2(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],d2(r-e)<=n)return r}function U_(e){return{x:e.x,y:e.y}}function Y_(e){return{x:e.x+e.width,y:e.y+e.height}}function Qn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:W_(e.x+e.width/2),y:W_(e.y+e.height/2)}}function No(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Dt(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function q_(e){return e.children||[]}var m2=Math.abs,K_=Math.round,xf=10;function X_(e){function t(o,a){if(_e(o)){for(var s=o.length;s--;)if(m2(o[s]-a)<=xf)return o[s]}else{o=+o;var c=a%o;if(c<xf)return a-c;if(c>o-xf)return a-c+o}return a}function n(o,a){if(o.waypoints)return a2(a,o);if(o.width)return{x:K_(o.width/2+o.x),y:K_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,p=a.segmentStartIndex,f=a.segmentEnd,d=a.segmentEndIndex,h=a.axis;if(s)return s;var m=[u[p-1],l,f,u[d+1]];return p<2&&m.unshift(n(c.source,o)),d>u.length-3&&m.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},k(m,function(g){g&&(g=g.original||g,h==="y"&&s.horizontal.push(g.y),h==="x"&&s.vertical.push(g.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var p=s-u,f=c-l;O(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&Dt(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&Dt(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},k(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!rt(s)||!c||!c.x||!c.y||(Dt(o,"x",c.x),Dt(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,p=o.y,f,d;if(s){f=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,p);var h=l-f,m=p-d;O(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&&Dt(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&Dt(o,"y",d)}})}X_.$inject=["eventBus"];const g2={__depends__:[Ii,yi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",k_],bendpointMove:["type",_f],bendpointMovePreview:["type",$_],connectionSegmentMove:["type",G_],bendpointSnapping:["type",X_]};function Z_(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!Zr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Zr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},p=s.source,f=s.target;if(!c)return!1;var d=null,h={connectionStart:wf(s)?l:u,connectionEnd:wf(s)?u:l};Gt(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){Gt(c)||(u=c,c=be(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}Z_.$inject=["eventBus","dragging","modeling","rules"];function wf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var y2=1100,v2=900,Q_="connect-ok",J_="connect-not-ok";function eb(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,p=o.target,f=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},h=f,m=d;wf(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",v2,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?Q_:J_)}),t.on(["connect.out","connect.cleanup"],y2,function(r){var o=r.hover;o&&(n.removeMarker(o,Q_),n.removeMarker(o,J_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}eb.$inject=["injector","eventBus","canvas"];const Ef={__depends__:[Kn,yi,Ii],__init__:["connectPreview"],connect:["type",Z_],connectPreview:["type",eb]};var _2="djs-dragger";function zi(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}zi.$inject=["injector","canvas","graphicsFactory","elementFactory"],zi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,p=n.noCropping,f=n.noNoop,d,h=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),vs(i),r||(r=e.getConnection=b2(function(m,g,R){return h.getConnection(m,g,R)})),t&&(d=r(t,o,a)),!d){!f&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?be(o):c,a?be(a):u]),this._connectionDocking&&(o||a)&&!p&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},zi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||be(n),o=t.connectionEnd||be(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Ce(e,s)},zi.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&Jo(o,s,!0)||e,t=i&&Jo(a,s,!1)||t,[e,t]},zi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ht(e.connectionPreviewGfx)},zi.prototype.getConnection=function(e){var t=x2(e);return this._elementFactory.createConnection(t)},zi.prototype.createConnectionPreviewGfx=function(){var e=he("g");return se(e,{pointerEvents:"none"}),He(e).add(_2),Ce(this._canvas.getActiveLayer(),e),e},zi.prototype.createNoopConnection=function(e,t){return Ko([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function b2(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}function x2(e){return Gt(e)?e:{}}const w2={__init__:["connectionPreview"],connectionPreview:["type",zi]},iu="complex-preview";class tb{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(iu);n.filter(s=>!E2(s)).forEach(s=>{let c;rt(s)?(c=this._graphicsFactory._createContainer("connection",he("g")),this._graphicsFactory.drawConnection(Ir(c),s)):(c=this._graphicsFactory._createContainer("shape",he("g")),this._graphicsFactory.drawShape(Ir(c),s),Jt(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);rt(s)?Jt(u,c.x,c.y):Jt(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",he("g"));this._graphicsFactory.drawShape(Ir(u),s,{width:c.width,height:c.height}),Jt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){vs(this._canvas.getLayer(iu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(iu)}hide(){this._canvas.hideLayer(iu)}}tb.$inject=["canvas","graphicsFactory","previewSupport"];function E2(e){return e.hidden}const S2={__depends__:[Co],__init__:["complexPreview"],complexPreview:["type",tb]},nb=Math.round;function ru(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}ru.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(O({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;O(u,{x:l.x-nb(u.width/2),y:l.y-nb(u.height/2)});const p=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let f=null;p&&(f=o.createConnection(p),f.waypoints=s.layoutConnection(f,{source:e,target:u}),f.waypoints=r.getCroppedWaypoints(f,e,u)),i.create({created:[u,f].filter(d=>!Zr(d))})},ru.prototype.cleanUp=function(){this._complexPreview.cleanUp()},ru.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const R2={__depends__:[kc,S2,qp],__init__:["appendPreview"],appendPreview:["type",ru]};var ib=Math.min,rb=Math.max;function Sf(e){e.preventDefault()}function Fa(e){e.stopPropagation()}function C2(e){return e.nodeType===Node.TEXT_NODE}function P2(e){return[].slice.call(e)}function oi(e){this.container=e.container,this.parent=ut('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=nt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=_n(this.autoResize,this),this.handlePaste=_n(this.handlePaste,this)}oi.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=ii(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);O(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=ii(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return O(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&O(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Re.bind(a,"keydown",this.keyHandler),Re.bind(a,"mousedown",Fa),Re.bind(a,"paste",r.handlePaste),Re.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Re.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},oi.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var r=this.autoResize(n);r&&this.resizeHandler(r)}},oi.prototype.insertText=function(e){e=A2(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},oi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=P2(a.childNodes),c,u;if(C2(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,s[r]),c=p,u=p.textContent.length}else{var f=s.indexOf(n),d=s.indexOf(i);s.forEach(function(h,m){m===f?h.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):m>f&&m<=d&&pi(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},oi.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},oi.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=ut('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){Sf(h),Fa(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,Re.bind(document,"mousemove",f),Re.bind(document,"mouseup",d)},f=function(h){Sf(h),Fa(h);var m=ib(rb(u+h.clientX-s,i),o),g=ib(rb(l+h.clientY-c,r),a);t.style.width=m+"px",t.style.height=g+"px",e.resizeHandler({width:u,height:l,dx:h.clientX-s,dy:h.clientY-c})},d=function(h){Sf(h),Fa(h),Re.unbind(document,"mousemove",f,!1),Re.unbind(document,"mouseup",d,!1)};Re.bind(n,"mousedown",p)}O(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},oi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Re.unbind(t,"keydown",this.keyHandler),Re.unbind(t,"mousedown",Fa),Re.unbind(t,"input",this.autoResize),Re.unbind(t,"paste",this.handlePaste),Re.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),pi(n)),pi(e)},oi.prototype.getValue=function(){return this.content.innerText.trim()},oi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},oi.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function A2(e){return e.replace(/\r\n|\r|\n/g,`
316
+ `)}function On(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new oi({container:t.getContainer(),keyHandler:_n(this._handleKey,this),resizeHandler:_n(this._handleResize,this),focusoutHandler:_n(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}On.$inject=["eventBus","canvas"],On.prototype.registerProvider=function(e){this._providers.push(e)},On.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},On.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},On.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},On.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},On.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},On.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;(r!==o||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},On.prototype.getValue=function(){return this._textbox.getValue()},On.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;if(t===27)return e.preventDefault(),this.cancel();if(t===13&&!e.shiftKey)return e.preventDefault(),this.complete()},On.prototype._handleResize=function(e){this._fire("resize",e)},On.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},On.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=ct(this._providers,function(i){return(t=i.activate(e))?i:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};const ob={__depends__:[sc],__init__:["directEditing"],directEditing:["type",On]};function T2(e){return function(t){var n=t.target,i=Z(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===Fe(e);return!o||!a||!s||!c}}const M2={task:{label:"Task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},"user-task":{label:"User task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},"service-task":{label:"Service task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},"send-task":{label:"Send task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},"receive-task":{label:"Receive task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},"manual-task":{label:"Manual task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},"rule-task":{label:"Business rule task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},"script-task":{label:"Script task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},"call-activity":{label:"Call activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},transaction:{label:"Transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},"event-subprocess":{label:"Event sub-process",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},"collapsed-subprocess":{label:"Sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},"expanded-subprocess":{label:"Sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},"collapsed-ad-hoc-subprocess":{label:"Ad-hoc sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},"expanded-ad-hoc-subprocess":{label:"Ad-hoc sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},"exclusive-gateway":{label:"Exclusive gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},"parallel-gateway":{label:"Parallel gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},"inclusive-gateway":{label:"Inclusive gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},"complex-gateway":{label:"Complex gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},"event-based-gateway":{label:"Event-based gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}},"data-store-reference":{label:"Data store reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}},"data-object-reference":{label:"Data object reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}},"expanded-pool":{label:"Expanded pool/participant",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},"collapsed-pool":{label:"Empty pool/participant",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}},"none-start-event":{label:"Start event",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},"none-intermediate-throwing":{label:"Intermediate throw event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},"none-boundary-event":{label:"Boundary event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:BoundaryEvent"}},"none-end-event":{label:"End event",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},"message-start":{label:"Message start event",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},"timer-start":{label:"Timer start event",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},"conditional-start":{label:"Conditional start event",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},"signal-start":{label:"Signal start event",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},"error-start":{label:"Error start event",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},"escalation-start":{label:"Escalation start event",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},"compensation-start":{label:"Compensation start event",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},"non-interrupting-message-start":{label:"Message start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},"non-interrupting-timer-start":{label:"Timer start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},"non-interrupting-conditional-start":{label:"Conditional start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},"non-interrupting-signal-start":{label:"Signal start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},"non-interrupting-escalation-start":{label:"Escalation start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}},"message-intermediate-catch":{label:"Message intermediate catch event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"message-intermediate-throw":{label:"Message intermediate throw event",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"timer-intermediate-catch":{label:"Timer intermediate catch event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},"escalation-intermediate-throw":{label:"Escalation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"conditional-intermediate-catch":{label:"Conditional intermediate catch event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},"link-intermediate-catch":{label:"Link intermediate catch event",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"link-intermediate-throw":{label:"Link intermediate throw event",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"compensation-intermediate-throw":{label:"Compensation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-intermediate-catch":{label:"Signal intermediate catch event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"signal-intermediate-throw":{label:"Signal intermediate throw event",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"message-boundary":{label:"Message boundary event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},"timer-boundary":{label:"Timer boundary event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},"escalation-boundary":{label:"Escalation boundary event",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},"conditional-boundary":{label:"Conditional boundary event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},"error-boundary":{label:"Error boundary event",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},"cancel-boundary":{label:"Cancel boundary event",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},"signal-boundary":{label:"Signal boundary event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},"compensation-boundary":{label:"Compensation boundary event",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},"non-interrupting-message-boundary":{label:"Message boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},"non-interrupting-timer-boundary":{label:"Timer boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},"non-interrupting-escalation-boundary":{label:"Escalation boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},"non-interrupting-conditional-boundary":{label:"Conditional boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},"non-interrupting-signal-boundary":{label:"Signal boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}},"message-end":{label:"Message end event",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"escalation-end":{label:"Escalation end event",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"error-end":{label:"Error end event",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},"cancel-end":{label:"Cancel end event",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},"compensation-end":{label:"Compensation end event",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-end":{label:"Signal end event",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"terminate-end":{label:"Terminate end event",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}};function q(e,t={}){var n=M2[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var k2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing"),q("none-end-event",{actionName:"replace-with-none-end"}),q("message-start"),q("timer-start"),q("conditional-start"),q("signal-start")],D2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing"),q("none-end-event",{actionName:"replace-with-none-end"})],O2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),q("none-end-event",{actionName:"replace-with-none-end"}),q("message-intermediate-catch"),q("message-intermediate-throw"),q("timer-intermediate-catch"),q("escalation-intermediate-throw"),q("conditional-intermediate-catch"),q("link-intermediate-catch"),q("link-intermediate-throw"),q("compensation-intermediate-throw"),q("signal-intermediate-catch"),q("signal-intermediate-throw")],L2=[q("none-start-event",{actionName:"replace-with-none-start"}),q("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),q("none-end-event",{actionName:"replace-with-none-end"}),q("message-end"),q("escalation-end"),q("error-end"),q("cancel-end"),q("compensation-end"),q("signal-end"),q("terminate-end")],I2=[q("exclusive-gateway"),q("parallel-gateway"),q("inclusive-gateway"),q("complex-gateway"),q("event-based-gateway")],N2=[q("transaction"),q("event-subprocess"),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),q("collapsed-subprocess")],B2=[q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),q("transaction"),q("event-subprocess"),q("collapsed-ad-hoc-subprocess")],ab=[q("transaction"),q("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),q("event-subprocess")],$2=ab,sb=[q("task"),q("user-task"),q("service-task"),q("send-task"),q("receive-task"),q("manual-task"),q("rule-task"),q("script-task"),q("call-activity"),q("collapsed-subprocess"),q("expanded-subprocess"),q("collapsed-ad-hoc-subprocess"),q("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],j2=[q("data-store-reference")],F2=[q("data-object-reference")],H2=[q("message-boundary"),q("timer-boundary"),q("escalation-boundary"),q("conditional-boundary"),q("error-boundary"),q("cancel-boundary"),q("signal-boundary"),q("compensation-boundary"),q("non-interrupting-message-boundary"),q("non-interrupting-timer-boundary"),q("non-interrupting-escalation-boundary"),q("non-interrupting-conditional-boundary"),q("non-interrupting-signal-boundary")],z2=[q("message-start"),q("timer-start"),q("conditional-start"),q("signal-start"),q("error-start"),q("escalation-start"),q("compensation-start"),q("non-interrupting-message-start"),q("non-interrupting-timer-start"),q("non-interrupting-conditional-start"),q("non-interrupting-signal-start"),q("non-interrupting-escalation-start")],V2=[{label:"Sequence flow",actionName:"replace-with-sequence-flow",className:"bpmn-icon-connection"},{label:"Default flow",actionName:"replace-with-default-flow",className:"bpmn-icon-default-flow"},{label:"Conditional flow",actionName:"replace-with-conditional-flow",className:"bpmn-icon-conditional-flow"}],G2=[q("expanded-pool"),q("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],W2={"bpmn:MessageEventDefinition":[q("message-start"),q("message-intermediate-catch"),q("message-intermediate-throw"),q("message-end")],"bpmn:TimerEventDefinition":[q("timer-start"),q("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[q("conditional-start"),q("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[q("signal-start"),q("signal-intermediate-catch"),q("signal-intermediate-throw"),q("signal-end")],"bpmn:ErrorEventDefinition":[q("error-start"),q("error-end")],"bpmn:EscalationEventDefinition":[q("escalation-start"),q("escalation-intermediate-throw"),q("escalation-end")],"bpmn:CompensateEventDefinition":[q("compensation-start"),q("compensation-intermediate-throw"),q("compensation-end")]};const cb={"start-event-non-interrupting":`
316
317
  <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
317
318
  <g transform="translate(0 995.64)">
318
319
  <path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>
@@ -323,7 +324,7 @@
323
324
  <circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
324
325
  <circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
325
326
  </g>
326
- </svg>`};function tn(e,t,n,i,r,o,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._moddleCopy=s,this._register()}tn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],tn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},tn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(ae(e)||!n.allowed("shape.replace",{element:e}))return{};var a=TA(e);return y(t,"bpmn:DataObjectReference")?this._createEntries(e,jA):y(t,"bpmn:DataStoreReference")&&!y(e.parent,"bpmn:Collaboration")?this._createEntries(e,FA):(y(t,"bpmn:Event")&&!y(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=WA[r]||[],!Et(t.$parent)&&y(t.$parent,"bpmn:SubProcess")&&(i=ye(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),y(t,"bpmn:StartEvent")&&!y(t.$parent,"bpmn:SubProcess")?(o=ye(kA.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Participant")?(o=ye(GA,function(c){return Ee(e)!==c.target.isExpanded}),this._createEntries(e,o)):y(t,"bpmn:StartEvent")&&Et(t.$parent)?(o=ye(zA.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,p=t.isInterrupting===l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):y(t,"bpmn:StartEvent")&&!Et(t.$parent)&&y(t.$parent,"bpmn:SubProcess")?(o=ye(DA.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:EndEvent")?(o=ye(IA.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):y(t,"bpmn:BoundaryEvent")?(o=ye(HA,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!y(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,p=t.cancelActivity==l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):y(t,"bpmn:IntermediateCatchEvent")||y(t,"bpmn:IntermediateThrowEvent")?(o=ye(OA.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Gateway")?(o=ye(LA,a),this._createEntries(e,o)):y(t,"bpmn:Transaction")?(o=ye(Kv,a),this._createEntries(e,o)):Et(t)&&Ee(e)?(o=ye($A,a),this._createEntries(e,o)):y(t,"bpmn:AdHocSubProcess")&&Ee(e)?(o=ye(NA,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&Ee(e)?(o=ye(BA,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&!Ee(e)?(o=ye(Xv,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):y(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,VA):y(t,"bpmn:FlowNode")?(o=ye(Xv,a),this._createEntries(e,o)):{})},tn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return y(e,"bpmn:Activity")&&!Et(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),y(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),y(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Wd(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},tn.prototype._createEntries=function(e,t){var n={},i=this;return A(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},tn.prototype._createSequenceFlowEntries=function(e,t){var n=G(e),i={},r=this._modeling,o=this._moddle,a=this;return A(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(y(n.sourceRef,"bpmn:ExclusiveGateway")||y(n.sourceRef,"bpmn:InclusiveGateway")||y(n.sourceRef,"bpmn:ComplexGateway")||y(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&y(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:y(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(y(n.sourceRef,"bpmn:ExclusiveGateway")||y(n.sourceRef,"bpmn:InclusiveGateway")||y(n.sourceRef,"bpmn:ComplexGateway")||y(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},tn.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=function(){return r(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||o,{label:i(a),className:e.className,action:n}},tn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&y(p,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:l.options.isSequential}):(p=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=G(e),o=r.loopCharacteristics,a,s,c;return o&&(a=o.isSequential,s=o.isSequential===void 0,c=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},tn.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function r(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var o=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}}},tn.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,u;c||(u=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:u})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},tn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=G(e),i=this,r=Ud(e),o=y(e,"bpmn:BoundaryEvent")?Zv["intermediate-event-non-interrupting"]:Zv["start-event-non-interrupting"],a=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[r]:!!a})}}}};const UA={__depends__:[Fl,fm,fs],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",tn]};function Do(e,t,n,i,r,o,a,s,c,u,l,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,g=h.shape;if(!(!no(d)||!i.isOpen(g))){var _=i.getEntries(g);_.replace&&_.replace.action.click(d,g)}}),n.on("contextPad.close",function(){f.cleanUp()})}Do.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Do.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&D(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Do.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return ae(t)?Ci(e,n=>t.includes(n)):t},Do.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&D(l,h()),l;var p=e.businessObject;function f(E,b){r.start(E,b)}function d(E,b){n.removeElements([b])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function g(E){var b=5,S=t.getPad(E).html,T=S.getBoundingClientRect(),O={x:T.left,y:T.bottom+b};return O}function _(E,b,S,T){function O(N,I){var W=i.createShape(D({type:E},T));o.start(N,W,{source:I})}var C=s?function(N,I){var W=i.createShape(D({type:E},T));s.append(I,W)}:O,F=s?function(N,I){return u.create(I,E,T),()=>{u.cleanUp()}}:null;return{group:"model",className:b,title:S,action:{dragstart:O,click:C,hover:F}}}function R(E){return function(b,S){n.splitLane(S,E),t.open(S,!0)}}if(ge(p,["bpmn:Lane","bpmn:Participant"])&&Ee(e)){var x=ai(e);D(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(E,b){n.addLane(b,"top")}}}}),x.length<2&&((at(e)?e.height>=120:e.width>=120)&&D(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:R(2)}}}),(at(e)?e.height>=180:e.width>=180)&&D(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:R(3)}}})),D(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(E,b){n.addLane(b,"bottom")}}}})}return y(p,"bpmn:FlowNode")&&(y(p,"bpmn:EventBasedGateway")?D(l,{"append.receive-task":_("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":_("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":_("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":_("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":_("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Qv(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?D(l,{"append.compensation-activity":_("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!y(p,"bpmn:EndEvent")&&!p.isForCompensation&&!Qv(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Et(p)&&D(l,{"append.end-event":_("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":_("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":_("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":_("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||D(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(E,b){var S=D(g(b),{cursor:{x:E.x,y:E.y}});a.open(b,"bpmn-replace",S,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),y(p,"bpmn:SequenceFlow")&&D(l,{"append.text-annotation":_("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),y(p,"bpmn:MessageFlow")&&D(l,{"append.text-annotation":_("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),ge(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(l,{"append.text-annotation":_("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),y(p,"bpmn:TextAnnotation")&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),ge(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),y(p,"bpmn:Group")&&D(l,{"append.text-annotation":_("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&D(l,h()),l};function Qv(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return A(o,function(a){a.$type===n&&(r=!0)}),i&&r}const qA={__depends__:[RA,Yv,Pg,Zt,Yl,Ga,UA],__init__:["contextPadProvider"],contextPadProvider:["type",Do]};var YA={horizontal:["x","width"],vertical:["y","height"]},Jv=5;function Un(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return ae(i)?i:i?n:[]})}Un.$inject=["modeling","rules"],Un.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Un.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Un.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(A(t,function(o){r=o(r,n,i)}),r):e},Un.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=ln(e,i);return A(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Un.prototype._setOrientation=function(e){var t=YA[e];this._axis=t[0],this._dimension=t[1]},Un.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Un.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+Jv,max:t+n-Jv}};const KA={__init__:["distributeElements"],distributeElements:["type",Un]};function Fs(e){Xt.call(this,e)}Fs.$inject=["eventBus"],X(Fs,Xt),Fs.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=ye(t,function(n){var i=ge(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=na(t),t.length<3?!1:t})};var ey={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function Jn(e,t,n,i,r,o,a,s){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=a,this._moddleCopy=s,this._register()}Jn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Jn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Jn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(_e(e)||!n.allowed("shape.replace",{element:e}))return{};var a=T2(e);return v(t,"bpmn:DataObjectReference")?this._createEntries(e,j2):v(t,"bpmn:DataStoreReference")&&!v(e.parent,"bpmn:Collaboration")?this._createEntries(e,F2):(v(t,"bpmn:Event")&&!v(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=W2[r]||[],!un(t.$parent)&&v(t.$parent,"bpmn:SubProcess")&&(i=Ie(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),v(t,"bpmn:StartEvent")&&!v(t.$parent,"bpmn:SubProcess")?(o=Ie(k2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Participant")?(o=Ie(G2,function(c){return Fe(e)!==c.target.isExpanded}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&un(t.$parent)?(o=Ie(z2.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,p=t.isInterrupting===l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):v(t,"bpmn:StartEvent")&&!un(t.$parent)&&v(t.$parent,"bpmn:SubProcess")?(o=Ie(D2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:EndEvent")?(o=Ie(L2.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):v(t,"bpmn:BoundaryEvent")?(o=Ie(H2,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!v(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,p=t.cancelActivity==l;return a(c)||!a(c)&&!p}),this._createEntries(e,o)):v(t,"bpmn:IntermediateCatchEvent")||v(t,"bpmn:IntermediateThrowEvent")?(o=Ie(O2.concat(i),a),this._createEntries(e,o)):v(t,"bpmn:Gateway")?(o=Ie(I2,a),this._createEntries(e,o)):v(t,"bpmn:Transaction")?(o=Ie(ab,a),this._createEntries(e,o)):un(t)&&Fe(e)?(o=Ie($2,a),this._createEntries(e,o)):v(t,"bpmn:AdHocSubProcess")&&Fe(e)?(o=Ie(B2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&Fe(e)?(o=Ie(N2,a),this._createEntries(e,o)):v(t,"bpmn:SubProcess")&&!Fe(e)?(o=Ie(sb,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):v(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,V2):v(t,"bpmn:FlowNode")?(o=Ie(sb,a),this._createEntries(e,o)):{})},Jn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return v(e,"bpmn:Activity")&&!un(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),v(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),v(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),ig(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Jn.prototype._createEntries=function(e,t){var n={},i=this;return k(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},Jn.prototype._createSequenceFlowEntries=function(e,t){var n=Z(e),i={},r=this._modeling,o=this._moddle,a=this;return k(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&v(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:v(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(v(n.sourceRef,"bpmn:ExclusiveGateway")||v(n.sourceRef,"bpmn:InclusiveGateway")||v(n.sourceRef,"bpmn:ComplexGateway")||v(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},Jn.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=function(){return r(t,e.target)},a=e.label;return a&&typeof a=="function"&&(a=a(t)),n=n||o,{label:i(a),className:e.className,action:n}},Jn.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var p=e.businessObject.get("loopCharacteristics");p&&v(p,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,p,{isSequential:l.options.isSequential}):(p=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:p}))}var r=Z(e),o=r.loopCharacteristics,a,s,c;return o&&(a=o.isSequential,s=o.isSequential===void 0,c=o.isSequential!==void 0&&!o.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:c,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:s,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Jn.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};function r(a,s){t._modeling.updateModdleProperties(e,i,{isCollection:!s.active})}var o=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:o,action:r}}},Jn.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,u;c||(u=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:u})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},Jn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Z(e),i=this,r=rg(e),o=v(e,"bpmn:BoundaryEvent")?cb["intermediate-event-non-interrupting"]:cb["start-event-non-interrupting"],a=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:a,action:function(){i._modeling.updateProperties(e,{[r]:!!a})}}}};const U2={__depends__:[mf,Sy,kc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Jn]};function Ha(e,t,n,i,r,o,a,s,c,u,l,p,f){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=p,this._eventBus=n,this._appendPreview=f,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var h=d.context,m=h.shape;if(!(!fa(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}Ha.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Ha.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&O(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Ha.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return _e(t)?Cr(e,n=>t.includes(n)):t},Ha.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&O(l,h()),l;var p=e.businessObject;function f(b,x){r.start(b,x)}function d(b,x){n.removeElements([x])}function h(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function m(b){var x=5,S=t.getPad(b).html,M=S.getBoundingClientRect(),I={x:M.left,y:M.bottom+x};return I}function g(b,x,S,M){function I(V,$){var G=i.createShape(O({type:b},M));o.start(V,G,{source:$})}var A=s?function(V,$){var G=i.createShape(O({type:b},M));s.append($,G)}:I,H=s?function(V,$){return u.create($,b,M),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:S,action:{dragstart:I,click:A,hover:H}}}function R(b){return function(x,S){n.splitLane(S,b),t.open(S,!0)}}if(Le(p,["bpmn:Lane","bpmn:Participant"])&&Fe(e)){var w=ar(e);O(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(b,x){n.addLane(x,"top")}}}}),w.length<2&&((Ut(e)?e.height>=120:e.width>=120)&&O(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:R(2)}}}),(Ut(e)?e.height>=180:e.width>=180)&&O(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:R(3)}}})),O(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(b,x){n.addLane(x,"bottom")}}}})}return v(p,"bpmn:FlowNode")&&(v(p,"bpmn:EventBasedGateway")?O(l,{"append.receive-task":g("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):ub(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?O(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!v(p,"bpmn:EndEvent")&&!p.isForCompensation&&!ub(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!un(p)&&O(l,{"append.end-event":g("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":g("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":g("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":g("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||O(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var S=O(m(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",S,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),v(p,"bpmn:SequenceFlow")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),v(p,"bpmn:MessageFlow")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Le(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:f,dragstart:f}}}),v(p,"bpmn:TextAnnotation")&&O(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),Le(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&O(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),v(p,"bpmn:Group")&&O(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&O(l,h()),l};function ub(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return k(o,function(a){a.$type===n&&(r=!0)}),i&&r}const Y2={__depends__:[R2,ob,$v,Kn,Ef,uc,U2],__init__:["contextPadProvider"],contextPadProvider:["type",Ha]};var q2={horizontal:["x","width"],vertical:["y","height"]},lb=5;function Vi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return _e(i)?i:i?n:[]})}Vi.$inject=["modeling","rules"],Vi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Vi.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Vi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(k(t,function(o){r=o(r,n,i)}),r):e},Vi.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=ai(e,i);return k(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Vi.prototype._setOrientation=function(e){var t=q2[e];this._axis=t[0],this._dimension=t[1]},Vi.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Vi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+lb,max:t+n-lb}};const K2={__init__:["distributeElements"],distributeElements:["type",Vi]};function ou(e){qn.call(this,e)}ou.$inject=["eventBus"],ae(ou,qn),ou.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ie(t,function(n){var i=Le(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=xs(t),t.length<3?!1:t})};var pb={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
328
  <polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
328
329
  <rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
329
330
  <rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
@@ -331,7 +332,7 @@
331
332
  <polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
332
333
  <rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
333
334
  <rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
334
- </svg>`},XA=900;function Oo(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",XA,this)}Oo.$inject=["popupMenu","distributeElements","translate","rules"],Oo.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Oo.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Oo.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:ey.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:ey.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const ZA={__depends__:[Fl,KA],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Fs],distributeElementsMenuProvider:["type",Oo]};var ty="is not a registered action",QA="is already registered";function nn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}nn.$inject=["eventBus","injector"],nn.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l});if(p!==!1){var f=ae(p)?p:l;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l}),f;p!==!1&&(ae(p)?f=p:f=l,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},nn.prototype.trigger=function(e,t){if(!this._actions[e])throw Xl(e,ty);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},nn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);A(e,function(i,r){n._registerAction(r,i)})},nn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Xl(e,QA);this._actions[e]=t},nn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Xl(e,ty);this._actions[e]=void 0},nn.prototype.getActions=function(){return Object.keys(this._actions)},nn.prototype.isRegistered=function(e){return!!this._actions[e]};function Xl(e,t){return new Error(e+" "+t)}const JA={__init__:["editorActions"],editorActions:["type",nn]};function Hs(e){e.invoke(nn,this)}X(Hs,nn),Hs.$inject=["injector"],Hs.prototype._registerDefaultActions=function(e){nn.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var h=t.getRootElement(),g=n.filter(function(_){return _!==h});return i.select(g),g}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(h){var g=i.get(),_=h.type;g.length&&c.trigger(g,_)}),i&&u&&this._registerAction("alignElements",function(h){var g=i.get(),_=[],R=h.type;g.length&&(_=ye(g,function(x){return!y(x,"bpmn:Lane")}),u.trigger(_,R))}),i&&f&&this._registerAction("setColor",function(h){var g=i.get();g.length&&f.setColor(g,h)}),i&&l&&this._registerAction("directEditing",function(){var h=i.get();h.length&&l.activate(h[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),g,_;y(h,"bpmn:Collaboration")?_=n.filter(function(R){return y(R.parent,"bpmn:Collaboration")}):_=n.filter(function(R){return R!==h&&!y(R.parent,"bpmn:SubProcess")}),g=Ue(_),f.moveElements(_,{x:-g.x,y:-g.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const eT={__depends__:[JA],editorActions:["type",Hs]};function ny(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;ge(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}ny.$inject=["eventBus"];function Ui(e,t){V.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;Tt(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Ui.$inject=["eventBus","gridSnapping","modeling"],X(Ui,V),Ui.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},Ui.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},Ui.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),D(e,o),e},Ui.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),D(e,o),e};var tT=2e3;function iy(e,t){e.on(["spaceTool.move","spaceTool.end"],tT,function(n){var i=n.context;if(i.initialized){var r=i.axis,o;r==="x"?(o=t.snapValue(n.dx),n.x=n.x+o-n.dx,n.dx=o):(o=t.snapValue(n.dy),n.y=n.y+o-n.dy,n.dy=o)}})}iy.$inject=["eventBus","gridSnapping"];const nT={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Ui],gridSnappingSpaceToolBehavior:["type",iy]};var zs=10;function Zl(e,t,n){return n||(n="round"),Math[n](e/t)*t}var iT=1200,rT=800;function _i(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",rT,function(){r.setActive(i)}),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],iT,function(o){var a=o.originalEvent;if(!(!r.active||a&&Lt(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=aT(o,u,e);p&&(l.offset=p);var f=oT(o,u);f&&D(l,f),Tr(o,u)||r.snapEvent(o,u,l)})}})}_i.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Xe(e,t,i)},_i.prototype.getGridSpacing=function(){return zs},_i.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Zl(e,zs);var i,r;return t&&t.min&&(i=t.min,ue(i)&&(i=Zl(i+n,zs,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,ue(r)&&(r=Zl(r+n,zs,"floor"),e=Math.min(e,r))),e-=n,e},_i.prototype.isActive=function(){return this.active},_i.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},_i.prototype.toggleActive=function(){this.setActive(!this.active)},_i.$inject=["elementRegistry","eventBus","config.gridSnapping"];function oT(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(Vs(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,u=r.max;return c&&(Vs(t)?oy(s)?a.x.max=c.left:a.x.min=c.right:ry(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(Vs(t)?oy(s)?a.x.min=u.left:a.x.max=u.right:ry(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function aT(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&ue(s[t])||(s||(s=o.snapOffset={}),ue(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Vs(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function Vs(e){return e==="x"}function ry(e){return e.indexOf("n")!==-1}function oy(e){return e.indexOf("w")!==-1}const sT={__depends__:[nT],__init__:["gridSnapping"],gridSnapping:["type",_i]};var cT=2e3;function ay(e,t,n){e.on("autoPlace",cT,function(i){var r=i.source,o=se(r),a=i.shape,s=rg(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],y(a,"bpmn:TextAnnotation")&&(uT(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}ay.$inject=["eventBus","gridSnapping","elementRegistry"];function uT(e){return e==="x"}var lT=1750;function sy(e,t,n){t.on(["create.start","shape.move.start"],lT,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!y(o,"bpmn:Participant")||!y(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}sy.$inject=["canvas","eventBus","gridSnapping"];var pT=3e3;function Gs(e,t,n){V.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],pT,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||fT(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Gs.$inject=["eventBus","gridSnapping","modeling"],X(Gs,V),Gs.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=mT(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function fT(e){return e.length>3}function dT(e){return e==="h"}function hT(e){return e==="v"}function mT(e,t,n){var i=Dn(t,n),r={};return dT(i)&&(r.y=e.snapValue(t.y)),hT(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=D({},t,r),n=D({},n,r)),[t,n]}const gT={__depends__:[sT,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",ay],gridSnappingParticipantBehavior:["type",sy],gridSnappingLayoutConnectionBehavior:["type",Gs]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",ny]};var vT=30,cy=30;function Io(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(y(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(y(r,"bpmn:Participant"))return Ee(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(y(r,"bpmn:SubProcess"))return Ee(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Io.$inject=["eventBus","interactionEvents"],Io.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Io.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=at(e)?{width:vT,height:e.height}:{width:e.width,height:cy};return this._interactionEvents.createBoxHit(t,"all",n),!0},Io.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:cy}),!0};const yT={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Io]};function Ws(e){e.invoke(xr,this)}X(Ws,xr),Ws.$inject=["injector"],Ws.prototype.registerBindings=function(e,t){xr.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const _T={__depends__:[Rl],__init__:["keyboardBindings"],keyboardBindings:["type",Ws]};var bT={moveSpeed:1,moveSpeedAccelerated:10},ET=1500,uy="left",ly="up",py="right",fy="down",xT={ArrowLeft:uy,Left:uy,ArrowUp:ly,Up:ly,ArrowRight:py,Right:py,ArrowDown:fy,Down:fy},wT={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function dy(e,t,n,i,r){var o=this;this._config=D({},bT,e||{}),t.addListener(ET,function(a){var s=a.keyEvent,c=xT[s.key];if(c&&!t.isCmd(s)){var u=t.isShift(s);return o.moveSelection(c,u),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var u=this._config[s?"moveSpeedAccelerated":"moveSpeed"],l=wT[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}dy.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const ST={__depends__:[Rl,Zt],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",dy]};var hy=10;function Lo(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=u,d=hw(l,p,u),c.newBounds=gw(d,f),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:ie(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=Mf(p),!RT(u,p))return;n.resizeShape(u,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}Lo.prototype.canResize=function(e){var t=this._rules,n=on(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Lo.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=D({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,my(t,o),"resize",{autoActivate:!0,cursor:CT(o),data:{shape:t,context:r}})},Lo.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:hy,height:hy},r=vd(t,e.childrenBoxPadding),vw(n,t,i,r)},Lo.$inject=["eventBus","rules","modeling","dragging"];function RT(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function my(e,t){var n=se(e),i=ie(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function CT(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var gy="djs-resizing",vy="resize-not-ok",PT=500;function yy(e,t,n){function i(o){var a=o.shape,s=o.newBounds,c=o.frame;c||(c=o.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,gy)),s.width>5&&Z(c,{x:s.x,width:s.width}),s.height>5&&Z(c,{y:s.y,height:s.height}),o.canExecute?xe(c).remove(vy):xe(c).add(vy)}function r(o){var a=o.shape,s=o.frame;s&&tt(o.frame),t.removeMarker(a,gy)}e.on("resize.move",PT,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}yy.$inject=["eventBus","canvas","previewSupport"];var Us=-6,qs=8,Ys=20,Bo="djs-resizer",AT=["n","w","s","e","nw","ne","se","sw"];function bi(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&A(a,Ct(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}bi.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){ci(o)&&i.activate(o,e,n)}le.bind(t,"mousedown",r),le.bind(t,"touchstart",r)},bi.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=TT(i),a=te("g");xe(a).add(Bo),xe(a).add(Bo+"-"+e.id),xe(a).add(Bo+"-"+i),pe(r,a);var s=te("rect");Z(s,{x:-qs/2+o.x,y:-qs/2+o.y,width:qs,height:qs}),xe(s).add(Bo+"-visual"),pe(a,s);var c=te("rect");return Z(c,{x:-Ys/2+o.x,y:-Ys/2+o.y,width:Ys,height:Ys}),xe(c).add(Bo+"-hit"),pe(a,c),ca(a,t,n),a},bi.prototype.createResizer=function(e,t){var n=my(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},bi.prototype.addResizer=function(e){var t=this;Te(e)||A(AT,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},bi.prototype.removeResizers=function(){var e=this._getResizersParent();Jo(e)},bi.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},bi.$inject=["eventBus","canvas","selection","resize"];function TT(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Us:e.indexOf("w")!==-1&&(t.x=Us),e.indexOf("s")!==-1?t.y=-Us:e.indexOf("n")!==-1&&(t.y=Us),t}const _y={__depends__:[En,$n,yr],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Lo],resizePreview:["type",yy],resizeHandles:["type",bi]};var MT=2e3;function No(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],MT,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||ge(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}No.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],No.prototype.activate=function(e){var t=Vt(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);D(n,i);var r={},o=n.style||{};return D(o,{backgroundColor:null,border:null}),(ge(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||by(e))&&D(r,{centerVertically:!0}),ri(e)&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),y(e,"bpmn:TextAnnotation")&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),D(n,{options:r,style:o}),n}},No.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(y(e,"bpmn:Lane")||OT(e)){var h=at(e),g=h?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};D(o,g),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(DT(e)){var _=at(e),R=_?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};D(o,R),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:_?null:"rotate(-90deg)"})}(ge(e,["bpmn:Task","bpmn:CallActivity"])||by(e))&&(D(o,{width:i.width,height:i.height}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),kT(e)&&(D(o,{width:i.width,x:i.x}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var x=1,E=i.width+2*x;if(n.labelTarget&&(D(o,{width:E,height:i.height+2*x,x:i.x-x,y:i.y-x}),D(d,{fontSize:u+"px",lineHeight:l})),ri(n)&&!pa(n)&&!he(n)){var b=$c(e),S=t.getAbsoluteBBox({x:b.x,y:b.y,width:0,height:0}),T=u,O=Ii.width*a+2*x;D(o,{width:O,height:T+2*x,x:S.x-O/2,y:S.y-T/2-x}),D(d,{fontSize:u+"px",lineHeight:l})}return y(e,"bpmn:TextAnnotation")&&(D(o,{width:i.width+2*x,height:i.height+2*x,x:i.x-x,y:i.y-x,minWidth:30*a,minHeight:10*a}),D(d,{textAlign:"left",paddingTop:or*a+"px",paddingBottom:or*a+"px",paddingLeft:or*a+"px",paddingRight:or*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},No.prototype.update=function(e,t,n,i){var r,o;y(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),IT(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function by(e){return y(e,"bpmn:SubProcess")&&!Ee(e)}function kT(e){return y(e,"bpmn:SubProcess")&&Ee(e)}function DT(e){return y(e,"bpmn:Participant")&&!Ee(e)}function OT(e){return y(e,"bpmn:Participant")&&Ee(e)}function IT(e){return!e||!e.trim()}var Ey="djs-element-hidden",xy="djs-label-hidden";function wy(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,y(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=te("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=te("path");Z(p,{d:l,strokeWidth:2,stroke:LT(o)}),pe(s,p),pe(r,s),lt(s,o.x,o.y)}y(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Ey):(y(o,"bpmn:Task")||y(o,"bpmn:CallActivity")||y(o,"bpmn:SubProcess")||y(o,"bpmn:Participant")||y(o,"bpmn:Lane"))&&t.addMarker(o,xy)}),e.on("directEditing.resize",function(c){if(y(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,p=Math.max(o.height/a.height*(u+l),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});Z(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,Ey),t.removeMarker(o,xy)),o=void 0,a=void 0,s&&(tt(s),s=void 0)})}wy.$inject=["eventBus","canvas","pathMap"];function LT(e,t){var n=we(e);return n.get("stroke")||t||"black"}const BT={__depends__:[nl,_y,Yv],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",No],labelEditingPreview:["type",wy]};var NT=500,$T=1e3;function Sn(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){gE(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){A(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],NT,function(o){var a=o.element,s=o.gfx,c=Ae(".djs-outline",s);c&&i.updateOutline(a,c)})}Sn.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Ae(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),pe(t,n),this.updateOutline(e,n)),n},Sn.prototype._createOutlineGfx=function(){var e=te("rect");return Z(e,D({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Sn.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Sn.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&A(i,function(r){n=n||r.updateOutline(t,e)}),n||Z(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Sn.prototype.updateConnectionOutline=function(e,t){var n=Ue(t);Z(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Sn.prototype.registerProvider=function(e,t){t||(t=e,e=$T),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Sn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Sn.prototype.getOutline=function(e){var t,n=this._getProviders();return A(n,function(i){ot(i.getOutline)&&(t=t||i.getOutline(e))}),t},Sn.$inject=["eventBus","styles","elementRegistry"];var Ks=6;function Ql(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(r){n.isSelected(r.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(r){var o=r.newSelection;i._updateMultiSelectionOutline(o)})}Ql.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Jo(t);var n=e.length>1,i=this._canvas.getContainer();if(xe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=jT(Ue(e)),o=te("rect");Z(o,D({rx:3},r)),xe(o).add("djs-selection-outline"),pe(t,o)}},Ql.$inject=["eventBus","canvas","selection"];function jT(e){return{x:e.x-Ks,y:e.y-Ks,width:e.width+Ks*2,height:e.height+Ks*2}}const Jl={__depends__:[Zt],__init__:["outline","multiSelectionOutline"],outline:["type",Sn],multiSelectionOutline:["type",Ql]},Sy=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Ry={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},FT=15,Xs=2;function Cy(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(h=>ge(h,Sy));if(f.length===1){const h=f[0];he(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(he),g=f.find(_=>{var R;return(R=_.labels)==null?void 0:R.includes(h)});h&&g&&a(h,g)}}),e.on("shape.changed",function({element:p}){var f;!ge(p,Sy)||!l(p)||(he(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=jr([se(f),se(p)],Ry),h=d.getAttribute("d"),_=r.isSelected(p)?c(p):u(p),R=Vr(_,h);if(!R)return;const E=r.isSelected(f)?c(f):u(f),b=Vr(E,h)||se(f);Jr(b,R)<FT||(Mc(d,[b,R]),pe(o,d))}function s(){Qo(`.${Ry.class}`,o).forEach(tt)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+Ei(f,"x")-Xs,y:p.y+Ei(f,"y")-Xs,width:Ei(f,"width")+Xs*2,height:Ei(f,"height")+Xs*2};return Fc(d,Ei(f,"rx"))}if(f.cx){const d=Ei(f,"r"),h={x:p.x+Ei(f,"cx")-d,y:p.y+Ei(f,"cy")-d,width:d*2,height:d*2};return ed(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}Cy.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function Ei(e,t){return parseFloat(Z(e,t)||0)}const HT={__depends__:[Zt,Jl],__init__:["labelLink"],labelLink:["type",Cy]};var zT=new vr("tt");function VT(e){var t=Ie('<div class="djs-tooltip-container" />');return wt(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function GT(e,t,n){wt(e,{left:t+"px",top:n+"px"})}function ep(e,t){e.style.display=t===!1?"none":""}var Py="djs-tooltip",tp="."+Py;function At(e,t){this._eventBus=e,this._canvas=t,this._ids=zT,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=VT(t.getContainer());var n=this;Dt.bind(this._tooltipRoot,tp,"mousedown",function(i){i.stopPropagation()}),Dt.bind(this._tooltipRoot,tp,"mouseover",function(i){n.trigger("mouseover",i)}),Dt.bind(this._tooltipRoot,tp,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}At.$inject=["eventBus","canvas"],At.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=D({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},At.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(_t(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},At.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},At.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},At.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},At.prototype.remove=function(e){var t=this.get(e);t&&(mn(t.html),mn(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},At.prototype.show=function(){ep(this._tooltipRoot)},At.prototype.hide=function(){ep(this._tooltipRoot,!1)},At.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},At.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),Tt(n)&&(n=Ie(n)),i=Ie('<div data-tooltip-id="'+t+'" class="'+Py+'">'),wt(i,{position:"absolute"}),i.appendChild(n),e.type&&Be(i).add("djs-tooltip-"+e.type),e.className&&Be(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},At.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;GT(n,t.x,t.y)},At.prototype._updateTooltipVisibilty=function(e){A(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),ep(i,r))})},At.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const WT={__init__:["tooltips"],tooltips:["type",At]};var UT="flow elements must be children of pools/participants",qT="Data object must be placed within a pool/participant.";function Ay(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;y(s,"bpmn:Collaboration")&&(y(a,"bpmn:FlowNode")?i(r,n(UT)):y(a,"bpmn:DataObjectReference")&&i(r,n(qT)))})}Ay.$inject=["eventBus","tooltips","translate"];const YT={__depends__:[WT],__init__:["modelingFeedback"],modelingFeedback:["type",Ay]};var KT=500,XT=1250,ZT=1500,Zs=Math.round;function QT(e){return{x:e.x+Zs(e.width/2),y:e.y+Zs(e.height/2)}}function Ty(e,t,n,i,r){function o(s,c,u,l){return r.allowed("elements.move",{shapes:s,delta:c,position:u,target:l})}e.on("shape.move.start",ZT,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=JT(l),D(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",XT,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",KT,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(u,p,f,l),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,p=l==="attach",f=c.shapes;if(l===!1)return!1;u.x=Zs(u.x),u.y=Zs(u.y),!(u.x===0&&u.y===0)&&n.moveElements(f,u,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(ci(s)){var c=dr(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(rt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!xe(s.target).has("djs-hit-no-move")){var p=QT(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(f!==!1)return!0}}this.start=a}Ty.$inject=["eventBus","dragging","modeling","selection","rules"];function JT(e){var t=Xi(e,"id");return ye(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var My=499,np="djs-dragging",ky="drop-ok",Dy="drop-not-ok",Oy="new-parent",Iy="attach-ok";function Ly(e,t,n,i){function r(c){var u=o(c),l=eM(u);return l}function o(c){var u=Fr(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[Iy,ky,Dy,Oy].forEach(function(l){l===u?t.addMarker(c,l):t.removeMarker(c,l)})}function s(c,u,l){i.addDragger(u,c.dragGroup),l&&t.addMarker(u,np),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",My,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=te("g");Z(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();pe(h,d),u.dragGroup=d}f.forEach(function(g){i.addDragger(g,u.dragGroup)}),p?p=rc([p,o(l)]):p=o(l),A(p,function(g){t.addMarker(g,np)}),u.allDraggedElements=p,u.differentParents=tM(l)}),e.on("shape.move.move",My,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,Iy):u.canExecute&&f&&p.id!==f.id?a(p,Oy):a(p,u.canExecute?ky:Dy)),lt(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,p=u.dragGroup;A(l,function(f){t.removeMarker(f,np)}),p&&tt(p)}),this.makeDraggable=s}Ly.$inject=["eventBus","canvas","styles","previewSupport"];function eM(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=ye(e,function(i){return Te(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function tM(e){return M_(Xi(e,function(t){return t.parent&&t.parent.id}))!==1}const nM={__depends__:[za,Zt,Jl,En,$n,yr],__init__:["move","movePreview"],move:["type",Ty],movePreview:["type",Ly]};var By=".djs-palette-toggle",Ny=".entry",iM=By+", "+Ny,ip="djs-palette-",rM="shown",rp="open",$y="two-column",oM=1e3;function Ze(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var r=i.tool;n.updateToolHighlight(r)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}Ze.$inject=["eventBus","canvas"],Ze.prototype.registerProvider=function(e,t){t||(t=e,e=oM),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Ze.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(sM,{})},Ze.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Ze.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Ie(Ze.HTML_MARKUP);n.appendChild(i),Be(n).add(ip+rM),Dt.bind(i,iM,"click",function(r){var o=r.delegateTarget;if(Ec(o,By))return e.toggle();e.trigger("click",r)}),le.bind(i,"mousedown",function(r){r.stopPropagation()}),Dt.bind(i,Ny,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Ze.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ze.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Be(n),a=Be(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle($y,r),a.toggle(ip+$y,r),"open"in e&&(o.toggle(rp,e.open),a.toggle(ip+rp,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Ze.prototype._update=function(){var e=Ae(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Xo(e),A(t,function(n,i){var r=n.group||"default",o=Ae("[data-group="+xo(r)+"]",e);o||(o=Ie('<div class="group"></div>'),_t(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Ie(a);if(o.appendChild(s),!n.separator&&(_t(s,"data-action",i),n.title&&_t(s,"title",n.title),n.className&&aM(s,n.className),n.imageUrl)){var c=Ie("<img>");_t(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Ze.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=_t(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Ze.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(ot(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Ze.prototype._layoutChanged=function(){this._toggleState({})},Ze.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Ze.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ze.prototype.open=function(){this._toggleState({open:!0})},Ze.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ze.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ze.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Ae(".djs-palette-entries",this._container),this._toolsContainer=Ae("[data-group=tools]",t)),n=this._toolsContainer,A(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Be(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Ze.prototype.isOpen=function(){return Be(this._container).has(rp)},Ze.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ze.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function aM(e,t){var n=Be(e),i=ae(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function sM(e,t){var n=t.getPaletteEntries();return ot(n)?n(e):(A(n,function(i,r){e[r]=i}),e)}const cM={__init__:["palette"],palette:["type",Ze]};var jy="crosshair",Fy="selected",uM="djs-dragging-active-lasso";function xi(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=te("rect");Z(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),pe(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&Z(f,{x:d.x,y:d.y,width:d.width,height:d.height});var h=p.marked,g=p.lastMarked;if(h&&g){for(const _ of g)h.has(_)||t.removeMarker(_,Fy);for(const _ of h)g.has(_)||t.addMarker(_,Fy)}},remove:function(p){this.update(p),p.frame&&tt(p.frame),u(!1)}};function u(p){xe(t.getContainer()).toggle(uM,p)}function l(p){var f=i.getAll();return new Set(Ki(er(f,p)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=Hy(p),f.add=La(p),f.lastMarked=new Set(r.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=Hy(p),h=l(d),g=f.initialMarked.union(h);f.lastMarked=f.marked,f.marked=g,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(La(p))return s.activateLasso(p.originalEvent),!0})}xi.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],xi.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:jy,data:{context:{}},keepSelection:!0})},xi.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:jy,data:{context:{}},keepSelection:!0})},xi.prototype._select=function(e){this._selection.select(e)},xi.prototype.select=function(e,t,n=[]){var i=Ki(er(e,t));this._select([...n,...i])},xi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},xi.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Hy(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y},i;return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?i={x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?i={x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?i={x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?i={x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:i={x:n.x,y:n.y,width:0,height:0},i}const lM={__depends__:[Ua,oo],__init__:["lassoTool"],lassoTool:["type",xi]};var op=1500,zy="grab";function Mr(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",op,function(c){if(no(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(op,function(c){if(!(!Vy(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(op,function(c){!Vy(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!no(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Mr.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Mr.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:zy,data:{context:n||{}}})},Mr.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:zy,data:{context:{reactivate:n}}})},Mr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Mr.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Vy(e){return nt("Space",e)}const pM={__depends__:[Ua,oo],__init__:["handTool"],handTool:["type",Mr]};var Gy="connect-ok",Wy="connect-not-ok";function kr(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,p=u.canStartConnect=s.canStartConnect(l);p!==null&&(u.startTarget=l,i.addMarker(l,p?Gy:Wy))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?Gy:Wy)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(l);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,p)}),!1})}kr.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],kr.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},kr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},kr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},kr.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const fM={__depends__:[Yl,En,$n,Ua,oo],globalConnect:["type",kr]};function ap(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}ap.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],ap.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,h,g){function _(R){var x=n.createShape(D({type:p},g));t.start(R,x)}return{group:f,className:d,title:h,action:{dragstart:_,click:_}}}function u(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function l(p){t.start(p,n.createParticipantShape())}return D(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const dM={__depends__:[cM,Ga,ym,lM,pM,fM,Kr],__init__:["paletteProvider"],paletteProvider:["type",ap]};var hM=250;function sp(e,t,n,i,r){V.call(this,e);function o(s){var c=s.canExecute.replacements;A(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);D(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=Ae('[data-element-id="'+xo(f.id)+'"]',s.dragGroup);h&&Z(h,{display:"none"});var g=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=g,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;A(c,function(u,l){var p=Ae('[data-element-id="'+xo(l)+'"]',s.dragGroup);p&&Z(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",hM,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}sp.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],X(sp,V);const mM={__depends__:[yr],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",sp]};var gM=1250,cp=40,vM=20,yM=10,Uy=20,qy=["x","y"],_M=Math.abs;function Yy(e){e.on(["connect.hover","connect.move","connect.end"],gM,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Lt(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&bM(t,o,SM(o)),o&&wM(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=en(r),ge(o,["bpmn:Event","bpmn:Gateway"])&&Ky(t,en(o)),ge(o,["bpmn:Task","bpmn:SubProcess"])&&EM(t,o),y(a,"bpmn:BoundaryEvent")&&s===a.host&&xM(t)):Xy(i,"bpmn:MessageFlow")?(y(r,"bpmn:Event")&&(n.connectionStart=en(r)),y(o,"bpmn:Event")&&Ky(t,en(o))):n.connectionStart=n.initialConnectionStart)})}Yy.$inject=["eventBus"];function bM(e,t,n){qy.forEach(function(i){var r=Zy(i,t);e[i]<t[i]+n?Xe(e,i,t[i]+n):e[i]>t[i]+r-n&&Xe(e,i,t[i]+r-n)})}function EM(e,t){var n=en(t);qy.forEach(function(i){RM(e,t,i)&&Xe(e,i,n[i])})}function xM(e){var t=e.context,n=t.source,i=t.target;if(!CM(t)){var r=en(n),o=ut(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],u;_M(c-r[s])<cp&&(c>r[s]?u=r[s]+cp:u=r[s]-cp,Xe(e,s,u))})}}function Ky(e,t){Xe(e,"x",t.x),Xe(e,"y",t.y)}function Xy(e,t){return e&&e.type===t}function wM(e,t){return qn(t,function(n){return Xy(e,n)})}function Zy(e,t){return e==="x"?t.width:t.height}function SM(e){return y(e,"bpmn:Task")?yM:vM}function RM(e,t,n){return e[n]>t[n]+Uy&&e[n]<t[n]+Zy(n,t)-Uy}function CM(e){var t=e.hover,n=e.source;return t&&n&&t===n}function wi(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}wi.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},wi.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},wi.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},wi.prototype.getSnapLocations=function(){return this._snapLocations},wi.prototype.setSnapLocations=function(e){this._snapLocations=e},wi.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Qs,n.initDefaults(this._defaultSnaps)),n};function Qs(){this._snapValues={}}Qs.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},Qs.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&hA(e[n],r[n],i)},Qs.prototype.initDefaults=function(e){var t=this;A(e||{},function(n,i){A(n,function(r){t.add(i,r)})})};var PM=1250;function Rn(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],PM,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Lt(r.originalEvent))&&!(Tr(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Rn.$inject=["elementRegistry","eventBus","snapping"],Rn.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new wi);var o;t.get(i.id)?o=en(i,e):o={x:e.x+en(i).x,y:e.y+en(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),he(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},Rn.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return A(i,function(r){if(he(r)){he(t)&&e.add("mid",en(r));return}if(Te(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);A(o,function(a){e.add("mid",a)});return}e.add("mid",en(r))}),!ue(t.x)||!ue(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",en(t)),e},Rn.prototype.getSnapTargets=function(e,t){return Nv(t).filter(function(n){return!AM(n)})};function AM(e){return!!e.hidden}var Qy=1500;function Dr(e,t){t.invoke(Rn,this),e.on(["create.move","create.end"],Qy,DM),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Qy,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Tr(n)&&TM(n,o)})}X(Dr,Rn),Dr.$inject=["eventBus","injector"],Dr.prototype.initSnap=function(e){var t=Rn.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return A(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",e_(o,i,e))}),A(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",e_(o,i,e))}),y(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Dr.prototype.addSnapTargetPoints=function(e,t,n){Rn.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);A(i,function(o){(kM(o)||MM([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Lv(o)),e.add("bottom-right",Bv(o)))});var r=this._elementRegistry;return A(t.incoming,function(o){if(r.get(t.id)){Jy(i,o.source)||e.add("mid",se(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),A(t.outgoing,function(o){if(r.get(t.id)){Jy(i,o.target)||e.add("mid",se(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),y(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Dr.prototype.getSnapTargets=function(e,t){return Rn.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!y(n,"bpmn:Lane")})};function TM(e,t){var n=ie(t),i=hh(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=se(o),/top/.test(i)?Xe(e,"y",n.top-a.y):/bottom/.test(i)&&Xe(e,"y",n.bottom-a.y),/left/.test(i)?Xe(e,"x",n.left-a.x):/right/.test(i)&&Xe(e,"x",n.right-a.x)}function MM(e,t){return e.every(function(n){return y(n,t)})}function kM(e){return y(e,"bpmn:SubProcess")&&Ee(e)?!0:y(e,"bpmn:Participant")}function DM(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,r=n.right,o=n.bottom,a=n.left;(a&&a>=e.x||r&&r<=e.x)&&Xe(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Xe(e,"y",e.y)}}function Jy(e,t){return e.indexOf(t)!==-1}function e_(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var OM=1250;function $o(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],OM,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Lt(i.originalEvent))&&!Tr(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),BM(s)&&Xe(i,"x",i.x),NM(s)&&Xe(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}$o.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new wi);var o=t_(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},$o.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return A(r,function(o){e.add("corner",Bv(o)),e.add("corner",Lv(o))}),e.add("corner",t_(t,i)),e},$o.$inject=["eventBus","snapping"],$o.prototype.getSnapTargets=function(e,t){return Nv(t).filter(function(n){return!IM(n,e)&&!Te(n)&&!LM(n)&&!he(n)})};function t_(e,t){var n=se(e),i=ie(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function IM(e,t){return e.host===t}function LM(e){return!!e.hidden}function BM(e){return e==="n"||e==="s"}function NM(e){return e==="e"||e==="w"}var $M=7,jM=1e3;function Si(e){this._canvas=e,this._asyncHide=ac(Ct(this.hide,this),jM)}Si.$inject=["canvas"],Si.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Tr(e,"x"),y:Tr(e,"y")};A(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(A(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,$M),l!==void 0&&(o[u]={value:l,originValue:l-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),A(["x","y"],function(a){var s=o[a];rt(s)&&Xe(e,a,s.originValue)})},Si.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=te("path");return Z(n,{d:"M0,0 L0,0"}),xe(n).add("djs-snap-line"),pe(t,n),{update:function(i){ue(i)?e==="horizontal"?Z(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Z(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Z(n,{display:"none"})}}},Si.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Si.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Si.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Si.prototype.hide=function(){A(this._snapLines,function(e){e.update()})};const FM={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Rn],resizeSnapping:["type",$o],snapping:["type",Si]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Yy],createMoveSnapping:["type",Dr]};var n_=300;function fe(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=Ae(fe.INPUT_SELECTOR,this._container),this._resultsContainer=Ae(fe.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}fe.$inject=["canvas","eventBus","selection","translate"],fe.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Dt.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,fe.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,fe.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,fe.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,fe.INPUT_SELECTOR,"keydown",function(n){nt("ArrowUp",n)&&n.preventDefault(),nt("ArrowDown",n)&&n.preventDefault()}),t(this._container,fe.INPUT_SELECTOR,"keyup",function(n){if(nt("Escape",n))return e.close();if(nt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(nt("ArrowUp",n))return e._scrollToDirection(!0);if(nt("ArrowDown",n))return e._scrollToDirection();nt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},fe.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Dt.unbind(e.el,e.type,e.listener)})},fe.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=Ae(fe.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},fe.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},fe.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},fe.prototype._clearResults=function(){Xo(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},fe.prototype._getCurrentResult=function(){return Ae(fe.RESULT_SELECTED_SELECTOR,this._resultsContainer)},fe.prototype._createResultNode=function(e,t){var n=Ie(fe.RESULT_HTML);return e.primaryTokens.length>0&&i_(n,e.primaryTokens,fe.RESULT_PRIMARY_HTML),i_(n,e.secondaryTokens,fe.RESULT_SECONDARY_HTML),_t(n,fe.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},fe.prototype.registerProvider=function(e){this._searchProvider=e},fe.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,Be(this._canvas.getContainer()).add("djs-search-open"),Be(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},fe.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,Be(this._canvas.getContainer()).remove("djs-search-open"),Be(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},fe.prototype.toggle=function(){this.isOpen()?this.close():this.open()},fe.prototype.isOpen=function(){return this._open},fe.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Be(t).remove(fe.RESULT_SELECTED_CLASS);var n=_t(e,fe.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Be(e).add(fe.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:n_}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},fe.prototype._select=function(e){var t=_t(e,fe.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:n_}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},fe.prototype._getBoxHtml=function(){const e=Ie(fe.BOX_HTML),t=Ae(fe.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function i_(e,t,n){var i=HM(t),r=Ie(n);r.innerHTML=i,e.appendChild(r)}function HM(e){var t="";return e.forEach(function(n){var i=pg(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+fe.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}fe.CONTAINER_SELECTOR=".djs-search-container",fe.INPUT_SELECTOR=".djs-search-input input",fe.RESULTS_CONTAINER_SELECTOR=".djs-search-results",fe.RESULT_SELECTOR=".djs-search-result",fe.RESULT_SELECTED_CLASS="djs-search-result-selected",fe.RESULT_SELECTED_SELECTOR="."+fe.RESULT_SELECTED_CLASS,fe.RESULT_ID_ATTRIBUTE="data-result-id",fe.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",fe.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
+ </svg>`},X2=900;function za(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",X2,this)}za.$inject=["popupMenu","distributeElements","translate","rules"],za.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&O(t,this._getEntries(e)),t},za.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},za.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:pb.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:pb.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const Z2={__depends__:[mf,K2],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ou],distributeElementsMenuProvider:["type",za]};var fb="is not a registered action",Q2="is already registered";function ei(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}ei.$inject=["eventBus","injector"],ei.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l});if(p!==!1){var f=_e(p)?p:l;return o.cut(f.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var p=s.allowed("elements.delete",{elements:l}),f;p!==!1&&(_e(p)?f=p:f=l,f.length&&n.removeElements(f.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},ei.prototype.trigger=function(e,t){if(!this._actions[e])throw Rf(e,fb);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},ei.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);k(e,function(i,r){n._registerAction(r,i)})},ei.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Rf(e,Q2);this._actions[e]=t},ei.prototype.unregister=function(e){if(!this.isRegistered(e))throw Rf(e,fb);this._actions[e]=void 0},ei.prototype.getActions=function(){return Object.keys(this._actions)},ei.prototype.isRegistered=function(e){return!!this._actions[e]};function Rf(e,t){return new Error(e+" "+t)}const J2={__init__:["editorActions"],editorActions:["type",ei]};function au(e){e.invoke(ei,this)}ae(au,ei),au.$inject=["injector"],au.prototype._registerDefaultActions=function(e){ei.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),p=e.get("searchPad",!1),f=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var h=t.getRootElement(),m=n.filter(function(g){return g!==h});return i.select(m),m}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(h){var m=i.get(),g=h.type;m.length&&c.trigger(m,g)}),i&&u&&this._registerAction("alignElements",function(h){var m=i.get(),g=[],R=h.type;m.length&&(g=Ie(m,function(w){return!v(w,"bpmn:Lane")}),u.trigger(g,R))}),i&&f&&this._registerAction("setColor",function(h){var m=i.get();m.length&&f.setColor(m,h)}),i&&l&&this._registerAction("directEditing",function(){var h=i.get();h.length&&l.activate(h[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var h=t.getRootElement(),m,g;v(h,"bpmn:Collaboration")?g=n.filter(function(R){return v(R.parent,"bpmn:Collaboration")}):g=n.filter(function(R){return R!==h&&!v(R.parent,"bpmn:SubProcess")}),m=At(g),f.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const ek={__depends__:[J2],editorActions:["type",au]};function db(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Le(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}db.$inject=["eventBus"];function qr(e,t){K.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;wn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}qr.$inject=["eventBus","gridSnapping","modeling"],ae(qr,K),qr.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},qr.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},qr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),O(e,o),e},qr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),O(e,o),e};var tk=2e3;function hb(e,t){e.on(["spaceTool.move","spaceTool.end"],tk,function(n){var i=n.context;if(i.initialized){var r=i.axis,o;r==="x"?(o=t.snapValue(n.dx),n.x=n.x+o-n.dx,n.dx=o):(o=t.snapValue(n.dy),n.y=n.y+o-n.dy,n.dy=o)}})}hb.$inject=["eventBus","gridSnapping"];const nk={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",qr],gridSnappingSpaceToolBehavior:["type",hb]};var su=10;function Cf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var ik=1200,rk=800;function _r(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",rk,function(){r.setActive(i)}),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],ik,function(o){var a=o.originalEvent;if(!(!r.active||a&&Tn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=ak(o,u,e);p&&(l.offset=p);var f=ok(o,u);f&&O(l,f),No(o,u)||r.snapEvent(o,u,l)})}})}_r.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Dt(e,t,i)},_r.prototype.getGridSpacing=function(){return su},_r.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Cf(e,su);var i,r;return t&&t.min&&(i=t.min,Ee(i)&&(i=Cf(i+n,su,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Ee(r)&&(r=Cf(r+n,su,"floor"),e=Math.min(e,r))),e-=n,e},_r.prototype.isActive=function(){return this.active},_r.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},_r.prototype.toggleActive=function(){this.setActive(!this.active)},_r.$inject=["elementRegistry","eventBus","config.gridSnapping"];function ok(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(cu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,u=r.max;return c&&(cu(t)?gb(s)?a.x.max=c.left:a.x.min=c.right:mb(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(cu(t)?gb(s)?a.x.min=u.left:a.x.max=u.right:mb(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function ak(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Ee(s[t])||(s||(s=o.snapOffset={}),Ee(s[t])||(s[t]=0),!r)||(n.get(r.id)||(cu(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function cu(e){return e==="x"}function mb(e){return e.indexOf("n")!==-1}function gb(e){return e.indexOf("w")!==-1}const sk={__depends__:[nk],__init__:["gridSnapping"],gridSnapping:["type",_r]};var ck=2e3;function yb(e,t,n){e.on("autoPlace",ck,function(i){var r=i.source,o=be(r),a=i.shape,s=gv(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],v(a,"bpmn:TextAnnotation")&&(uk(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}yb.$inject=["eventBus","gridSnapping","elementRegistry"];function uk(e){return e==="x"}var lk=1750;function vb(e,t,n){t.on(["create.start","shape.move.start"],lk,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!v(o,"bpmn:Participant")||!v(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}vb.$inject=["canvas","eventBus","gridSnapping"];var pk=3e3;function uu(e,t,n){K.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],pk,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||fk(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}uu.$inject=["eventBus","gridSnapping","modeling"],ae(uu,K),uu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=mk(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function fk(e){return e.length>3}function dk(e){return e==="h"}function hk(e){return e==="v"}function mk(e,t,n){var i=Ti(t,n),r={};return dk(i)&&(r.y=e.snapValue(t.y)),hk(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=O({},t,r),n=O({},n,r)),[t,n]}const gk={__depends__:[sk,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",yb],gridSnappingParticipantBehavior:["type",vb],gridSnappingLayoutConnectionBehavior:["type",uu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",db]};var yk=30,_b=30;function Va(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(v(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(v(r,"bpmn:Participant"))return Fe(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(v(r,"bpmn:SubProcess"))return Fe(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Va.$inject=["eventBus","interactionEvents"],Va.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Va.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=Ut(e)?{width:yk,height:e.height}:{width:e.width,height:_b};return this._interactionEvents.createBoxHit(t,"all",n),!0},Va.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:_b}),!0};const vk={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Va]};function lu(e){e.invoke(To,this)}ae(lu,To),lu.$inject=["injector"],lu.prototype.registerBindings=function(e,t){To.prototype.registerBindings.call(this,e,t);function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("selectElements",function(i){var r=i.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0}),n("find",function(i){var r=i.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0}),n("spaceTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["s","S"],r))return t.trigger("spaceTool"),!0}),n("lassoTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["l","L"],r))return t.trigger("lassoTool"),!0}),n("handTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["h","H"],r))return t.trigger("handTool"),!0}),n("globalConnectTool",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["c","C"],r))return t.trigger("globalConnectTool"),!0}),n("directEditing",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["e","E"],r))return t.trigger("directEditing"),!0}),n("replaceElement",function(i){var r=i.keyEvent;if(!e.hasModifier(r)&&e.isKey(["r","R"],r))return t.trigger("replaceElement",r),!0})};const _k={__depends__:[Jp],__init__:["keyboardBindings"],keyboardBindings:["type",lu]};var bk={moveSpeed:1,moveSpeedAccelerated:10},xk=1500,bb="left",xb="up",wb="right",Eb="down",wk={ArrowLeft:bb,Left:bb,ArrowUp:xb,Up:xb,ArrowRight:wb,Right:wb,ArrowDown:Eb,Down:Eb},Ek={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function Sb(e,t,n,i,r){var o=this;this._config=O({},bk,e||{}),t.addListener(xk,function(a){var s=a.keyEvent,c=wk[s.key];if(c&&!t.isCmd(s)){var u=t.isShift(s);return o.moveSelection(c,u),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var u=this._config[s?"moveSpeedAccelerated":"moveSpeed"],l=Ek[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}Sb.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const Sk={__depends__:[Jp,Kn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Sb]};var Rb=10;function Ga(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,p=c.direction,f=c.resizeConstraints,d;c.delta=u,d=bR(l,p,u),c.newBounds=wR(d,f),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:ge(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=zh(p),!Rk(u,p))return;n.resizeShape(u,p)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}Ga.prototype.canResize=function(e){var t=this._rules,n=ii(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ga.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=O({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,Cb(t,o),"resize",{autoActivate:!0,cursor:Ck(o),data:{shape:t,context:r}})},Ga.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:Rb,height:Rb},r=Tm(t,e.childrenBoxPadding),ER(n,t,i,r)},Ga.$inject=["eventBus","rules","modeling","dragging"];function Rk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Cb(e,t){var n=be(e),i=ge(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function Ck(e){var t="resize-";return e==="n"||e==="s"?t+"ns":e==="e"||e==="w"?t+"ew":e==="nw"||e==="se"?t+"nwse":t+"nesw"}var Pb="djs-resizing",Ab="resize-not-ok",Pk=500;function Tb(e,t,n){function i(o){var a=o.shape,s=o.newBounds,c=o.frame;c||(c=o.frame=n.addFrame(a,t.getActiveLayer()),t.addMarker(a,Pb)),s.width>5&&se(c,{x:s.x,width:s.width}),s.height>5&&se(c,{y:s.y,height:s.height}),o.canExecute?He(c).remove(Ab):He(c).add(Ab)}function r(o){var a=o.shape,s=o.frame;s&&Ht(o.frame),t.removeMarker(a,Pb)}e.on("resize.move",Pk,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Tb.$inject=["eventBus","canvas","previewSupport"];var pu=-6,fu=8,du=20,Wa="djs-resizer",Ak=["n","w","s","e","nw","ne","se","sw"];function br(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&k(a,_n(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}br.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){cr(o)&&i.activate(o,e,n)}Re.bind(t,"mousedown",r),Re.bind(t,"touchstart",r)},br.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=Tk(i),a=he("g");He(a).add(Wa),He(a).add(Wa+"-"+e.id),He(a).add(Wa+"-"+i),Ce(r,a);var s=he("rect");se(s,{x:-fu/2+o.x,y:-fu/2+o.y,width:fu,height:fu}),He(s).add(Wa+"-visual"),Ce(a,s);var c=he("rect");return se(c,{x:-du/2+o.x,y:-du/2+o.y,width:du,height:du}),He(c).add(Wa+"-hit"),Ce(a,c),Ps(a,t,n),a},br.prototype.createResizer=function(e,t){var n=Cb(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},br.prototype.addResizer=function(e){var t=this;rt(e)||k(Ak,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},br.prototype.removeResizers=function(){var e=this._getResizersParent();vs(e)},br.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},br.$inject=["eventBus","canvas","selection","resize"];function Tk(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-pu:e.indexOf("w")!==-1&&(t.x=pu),e.indexOf("s")!==-1?t.y=-pu:e.indexOf("n")!==-1&&(t.y=pu),t}const Mb={__depends__:[yi,Ii,Co],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ga],resizePreview:["type",Tb],resizeHandles:["type",br]};var Mk=2e3;function Ua(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],Mk,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,p=c.context.canExecute,f=c.isTouch;f||p&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||Le(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ua.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ua.prototype.activate=function(e){var t=Hn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);O(n,i);var r={},o=n.style||{};return O(o,{backgroundColor:null,border:null}),(Le(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||kb(e))&&O(r,{centerVertically:!0}),rr(e)&&(O(r,{resizable:!0,autoResize:!0}),O(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),v(e,"bpmn:TextAnnotation")&&(O(r,{resizable:!0,autoResize:!0}),O(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),O(n,{options:r,style:o}),n}},Ua.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(v(e,"bpmn:Lane")||Ok(e)){var h=Ut(e),m=h?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};O(o,m),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(Dk(e)){var g=Ut(e),R=g?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};O(o,R),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Le(e,["bpmn:Task","bpmn:CallActivity"])||kb(e))&&(O(o,{width:i.width,height:i.height}),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),kk(e)&&(O(o,{width:i.width,x:i.x}),O(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var w=1,b=i.width+2*w;if(n.labelTarget&&(O(o,{width:b,height:i.height+2*w,x:i.x-w,y:i.y-w}),O(d,{fontSize:u+"px",lineHeight:l})),rr(n)&&!Ms(n)&&!De(n)){var x=dl(e),S=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),M=u,I=Nr.width*a+2*w;O(o,{width:I,height:M+2*w,x:S.x-I/2,y:S.y-M/2-w}),O(d,{fontSize:u+"px",lineHeight:l})}return v(e,"bpmn:TextAnnotation")&&(O(o,{width:i.width+2*w,height:i.height+2*w,x:i.x-w,y:i.y-w,minWidth:30*a,minHeight:10*a}),O(d,{textAlign:"left",paddingTop:fo*a+"px",paddingBottom:fo*a+"px",paddingLeft:fo*a+"px",paddingRight:fo*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Ua.prototype.update=function(e,t,n,i){var r,o;v(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),Lk(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function kb(e){return v(e,"bpmn:SubProcess")&&!Fe(e)}function kk(e){return v(e,"bpmn:SubProcess")&&Fe(e)}function Dk(e){return v(e,"bpmn:Participant")&&!Fe(e)}function Ok(e){return v(e,"bpmn:Participant")&&Fe(e)}function Lk(e){return!e||!e.trim()}var Db="djs-element-hidden",Ob="djs-label-hidden";function Lb(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,v(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=he("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=he("path");se(p,{d:l,strokeWidth:2,stroke:Ik(o)}),Ce(s,p),Ce(r,s),Jt(s,o.x,o.y)}v(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Db):(v(o,"bpmn:Task")||v(o,"bpmn:CallActivity")||v(o,"bpmn:SubProcess")||v(o,"bpmn:Participant")||v(o,"bpmn:Lane"))&&t.addMarker(o,Ob)}),e.on("directEditing.resize",function(c){if(v(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,p=Math.max(o.height/a.height*(u+l),0),f=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:p,position:{mx:0,my:0}});se(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,Db),t.removeMarker(o,Ob)),o=void 0,a=void 0,s&&(Ht(s),s=void 0)})}Lb.$inject=["eventBus","canvas","pathMap"];function Ik(e,t){var n=Ge(e);return n.get("stroke")||t||"black"}const Nk={__depends__:[kp,Mb,ob],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ua],labelEditingPreview:["type",Lb]};var Bk=500,$k=1e3;function bi(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){w1(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){k(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],Bk,function(o){var a=o.element,s=o.gfx,c=nt(".djs-outline",s);c&&i.updateOutline(a,c)})}bi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=nt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Ce(t,n),this.updateOutline(e,n)),n},bi.prototype._createOutlineGfx=function(){var e=he("rect");return se(e,O({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},bi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},bi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&k(i,function(r){n=n||r.updateOutline(t,e)}),n||se(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},bi.prototype.updateConnectionOutline=function(e,t){var n=At(t);se(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},bi.prototype.registerProvider=function(e,t){t||(t=e,e=$k),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},bi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},bi.prototype.getOutline=function(e){var t,n=this._getProviders();return k(n,function(i){Wt(i.getOutline)&&(t=t||i.getOutline(e))}),t},bi.$inject=["eventBus","styles","elementRegistry"];var hu=6;function Pf(e,t,n){this._canvas=t;var i=this;e.on("element.changed",function(r){n.isSelected(r.element)&&i._updateMultiSelectionOutline(n.get())}),e.on("selection.changed",function(r){var o=r.newSelection;i._updateMultiSelectionOutline(o)})}Pf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");vs(t);var n=e.length>1,i=this._canvas.getContainer();if(He(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=jk(At(e)),o=he("rect");se(o,O({rx:3},r)),He(o).add("djs-selection-outline"),Ce(t,o)}},Pf.$inject=["eventBus","canvas","selection"];function jk(e){return{x:e.x-hu,y:e.y-hu,width:e.width+hu*2,height:e.height+hu*2}}const Af={__depends__:[Kn],__init__:["outline","multiSelectionOutline"],outline:["type",bi],multiSelectionOutline:["type",Pf]},Ib=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Nb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},Fk=15,mu=2;function Bb(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:p}){var d;const f=p.filter(h=>Le(h,Ib));if(f.length===1){const h=f[0];De(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(De),m=f.find(g=>{var R;return(R=g.labels)==null?void 0:R.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!Le(p,Ib)||!l(p)||(De(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=Ko([be(f),be(p)],Nb),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),R=Jo(g,h);if(!R)return;const b=r.isSelected(f)?c(f):u(f),x=Jo(b,h)||be(f);ua(x,R)<Fk||(ol(d,[x,R]),Ce(o,d))}function s(){ys(`.${Nb.class}`,o).forEach(Ht)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+xr(f,"x")-mu,y:p.y+xr(f,"y")-mu,width:xr(f,"width")+mu*2,height:xr(f,"height")+mu*2};return ml(d,xr(f,"rx"))}if(f.cx){const d=xr(f,"r"),h={x:p.x+xr(f,"cx")-d,y:p.y+xr(f,"cy")-d,width:d*2,height:d*2};return fm(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}Bb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function xr(e,t){return parseFloat(se(e,t)||0)}const Hk={__depends__:[Kn,Af],__init__:["labelLink"],labelLink:["type",Bb]};var zk=new Ro("tt");function Vk(e){var t=ut('<div class="djs-tooltip-container" />');return gn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function Gk(e,t,n){gn(e,{left:t+"px",top:n+"px"})}function Tf(e,t){e.style.display=t===!1?"none":""}var $b="djs-tooltip",Mf="."+$b;function xn(e,t){this._eventBus=e,this._canvas=t,this._ids=zk,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=Vk(t.getContainer());var n=this;Cn.bind(this._tooltipRoot,Mf,"mousedown",function(i){i.stopPropagation()}),Cn.bind(this._tooltipRoot,Mf,"mouseover",function(i){n.trigger("mouseover",i)}),Cn.bind(this._tooltipRoot,Mf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}xn.$inject=["eventBus","canvas"],xn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=O({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},xn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(sn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},xn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},xn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},xn.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},xn.prototype.remove=function(e){var t=this.get(e);t&&(pi(t.html),pi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},xn.prototype.show=function(){Tf(this._tooltipRoot)},xn.prototype.hide=function(){Tf(this._tooltipRoot,!1)},xn.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},xn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),wn(n)&&(n=ut(n)),i=ut('<div data-tooltip-id="'+t+'" class="'+$b+'">'),gn(i,{position:"absolute"}),i.appendChild(n),e.type&&gt(i).add("djs-tooltip-"+e.type),e.className&&gt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},xn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;Gk(n,t.x,t.y)},xn.prototype._updateTooltipVisibilty=function(e){k(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Tf(i,r))})},xn.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const Wk={__init__:["tooltips"],tooltips:["type",xn]};var Uk="flow elements must be children of pools/participants",Yk="Data object must be placed within a pool/participant.";function jb(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;v(s,"bpmn:Collaboration")&&(v(a,"bpmn:FlowNode")?i(r,n(Uk)):v(a,"bpmn:DataObjectReference")&&i(r,n(Yk)))})}jb.$inject=["eventBus","tooltips","translate"];const qk={__depends__:[Wk],__init__:["modelingFeedback"],modelingFeedback:["type",jb]};var Kk=500,Xk=1250,Zk=1500,gu=Math.round;function Qk(e){return{x:e.x+gu(e.width/2),y:e.y+gu(e.height/2)}}function Fb(e,t,n,i,r){function o(s,c,u,l){return r.allowed("elements.move",{shapes:s,delta:c,position:u,target:l})}e.on("shape.move.start",Zk,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=Jk(l),O(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",Xk,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",Kk,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,p={x:s.dx,y:s.dy},f={x:s.x,y:s.y},d;if(d=o(u,p,f,l),c.delta=p,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,p=l==="attach",f=c.shapes;if(l===!1)return!1;u.x=gu(u.x),u.y=gu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(f,u,c.target,{primaryShape:c.shape,attach:p})}),e.on("element.mousedown",function(s){if(cr(s)){var c=xo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Gt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!He(s.target).has("djs-hit-no-move")){var p=Qk(c),f=t.init(s,p,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(f!==!1)return!0}}this.start=a}Fb.$inject=["eventBus","dragging","modeling","selection","rules"];function Jk(e){var t=Jr(e,"id");return Ie(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Hb=499,kf="djs-dragging",zb="drop-ok",Vb="drop-not-ok",Gb="new-parent",Wb="attach-ok";function Ub(e,t,n,i){function r(c){var u=o(c),l=eD(u);return l}function o(c){var u=Xo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[Wb,zb,Vb,Gb].forEach(function(l){l===u?t.addMarker(c,l):t.removeMarker(c,l)})}function s(c,u,l){i.addDragger(u,c.dragGroup),l&&t.addMarker(u,kf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",Hb,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=he("g");se(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();Ce(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=Ru([p,o(l)]):p=o(l),k(p,function(m){t.addMarker(m,kf)}),u.allDraggedElements=p,u.differentParents=tD(l)}),e.on("shape.move.move",Hb,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,Wb):u.canExecute&&f&&p.id!==f.id?a(p,Gb):a(p,u.canExecute?zb:Vb)),Jt(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,p=u.dragGroup;k(l,function(f){t.removeMarker(f,kf)}),p&&Ht(p)}),this.makeDraggable=s}Ub.$inject=["eventBus","canvas","styles","previewSupport"];function eD(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ie(e,function(i){return rt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function tD(e){return t0(Jr(e,function(t){return t.parent&&t.parent.id}))!==1}const nD={__depends__:[sc,Kn,Af,yi,Ii,Co],__init__:["move","movePreview"],move:["type",Fb],movePreview:["type",Ub]};var Yb=".djs-palette-toggle",qb=".entry",iD=Yb+", "+qb,Df="djs-palette-",rD="shown",Of="open",Kb="two-column",oD=1e3;function Ot(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var r=i.tool;n.updateToolHighlight(r)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}Ot.$inject=["eventBus","canvas"],Ot.prototype.registerProvider=function(e,t){t||(t=e,e=oD),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Ot.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(sD,{})},Ot.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Ot.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=ut(Ot.HTML_MARKUP);n.appendChild(i),gt(n).add(Df+rD),Cn.bind(i,iD,"click",function(r){var o=r.delegateTarget;if(Xu(o,Yb))return e.toggle();e.trigger("click",r)}),Re.bind(i,"mousedown",function(r){r.stopPropagation()}),Cn.bind(i,qb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Ot.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ot.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=gt(n),a=gt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Kb,r),a.toggle(Df+Kb,r),"open"in e&&(o.toggle(Of,e.open),a.toggle(Df+Of,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Ot.prototype._update=function(){var e=nt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ms(e),k(t,function(n,i){var r=n.group||"default",o=nt("[data-group="+ka(r)+"]",e);o||(o=ut('<div class="group"></div>'),sn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ut(a);if(o.appendChild(s),!n.separator&&(sn(s,"data-action",i),n.title&&sn(s,"title",n.title),n.className&&aD(s,n.className),n.imageUrl)){var c=ut("<img>");sn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Ot.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=sn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Ot.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(Wt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Ot.prototype._layoutChanged=function(){this._toggleState({})},Ot.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Ot.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ot.prototype.open=function(){this._toggleState({open:!0})},Ot.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ot.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ot.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=nt(".djs-palette-entries",this._container),this._toolsContainer=nt("[data-group=tools]",t)),n=this._toolsContainer,k(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=gt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Ot.prototype.isOpen=function(){return gt(this._container).has(Of)},Ot.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ot.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function aD(e,t){var n=gt(e),i=_e(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function sD(e,t){var n=t.getPaletteEntries();return Wt(n)?n(e):(k(n,function(i,r){e[r]=i}),e)}const cD={__init__:["palette"],palette:["type",Ot]};var Xb="crosshair",Zb="selected",uD="djs-dragging-active-lasso";function wr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=he("rect");se(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Ce(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&se(f,{x:d.x,y:d.y,width:d.width,height:d.height});var h=p.marked,m=p.lastMarked;if(h&&m){for(const g of m)h.has(g)||t.removeMarker(g,Zb);for(const g of h)m.has(g)||t.addMarker(g,Zb)}},remove:function(p){this.update(p),p.frame&&Ht(p.frame),u(!1)}};function u(p){He(t.getContainer()).toggle(uD,p)}function l(p){var f=i.getAll();return new Set(Qr(so(f,p)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(p){var f=p.originalEvent.target;!p.hover&&!(f instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(p.originalEvent,!0)})}),e.on("lasso.end",0,function(p){var f=p.context;s._select(Array.from(f.marked))}),e.on("lasso.start",function(p){var f=p.context;f.bbox=Qb(p),f.add=ec(p),f.lastMarked=new Set(r.get()),f.add?f.marked=f.lastMarked:f.marked=new Set,f.initialMarked=f.marked,c.create(f)}),e.on("lasso.move",function(p){var f=p.context,d=f.bbox=Qb(p),h=l(d),m=f.initialMarked.union(h);f.lastMarked=f.marked,f.marked=m,c.update(f)}),e.on("lasso.cleanup",function(p){var f=p.context;f.lastMarked=f.marked,f.marked=new Set(r.get()),c.remove(p.context)}),e.on("element.mousedown",1500,function(p){if(ec(p))return s.activateLasso(p.originalEvent),!0})}wr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],wr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Xb,data:{context:{}},keepSelection:!0})},wr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Xb,data:{context:{}},keepSelection:!0})},wr.prototype._select=function(e){this._selection.select(e)},wr.prototype.select=function(e,t,n=[]){var i=Qr(so(e,t));this._select([...n,...i])},wr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},wr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Qb(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y},i;return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?i={x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?i={x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?i={x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?i={x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:i={x:n.x,y:n.y,width:0,height:0},i}const lD={__depends__:[pc,ma],__init__:["lassoTool"],lassoTool:["type",wr]};var Lf=1500,Jb="grab";function Bo(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Lf,function(c){if(fa(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Lf,function(c){if(!(!ex(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Lf,function(c){!ex(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!fa(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Bo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Bo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Jb,data:{context:n||{}}})},Bo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Jb,data:{context:{reactivate:n}}})},Bo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Bo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function ex(e){return zt("Space",e)}const pD={__depends__:[pc,ma],__init__:["handTool"],handTool:["type",Bo]};var tx="connect-ok",nx="connect-not-ok";function $o(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,p=u.canStartConnect=s.canStartConnect(l);p!==null&&(u.startTarget=l,i.addMarker(l,p?tx:nx))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?tx:nx)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,p={x:c.x,y:c.y},f=s.canStartConnect(l);if(f)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,p)}),!1})}$o.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],$o.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},$o.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},$o.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},$o.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const fD={__depends__:[Ef,yi,Ii,pc,ma],globalConnect:["type",$o]};function If(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}If.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],If.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(p,f,d,h,m){function g(R){var w=n.createShape(O({type:p},m));t.start(R,w)}return{group:f,className:d,title:h,action:{dragstart:g,click:g}}}function u(p){var f=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:f});t.start(p,[f,d],{hints:{autoSelect:[f]}})}function l(p){t.start(p,n.createParticipantShape())}return O(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const dD={__depends__:[cD,uc,My,lD,pD,fD,oa],__init__:["paletteProvider"],paletteProvider:["type",If]};var hD=250;function Nf(e,t,n,i,r){K.call(this,e);function o(s){var c=s.canExecute.replacements;k(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);O(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=nt('[data-element-id="'+ka(f.id)+'"]',s.dragGroup);h&&se(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;k(c,function(u,l){var p=nt('[data-element-id="'+ka(l)+'"]',s.dragGroup);p&&se(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",hD,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}Nf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ae(Nf,K);const mD={__depends__:[Co],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Nf]};var gD=1250,Bf=40,yD=20,vD=10,ix=20,rx=["x","y"],_D=Math.abs;function ox(e){e.on(["connect.hover","connect.move","connect.end"],gD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Tn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&bD(t,o,SD(o)),o&&ED(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Qn(r),Le(o,["bpmn:Event","bpmn:Gateway"])&&ax(t,Qn(o)),Le(o,["bpmn:Task","bpmn:SubProcess"])&&xD(t,o),v(a,"bpmn:BoundaryEvent")&&s===a.host&&wD(t)):sx(i,"bpmn:MessageFlow")?(v(r,"bpmn:Event")&&(n.connectionStart=Qn(r)),v(o,"bpmn:Event")&&ax(t,Qn(o))):n.connectionStart=n.initialConnectionStart)})}ox.$inject=["eventBus"];function bD(e,t,n){rx.forEach(function(i){var r=cx(i,t);e[i]<t[i]+n?Dt(e,i,t[i]+n):e[i]>t[i]+r-n&&Dt(e,i,t[i]+r-n)})}function xD(e,t){var n=Qn(t);rx.forEach(function(i){RD(e,t,i)&&Dt(e,i,n[i])})}function wD(e){var t=e.context,n=t.source,i=t.target;if(!CD(t)){var r=Qn(n),o=Qt(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],u;_D(c-r[s])<Bf&&(c>r[s]?u=r[s]+Bf:u=r[s]-Bf,Dt(e,s,u))})}}function ax(e,t){Dt(e,"x",t.x),Dt(e,"y",t.y)}function sx(e,t){return e&&e.type===t}function ED(e,t){return Wi(t,function(n){return sx(e,n)})}function cx(e,t){return e==="x"?t.width:t.height}function SD(e){return v(e,"bpmn:Task")?vD:yD}function RD(e,t,n){return e[n]>t[n]+ix&&e[n]<t[n]+cx(n,t)-ix}function CD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Er(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Er.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Er.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Er.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Er.prototype.getSnapLocations=function(){return this._snapLocations},Er.prototype.setSnapLocations=function(e){this._snapLocations=e},Er.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new yu,n.initDefaults(this._defaultSnaps)),n};function yu(){this._snapValues={}}yu.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},yu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&h2(e[n],r[n],i)},yu.prototype.initDefaults=function(e){var t=this;k(e||{},function(n,i){k(n,function(r){t.add(i,r)})})};var PD=1250;function xi(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(r){i.initSnap(r)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],PD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Tn(r.originalEvent))&&!(No(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}xi.$inject=["elementRegistry","eventBus","snapping"],xi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Er);var o;t.get(i.id)?o=Qn(i,e):o={x:e.x+Qn(i).x,y:e.y+Qn(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),De(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},xi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return k(i,function(r){if(De(r)){De(t)&&e.add("mid",Qn(r));return}if(rt(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);k(o,function(a){e.add("mid",a)});return}e.add("mid",Qn(r))}),!Ee(t.x)||!Ee(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Qn(t)),e},xi.prototype.getSnapTargets=function(e,t){return q_(t).filter(function(n){return!AD(n)})};function AD(e){return!!e.hidden}var ux=1500;function jo(e,t){t.invoke(xi,this),e.on(["create.move","create.end"],ux,DD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],ux,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!No(n)&&TD(n,o)})}ae(jo,xi),jo.$inject=["eventBus","injector"],jo.prototype.initSnap=function(e){var t=xi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return k(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",px(o,i,e))}),k(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",px(o,i,e))}),v(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},jo.prototype.addSnapTargetPoints=function(e,t,n){xi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);k(i,function(o){(kD(o)||MD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",U_(o)),e.add("bottom-right",Y_(o)))});var r=this._elementRegistry;return k(t.incoming,function(o){if(r.get(t.id)){lx(i,o.source)||e.add("mid",be(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),k(t.outgoing,function(o){if(r.get(t.id)){lx(i,o.target)||e.add("mid",be(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),v(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},jo.prototype.getSnapTargets=function(e,t){return xi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!v(n,"bpmn:Lane")})};function TD(e,t){var n=ge(t),i=Cg(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=be(o),/top/.test(i)?Dt(e,"y",n.top-a.y):/bottom/.test(i)&&Dt(e,"y",n.bottom-a.y),/left/.test(i)?Dt(e,"x",n.left-a.x):/right/.test(i)&&Dt(e,"x",n.right-a.x)}function MD(e,t){return e.every(function(n){return v(n,t)})}function kD(e){return v(e,"bpmn:SubProcess")&&Fe(e)?!0:v(e,"bpmn:Participant")}function DD(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,r=n.right,o=n.bottom,a=n.left;(a&&a>=e.x||r&&r<=e.x)&&Dt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Dt(e,"y",e.y)}}function lx(e,t){return e.indexOf(t)!==-1}function px(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var OD=1250;function Ya(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],OD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Tn(i.originalEvent))&&!No(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),ND(s)&&Dt(i,"x",i.x),BD(s)&&Dt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ya.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Er);var o=fx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ya.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return k(r,function(o){e.add("corner",Y_(o)),e.add("corner",U_(o))}),e.add("corner",fx(t,i)),e},Ya.$inject=["eventBus","snapping"],Ya.prototype.getSnapTargets=function(e,t){return q_(t).filter(function(n){return!LD(n,e)&&!rt(n)&&!ID(n)&&!De(n)})};function fx(e,t){var n=be(e),i=ge(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function LD(e,t){return e.host===t}function ID(e){return!!e.hidden}function ND(e){return e==="n"||e==="s"}function BD(e){return e==="e"||e==="w"}var $D=7,jD=1e3;function Sr(e){this._canvas=e,this._asyncHide=Pu(_n(this.hide,this),jD)}Sr.$inject=["canvas"],Sr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:No(e,"x"),y:No(e,"y")};k(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(k(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,$D),l!==void 0&&(o[u]={value:l,originValue:l-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),k(["x","y"],function(a){var s=o[a];Gt(s)&&Dt(e,a,s.originValue)})},Sr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=he("path");return se(n,{d:"M0,0 L0,0"}),He(n).add("djs-snap-line"),Ce(t,n),{update:function(i){Ee(i)?e==="horizontal"?se(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):se(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):se(n,{display:"none"})}}},Sr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Sr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Sr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Sr.prototype.hide=function(){k(this._snapLines,function(e){e.update()})};const FD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",xi],resizeSnapping:["type",Ya],snapping:["type",Sr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",ox],createMoveSnapping:["type",jo]};var dx=300;function Pe(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=nt(Pe.INPUT_SELECTOR,this._container),this._resultsContainer=nt(Pe.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Pe.$inject=["canvas","eventBus","selection","translate"],Pe.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Cn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Pe.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Pe.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Pe.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Pe.INPUT_SELECTOR,"keydown",function(n){zt("ArrowUp",n)&&n.preventDefault(),zt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Pe.INPUT_SELECTOR,"keyup",function(n){if(zt("Escape",n))return e.close();if(zt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(zt("ArrowUp",n))return e._scrollToDirection(!0);if(zt("ArrowDown",n))return e._scrollToDirection();zt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Pe.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Cn.unbind(e.el,e.type,e.listener)})},Pe.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=nt(Pe.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Pe.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Pe.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},Pe.prototype._clearResults=function(){ms(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Pe.prototype._getCurrentResult=function(){return nt(Pe.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Pe.prototype._createResultNode=function(e,t){var n=ut(Pe.RESULT_HTML);return e.primaryTokens.length>0&&hx(n,e.primaryTokens,Pe.RESULT_PRIMARY_HTML),hx(n,e.secondaryTokens,Pe.RESULT_SECONDARY_HTML),sn(n,Pe.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Pe.prototype.registerProvider=function(e){this._searchProvider=e},Pe.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,gt(this._canvas.getContainer()).add("djs-search-open"),gt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Pe.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,gt(this._canvas.getContainer()).remove("djs-search-open"),gt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Pe.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Pe.prototype.isOpen=function(){return this._open},Pe.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&gt(t).remove(Pe.RESULT_SELECTED_CLASS);var n=sn(e,Pe.RESULT_ID_ATTRIBUTE),i=this._results[n].element;gt(e).add(Pe.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:dx}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Pe.prototype._select=function(e){var t=sn(e,Pe.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:dx}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Pe.prototype._getBoxHtml=function(){const e=ut(Pe.BOX_HTML),t=nt(Pe.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function hx(e,t,n){var i=HD(t),r=ut(n);r.innerHTML=i,e.appendChild(r)}function HD(e){var t="";return e.forEach(function(n){var i=wv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Pe.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Pe.CONTAINER_SELECTOR=".djs-search-container",Pe.INPUT_SELECTOR=".djs-search-input input",Pe.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Pe.RESULT_SELECTOR=".djs-search-result",Pe.RESULT_SELECTED_CLASS="djs-search-result-selected",Pe.RESULT_SELECTED_SELECTOR="."+Pe.RESULT_SELECTED_CLASS,Pe.RESULT_ID_ATTRIBUTE="data-result-id",Pe.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Pe.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
336
  <div class="djs-search-input">
336
337
  <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
337
338
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -339,4 +340,4 @@
339
340
  <input type="text" spellcheck="false" />
340
341
  </div>
341
342
  <div class="djs-search-results" />
342
- </div>`,fe.RESULT_HTML='<div class="djs-search-result"></div>',fe.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',fe.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const zM={__depends__:[Kr,hs,Zt],searchPad:["type",fe]};function up(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}up.$inject=["elementRegistry","searchPad","canvas","search"],up.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!he(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:Vt(i),id:i.id})),e,{keys:["label","id"]}).map(VM)};function VM(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const GM={__depends__:[zM,mv],__init__:["bpmnSearch"],bpmnSearch:["type",up]},WM="M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z",UM="M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z",qM={width:36,height:50},YM={width:50,height:50};function r_(e,t,n){return te("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const rn=5;function Js(e,t){this._styles=t,e.registerProvider(this)}Js.$inject=["outline","styles"],Js.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(fx(e))return n=te("rect"),Z(n,D({x:-rn,y:-rn,rx:4,width:e.width+rn*2,height:e.height+rn*2},t)),n;if(!he(e))return y(e,"bpmn:Gateway")?(n=te("rect"),D(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Z(n,D({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):ge(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=te("rect"),Z(n,D({x:-rn,y:-rn,rx:14,width:e.width+rn*2,height:e.height+rn*2},t))):y(e,"bpmn:EndEvent")?(n=te("circle"),Z(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+rn+1},t))):y(e,"bpmn:Event")?(n=te("circle"),Z(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+rn},t))):y(e,"bpmn:DataObjectReference")&&o_(e,"bpmn:DataObjectReference")?n=r_(WM,{x:-6,y:-6},t):y(e,"bpmn:DataStoreReference")&&o_(e,"bpmn:DataStoreReference")&&(n=r_(UM,{x:-6,y:-6},t)),n},Js.prototype.updateOutline=function(e,t){if(!he(e))return ge(e,["bpmn:SubProcess","bpmn:Group"])?(Z(t,{width:e.width+rn*2,height:e.height+rn*2}),!0):!!ge(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function o_(e,t){var n;return t==="bpmn:DataObjectReference"?n=qM:t==="bpmn:DataStoreReference"&&(n=YM),e.width===n.width&&e.height===n.height}const KM={__depends__:[Jl],__init__:["outlineProvider"],outlineProvider:["type",Js]};var XM='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function Cn(e){ir.call(this,e)}X(Cn,ir),Cn.Viewer=vi,Cn.NavigatedViewer=wo,Cn.prototype.createDiagram=function(){return this.importXML(XM)},Cn.prototype._interactionModules=[yg,bg,wg],Cn.prototype._modelingModules=[QP,fs,iA,tA,gA,Yl,xA,qA,sm,Ga,ZA,eT,gT,yT,_T,ST,BT,HT,_l,YT,nM,dM,mM,_y,FM,GM,KM],Cn.prototype._modules=[].concat(vi.prototype._modules,Cn.prototype._interactionModules,Cn.prototype._modelingModules);const ZM=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(We.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=We.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=_c(l);return r("imported",p),{warnings:p}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return We.onMounted(async()=>{a=new Cn({container:o.value,moddleExtensions:Ko}),i.xml&&await s(i.xml),r("ready")}),We.watch(()=>i.xml,u=>{u&&a&&s(u)}),We.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(We.openBlock(),We.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);me.APPLY_BPMN_OPS_SCHEMA=x_,me.BPMN_MODDLE_EXTENSIONS=Ko,me.BWL_MODDLE_SCHEMA=fp,me.BWL_NS=pp,me.BWL_PREFIX=ec,me.BWL_SIDES=tc,me.BpmnModelerView=ZM,me.EDITOR=p0,me.HEADLESS_BPMN_MODULES=cg,me.HEADLESS_TEXT_METRICS=Er,me.I18N_NS=r0,me.I18N_PREFIX=Up,me.MVP_FLOW_NODE_TYPES=Tn,me.SYMBOLIC_OP_KINDS=mp,me.SYMBOLIC_OP_SCHEMA=gp,me.UNDO_EPISODE_COMMAND=nc,me.applyBpmnOpBatch=Jp,me.applyBpmnOps=Rp,me.approximateTextWidth=wl,me.buildBpmnOpBatch=l0,me.buildRegistryIndex=yp,me.createBpmnEditorController=f0,me.createBpmnModdle=qp,me.createHeadlessBpmnModeler=$C,me.describeProcess=Qp,me.describeProcessXml=u0,me.executeAsUndoEpisode=hp,me.installHeadlessBpmnDom=sg,me.isMvpFlowNodeType=lp,me.loadBpmnXml=Kp,me.lowerOps=Sp,me.resolverServicesOf=xp,me.saveBpmnXml=o0,me.validateOps=Ep,me.warningMessages=_c,Object.defineProperty(me,Symbol.toStringTag,{value:"Module"})}));
343
+ </div>`,Pe.RESULT_HTML='<div class="djs-search-result"></div>',Pe.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Pe.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const zD={__depends__:[oa,Oc,Kn],searchPad:["type",Pe]};function $f(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}$f.$inject=["elementRegistry","searchPad","canvas","search"],$f.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!De(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:Hn(i),id:i.id})),e,{keys:["label","id"]}).map(VD)};function VD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const GD={__depends__:[zD,C_],__init__:["bpmnSearch"],bpmnSearch:["type",$f]},WD="M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z",UD="M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z",YD={width:36,height:50},qD={width:50,height:50};function mx(e,t,n){return he("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ti=5;function vu(e,t){this._styles=t,e.registerProvider(this)}vu.$inject=["outline","styles"],vu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(vS(e))return n=he("rect"),se(n,O({x:-ti,y:-ti,rx:4,width:e.width+ti*2,height:e.height+ti*2},t)),n;if(!De(e))return v(e,"bpmn:Gateway")?(n=he("rect"),O(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),se(n,O({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Le(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=he("rect"),se(n,O({x:-ti,y:-ti,rx:14,width:e.width+ti*2,height:e.height+ti*2},t))):v(e,"bpmn:EndEvent")?(n=he("circle"),se(n,O({cx:e.width/2,cy:e.height/2,r:e.width/2+ti+1},t))):v(e,"bpmn:Event")?(n=he("circle"),se(n,O({cx:e.width/2,cy:e.height/2,r:e.width/2+ti},t))):v(e,"bpmn:DataObjectReference")&&gx(e,"bpmn:DataObjectReference")?n=mx(WD,{x:-6,y:-6},t):v(e,"bpmn:DataStoreReference")&&gx(e,"bpmn:DataStoreReference")&&(n=mx(UD,{x:-6,y:-6},t)),n},vu.prototype.updateOutline=function(e,t){if(!De(e))return Le(e,["bpmn:SubProcess","bpmn:Group"])?(se(t,{width:e.width+ti*2,height:e.height+ti*2}),!0):!!Le(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function gx(e,t){var n;return t==="bpmn:DataObjectReference"?n=YD:t==="bpmn:DataStoreReference"&&(n=qD),e.width===n.width&&e.height===n.height}const KD={__depends__:[Af],__init__:["outlineProvider"],outlineProvider:["type",vu]};var XD='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function wi(e){lo.call(this,e)}ae(wi,lo),wi.Viewer=yr,wi.NavigatedViewer=Da,wi.prototype.createDiagram=function(){return this.importXML(XD)},wi.prototype._interactionModules=[Tv,kv,Lv],wi.prototype._modelingModules=[QM,kc,i2,t2,g2,Ef,w2,Y2,_y,uc,Z2,ek,gk,vk,_k,Sk,Nk,Hk,qp,qk,nD,dD,mD,Mb,FD,GD,KD],wi.prototype._modules=[].concat(yr.prototype._modules,wi.prototype._interactionModules,wi.prototype._modelingModules);const ZD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Ct.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Ct.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=Hu(l);return r("imported",p),{warnings:p}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return Ct.onMounted(async()=>{a=new wi({container:o.value,moddleExtensions:is}),i.xml&&await s(i.xml),r("ready")}),Ct.watch(()=>i.xml,u=>{u&&a&&s(u)}),Ct.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(Ct.openBlock(),Ct.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);J.APPLY_BPMN_OPS_SCHEMA=Zx,J.BPMN_MODDLE_EXTENSIONS=is,J.BWL_MODDLE_SCHEMA=Gf,J.BWL_NS=Vf,J.BWL_PREFIX=wu,J.BWL_SIDES=Eu,J.BpmnModelerView=ZD,J.EDITOR=yE,J.FLOW_LABEL_INDENT=Sd,J.HEADLESS_BPMN_MODULES=_v,J.HEADLESS_TEXT_METRICS=io,J.I18N_NS=Tw,J.I18N_PREFIX=md,J.LABEL_FORK_MARGIN=Vu,J.MVP_FLOW_NODE_TYPES=Ei,J.SYMBOLIC_OP_KINDS=Yf,J.SYMBOLIC_OP_SCHEMA=qf,J.UNDO_EPISODE_COMMAND=Su,J.applyBpmnOpBatch=fh,J.applyBpmnOps=ch,J.approximateTextWidth=ro,J.auditBpmnGeometry=Od,J.auditBpmnGeometryXml=Zw,J.auditGeometry=Xi,J.auditTargetsOf=Pi,J.axisSegmentsOf=mn,J.blackBoxNameRect=zu,J.buildBpmnOpBatch=gE,J.buildRegistryIndex=Id,J.containerBoundarySegments=Wo,J.createBpmnEditorController=vE,J.createBpmnModdle=gd,J.createHeadlessBpmnModeler=$T,J.crossedShapesOf=Vn,J.crossingCost=Ci,J.describeProcess=ph,J.describeProcessXml=mE,J.edgeCrossCount=cs,J.edgeCrossingPairsOf=Wu,J.executeAsUndoEpisode=Uf,J.forwardThreePointCandidates=Uu,J.geometryFindingKey=Ki,J.installHeadlessBpmnDom=vd,J.isMvpFlowNodeType=zf,J.labelRectsOf=Uo,J.lineCrossesLabel=Ri,J.lineThroughLabel=Cd,J.lineThroughShapeLabel=kd,J.loadBpmnXml=Fu,J.lowerOps=sh,J.oppositeOverlapCount=Hw,J.oppositeOverlapOf=Ed,J.planBackEdgeBoundaryClearance=Yd,J.planCrossPoolRoute=Vd,J.planEdgeRepair=Fd,J.planLabelLineClearance=Qd,J.planLabelPlacement=Zd,J.planMiddleSegmentShifts=$d,J.planOppositeOverlapRepair=Kd,J.planSegmentDetours=Bd,J.planShapeLabelClearance=th,J.repairIntroducedBoundaryHugging=qd,J.repairIntroducedCrossings=Hd,J.repairIntroducedLabelLines=Jd,J.repairIntroducedOppositeOverlaps=Xd,J.repairIntroducedShapeLabelLines=nh,J.repairIntroducedSharedSegmentLabels=eh,J.rerouteIntroducedCrossPoolEdges=Gd,J.resolverServicesOf=ah,J.saveBpmnXml=Mw,J.sceneCrossingCost=Ad,J.sceneFromDefinitions=Dd,J.sceneFromRegistry=jt,J.sharedSegmentUnderLabel=ss,J.sharedSpansOf=as,J.unreadableOverlapCount=Mr,J.unreadableOverlapOf=os,J.validateOps=oh,J.warningMessages=Hu,Object.defineProperty(J,Symbol.toStringTag,{value:"Module"})}));