@g1cloud/bpmn-modeler-next 5.0.0-alpha.7 → 5.0.0-alpha.70
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/describeProcess.d.ts +7 -1
- package/dist/agent/geometryAudit.d.ts +470 -3
- package/dist/agent/resolver/index.d.ts +27 -1
- package/dist/agent/resolver/issues.d.ts +12 -0
- package/dist/agent/resolver/lower.d.ts +83 -0
- package/dist/agent/resolver/routeRepair.d.ts +157 -6
- package/dist/agent/symbolicOp.d.ts +5 -2
- package/dist/bpmn-modeler.js +12310 -9992
- package/dist/bpmn-modeler.umd.cjs +87 -86
- package/dist/core/ir.d.ts +32 -6
- package/package.json +2 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
(function(ie,ot){typeof exports=="object"&&typeof module<"u"?ot(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],ot):(ie=typeof globalThis<"u"?globalThis:ie||self,ot(ie.BpmnModeler={},ie.Vue))})(this,(function(ie,ot){"use strict";var pk=Object.defineProperty;var fk=(ie,ot,Un)=>ot in ie?pk(ie,ot,{enumerable:!0,configurable:!0,writable:!0,value:Un}):ie[ot]=Un;var vr=(ie,ot,Un)=>fk(ie,typeof ot!="symbol"?ot+"":ot,Un);const Un=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Hp(e){return Un.includes(e)}const zp="http://g1project.net/spec/bpmn/bwl/1.0",Pc="bwl",Ac=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Vp={name:"bwl-hints",uri:zp,prefix:Pc,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"}]}]},Tc="bwl.undoEpisode",Gp=new WeakSet;function Q_(e){Gp.has(e)||(e.register(Tc,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),Gp.add(e))}function Wp(e,t){Q_(e);const n={run:t};if(e.execute(Tc,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Up=["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"],J_={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},eb={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},tb={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},nb={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...Un]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},ib={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},rb={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},ob={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},ab={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},sb={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},cb={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},ub={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},lb={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},pb={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Ac]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function kt(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const fb={"participant.add":kt("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":kt("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":kt("node.add",{description:"플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 보조 스트랜드 1…). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.",properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":kt("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...Un]}},required:["id"]}),"sequenceFlow.add":kt("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":kt("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":kt("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":kt("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":kt("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":kt("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":kt("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":kt("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":kt("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":kt("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":kt("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":kt("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":kt("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},qp={anyOf:Up.map(e=>fb[e])},db={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:eb,irParticipant:tb,irNode:nb,irFlowCondition:ib,irSequenceFlow:rb,irMessageFlow:ob,irDataStore:ab,irDataAssociation:sb,irTextAnnotation:cb,irAssociation:ub,irGroup:lb,bwlPlacement:pb,nullableString:J_,symbolicOp:qp}};function Mc(e){return Array.prototype.concat.apply([],e)}const oo=Object.prototype.toString,hb=Object.prototype.hasOwnProperty;function Ui(e){return e===void 0}function ht(e){return e!==void 0}function yr(e){return e==null}function pe(e){return oo.call(e)==="[object Array]"}function bt(e){return oo.call(e)==="[object Object]"}function me(e){return oo.call(e)==="[object Number]"}function xt(e){const t=oo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function qt(e){return oo.call(e)==="[object String]"}function mb(e){if(!pe(e))throw new Error("must supply array")}function Yt(e,t){return!yr(e)&&hb.call(e,t)}function ze(e,t){const n=fa(t);let i;return P(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Yp(e,t){const n=fa(t);let i=pe(e)?-1:void 0;return P(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Re(e,t){const n=fa(t);let i=[];return P(e,function(r,o){n(r,o)&&i.push(r)}),i}function P(e,t){let n,i;if(Ui(e))return;const r=pe(e)?bb:_b;for(let o in e)if(Yt(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function gb(e,t){if(Ui(e))return[];mb(e);const n=fa(t);return e.filter(function(i,r){return!n(i,r)})}function Kt(e,t,n){return P(e,function(i,r){n=t(n,i,r)}),n}function qi(e,t){return!!Kt(e,function(n,i,r){return n&&t(i,r)},!0)}function di(e,t){return!!ze(e,t)}function Dt(e,t){let n=[];return P(e,function(i,r){n.push(t(i,r))}),n}function pa(e){return e&&Object.keys(e)||[]}function vb(e){return pa(e).length}function _r(e){return Dt(e,t=>t)}function br(e,t,n={}){return t=kc(t),P(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Kp(e,...t){e=kc(e);let n={};return P(t,r=>br(r,e,n)),Dt(n,function(r,o){return r[0]})}const yb=Kp;function Pn(e,t){t=kc(t);let n=[];return P(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)}),Dt(n,i=>i.v)}function xr(e){return function(t){return qi(e,function(n,i){return t[i]===n})}}function kc(e){return xt(e)?e:t=>t[e]}function fa(e){return xt(e)?e:t=>t===e}function _b(e){return e}function bb(e){return Number(e)}function Dc(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 Gt(e,t){return e.bind(t)}function k(e,...t){return Object.assign(e,...t)}function xb(e,t,n){let i=e;return P(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];ht(a)&&yr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Ui(a)?Ui(n)?delete i[r]:i[r]=n:i=s}),e}function Sn(e,t){let n={},i=Object(e);return P(t,function(r){r in i&&(n[r]=e[r])}),n}function An(e,t){let n={},i=Object(e);return P(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Oc(){}Oc.prototype.get=function(e){return this.$model.properties.get(this,e)},Oc.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Xp(e,t){this.model=e,this.properties=t}Xp.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Oc.prototype);P(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}),P(a,Gt(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 Eb=k(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Zp=k(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 Ic(e,t){var n=Zp[e];return n?n(t):t}function Lc(e){return!!Eb[e]}function Qp(e){return!!Zp[e]}function Ot(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 an(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}an.prototype.build=function(){return Sn(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},an.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)},an.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},an.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Ot(r[0],i),a=Ot(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},an.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},an.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},an.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},an.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},an.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},an.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")},an.prototype.hasProperty=function(e){return this.propertiesByName[e]},an.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(P(e.properties,Gt(function(o){o=k({},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 hi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,P(e,Gt(this.registerPackage,this))}hi.prototype.getPackage=function(e){return this.packageMap[e]},hi.prototype.getPackages=function(){return this.packages},hi.prototype.registerPackage=function(e){e=k({},e);var t=this.packageMap;Jp(t,e,"prefix"),Jp(t,e,"uri"),P(e.types,Gt(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},hi.prototype.registerType=function(e,t){e=k({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:k({},e.meta||{})});var n=Ot(e.name,t.prefix),i=n.name,r=Object.create(null);P(e.properties,Gt(function(o){var a=Ot(o.name,n.prefix),s=a.name;Lc(o.type)||(o.type=Ot(o.type,a.prefix).name),k(o,{ns:a,name:s}),r[s]=o},this)),k(e,{ns:n,name:i,propertiesByName:r}),P(e.extends,Gt(function(o){var a=Ot(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},hi.prototype.mapTypes=function(e,t,n){var i=Lc(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=Ot(c,Lc(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+">");P(i.superClass,n?a:s),t(i,!n),P(i.traits,a)},hi.prototype.getEffectiveDescriptor=function(e){var t=Ot(e),n=new an(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},hi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Jp(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Yi(e){this.model=e}Yi.prototype.set=function(e,t,n){if(!qt(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;wb(n)?i?delete e[r]:delete e.$attrs[Bc(t)]:i?r in e?e[r]=n:ef(e,i,n):e.$attrs[Bc(t)]=n},Yi.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Bc(t)];var i=n.name;return!e[i]&&n.isMany&&ef(e,n,[]),e[i]},Yi.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=k({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Yi.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Yi.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Yi.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 wb(e){return typeof e>"u"}function ef(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Bc(e){return e.replace(/^:/,"")}function ln(e,t={}){this.properties=new Yi(this),this.factory=new Xp(this,this.properties),this.registry=new hi(e,this.properties),this.typeCache=Object.create(null),this.config=t}ln.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},ln.prototype.getType=function(e){var t=this.typeCache,n=qt(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},ln.prototype.createAny=function(e,t,n){var i=Ot(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){xb(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}),P(n,function(a,s){bt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},ln.prototype.getPackage=function(e){return this.registry.getPackage(e)},ln.prototype.getPackages=function(){return this.registry.getPackages()},ln.prototype.getElementDescriptor=function(e){return e.$descriptor},ln.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},ln.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},ln.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var tf=String.fromCharCode,Sb=Object.prototype.hasOwnProperty,Rb=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,ao={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(ao).forEach(function(e){ao[e.toUpperCase()]=ao[e]});function Cb(e,t,n,i){return i?Sb.call(ao,i)?ao[i]:"&"+i+";":tf(t||parseInt(n,16))}function Ki(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(Rb,Cb):e}var nf="non-whitespace outside of root node";function mi(e){return new Error(e)}function Pb(e){return"missing namespace for prefix <"+e+">"}function da(e){return{get:e,enumerable:!0}}function Ab(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var rf=Symbol("nameCache");function Nc(e){return e+"$uri"}function Tb(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Nc(i)]=n;return t}function ha(){return{line:0,column:0}}function Mb(e){throw e}function of(e){if(!this)return new of(e);var t=e&&e.proxy,n,i,r,o,a=Mb,s,c,u,l,p=ha,f=!1,d=!1,h="",m=!1,g=!1,w=null,E=!1,b,x,S,A;function I(L){L instanceof Error||(L=mi(L)),w=L,a(L,p)}function C(L){s&&(L instanceof Error||(L=mi(L)),s(L,p))}this.on=function(L,F){if(typeof F!="function")throw mi("required args <name, cb>");switch(L){case"openTag":i=F;break;case"text":n=F;break;case"closeTag":r=F;break;case"error":a=F;break;case"warn":s=F;break;case"cdata":o=F;break;case"attention":l=F;break;case"question":u=F;break;case"comment":c=F;break;default:throw mi("unsupported event: "+L)}return this},this.ns=function(L){if(typeof L>"u"&&(L={}),typeof L!="object")throw mi("required args <nsMap={}>");var F=Object.create(null),te;for(te in L)F[te]=L[te];return g=!0,A=F,this};function $(){b=g?[]:null,x=g?Tb(A):null,S=[],p=ha,E=!1,w=null,d=!1,h=""}this.parse=function(L){if(typeof L!="string")throw mi("required args <xml=string>");if(f)throw mi("parse during stream; call end() first");return $(),j(L),p=ha,E=!1,w},this.write=function(L){if(typeof L!="string")throw mi("required args <xml=string>");return f||($(),f=!0),w||(h=j(h+L,!0)||""),this},this.end=function(){return f||$(),f=!1,w||j(h),h="",p=ha,E=!1,w},this.stop=function(){E=!0};function j(L,F=!1){var te=null,ke=null,Je,q=0,ne=!1,ce=!1,ee=0,ae=0,Y,B,N,V,Ee,_t,R,_,v,M="",O=0,z;function J(Ne,ft){var Tt=Ne.indexOf(":");if(Tt===-1)return Ne;var T=x[Ne.substring(0,Tt)];return T?ft===T?Ne.substr(Tt+1):T+Ne.substr(Tt):(C(Pb(Ne.substring(0,Tt))),null)}function ge(){if(z!==null)return z;var Ne,ft,Tt=g&&x.xmlns,T=g&&m?[]:null,D=O,H=M,Q=H.length,le,re,he,Ve,we,Ue={},$t=new Set,dt,be,se;e:for(;D<Q;D++)if(dt=!1,be=H.charCodeAt(D),!(be===32||be<14&&be>8)){for((be<65||be>122||be>90&&be<97)&&be!==95&&be!==58&&(C("illegal first char attribute name"),dt=!0),se=D+1;se<Q;se++)if(be=H.charCodeAt(se),!(be>96&&be<123||be>64&&be<91||be>47&&be<59||be===46||be===45||be===95)){if(be===32||be<14&&be>8){C("missing attribute value"),D=se;continue e}if(be===61)break;C("illegal attribute name char"),dt=!0}if(we=H.substring(D,se),we==="xmlns:xmlns"&&(C("illegal declaration of xmlns"),dt=!0),be=H.charCodeAt(se+1),be===34)se=H.indexOf('"',D=se+2),se===-1&&(se=H.indexOf("'",D),se!==-1&&(C("attribute value quote missmatch"),dt=!0));else if(be===39)se=H.indexOf("'",D=se+2),se===-1&&(se=H.indexOf('"',D),se!==-1&&(C("attribute value quote missmatch"),dt=!0));else for(C("missing attribute value quotes"),dt=!0,se=se+1;se<Q&&(be=H.charCodeAt(se+1),!(be===32||be<14&&be>8));se++);for(se===-1&&(C("missing closing quotes"),se=Q,dt=!0),dt||(he=H.substring(D,se)),D=se;se+1<Q&&(be=H.charCodeAt(se+1),!(be===32||be<14&&be>8));se++)D===se&&(C("illegal character after attribute end"),dt=!0);if(D=se+1,dt)continue e;if($t.has(we)){C("attribute <"+we+"> already defined");continue}if($t.add(we),!g){Ue[we]=he;continue}if(m){if(re=we==="xmlns"?"xmlns":we.charCodeAt(0)===120&&we.substr(0,6)==="xmlns:"?we.substr(6):null,re!==null){if(Ne=Ki(he),ft=Nc(re),Ve=A[Ne],!Ve){if(re==="xmlns"||ft in x&&x[ft]!==Ne)do Ve="ns"+q++;while(typeof x[Ve]<"u");else Ve=re;A[Ne]=Ve}x[re]!==Ve&&(le||(x=Ab(x),le=!0),x[re]=Ve,re==="xmlns"&&(x[Nc(Ve)]=Ne,Tt=Ve),x[ft]=Ne),Ue[we]=he;continue}T.push(we,he);continue}we=J(we,Tt),we!==null&&(Ue[we]=he)}if(m)for(D=0,Q=T.length;D<Q;D++)we=J(T[D++],Tt),he=T[D],we!==null&&(Ue[we]=he);return z=Ue}function Ie(){for(var Ne=/(\r\n|\r|\n)/g,ft=0,Tt=0,T=0,D=ae,H,Q;ee>=T&&(H=Ne.exec(L),!(!H||(D=H[0].length+H.index,D>ee)));)ft+=1,T=D;return ee==-1?(Tt=D,Q=L.substring(ae)):ae===0?Q=L.substring(ae,ee):(Tt=ee-T,Q=ae==-1?L.substring(ee):L.substring(ee,ae+1)),{data:Q,line:ft,column:Tt}}for(p=Ie,t&&(v=Object.create({},{name:da(function(){return R}),originalName:da(function(){return _}),attrs:da(ge),ns:da(function(){return x})}));ae!==-1;){if(L.charCodeAt(ae)===60?ee=ae:ee=L.indexOf("<",ae),ee===-1){if(F)return L.substring(ae);if(S.length)return I("unexpected end of file");if(!d)return I("missing start tag");ae<L.length&&L.substring(ae).trim()&&C(nf);return}if(d||(d=!0),ae!==ee){if(S.length){if(n&&(n(L.substring(ae,ee),Ki,p),E))return}else if(L.substring(ae,ee).trim()&&(C(nf),E))return}if(V=L.charCodeAt(ee+1),V===33){if(N=L.charCodeAt(ee+2),N===91&&L.substr(ee+3,6)==="CDATA["){if(ae=L.indexOf("]]>",ee),ae===-1)return F?L.substring(ee):I("unclosed cdata");if(o&&(o(L.substring(ee+9,ae),p),E))return;ae+=3;continue}if(N===45&&L.charCodeAt(ee+3)===45){if(ae=L.indexOf("-->",ee),ae===-1)return F?L.substring(ee):I("unclosed comment");if(c&&(c(L.substring(ee+4,ae),Ki,p),E))return;ae+=3;continue}}if(V===63){if(ae=L.indexOf("?>",ee),ae===-1)return F?L.substring(ee):I("unclosed question");if(u&&(u(L.substring(ee,ae+2),p),E))return;ae+=2;continue}for(Y=ee+1;;Y++){if(Ee=L.charCodeAt(Y),isNaN(Ee))return F?L.substring(ee):(ae=-1,I("unclosed tag"));if(Ee===34)N=L.indexOf('"',Y+1),Y=N!==-1?N:Y;else if(Ee===39)N=L.indexOf("'",Y+1),Y=N!==-1?N:Y;else if(Ee===62){ae=Y;break}}if(V===33){if(l&&(l(L.substring(ee,ae+1),Ki,p),E))return;ae+=1;continue}if(z={},V===47){if(ne=!1,ce=!0,!S.length)return I("missing open tag");if(Y=R=S.pop(),N=ee+2+Y.length,L.substring(ee+2,N)!==Y)return I("closing tag mismatch");for(;N<ae;N++)if(V=L.charCodeAt(N),!(V===32||V>8&&V<14))return I("close tag")}else{if(L.charCodeAt(ae-1)===47?(Y=R=L.substring(ee+1,ae-1),ne=!0,ce=!0):(Y=R=L.substring(ee+1,ae),ne=!0,ce=!1),!(V>96&&V<123||V>64&&V<91||V===95||V===58))return I("illegal first char nodeName");for(N=1,B=Y.length;N<B;N++)if(V=Y.charCodeAt(N),!(V>96&&V<123||V>64&&V<91||V>47&&V<59||V===45||V===95||V==46)){if(V===32||V<14&&V>8){R=Y.substring(0,N),z=null;break}return I("invalid nodeName")}ce||S.push(R)}if(g){Je=x,ne&&(ce||b.push(Je),z===null&&(m=Y.indexOf("xmlns",N)!==-1)&&(O=N,M=Y,ge(),m=!1)),_=R,ke!==x&&(te=x[rf],te===void 0&&(te=x[rf]=Object.create(null)),ke=x);var tt=te[R];if(tt!==void 0)R=tt;else{if(V=R.indexOf(":"),V!==-1){if(_t=x[R.substring(0,V)],!_t)return I("missing namespace on <"+_+">");R=R.substr(V+1)}else _t=x.xmlns;_t&&(R=_t+":"+R),te[_]=R}}if(ne&&(O=N,M=Y,i&&(t?i(v,Ki,ce,p):i(R,ge,Ki,ce,p),E)))return;if(ce){if(r&&(r(t?v:R,Ki,ne,p),E))return;g&&(ne?x=Je:x=b.pop())}ae+=1}}}function af(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var $c={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},sf="property";function cf(e){return e.xml&&e.xml.serialize}function kb(e){const t=cf(e);return t!==sf&&(t||null)}function Db(e){return e.charAt(0).toUpperCase()+e.slice(1)}function uf(e,t){return af(t)?e.prefix+":"+Db(e.localName):e.name}function Ob(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 Ib(e,t,n){const i=Ot(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=Ot(r);var a=n.getPackage(o.prefix);return Ob(o,a)}function gi(e){return new Error(e)}function qn(e){return e.$descriptor}function Lb(e){k(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw gi("expected element");var n=this.elementsById,i=qn(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 gi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function so(){}so.prototype.handleEnd=function(){},so.prototype.handleText=function(){},so.prototype.handleNode=function(){};function jc(){}jc.prototype=Object.create(so.prototype),jc.prototype.handleNode=function(){return this};function Er(){}Er.prototype=Object.create(so.prototype),Er.prototype.handleText=function(e){this.body=(this.body||"")+e};function co(e,t){this.property=e,this.context=t}co.prototype=Object.create(Er.prototype),co.prototype.handleNode=function(e){if(this.element)throw gi("expected no sub nodes");return this.element=this.createReference(e),this},co.prototype.handleEnd=function(){this.element.id=this.body},co.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Fc(e,t){this.element=t,this.propertyDesc=e}Fc.prototype=Object.create(Er.prototype),Fc.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Ic(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function ma(){}ma.prototype=Object.create(Er.prototype),ma.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 Ft(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Ft.prototype=Object.create(ma.prototype),Ft.prototype.addReference=function(e){this.context.addReference(e)},Ft.prototype.handleText=function(e){var t=this.element,n=qn(t),i=n.bodyProperty;if(!i)throw gi("unexpected body text <"+e+">");Er.prototype.handleText.call(this,e)},Ft.prototype.handleEnd=function(){var e=this.body,t=this.element,n=qn(t),i=n.bodyProperty;i&&e!==void 0&&(e=Ic(i.type,e),t.set(i.name,e))},Ft.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=qn(n),r=this.context,o=new n({}),a=this.model,s;return P(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),P(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=Ic(l.type,c):u==="xmlns"?u=":"+u:(s=Ot(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},Ft.prototype.getPropertyForNode=function(e){var t=e.name,n=Ot(t),i=this.type,r=this.model,o=qn(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=kb(s);if(u){const l=e.attributes[u];if(l){const p=Ib(l,e.ns,r),f=r.getType(p);return k({},s,{effectiveType:qn(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=uf(n,c),l=r.getType(u);if(s=ze(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return k({},s,{effectiveType:qn(l).name})}else if(s=ze(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw gi("unrecognized element <"+n.name+">")},Ft.prototype.toString=function(){return"ElementDescriptor["+qn(this.type).name+"]"},Ft.prototype.valueHandler=function(e,t){return new Fc(e,t)},Ft.prototype.referenceHandler=function(e){return new co(e,this.context)},Ft.prototype.handler=function(e){return e==="Element"?new wr(this.model,e,this.context):new Ft(this.model,e,this.context)},Ft.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Qp(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?(k(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Hc(e,t,n){Ft.call(this,e,t,n)}Hc.prototype=Object.create(Ft.prototype),Hc.prototype.createElement=function(e){var t=e.name,n=Ot(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&uf(n,o)||t;if(!r.hasType(a))throw gi("unexpected element <"+e.originalName+">");return Ft.prototype.createElement.call(this,e)};function wr(e,t,n){this.model=e,this.context=n}wr.prototype=Object.create(ma.prototype),wr.prototype.createElement=function(e){var t=e.name,n=Ot(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},wr.prototype.handleChild=function(e){var t=new wr(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},wr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function zc(e){e instanceof ln&&(e={model:e}),k(this,{lax:!1},e)}zc.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Ft?(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 Lb(k({},t,{rootHandler:i})),s=new of({proxy:!0}),c=Bb();i.context=a,c.push(i);function u(S,A,I){var C=A(),$=C.line,j=C.column,L=C.data;L.charAt(0)==="<"&&L.indexOf(" ")!==-1&&(L=L.slice(0,L.indexOf(" "))+">");var F="unparsable content "+(L?L+" ":"")+`detected
|
|
2
|
-
line:
|
|
3
|
-
column: `+
|
|
4
|
-
nested error: `+
|
|
5
|
-
|
|
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 Jb(e){e=k({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new Zb,o=new Qb(r,e.format);e.preamble&&o.append(Nb);var a=new qe,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(e0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function e0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in $c)n[i]=$c[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 va(e,t){ln.call(this,e,t)}va.prototype=Object.create(ln.prototype),va.prototype.fromXML=function(e,t,n){qt(t)||(n=t,t="bpmn:Definitions");var i=new zc(k({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},va.prototype.toXML=function(e,t){var n=new Jb(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var t0="BPMN20",n0="http://www.omg.org/spec/BPMN/20100524/MODEL",i0="bpmn",r0=[],o0=[{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"}]}],a0=[{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"}]}],s0={tagAlias:"lowerCase",typePrefix:"t"},c0={name:t0,uri:n0,prefix:i0,associations:r0,types:o0,enumerations:a0,xml:s0},u0="BPMNDI",l0="http://www.omg.org/spec/BPMN/20100524/DI",p0="bpmndi",f0=[{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"]}],d0=[{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"}]}],h0=[],m0={name:u0,uri:l0,prefix:p0,types:f0,enumerations:d0,associations:h0},g0="DC",v0="http://www.omg.org/spec/DD/20100524/DC",y0="dc",_0=[{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}]}],b0=[],x0={name:g0,uri:v0,prefix:y0,types:_0,associations:b0},E0="DI",w0="http://www.omg.org/spec/DD/20100524/DI",S0="di",R0=[{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"}]}],C0=[],P0={tagAlias:"lowerCase"},A0={name:E0,uri:w0,prefix:S0,types:R0,associations:C0,xml:P0},T0="bpmn.io colors for BPMN",M0="http://bpmn.io/schema/bpmn/biocolor/1.0",k0="bioc",D0=[{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"}]}],O0=[],I0=[],L0={name:T0,uri:M0,prefix:k0,types:D0,enumerations:O0,associations:I0},B0="BPMN in Color",N0="http://www.omg.org/spec/BPMN/non-normative/color/1.0",$0="color",j0=[{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"}]}],F0=[],H0=[],z0={name:B0,uri:N0,prefix:$0,types:j0,enumerations:F0,associations:H0};const V0={bpmn:c0,bpmndi:m0,dc:x0,di:A0,bioc:L0,color:z0};function hf(e,t){const n=k({},V0,e);return new va(n,t)}const G0={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"}},W0="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",mf="i18n",ya={[mf]:G0,[Pc]:Vp};function gf(){return hf(ya)}const vf=gf();async function Wc(e){const{rootElement:t,warnings:n}=await vf.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function U0(e){const{xml:t}=await vf.toXML(e,{format:!0});return t}function Uc(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const _a=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),q0=1,Y0=2;function Zi(e){switch(e.kind){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]}`}}const K0=20,X0=1;function yf(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 qc(e,t){let n=null;for(const i of yf(e))for(const r of yf(t)){if(i.axis!==r.axis||i.dir===r.dir||Math.abs(i.at-r.at)>X0)continue;const o=Math.min(i.hi,r.hi)-Math.max(i.lo,r.lo);o>=K0&&(!n||o>n.length)&&(n={axis:i.axis,length:o})}return n}function Yc(e,t){let n=0;for(const i of t)i.id!==e.id&&qc(e,i)&&n++;return n}const Z0=1,Q0=(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 J0(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 ex(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 tx=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height;function Qi(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(J0(e.waypoints[o],e.waypoints[o+1],r,Y0)){i.push(r);break}}return i}function nx(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 ix=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Sr(e,t){let n=0;for(const i of t){if(i.id===e.id||ix(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++)nx(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Kc(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Sr(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]}`))}const ba=e=>e.shapes.filter(t=>!t.container);function Rr(e){const t=[],n=e.shapes.filter(o=>!o.container);for(const o of e.edges)for(const a of Qi(o,n))t.push({kind:"edge-crosses-shape",edge:o.id,shape:a.id});const i=n.filter(o=>!o.attached);for(let o=0;o<i.length;o++)for(let a=o+1;a<i.length;a++){const s=i[o],c=i[a];if(!ex(s,c,q0))continue;const u=s.id<c.id?[s.id,c.id]:[c.id,s.id];t.push({kind:"shape-overlap",shapes:u,identical:tx(s,c)})}for(let o=0;o<e.edges.length;o++)for(let a=o+1;a<e.edges.length;a++){const s=e.edges[o],c=e.edges[a],u=qc(s,c);if(!u)continue;const l=s.id<c.id?[s.id,c.id]:[c.id,s.id];t.push({kind:"edge-overlap-opposite",edges:l,axis:u.axis,length:Math.round(u.length)})}const r=new Map(e.shapes.map(o=>[o.id,o]));for(const o of n){if(!o.parent)continue;const a=r.get(o.parent);!a||!a.container||Q0(a,o,Z0)||t.push({kind:"shape-outside-container",shape:o.id,container:a.id})}return t.sort((o,a)=>Zi(o).localeCompare(Zi(a)))}const It=e=>typeof e=="object"&&e!==null?e:void 0,Mn=e=>typeof e=="number"?e:0,Ji=e=>{const t=It(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function rx(e){const t=It(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=Ji(o);a&&n.push(a)}}return n}function ox(e,t){const n=It(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Ji(n);return r?t.get(r):void 0}if(_a.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Ji(n)}function _f(e){var o,a,s;const t=[],n=[],i=((o=It(e))==null?void 0:o.diagrams)??[],r=new Map;for(const c of((a=It(e))==null?void 0:a.rootElements)??[]){const u=It(c);if((u==null?void 0:u.$type)==="bpmn:Collaboration")for(const l of u.participants??[]){const p=It(l),f=Ji(p),d=Ji(p==null?void 0:p.processRef);f&&d&&r.set(d,f)}}for(const c of i){const u=It((s=It(c))==null?void 0:s.plane),l=(u==null?void 0:u.planeElement)??[];for(const p of l){const f=It(p);if(!f)continue;const d=It(f.bpmnElement),h=typeof(d==null?void 0:d.id)=="string"?d.id:void 0;if(!h)continue;const m=typeof(d==null?void 0:d.$type)=="string"?d.$type:"",g=It(f.bounds);if(g){const E=f.isExpanded===!1;t.push({id:h,type:m,x:Mn(g.x),y:Mn(g.y),width:Mn(g.width),height:Mn(g.height),container:_a.has(m)&&!E,attached:(d==null?void 0:d.attachedToRef)!==void 0,...d?{parent:ox(d,r)}:{}});continue}const w=f.waypoint;Array.isArray(w)&&n.push({id:h,type:m,waypoints:w.map(E=>{var b,x;return{x:Mn((b=It(E))==null?void 0:b.x),y:Mn((x=It(E))==null?void 0:x.y)}}),endpoints:rx(d)})}}return{shapes:t,edges:n}}function bf(e){return Rr(_f(e))}async function ax(e){const{definitions:t,warnings:n}=await Wc(e);return{findings:bf(t),warnings:n}}function vi(e){const t=[],n=[];for(const i of e.getAll()){const r=i;if(r.type==="label"||r.labelTarget)continue;const o=typeof r.type=="string"?r.type:"";if(o==="bpmn:Definitions"||o.startsWith("bpmndi:"))continue;const a=r.waypoints;if(a){n.push({id:r.id,type:o,waypoints:a.map(p=>({x:Mn(p.x),y:Mn(p.y)})),endpoints:[Ji(r.source),Ji(r.target)].filter(p=>!!p)});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const s=It(r.businessObject);let c=It(r.parent);for(;c&&c.type==="bpmn:Lane";)c=It(c.parent);const u=typeof(c==null?void 0:c.type)=="string"?c.type:"",l=c&&_a.has(u)&&u!=="bpmn:Group"&&typeof c.id=="string"?c.id:void 0;t.push({id:r.id,type:o,x:r.x,y:r.y,width:Mn(r.width),height:Mn(r.height),container:_a.has(o)&&r.collapsed!==!0,attached:(s==null?void 0:s.attachedToRef)!==void 0,...l!==void 0?{parent:l}:{}})}return{shapes:t,edges:n}}const sx={"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 cx(e,t){const n=sx[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function xf(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Ef(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 cx(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&xf(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?xf(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 wf=20,ux=4,Ht=(e,t)=>Math.abs(e-t)<.5;function Sf(e,t,n,i=wf){if(Ht(e.y,t.y)&&!Ht(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(Ht(e.x,t.x)&&!Ht(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 Rf(e,t,n=wf){if(e.length!==4)return null;const[i,r,o,a]=e;if(Ht(i.y,r.y)&&Ht(r.x,o.x)&&Ht(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(Ht(i.x,r.x)&&Ht(r.y,o.y)&&Ht(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}const lx=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],Cf=(e,t,n)=>Qi({...e,waypoints:t},n).length;function Pf(e,t,n){let i=[...e.waypoints],r=Cf(e,i,t);if(r===0)return null;let o=!1;const a=s=>!n||s.every(c=>c.x>=n.x&&c.x<=n.x+n.width&&c.y>=n.y&&c.y<=n.y+n.height);for(let s=0;s<ux&&r>0;s++){let c=!1;for(let u=0;u+1<i.length&&!c;u++){const l=i[u],p=i[u+1];for(const f of t){if(e.endpoints.includes(f.id)||Qi({...e,waypoints:[l,p]},[f]).length===0)continue;const d=Sf(l,p,f),h=d?d.map(g=>lx(i,u,g)):Rf(i,f)??[];if(!h.length)continue;const m=[...h].sort((g,w)=>Number(a(w))-Number(a(g)));for(const g of m){const w=Cf(e,g,t);if(w<r){i=g,r=w,c=!0,o=!0;break}}if(c)break}}if(!c)break}return o&&r===0?i:null}function Af(e,t){const{elementRegistry:n}=e,i=e.modeling,r=vi(n),o=ba(r),a=Rr(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(Zi(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=Pf(u,o,f);d&&i.updateWaypoints(l,d)}}const px=10;function Tf(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 Mf(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(F=>F.type==="bpmn:Participant"&&F.container),i=t.shapes.find(F=>F.id===e.endpoints[0]),r=t.shapes.find(F=>F.id===e.endpoints[1]);if(!i||!r)return null;const o=Tf(i,n),a=Tf(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(F=>F.id!==o.id&&F.id!==a.id&&F.y>=c.y+c.height&&F.y+F.height<=u.y).sort((F,te)=>F.y-te.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,w=e.waypoints[0],E=e.waypoints[e.waypoints.length-1],b=ba(t),x=t.edges.filter(F=>F.id!==e.id),S=Sr(e,x),A=Qi(e,b).length;if(S===0&&A===0)return null;const I=Math.min(...l.map(F=>F.x)),C=Math.max(...l.map(F=>F.x+F.width)),$=(w.x+E.x)/2,j=F=>F.filter((te,ke)=>ke===0||!(Ht(te.x,F[ke-1].x)&&Ht(te.y,F[ke-1].y)));let L;for(let F=I;F<=C;F+=px){const te=j([w,{x:w.x,y:m},{x:F,y:m},{x:F,y:g},{x:E.x,y:g},E]),ke={...e,waypoints:te};if(Qi(ke,b).length>0)continue;const Je=Sr(ke,x),q=Math.abs(F-$);(!L||Je<L.cross||Je===L.cross&&q<L.detour)&&(L={pts:te,cross:Je,detour:q})}return L&&(A>0?L.cross<=S:L.cross<S)?L.pts:null}function kf(e,t){const{elementRegistry:n}=e,i=e.modeling,r=vi(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=vi(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=Mf(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const fx=[25,-25,40,-40],Df=35;function dx(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=[{x:n.x,y:r},{x:o,y:r},{x:o,y:c}],l=s?n.y:n.y+n.height,p=s?n.y-Df:n.y+n.height+Df;return[u,[{x:a,y:l},{x:a,y:p},{x:o,y:p},{x:o,y:c}]]}function hx(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=Ht(n[0].x,n[1].x)&&!Ht(n[0].y,n[1].y),s=Ht(n[n.length-1].x,n[n.length-2].x)&&!Ht(n[n.length-1].y,n[n.length-2].y);for(const c of fx){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(u)}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(u)}}return i}function Of(e,t){const n=new Map(t.shapes.map(u=>[u.id,u])),i=ba(t),r=t.edges.filter(u=>u.id!==e.id),o=Yc(e,r);if(o===0)return null;const a=Sr(e,r);let s;const c=u=>u.reduce((l,p,f)=>f?l+Math.abs(p.x-u[f-1].x)+Math.abs(p.y-u[f-1].y):0,0);for(const u of[...dx(e,n),...hx(e,n)]){const l={...e,waypoints:u};if(Qi(l,i).length>0)continue;const p=Yc(l,r),f=Sr(l,r);if(p>=o||f-a>o-p)continue;const d=c(u);(!s||p<s.opposite||p===s.opposite&&(f<s.cross||f===s.cross&&d<s.len))&&(s={pts:u,opposite:p,cross:f,len:d})}return(s==null?void 0:s.pts)??null}function If(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=vi(i),a=Rr(o).filter(c=>c.kind==="edge-overlap-opposite"&&!t.has(Zi(c)));if(!a.length)return;const s=new Set;for(const c of a)if(c.kind==="edge-overlap-opposite")for(const u of c.edges)n.has(u)||s.add(u);for(const c of s){const u=vi(i),l=u.edges.find(d=>d.id===c);if(!l)continue;const p=Of(l,u);if(!p)continue;const f=i.get(c);f&&r.updateWaypoints(f,p)}}const mx=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Lf=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Bf={"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}]},xa=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Xc=e=>typeof e=="string"&&e!=="";function gx(e){const t=[];function n(i,r,o,a){if(a===null){Xc(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!xa(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Xc(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!xa(i)||!Xc(i.kind)||!(i.kind in Bf)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of Bf[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(!xa(u))break;u=u[p]}if(!xa(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 Nf(e,t){const n=gx(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!mx.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:w,name:E,condition:b}=f.flow,x=u(d,g,"source",["flowNode"]),S=u(d,w,"target",["flowNode"]);x&&S&&c(g)!==c(w)&&i.push({kind:"flow-cross-pool",opIndex:d,id:m}),E!==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:w}=f.flow,E=u(d,g,"source",["flowNode","participant"]),b=u(d,w,"target",["flowNode","participant"]);if(E&&b){const x=c(g),S=c(w);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(E=>E===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:m.source,target:m.target});continue}const w=m.source===f.dataStore.id?m.target:m.source;u(d,w,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=f.association,w=u(d,m,"source"),E=u(d,g,"target");if(w&&E){const b=new Set([w,E]);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:w}=f.association,E=u(d,g,"source"),b=u(d,w,"target");E&&b&&E!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${w}`});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 w=m===f.annotation.id?g:m;u(d,w,"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&&Lf.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(E=>E.id);for(const E of m)g.includes(E)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:E});for(const E of g)t.categoryOf(E)!==void 0&&!m.includes(E)&&i.push({kind:"id-duplicate",opIndex:d,id:E});const w=g.filter(E=>m.includes(E));w.length===m.length&&w.some((E,b)=>E!==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,w=t.endpointsOf(f.id),E=f.source??(w==null?void 0:w.source),b=f.target??(w==null?void 0:w.target);m&&g&&E!==void 0&&b!==void 0&&new Set([c(E),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&&Lf.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 $f(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 Ea(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const jf={"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 St(e,t){return e.filter(n=>n.kind===t)}function Ff(e,t){var tt,Ne,ft,Tt;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=T=>o.get(T),p=T=>{const D=l(T);if(!D)throw new Error(`하강 참조 해소 실패: ${T}`);return D},f=T=>{let D=T.parent;for(;D;){if(D.type==="bpmn:Participant")return D;D=D.parent}},d=St(e,"participant.add"),h=St(e,"node.add"),m=St(e,"sequenceFlow.add"),g=St(e,"messageFlow.add"),w=St(e,"dataStore.add"),E=St(e,"dataAssociation.add"),b=St(e,"annotation.add"),x=St(e,"group.add"),S=new Map(h.map(T=>[T.node.id,T])),A=(T,D,H)=>{var Ve;const Q=T.businessObject,le=(((Ve=Q.extensionElements)==null?void 0:Ve.values)??[]).filter(we=>we.$type!==D),re=H?[...le,i.create(D,H)]:le;if(!re.length){Q.extensionElements&&n.updateProperties(T,{extensionElements:void 0});return}const he=i.create("bpmn:ExtensionElements",{values:re});re.forEach(we=>{we.$parent=he}),n.updateProperties(T,{extensionElements:he})},I=T=>({anchor:T.anchor,side:T.side,...T.offset!==void 0?{offset:T.offset}:{}});for(const T of St(e,"element.remove")){const D=l(T.id);D&&n.removeElements([D])}const C=T=>o.filter(D=>{var H;return D.type==="bpmn:Lane"&&((H=f(D))==null?void 0:H.id)===T}).sort((D,H)=>D.y-H.y);for(const T of St(e,"participant.update")){const D=p(T.id);if(T.name!==void 0&&n.updateProperties(D,{name:T.name??void 0}),!T.lanes)continue;const H=C(T.id);if(!H.length){n.splitLane(D,T.lanes.length),C(T.id).forEach((le,re)=>{const he=T.lanes[re];he&&n.updateProperties(le,{id:he.id,name:he.name})});continue}const Q=new Set(H.map(le=>le.id));T.lanes.forEach((le,re)=>{if(Q.has(le.id)){n.updateProperties(p(le.id),{name:le.name});return}const he=re===0?n.addLane(C(T.id)[0],"top"):n.addLane(p(T.lanes[re-1].id),"bottom");n.updateProperties(he,{id:le.id,name:le.name})})}const $=150,j=80,L=90,F=180,te=new Set;for(const T of d){te.add(`pool:${T.participant.id}`);for(const D of T.participant.lanes??[])te.add(D.id)}const ke=new Map;for(const T of h){const D=T.node.lane??`pool:${T.node.participant??""}`;let H=ke.get(D);H||ke.set(D,H=new Set([0])),T.band!==void 0&&H.add(T.band)}const Je=new Map;for(const[T,D]of ke){if(!te.has(T))continue;const H=[...D].sort((re,he)=>re-he),Q=H.map((re,he)=>he===0?0:he%2===1?Math.ceil(he/2):-(he/2)),le=Math.min(...Q);Je.set(T,new Map(H.map((re,he)=>[re,Q[he]-le])))}const q=T=>{var D;return(((D=ke.get(T))==null?void 0:D.size)??0)>1},ne=T=>T.band??(T.node.lane||!q(`pool:${T.node.participant??""}`)?void 0:0),ce=(T,D)=>{var H;return((H=Je.get(T))==null?void 0:H.get(D))??D},ee=new Map;for(const[T,D]of ke){let H=0;for(const Q of D)H=Math.max(H,ce(T,Q));ee.set(T,H)}const ae=T=>F+$*T,Y=d.map((T,D)=>({op:T,declared:D}));Y.sort((T,D)=>{const H=T.op.order??Number.POSITIVE_INFINITY,Q=D.op.order??Number.POSITIVE_INFINITY;return H!==Q?H-Q:T.declared-D.declared});let B=80;for(const T of o.getAll())T.parent===u()&&"height"in T&&typeof T.y=="number"&&(B=Math.max(B,T.y+T.height+60));for(const{op:T}of Y){const D=T.participant,H=h.filter(be=>be.node.participant===D.id).length,Q=((tt=D.lanes)==null?void 0:tt.length)??0,le=Math.max(1200,H*160+300),re=(D.lanes??[]).map(be=>ae(ee.get(be.id)??0)),he=re.reduce((be,se)=>be+se,0);Q&&he<300&&(re[Q-1]+=300-he);const Ve=Math.max(300,$*((ee.get(`pool:${D.id}`)??0)+1)),we=D.blackBox||H+Q===0?120:Q?Math.max(300,he):Ve,Ue=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:D.id,name:D.name,...T.order!==void 0?{"bwl:poolOrder":T.order}:{},...D.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:le,height:we,isExpanded:!0}),$t=n.createShape(Ue,{x:100+le/2,y:B+we/2},u()),dt=D.lanes??[];if(dt.length&&n.splitLane($t,dt.length),dt.length){const be=o.filter(se=>{var Mt;return se.type==="bpmn:Lane"&&((Mt=f(se))==null?void 0:Mt.id)===D.id}).sort((se,Mt)=>se.y-Mt.y);if(be.forEach((se,Mt)=>{const on=dt[Mt];on&&n.updateProperties(se,{id:on.id,name:on.name})}),re.some(se=>se!==$t.height/Q)){let se=$t.y;be.forEach((Mt,on)=>{const wn=re[on];n.resizeShape(Mt,{x:Mt.x,y:se,width:Mt.width,height:wn}),se+=wn})}}B=$t.y+$t.height+60}const N=T=>{var Q;const D=S.get(T);if(D)return D.node.participant??"";const H=l(T);return H?H.type==="bpmn:Participant"?H.id:((Q=f(H))==null?void 0:Q.id)??"":""},V=new Map,Ee=T=>{let D=V.get(T);return D||V.set(T,D={nodes:[],flows:[]}),D};for(const T of h)Ee(T.node.participant??"").nodes.push(T);for(const T of m)Ee(N(T.flow.source)).flows.push(T);const _t=T=>{var D;return i.create("bpmn:SequenceFlow",{id:T.id,name:T.name??((D=T.condition)==null?void 0:D.label)})},R=(T,D)=>r.createShape({type:Ea(T.type),businessObject:i.create(Ea(T.type),{id:T.id,name:T.name,...D!==void 0?{"bwl:band":D}:{}})}),_=[...Y.map(({op:T})=>T.participant.id).filter(T=>V.has(T)),...[...V.keys()].filter(T=>!d.some(D=>D.participant.id===T))],v=200;for(const T of _){const D=V.get(T),H=T?p(T):void 0;if(H&&d.some(Ae=>Ae.participant.id===T)){const Ae=new Set(D.flows.map(Le=>Le.flow.target)),Te=D.nodes.filter(Le=>!Ae.has(Le.node.id)).map(Le=>Le.node.id),Be=g.find(Le=>Te.includes(Le.flow.target)&&l(Le.flow.source));if(Be){const Le=l(Be.flow.source),Ge=Le.x+Le.width/2-(H.x+150);Ge>=v&&n.moveElements([H],{x:Ge,y:0})}}const Q=H?H.x+150:250;let le=H?H.y+80:120;const re=(Ae,Te,Be)=>{const Le=u().children.filter(rt=>!("waypoints"in rt&&rt.waypoints)&&rt.id!==Te&&typeof rt.y=="number"&&rt.y>=Ae);Le.length&&n.moveElements(Le,{x:0,y:Be})},he=(Ae,Te)=>{if(Ae){const Ge=p(Ae),nt=ae(Te);if(Ge.height>=nt)return;const li=nt-Ge.height,jt=f(Ge),pi=jt?jt.y+jt.height:Ge.y+Ge.height;n.resizeLane(Ge,{x:Ge.x,y:Ge.y,width:Ge.width,height:nt},!1),re(pi,jt==null?void 0:jt.id,li);return}if(!H)return;const Be=$*(Te+1);if(H.height>=Be)return;const Le=Be-H.height,rt=H.y+H.height;n.resizeShape(H,{x:H.x,y:H.y,width:H.width,height:Be}),re(rt,H.id,Le)},Ve=(Ae,Te,Be)=>{if(Ae){const Le=p(Ae);return Le.y+Math.min(Le.height/2,L)+ce(Ae,Te??0)*$}return Te!==void 0&&H?H.y+j+ce(`pool:${T}`,Te)*$:Be},we=(Ae,Te,Be)=>{if(Ae){const Le=p(Ae);return Le.y+Math.min(Le.height/2,L)+Te*$}return H?H.y+j+Te*$:Be},Ue=Ae=>Ae.participant?p(Ae.participant):u(),$t=30,dt=(Ae,Te,Be,Le)=>{const rt=Be-Te.width/2,Ge=Le-Te.height/2;return(Ae.children??[]).find(nt=>!("waypoints"in nt&&nt.waypoints)&&nt.type!=="bpmn:Lane"&&nt.type!=="label"&&typeof nt.x=="number"&&rt<nt.x+nt.width+$t&&rt+Te.width+$t>nt.x&&Ge<nt.y+nt.height&&Ge+Te.height>nt.y)},be=(Ae,Te,Be,Le,rt,Ge)=>{const nt=Be!==void 0||Le!==void 0,li=ce(Be??`pool:${T}`,Le??0);if(nt)for(let Wn=0;Wn<4;Wn++){const fi=we(Be,li+Wn,Ge);if(!dt(Ae,Te,rt,fi))return he(Be,li+Wn),{x:rt,y:fi}}const jt=Ve(Be,Le,Ge);nt&&he(Be,li);let pi=rt;for(let Wn=0;Wn<64;Wn++){const fi=dt(Ae,Te,pi,jt);if(!fi)break;pi=fi.x+fi.width+130+Te.width/2}return{x:pi,y:jt}},se=new Set(D.flows.map(Ae=>Ae.flow.target)),Mt=new Map;for(const Ae of D.nodes){if(se.has(Ae.node.id))continue;const Te=R(Ae.node,Ae.band),Be=ne(Ae),Le=Ae.node.lane?`${Ae.node.lane}|${Be??""}`:Be!==void 0?`band:${Be}`:"",rt=Ue(Ae.node),Ge=be(rt,Te,Ae.node.lane,Be,Mt.get(Le)??Q,le);n.createShape(Te,Ge,rt),Mt.set(Le,Ge.x+Te.width+130),!Ae.node.lane&&Be===void 0&&(le+=160)}const on=new Set;let wn=0;for(;wn++<D.nodes.length+2;){for(let Be=0;Be<D.nodes.length+D.flows.length+2;Be++){let Le=!1;for(const rt of D.flows){const Ge=rt.flow;if(on.has(Ge.id))continue;const nt=l(Ge.source);if(!nt)continue;const li=l(Ge.target),jt=S.get(Ge.target);if(!li&&jt){const pi=R(jt.node,jt.band),Wn=ne(jt);if(jt.node.lane||Wn!==void 0){const fi=Ue(jt.node),Z_=nt,uk=be(fi,pi,jt.node.lane,Wn,Z_.x+Z_.width+130,Number.NaN),lk=n.createShape(pi,uk,fi);n.connect(nt,lk,{type:"bpmn:SequenceFlow",businessObject:_t(Ge)})}else s.append(nt,pi,{connection:{type:"bpmn:SequenceFlow",businessObject:_t(Ge)}})}else if(li)n.connect(nt,li,{type:"bpmn:SequenceFlow",businessObject:_t(Ge)});else continue;on.add(Ge.id),Le=!0}if(!Le)break}const Ae=D.nodes.filter(Be=>!l(Be.node.id));if(!Ae.length)break;const Te=Ae[0];{const Be=R(Te.node,Te.band),Le=Ue(Te.node),rt=ne(Te);n.createShape(Be,be(Le,Be,Te.node.lane,rt,Q,le),Le),!Te.node.lane&&rt===void 0&&(le+=160)}}}const M=40;for(const T of St(e,"sequenceFlow.update")){if(T.target===void 0)continue;const D=S.get(T.target);if(!D)continue;const H=l(T.target),Q=l(T.id);if(!H||!Q)continue;const le=T.source!==void 0?l(T.source):Q.source,re=Q.target;if(!le||!re||re.id===H.id)continue;const he=[H],Ve=new Set([T.target]);for(let se=0;se<he.length;se++){const Mt=he[se].id;for(const on of m){const wn=on.flow.target;if(on.flow.source!==Mt||Ve.has(wn)||!S.has(wn))continue;Ve.add(wn);const Ae=l(wn);Ae&&he.push(Ae)}}const we=Math.min(...he.map(se=>se.x)),Ue=Math.max(...he.map(se=>se.x+se.width)),$t=le.x+le.width,dt=Ue-we+M*2-(re.x-$t);if(dt>0){const se=f(H),Mt=(se==null?void 0:se.children)??[],on=Te=>Te.type==="bpmn:Lane",wn=Mt.filter(Te=>!("waypoints"in Te&&Te.waypoints)&&!on(Te)&&!Ve.has(Te.id)&&Te.x>=re.x),Ae=se?[se,...Mt.filter(Te=>on(Te))]:[];wn.length&&n.createSpace(wn,Ae,{x:dt,y:0},"e",re.x-1)}const be=D.node.lane||D.band!==void 0?H.y+H.height/2:le.y+le.height/2;n.moveElements(he,{x:$t+M-we,y:be-(H.y+H.height/2)})}const O=(T,D)=>{const H=D.target===T,Q=p(D.source),le=p(D.target),re=H?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(Q,le,D.id?{type:re,businessObject:i.create(re,{id:D.id})}:{type:re})};for(const T of w){const D=T.associations??[],H=D.map(re=>re.source===T.dataStore.id?re.target:re.source).map(l).find(Boolean),Q=H?f(H)??u():u(),le=H?{x:H.x+H.width/2,y:H.y+H.height+110}:{x:200,y:B+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:T.dataStore.id,name:T.dataStore.name})},le,Q);for(const re of D)O(T.dataStore.id,re)}for(const T of E){const H=p(T.association.target).type==="bpmn:DataStoreReference"?T.association.target:T.association.source;O(H,T.association)}for(const T of g){const D=T.flow;n.connect(p(D.source),p(D.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:D.id,name:D.name})})}let z=0;for(const T of x){const D=(T.group.members??[]).map(l).filter(re=>!!re),H=40;let Q;if(D.length){const re=Math.min(...D.map(Ue=>Ue.x))-H,he=Math.min(...D.map(Ue=>Ue.y))-H,Ve=Math.max(...D.map(Ue=>Ue.x+Ue.width))+H,we=Math.max(...D.map(Ue=>Ue.y+Ue.height))+H;Q={x:re,y:he,width:Ve-re,height:we-he}}else Q={x:300+z*350,y:40,width:300,height:200},z++;const le=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:T.group.id}),width:Q.width,height:Q.height},{x:Q.x+Q.width/2,y:Q.y+Q.height/2},u());T.group.name&&n.updateLabel(le,T.group.name),(Ne=T.group.members)!=null&&Ne.length&&A(le,"bwl:Members",{refs:T.group.members.join(" ")})}const J=T=>{const D=T.waypoints;if(D!=null&&D.length){const Q=D[Math.floor((D.length-1)/2)];return{x:Q.x,y:Q.y,width:0,height:0}}const H=T;return{x:H.x,y:H.y,width:H.width,height:H.height}};let ge=0;const Ie={width:100,height:30};for(const T of b){const D=T.association,H=((ft=T.placement)==null?void 0:ft.anchor)??(D?D.source===T.annotation.id?D.target:D.source:void 0),Q=H?l(H):void 0,le=Q?J(Q):void 0;let re;if(le&&T.placement){const[we,Ue]=jf[T.placement.side],$t=T.placement.offset??50;re={x:le.x+le.width/2+we*(le.width/2+Ie.width/2+$t),y:le.y+le.height/2+Ue*(le.height/2+Ie.height/2+$t)}}else le?(re={x:le.x+le.width/2+180+ge%3*260,y:le.y-110-ge%2*95},ge++):(re={x:300+ge*260,y:60},ge++);const he=Q?f(Q)??u():u(),Ve=n.createShape({type:"bpmn:TextAnnotation",businessObject:i.create("bpmn:TextAnnotation",{id:T.annotation.id,text:T.annotation.text})},re,he);if(D){const we=Ue=>Ue===T.annotation.id?Ve:p(Ue);n.connect(we(D.source),we(D.target),D.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:D.id})}:{type:"bpmn:Association"})}T.placement&&A(Ve,"bwl:Placement",I(T.placement))}for(const T of St(e,"association.add")){const D=T.association;n.connect(p(D.source),p(D.target),D.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:D.id})}:{type:"bpmn:Association"})}for(const T of St(e,"node.update")){let D=p(T.id);if(T.type&&Ea(T.type)!==D.type&&(D=c.replaceElement(D,{type:Ea(T.type)})),T.name!==void 0&&n.updateProperties(D,{name:T.name??void 0}),T.lane){const H=p(T.lane),Q=H.y+H.height/2-(D.y+D.height/2);Q!==0&&n.moveElements([D],{x:0,y:Q})}}for(const T of St(e,"sequenceFlow.update")){const D=p(T.id);if(T.source!==void 0||T.target!==void 0){const H=D,Q=T.source!==void 0?p(T.source):H.source,le=T.target!==void 0?p(T.target):H.target,re=he=>({x:he.x+he.width/2,y:he.y+he.height/2});n.reconnect(H,Q,le,[re(Q),re(le)])}T.name!==void 0&&n.updateProperties(D,{name:T.name??void 0}),T.condition!==void 0&&n.updateProperties(D,{name:((Tt=T.condition)==null?void 0:Tt.label)??void 0})}for(const T of St(e,"messageFlow.update"))T.name!==void 0&&n.updateProperties(p(T.id),{name:T.name??void 0});for(const T of St(e,"dataStore.update"))T.name!==void 0&&n.updateProperties(p(T.id),{name:T.name??void 0});for(const T of St(e,"annotation.update")){const D=p(T.id);if(T.text!==void 0&&n.updateProperties(D,{text:T.text}),T.placement===null)A(D,"bwl:Placement",null);else if(T.placement){const H=J(p(T.placement.anchor)),[Q,le]=jf[T.placement.side],re=T.placement.offset??50,he=H.x+H.width/2+Q*(H.width/2+D.width/2+re),Ve=H.y+H.height/2+le*(H.height/2+D.height/2+re);n.moveElements([D],{x:he-(D.x+D.width/2),y:Ve-(D.y+D.height/2)}),A(D,"bwl:Placement",I(T.placement))}}for(const T of St(e,"group.update")){const D=p(T.id);if(T.name!==void 0&&n.updateLabel(D,T.name??""),T.members){const H=T.members.map(l).filter(Q=>!!Q);if(H.length){const le=Math.min(...H.map(we=>we.x))-40,re=Math.min(...H.map(we=>we.y))-40,he=Math.max(...H.map(we=>we.x+we.width))+40,Ve=Math.max(...H.map(we=>we.y+we.height))+40;n.resizeShape(D,{x:le,y:re,width:he-le,height:Ve-re})}A(D,"bwl:Members",{refs:T.members.join(" ")})}}}function Hf(e,t,n=Ff){const i=$f(e),r=Nf(t,Ef(i.elementRegistry)),o={edgeCrossings:{before:0,after:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=vi(i.elementRegistry),s=new Set(Rr(a).map(Zi)),c=new Set(a.edges.map(d=>d.id)),u=Kc(a).length,l=e.get("commandStack");try{Wp(l,()=>{n(t,i),kf(i,c),Af(i,s),If(i,s,c)})}catch(d){return{ok:!1,issues:[{kind:"lower-failed",message:d instanceof Error?d.message:String(d)}],findings:[],stats:o}}const p=vi(i.elementRegistry),f=Rr(p).filter(d=>!s.has(Zi(d)));return{ok:!0,issues:[],findings:f,stats:{edgeCrossings:{before:u,after:Kc(p).length}}}}function vx(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function yx(e,t){return typeof e.get=="function"?e.get(t):e[t]}function zf(e,t){const n=yx(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Vf(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function _x(e){return typeof e=="string"&&Ac.includes(e)}function kn(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Gf(e){const t=e.rootElements??[],n=t.find(q=>q.$type==="bpmn:Collaboration"),i=new Map(t.filter(q=>q.$type==="bpmn:Process").map(q=>[q.id,q])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],h=[],m=[],g=[],w=new Set,E=new Set,b=q=>{q&&w.add(q)},x=q=>{w.add(q),E.add(q)},S=q=>{const ne=Vf(q,"bwl:Placement");if(!ne)return;const ce=typeof ne.anchor=="string"?ne.anchor:void 0;if(!ce||!_x(ne.side))return;const ee=typeof ne.offset=="number"?ne.offset:void 0;m.push({owner:q.id,anchor:ce,side:ne.side,...ee!==void 0?{offset:ee}:{}})},A=q=>{const ne=Vf(q,"bwl:Members"),ce=typeof(ne==null?void 0:ne.refs)=="string"?ne.refs.split(/\s+/).filter(Boolean):[];ce.length&&g.push({owner:q.id,refs:ce})},I=q=>{var ne;for(const ce of q)switch(b(ce.id),ce.$type){case"bpmn:TextAnnotation":x(ce.id),s.push({id:ce.id,text:typeof ce.text=="string"?ce.text:""}),S(ce);break;case"bpmn:Association":d.push({id:ce.id,type:ce.$type,source:kn(ce.sourceRef),target:kn(ce.targetRef)});break;case"bpmn:Group":{x(ce.id);const ee=(ne=ce.categoryValueRef)==null?void 0:ne.value;c.push({id:ce.id,...typeof ee=="string"&&ee?{name:ee}:{}}),A(ce);break}default:u.push({id:ce.id,type:ce.$type,reason:"type-outside-mvp"})}},C=(q,ne)=>{const ce=q.flowElements??[],ee=(q.laneSets??[]).flatMap(Y=>Y.lanes??[]),ae=new Map;for(const Y of ee){b(Y.id);for(const B of Y.flowNodeRef??[]){const N=kn(B);N&&ae.set(N,Y.id)}}for(const Y of ce){if(b(Y.id),Y.$type==="bpmn:SequenceFlow"){p.push({id:Y.id,source:kn(Y.sourceRef),target:kn(Y.targetRef),...typeof Y.name=="string"&&Y.name?{name:Y.name}:{}});continue}if(Y.$type==="bpmn:DataStoreReference"){x(Y.id),a.push({id:Y.id,...Y.name?{name:Y.name}:{}});continue}const B=vx(Y.$type);if(!Hp(B)){u.push({id:Y.id,type:Y.$type,reason:"type-outside-mvp"});continue}x(Y.id),o.push({id:Y.id,type:B,...Y.name?{name:Y.name}:{},...ne?{participant:ne}:{},...ae.has(Y.id)?{lane:ae.get(Y.id)}:{}});const N=zf(Y,"bwl:band");N!==void 0&&(l.bands[Y.id]=N);for(const V of Y.dataOutputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:Y.id,target:kn(V.targetRef)});for(const V of Y.dataInputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:kn((V.sourceRef??[])[0]),target:Y.id})}I(q.artifacts??[])};if(n){const q=new Set;for(const ne of n.participants??[]){x(ne.id);const ce=kn(ne.processRef);ce&&q.add(ce);const ee=ce?i.get(ce):void 0,ae=((ee==null?void 0:ee.laneSets)??[]).flatMap(V=>V.lanes??[]),Y=ae.map(V=>({id:V.id,...V.name?{name:V.name}:{}}));for(const V of Y)x(V.id);const B=!ee||(ee.flowElements??[]).length===0&&ae.length===0&&(ee.artifacts??[]).length===0;r.push({id:ne.id,...ne.name?{name:ne.name}:{},...B?{blackBox:!0}:{},...Y.length?{lanes:Y}:{}});const N=zf(ne,"bwl:poolOrder");N!==void 0&&(l.poolOrders[ne.id]=N),ee&&C(ee,ne.id)}for(const ne of n.messageFlows??[])b(ne.id),f.push({id:ne.id,source:kn(ne.sourceRef),target:kn(ne.targetRef),...typeof ne.name=="string"&&ne.name?{name:ne.name}:{}});I(n.artifacts??[]);for(const[ne,ce]of i)!q.has(ne)&&(ce.flowElements??[]).length>0&&u.push({id:ne,type:ce.$type,reason:"unreachable-process"})}else for(const q of i.values())C(q);const $=[],j=[],L=[],F=[],te=(q,ne)=>!!q&&!!ne&&E.has(q)&&E.has(ne);for(const q of p){if(!te(q.source,q.target)){u.push({id:q.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}$.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),E.add(q.id)}for(const q of f){if(!te(q.source,q.target)){u.push({id:q.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}j.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),E.add(q.id)}for(const q of h){if(!te(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}F.push({...q.id?{id:q.id}:{},source:q.source,target:q.target}),q.id&&E.add(q.id)}for(const q of d){if(!te(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}L.push({...q.id?{id:q.id}:{},source:q.source,target:q.target})}const ke=new Map(c.map(q=>[q.id,q]));for(const{owner:q,refs:ne}of g){const ce=ne.filter(ae=>w.has(ae)),ee=ke.get(q);ee&&ce.length&&(ee.members=ce)}for(const q of m)w.has(q.anchor)&&(l.placements[q.owner]={anchor:q.anchor,side:q.side,...q.offset!==void 0?{offset:q.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:$,...j.length?{messageFlows:j}:{},...a.length?{dataStores:a}:{},...F.length?{dataAssociations:F}:{},...s.length?{annotations:s}:{},...L.length?{associations:L}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function bx(e){const{definitions:t,warnings:n}=await Wc(e);return{...Gf(t),warnings:n}}function xx(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Wf(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Hf(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 Ex=Symbol("bpmn-editor");function wx(){const e=ot.ref(!1),t=ot.ref(!0),n=ot.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 Wf(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:Uc(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 Sx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zc={exports:{}},Uf;function Rx(){if(Uf)return Zc.exports;Uf=1;var e=Zc.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},Zc.exports}var Cx=Rx(),Px=Sx(Cx);function Dn(e){if(!(this instanceof Dn))return new Dn(e);e=e||[128,36,1],this._seed=e.length?Px.rack(e[0],e[1],e[2]):e}Dn.prototype.next=function(e){return this._seed(e||!0)},Dn.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Dn.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Dn.prototype.assigned=function(e){return this._seed.get(e)||!1},Dn.prototype.unclaim=function(e){delete this._seed.hats[e]},Dn.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const mt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};mt.td=mt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],mt.option=mt.optgroup=[1,'<select multiple="multiple">',"</select>"],mt.thead=mt.tbody=mt.colgroup=mt.caption=mt.tfoot=[1,"<table>","</table>"],mt.polyline=mt.ellipse=mt.polygon=mt.circle=mt.text=mt.line=mt.path=mt.rect=mt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function We(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(mt,i)?mt[i]:mt._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 Ax(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 zt(e,...t){const n=e.style;return P(t,function(i){i&&P(i,function(r,o){n[o]=r})}),e}function Lt(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const Tx=Object.prototype.toString;function Ye(e){return new yi(e)}function yi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}yi.prototype.add=function(e){return this.list.add(e),this},yi.prototype.remove=function(e){return Tx.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},yi.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},yi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},yi.prototype.array=function(){return Array.from(this.list)},yi.prototype.has=yi.prototype.contains=function(e){return this.list.contains(e)};function wa(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function er(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function Mx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Sa={},qf;function kx(){if(qf)return Sa;qf=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Sa.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Sa.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Sa}var Yf=kx(),Dx=Mx(Yf),ve=Ax({__proto__:null,default:Dx},[Yf]),Kf=["focus","blur"];function Ox(e,t,n,i,r){return Kf.indexOf(n)!==-1&&(r=!0),ve.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=er(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function Ix(e,t,n,i){return Kf.indexOf(t)!==-1&&(i=!0),ve.unbind(e,t,n,i)}var Xt={bind:Ox,unbind:Ix};function Qc(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function $e(e,t){return t=t||document,t.querySelector(e)}function Ra(e,t){return t=t||document,t.querySelectorAll(e)}function On(e){e.parentNode&&e.parentNode.removeChild(e)}function Lx(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function Bx(e,t){return t.appendChild(Lx(e,t))}function ye(e,t){return Bx(t,e),e}var Jc=2,Xf={"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":Jc,"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":Jc,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function Nx(e,t){return Xf[t]?e.style[t]:e.getAttributeNS(null,t)}function Zf(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Xf[i];r?(r===Jc&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function $x(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Zf(e,r,t[r])}function Z(e,t,n){if(typeof t=="string")if(n!==void 0)Zf(e,t,n);else return Nx(e,t);else $x(e,t);return e}const jx=Object.prototype.toString;function Me(e){return new _i(e)}function _i(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}_i.prototype.add=function(e){return this.list.add(e),this},_i.prototype.remove=function(e){return jx.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},_i.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},_i.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},_i.prototype.array=function(){return Array.from(this.list)},_i.prototype.has=_i.prototype.contains=function(e){return this.list.contains(e)};function Ca(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Qf(e){return e.cloneNode(!0)}var eu={svg:"http://www.w3.org/2000/svg"},Jf='<svg xmlns="'+eu.svg+'"';function Fx(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(eu.svg)===-1&&(e=Jf+e.substring(4)):(e=Jf+">"+e+"</svg>",t=!0);var n=Hx(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function Hx(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function oe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=Fx(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(eu.svg,e),t&&Z(n,t),n}var tu=null;function ed(){return tu===null&&(tu=oe("svg")),tu}function td(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function zx(e,t,n,i,r,o){var a=ed().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return td(a,e);case 6:return td(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function uo(e){return ed().createSVGTransform()}var nd=/([&<>]{1})/g,Vx=/([&<>\n\r"]{1})/g,Gx={"&":"&","<":"<",">":">",'"':"'"};function nu(e,t){function n(i,r){return Gx[r]||r}return e.replace(t,n)}function id(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(nu(e.textContent,nd));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,'="',nu(o.value,Vx),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)id(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",nu(e.nodeValue,nd),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function Wx(e){for(var t=e.firstChild,n=[];t;)id(t,n),t=t.nextSibling;return n.join("")}function rd(e,t){return Wx(e)}function gt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function Ux(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function qx(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(Ux(e,i))}function lo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),qx(n,t)),n.consolidate()}const Yx=/^class[ {]/;function Kx(e){return Yx.test(e.toString())}function iu(e){return Array.isArray(e)}function ru(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Pa(...e){e.length===1&&iu(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const Xx=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Zx=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,Qx=/\/\*([^*]*)\*\//m;function Jx(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(Kx(e)?Xx:Zx);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(Qx);return(r&&r[1]||i).trim()})||[]}function od(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 A=c(S.shift());for(;S.length;)A=A[S.shift()];return A}if(ru(o,b))return o[b];if(ru(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(iu(b))b=Pa(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const A=(b.$inject||Jx(b)).map(I=>ru(x,I)?x[I]:c(I));return{fn:b,dependencies:A}}function l(b){const{fn:x,dependencies:S}=u(b),A=Function.prototype.bind.call(x,null,...S);return new A}function p(b,x,S){const{fn:A,dependencies:I}=u(b,S);return A.apply(x,I)}function f(b){return Pa(x=>b.get(x))}function d(b,x){if(x&&x.length){const S=Object.create(null),A=Object.create(null),I=[],C=[],$=[];let j,L,F,te;for(let ke in r)j=r[ke],x.indexOf(ke)!==-1&&(j[2]==="private"?(L=I.indexOf(j[3]),L===-1?(F=j[3].createChild([],x),te=f(F),I.push(j[3]),C.push(F),$.push(te),S[ke]=[te,ke,"private",F]):S[ke]=[$[L],ke,"private",C[L]]):S[ke]=[j[2],j[1]],A[ke]=!0),(j[2]==="factory"||j[2]==="type")&&j[1].$scope&&x.forEach(Je=>{j[1].$scope.indexOf(Je)!==-1&&(S[ke]=[j[2],j[1]],A[Je]=!0)});x.forEach(ke=>{if(!A[ke])throw new Error('No provider for "'+ke+'". Cannot use provider from the parent!')}),b.unshift(S)}return new od(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(A=>{typeof A=="string"?x.get(A):x.invoke(A)})}}function g(b){const x=b.__exports__;if(x){const S=b.__modules__,A=Object.keys(b).reduce((L,F)=>(F!=="__exports__"&&F!=="__modules__"&&F!=="__init__"&&F!=="__depends__"&&(L[F]=b[F]),L),Object.create(null)),I=(S||[]).concat(A),C=d(I),$=Pa(function(L){return C.get(L)});x.forEach(function(L){r[L]=[$,L,"private",C]});const j=(b.__init__||[]).slice();return j.unshift(function(){C.init()}),b=Object.assign({},b,{__init__:j}),m(b,C)}return Object.keys(b).forEach(function(S){if(S==="__init__"||S==="__depends__")return;const A=b[S];if(A[2]==="private"){r[S]=A;return}const I=A[0],C=A[1];r[S]=[h[I],eE(I,C),I]}),m(b,a)}function w(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(w,b),b.indexOf(x)!==-1)?b:b.concat(x)}function E(b){const x=b.reduce(w,[]).map(g);let S=!1;return function(){S||(S=!0,x.forEach(A=>A()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=E(e)}function eE(e,t){return e!=="value"&&iu(t)&&(t=Pa(t.slice())),t}var tE=1e3;function Yn(e,t){var n=this;t=t||tE,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)})}Yn.prototype.canRender=function(e){},Yn.prototype.drawShape=function(e,t){},Yn.prototype.drawConnection=function(e,t){},Yn.prototype.getShapePath=function(e){},Yn.prototype.getConnectionPath=function(e){};function tr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function nE(e){return["M",e.x,e.y]}function ou(e){return["L",e.x,e.y]}function iE(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function rE(e,t){const n=e.length,i=[nE(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(ou(a));continue}const c=Math.min(t,au(a.x-o.x,a.y-o.y),au(s.x-a.x,s.y-a.y));if(!c){i.push(ou(a));continue}const u=Aa(a,o,c),l=Aa(a,o,c*.5),p=Aa(a,s,c),f=Aa(a,s,c*.5);i.push(ou(u)),i.push(iE(l,f,p))}return i}function Aa(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=au(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function au(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function po(e,t,n){me(t)&&(n=t,t=null),t||(t={});const i=oe("path",t);return me(n)&&(i.dataset.cornerRadius=String(n)),su(i,e)}function su(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Z(e,{d:tr(rE(t,n))}),e}function Ta(e){var t=new Set(e);return Re(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function nr(e,t,n){n=n||0,pe(e)||(e=[e]),P(e,function(i,r){var o=t(i,r,n);pe(o)&&o.length&&nr(o,t,n+1)})}function cu(e,t,n){var i=new Set,r=new Set;return nr(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 fo(e,t){return cu(e)}function oE(e,t,n){Ui(t)&&(t=!0),bt(t)&&(n=t,t=!0),n=n||{};var i=ho(n.allShapes),r=ho(n.allConnections),o=ho(n.enclosedElements),a=ho(n.enclosedConnections),s=ho(n.topLevel,t&&br(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,P(l.incoming,c),P(l.outgoing,c),l.children}return nr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function at(e,t){t=!!t,pe(e)||(e=[e]);var n,i,r,o;return P(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 Cr(e,t){var n={};return P(e,function(i){var r=i;r.waypoints&&(r=at(r)),!me(t.y)&&r.x>t.x&&(n[i.id]=i),!me(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(me(t.width)&&me(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!me(t.width)||!me(t.height))&&(n[i.id]=i)}),n}function ad(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function sd(e){return!!(e&&e.isFrame)}function ho(e,t){return k({},e||{},t||{})}var aE=1;function bi(e,t){Yn.call(this,e,aE),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(bi,Yn),bi.prototype.canRender=function(){return!0},bi.prototype.drawShape=function(t,n,i){var r=oe("rect");return Z(r,{x:0,y:0,width:n.width||0,height:n.height||0}),sd(n)?Z(r,k({},this.FRAME_STYLE,i||{})):Z(r,k({},this.SHAPE_STYLE,i||{})),ye(t,r),r},bi.prototype.drawConnection=function(t,n,i){var r=po(n.waypoints,k({},this.CONNECTION_STYLE,i||{}));return ye(t,r),r},bi.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 tr(a)},bi.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 tr(o)},bi.$inject=["eventBus","styles"];function sE(){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 k(o,{class:n})},this.style=function(n,i){!pe(n)&&!i&&(i=n,n=[]);var r=Kt(n,function(o,a){return k(o,e[a]||{})},{});return i?k(r,i):r},this.computeStyle=function(n,i,r){return pe(i)||(r=i,i=[]),t.style(i||[],k({},r,n||{}))}}const cE={__init__:["defaultRenderer"],defaultRenderer:["type",bi],styles:["type",sE]};function et(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function it(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 uu(e,t){return!e||!t?-1:e.indexOf(t)}function mo(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function lu(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=mo(e,t);return Math.abs(r/o)<=i}var uE=2;function Kn(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(lE(r,n))return o;return!1}function lE(e,t){const n=t[0];return qi(t,function(i){return Math.abs(n[e]-i[e])<=uE})}function cd(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 pu(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var pE=/,?([a-z]),?/gi,ud=parseFloat,st=Math,xi=st.PI,In=st.min,Ln=st.max,ld=st.pow,Ei=st.abs,fE=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,dE=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,pd=Array.isArray||function(e){return e instanceof Array};function hE(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function mE(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 gE(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 hE(r,i)?(mE(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function vE(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(fE,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(dE,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=du,n}function yE(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 _E(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 fu(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 du(){return this.join(",").replace(pE,"$1")}function bE(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=du,t}function fd(e,t,n,i,r,o,a,s,c){var u=1-c,l=ld(u,3),p=ld(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:Ma(h),y:Ma(m)}}function dd(e){var t=CE(...e);return fu(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function wi(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function xE(e,t){return e=fu(e),t=fu(t),wi(t,e.x,e.y)||wi(t,e.x2,e.y)||wi(t,e.x,e.y2)||wi(t,e.x2,e.y2)||wi(e,t.x,t.y)||wi(e,t.x2,t.y)||wi(e,t.x,t.y2)||wi(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 hd(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 md(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=hd(m,e,n,r,a),w=hd(m,t,i,o,s),E=g*g+w*w;d+=f[h]*st.sqrt(E)}return u*d}function EE(e,t,n,i,r,o,a,s){if(!(Ln(e,n)<In(r,a)||In(e,n)>Ln(r,a)||Ln(t,i)<In(o,s)||In(t,i)>Ln(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=Ma(c/l),f=Ma(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+In(e,n).toFixed(2)||d>+Ln(e,n).toFixed(2)||d<+In(r,a).toFixed(2)||d>+Ln(r,a).toFixed(2)||h<+In(t,i).toFixed(2)||h>+Ln(t,i).toFixed(2)||h<+In(o,s).toFixed(2)||h>+Ln(o,s).toFixed(2)))return{x:p,y:f}}}}function Ma(e){return Math.round(e*1e11)/1e11}function wE(e,t,n){var i=dd(e),r=dd(t);if(!xE(i,r))return[];var o=md(...e),a=md(...t),s=vd(e)?1:~~(o/5)||1,c=vd(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=fd(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=fd(...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],w=u[d+1],E=l[h],b=l[h+1],x=Ei(w.x-g.x)<.01?"y":"x",S=Ei(b.x-E.x)<.01?"y":"x",A=EE(g.x,g.y,w.x,w.y,E.x,E.y,b.x,b.y),I;if(A){if(I=A.x.toFixed(9)+"#"+A.y.toFixed(9),p[I])continue;p[I]=!0;var C=g.t+Ei((A[x]-g[x])/(w[x]-g[x]))*(w.t-g.t),$=E.t+Ei((A[S]-E[S])/(b[S]-E[S]))*(b.t-E.t);C>=0&&C<=1&&$>=0&&$<=1&&f.push({x:A.x,y:A.y,t1:C,t2:$})}}return f}function gd(e,t,n){e=bd(e),t=bd(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 w=0,E=t.length;w<E;w++){var b=t[w];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=wE(p,f);{for(var S=0,A=x.length;S<A;S++)x[S].segment1=h,x[S].segment2=w,x[S].bez1=p,x[S].bez2=f;d=d.concat(x)}}}}}return d}function SE(e){return pd(e)&&pd(e[0])}function RE(e){if(yE(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=du,t}function vd(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function ka(e,t,n,i){return[e,t,n,i,n,i]}function yd(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 _d(e,t,n,i,r,o,a,s,c,u){var l=xi*120/180,p=xi/180*(+r||0),f=[],d,h=gE(function(R,_,v){var M=R*st.cos(v)-_*st.sin(v),O=R*st.sin(v)+_*st.cos(v);return{x:M,y:O}});if(u)I=u[0],C=u[1],S=u[2],A=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,w=m*m/(n*n)+g*g/(i*i);w>1&&(w=st.sqrt(w),n=w*n,i=w*i);var E=n*n,b=i*i,x=(o==a?-1:1)*st.sqrt(Ei((E*b-E*g*g-b*m*m)/(E*g*g+b*m*m))),S=x*n*g/i+(e+s)/2,A=x*-i*m/n+(t+c)/2,I=st.asin(((t-A)/i).toFixed(9)),C=st.asin(((c-A)/i).toFixed(9));I=e<S?xi-I:I,C=s<S?xi-C:C,I<0&&(I=xi*2+I),C<0&&(C=xi*2+C),a&&I>C&&(I=I-xi*2),!a&&C>I&&(C=C-xi*2)}var $=C-I;if(Ei($)>l){var j=C,L=s,F=c;C=I+l*(a&&C>I?1:-1),s=S+n*st.cos(C),c=A+i*st.sin(C),f=_d(s,c,n,i,r,0,a,L,F,[C,j,S,A])}$=C-I;var te=st.cos(I),ke=st.sin(I),Je=st.cos(C),q=st.sin(C),ne=st.tan($/4),ce=4/3*n*ne,ee=4/3*i*ne,ae=[e,t],Y=[e+ce*ke,t-ee*te],B=[s+ce*q,c-ee*Je],N=[s,c];if(Y[0]=2*ae[0]-Y[0],Y[1]=2*ae[1]-Y[1],u)return[Y,B,N].concat(f);f=[Y,B,N].concat(f).join().split(",");for(var V=[],Ee=0,_t=f.length;Ee<_t;Ee++)V[Ee]=Ee%2?h(f[Ee-1],f[Ee],p).y:h(f[Ee],f[Ee+1],p).x;return V}function CE(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,h,m,g,w,E=0;E<2;++E){if(E==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),Ei(l)<1e-12){if(Ei(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*l,w=st.sqrt(g),!(g<0)&&(h=(-p+w)/(2*l),0<h&&h<1&&c.push(h),m=(-p-w)/(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:In(...u[0]),y0:In(...u[1]),x1:Ln(...u[0]),y1:Ln(...u[1])}}function bd(e){if(SE(e)||(e=vE(e)),_E(e))return e;for(var t=bE(RE(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",..._d(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",...yd(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",...yd(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...ka(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...ka(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...ka(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...ka(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=ud(l[p-4])||n.x,n.by=ud(l[p-3])||n.y}return t}function je(e){return bt(e)&&Yt(e,"waypoints")}function xe(e){return bt(e)&&Yt(e,"labelTarget")}function PE(e){return bt(e)&&yr(e.parent)}function xd(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Xn(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function ue(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Da(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function AE(e){return Xn({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function TE(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=DE(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 fe(e){return je(e)?TE(e):AE(e)}function Rt(e,t,n){n=n||0,bt(n)||(n={x:n,y:n});var i=ue(e),r=ue(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 go(e,t,n){var i=ME(e,t);return i.length===1||i.length===2&&mo(i[0],i[1])<1?Xn(i[0]):i.length>1?(i=Pn(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Xn(i[n?0:i.length-1])):null}function ME(e,t){return gd(e,t)}function kE(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],mo(n,r)===0||lu(i,r,n)?e.splice(t,1):t++;return e}function DE(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Oa(e,t){return Math.round(e*t)/t}function Ed(e){return me(e)?e+"px":e}function OE(e){for(;e.parent;)e=e.parent;return e}function IE(e){e=k({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),zt(n,{position:"relative",overflow:"hidden",width:Ed(e.width),height:Ed(e.height)}),t.appendChild(n),n}function wd(e,t,n){const i=oe("g");Me(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const LE="base",Sd=0,BE=1,NE={shape:["x","y","width","height"],connection:["waypoints"]};function de(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||{})}de.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],de.prototype._init=function(e){const t=this._eventBus,n=this._container=IE(e),i=this._svg=oe("svg");Z(i,{width:"100%",height:"100%"}),Lt(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")}),ye(n,i);const r=this._viewport=wd(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Dc(this._viewboxChanged,300)),this._restoreFocus=Dc(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)},de.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},de.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},de.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=ad(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},de.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},de.prototype.restoreFocus=function(){this._restoreFocus()},de.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},de.prototype.isFocused=function(){return this._focused},de.prototype.getDefaultLayer=function(){return this.getLayer(LE,Sd)},de.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},de.prototype._getChildIndex=function(e){return Kt(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},de.prototype._createLayer=function(e,t){typeof t>"u"&&(t=BE);const n=this._getChildIndex(t);return{group:wd(this._viewport,"layer-"+e,n),index:t,visible:!0}},de.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},de.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&&(gt(n),t.visible=!1),n},de.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],gt(t.group))},de.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},de.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(OE(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},de.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},de.prototype._findPlaneForRoot=function(e){return ze(this._planes,function(t){return t.rootElement===e})},de.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},de.prototype._resolveElements=function(e){return pe(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},de.prototype.getContainer=function(){return this._container},de.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&&(P([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Me(r).add(t)):(e.markers.delete(t),Me(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},de.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},de.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},de.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},de.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},de.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},de.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,Sd);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},de.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},de.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},de.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)},de.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})},de.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})},de.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=NE[e];if(!qi(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},de.prototype._setParent=function(e,t,n){it(t.children,e,n),e.parent=t},de.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},de.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},de.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},de.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),et(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},de.prototype.removeShape=function(e){return this._removeElement(e,"shape")},de.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},de.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},de.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},de.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},de.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);lo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=lo(t),r=a?a.matrix:zx(),s=Oa(r.a,1e3),c=Oa(-r.e||0,1e3),u=Oa(-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},de.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=k({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Rd(t,n)}),{x:n.e,y:n.f}},de.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=ue(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=ue(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),w=Math.min(0,s.top-f.top);l=h||m,p=g||w}this.scroll({dx:-l*u,dy:-p*u})},de.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)}),Oa(i.a,1e3)};function Rd(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}de.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},de.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=k(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),Rd(this._viewport,l),l},de.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},de.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}},de.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Pr="data-element-id";function sn(e){this._elements={},this._eventBus=e}sn.$inject=["eventBus"],sn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Z(t,Pr,i),n&&Z(n,Pr,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},sn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Z(i.gfx,Pr,""),i.secondaryGfx&&Z(i.secondaryGfx,Pr,""),delete t[n])},sn.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)},sn.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,Pr,i),t},sn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Z(e,Pr);var n=this._elements[t];return n&&n.element},sn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},sn.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}},sn.prototype.getAll=function(){return this.filter(function(e){return e})},sn.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)})},sn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},sn.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 $E(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 jE(e){return e.__refs_collection===!0}function FE(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Cd(e,t,n){var i=$E(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 HE(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 pn(e,t){if(!(this instanceof pn))return new pn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}pn.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?Cd(this,t,e):HE(this,t,e)},pn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return jE(n)||Cd(this,t,e),n},pn.prototype.ensureBound=function(e,t){FE(e,t)||this.bind(e,t)},pn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},pn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var hu=new pn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Pd=new pn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Ad=new pn({name:"attachers",collection:!0},{name:"host"}),Td=new pn({name:"outgoing",collection:!0},{name:"source"}),Md=new pn({name:"incoming",collection:!0},{name:"target"});function Ar(){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)}}),hu.bind(this,"parent"),Pd.bind(this,"labels"),Td.bind(this,"outgoing"),Md.bind(this,"incoming")}function vo(){Ar.call(this),hu.bind(this,"children"),Ad.bind(this,"host"),Ad.bind(this,"attachers")}X(vo,Ar);function kd(){Ar.call(this),hu.bind(this,"children")}X(kd,vo);function Dd(){vo.call(this),Pd.bind(this,"labelTarget")}X(Dd,vo);function Od(){Ar.call(this),Td.bind(this,"source"),Md.bind(this,"target")}X(Od,Ar);var zE={connection:Od,shape:vo,label:Dd,root:kd};function VE(e,t){var n=zE[e];if(!n)throw new Error("unknown type: <"+e+">");return k(new n,t)}function GE(e){return e instanceof Ar}function Zn(){this._uid=12}Zn.prototype.createRoot=function(e){return this.create("root",e)},Zn.prototype.createLabel=function(e){return this.create("label",e)},Zn.prototype.createShape=function(e){return this.create("shape",e)},Zn.prototype.createConnection=function(e){return this.create("connection",e)},Zn.prototype.create=function(e,t){return t=k({},t||{}),t.id||(t.id=e+"_"+this._uid++),VE(e,t)};var Ia="__fn",Id=1e3,WE=Array.prototype.slice;function Zt(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Zt.prototype.on=function(e,t,n,i){if(e=pe(e)?e:[e],xt(t)&&(i=n,n=t,t=Id),!me(t))throw new Error("priority must be a number");var r=n;i&&(r=Gt(n,i),r[Ia]=n[Ia]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Zt.prototype.once=function(e,t,n,i){var r=this;if(xt(t)&&(i=n,n=t,t=Id),!me(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[Ia]=n,this.on(e,t,o)},Zt.prototype.off=function(e,t){e=pe(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Zt.prototype.createEvent=function(e){var t=new yo;return t.init(e),t},Zt.prototype.fire=function(e,t){var n,i,r,o;if(o=WE.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 yo?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}},Zt.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Zt.prototype._destroy=function(){this._listeners={}},Zt.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Zt.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=UE(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},Zt.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},Zt.prototype._getListeners=function(e){return this._listeners[e]},Zt.prototype._setListeners=function(e,t){this._listeners[e]=t},Zt.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[Ia]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function yo(){}yo.prototype.stopPropagation=function(){this.cancelBubble=!0},yo.prototype.preventDefault=function(){this.defaultPrevented=!0},yo.prototype.init=function(e){k(this,e||{})};function UE(e,t){return e.apply(null,t)}function ir(e){return e.childNodes[0]}function qE(e){return e.parentNode.childNodes[1]}function La(e,t,n,i,r){var o=uo();o.setTranslate(t,n);var a=uo();a.setRotate(i||0,0,0);var s=uo();s.setScale(1,1),lo(e,[o,a,s])}function Ct(e,t,n){var i=uo();i.setTranslate(t,n),lo(e,i)}function Ld(e,t){var n=uo();n.setRotate(t,0,0),lo(e,n)}function cn(e,t){this._eventBus=e,this._elementRegistry=t}cn.$inject=["eventBus","elementRegistry"],cn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=qE(t),n||(n=oe("g"),Me(n).add("djs-children"),ye(t.parentNode,n))):n=t,n},cn.prototype._clear=function(e){var t=ir(e);return wa(t),t},cn.prototype._createContainer=function(e,t,n,i){var r=oe("g");Me(r).add("djs-group"),typeof n<"u"?YE(r,t,t.childNodes[n]):ye(t,r);var o=oe("g");Me(o).add("djs-element"),Me(o).add("djs-"+e),i&&Me(o).add("djs-frame"),ye(r,o);var a=oe("g");return Me(a).add("djs-visual"),ye(o,a),o},cn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,sd(t))},cn.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},{}),P(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;P(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},cn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},cn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},cn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},cn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},cn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Ct(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")}},cn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);gt(t.parentNode)};function YE(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const KE={__depends__:[cE],__init__:["canvas"],canvas:["type",de],elementRegistry:["type",sn],elementFactory:["type",Zn],eventBus:["type",Zt],graphicsFactory:["type",cn]};function XE(e){var t=new od(e);return t.init(),t}function ZE(e){e=e||{};var t={config:["value",e]},n=[t,KE].concat(e.modules||[]);return XE(n)}function Si(e,t){this._injector=t||ZE(e),this.get("eventBus").fire("diagram.init")}Si.prototype.get=function(e,t){return this._injector.get(e,t)},Si.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Si.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Si.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Bt(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Wt(e,t){return e.$instanceOf(t)}function QE(e){return ze(e.rootElements,function(t){return Wt(t,"bpmn:Process")||Wt(t,"bpmn:Collaboration")})}function JE(e){var t={},n=[],i={};function r(B,N){return function(V){B(V,N)}}function o(B){t[B.id]=B}function a(B){return t[B.id]}function s(B,N){var V=B.gfx;if(V)throw new Error(`already rendered ${Bt(B)}`);return e.element(B,i[B.id],N)}function c(B,N){return e.root(B,i[B.id],N)}function u(B,N){try{var V=i[B.id]&&s(B,N);return o(B),V}catch(Ee){l(Ee.message,{element:B,error:Ee}),console.error(`failed to import ${Bt(B)}`,Ee)}}function l(B,N){e.error(B,N)}var p=this.registerDi=function(N){var V=N.bpmnElement;V?i[V.id]?l(`multiple DI elements defined for ${Bt(V)}`,{element:V}):i[V.id]=N:l(`no bpmnElement referenced in ${Bt(N)}`,{element:N})};function f(B){d(B.plane)}function d(B){p(B),P(B.planeElement,h)}function h(B){p(B)}this.handleDefinitions=function(N,V){var Ee=N.diagrams;if(V&&Ee.indexOf(V)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!V&&Ee&&Ee.length&&(V=Ee[0]),!V)throw new Error("no diagram to display");i={},f(V);var _t=V.plane;if(!_t)throw new Error(`no plane for ${Bt(V)}`);var R=_t.bpmnElement;if(!R)if(R=QE(N),R)l(`correcting missing bpmnElement on ${Bt(_t)} to ${Bt(R)}`),_t.bpmnElement=R,p(_t);else throw new Error("no process or collaboration to display");var _=c(R,_t);if(Wt(R,"bpmn:Process")||Wt(R,"bpmn:SubProcess"))g(R,_);else if(Wt(R,"bpmn:Collaboration"))ae(R,_),w(N.rootElements,_);else throw new Error(`unsupported bpmnElement for ${Bt(_t)}: ${Bt(R)}`);m(n)};var m=this.handleDeferred=function(){for(var N;n.length;)N=n.shift(),N()};function g(B,N){ne(B,N),$(B.ioSpecification,N),C(B.artifacts,N),o(B)}function w(B,N){var V=Re(B,function(Ee){return!a(Ee)&&Wt(Ee,"bpmn:Process")&&Ee.laneSets});V.forEach(r(g,N))}function E(B,N){u(B,N)}function b(B,N){P(B,r(E,N))}function x(B,N){u(B,N)}function S(B,N){u(B,N)}function A(B,N){u(B,N)}function I(B,N){u(B,N)}function C(B,N){P(B,function(V){Wt(V,"bpmn:Association")?n.push(function(){I(V,N)}):I(V,N)})}function $(B,N){B&&(P(B.dataInputs,r(S,N)),P(B.dataOutputs,r(A,N)))}var j=this.handleSubProcess=function(N,V){ne(N,V),C(N.artifacts,V)};function L(B,N){var V=u(B,N);Wt(B,"bpmn:SubProcess")&&j(B,V||N),Wt(B,"bpmn:Activity")&&$(B.ioSpecification,N),n.push(function(){P(B.dataInputAssociations,r(x,N)),P(B.dataOutputAssociations,r(x,N))})}function F(B,N){u(B,N)}function te(B,N){u(B,N)}function ke(B,N){n.push(function(){var V=u(B,N);B.childLaneSet&&Je(B.childLaneSet,V||N),Y(B)})}function Je(B,N){P(B.lanes,r(ke,N))}function q(B,N){P(B,r(Je,N))}function ne(B,N){ce(B.flowElements,N),B.laneSets&&q(B.laneSets,N)}function ce(B,N){P(B,function(V){Wt(V,"bpmn:SequenceFlow")?n.push(function(){F(V,N)}):Wt(V,"bpmn:BoundaryEvent")?n.unshift(function(){L(V,N)}):Wt(V,"bpmn:FlowNode")?L(V,N):Wt(V,"bpmn:DataObject")||(Wt(V,"bpmn:DataStoreReference")||Wt(V,"bpmn:DataObjectReference")?te(V,N):l(`unrecognized flowElement ${Bt(V)} in context ${Bt(N&&N.businessObject)}`,{element:V,context:N}))})}function ee(B,N){var V=u(B,N),Ee=B.processRef;Ee&&g(Ee,V||N)}function ae(B,N){P(B.participants,r(ee,N)),n.push(function(){b(B.messageFlows,N)}),C(B.artifacts,N)}function Y(B){P(B.flowNodeRef,function(N){var V=N.get("lanes");V&&V.push(B)})}}function y(e,t){var n=U(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Se(e,t){return di(t,function(n){return y(e,n)})}function U(e){return e&&e.businessObject||e}function De(e){return e&&e.di}function ew(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,w){return i.add(m,g,w)},error:function(m,g){s.push({message:m,context:g})}},f=new JE(p);l=l||u.diagrams&&u.diagrams[0];var d=tw(u,l);if(!d)throw new Error("no diagram to display");P(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 tw(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!y(n,"bpmn:Process")&&!y(n,"bpmn:Collaboration")&&(i=nw(n));var r;y(i,"bpmn:Collaboration")?r=i:r=ze(e.rootElements,function(u){if(y(u,"bpmn:Collaboration"))return ze(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=Dt(r.participants,function(u){return u.processRef}),o.push(r));var a=Bd(o),s=[t],c=[n];return P(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 Bd(e){var t=[];return P(e,function(n){n&&(t.push(n),t=t.concat(Bd(n.flowElements)))}),t}function nw(e){for(var t=e;t;){if(y(t,"bpmn:Process"))return t;t=t.$parent}}var iw='<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>',Nd=iw,$d={verticalAlign:"middle"},jd={color:"#404040"},rw={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},ow={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},aw={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"},sw='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Nd+'</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>',Bn;function cw(){Bn=We(sw),zt(Bn,rw),zt($e("svg",Bn),$d),zt($e(".backdrop",Bn),ow),zt($e(".notice",Bn),aw),zt($e(".link",Bn),jd,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function uw(){Bn||(cw(),Xt.bind(Bn,".backdrop","click",function(e){document.body.removeChild(Bn)})),document.body.appendChild(Bn)}const Ba=5,Fd="djs-outline-hidden";function Ke(e){e=k({},pw,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),dw(this._container)}X(Ke,Si),Ke.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||[]),Na(s,o),s=lw(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Ke.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Ke.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Na(o,[]),o}if(typeof t=="string"&&(i=fw(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Na(o,[]),o}try{this.clear()}catch(o){throw Na(o,[]),o}const{warnings:r}=await ew(this,n,i);return{warnings:r}},Ke.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},Ke.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=$e(":scope > defs",i._svg),a=rd(r),s=o?"<defs>"+rd(o)+"</defs>":"",c=i.getContainer();Ye(c).add(Fd);let u;try{u=r.getBBox()}finally{Ye(c).remove(Fd)}const l=u.x-Ba,p=u.y-Ba,f=u.width+Ba*2,d=u.height+Ba*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
1
|
+
(function(se,It){typeof exports=="object"&&typeof module<"u"?It(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],It):(se=typeof globalThis<"u"?globalThis:se||self,It(se.BpmnModeler={},se.Vue))})(this,(function(se,It){"use strict";var OL=Object.defineProperty;var DL=(se,It,Ar)=>It in se?OL(se,It,{enumerable:!0,configurable:!0,writable:!0,value:Ar}):se[It]=Ar;var to=(se,It,Ar)=>DL(se,typeof It!="symbol"?It+"":It,Ar);const Ar=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent"],us=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function md(e){return Ar.includes(e)}function gd(e){return us.includes(e)}const yd="http://g1project.net/spec/bpmn/bwl/1.0",Fu="bwl",ju=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],vd={name:"bwl-hints",uri:yd,prefix:Fu,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"}]}]},Hu="bwl.undoEpisode",bd=new WeakSet;function F0(e){bd.has(e)||(e.register(Hu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),bd.add(e))}function xd(e,t){F0(e);const n={run:t};if(e.execute(Hu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const _d=["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"],j0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},H0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},z0={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},G0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ).",properties:{id:{type:"string"},type:{type:"string",enum:[...us]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},V0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},W0={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},U0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Y0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},q0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},K0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},X0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Z0={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},Q0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...ju]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function ln(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const J0={"participant.add":ln("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":ln("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":ln("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":ln("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...us]},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":ln("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":ln("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":ln("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":ln("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":ln("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":ln("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":ln("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":ln("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":ln("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":ln("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":ln("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":ln("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":ln("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},wd={anyOf:_d.map(e=>J0[e])},ew={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:H0,irParticipant:z0,irNode:G0,irFlowCondition:V0,irSequenceFlow:W0,irMessageFlow:U0,irDataStore:Y0,irDataAssociation:q0,irTextAnnotation:K0,irAssociation:X0,irGroup:Z0,bwlPlacement:Q0,nullableString:j0,symbolicOp:wd}};function zu(e){return Array.prototype.concat.apply([],e)}const Qo=Object.prototype.toString,tw=Object.prototype.hasOwnProperty;function Tr(e){return e===void 0}function zt(e){return e!==void 0}function no(e){return e==null}function De(e){return Qo.call(e)==="[object Array]"}function Kt(e){return Qo.call(e)==="[object Object]"}function Be(e){return Qo.call(e)==="[object Number]"}function Xt(e){const t=Qo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Tn(e){return Qo.call(e)==="[object String]"}function nw(e){if(!De(e))throw new Error("must supply array")}function Mn(e,t){return!no(e)&&tw.call(e,t)}function ht(e,t){const n=ps(t);let i;return $(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Ed(e,t){const n=ps(t);let i=De(e)?-1:void 0;return $(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ye(e,t){const n=ps(t);let i=[];return $(e,function(r,o){n(r,o)&&i.push(r)}),i}function $(e,t){let n,i;if(Tr(e))return;const r=De(e)?sw:aw;for(let o in e)if(Mn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function iw(e,t){if(Tr(e))return[];nw(e);const n=ps(t);return e.filter(function(i,r){return!n(i,r)})}function kn(e,t,n){return $(e,function(i,r){n=t(n,i,r)}),n}function Mr(e,t){return!!kn(e,function(n,i,r){return n&&t(i,r)},!0)}function Xi(e,t){return!!ht(e,t)}function pn(e,t){let n=[];return $(e,function(i,r){n.push(t(i,r))}),n}function ls(e){return e&&Object.keys(e)||[]}function rw(e){return ls(e).length}function io(e){return pn(e,t=>t)}function ro(e,t,n={}){return t=Gu(t),$(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Sd(e,...t){e=Gu(e);let n={};return $(t,r=>ro(r,e,n)),pn(n,function(r,o){return r[0]})}const ow=Sd;function di(e,t){t=Gu(t);let n=[];return $(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)}),pn(n,i=>i.v)}function oo(e){return function(t){return Mr(e,function(n,i){return t[i]===n})}}function Gu(e){return Xt(e)?e:t=>t[e]}function ps(e){return Xt(e)?e:t=>t===e}function aw(e){return e}function sw(e){return Number(e)}function Vu(e,t){let n,i,r,o;function a(f){let p=Date.now(),d=f?0:o+t-p;if(d>0)return s(d);e.apply(r,i),c()}function s(f){n=setTimeout(a,f)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...f){o=Date.now(),i=f,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function Cn(e,t){return e.bind(t)}function V(e,...t){return Object.assign(e,...t)}function cw(e,t,n){let i=e;return $(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];zt(a)&&no(s)&&(s=i[r]=isNaN(+a)?{}:[]),Tr(a)?Tr(n)?delete i[r]:i[r]=n:i=s}),e}function ui(e,t){let n={},i=Object(e);return $(t,function(r){r in i&&(n[r]=e[r])}),n}function hi(e,t){let n={},i=Object(e);return $(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Wu(){}Wu.prototype.get=function(e){return this.$model.properties.get(this,e)},Wu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Rd(e,t){this.model=e,this.properties=t}Rd.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Wu.prototype);$(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,Cn(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 uw=V(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Cd=V(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 Uu(e,t){var n=Cd[e];return n?n(t):t}function Yu(e){return!!uw[e]}function Pd(e){return!!Cd[e]}function fn(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 zn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}zn.prototype.build=function(){return ui(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},zn.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)},zn.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},zn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=fn(r[0],i),a=fn(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},zn.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},zn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},zn.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},zn.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},zn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},zn.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")},zn.prototype.hasProperty=function(e){return this.propertiesByName[e]},zn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||($(e.properties,Cn(function(o){o=V({},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 Zi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,$(e,Cn(this.registerPackage,this))}Zi.prototype.getPackage=function(e){return this.packageMap[e]},Zi.prototype.getPackages=function(){return this.packages},Zi.prototype.registerPackage=function(e){e=V({},e);var t=this.packageMap;Ad(t,e,"prefix"),Ad(t,e,"uri"),$(e.types,Cn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Zi.prototype.registerType=function(e,t){e=V({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:V({},e.meta||{})});var n=fn(e.name,t.prefix),i=n.name,r=Object.create(null);$(e.properties,Cn(function(o){var a=fn(o.name,n.prefix),s=a.name;Yu(o.type)||(o.type=fn(o.type,a.prefix).name),V(o,{ns:a,name:s}),r[s]=o},this)),V(e,{ns:n,name:i,propertiesByName:r}),$(e.extends,Cn(function(o){var a=fn(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},Zi.prototype.mapTypes=function(e,t,n){var i=Yu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=fn(c,Yu(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+">");$(i.superClass,n?a:s),t(i,!n),$(i.traits,a)},Zi.prototype.getEffectiveDescriptor=function(e){var t=fn(e),n=new zn(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},Zi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Ad(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function kr(e){this.model=e}kr.prototype.set=function(e,t,n){if(!Tn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;lw(n)?i?delete e[r]:delete e.$attrs[qu(t)]:i?r in e?e[r]=n:Td(e,i,n):e.$attrs[qu(t)]=n},kr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[qu(t)];var i=n.name;return!e[i]&&n.isMany&&Td(e,n,[]),e[i]},kr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=V({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},kr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},kr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},kr.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 lw(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 qu(e){return e.replace(/^:/,"")}function Kn(e,t={}){this.properties=new kr(this),this.factory=new Rd(this,this.properties),this.registry=new Zi(e,this.properties),this.typeCache=Object.create(null),this.config=t}Kn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Kn.prototype.getType=function(e){var t=this.typeCache,n=Tn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Kn.prototype.createAny=function(e,t,n){var i=fn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){cw(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}),$(n,function(a,s){Kt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Kn.prototype.getPackage=function(e){return this.registry.getPackage(e)},Kn.prototype.getPackages=function(){return this.registry.getPackages()},Kn.prototype.getElementDescriptor=function(e){return e.$descriptor},Kn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Kn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Kn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Md=String.fromCharCode,pw=Object.prototype.hasOwnProperty,fw=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Jo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Jo).forEach(function(e){Jo[e.toUpperCase()]=Jo[e]});function dw(e,t,n,i){return i?pw.call(Jo,i)?Jo[i]:"&"+i+";":Md(t||parseInt(n,16))}function Or(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(fw,dw):e}var kd="non-whitespace outside of root node";function Qi(e){return new Error(e)}function hw(e){return"missing namespace for prefix <"+e+">"}function fs(e){return{get:e,enumerable:!0}}function mw(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Od=Symbol("nameCache");function Ku(e){return e+"$uri"}function gw(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Ku(i)]=n;return t}function ds(){return{line:0,column:0}}function yw(e){throw e}function Dd(e){if(!this)return new Dd(e);var t=e&&e.proxy,n,i,r,o,a=yw,s,c,u,l,f=ds,p=!1,d=!1,m="",h=!1,g=!1,y=null,v=!1,b,x,C,P;function D(L){L instanceof Error||(L=Qi(L)),y=L,a(L,f)}function T(L){s&&(L instanceof Error||(L=Qi(L)),s(L,f))}this.on=function(L,z){if(typeof z!="function")throw Qi("required args <name, cb>");switch(L){case"openTag":i=z;break;case"text":n=z;break;case"closeTag":r=z;break;case"error":a=z;break;case"warn":s=z;break;case"cdata":o=z;break;case"attention":l=z;break;case"question":u=z;break;case"comment":c=z;break;default:throw Qi("unsupported event: "+L)}return this},this.ns=function(L){if(typeof L>"u"&&(L={}),typeof L!="object")throw Qi("required args <nsMap={}>");var z=Object.create(null),ae;for(ae in L)z[ae]=L[ae];return g=!0,P=z,this};function I(){b=g?[]:null,x=g?gw(P):null,C=[],f=ds,v=!1,y=null,d=!1,m=""}this.parse=function(L){if(typeof L!="string")throw Qi("required args <xml=string>");if(p)throw Qi("parse during stream; call end() first");return I(),k(L),f=ds,v=!1,y},this.write=function(L){if(typeof L!="string")throw Qi("required args <xml=string>");return p||(I(),p=!0),y||(m=k(m+L,!0)||""),this},this.end=function(){return p||I(),p=!1,y||k(m),m="",f=ds,v=!1,y},this.stop=function(){v=!0};function k(L,z=!1){var ae=null,me=null,Ue,$e=0,q=!1,le=!1,oe=0,fe=0,Oe,W,Y,Z,Me,mt,M,S,w,G="",U=0,X;function xe(ot,At){var yn=ot.indexOf(":");if(yn===-1)return ot;var Jt=x[ot.substring(0,yn)];return Jt?At===Jt?ot.substr(yn+1):Jt+ot.substr(yn):(T(hw(ot.substring(0,yn))),null)}function He(){if(X!==null)return X;var ot,At,yn=g&&x.xmlns,Jt=g&&h?[]:null,gt=U,Dt=G,cn=Dt.length,qo,Hn,ci,un,Yt,Sn={},Mi=new Set,vn,nt,st;e:for(;gt<cn;gt++)if(vn=!1,nt=Dt.charCodeAt(gt),!(nt===32||nt<14&&nt>8)){for((nt<65||nt>122||nt>90&&nt<97)&&nt!==95&&nt!==58&&(T("illegal first char attribute name"),vn=!0),st=gt+1;st<cn;st++)if(nt=Dt.charCodeAt(st),!(nt>96&&nt<123||nt>64&&nt<91||nt>47&&nt<59||nt===46||nt===45||nt===95)){if(nt===32||nt<14&&nt>8){T("missing attribute value"),gt=st;continue e}if(nt===61)break;T("illegal attribute name char"),vn=!0}if(Yt=Dt.substring(gt,st),Yt==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),vn=!0),nt=Dt.charCodeAt(st+1),nt===34)st=Dt.indexOf('"',gt=st+2),st===-1&&(st=Dt.indexOf("'",gt),st!==-1&&(T("attribute value quote missmatch"),vn=!0));else if(nt===39)st=Dt.indexOf("'",gt=st+2),st===-1&&(st=Dt.indexOf('"',gt),st!==-1&&(T("attribute value quote missmatch"),vn=!0));else for(T("missing attribute value quotes"),vn=!0,st=st+1;st<cn&&(nt=Dt.charCodeAt(st+1),!(nt===32||nt<14&&nt>8));st++);for(st===-1&&(T("missing closing quotes"),st=cn,vn=!0),vn||(ci=Dt.substring(gt,st)),gt=st;st+1<cn&&(nt=Dt.charCodeAt(st+1),!(nt===32||nt<14&&nt>8));st++)gt===st&&(T("illegal character after attribute end"),vn=!0);if(gt=st+1,vn)continue e;if(Mi.has(Yt)){T("attribute <"+Yt+"> already defined");continue}if(Mi.add(Yt),!g){Sn[Yt]=ci;continue}if(h){if(Hn=Yt==="xmlns"?"xmlns":Yt.charCodeAt(0)===120&&Yt.substr(0,6)==="xmlns:"?Yt.substr(6):null,Hn!==null){if(ot=Or(ci),At=Ku(Hn),un=P[ot],!un){if(Hn==="xmlns"||At in x&&x[At]!==ot)do un="ns"+$e++;while(typeof x[un]<"u");else un=Hn;P[ot]=un}x[Hn]!==un&&(qo||(x=mw(x),qo=!0),x[Hn]=un,Hn==="xmlns"&&(x[Ku(un)]=ot,yn=un),x[At]=ot),Sn[Yt]=ci;continue}Jt.push(Yt,ci);continue}Yt=xe(Yt,yn),Yt!==null&&(Sn[Yt]=ci)}if(h)for(gt=0,cn=Jt.length;gt<cn;gt++)Yt=xe(Jt[gt++],yn),ci=Jt[gt],Yt!==null&&(Sn[Yt]=ci);return X=Sn}function tt(){for(var ot=/(\r\n|\r|\n)/g,At=0,yn=0,Jt=0,gt=fe,Dt,cn;oe>=Jt&&(Dt=ot.exec(L),!(!Dt||(gt=Dt[0].length+Dt.index,gt>oe)));)At+=1,Jt=gt;return oe==-1?(yn=gt,cn=L.substring(fe)):fe===0?cn=L.substring(fe,oe):(yn=oe-Jt,cn=fe==-1?L.substring(oe):L.substring(oe,fe+1)),{data:cn,line:At,column:yn}}for(f=tt,t&&(w=Object.create({},{name:fs(function(){return M}),originalName:fs(function(){return S}),attrs:fs(He),ns:fs(function(){return x})}));fe!==-1;){if(L.charCodeAt(fe)===60?oe=fe:oe=L.indexOf("<",fe),oe===-1){if(z)return L.substring(fe);if(C.length)return D("unexpected end of file");if(!d)return D("missing start tag");fe<L.length&&L.substring(fe).trim()&&T(kd);return}if(d||(d=!0),fe!==oe){if(C.length){if(n&&(n(L.substring(fe,oe),Or,f),v))return}else if(L.substring(fe,oe).trim()&&(T(kd),v))return}if(Z=L.charCodeAt(oe+1),Z===33){if(Y=L.charCodeAt(oe+2),Y===91&&L.substr(oe+3,6)==="CDATA["){if(fe=L.indexOf("]]>",oe),fe===-1)return z?L.substring(oe):D("unclosed cdata");if(o&&(o(L.substring(oe+9,fe),f),v))return;fe+=3;continue}if(Y===45&&L.charCodeAt(oe+3)===45){if(fe=L.indexOf("-->",oe),fe===-1)return z?L.substring(oe):D("unclosed comment");if(c&&(c(L.substring(oe+4,fe),Or,f),v))return;fe+=3;continue}}if(Z===63){if(fe=L.indexOf("?>",oe),fe===-1)return z?L.substring(oe):D("unclosed question");if(u&&(u(L.substring(oe,fe+2),f),v))return;fe+=2;continue}for(Oe=oe+1;;Oe++){if(Me=L.charCodeAt(Oe),isNaN(Me))return z?L.substring(oe):(fe=-1,D("unclosed tag"));if(Me===34)Y=L.indexOf('"',Oe+1),Oe=Y!==-1?Y:Oe;else if(Me===39)Y=L.indexOf("'",Oe+1),Oe=Y!==-1?Y:Oe;else if(Me===62){fe=Oe;break}}if(Z===33){if(l&&(l(L.substring(oe,fe+1),Or,f),v))return;fe+=1;continue}if(X={},Z===47){if(q=!1,le=!0,!C.length)return D("missing open tag");if(Oe=M=C.pop(),Y=oe+2+Oe.length,L.substring(oe+2,Y)!==Oe)return D("closing tag mismatch");for(;Y<fe;Y++)if(Z=L.charCodeAt(Y),!(Z===32||Z>8&&Z<14))return D("close tag")}else{if(L.charCodeAt(fe-1)===47?(Oe=M=L.substring(oe+1,fe-1),q=!0,le=!0):(Oe=M=L.substring(oe+1,fe),q=!0,le=!1),!(Z>96&&Z<123||Z>64&&Z<91||Z===95||Z===58))return D("illegal first char nodeName");for(Y=1,W=Oe.length;Y<W;Y++)if(Z=Oe.charCodeAt(Y),!(Z>96&&Z<123||Z>64&&Z<91||Z>47&&Z<59||Z===45||Z===95||Z==46)){if(Z===32||Z<14&&Z>8){M=Oe.substring(0,Y),X=null;break}return D("invalid nodeName")}le||C.push(M)}if(g){Ue=x,q&&(le||b.push(Ue),X===null&&(h=Oe.indexOf("xmlns",Y)!==-1)&&(U=Y,G=Oe,He(),h=!1)),S=M,me!==x&&(ae=x[Od],ae===void 0&&(ae=x[Od]=Object.create(null)),me=x);var kt=ae[M];if(kt!==void 0)M=kt;else{if(Z=M.indexOf(":"),Z!==-1){if(mt=x[M.substring(0,Z)],!mt)return D("missing namespace on <"+S+">");M=M.substr(Z+1)}else mt=x.xmlns;mt&&(M=mt+":"+M),ae[S]=M}}if(q&&(U=Y,G=Oe,i&&(t?i(w,Or,le,f):i(M,He,Or,le,f),v)))return;if(le){if(r&&(r(t?w:M,Or,q,f),v))return;g&&(q?x=Ue:x=b.pop())}fe+=1}}}function Ld(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Xu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Id="property";function Bd(e){return e.xml&&e.xml.serialize}function vw(e){const t=Bd(e);return t!==Id&&(t||null)}function bw(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Nd(e,t){return Ld(t)?e.prefix+":"+bw(e.localName):e.name}function xw(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 _w(e,t,n){const i=fn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=fn(r);var a=n.getPackage(o.prefix);return xw(o,a)}function Ji(e){return new Error(e)}function ki(e){return e.$descriptor}function ww(e){V(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Ji("expected element");var n=this.elementsById,i=ki(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 Ji("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function ea(){}ea.prototype.handleEnd=function(){},ea.prototype.handleText=function(){},ea.prototype.handleNode=function(){};function Zu(){}Zu.prototype=Object.create(ea.prototype),Zu.prototype.handleNode=function(){return this};function ao(){}ao.prototype=Object.create(ea.prototype),ao.prototype.handleText=function(e){this.body=(this.body||"")+e};function ta(e,t){this.property=e,this.context=t}ta.prototype=Object.create(ao.prototype),ta.prototype.handleNode=function(e){if(this.element)throw Ji("expected no sub nodes");return this.element=this.createReference(e),this},ta.prototype.handleEnd=function(){this.element.id=this.body},ta.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Qu(e,t){this.element=t,this.propertyDesc=e}Qu.prototype=Object.create(ao.prototype),Qu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Uu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function hs(){}hs.prototype=Object.create(ao.prototype),hs.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 bn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}bn.prototype=Object.create(hs.prototype),bn.prototype.addReference=function(e){this.context.addReference(e)},bn.prototype.handleText=function(e){var t=this.element,n=ki(t),i=n.bodyProperty;if(!i)throw Ji("unexpected body text <"+e+">");ao.prototype.handleText.call(this,e)},bn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=ki(t),i=n.bodyProperty;i&&e!==void 0&&(e=Uu(i.type,e),t.set(i.name,e))},bn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=ki(n),r=this.context,o=new n({}),a=this.model,s;return $(t,function(c,u){var l=i.propertiesByName[u],f;l&&l.isReference?l.isMany?(f=c.split(" "),$(f,function(p){r.addReference({element:o,property:l.ns.name,id:p})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Uu(l.type,c):u==="xmlns"?u=":"+u:(s=fn(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},bn.prototype.getPropertyForNode=function(e){var t=e.name,n=fn(t),i=this.type,r=this.model,o=ki(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=vw(s);if(u){const l=e.attributes[u];if(l){const f=_w(l,e.ns,r),p=r.getType(f);return V({},s,{effectiveType:ki(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Nd(n,c),l=r.getType(u);if(s=ht(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&l.hasType(f.type)}),s)return V({},s,{effectiveType:ki(l).name})}else if(s=ht(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Ji("unrecognized element <"+n.name+">")},bn.prototype.toString=function(){return"ElementDescriptor["+ki(this.type).name+"]"},bn.prototype.valueHandler=function(e,t){return new Qu(e,t)},bn.prototype.referenceHandler=function(e){return new ta(e,this.context)},bn.prototype.handler=function(e){return e==="Element"?new so(this.model,e,this.context):new bn(this.model,e,this.context)},bn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Pd(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?(V(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Ju(e,t,n){bn.call(this,e,t,n)}Ju.prototype=Object.create(bn.prototype),Ju.prototype.createElement=function(e){var t=e.name,n=fn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Nd(n,o)||t;if(!r.hasType(a))throw Ji("unexpected element <"+e.originalName+">");return bn.prototype.createElement.call(this,e)};function so(e,t,n){this.model=e,this.context=n}so.prototype=Object.create(hs.prototype),so.prototype.createElement=function(e){var t=e.name,n=fn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},so.prototype.handleChild=function(e){var t=new so(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},so.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function el(e){e instanceof Kn&&(e={model:e}),V(this,{lax:!1},e)}el.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof bn?(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 ww(V({},t,{rootHandler:i})),s=new Dd({proxy:!0}),c=Ew();i.context=a,c.push(i);function u(C,P,D){var T=P(),I=T.line,k=T.column,L=T.data;L.charAt(0)==="<"&&L.indexOf(" ")!==-1&&(L=L.slice(0,L.indexOf(" "))+">");var z="unparsable content "+(L?L+" ":"")+`detected
|
|
2
|
+
line: `+I+`
|
|
3
|
+
column: `+k+`
|
|
4
|
+
nested error: `+C.message;if(D)return a.addWarning({message:z,error:C}),!0;throw Ji(z)}function l(C,P){return u(C,P,!0)}function f(){var C=a.elementsById,P=a.references,D,T;for(D=0;T=P[D];D++){var I=T.element,k=C[T.id],L=ki(I).propertiesByName[T.property];if(k||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),L.isMany){var z=I.get(L.name),ae=z.indexOf(T);ae===-1&&(ae=z.length),k?z[ae]=k:z.splice(ae,1)}else I.set(L.name,k)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,m=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function g(C){if(d.test(C)){var P=m.exec(C),D=P&&P[1];!D||h.test(D)||a.addWarning({message:"unsupported document encoding <"+D+">, falling back to UTF-8"})}}function y(C,P){var D=c.peek();try{c.push(D.handleNode(C))}catch(T){u(T,P,o)&&c.push(new Zu)}}function v(C,P){try{c.peek().handleText(C)}catch(D){l(D,P)}}function b(C,P){C.trim()&&v(C,P)}var x=r.getPackages().reduce(function(C,P){return C[P.uri]=P.prefix,C},Object.entries(Xu).reduce(function(C,[P,D]){return C[D]=P,C},r.config&&r.config.nsMap||{}));return s.ns(x).on("openTag",function(C,P,D,T){var I=C.attrs||{},k=Object.keys(I).reduce(function(z,ae){var me=P(I[ae]);return z[ae]=me,z},{}),L={name:C.name,originalName:C.originalName,attributes:k,ns:C.ns};y(L,T)}).on("question",g).on("closeTag",p).on("cdata",v).on("text",function(C,P,D){b(P(C),D)}).on("error",u).on("warn",l),new Promise(function(C,P){var D;try{s.parse(e),f()}catch(z){D=z}var T=i.element;!D&&!T&&(D=Ji("failed to parse document as <"+i.type.$descriptor.name+">"));var I=a.warnings,k=a.references,L=a.elementsById;return D?(D.warnings=I,P(D)):C({rootElement:T,elementsById:L,references:k,warnings:I})})},el.prototype.handler=function(e){return new Ju(this.model,e)};function Ew(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var Sw=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
+
`,Rw=/<|>|'|"|&|\n\r|\n/g,$d=/<|>|&/g;function mi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}mi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},mi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},mi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},mi.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)},mi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},mi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},mi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},mi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},mi.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 Cw(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Pw(e,t){return Ld(t)?Cw(e):e}function Fd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function jd(e){return Tn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function Aw(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 Tw(e,t){return t.isGeneric?V({localName:t.ns.localName},e):V({localName:Pw(t.ns.localName,t.$pkg)},e)}function Mw(e,t){return V({localName:t.ns.localName},e)}function kw(e){var t=e.$descriptor;return Ye(t.properties,function(n){var i=n.name;if(n.isVirtual||!Mn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var Ow={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},Dw={"<":"lt",">":"gt","&":"amp"};function Hd(e,t,n){return e=Tn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function Lw(e){return Hd(e,Rw,Ow)}function Iw(e){return Hd(e,$d,Dw)}function Bw(e){return Ye(e,function(t){return t.isAttr})}function Nw(e){return Ye(e,function(t){return!t.isAttr})}function tl(e){this.tagName=e}tl.prototype.build=function(e){return this.element=e,this},tl.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Dr(){}Dr.prototype.serializeValue=Dr.prototype.serializeTo=function(e){e.append(this.escape?Iw(this.value):this.value)},Dr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search($d)!==-1&&(this.escape=!0),this};function nl(e){this.tagName=e}Fd(nl,Dr),nl.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function wt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}wt.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=kw(e),this.parseAttributes(Bw(r)),this.parseContainments(Nw(r))),this.parseGenericAttributes(e,i),this},wt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return Tw(t,e)},wt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return Mw(t,e)},wt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},wt.prototype.nsAttributeName=function(e){var t;if(Tn(e)?t=fn(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}:V({localName:t.localName},n)},wt.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}))},wt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Dr().build({type:"String"},t));var n=e.$children;n&&$(n,i=>{this.body.push(new wt(this).build(i))})},wt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=fn(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)}},wt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return $(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},wt.prototype.parseGenericAttributes=function(e,t){var n=this;$(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)}})},wt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;$(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Dr().build(r,o[0]));else if(Pd(r.type))$(o,function(u){n.push(new nl(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)$(o,function(u){n.push(new tl(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=Bd(r);$(o,function(u){var l;c?c===Id?l=new wt(t,r):l=new ms(t,r,c):l=new wt(t),n.push(l.build(u))})}})},wt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new mi(i):t=i),t},wt.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},wt.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},wt.prototype.parseAttributes=function(e){var t=this,n=this.element;$(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];$(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},wt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),jd(e)},wt.prototype.addAttribute=function(e,t){var n=this.attrs;Tn(t)&&(t=Lw(t));var i=Ed(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)},wt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=Aw(n).concat(t)),$(t,function(i){e.append(" ").append(jd(i.name)).append('="').append(i.value).append('"')})},wt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Dr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),$(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function ms(e,t,n){wt.call(this,e,t),this.serialization=n}Fd(ms,wt),ms.prototype.parseNsAttributes=function(e){var t=wt.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},ms.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function $w(){this.value="",this.write=function(e){this.value+=e}}function Fw(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 jw(e){e=V({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new $w,o=new Fw(r,e.format);e.preamble&&o.append(Sw);var a=new wt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(Hw(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function Hw(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Xu)n[i]=Xu[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 gs(e,t){Kn.call(this,e,t)}gs.prototype=Object.create(Kn.prototype),gs.prototype.fromXML=function(e,t,n){Tn(t)||(n=t,t="bpmn:Definitions");var i=new el(V({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},gs.prototype.toXML=function(e,t){var n=new jw(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var zw="BPMN20",Gw="http://www.omg.org/spec/BPMN/20100524/MODEL",Vw="bpmn",Ww=[],Uw=[{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"}]}],Yw=[{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"}]}],qw={tagAlias:"lowerCase",typePrefix:"t"},Kw={name:zw,uri:Gw,prefix:Vw,associations:Ww,types:Uw,enumerations:Yw,xml:qw},Xw="BPMNDI",Zw="http://www.omg.org/spec/BPMN/20100524/DI",Qw="bpmndi",Jw=[{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"]}],eE=[{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"}]}],tE=[],nE={name:Xw,uri:Zw,prefix:Qw,types:Jw,enumerations:eE,associations:tE},iE="DC",rE="http://www.omg.org/spec/DD/20100524/DC",oE="dc",aE=[{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}]}],sE=[],cE={name:iE,uri:rE,prefix:oE,types:aE,associations:sE},uE="DI",lE="http://www.omg.org/spec/DD/20100524/DI",pE="di",fE=[{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"}]}],dE=[],hE={tagAlias:"lowerCase"},mE={name:uE,uri:lE,prefix:pE,types:fE,associations:dE,xml:hE},gE="bpmn.io colors for BPMN",yE="http://bpmn.io/schema/bpmn/biocolor/1.0",vE="bioc",bE=[{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"}]}],xE=[],_E=[],wE={name:gE,uri:yE,prefix:vE,types:bE,enumerations:xE,associations:_E},EE="BPMN in Color",SE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",RE="color",CE=[{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"}]}],PE=[],AE=[],TE={name:EE,uri:SE,prefix:RE,types:CE,enumerations:PE,associations:AE};const ME={bpmn:Kw,bpmndi:nE,dc:cE,di:mE,bioc:wE,color:TE};function zd(e,t){const n=V({},ME,e);return new gs(n,t)}const kE={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"}},OE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Gd="i18n",ys={[Gd]:kE,[Fu]:vd};function Vd(){return zd(ys)}const Wd=Vd();async function il(e){const{rootElement:t,warnings:n}=await Wd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function DE(e){const{xml:t}=await Wd.toXML(e,{format:!0});return t}function rl(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const co={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},LE=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function IE(e){const t=co;return LE.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 uo(e,t){let n=0;for(const i of e)n+=t*IE(i);return n}function Ud(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&BE(e),NE(e),$E(e),FE(e)}function BE(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:uo(r,o),fontBoundingBoxAscent:o*co.ascentEm,fontBoundingBoxDescent:o*co.descentEm,actualBoundingBoxAscent:o*co.ascentEm,actualBoundingBoxDescent:o*co.descentEm}}};t.getContext=()=>n}function NE(e){if(e.SVGMatrix)return;class t{constructor(){to(this,"a",1);to(this,"b",0);to(this,"c",0);to(this,"d",1);to(this,"e",0);to(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 $E(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,f=Math.cos(l),p=Math.sin(l);a.a=f,a.b=p,a.c=-p,a.d=f,a.e=c-f*c+p*u,a.f=u-p*c-f*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 FE(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:uo(n,12),height:14}})}const vs=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),jE=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),HE=1,ol=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),zE=2;function xn(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"edge-overlap-unrelated":return`u|${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"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Yd=20,bs=5,qd=3,GE=8,Kd=12,VE=Kd*1.2;function al(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>uo(o,Kd))),r=n.length*VE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Xd=1;function _n(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 lo(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of _n(e))for(const s of _n(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Xd)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const u=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);u>=Yd&&(!n||u>n.length)&&(n={axis:a.axis,length:u,kind:c})}return n}function sl(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Zd(e,t){const n=lo(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function WE(e,t){let n=0;for(const i of t)i.id!==e.id&&Zd(e,i)&&n++;return n}function Gn(e,t){let n=0;for(const i of t)i.id!==e.id&&lo(e,i)&&n++;return n}const Qd=15,Jd=20;function UE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Jd||t.at>n[1]+Jd)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 cl=20;function xs(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Xd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Yd||n.push([r-cl,o+cl])}return n}function _s(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of _n(e)){const o=UE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of xs(r,_n(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const YE=1,qE=(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 KE(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,f=1;const p=(d,m)=>{if(m===0)return d<=0;const h=d/m;if(m>0){if(h>f)return!1;h>l&&(l=h)}else{if(h<l)return!1;h<f&&(f=h)}return!0};return p(r-e.x,c)&&p(e.x-a,-c)&&p(o-e.y,u)&&p(e.y-s,-u)&&f>l}function ul(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 XE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,po=1;function Oi(e,t){const n=e.x+po,i=e.x+e.width-po,r=e.y+po,o=e.y+e.height-po;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 na(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 eh(e,t){const n=e.label;if(!n)return null;if(_n(e).some(i=>Oi(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(_n(i).some(r=>Oi(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(na(i).some(r=>Oi(n,r)))return i.id;return null}function tn(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(KE(e.waypoints[o],e.waypoints[o+1],r,zE)){i.push(r);break}}return i}function ZE(e,t,n,i){const r=(u,l,f)=>(l.x-u.x)*(f.y-u.y)-(l.y-u.y)*(f.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 th=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ia(e,t){let n=0;for(const i of t){if(i.id===e.id||th(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++)ZE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Vn(e,t){let n=0;for(const i of t)i.id===e.id||th(e,i)||ia(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function nh(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++)ia(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function ws(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ia(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 ih(e){const t=ws(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let r=0,o=0;for(const[a,s]of t){const c=i.get(a),u=i.get(s);if(!c||!u)continue;const l=n(c.type),f=n(u.type);l==="solid"&&f==="solid"?r++:l==="dashed"&&f==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:QE(e)}}function QE(e){const t=e.shapes.filter(r=>r.type==="bpmn:Participant");if(t.length<3)return 0;const n=r=>{const o=e.shapes.find(a=>a.id===r);if(o)return t.find(a=>o.x>=a.x&&o.y>=a.y&&o.x+o.width<=a.x+a.width&&o.y+o.height<=a.y+a.height)};let i=0;for(const r of e.edges){if(r.type!=="bpmn:MessageFlow"||r.endpoints.length<2)continue;const o=n(r.endpoints[0]),a=n(r.endpoints[1]);if(!o||!a||o.id===a.id)continue;const s=Math.min(o.y,a.y),c=Math.max(o.y+o.height,a.y+a.height);t.some(u=>u.id!==o.id&&u.id!==a.id&&u.y>s&&u.y+u.height<c)&&i++}return i}function rh(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!ol.has(r.type)&&!i.has(r.id)&&r.x>=n.x&&r.y>=n.y&&r.x+r.width<=n.right&&r.y+r.height<=n.bottom).map(r=>r.id).sort()}function oh(e){var n;const t=(n=_t(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=_t(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 ah=e=>e?{members:e}:{},Wn=e=>e.shapes.filter(t=>!t.container);function JE(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 sh(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(_n(i).some(r=>Oi(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(na(i).some(r=>Oi(n,r)))return i.id;return null}function fo(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 dn(e){const t=[],n=e.shapes.filter(y=>!y.container);for(const y of e.edges)for(const v of tn(y,n))t.push({kind:"edge-crosses-shape",edge:y.id,shape:v.id});const i=e.shapes.filter(y=>y.container&&jE.has(y.type));if(i.length){const y=(v,b)=>{const x=e.shapes.find(C=>C.id===b);return!!x&&x.x>=v.x&&x.y>=v.y&&x.x+x.width<=v.x+v.width&&x.y+x.height<=v.y+v.height};for(const v of e.edges)for(const b of tn(v,i))v.endpoints.includes(b.id)||v.endpoints.some(x=>y(b,x))||t.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:b.id})}const r=e.shapes.filter(y=>y.type==="bpmn:Participant");for(let y=0;y<r.length;y++)for(let v=y+1;v<r.length;v++){const b=r[y],x=r[v];if(b.x+b.width<=x.x||x.x+x.width<=b.x||b.y+b.height<=x.y||x.y+x.height<=b.y)continue;const C=(P,D)=>P.x<=D.x&&P.y<=D.y&&P.x+P.width>=D.x+D.width&&P.y+P.height>=D.y+D.height;t.push({kind:"pool-overlap",pools:[b.id,x.id],contained:C(b,x)||C(x,b)})}const o=n.filter(y=>!y.attached);for(let y=0;y<o.length;y++)for(let v=y+1;v<o.length;v++){const b=o[y],x=o[v];if(!ul(b,x,HE))continue;const C=b.id<x.id?[b.id,x.id]:[x.id,b.id];t.push({kind:"shape-overlap",shapes:C,identical:XE(b,x)})}const a=e.shapes.filter(y=>y.type==="bpmn:Group"&&Array.isArray(y.members)&&y.members.length>0);for(let y=0;y<a.length;y++)for(let v=y+1;v<a.length;v++){const b=a[y],x=a[v],C=Math.min(b.x+b.width,x.x+x.width)-Math.max(b.x,x.x),P=Math.min(b.y+b.height,x.y+x.height)-Math.max(b.y,x.y);if(C<=bs||P<=bs)continue;const D=b.id<x.id?[b.id,x.id]:[x.id,b.id],T=new Set(x.members);if(b.members.some(k=>T.has(k))){const k=rh(e,a,{x:Math.max(b.x,x.x),y:Math.max(b.y,x.y),right:Math.min(b.x+b.width,x.x+x.width),bottom:Math.min(b.y+b.height,x.y+x.height)});k.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:D,shapes:k});continue}const I=b.x<=x.x&&b.y<=x.y&&b.x+b.width>=x.x+x.width&&b.y+b.height>=x.y+x.height?b.id:x.x<=b.x&&x.y<=b.y&&x.x+x.width>=b.x+b.width&&x.y+x.height>=b.y+b.height?x.id:void 0;t.push({kind:"group-overlap-unintended",groups:D,...I?{container:I}:{}})}const s=new Set(a.flatMap(y=>[...y.members])),c=y=>e.shapes.filter(v=>!v.container&&!ol.has(v.type)&&v.x>=y.x&&v.y>=y.y&&v.x+v.width<=y.x+y.width&&v.y+v.height<=y.y+y.height);for(const y of a){const v=c(y);if(!v.length)continue;const b=new Set(y.members),x=v.filter(C=>!b.has(C.id));x.some(C=>s.has(C.id))&&(x.length*2<v.length||t.push({kind:"group-overlap-unreadable",reason:"minority",group:y.id,shapes:x.map(C=>C.id).sort()}))}for(const y of a){const v=new Set(c(y).map(T=>T.id)),b=new Set(y.members),x=new Set([...v].filter(T=>!b.has(T)&&s.has(T)));if(!x.size)continue;let C=!1,P=!1,D=!1;for(const T of e.edges){if(T.type!=="bpmn:SequenceFlow"||!T.source||!T.target)continue;const I=x.has(T.source),k=x.has(T.target);!I&&k&&!v.has(T.source)?C=!0:I&&!k&&!v.has(T.target)?P=!0:I&&k&&(D=!0)}C&&P&&D&&t.push({kind:"group-overlap-unreadable",reason:"throughpass",group:y.id,shapes:[...x].sort()})}const u=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<u.length;y++)for(let v=y+1;v<u.length;v++)for(let b=v+1;b<u.length;b++){const x=[u[y],u[v],u[b]],C={x:Math.max(...x.map(T=>T.x)),y:Math.max(...x.map(T=>T.y)),right:Math.min(...x.map(T=>T.x+T.width)),bottom:Math.min(...x.map(T=>T.y+T.height))};if(C.right-C.x<=bs||C.bottom-C.y<=bs)continue;const P=rh(e,[],C);if(!P.length)continue;const D=x.map(T=>T.id).sort();t.push({kind:"group-stack-unreadable",groups:D,shapes:P})}for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||ol.has(v.type)||v.width<=0||v.height<=0)continue;const b=[["top",y.y,"h",y.x,y.x+y.width],["bottom",y.y+y.height,"h",y.x,y.x+y.width],["left",y.x,"v",y.y,y.y+y.height],["right",y.x+y.width,"v",y.y,y.y+y.height]];for(const[x,C,P,D,T]of b){const I=P==="h"?v.x:v.y,k=P==="h"?v.x+v.width:v.y+v.height;if(!(I<T&&D<k))continue;const L=P==="h"?v.y:v.x,z=P==="h"?v.y+v.height:v.x+v.width;if(!(L<C&&C<z))continue;const ae=Math.min(C-L,z-C);ae<GE||t.push({kind:"group-cuts-shape",group:y.id,shape:v.id,side:x,depth:ae})}}const l=e.shapes.filter(y=>y.container&&y.type!=="bpmn:Group"&&y.type!=="bpmn:Lane");for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of l){const b=y.x<v.x+v.width&&v.x<y.x+y.width,x=y.y<v.y+v.height&&v.y<y.y+y.height,C=[["top",y.y,v.y,b],["bottom",y.y+y.height,v.y+v.height,b],["left",y.x,v.x,x],["right",y.x+y.width,v.x+v.width,x]];for(const[P,D,T,I]of C)I&&Math.abs(D-T)<=qd&&t.push({kind:"group-on-container-boundary",group:y.id,container:v.id,side:P})}const f=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<f.length;y++)for(let v=y+1;v<f.length;v++){const b=f[y],x=f[v],C=b.x<x.x+x.width&&x.x<b.x+b.width,P=b.y<x.y+x.height&&x.y<b.y+b.height,D=[["x",b.x+b.width,x.x,P],["x",x.x+x.width,b.x,P],["y",b.y+b.height,x.y,C],["y",x.y+x.height,b.y,C]];for(const[T,I,k,L]of D)if(L&&Math.abs(I-k)<=qd){t.push({kind:"group-on-group-boundary",groups:b.id<x.id?[b.id,x.id]:[x.id,b.id],axis:T});break}}for(let y=0;y<e.edges.length;y++)for(let v=y+1;v<e.edges.length;v++){const b=e.edges[y],x=e.edges[v],C=lo(b,x);if(!C)continue;const P=b.id<x.id?[b.id,x.id]:[x.id,b.id];t.push({kind:C.kind==="opposite"?"edge-overlap-opposite":C.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:P,axis:C.axis,length:Math.round(C.length)})}for(const y of e.edges){if(!y.label)continue;const v=_s(y,e.edges);v&&t.push({kind:"label-on-shared-segment",edge:y.id,other:v.other,axis:v.axis})}for(const y of e.edges){if(!y.label)continue;const v=eh(y,e);v&&t.push({kind:"label-over-line",edge:y.id,line:v})}const p=new Set(n.map(y=>y.id)),d=e.shapes.filter(y=>y.type==="bpmn:Participant"&&y.label);for(const y of[...n,...d.filter(v=>!p.has(v.id))]){if(!y.label)continue;const v=sh(y,e);v&&t.push({kind:"label-over-line",edge:y.id,line:v})}const m=new Set(e.shapes.filter(y=>y.type==="bpmn:TextAnnotation").map(y=>y.id));for(const y of d)for(const{owner:v,rect:b}of fo(e))v===y.id||m.has(v)||ul(y.label,b,po)&&t.push({kind:"pool-name-over-label",pool:y.id,label:v});const h=fo(e);for(const y of n)if(y.type==="bpmn:TextAnnotation")for(const{owner:v,rect:b}of h)v!==y.id&&ul(y,b,po)&&t.push({kind:"annotation-over-label",annotation:y.id,label:v});const g=new Map(e.shapes.map(y=>[y.id,y]));for(const y of n){const v=y.parent??JE(y,e,g);if(!v)continue;const b=g.get(v);!b||!b.container||qE(b,y,YE)||t.push({kind:"shape-outside-container",shape:y.id,container:b.id})}return t.sort((y,v)=>xn(y).localeCompare(xn(v)))}const _t=e=>typeof e=="object"&&e!==null?e:void 0,Tt=e=>typeof e=="number"?e:0,Di=e=>{const t=_t(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function e1(e){const t=_t(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=Di(o);a&&n.push(a)}}return n}function t1(e){const t=_t(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Di(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Di(t.targetRef);return n&&i?{source:n,target:i}:{}}function n1(e,t){const n=_t(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Di(n);return r?t.get(r):void 0}if(vs.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Di(n)}function ch(e){var a,s,c,u,l;const t=[],n=[],i=((a=_t(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=_t(e))==null?void 0:s.rootElements)??[]){const p=_t(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const m=_t(d),h=Di(m),g=Di(m==null?void 0:m.processRef);h&&g?r.set(g,h):h&&o.add(h)}}for(const f of i){const p=_t((c=_t(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const m of d){const h=_t(m);if(!h)continue;const g=_t(h.bpmnElement),y=typeof(g==null?void 0:g.id)=="string"?g.id:void 0;if(!y)continue;const v=typeof(g==null?void 0:g.$type)=="string"?g.$type:"",b=_t(h.bounds);if(b){const C=h.isExpanded===!1&&v!=="bpmn:Participant",P=_t((u=_t(h.label))==null?void 0:u.bounds),D={id:y,type:v,x:Tt(b.x),y:Tt(b.y),width:Tt(b.width),height:Tt(b.height),container:vs.has(v)&&!C,attached:(g==null?void 0:g.attachedToRef)!==void 0,...g?{parent:n1(g,r)}:{},...P?{label:{x:Tt(P.x),y:Tt(P.y),width:Tt(P.width),height:Tt(P.height)}}:{},...v==="bpmn:Group"?ah(oh(g)):{}},T=h.isHorizontal!==!1,I=typeof(g==null?void 0:g.name)=="string"?g.name:"";o.has(y)&&T&&I&&(D.label=al(D,I)),t.push(D);continue}const x=h.waypoint;if(Array.isArray(x)){const C=_t((l=_t(h.label))==null?void 0:l.bounds);n.push({id:y,type:v,waypoints:x.map(P=>{var D,T;return{x:Tt((D=_t(P))==null?void 0:D.x),y:Tt((T=_t(P))==null?void 0:T.y)}}),endpoints:e1(g),...t1(g),...C?{label:{x:Tt(C.x),y:Tt(C.y),width:Tt(C.width),height:Tt(C.height)}}:{}})}}}return{shapes:t,edges:n}}function uh(e){return dn(ch(e))}async function i1(e){const{definitions:t,warnings:n}=await il(e);return{findings:uh(t),warnings:n}}function rt(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 h=_t(o.label),g=Di(o.source),y=Di(o.target);n.push({id:o.id,type:a,waypoints:s.map(v=>({x:Tt(v.x),y:Tt(v.y)})),endpoints:[g,y].filter(v=>!!v),...g&&y?{source:g,target:y}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Tt(h.y),width:Tt(h.width),height:Tt(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=_t(o.businessObject),u=_t(o.label);let l=_t(o.parent);for(;l&&l.type==="bpmn:Lane";)l=_t(l.parent);const f=typeof(l==null?void 0:l.type)=="string"?l.type:"",p=l&&vs.has(f)&&f!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Tt(o.width),height:Tt(o.height),container:vs.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:Tt(u.y),width:Tt(u.width),height:Tt(u.height)}}:{},...a==="bpmn:Group"?ah(oh(c)):{}},m=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&m&&((i=_t(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=al(d,m)),t.push(d)}return{shapes:t,edges:n}}const r1={"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 o1(e,t){const n=r1[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function lh(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function ph(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 o1(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&lh(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?lh(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 ll=20,a1=4,vt=(e,t)=>Math.abs(e-t)<.5;function Es(e,t,n,i=ll){if(vt(e.y,t.y)&&!vt(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(vt(e.x,t.x)&&!vt(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 fh(e,t,n,i=ll){if(n.length<2)return null;if(vt(e.y,t.y)&&!vt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,u=e.x<t.x?s:a,l=Math.min(...n.map(d=>d.y))-i,f=Math.max(...n.map(d=>d.y+d.height))+i,p=d=>[{x:c,y:e.y},{x:c,y:d},{x:u,y:d},{x:u,y:e.y}];return[p(l),p(f)]}if(vt(e.x,t.x)&&!vt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,u=e.y<t.y?s:a,l=Math.min(...n.map(d=>d.x))-i,f=Math.max(...n.map(d=>d.x+d.width))+i,p=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:u},{x:e.x,y:u}];return[p(l),p(f)]}return null}function dh(e,t,n=ll){if(e.length!==4)return null;const[i,r,o,a]=e;if(vt(i.y,r.y)&&vt(r.x,o.x)&&vt(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(vt(i.x,r.x)&&vt(r.y,o.y)&&vt(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 Ss(e,t){if(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[];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 hh=30,s1=[0,-25,25,-40,40];function c1(e,t){if(e.type!=="bpmn:MessageFlow"||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[];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+hh:s-hh,u=a?i.y+i.height:i.y,l=n.x+n.width/2,f=i.x+i.width/2;return s1.map(p=>[{x:l,y:s},{x:l,y:c},{x:f+p,y:c},{x:f+p,y:u}])}const pl=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],ho=(e,t,n)=>tn({...e,waypoints:t},n).length;function fl(e,t,n,i){let r=[...e.waypoints],o=ho(e,r,t);if(o===0)return null;let a=!1;for(const f of Ss(e,t))if(ho(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(_n),c=f=>_n({...e,waypoints:f}).some(p=>xs(p,s).length>0),u=c1(e,t).filter(f=>ho(e,f,t)===0);if(u.length)return u.find(f=>!c(f))??u[0];const l=f=>!n||f.every(p=>p.x>=n.x&&p.x<=n.x+n.width&&p.y>=n.y&&p.y<=n.y+n.height);if(e.endpoints.length===2&&r.length>2){const f=t.find(d=>d.id===e.endpoints[0]),p=t.find(d=>d.id===e.endpoints[1]);if(f&&p&&vt(f.y+f.height/2,p.y+p.height/2)){const d=[r[0],r[r.length-1]];if(vt(d[0].y,d[1].y)&&!vt(d[0].x,d[1].x)){const m=t.filter(v=>!e.endpoints.includes(v.id)&&tn({...e,waypoints:d},[v]).length>0),h=m.length>=2?fh(d[0],d[1],m):null,y=(h?h.map(v=>[d[0],...v,d[1]]):m.length===1?(Es(d[0],d[1],m[0])??[]).map(v=>[d[0],...v,d[1]]):m.length===0?[d]:[]).filter(v=>ho(e,v,t)===0&&v.length<=r.length).sort((v,b)=>Number(l(b))-Number(l(v)));if(y.length)return y.find(v=>!c(v))??y[0]}}}for(let f=0;f+1<r.length;f++){const p=r[f],d=r[f+1],m=t.filter(y=>!e.endpoints.includes(y.id)&&tn({...e,waypoints:[p,d]},[y]).length>0);if(m.length<2)continue;const h=fh(p,d,m);if(!h)continue;const g=h.map(y=>pl(r,f,y)).filter(y=>ho(e,y,t)===0).sort((y,v)=>Number(l(v))-Number(l(y)));if(g.length)return g.find(y=>!c(y))??g[0]}for(let f=0;f<a1&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const m=r[d],h=r[d+1];for(const g of t){if(e.endpoints.includes(g.id)||tn({...e,waypoints:[m,h]},[g]).length===0)continue;const y=Es(m,h,g),v=y?y.map(x=>pl(r,d,x)):dh(r,g)??[];if(!v.length)continue;const b=[...v].sort((x,C)=>Number(l(C))-Number(l(x)));for(const x of b){const C=ho(e,x,t);if(C<o){r=x,o=C,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function dl(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=rt(i),a=Wn(o),s=new Set,c=dn(o).filter(l=>l.kind==="edge-crosses-shape"&&!t.has(xn(l)));if(!c.length)return s;const u=new Map;for(const l of c){if(l.kind!=="edge-crosses-shape"||u.has(l.edge))continue;const f=o.edges.find(p=>p.id===l.edge);f&&u.set(l.edge,f)}for(const[l,f]of u){if(n&&!n.has(l))continue;const p=i.get(l);if(!p)continue;const d=p.parent,m=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=fl(f,a,m,o.edges);if(!h){tn(f,a).some(b=>b.type==="bpmn:TextAnnotation")&&s.add(l);continue}const g=o.edges.filter(b=>b.id!==l),y=Gn(f,g);Gn({...f,waypoints:h},g)>y||r.updateWaypoints(p,h)}return s}const u1=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,r.x)-1,y:Math.min(i.y,r.y)-1,width:Math.max(2,Math.abs(r.x-i.x)+2),height:Math.max(2,Math.abs(r.y-i.y)+2),container:!1,attached:!1})}return t},hl=(e,t)=>ia(e,[t])>0;function mh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=rt(i),a=Wn(o);let s=o;const c=new Set(dn(o).map(xn));for(const[u,l]of ws(o))if(!t.has(`${u}|${l}`))for(const[f,p]of[[u,l],[l,u]]){if(n.has(f))continue;const d=s.edges.find(I=>I.id===f),m=s.edges.find(I=>I.id===p);if(!d||!m)continue;const h=i.get(f);if(!h)continue;const g=h.parent,y=g&&typeof g.x=="number"&&typeof g.width=="number"?{x:g.x,y:g.y,width:g.width,height:g.height}:void 0,v=u1(m),b=[...Ss(d,a)??[]],x=fl(d,[...a,...v],y,o.edges);x&&b.push(x);for(let I=0;I+1<d.waypoints.length;I++)for(const k of v)for(const L of Es(d.waypoints[I],d.waypoints[I+1],k)??[])b.push(pl(d.waypoints,I,L));const C=s.edges.filter(I=>I.id!==f),P=I=>({...s,edges:s.edges.map(k=>k.id===f?{...k,waypoints:I}:k)}),D=I=>!y||I.every(k=>k.x>=y.x&&k.x<=y.x+y.width&&k.y>=y.y&&k.y<=y.y+y.height),T=b.find(I=>{const k={...d,waypoints:I};return hl(k,m)||!D(I)||C.some(L=>L.id!==p&&!hl(d,L)&&hl(k,L))?!1:dn(P(I)).every(L=>c.has(xn(L)))});if(T){r.updateWaypoints(h,T),s=P(T);break}}}const l1=10;function gh(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 yh(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(z=>z.type==="bpmn:Participant"&&z.container),i=t.shapes.find(z=>z.id===e.endpoints[0]),r=t.shapes.find(z=>z.id===e.endpoints[1]);if(!i||!r)return null;const o=gh(i,n),a=gh(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(z=>z.id!==o.id&&z.id!==a.id&&z.y>=c.y+c.height&&z.y+z.height<=u.y).sort((z,ae)=>z.y-ae.y);if(!l.length)return null;const f=l[0],p=l[l.length-1],d=(c.y+c.height+f.y)/2,m=(p.y+p.height+u.y)/2,h=s?d:m,g=s?m:d,y=e.waypoints[0],v=e.waypoints[e.waypoints.length-1],b=Wn(t),x=t.edges.filter(z=>z.id!==e.id),C=Vn(e,x),P=tn(e,b).length;if(C===0&&P===0||P===0&&e.waypoints.length===2)return null;const D=Math.min(...l.map(z=>z.x)),T=Math.max(...l.map(z=>z.x+z.width)),I=(y.x+v.x)/2,k=z=>z.filter((ae,me)=>me===0||!(vt(ae.x,z[me-1].x)&&vt(ae.y,z[me-1].y)));let L;for(let z=D;z<=T;z+=l1){const ae=k([y,{x:y.x,y:h},{x:z,y:h},{x:z,y:g},{x:v.x,y:g},v]),me={...e,waypoints:ae};if(tn(me,b).length>0)continue;const Ue=Vn(me,x),$e=Math.abs(z-I);(!L||Ue<L.cross||Ue===L.cross&&$e<L.detour)&&(L={pts:ae,cross:Ue,detour:$e})}return L&&(P>0?L.cross<=C:L.cross<C)?L.pts:null}function vh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=rt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=rt(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=yh(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const gi=[25,-25,40,-40],mo=35;function p1(e,t){const n=e.x+e.width/2,i=t.x+t.width/2,r=[];for(const o of[!0,!1]){const a=o?e.y:e.y+e.height,s=o?t.y:t.y+t.height,c=o?Math.min(e.y,t.y)-mo:Math.max(e.y+e.height,t.y+t.height)+mo;for(const u of[0,...gi])if(!(Math.abs(u)>=e.width/2-5))for(const l of[0,...gi]){if(Math.abs(l)>=t.width/2-5)continue;const f=n+u,p=i+l;r.push({pts:[{x:f,y:a},{x:f,y:c},{x:p,y:c},{x:p,y:s}],cost:Math.abs(l)+Math.abs(u)})}}return r}function Rs(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 p1(n,i);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-mo:n.y+n.height+mo,f=[];for(const v of[0,...gi]){if(Math.abs(v)>=i.width/2-5)continue;const b=o+v;f.push({pts:[{x:n.x,y:r},{x:b,y:r},{x:b,y:c}],cost:Math.abs(v)});for(const x of[0,...gi]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;f.push({pts:[{x:C,y:u},{x:C,y:l},{x:b,y:l},{x:b,y:c}],cost:Math.abs(v)+Math.abs(x)})}}const p=50,d=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const v of[0,...gi]){if(Math.abs(v)>=n.width/2-5)continue;const b=a+v;f.push({pts:[{x:b,y:m},{x:b,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(v)})}const h=60,g=s?i.y+i.height:i.y,y=s?i.y+i.height+mo:i.y-mo;for(const v of[0,...gi]){if(Math.abs(v)>=i.width/2-5)continue;const b=o+v;for(const x of[0,...gi]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;f.push({pts:[{x:C,y:m},{x:C,y},{x:b,y},{x:b,y:g}],cost:h+Math.abs(v)+Math.abs(x)})}}return f}const Cs=30;function bh(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=vt(i.y,r.y)&&!vt(i.x,r.x),a=vt(i.x,r.x)&&!vt(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)<Cs||Math.abs(i.y-(s.y+s.height))<Cs)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)<Cs||Math.abs(i.x-(s.x+s.width))<Cs)return!0}}return!1}const Ps=40;function f1(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-Ps,a=r.x+r.width+Ps,s=r.y-Ps,c=r.y+r.height+Ps;for(let u=1;u<e.length-2;u++){const l=e[u],f=e[u+1],p={x:Math.min(l.x,f.x),y:Math.min(l.y,f.y)},d={x:Math.max(l.x,f.x),y:Math.max(l.y,f.y)};if(p.x<a&&d.x>o&&p.y<c&&d.y>s){i++;break}}}return i}function xh(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(P=>P.container),i=new Map(t.shapes.map(P=>[P.id,P])),r=Wn(t),o=t.edges.filter(P=>P.id!==e.id),a=Gn(e,o),s=Vn(e,o),c=P=>f1(P,t.shapes,e.endpoints)+(bh(P,n)?1:0),u=c(e.waypoints),l=P=>{if(!P)return;const D=P.x+P.width/2,T=P.y+P.height/2;return n.find(I=>I.type==="bpmn:Lane"&&D>=I.x&&D<=I.x+I.width&&T>=I.y&&T<=I.y+I.height)},f=l(i.get(e.endpoints[0]??"")),p=l(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,m=P=>{if(!d||!p)return!1;for(let D=1;D<P.length-2;D++){const T=P[D],I=P[D+1];if(vt(T.y,I.y)&&!vt(T.x,I.x)&&T.y>p.y&&T.y<p.y+p.height)return!0}return!1},h=m(e.waypoints),y=(P=>{if(!P)return;const D=P.x+P.width/2,T=P.y+P.height/2;return n.filter(I=>I.type==="bpmn:Participant"&&D>=I.x&&D<=I.x+I.width&&T>=I.y&&T<=I.y+I.height).sort((I,k)=>I.width*I.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),v=P=>{if(!y)return 0;let D=0;for(let T=1;T<P.length-1;T++){const I=P[T];(I.x<y.x||I.x>y.x+y.width||I.y<y.y||I.y>y.y+y.height)&&D++}return D},b=v(e.waypoints);if(!bh(e.waypoints,n)&&!(d&&!h)&&b===0)return null;const x=P=>P.reduce((D,T,I)=>I?D+Math.abs(T.x-P[I-1].x)+Math.abs(T.y-P[I-1].y):0,0);let C;for(const{pts:P,cost:D}of Rs(e,i)){const T={...e,waypoints:P};if(tn(T,r).length>0)continue;const I=Gn(T,o);if(I>a)continue;const k=v(P);if(k>b)continue;const L=k<b&&I===0;if(!L&&Vn(T,o)>s)continue;const z=c(P),ae=m(P);if(!L&&!(ae&&!h)&&z>=u)continue;const Ue=ae?0:1,$e=x(P);(!C||k<C.out||k===C.out&&(Ue<C.lane||Ue===C.lane&&(I<C.opp||I===C.opp&&(z<C.sc||z===C.sc&&(D<C.cost||D===C.cost&&$e<C.len)))))&&(C={pts:P,out:k,sc:z,lane:Ue,opp:I,cost:D,len:$e})}return(C==null?void 0:C.pts)??null}function d1(e,t){const{elementRegistry:n}=e,i=e.modeling,r=rt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=rt(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=Wn(a),u=a.edges.filter(d=>d.id!==o),l=tn(s,c).length,f=Gn(s,u),p=Vn(s,u);for(const d of Ss(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const m={...s,waypoints:d};if(tn(m,c).length>l||Gn(m,u)>f||Vn(m,u)>p)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function _h(e,t){const{elementRegistry:n}=e,i=e.modeling,r=rt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=rt(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=xh(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function ml(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=vt(n[0].x,n[1].x)&&!vt(n[0].y,n[1].y),s=vt(n[n.length-1].x,n[n.length-2].x)&&!vt(n[n.length-1].y,n[n.length-2].y);for(const c of gi){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 h1(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(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const r=i.y+i.height<=n.y,o=n.y+n.height<=i.y;if(!r&&!o)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,u=n.y+n.height/2,l=i.x+i.width/2,f=i.y+i.height/2,p=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,m=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,g=[];for(const y of[0,...gi])Math.abs(y)<i.width/2-5&&g.push({pts:[{x:p,y:u},{x:l+y,y:u},{x:l+y,y:h}],cost:Math.abs(y)}),Math.abs(y)<i.height/2-5&&g.push({pts:[{x:c,y:d},{x:c,y:f+y},{x:m,y:f+y}],cost:Math.abs(y)});return g}function gl(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[];const r=Math.max(n.x,i.x),o=Math.min(n.x+n.width,i.x+i.width);if(o-r<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,u=a?i.y+i.height:i.y,l=(r+o)/2,f=[];for(const p of[0,...gi]){const d=l+p;d<=r||d>=o||f.push({pts:[{x:d,y:c},{x:d,y:u}],cost:Math.abs(p)})}return f}function wh(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Wn(t),r=t.edges.filter(d=>d.id!==e.id),o=Gn(e,r);if(o===0)return null;const a=Vn(e,r);let s;const c=d=>d.reduce((m,h,g)=>g?m+Math.abs(h.x-d[g-1].x)+Math.abs(h.y-d[g-1].y):0,0),u=3,l=d=>{const m=d[0],h=d[d.length-1],g=Math.hypot(h.x-m.x,h.y-m.y);return g>=1&&c(d)/g>=u?1:0},f=l(e.waypoints),p=[...Rs(e,n),...gl(e,n),...ml(e,n)];for(const{pts:d,cost:m}of p){const h={...e,waypoints:d};if(tn(h,i).length>0)continue;const g=Gn(h,r),y=Vn(h,r),v=o-g+(f-l(d));if(g>=o||y-a>v)continue;const b=c(d);(!s||g<s.opposite||g===s.opposite&&(y<s.cross||y===s.cross&&(m<s.cost||m===s.cost&&b<s.len)))&&(s={pts:d,opposite:g,cross:y,cost:m,len:b})}return(s==null?void 0:s.pts)??null}function Eh(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=lo(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function m1(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Wn(t),r=t.edges.filter(p=>p.id!==e.id),o=Eh(e,r);if(o===0)return null;const a=Gn(e,r),s=Vn(e,r),c=p=>p.reduce((d,m,h)=>h?d+Math.abs(m.x-p[h-1].x)+Math.abs(m.y-p[h-1].y):0,0),u=2;let l;const f=[...Rs(e,n),...gl(e,n),...h1(e,n),...ml(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(tn(m,i).length>0)continue;const h=Eh(m,r);if(h>=o)continue;const g=Gn(m,r);if(g-h>a-o)continue;const y=Vn(m,r);if(y-s>(o-h)*u)continue;const v=c(p);(!l||h<l.fake||h===l.fake&&(g<l.unreadable||g===l.unreadable&&(y<l.cross||y===l.cross&&(d<l.cost||d===l.cost&&v<l.length))))&&(l={pts:p,fake:h,unreadable:g,cross:y,cost:d,length:v})}return(l==null?void 0:l.pts)??null}function Sh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=dn(rt(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(xn(s)));if(!o.length)return;const a=new Set;for(const s of o)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=rt(i),u=c.edges.find(p=>p.id===s);if(!u)continue;const l=m1(u,c);if(!l)continue;const f=i.get(s);f&&r.updateWaypoints(f,l)}}function Rh(e,t){const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");return!!n&&!!i&&i.x+i.width>n.x}function Ch(e,t,n){var u;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((u=lo(e,t))==null?void 0:u.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(l=>l&&(l===o||l===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:Rh(e,n)&&Rh(t,n)}function Ph(e,t,n){let i=0;for(const r of t)r.id!==e.id&&Ch(e,r,n)&&i++;return i}function g1(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Wn(t),r=t.edges.filter(p=>p.id!==e.id),o=Ph(e,r,n);if(o===0)return null;const a=Gn(e,r),s=Vn(e,r),c=p=>p.reduce((d,m,h)=>h?d+Math.abs(m.x-p[h-1].x)+Math.abs(m.y-p[h-1].y):0,0),u=2;let l;const f=[...Rs(e,n),...gl(e,n),...ml(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(tn(m,i).length>0)continue;const h=Ph(m,r,n);if(h>=o)continue;const g=Gn(m,r);if(g-h>a-o)continue;const y=Vn(m,r);if(y-s>(o-h)*u)continue;const v=c(p);(!l||h<l.chain||h===l.chain&&(g<l.unreadable||g===l.unreadable&&(y<l.cross||y===l.cross&&(d<l.cost||d===l.cost&&v<l.length))))&&(l={pts:p,chain:h,unreadable:g,cross:y,cost:d,length:v})}return(l==null?void 0:l.pts)??null}function y1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=rt(i),a=new Map(o.shapes.map(u=>[u.id,u])),s=dn(o).filter(u=>u.kind==="edge-overlap-opposite"&&!t.has(xn(u)));if(!s.length)return;const c=new Set;for(const u of s){if(u.kind!=="edge-overlap-opposite")continue;const[l,f]=u.edges.map(p=>o.edges.find(d=>d.id===p));if(!(!l||!f||!Ch(l,f,a)))for(const p of u.edges)n.has(p)||c.add(p)}for(const u of[...c].sort()){const l=rt(i),f=l.edges.find(m=>m.id===u);if(!f)continue;const p=g1(f,l);if(!p)continue;const d=i.get(u);d&&r.updateWaypoints(d,p)}}function Ah(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=rt(i),a=dn(o).filter(l=>sl(l)&&!t.has(xn(l)));if(!a.length)return;const s=new Set;for(const l of a)if(sl(l))for(const f of l.edges)n.has(f)||s.add(f);const c=l=>{var f;return((f=o.edges.find(p=>p.id===l))==null?void 0:f.type)??""},u=[...s].sort((l,f)=>{const p=c(l)==="bpmn:SequenceFlow"?0:1,d=c(f)==="bpmn:SequenceFlow"?0:1;return p!==d?p-d:l.localeCompare(f)});for(const l of u){const f=rt(i),p=f.edges.find(h=>h.id===l);if(!p)continue;const d=wh(p,f);if(!d)continue;const m=i.get(l);m&&r.updateWaypoints(m,d)}}const v1=10,b1=(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 Th(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!_s(e,i))return null;const r=Wn(t),o=i.flatMap(_n);for(const a of _n(e)){let s=[[a.lo,a.hi]];for(const[d,m]of xs(a,o))s=s.flatMap(([h,g])=>{const y=[];return d>h&&y.push([h,Math.min(g,d)]),m<g&&y.push([Math.max(h,m),g]),y.filter(([v,b])=>b>v)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,m])=>m-d>=c+v1*2);if(!u)continue;const l=(u[0]+u[1])/2,f=a.axis==="h"?{x:l,y:a.at-Qd}:{x:a.at+On+n.width/2,y:l},p={x:f.x-n.width/2,y:f.y-n.height/2,width:n.width,height:n.height};if(!_s({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&b1(p,d)))return p}return null}const On=8;function Mh(e,t){const n=e.label;if(!n)return null;const i=_n(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=p=>{const d=p.axis==="h"?r:o,m=p.axis==="h"?o-p.at:r-p.at,h=d<p.lo?p.lo-d:d>p.hi?d-p.hi:0;return Math.hypot(m,h)},s=i.reduce((p,d)=>a(d)<a(p)?d:p,i[0]),c=[...i,...t.edges.filter(p=>p.id!==e.id).flatMap(_n),...t.shapes.filter(p=>p.container).flatMap(na)],u=p=>!c.some(d=>Oi(p,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+On,f=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const p of[s.at+On,s.at-On-n.width])for(const d of f){const m=n.y+d;if(m<s.lo||m+n.height>s.hi)continue;const h={...n,x:p,y:m};if(u(h))return h}else for(const p of[s.at-On-n.height,s.at+On])for(const d of f){const m=n.x+d;if(m<s.lo||m+n.width>s.hi)continue;const h={...n,x:m,y:p};if(u(h))return h}return null}function kh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=rt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=Mh(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 Oh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=rt(i),a=dn(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(xn(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(p=>p.id===s.edge);if(!c)continue;const u=Th(c,o);if(!u)continue;const l=i.get(s.edge),f=l==null?void 0:l.label;f&&r.moveElements([f],{x:u.x-f.x,y:u.y-f.y})}}function Dh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(_n),...t.shapes.filter(p=>p.container).flatMap(na)],r=i.filter(p=>Oi(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=fo(t).filter(p=>p.owner!==e.id).map(p=>p.rect),s=(p,d)=>p.x<d.x+d.width&&d.x<p.x+p.width&&p.y<d.y+d.height&&d.y<p.y+p.height,c=p=>!i.some(d=>Oi(p,d))&&!o.some(d=>s(p,d))&&!a.some(d=>s(p,d)),u=[];for(const p of r)p.axis==="h"?u.push({...n,y:p.at-On-n.height},{...n,y:p.at+On}):u.push({...n,x:p.at-On-n.width},{...n,x:p.at+On});const l=e.x+e.width/2,f=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+On},{...n,x:l-n.width/2,y:e.y-On-n.height},{...n,x:e.x+e.width+On,y:f-n.height/2},{...n,x:e.x-On-n.width,y:f-n.height/2}),u.find(c)??null}function Lh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=rt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Dh(o,rt(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 x1=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Ih=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Bh={"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}]},As=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),yl=e=>typeof e=="string"&&e!=="";function _1(e){const t=[];function n(i,r,o,a){if(a===null){yl(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!As(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)yl(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a;if(!As(i)||!yl(i.kind)||!(i.kind in Bh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const s of Bh[i.kind]){const c=s.path.endsWith("[]"),u=c?s.path.slice(0,-2):s.path,l=u.split(".");let f=i;for(const d of l.slice(0,-1)){if(!As(f))break;f=f[d]}if(!As(f))continue;const p=f[l[l.length-1]];if(!(p===void 0&&s.optional)&&!(p===null&&s.optional)){if(!c){n(r,s.path,p,s.shape);continue}if(!Array.isArray(p)){t.push({kind:"payload-invalid",opIndex:r,field:s.path});continue}p.forEach((d,m)=>n(r,`${u}[${m}]`,d,s.shape))}}if(i.kind==="node.add"||i.kind==="node.update"){const s=i.band;s!==void 0&&(!Number.isInteger(s)||s<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"});const c=i.kind==="node.add"?(o=i.node)==null?void 0:o.type:i.type;typeof c=="string"&&!gd(c)&&t.push({kind:"node-type-unsupported",opIndex:r,id:(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"",type:c})}}),t}function Nh(e,t){const n=_1(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,m){if(!x1.test(d)){i.push({kind:"id-invalid",opIndex:p,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:p,id:d});return}r.set(d,{...m,opIndex:p})}e.forEach((p,d)=>{var m;switch(p.kind){case"participant.add":a(d,p.participant.id,{category:"participant",lanes:(p.participant.lanes??[]).map(h=>h.id)});for(const h of p.participant.lanes??[])a(d,h.id,{category:"lane"});break;case"node.add":a(d,p.node.id,{category:"flowNode",participant:p.node.participant});break;case"sequenceFlow.add":a(d,p.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,p.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,p.dataStore.id,{category:"dataStore"});for(const h of p.associations??[])h.id&&a(d,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":p.association.id&&a(d,p.association.id,{category:"dataAssociation"});break;case"association.add":p.association.id&&a(d,p.association.id,{category:"association"});break;case"annotation.add":a(d,p.annotation.id,{category:"annotation"}),(m=p.association)!=null&&m.id&&a(d,p.association.id,{category:"association"});break;case"group.add":a(d,p.group.id,{category:"group"});break;case"participant.update":if(p.lanes){o.set(p.id,p.lanes.map(h=>h.id));for(const h of p.lanes)t.categoryOf(h.id)===void 0&&a(d,h.id,{category:"lane"})}break}});const s=p=>{var d;return((d=r.get(p))==null?void 0:d.category)??t.categoryOf(p)},c=p=>{const d=r.get(p);return d?d.category==="participant"?p:d.participant:t.categoryOf(p)==="participant"?p:t.participantOf(p)};function u(p,d,m,h){const g=s(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:m});return}if(h&&!h.includes(g)){i.push({kind:"ref-category",opIndex:p,ref:d,role:m,expected:h.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(p=>p.kind==="participant.add");return e.forEach((p,d)=>{var m;switch(p.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:g}=p.node;if(h===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:p.node.id});break}if(u(d,h,"participant",["participant"])===void 0)break;g!==void 0&&((((m=r.get(h))==null?void 0:m.lanes)??o.get(h)??t.lanesOf(h)).includes(g)||i.push({kind:"lane-unknown",opIndex:d,lane:g,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:g,target:y,name:v,condition:b}=p.flow,x=u(d,g,"source",["flowNode"]),C=u(d,y,"target",["flowNode"]);x&&C&&c(g)!==c(y)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),v!==void 0&&b!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:g,target:y}=p.flow,v=u(d,g,"source",["flowNode","participant"]),b=u(d,y,"target",["flowNode","participant"]);if(v&&b){const x=c(g),C=c(y);x!==void 0&&x===C&&i.push({kind:"message-flow-same-pool",opIndex:d,id:h})}break}case"dataStore.add":{for(const h of p.associations??[]){if([h.source,h.target].filter(v=>v===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const y=h.source===p.dataStore.id?h.target:h.source;u(d,y,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:g}=p.association,y=u(d,h,"source"),v=u(d,g,"target");if(y&&v){const b=new Set([y,v]);b.has("dataStore")&&b.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:g})}break}case"association.add":{const{id:h,source:g,target:y}=p.association,v=u(d,g,"source"),b=u(d,y,"target");v&&b&&v!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${g}->${y}`});break}case"annotation.add":{if(p.association){const{source:h,target:g}=p.association;if(h!==p.annotation.id&&g!==p.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:p.annotation.id});else{const y=h===p.annotation.id?g:h;u(d,y,"association")}}p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.add":{for(const h of p.group.members??[]){const g=u(d,h,"member");g&&Ih.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(f(d,p.id,"participant")===void 0)break;if(p.lanes){const h=t.lanesOf(p.id),g=p.lanes.map(v=>v.id);for(const v of h)g.includes(v)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.id,lane:v});for(const v of g)t.categoryOf(v)!==void 0&&!h.includes(v)&&i.push({kind:"id-duplicate",opIndex:d,id:v});const y=g.filter(v=>h.includes(v));y.length===h.length&&y.some((v,b)=>v!==h[b])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:p.id})}break}case"node.update":{if(f(d,p.id,"flowNode")===void 0)break;if(p.lane!==void 0){const h=t.participantOf(p.id);(h?o.get(h)??t.lanesOf(h):[]).includes(p.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:p.lane,participant:h??""})}break}case"sequenceFlow.update":{if(f(d,p.id,"sequenceFlow")===void 0)break;if(p.name!==void 0&&p.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:p.id}),p.source!==void 0||p.target!==void 0){const h=p.source===void 0||u(d,p.source,"source",["flowNode"])!==void 0,g=p.target===void 0||u(d,p.target,"target",["flowNode"])!==void 0,y=t.endpointsOf(p.id),v=p.source??(y==null?void 0:y.source),b=p.target??(y==null?void 0:y.target);h&&g&&v!==void 0&&b!==void 0&&new Set([c(v),c(b),c(p.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:p.id})}break}case"messageFlow.update":f(d,p.id,"messageFlow");break;case"dataStore.update":f(d,p.id,"dataStore");break;case"annotation.update":{if(f(d,p.id,"annotation")===void 0)break;p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.update":{if(f(d,p.id,"group")===void 0)break;for(const h of p.members??[]){const g=u(d,h,"member");g&&Ih.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:g})}break}case"element.remove":{f(d,p.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:p.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function f(p,d,m){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:p,id:d});return}const h=t.categoryOf(d);if(h===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:"target"});return}if(m&&h!==m){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:m,actual:h});return}return h}}function $h(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 Ts(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Ms={"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]},nn=10,Fh=40,w1=10;function vl(e,t,n,i,r){const o=n,a=(k,L)=>{const[z,ae]=Ms[k];let me={x:t.x+t.width/2+z*(t.width/2+o.width/2+L),y:t.y+t.height/2+ae*(t.height/2+o.height/2+L)};const Ue=i.x+nn+o.width/2,$e=i.x+i.width-nn-o.width/2,q=i.y+nn+o.height/2,le=i.y+i.height-nn-o.height/2,oe={x:Math.min($e,Math.max(Ue,me.x)),y:Math.min(le,Math.max(q,me.y))};return(oe.x!==me.x||oe.y!==me.y)&&(me=Math.abs(oe.x-(t.x+t.width/2))<(t.width+o.width)/2+nn&&Math.abs(oe.y-(t.y+t.height/2))<(t.height+o.height)/2+nn?{x:t.x+t.width+nn+o.width/2,y:oe.y}:oe),me},s=(i.children??[]).filter(k=>!("waypoints"in k&&k.waypoints)&&k.type!=="bpmn:Lane"&&k.type!=="label"&&typeof k.x=="number"&&k.id!==r.selfId),c=rt(e),u=k=>{var z,ae;if(!r.selfId)return!1;const L=e.get(k);return!!L&&(((z=L.source)==null?void 0:z.id)===r.selfId||((ae=L.target)==null?void 0:ae.id)===r.selfId)},l=c.edges.filter(k=>!u(k.id)).flatMap(_n),f=fo(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),p=k=>({x0:k.x-o.width/2-nn,x1:k.x+o.width/2+nn,y0:k.y-o.height/2-nn,y1:k.y+o.height/2+nn}),d=k=>{const L=p(k);return s.some(z=>L.x0<z.x+z.width&&L.x1>z.x&&L.y0<z.y+z.height&&L.y1>z.y)},m=k=>{const L=p(k);return l.some(z=>z.axis==="h"?z.at>L.y0&&z.at<L.y1&&z.lo<L.x1&&z.hi>L.x0:z.at>L.x0&&z.at<L.x1&&z.lo<L.y1&&z.hi>L.y0)},h=k=>{const L=p(k);return f.some(z=>L.x0<z.x+z.width&&L.x1>z.x&&L.y0<z.y+z.height&&L.y1>z.y)},g=c.shapes.filter(k=>k.type==="bpmn:Group").flatMap(k=>[{axis:"h",at:k.y,lo:k.x,hi:k.x+k.width},{axis:"h",at:k.y+k.height,lo:k.x,hi:k.x+k.width},{axis:"v",at:k.x,lo:k.y,hi:k.y+k.height},{axis:"v",at:k.x+k.width,lo:k.y,hi:k.y+k.height}]),y=k=>{const L=p(k);return g.some(z=>z.axis==="h"?z.at>L.y0&&z.at<L.y1&&z.lo<L.x1&&z.hi>L.x0:z.at>L.x0&&z.at<L.x1&&z.lo<L.y1&&z.hi>L.y0)},v=k=>d(k)||m(k)||h(k)||y(k),b=k=>k.x-o.width/2>=i.x&&k.x+o.width/2<=i.x+i.width&&k.y-o.height/2>=i.y&&k.y+o.height/2<=i.y+i.height;if(r.placement){const k=$e=>$e.startsWith("top")?$e.replace(/^top/,"bottom"):$e.replace(/^bottom/,"top"),L=$e=>$e.endsWith("left")?$e.replace(/left$/,"right"):$e.replace(/right$/,"left"),z=r.placement.side,ae=[z,k(z),L(z),k(L(z)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],me=r.placement.offset??50;let Ue=a(z,me);if(v(Ue)){const $e=new Set;for(const q of ae){if($e.has(q))continue;$e.add(q);const le=a(q,me);if(b(le)&&!v(le)){Ue=le;break}}}return Ue}const x=r.from,C=i.x+nn+o.width/2,P=i.x+i.width-nn-o.width/2,D=i.y+nn+o.height/2,T=i.y+i.height-nn-o.height/2;let I={x:Math.min(P,Math.max(C,x.x)),y:Math.min(T,Math.max(D,x.y))};if(v(I)){const k=(t.width+o.width)/2+nn,z=[{x:I.x+k,y:I.y},{x:I.x-k,y:I.y},{x:I.x,y:I.y-o.height-nn},{x:I.x,y:I.y+o.height+nn}].filter(b).find(ae=>!v(ae));z&&(I=z)}return I}function Zt(e,t){return e.filter(n=>n.kind===t)}function jh(e,t){var g0,y0,v0,b0,x0,_0,w0,E0,S0,R0,C0,P0,A0,T0,M0,k0,O0,D0,L0,I0,B0,N0,$0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=_=>o.get(_),f=_=>{const R=l(_);if(!R)throw new Error(`하강 참조 해소 실패: ${_}`);return R},p=_=>{let R=_.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},d=new Map;for(const _ of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))d.set(_.id,{x:_.x,y:_.y});const m=Zt(e,"participant.add"),h=Zt(e,"node.add"),g=Zt(e,"sequenceFlow.add"),y=Zt(e,"messageFlow.add"),v=Zt(e,"dataStore.add"),b=Zt(e,"dataAssociation.add"),x=Zt(e,"annotation.add"),C=Zt(e,"group.add"),P=new Map(h.map(_=>[_.node.id,_])),D=(_,R,A)=>{var j;const O=_.businessObject,F=(((j=O.extensionElements)==null?void 0:j.values)??[]).filter(H=>H.$type!==R),B=A?[...F,i.create(R,A)]:F;if(!B.length){O.extensionElements&&n.updateProperties(_,{extensionElements:void 0});return}const N=i.create("bpmn:ExtensionElements",{values:B});B.forEach(H=>{H.$parent=N}),n.updateProperties(_,{extensionElements:N})},T=_=>({anchor:_.anchor,side:_.side,..._.offset!==void 0?{offset:_.offset}:{}});for(const _ of Zt(e,"element.remove")){const R=l(_.id);R&&n.removeElements([R])}const I=_=>o.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=p(R))==null?void 0:A.id)===_}).sort((R,A)=>R.y-A.y);for(const _ of Zt(e,"participant.update")){const R=f(_.id);if(_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),!_.lanes)continue;const A=I(_.id);if(!A.length){n.splitLane(R,_.lanes.length),I(_.id).forEach((F,B)=>{const N=_.lanes[B];N&&n.updateProperties(F,{id:N.id,name:N.name})});continue}const O=new Set(A.map(F=>F.id));_.lanes.forEach((F,B)=>{if(O.has(F.id)){n.updateProperties(f(F.id),{name:F.name});return}const N=B===0?n.addLane(I(_.id)[0],"top"):n.addLane(f(_.lanes[B-1].id),"bottom");n.updateProperties(N,{id:F.id,name:F.name})})}const k=150,L=130,z=80,ae=90,me=180,Ue=30,$e=30,q=(_,R,A,O,F)=>{const B=A-R.width/2,N=O-R.height/2;return(_.children??[]).find(j=>!("waypoints"in j&&j.waypoints)&&j.type!=="bpmn:Lane"&&j.type!=="label"&&!(F!=null&&F.has(j.id))&&typeof j.x=="number"&&B<j.x+j.width+$e&&B+R.width+$e>j.x&&N<j.y+j.height&&N+R.height>j.y)},le=new Set;for(const _ of m){le.add(`pool:${_.participant.id}`);for(const R of _.participant.lanes??[])le.add(R.id)}const oe=new Map;for(const _ of h){const R=_.node.lane??`pool:${_.node.participant??""}`;let A=oe.get(R);A||oe.set(R,A=new Set([0])),_.band!==void 0&&A.add(_.band)}const fe=new Map;for(const[_,R]of oe){if(!le.has(_))continue;const A=[...R].sort((B,N)=>B-N),O=A.map((B,N)=>N===0?0:N%2===1?Math.ceil(N/2):-(N/2)),F=Math.min(...O);fe.set(_,new Map(A.map((B,N)=>[B,O[N]-F])))}{const _=new Map;for(const R of m)(R.participant.lanes??[]).forEach((A,O)=>_.set(A.id,O));for(const[R,A]of fe){if(!_.has(R)||A.size<2)continue;const O=_.get(R),F=A.get(0)??0,B=new Set;for(const re of h){if(re.node.lane!==R||(re.band??0)!==0||!re.node.type.endsWith("Gateway"))continue;const ke={in:new Set,out:new Set,cross:new Set};for(const be of g){const Re=be.flow.source===re.node.id;if(!Re&&be.flow.target!==re.node.id)continue;const lt=P.get(Re?be.flow.target:be.flow.source);if(!lt||lt.node.participant!==re.node.participant||!lt.node.lane)continue;let ue,ge=!1;if(lt.node.lane!==R){const Se=_.get(lt.node.lane);if(Se===void 0)continue;ue=Se>O?"down":"up",ge=!0}else{const Se=A.get(lt.band??0)??F;ue=Se>F?"down":Se<F?"up":void 0}ue&&(ke[Re?"out":"in"].add(ue),ge&&ke.cross.add(ue))}for(const be of["up","down"])ke.in.has(be)&&ke.out.has(be)&&ke.cross.has(be)&&B.add(be)}if(B.size!==1)continue;const[N]=B,j=Math.max(...A.values()),H=N==="down"?j:0;if(F===H)continue;const K=[...A.entries()].filter(([re])=>re!==0).sort((re,ke)=>re[1]-ke[1]),pe=[...Array(j+1).keys()].filter(re=>re!==H),we=new Map([[0,H]]);K.forEach(([re],ke)=>we.set(re,pe[ke])),fe.set(R,we)}}const Oe=_=>{var R;return(((R=oe.get(_))==null?void 0:R.size)??0)>1},W=_=>_.band??(_.node.lane||!Oe(`pool:${_.node.participant??""}`)?void 0:0),Y=new Map,Z=_=>Y.get(_.node.id)??W(_),Me=new Set,mt=new Set;{const _=new Map;for(const O of g)_.set(O.flow.target,(_.get(O.flow.target)??0)+1);const R=O=>{const F=[],B=new Set([O]),N=[O];for(;N.length;){const j=N.shift();F.push(j);for(const H of g)H.flow.source!==j||B.has(H.flow.target)||(_.get(H.flow.target)??0)!==1||(B.add(H.flow.target),N.push(H.flow.target))}return F},A=(O,F)=>{var B;return((B=fe.get(O))==null?void 0:B.get(F))??F};for(const O of h){if(!O.node.type.endsWith("Gateway"))continue;const F=O.node.lane??`pool:${O.node.participant??""}`,B=fe.get(F);if(!B||B.size<2)continue;const N=Z(O);if(N===void 0||A(F,N)!==A(F,0))continue;const j=A(F,N),H=g.filter(be=>be.flow.source===O.node.id).map(be=>P.get(be.flow.target)).filter(be=>!!be&&(be.node.lane??`pool:${be.node.participant??""}`)===F),K=H.filter(be=>{const Re=Z(be);return Re!==void 0&&A(F,Re)===j&&(_.get(be.node.id)??0)===1}),pe=H.some(be=>{const Re=Z(be);return Re!==void 0&&A(F,Re)>j});if(K.length!==1||!pe)continue;const we=new Set(H.flatMap(be=>R(be.node.id)));if(!g.some(be=>be.flow.target===O.node.id&&we.has(be.flow.source)))continue;const ke=new Map;for(const[be,Re]of B)ke.set(be,Re+1);ke.set(-1,0),fe.set(F,ke);for(const be of R(K[0].node.id))P.has(be)&&(Y.set(be,-1),mt.add(be));Me.add(O.node.id)}}const M=(_,R)=>{var A;return((A=fe.get(_))==null?void 0:A.get(R))??R},S=(_,R,A,O)=>{const F=_?l(_):R?l(R):void 0;if(!F)return!1;const B=_?F.y+Math.min(F.height/2,ae):F.y+z;return Math.abs(B+M(_??`pool:${R??""}`,A)*k-O)<=k/2},w=new Map;for(const[_,R]of oe){let A=0;for(const O of R)A=Math.max(A,M(_,O));w.set(_,A)}const G=_=>me+k*_,U=(_,R,A)=>{const O=u().children.filter(F=>!("waypoints"in F&&F.waypoints)&&F.id!==R&&typeof F.y=="number"&&F.y>=_);O.length&&n.moveElements(O,{x:0,y:A})},X=(_,R,A)=>{const O=_.type==="bpmn:Participant"?_:void 0;if(!O||O.children.some(j=>j.type==="bpmn:Lane"))return;const F=A+R.height/2+Ue-O.y;if(O.height>=F)return;const B=F-O.height,N=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:F}),U(N,O.id,B)},xe=(_,R,A)=>{if(_){const N=f(_),j=G(R);if(N.height>=j)return;const H=j-N.height,K=p(N),pe=K?K.y+K.height:N.y+N.height;n.resizeLane(N,{x:N.x,y:N.y,width:N.width,height:j},!1),U(pe,K==null?void 0:K.id,H);return}if(!A)return;const O=k*(R+1);if(A.height>=O)return;const F=O-A.height,B=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:O}),U(B,A.id,F)},He=new Map;for(const _ of g)He.set(_.flow.target,(He.get(_.flow.target)??0)+1);const tt=_=>(He.get(_)??0)<=1,kt=(_,R,A)=>{if(!_)return!0;const O=l(_);return O?A-R.height/2>=O.y&&A+R.height/2<=O.y+O.height:!0},ot=m.map((_,R)=>({op:_,declared:R}));ot.sort((_,R)=>{const A=_.op.order??Number.POSITIVE_INFINITY,O=R.op.order??Number.POSITIVE_INFINITY;return A!==O?A-O:_.declared-R.declared});let At=80;for(const _ of o.getAll())_.parent===u()&&"height"in _&&typeof _.y=="number"&&(At=Math.max(At,_.y+_.height+60));for(const{op:_}of ot){const R=_.participant,A=h.filter(re=>re.node.participant===R.id).length,O=((g0=R.lanes)==null?void 0:g0.length)??0,F=Math.max(1200,A*160+300),B=(R.lanes??[]).map(re=>G(w.get(re.id)??0)),N=B.reduce((re,ke)=>re+ke,0);O&&N<300&&(B[O-1]+=300-N);const j=Math.max(300,k*((w.get(`pool:${R.id}`)??0)+1)),H=R.blackBox||A+O===0?120:O?Math.max(300,N):j,K=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,..._.order!==void 0?{"bwl:poolOrder":_.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:F,height:H,isExpanded:!0}),pe=n.createShape(K,{x:100+F/2,y:At+H/2},u()),we=R.lanes??[];if(we.length&&n.splitLane(pe,we.length),we.length){const re=o.filter(ke=>{var be;return ke.type==="bpmn:Lane"&&((be=p(ke))==null?void 0:be.id)===R.id}).sort((ke,be)=>ke.y-be.y);if(re.forEach((ke,be)=>{const Re=we[be];Re&&n.updateProperties(ke,{id:Re.id,name:Re.name})}),B.some(ke=>ke!==pe.height/O)){let ke=pe.y;re.forEach((be,Re)=>{const lt=B[Re];n.resizeShape(be,{x:be.x,y:ke,width:be.width,height:lt}),ke+=lt})}}At=pe.y+pe.height+60}const yn=_=>{var O;const R=P.get(_);if(R)return R.node.participant??"";const A=l(_);return A?A.type==="bpmn:Participant"?A.id:((O=p(A))==null?void 0:O.id)??"":""},Jt=new Map,gt=_=>{let R=Jt.get(_);return R||Jt.set(_,R={nodes:[],flows:[]}),R};for(const _ of h)gt(_.node.participant??"").nodes.push(_);for(const _ of g)gt(yn(_.flow.source)).flows.push(_);const Dt=_=>{var R;return i.create("bpmn:SequenceFlow",{id:_.id,name:_.name??((R=_.condition)==null?void 0:R.label)})},cn=(_,R)=>r.createShape({type:Ts(_.type),businessObject:i.create(Ts(_.type),{id:_.id,name:_.name,...R!==void 0?{"bwl:band":R}:{}})}),qo=[...ot.map(({op:_})=>_.participant.id).filter(_=>Jt.has(_)),...[...Jt.keys()].filter(_=>!m.some(R=>R.participant.id===_))],Hn=_=>_.endsWith("Gateway");for(const _ of qo){const R=Jt.get(_),A=_?f(_):void 0,O=A?A.x+150:250;let F=A?A.y+80:120;const B=(ue,ge,Se)=>{if(ue){const Pe=f(ue);return Pe.y+Math.min(Pe.height/2,ae)+M(ue,ge??0)*k}return ge!==void 0&&A?A.y+z+M(`pool:${_}`,ge)*k:Se},N=(ue,ge,Se)=>{if(ue){const Pe=f(ue);return Pe.y+Math.min(Pe.height/2,ae)+ge*k}return A?A.y+z+ge*k:Se},j=ue=>ue.participant?f(ue.participant):u(),H=(ue,ge,Se,Pe,it,ze,Ve)=>{const yt=Se!==void 0||Pe!==void 0,_e=M(Se??`pool:${_}`,Pe??0);if((Pe===void 0||S(Se,_,Pe,Ve??Number.NaN))&&Ve!==void 0&&kt(Se,ge,Ve)&&!q(ue,ge,it,Ve))return{x:it,y:Ve};if(yt)for(let Q=0;Q<4;Q++){const ne=N(Se,_e+Q,ze);if(!q(ue,ge,it,ne))return xe(Se,_e+Q,A),{x:it,y:ne}}const et=B(Se,Pe,ze);yt?xe(Se,_e,A):X(ue,ge,et);let ie=it;for(let Q=0;Q<64;Q++){const ne=q(ue,ge,ie,et);if(!ne)break;ie=ne.x+ne.width+L+ge.width/2}return{x:ie,y:et}},K=new Set(R.flows.map(ue=>ue.flow.target)),pe=new Map;for(const ue of R.nodes){if(K.has(ue.node.id))continue;const ge=cn(ue.node,ue.band),Se=W(ue),Pe=ue.node.lane?`${ue.node.lane}|${Se??""}`:Se!==void 0?`band:${Se}`:"",it=j(ue.node),ze=H(it,ge,ue.node.lane,Se,pe.get(Pe)??O,F);n.createShape(ge,ze,it),pe.set(Pe,ze.x+ge.width+L),!ue.node.lane&&Se===void 0&&(F+=160)}const we=new Set,re=new Map,ke=new Map,be=new Map;if(_&&le.has(`pool:${_}`)){const ue=new Map;for(const _e of R.flows)ue.set(_e.flow.target,(ue.get(_e.flow.target)??0)+1);const ge=_e=>B(_e.node.lane,Z(_e),Number.NaN),Se=new Set,Pe=_e=>{var Q;const et=(Q=P.get(_e))==null?void 0:Q.node.participant;if(et)return l(et);const ie=l(_e);if(ie)return ie.type==="bpmn:Participant"?ie:p(ie)},it=_e=>{const et=[],ie=new Set([_e]),Q=[_e];for(;Q.length;){const ne=Q.shift(),Ee=P.get(ne);Ee&&et.push(Ee);for(const de of R.flows)de.flow.source!==ne||ie.has(de.flow.target)||(ue.get(de.flow.target)??0)!==1||(ie.add(de.flow.target),Q.push(de.flow.target))}return et},ze=_e=>{if(!A)return;const et=new Set(_e.map(ne=>ne.node.id));let ie=!1,Q=!1;for(const ne of y){if(!et.has(ne.flow.source))continue;const Ee=Pe(ne.flow.target);!Ee||Ee.id===A.id||(Ee.y<A.y?ie=!0:Q=!0)}return ie&&!Q?"up":Q&&!ie?"down":void 0};for(const _e of R.nodes){if(!Hn(_e.node.type))continue;const et=B(_e.node.lane,W(_e),Number.NaN);if(Number.isNaN(et))continue;const ie=[];for(const de of R.flows){if(de.flow.source!==_e.node.id)continue;const ce=P.get(de.flow.target);if(!ce||ce.node.lane!==_e.node.lane||(ue.get(ce.node.id)??0)!==1)continue;const Ae=W(ce);if(Ae===void 0)continue;const at=B(ce.node.lane,Ae,Number.NaN);if(Number.isNaN(at))continue;const xt=it(ce.node.id),ct=ze(xt);ct&&ie.push({subtree:xt,band:Ae,row:at,dir:ct})}if(!ie.some(de=>de.dir==="up")||!ie.some(de=>de.dir==="down")||!ie.some(de=>de.dir==="up"&&ie.some(ce=>ce.dir==="down"&&ce.row<de.row)))continue;const ne=[...ie].sort((de,ce)=>de.row-ce.row);[...ie.filter(de=>de.dir==="up"),...ie.filter(de=>de.dir==="down")].sort((de,ce)=>de.dir===ce.dir?de.row-ce.row:de.dir==="up"?-1:1).forEach((de,ce)=>{const Ae=ne[ce].band;if(Ae!==de.band){Se.add(_e.node.id);for(const at of de.subtree)W(at)===de.band&&Y.set(at.node.id,Ae)}})}const Ve=_e=>{if(!A)return;const et=new Set(_e.map(ne=>ne.node.id));let ie=!1,Q=!1;for(const ne of y){if(!et.has(ne.flow.target))continue;const Ee=Pe(ne.flow.source);!Ee||Ee.id===A.id||(Ee.y<A.y?ie=!0:Q=!0)}return ie&&!Q?"up":Q&&!ie?"down":void 0};for(const _e of R.nodes){if(!Hn(_e.node.type))continue;const et=_e.node.lane??`pool:${_}`,ie=fe.get(et);if(!ie||ie.size<2)continue;const Q=ie.get(0);if(Q===void 0)continue;const ne=Math.max(...ie.values()),Ee=Q===ne&&Q!==0?"down":void 0;if(!Ee)continue;const de=[];for(const ct of R.flows){if(ct.flow.source!==_e.node.id)continue;const qe=P.get(ct.flow.target);if(!qe||qe.node.lane!==_e.node.lane||(ue.get(qe.node.id)??0)!==1)continue;const qt=Z(qe);qt!==void 0&&de.push({t:qe,subtree:it(qe.node.id),band:qt})}const ce=de.find(ct=>(ie.get(ct.band)??ct.band)===Q);if(!ce||Ve(ce.subtree)===Ee||ze(ce.subtree)===Ee)continue;const Ae=de.find(ct=>ct!==ce&&Ve(ct.subtree)===Ee);if(!Ae)continue;const at=ce.band,xt=Ae.band;for(const ct of ce.subtree)Z(ct)===at&&Y.set(ct.node.id,xt);for(const ct of Ae.subtree)Z(ct)===xt&&Y.set(ct.node.id,at);Se.add(_e.node.id)}for(const _e of R.nodes){if(!Hn(_e.node.type))continue;const et=ge(_e);if(Number.isNaN(et)||x.some(de=>{var ce,Ae;return(((ce=de.placement)==null?void 0:ce.anchor)??(de.association?de.association.source===de.annotation.id?de.association.target:de.association.source:void 0))===_e.node.id&&((Ae=de.placement)==null?void 0:Ae.side.startsWith("bottom"))}))continue;let Q,ne=!1,Ee;for(const de of R.flows){if(de.flow.source!==_e.node.id)continue;const ce=P.get(de.flow.target);if(!ce||!ce.node.lane&&W(ce)===void 0)continue;const Ae=ge(ce);Number.isNaN(Ae)||(Math.abs(Ae-et)<.5&&(ne=!0),Ae>et?!Q||Ae>Q.row?Q={id:ce.node.id,row:Ae,count:1}:Ae===Q.row&&Q.count++:Ae<et&&ce.node.lane===_e.node.lane&&(!Ee||Ae>Ee.row?Ee={op:ce,row:Ae,count:1}:Ae===Ee.row&&Ee.count++))}Q&&Q.count===1&&(ue.get(Q.id)??0)===1&&!Se.has(_e.node.id)&&we.add(Q.id),!ne&&Ee&&Ee.count===1&&(ue.get(Ee.op.node.id)??0)===1&&!Me.has(_e.node.id)&&re.set(Ee.op.node.id,{lane:_e.node.lane,band:Z(_e)})}const yt=new Map;for(const _e of y)yt.set(_e.flow.target,[...yt.get(_e.flow.target)??[],_e]);for(const _e of R.nodes){const et=yt.get(_e.node.id);if(!et||et.length!==1||!ue.get(_e.node.id)||!_e.node.lane&&W(_e)===void 0||mt.has(_e.node.id))continue;const ie=(y0=P.get(et[0].flow.source))==null?void 0:y0.node.participant,Q=ie?l(ie):void 0;if(!Q||!A||Q.id===A.id)continue;const ne=_e.node.lane??`pool:${_}`,Ee=fe.get(ne);if(!Ee)continue;const de=Ee.get(0)??0,ce=(Ee.get(Z(_e)??0)??de)-de;if(ce===0)continue;const Ae=Q.y<A.y;if(Ae&&ce<0||!Ae&&ce>0)continue;let at;for(const[xt,ct]of Ee){const qe=ct-de;(Ae&&qe<0&&(!at||qe<at.row)||!Ae&&qe>0&&(!at||qe>at.row))&&(at={band:xt,row:qe})}at&&ke.set(_e.node.id,{lane:_e.node.lane,band:at.band})}}const Re=new Set;let lt=0;for(;lt++<R.nodes.length+2;){for(let Se=0;Se<R.nodes.length+R.flows.length+2;Se++){let Pe=!1;for(const it of R.flows){const ze=it.flow;if(Re.has(ze.id))continue;const Ve=l(ze.source);if(!Ve)continue;const yt=l(ze.target),_e=P.get(ze.target);if(!yt&&_e){const et=cn(_e.node,_e.band),ie=Z(_e);if(_e.node.lane||ie!==void 0){const Q=j(_e.node),ne=Ve,Ee=ne.x+(be.get(ze.source)??0)+ne.width+L,de=re.get(ze.target)??ke.get(ze.target),ce=H(Q,et,de?de.lane:_e.node.lane,de?de.band:ie,we.has(ze.target)?ne.x+ne.width/2:Ee,Number.NaN,de||!tt(ze.target)?void 0:ne.y+ne.height/2),Ae=n.createShape(et,ce,Q);we.has(ze.target)&&be.set(ze.target,Ee-(Ae.x+Ae.width/2)),n.connect(Ve,Ae,{type:"bpmn:SequenceFlow",businessObject:Dt(ze)})}else s.append(Ve,et,{connection:{type:"bpmn:SequenceFlow",businessObject:Dt(ze)}})}else if(yt)n.connect(Ve,yt,{type:"bpmn:SequenceFlow",businessObject:Dt(ze)});else continue;Re.add(ze.id),Pe=!0}if(!Pe)break}const ue=R.nodes.filter(Se=>!l(Se.node.id));if(!ue.length)break;const ge=ue[0];{const Se=cn(ge.node,ge.band),Pe=j(ge.node),it=W(ge);n.createShape(Se,H(Pe,Se,ge.node.lane,it,O,F),Pe),!ge.node.lane&&it===void 0&&(F+=160)}}}const ci=40,un=(_,R=()=>!0)=>{const A=l(_);if(!A)return[];const O=[A],F=new Set([_]);for(let B=0;B<O.length;B++){const N=O[B].id;for(const j of g){const H=j.flow.target;if(j.flow.source!==N||F.has(H)||!P.has(H))continue;F.add(H);const K=l(H);K&&R(K)&&O.push(K)}}return O},Yt=(_,R=()=>!0)=>{const A=l(_);if(!A)return[];const O=[A],F=new Set([_]);for(let B=0;B<O.length;B++){const N=O[B].id;for(const j of g){const H=j.flow.source;if(j.flow.target!==N||F.has(H)||!P.has(H))continue;F.add(H);const K=l(H);K&&R(K)&&O.push(K)}}return O},Sn=30,Mi=_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number",vn=(_,R)=>{const A=new Set(_.flatMap(N=>N.subtree.map(j=>j.id)));for(const N of _){const j=(N.pool.children??[]).filter(Mi).filter(K=>!A.has(K.id));if(N.subtree.some(K=>j.some(pe=>K.x+R<pe.x+pe.width+Sn&&K.x+R+K.width+Sn>pe.x&&K.y<pe.y+pe.height&&K.y+K.height>pe.y)))return null}const O=_.map(N=>N.pool.width),F=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));n.moveElements(_.flatMap(N=>N.subtree),{x:R,y:0});const B=_.map(N=>{const H=Math.max(...N.subtree.map(K=>K.x+K.width))+150-(N.pool.x+N.pool.width);return H>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:N.pool.width+H,height:N.pool.height}),H});return()=>{n.moveElements(_.flatMap(N=>N.subtree),{x:-R,y:0}),_.forEach((N,j)=>{B[j]>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:O[j],height:N.pool.height})});for(let N=0;N<3;N++){let j=0;for(const H of F){const K=H.x-H.label.x,pe=H.y-H.label.y;Math.abs(K)<=.5&&Math.abs(pe)<=.5||(n.moveElements([H.label],{x:K,y:pe}),j++)}if(!j)break}}},nt=_=>{var F,B;const R=new Map,A=new Map;for(const N of o.getAll()){if(N.type!=="bpmn:Participant")continue;const j=N;(j.children??[]).length||(R.set(j.id,j),A.set(j.id,[]))}for(const N of o.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const j=N,H=(F=j.source)==null?void 0:F.id,K=(B=j.target)==null?void 0:B.id;H&&K&&A.has(H)&&A.get(H).push(K),H&&K&&A.has(K)&&A.get(K).push(H)}const O=[];for(const[N,j]of A)j.length&&j.every(H=>_.has(H))&&O.push(R.get(N));return O},st=(_,R)=>{if(!_.length)return null;const A=new Set(_.map(N=>N.id)),O=o.getAll().filter(N=>N.type==="bpmn:Participant"&&!A.has(N.id));if(_.some(N=>O.some(j=>N.x+R<j.x+j.width+Sn&&N.x+R+N.width+Sn>j.x&&N.y<j.y+j.height&&N.y+N.height>j.y)))return null;const B=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));return n.moveElements(_,{x:R,y:0}),()=>{n.moveElements(_,{x:-R,y:0});for(let N=0;N<3;N++){let j=0;for(const H of B){const K=H.x-H.label.x,pe=H.y-H.label.y;Math.abs(K)<=.5&&Math.abs(pe)<=.5||(n.moveElements([H.label],{x:K,y:pe}),j++)}if(!j)break}}},X_=()=>{let _=0;for(const R of o.getAll()){if(R.type!=="bpmn:DataInputAssociation"&&R.type!=="bpmn:DataOutputAssociation")continue;const A=R.waypoints??[];for(let O=1;O<A.length;O++)_+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return _},Z_=()=>{let _=0;for(const R of o.getAll()){if(R.type!=="bpmn:Association")continue;const A=R.waypoints??[];for(let O=1;O<A.length;O++)_+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return _},dL=_=>{const R=[];for(const A of o.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const O=A;if(_.has(O.id))continue;const B=[...O.incoming??[],...O.outgoing??[]].filter(H=>H.type==="bpmn:Association").map(H=>H.source===O?H.target:H.source);if(!B.length||B.some(H=>H===void 0))continue;const N=H=>{if(!("waypoints"in H&&H.waypoints))return[H.id];const K=H,pe=[K.source,K.target];return pe.some(we=>!we)?[]:pe.map(we=>we.id)},j=B.flatMap(H=>N(H));j.length&&j.every(H=>_.has(H))&&R.push(O)}return R},Q_=()=>dn(rt(o)).filter(_=>_.kind==="edge-crosses-shape").length,J_=_=>{const R=(_.children??[]).filter(Mi);let A=0;for(let O=0;O<R.length;O++)for(let F=O+1;F<R.length;F++){const B=R[O],N=R[F];B.x<N.x+N.width&&B.x+B.width>N.x&&B.y<N.y+N.height&&B.y+B.height>N.y&&A++}return A},Ko=()=>{const _=rt(o),R=A=>A.length>=2&&(A.every(O=>Math.abs(O.x-A[0].x)<.01)||A.every(O=>Math.abs(O.y-A[0].y)<.01));return{messages:_.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:_.edges.filter(A=>R(A.waypoints)).length}},hL=_=>{const R=new Map;for(const O of o.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const F=O;if(!F.waypoints||F.waypoints.length!==2)continue;const B=F.source,N=F.target;if(!B||!N)continue;const j=_.has(B.id);if(j===_.has(N.id))continue;const H=j?N:B,K=p(H);if(!K||_.has(H.id))continue;const pe=R.get(K.id);pe?H.x<pe.minX&&(pe.minX=H.x):R.set(K.id,{pool:K,minX:H.x})}const A=[];for(const{pool:O,minX:F}of R.values()){const B=(O.children??[]).filter(N=>Mi(N)&&!_.has(N.id)&&N.x>=F);B.length&&A.push({subtree:B,pool:O})}return A};for(const _ of Zt(e,"sequenceFlow.update")){if(_.target===void 0)continue;const R=P.get(_.target);if(!R)continue;const A=l(_.target),O=l(_.id);if(!A||!O)continue;const F=_.source!==void 0?l(_.source):O.source,B=O.target;if(!F||!B||B.id===A.id)continue;const N=un(_.target),j=new Set(N.map(Ve=>Ve.id)),H=Math.min(...N.map(Ve=>Ve.x)),K=Math.max(...N.map(Ve=>Ve.x+Ve.width)),pe=F.x+F.width,we=K-H+ci*2-(B.x-pe);let re=[];if(we>0){const Ve=p(A),yt=(Ve==null?void 0:Ve.children)??[],_e=ne=>ne.type==="bpmn:Lane";re=(()=>{const ne=new Set;for(const de of yt)Mi(de)&&!j.has(de.id)&&de.id!==F.id&&de.x>=B.x&&ne.add(de.id);const Ee=[];for(const de of yt){if(de.type!=="bpmn:DataStoreReference"&&de.type!=="bpmn:DataObjectReference")continue;const ce=de,at=[...ce.incoming??[],...ce.outgoing??[]].filter(xt=>xt.type==="bpmn:DataInputAssociation"||xt.type==="bpmn:DataOutputAssociation").map(xt=>xt.source===ce?xt.target:xt.source);at.length&&at.every(xt=>xt!==void 0&&ne.has(xt.id))&&Ee.push(ce)}return Ee})();const ie=yt.filter(ne=>!("waypoints"in ne&&ne.waypoints)&&!_e(ne)&&!j.has(ne.id)&&ne.id!==F.id&&ne.x>=B.x),Q=Ve?[Ve,...yt.filter(ne=>_e(ne))]:[];if(ie.length){const ne=new Set(ie.map(qe=>qe.id)),Ee=hL(ne),de=new Set(ne);for(const qe of Ee)for(const qt of qe.subtree)de.add(qt.id);const ce=dL(de),Ae=nt(ne),at=new Set(ne);for(const qe of Ee)for(const qt of qe.subtree)at.add(qt.id);const xt=Ee.length?nt(at):Ae;n.createSpace(ie,Q,{x:we,y:0},"e",B.x-1);let ct=!1;if(Ee.length){const qe=Ko(),qt=vn(Ee,we);if(qt){const Rn=xt.length?st(xt,we):null,eo=Ko();eo.messages>qe.messages&&eo.lines>=qe.lines?ct=!0:(Rn==null||Rn(),qt())}}if(!ct){for(const qe of Ee){const qt=Ko(),Rn=vn([qe],we);if(!Rn)continue;const eo=Ko();(eo.messages<=qt.messages||eo.lines<qt.lines)&&Rn()}if(Ae.length){const qe=Ko(),qt=st(Ae,we);if(qt){const Rn=Ko();(Rn.messages<=qe.messages||Rn.lines<qe.lines)&&qt()}}}if(ce.length){const qe=()=>new Set(dn(rt(o)).map(Rn=>xn(Rn))),qt=Rn=>{const eo=Z_(),AL=qe(),TL=Rn.map(Lt=>({a:Lt,x:Lt.x,y:Lt.y})),ML=o.filter(Lt=>Lt.type==="label").map(Lt=>({label:Lt,x:Lt.x,y:Lt.y}));n.moveElements(Rn,{x:we,y:0});const kL=[...qe()].filter(Lt=>!AL.has(Lt));if(Z_()<eo&&kL.length===0)return!0;for(const{a:Lt,x:ss,y:cs}of TL)(Lt.x!==ss||Lt.y!==cs)&&n.moveElements([Lt],{x:ss-Lt.x,y:cs-Lt.y});for(const Lt of ML){const ss=Lt.x-Lt.label.x,cs=Lt.y-Lt.label.y;(ss!==0||cs!==0)&&n.moveElements([Lt.label],{x:ss,y:cs})}return!1};if(!qt(ce)&&ce.length>1)for(const Rn of ce)qt([Rn])}}}const ke=R.node.lane!==void 0?l(R.node.lane):R.node.participant!==void 0?l(R.node.participant):void 0,be=Ve=>{if(!ke)return!0;const yt=Ve.y+Ve.height/2;return yt>=ke.y&&yt<=ke.y+ke.height},Re=!be(F)&&be(B)?B:F,lt=Re.y+Re.height/2,ue=lt-(A.y+A.height/2),ge=R.band!==void 0,Se=ge?[A]:N,Pe=(R.band===void 0||S(R.node.lane,R.node.participant,R.band,lt))&&tt(_.target)&&Se.every(Ve=>{var yt;return kt((yt=P.get(Ve.id))==null?void 0:yt.node.lane,Ve,Ve.y+Ve.height/2+ue)});Pe&&ge?(n.moveElements(N,{x:pe+ci-H,y:0}),n.moveElements([A],{x:0,y:ue})):n.moveElements(N,{x:pe+ci-H,y:Pe?ue:0});const it=p(A);if(!Pe&&R.node.lane===void 0&&R.band!==void 0&&it){const Ve=it.y+z+M(`pool:${R.node.participant??""}`,R.band)*k,yt=Ve-(A.y+A.height/2);yt!==0&&!q(it,A,A.x+A.width/2,Ve,j)&&n.moveElements([A],{x:0,y:yt})}const ze=re.length?p(re[0]):void 0;if(ze){const Ve={assoc:X_(),overlaps:J_(ze),crosses:Q_()},yt=re.map(ce=>({st:ce,x:ce.x})),_e=o.filter(ce=>ce.type==="label").map(ce=>({label:ce,x:ce.x,y:ce.y})),et=Math.min(...re.flatMap(ce=>[...ce.incoming??[],...ce.outgoing??[]].filter(Ae=>Ae.type==="bpmn:DataInputAssociation"||Ae.type==="bpmn:DataOutputAssociation").map(Ae=>(Ae.source===ce?Ae.target:Ae.source).x))),ie=new Set(re.map(ce=>ce.id)),Q=(ze.children??[]).filter(Mi).filter(ce=>!ie.has(ce.id));let ne=et;for(const ce of[...re].sort((Ae,at)=>Ae.x-at.x)){let Ae=ne;for(let at=0;at<100;at++){const xt=Q.find(ct=>Ae<ct.x+ct.width+Sn&&Ae+ce.width+Sn>ct.x&&ce.y<ct.y+ct.height&&ce.y+ce.height>ct.y);if(!xt)break;Ae=xt.x+xt.width+Sn}Ae!==ce.x&&n.moveElements([ce],{x:Ae-ce.x,y:0}),ne=Ae+ce.width+Sn}const Ee=ne+150-(ze.x+ze.width);Ee>0&&n.resizeShape(ze,{x:ze.x,y:ze.y,width:ze.width+Ee,height:ze.height});const de={assoc:X_(),overlaps:J_(ze),crosses:Q_()};if(de.assoc>=Ve.assoc||de.overlaps>Ve.overlaps||de.crosses>Ve.crosses){for(const{st:ce,x:Ae}of yt)ce.x!==Ae&&n.moveElements([ce],{x:Ae-ce.x,y:0});Ee>0&&n.resizeShape(ze,{x:ze.x,y:ze.y,width:ze.width-Ee,height:ze.height});for(const ce of _e){const Ae=ce.x-ce.label.x,at=ce.y-ce.label.y;(Ae!==0||at!==0)&&n.moveElements([ce.label],{x:Ae,y:at})}}}}const e0=(_,R)=>{const A=R.target===_,O=f(R.source),F=f(R.target),B=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,F,R.id?{type:B,businessObject:i.create(B,{id:R.id})}:{type:B})},mL=100,t0=_=>{for(const R of m){if(!R.participant.blackBox)continue;const A=l(R.participant.id);if(!A)continue;const O=[];for(const B of y){const N=B.flow.source===R.participant.id?B.flow.target:B.flow.target===R.participant.id?B.flow.source:void 0,j=N?l(N):void 0;j&&typeof j.x=="number"&&j.type!=="bpmn:Participant"&&O.push(j)}if(!O.length)continue;const F=Math.max(...O.map(B=>B.x+B.width/2))+mL;if(F>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:F-A.x,height:A.height}),!!_)for(const B of y){const N=l(B.flow.id),j=B.flow.source===R.participant.id?B.flow.target:B.flow.target===R.participant.id?B.flow.source:void 0,H=j?l(j):void 0;if(!N||!H||H.type==="bpmn:Participant")continue;const K=H.x+H.width/2;if(K<A.x+10||K>A.x+A.width-10)continue;const pe=A.y>H.y,we=pe?H.y+H.height:H.y,re=pe?A.y:A.y+A.height,ke=B.flow.source===R.participant.id?[{x:K,y:re},{x:K,y:we}]:[{x:K,y:we},{x:K,y:re}],be=rt(o),Re={...be.edges.find(lt=>lt.id===B.flow.id),waypoints:ke};tn(Re,Wn(be)).length||n.updateWaypoints(N,ke)}}};t0(!1);for(const _ of y){const R=_.flow;n.connect(f(R.source),f(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const A=new Set([...g.map(H=>H.flow.id),...y.map(H=>H.flow.id)].filter(H=>!!H)),O=o.filter(H=>!!H.waypoints),F=(H,K)=>Math.abs(K.x-H.x)<2?"L":Math.abs(K.x-(H.x+H.width))<2?"R":Math.abs(K.y-H.y)<2?"T":Math.abs(K.y-(H.y+H.height))<2?"B":void 0,B=new Map,N=(H,K,pe)=>{if(!H||!K||typeof H.x!="number")return;const we=F(H,K);if(!we)return;let re=B.get(H.id);re||B.set(H.id,re=new Map),re.set(we,[...re.get(we)??[],pe])};for(const H of O){const K=H.waypoints;!K||K.length<2||(N(H.source,K[0],{id:H.id,dir:"out"}),N(H.target,K[K.length-1],{id:H.id,dir:"in"}))}const j=new Set;for(const[H,K]of B){const pe=l(H);if(!pe||typeof pe.x!="number"||![...K.values()].some(ge=>{const Se=ge.filter(Pe=>Pe.dir==="in");return ge.length>=3&&Se.length>=1&&ge.some(Pe=>Pe.dir==="out")&&Se.some(Pe=>A.has(Pe.id))}))continue;const re=p(pe);if(!re||j.has(re.id)||(re.children??[]).some(ge=>ge.type==="bpmn:Lane"))continue;const ke=(v0=K.get("T"))!=null&&v0.length?(b0=K.get("B"))!=null&&b0.length?void 0:"B":"T";if(!ke||(ke==="T"?pe.y-re.y:re.y+re.height-(pe.y+pe.height))>=k)continue;const Re=(re.children??[]).filter(ge=>!("waypoints"in ge&&ge.waypoints)&&ge.type!=="label"&&typeof ge.x=="number"),lt=re.y+re.height;n.resizeShape(re,{x:re.x,y:re.y,width:re.width,height:re.height+k});const ue=u().children.filter(ge=>!("waypoints"in ge&&ge.waypoints)&&ge.id!==re.id&&typeof ge.y=="number"&&ge.y>=lt);ue.length&&n.moveElements(ue,{x:0,y:k}),ke==="T"&&Re.length&&n.moveElements(Re,{x:0,y:k}),j.add(re.id)}}const ld=20,n0=4,gL=2,yL=[10,30,80],Xo=()=>{const _=rt(o);return{bad:dn(_).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:nh(_),straight:_.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Zo=_=>{const R=rt(o),A=R.edges.find(O=>O.id===_);return A?tn(A,Wn(R)).length:0},Iu=_=>Zo(_)>0,Bu=_=>rt(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==_&&R.waypoints.length===2).length,vL=(_,R,A)=>vn([{subtree:_,pool:R}],A),i0=(_,R)=>R.bad>_.bad||R.crossings>_.crossings&&R.straight<=_.straight&&R.bad>=_.bad,Nu=(_,R)=>i0(_,R)||R.straight<_.straight,$u=(_,R,A=()=>!0,O=i0)=>{const F=Xo(),B=vn(_,R);if(!B)return!1;const N=Xo();return O(F,N)||!A()?(B(),!1):!0},r0=(_,R,A,O=()=>!0)=>$u([{subtree:_,pool:R}],A,O),Zr=_=>{var R;return!!((R=P.get(_))!=null&&R.node.participant)},os=new Map;for(const _ of y){if(!Zr(_.flow.target))continue;const R=os.get(_.flow.target)??[];R.push(_),os.set(_.flow.target,R)}const pd=[...os.keys()],o0=new Set(g.map(_=>_.flow.target)),a0=_=>ot.findIndex(({op:R})=>R.participant.id===_);pd.sort((_,R)=>{var F,B;const A=o0.has(_)?1:0,O=o0.has(R)?1:0;return A!==O?A-O:a0((F=P.get(_))==null?void 0:F.node.participant)-a0((B=P.get(R))==null?void 0:B.node.participant)});const Qr=_=>_.x+_.width/2,bL=_=>{const R=new Map;for(const F of o.getAll()){const B=F;if(!B.waypoints||!B.source||!B.target)continue;(R.get(B.source.id)??R.set(B.source.id,[]).get(B.source.id)).push(B.target.id)}const A=new Set([_]),O=[_];for(let F=0;F<O.length;F++)for(const B of R.get(O[F])??[])A.has(B)||(A.add(B),O.push(B));return A},xL=(_,R)=>{const A=bL(R);let O;for(const F of o.getAll()){const B=F;if(B.type!=="bpmn:MessageFlow"||!B.source||!B.target||B.target.id!==_||A.has(B.source.id))continue;const N=B.source;if(typeof N.x!="number"||N.type==="bpmn:Participant")continue;const j=Qr(N);(O===void 0||j>O)&&(O=j)}return O},fd=(_,R)=>{const A=l(_.flow.source);if(A)return A.type==="bpmn:Participant"?xL(A.id,R):Qr(A)},s0=_=>{let R;for(const A of os.get(_)??[]){const O=fd(A,_);O!==void 0&&(!R||O>R.cx)&&(R={op:A,cx:O})}return R==null?void 0:R.op},_L=_=>{const R=s0(_),A=l(_),O=R?fd(R,_):void 0;return A&&O!==void 0?O-Qr(A):void 0},wL=_=>{const R=_L(_);return R!==void 0&&Math.abs(R)<ld},c0=(_,R,A,O,F)=>{var B;for(let N=!0;N;){N=!1;for(const j of y){if(j.flow.id===A)continue;const H=R.has(j.flow.source),K=R.has(j.flow.target);if(H===K||O(H?j.flow.source:j.flow.target))continue;const pe=H?j.flow.target:j.flow.source;if(F(pe)||!Zr(pe))continue;const we=l(j.flow.id);if(!(we!=null&&we.waypoints)||we.waypoints.length!==2)continue;const re=l(pe),ke=(B=P.get(pe))==null?void 0:B.node.participant;if(!re||!ke)continue;const be=un(pe,Re=>Re.x>=re.x).filter(Re=>!R.has(Re.id));if(!(!be.length||be.some(Re=>F(Re.id)))){for(const Re of be)R.add(Re.id);_.set(ke,[..._.get(ke)??[],...be]),N=!0}}}return[..._].map(([N,j])=>({subtree:j,pool:f(N)}))},u0=(_,R,A,O,F)=>c0(new Map([[R,[..._]]]),new Set(_.map(B=>B.id)),O,B=>B===A,B=>B===F),dd=_=>{const R=s0(_);if(!R)return null;const A=l(_),O=l(R.flow.source),F=fd(R,_);if(!A||!O||F===void 0)return null;const B=F-Qr(A);if(B>=ld){const N=P.get(_).node.participant,j=un(_,H=>H.x>=A.x);return{groups:u0(j,N,_,R.flow.id,R.flow.source),dx:B}}if(-B>=ld&&Zr(R.flow.source)){const N=P.get(R.flow.source).node.participant,j=un(R.flow.source,H=>H.x>=O.x&&!wL(H.id));return{groups:u0(j,N,R.flow.source,R.flow.id,_),dx:-B}}return null},l0=()=>pd.map(_=>({id:_,plan:dd(_)})).filter(_=>!!_.plan).sort((_,R)=>Math.min(..._.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))).map(_=>_.id);for(let _=0;_<3;_++){const R=Xo(),A=[];for(const F of l0()){const B=dd(F);if(!B)continue;const N=vn(B.groups,B.dx);N&&A.push(N)}if(!A.length)break;if(!Nu(R,Xo()))continue;for(const F of A.reverse())F();let O=!1;for(const F of l0()){const B=dd(F);B&&$u(B.groups,B.dx,()=>!0,Nu)&&(O=!0)}if(!O)break}for(const _ of pd.flatMap(R=>os.get(R)??[])){if(!Iu(_.flow.id))continue;const R=l(_.flow.target);if(!R)continue;const A=f(P.get(_.flow.target).node.participant),O=un(_.flow.target,j=>j.x>=R.x),F=R.width+L,B=Zo(_.flow.id),N=Bu(_.flow.id);for(let j=1;j<=n0;j++){const H=()=>Zo(_.flow.id)<B&&Bu(_.flow.id)>=N;if(r0(O,A,F*j,H))break}}for(const _ of y){if(!Iu(_.flow.id))continue;const R=l(_.flow.source),A=l(_.flow.target);if(!R||!A||R.type==="bpmn:Participant"||A.type==="bpmn:Participant")continue;const O=R.x+R.width/2;if(Math.abs(O-(A.x+A.width/2))>15)continue;const[F,B]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y],N=[...P.values()].map(j=>l(j.node.id)).filter(j=>!!j&&j.id!==R.id&&j.id!==A.id).filter(j=>j.x<=O&&O<=j.x+j.width&&j.y+j.height>F&&j.y<B).sort((j,H)=>j.x-H.x);for(const j of N){const H=(x0=P.get(j.id))==null?void 0:x0.node.participant,K=H?l(H):void 0;if(!K)continue;const pe=[...P.values()].filter(Se=>Se.node.participant===H).map(Se=>Se.node.id),we=Se=>Se.map(Pe=>l(Pe)).filter(Pe=>!!Pe),ke=[Yt(j.id,Se=>{var Pe;return((Pe=P.get(Se.id))==null?void 0:Pe.node.participant)===H}),we(pe)].filter(Se=>Se.length),be=j.width+L,Re=Zo(_.flow.id),lt=Bu(_.flow.id),ue=()=>Zo(_.flow.id)<Re&&Bu(_.flow.id)>=lt;let ge=!1;for(const Se of ke){for(let Pe=1;Pe<=n0;Pe++)if(r0(Se,K,be*Pe,ue)){ge=!0;break}if(ge)break}if(!Iu(_.flow.id))break}}for(const _ of y){if(!Iu(_.flow.id))continue;const R=l(_.flow.id);if(((_0=R==null?void 0:R.waypoints)==null?void 0:_0.length)!==2)continue;const A=l(_.flow.source),O=l(_.flow.target);if(!A||!O||A.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!Zr(_.flow.source)||!Zr(_.flow.target)||Math.abs(Qr(A)-Qr(O))>gL)continue;const F=Qr(A),B=R.waypoints.map(Re=>Re.y),[N,j]=[Math.min(...B),Math.max(...B)],H=Wn(rt(o)).filter(Re=>Re.id!==A.id&&Re.id!==O.id&&Re.x<F&&F<Re.x+Re.width&&N<Re.y+Re.height&&Re.y<j);if(!H.length)continue;const K=(w0=P.get(_.flow.source))==null?void 0:w0.node.participant,pe=(E0=P.get(_.flow.target))==null?void 0:E0.node.participant;if(!K||!pe)continue;const we=new Map;for(const[Re,lt,ue]of[[_.flow.source,A,K],[_.flow.target,O,pe]]){const ge=we.get(ue)??[],Se=un(Re,Pe=>Pe.x>=lt.x).filter(Pe=>!ge.some(it=>it.id===Pe.id));we.set(ue,[...ge,...Se])}const re=new Set([...we.values()].flat().map(Re=>Re.id)),ke=c0(we,re,_.flow.id,Re=>Re===_.flow.source||Re===_.flow.target,()=>!1),be=Math.max(...H.map(Re=>Re.x+Re.width));for(const Re of yL){const lt=be+Re-F;if(lt<=0)continue;if($u(ke,lt,()=>{var ge,Se;return Zo(_.flow.id)===0&&((Se=(ge=l(_.flow.id))==null?void 0:ge.waypoints)==null?void 0:Se.length)===2},Nu))break}}{const _=A=>A.y+A.height/2,R=[];for(const A of P.keys()){if(!Zr(A))continue;const O=g.filter(N=>N.flow.target===A);if(O.length!==1)continue;const F=l(O[0].flow.source),B=l(A);!F||!B||!P.has(F.id)||Math.abs(_(F)-_(B))>1||B.x-(F.x+F.width)<=L+1||R.push({id:A,pred:F,node:B})}R.sort((A,O)=>A.node.x-O.node.x);for(const{id:A}of R){const O=P.get(A),F=l(A),B=l(g.find(re=>re.flow.target===A).flow.source);if(!F||!B)continue;const N=F.x-(B.x+B.width);if(N<=L+1)continue;const j=f(O.node.participant),H=un(A,re=>re.x>=F.x),K=Xo(),pe=vL(H,j,-(N-L));if(!pe)continue;const we=Xo();(we.bad>K.bad||we.crossings>=K.crossings||we.straight<K.straight)&&pe()}}t0(!0);for(const _ of v){const R=_.associations??[],A=R.map(B=>B.source===_.dataStore.id?B.target:B.source).map(l).find(Boolean),O=A?p(A)??u():u(),F=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:At+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:_.dataStore.id,name:_.dataStore.name})},F,O);for(const B of R)e0(_.dataStore.id,B)}for(const _ of b){const A=f(_.association.target).type==="bpmn:DataStoreReference"?_.association.target:_.association.source;e0(A,_.association)}let p0=0;const Jr=10,f0=40,EL=(_,R)=>{const A=R.map(H=>p(H)).filter(H=>!!H);for(const H of A){const K=Jr,pe=H.y,we=H.y+H.height,re=H.x,ke=H.x+H.width;if(Math.abs(_.y-pe)<K){const be=pe+K-_.y;_.y+=be,_.height-=be}if(Math.abs(_.y+_.height-we)<K&&(_.height=we-K-_.y),Math.abs(_.x-re)<K){const be=re+K-_.x;_.x+=be,_.width-=be}Math.abs(_.x+_.width-ke)<K&&(_.width=ke-K-_.x)}if(!A.length)return;const O=Math.min(...A.map(H=>H.y)),F=Math.max(...A.map(H=>H.y+H.height)),B=O-_.y,N=_.y+_.height-F,j=f0-Jr;if(B>0!=N>0)if(B>0&&B<j){const H=B+Jr;_.y+=H,_.height-=H}else N>0&&N<j&&(_.height-=N+Jr)},SL=(_,R)=>{const A=Jr,O=30,F=o.filter(B=>B.type==="bpmn:Group"&&B.id!==R);for(const B of F){const N=B.x,j=B.x+B.width,H=B.y,K=B.y+B.height,pe=_.y<K&&H<_.y+_.height,we=_.x<j&&N<_.x+_.width;if(pe){if(Math.abs(_.x-j)<A){const re=Math.min(j+A-_.x,O);re>0&&_.width-re>0&&(_.x+=re,_.width-=re)}if(Math.abs(_.x+_.width-N)<A){const re=Math.min(_.x+_.width-(N-A),O);re>0&&_.width-re>0&&(_.width-=re)}}if(we){if(Math.abs(_.y-K)<A){const re=Math.min(K+A-_.y,O);re>0&&_.height-re>0&&(_.y+=re,_.height-=re)}if(Math.abs(_.y+_.height-H)<A){const re=Math.min(_.y+_.height-(H-A),O);re>0&&_.height-re>0&&(_.height-=re)}}}},hd=(_,R)=>{const A=f0,O=Math.min(..._.map(H=>H.x))-A,F=Math.min(..._.map(H=>H.y))-A,B=Math.max(..._.map(H=>H.x+H.width))+A,N=Math.max(..._.map(H=>H.y+H.height))+A,j={x:O,y:F,width:B-O,height:N-F};return EL(j,_),SL(j,R),j};for(const _ of C){const R=(_.group.members??[]).map(l).filter(F=>!!F);let A;R.length?A=hd(R,_.group.id):(A={x:300+p0*350,y:40,width:300,height:200},p0++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:_.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());_.group.name&&n.updateLabel(O,_.group.name),(S0=_.group.members)!=null&&S0.length&&D(O,"bwl:Members",{refs:_.group.members.join(" ")})}{const _=o.filter(F=>!!F.waypoints),R=new Map,A=(F,B)=>{!F||!B||(R.has(F)||R.set(F,new Set),R.get(F).add(B))};for(const F of _){const B=(R0=F.source)==null?void 0:R0.id,N=(C0=F.target)==null?void 0:C0.id;A(B,N),((P0=F.type)!=null&&P0.includes("DataOutputAssociation")||(A0=F.type)!=null&&A0.includes("DataInputAssociation")||F.type==="bpmn:Association")&&A(N,B)}const O=o.filter(F=>F.type==="bpmn:Group");for(const F of O){const N=(((T0=F.businessObject.extensionElements)==null?void 0:T0.values)??[]).find(ue=>ue.$type==="bwl:Members"),j=((N==null?void 0:N.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const H=new Set(j),K=[...j];for(;K.length;){const ue=K.shift();for(const ge of R.get(ue)??[])H.has(ge)||(H.add(ge),K.push(ge))}const pe=F.x,we=F.x+F.width,re=F.y,ke=F.y+F.height,be=ue=>g.filter(ge=>ge.flow.target===ue).length,Re=ue=>{var Se;const ge=((Se=l(ue))==null?void 0:Se.type)??"";if(ge==="bpmn:StartEvent"&&be(ue)===0)return!1;if(ge.endsWith("Gateway")){const Pe=g.filter(it=>it.flow.target===ue).map(it=>it.flow.source);if(Pe.length&&Pe.every(it=>{var ze;return((ze=l(it))==null?void 0:ze.type)==="bpmn:StartEvent"&&be(it)===0}))return!1}return!0},lt=o.filter(ue=>Mi(ue)).filter(ue=>ue.type!=="bpmn:Group"&&ue.type!=="bpmn:Participant"&&ue.type!=="bpmn:TextAnnotation"&&!H.has(ue.id)&&Zr(ue.id)&&Re(ue.id)&&ue.x<we&&ue.x+ue.width>pe&&ue.y<ke&&ue.y+ue.height>re);if(lt.length)for(const ue of[-1,1]){const ge=lt.filter(ie=>(ie.x+ie.width-pe<=we-ie.x?-1:1)===ue);if(!ge.length)continue;const Se=[];for(const ie of ge){const Q=Se.find(ne=>ne.some(Ee=>ie.y<Ee.y+Ee.height&&ie.y+ie.height>Ee.y));Q?Q.push(ie):Se.push([ie])}const Pe=new Map;for(const ie of Se){let Q=ue<0?pe-Jr:we+Jr;for(const ne of[...ie].sort((Ee,de)=>ue<0?de.x-Ee.x:Ee.x-de.x)){const Ee=ue<0?Math.min(ne.x,Q-ne.width):Math.max(ne.x,Q);Q=ue<0?Ee-Sn:Ee+ne.width+Sn,Ee!==ne.x&&Math.sign(Ee-ne.x)===ue&&Pe.set(ne.id,Ee-ne.x)}}const it=new Map,ze=ie=>it.get(ie)===ie||!it.get(ie)?ie:ze(it.get(ie));for(const ie of ge)it.set(ie.id,ie.id);for(const ie of y){const Q=Pe.has(ie.flow.source)?ie.flow.source:void 0,ne=Pe.has(ie.flow.target)?ie.flow.target:void 0;if(!Q||!ne)continue;const Ee=l(ie.flow.id);((M0=Ee==null?void 0:Ee.waypoints)==null?void 0:M0.length)===2&&it.set(ze(Q),ze(ne))}const Ve=new Map;for(const ie of ge){if(!Pe.has(ie.id))continue;const Q=ze(ie.id);Ve.set(Q,[...Ve.get(Q)??[],ie])}const yt=[...Ve.values()].sort((ie,Q)=>ue<0?Math.min(...ie.map(ne=>ne.x))-Math.min(...Q.map(ne=>ne.x)):Math.max(...Q.map(ne=>ne.x))-Math.max(...ie.map(ne=>ne.x))),_e=[];let et=!0;for(const ie of yt){const Q=ie.map(de=>Pe.get(de.id)??0).reduce((de,ce)=>Math.abs(ce)>Math.abs(de)?ce:de,0),ne=new Map;let Ee=!0;for(const de of ie){const ce=p(de);if(!ce){Ee=!1;break}ne.has(ce.id)||ne.set(ce.id,{subtree:[],pool:ce}),ne.get(ce.id).subtree.push(de)}Ee&&$u([...ne.values()],Q,()=>!0,Nu)?_e.push({shapes:ie,dx:Q}):et=!1}if(!et)for(const ie of _e.reverse())n.moveElements(ie.shapes,{x:-ie.dx,y:0})}}}{const _=new Set([...C.map(R=>R.group.id),...Zt(e,"group.update").map(R=>R.id)]);for(const R of o.filter(A=>A.type==="bpmn:Group")){if(_.has(R.id))continue;const O=(((k0=R.businessObject.extensionElements)==null?void 0:k0.values)??[]).find(j=>j.$type==="bwl:Members"),F=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(l).filter(j=>!!j);!F.length||!F.some(j=>{const H=d.get(j.id);return!H||H.x!==j.x||H.y!==j.y})||!F.some(j=>j.x<R.x||j.y<R.y||j.x+j.width>R.x+R.width||j.y+j.height>R.y+R.height)||n.resizeShape(R,hd(F,R.id))}}{const R=new Map(fo(rt(o)).map(j=>[j.owner,j.rect])),A=o.filter(j=>!!j.waypoints),O=new Map,F=(j,H)=>{!j||!H||(O.has(j)||O.set(j,new Set),O.get(j).add(H))};for(const j of A){const H=(O0=j.source)==null?void 0:O0.id,K=(D0=j.target)==null?void 0:D0.id;F(H,K),((L0=j.type)!=null&&L0.includes("DataOutputAssociation")||(I0=j.type)!=null&&I0.includes("DataInputAssociation")||j.type==="bpmn:Association")&&F(K,H)}const B=j=>g.filter(H=>H.flow.target===j).length,N=j=>{var K;const H=((K=l(j))==null?void 0:K.type)??"";if(H==="bpmn:StartEvent"&&B(j)===0)return!1;if(H.endsWith("Gateway")){const pe=g.filter(we=>we.flow.target===j).map(we=>we.flow.source);if(pe.length&&pe.every(we=>{var re;return((re=l(we))==null?void 0:re.type)==="bpmn:StartEvent"&&B(we)===0}))return!1}return!0};for(const j of o.filter(H=>H.type==="bpmn:Group")){const K=(((B0=j.businessObject.extensionElements)==null?void 0:B0.values)??[]).find(Q=>Q.$type==="bwl:Members"),pe=((K==null?void 0:K.refs)??"").split(" ").filter(Boolean);if(!pe.length)continue;const we=pe.map(l).filter(Q=>!!Q);if(!we.length||!(C.some(Q=>Q.group.id===j.id)||Zt(e,"group.update").some(Q=>Q.id===j.id)||we.some(Q=>{const ne=d.get(Q.id);return!ne||ne.x!==Q.x||ne.y!==Q.y})))continue;const ke=new Set(pe),be=[...pe];for(;be.length;){const Q=be.shift();for(const ne of O.get(Q)??[])ke.has(ne)||(ke.add(ne),be.push(ne))}const Re=j.x,lt=j.x+j.width,ue=j.y,ge=j.y+j.height,Se=Q=>{const ne=R.get(Q.id),Ee={x:Q.x,y:Q.y,width:Q.width,height:Q.height};return ne?[Ee,{x:ne.x,y:ne.y,width:ne.width,height:ne.height}]:[Ee]},Pe=we.flatMap(Se),it=Math.min(...Pe.map(Q=>Q.x)),ze=Math.max(...Pe.map(Q=>Q.x+Q.width)),Ve=Math.min(...Pe.map(Q=>Q.y)),yt=Math.max(...Pe.map(Q=>Q.y+Q.height)),_e={L:it-Re,R:lt-ze,T:Ve-ue,B:ge-yt},et=o.filter(Q=>Mi(Q)).filter(Q=>Q.type!=="bpmn:Group"&&Q.type!=="bpmn:Participant"&&Q.type!=="bpmn:TextAnnotation"&&!ke.has(Q.id)&&N(Q.id)&&Q.x<lt&&Q.x+Q.width>Re&&Q.y<ge&&Q.y+Q.height>ue);if(!et.length)continue;const ie={L:0,R:0,T:0,B:0};for(const Q of et){const ne=Se(Q),Ee=Math.min(...ne.map(qe=>qe.x)),de=Math.max(...ne.map(qe=>qe.x+qe.width)),ce=Math.min(...ne.map(qe=>qe.y)),Ae=Math.max(...ne.map(qe=>qe.y+qe.height)),at={L:de-Re,R:lt-Ee,T:Ae-ue,B:ge-ce},xt=["L","R","T","B"].filter(qe=>at[qe]<=_e[qe]+.001);if(!xt.length)continue;const ct=xt.reduce((qe,qt)=>at[qt]<at[qe]?qt:qe,xt[0]);ie[ct]=Math.max(ie[ct],Math.min(at[ct]+10,_e[ct]))}!ie.L&&!ie.R&&!ie.T&&!ie.B||n.resizeShape(j,{x:j.x+ie.L,y:j.y+ie.T,width:j.width-ie.L-ie.R,height:j.height-ie.T-ie.B})}}const d0=_=>{const R=_.waypoints;if(R!=null&&R.length){const O=R[Math.floor((R.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const A=_;return{x:A.x,y:A.y,width:A.width,height:A.height}};let as=0;const h0=12,m0=14,RL=15,CL=300,PL=_=>{const R=_.split(`
|
|
7
|
+
`),A=Math.max(...R.map(B=>uo(B,h0))),O=Math.max(100,Math.min(CL,Math.ceil(A)+m0)),F=R.reduce((B,N)=>B+Math.max(1,Math.ceil((uo(N,h0)+m0)/O)),0);return{width:O,height:Math.max(30,F*RL+10)}};for(const _ of x){const R=_.association,A=((N0=_.placement)==null?void 0:N0.anchor)??(R?R.source===_.annotation.id?R.target:R.source:void 0),O=A?l(A):void 0,F=O?d0(O):void 0,B=PL(_.annotation.text??"");let N;if(F&&_.placement){const[pe,we]=Ms[_.placement.side],re=_.placement.offset??50;N={x:F.x+F.width/2+pe*(F.width/2+B.width/2+re),y:F.y+F.height/2+we*(F.height/2+B.height/2+re)}}else F?(N={x:F.x+F.width/2+180+as%3*260,y:F.y-110-as%2*95},as++):(N={x:300+as*260,y:60},as++);const j=O?p(O)??u():u(),H=j;F&&typeof H.x=="number"&&typeof H.width=="number"&&H.type==="bpmn:Participant"&&(N=vl(o,F,B,H,_.placement?{placement:_.placement}:{from:N}));const K=n.createShape({type:"bpmn:TextAnnotation",width:B.width,height:B.height,businessObject:i.create("bpmn:TextAnnotation",{id:_.annotation.id,text:_.annotation.text})},N,j);if(R){const pe=we=>we===_.annotation.id?K:f(we);n.connect(pe(R.source),pe(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}_.placement&&D(K,"bwl:Placement",T(_.placement))}for(const _ of Zt(e,"association.add")){const R=_.association;n.connect(f(R.source),f(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const _ of Zt(e,"node.update")){let R=f(_.id);if(_.type&&Ts(_.type)!==R.type&&(R=c.replaceElement(R,{type:Ts(_.type)})),_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.lane||_.band!==void 0){_.band!==void 0&&n.updateProperties(R,{"bwl:band":_.band});const A=R.y+R.height/2,O=p(R),F=_.lane?f(_.lane):((O==null?void 0:O.children)??[]).find(N=>N.type==="bpmn:Lane"&&A>=N.y&&A<=N.y+N.height);_.band!==void 0&&xe(F==null?void 0:F.id,_.band,O);const B=F?F.y+(_.band===void 0?F.height/2:Math.min(F.height/2,ae)+M(F.id,_.band)*k):_.band!==void 0&&O?O.y+z+M(`pool:${O.id}`,_.band)*k:void 0;if(B!==void 0){const N=B-A;N!==0&&n.moveElements([R],{x:0,y:N})}}}for(const _ of Zt(e,"sequenceFlow.update")){const R=f(_.id);if(_.source!==void 0||_.target!==void 0){const A=R,O=_.source!==void 0?f(_.source):A.source,F=_.target!==void 0?f(_.target):A.target,B=N=>({x:N.x+N.width/2,y:N.y+N.height/2});n.reconnect(A,O,F,[B(O),B(F)])}_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.condition!==void 0&&n.updateProperties(R,{name:(($0=_.condition)==null?void 0:$0.label)??void 0})}for(const _ of Zt(e,"messageFlow.update"))_.name!==void 0&&n.updateProperties(f(_.id),{name:_.name??void 0});for(const _ of Zt(e,"dataStore.update"))_.name!==void 0&&n.updateProperties(f(_.id),{name:_.name??void 0});for(const _ of Zt(e,"annotation.update")){const R=f(_.id);if(_.text!==void 0&&n.updateProperties(R,{text:_.text}),_.placement===null)D(R,"bwl:Placement",null);else if(_.placement){const A=f(_.placement.anchor),O=d0(A),F=p(A)??u(),B=typeof F.x=="number"&&typeof F.width=="number"&&F.type==="bpmn:Participant",[N,j]=Ms[_.placement.side],H=_.placement.offset??50,K={x:O.x+O.width/2+N*(O.width/2+R.width/2+H),y:O.y+O.height/2+j*(O.height/2+R.height/2+H)},pe=B?vl(o,O,{width:R.width,height:R.height},F,{placement:_.placement,selfId:_.id}):K;n.moveElements([R],{x:pe.x-(R.x+R.width/2),y:pe.y-(R.y+R.height/2)}),D(R,"bwl:Placement",T(_.placement))}}for(const _ of Zt(e,"group.update")){const R=f(_.id);if(_.name!==void 0&&n.updateLabel(R,_.name??""),_.members){const A=_.members.map(l).filter(O=>!!O);A.length&&n.resizeShape(R,hd(A,_.id)),D(R,"bwl:Members",{refs:_.members.join(" ")})}}}function bl(e){switch(e.kind){case"annotation-over-label":return[e.annotation];case"edge-crosses-shape":return[e.shape];case"shape-outside-container":return[e.shape];case"shape-overlap":return e.shapes;default:return[]}}function E1(e,t,n){var l,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>dn(p).filter(d=>!t.has(xn(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=rt(i),c=o(s),u=[...new Set(c.flatMap(bl))].filter(p=>n.has(p)&&a(p));if(u.length)for(const p of u){const d=i.get(p);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let m=d.parent,h;for(;m;){if(m.type==="bpmn:Participant"){h=m;break}m=m.parent}if(!h){const me=d.x+d.width/2,Ue=d.y+d.height/2;h=i.getAll().find($e=>{if($e.type!=="bpmn:Participant")return!1;const q=$e;return typeof q.x=="number"&&typeof q.width=="number"&&me>=q.x&&me<=q.x+q.width&&Ue>=q.y&&Ue<=q.y+q.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const y=(((l=d.businessObject.extensionElements)==null?void 0:l.values)??[]).find(me=>me.$type==="bwl:Placement"),v=[...d.incoming??[],...d.outgoing??[]].find(me=>me.type==="bpmn:Association"),b=(y!=null&&y.anchor?i.get(y.anchor):void 0)??(v?((f=v.source)==null?void 0:f.id)===p?v.target:v.source:void 0);if(!b)continue;const x=b.waypoints,C=x!=null&&x.length?{x:x[Math.floor((x.length-1)/2)].x,y:x[Math.floor((x.length-1)/2)].y,width:0,height:0}:{x:b.x,y:b.y,width:b.width,height:b.height},P={width:d.width,height:d.height},D={x:d.x+d.width/2,y:d.y+d.height/2},T=y==null?void 0:y.side,I=[];T&&T in Ms&&I.push(vl(i,C,P,h,{placement:{side:T,offset:(y==null?void 0:y.offset)??null},selfId:p}));for(const[me,Ue]of[[-1,0],[1,0],[0,-1],[0,1]])for(let $e=1;$e<=w1;$e++)I.push({x:D.x+me*Fh*$e,y:D.y+Ue*Fh*$e});const k={...s,edges:s.edges.filter(me=>me.id!==(v==null?void 0:v.id))},L=o(k),z=L.filter(me=>bl(me).includes(p)).length;if(!z)continue;let ae;for(const me of I){const Ue=me.x-D.x,$e=me.y-D.y;if(!Ue&&!$e||me.x-P.width/2<h.x||me.x+P.width/2>h.x+h.width||me.y-P.height/2<h.y||me.y+P.height/2>h.y+h.height)continue;const q={...k,shapes:k.shapes.map(Oe=>Oe.id===p?{...Oe,x:Oe.x+Ue,y:Oe.y+$e}:Oe)},le=o(q),oe=le.filter(Oe=>bl(Oe).includes(p)).length;if(oe>=z||le.length>L.length)continue;const fe=Math.abs(Ue)+Math.abs($e);if((!ae||oe<ae.mine||oe===ae.mine&&(le.length<ae.all||le.length===ae.all&&fe<ae.dist))&&(ae={x:me.x,y:me.y,mine:oe,all:le.length,dist:fe}),ae.mine===0&&ae.all<L.length)break}ae&&r.moveElements([d],{x:ae.x-D.x,y:ae.y-D.y})}}const S1=60;function R1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>dn(l).filter(f=>!t.has(xn(f))),a=l=>l.filter(f=>f.kind==="pool-overlap"),s=new Map(n.shapes.map(l=>[l.id,l])),c=(l,f)=>f.x>=l.x&&f.y>=l.y&&f.x+f.width<=l.x+l.width&&f.y+f.height<=l.y+l.height,u=l=>{if(!s.get(l))return[l];const p=new Set,d=new Set([l]);for(let h=0;h<4;h++){let g=!1;for(const y of n.shapes)y.type!=="bpmn:Group"||p.has(y.id)||[...d].some(v=>{const b=s.get(v);return b&&c(y,b)})&&(p.add(y.id),g=!0);for(const y of n.shapes)y.type!=="bpmn:Participant"||d.has(y.id)||[...p].some(v=>{const b=s.get(v);return b&&c(b,y)})&&(d.add(y.id),g=!0);if(!g)break}const m=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!p.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...p].some(g=>{const y=s.get(g);return y&&c(y,h)})).map(h=>h.id);return[...d,...p,...m]};for(let l=0;l<6;l++){const f=rt(i),p=o(f),d=a(p);if(!d.length)return;const m=new Map(f.shapes.map(x=>[x.id,x]));let h=null;for(const x of d){if(x.kind!=="pool-overlap")continue;const[C,P]=x.pools,D=m.get(C),T=m.get(P);if(!D||!T)continue;const[I,k]=D.x<=T.x?[D,T]:[T,D];if(x.contained)continue;const L=s.get(I.id),z=s.get(k.id),ae=L&&z?Math.max(z.x-(L.x+L.width),0):S1,me=I.x+I.width+ae-k.x;if(me<=0)continue;const Ue=u(k.id).filter($e=>i.get($e));Ue.length&&(!h||me>h.dx)&&(h={movers:Ue,dx:me})}if(!h)return;const g=h.movers.map(x=>i.get(x)).filter(x=>!!x&&typeof x.x=="number");if(!g.length)return;const y=p.length,v=d.length;r.moveElements(g,{x:h.dx,y:0});const b=o(rt(i));if(!(a(b).length<v&&b.length<=y)){r.moveElements(g,{x:-h.dx,y:0});return}}}function C1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>dn(u).filter(l=>!t.has(xn(l))),a=(u,l)=>l.x>=u.x&&l.y>=u.y&&l.x+l.width<=u.x+u.width&&l.y+l.height<=u.y+u.height,s=u=>({l:Math.min(...u.map(l=>l.x)),t:Math.min(...u.map(l=>l.y)),r:Math.max(...u.map(l=>l.x+l.width)),b:Math.max(...u.map(l=>l.y+l.height))}),c=n.shapes.filter(u=>{var l;return u.type==="bpmn:Group"&&!((l=u.members)!=null&&l.length)});if(c.length)for(const u of c){const l=i.get(u.id);if(!l||typeof l.x!="number")continue;const f=n.shapes.filter(P=>P.id!==u.id&&P.type!=="bpmn:Group"&&a(u,P));if(!f.length)continue;const p=f.map(P=>i.get(P.id)).filter(P=>!!P&&typeof P.x=="number");if(p.length!==f.length)continue;const d=s(f),m=s(p),h=m.l+(u.x-d.l),g=m.t+(u.y-d.t),y=m.r+(u.x+u.width-d.r),v=m.b+(u.y+u.height-d.b),b={x:h,y:g,width:y-h,height:v-g};if(b.width<=0||b.height<=0||Math.abs(b.x-l.x)<1&&Math.abs(b.y-l.y)<1&&Math.abs(b.width-l.width)<1&&Math.abs(b.height-l.height)<1)continue;const x=o(rt(i)).length,C={x:l.x,y:l.y,width:l.width,height:l.height};r.resizeShape(l,b),o(rt(i)).length>x&&r.resizeShape(l,C)}}function Hh(e,t,n=jh){const i=$h(e),r=Nh(t,ph(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=rt(i.elementRegistry),s=new Set(dn(a).map(xn)),c=new Set(a.edges.map(y=>y.id)),u=new Set(a.shapes.map(y=>y.id)),l=ws(a),f=l.length,p=new Set(l.map(([y,v])=>`${y}|${v}`)),d=e.get("commandStack");try{xd(d,()=>{n(t,i),R1(i,s,a),C1(i,s,a),vh(i,c);const y=dl(i,s);mh(i,p,c),Ah(i,s,c),_h(i,c),d1(i,c),Sh(i,s,c),y1(i,s,c),Oh(i,s,c),kh(i,c),Lh(i,u),E1(i,s,u),dl(i,s,y)})}catch(y){return{ok:!1,issues:[{kind:"lower-failed",message:y instanceof Error?y.message:String(y)}],findings:[],stats:o}}const m=rt(i.elementRegistry),h=dn(m).filter(y=>!s.has(xn(y))),g=ih(m);return{ok:!0,issues:[],findings:h,stats:{edgeCrossings:{before:f,after:g.pairs.length,pairs:g.pairs,solidPairs:g.solidPairs,dashedPairs:g.dashedPairs,mixedPairs:g.mixedPairs,crossPoolMessages:g.crossPoolMessages}}}}function P1(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function A1(e,t){return typeof e.get=="function"?e.get(t):e[t]}function zh(e,t){const n=A1(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Gh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function T1(e){return typeof e=="string"&&ju.includes(e)}function li(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Vh(e){const t=e.rootElements??[],n=t.find(q=>q.$type==="bpmn:Collaboration"),i=new Map(t.filter(q=>q.$type==="bpmn:Process").map(q=>[q.id,q])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},f=[],p=[],d=[],m=[],h=[],g=[],y=new Set,v=new Set,b=q=>{q&&y.add(q)},x=q=>{y.add(q),v.add(q)},C=q=>{const le=Gh(q,"bwl:Placement");if(!le)return;const oe=typeof le.anchor=="string"?le.anchor:void 0;if(!oe||!T1(le.side))return;const fe=typeof le.offset=="number"?le.offset:void 0;h.push({owner:q.id,anchor:oe,side:le.side,...fe!==void 0?{offset:fe}:{}})},P=q=>{const le=Gh(q,"bwl:Members"),oe=typeof(le==null?void 0:le.refs)=="string"?le.refs.split(/\s+/).filter(Boolean):[];oe.length&&g.push({owner:q.id,refs:oe})},D=q=>{var le;for(const oe of q)switch(b(oe.id),oe.$type){case"bpmn:TextAnnotation":x(oe.id),s.push({id:oe.id,text:typeof oe.text=="string"?oe.text:""}),C(oe);break;case"bpmn:Association":d.push({id:oe.id,type:oe.$type,source:li(oe.sourceRef),target:li(oe.targetRef)});break;case"bpmn:Group":{x(oe.id);const fe=(le=oe.categoryValueRef)==null?void 0:le.value;c.push({id:oe.id,...typeof fe=="string"&&fe?{name:fe}:{}}),P(oe);break}default:u.push({id:oe.id,type:oe.$type,reason:"type-outside-mvp"})}},T=q=>{for(const le of q.flowElements??[])b(le.id),u.push({id:le.id,type:le.$type,reason:"inside-container"}),(le.flowElements??[]).length&&T(le);for(const le of q.artifacts??[])b(le.id),u.push({id:le.id,type:le.$type,reason:"inside-container"})},I=(q,le)=>{const oe=q.flowElements??[],fe=(q.laneSets??[]).flatMap(W=>W.lanes??[]),Oe=new Map;for(const W of fe){b(W.id);for(const Y of W.flowNodeRef??[]){const Z=li(Y);Z&&Oe.set(Z,W.id)}}for(const W of oe){if(b(W.id),W.$type==="bpmn:SequenceFlow"){f.push({id:W.id,source:li(W.sourceRef),target:li(W.targetRef),...typeof W.name=="string"&&W.name?{name:W.name}:{}});continue}if(W.$type==="bpmn:DataStoreReference"){x(W.id),a.push({id:W.id,...W.name?{name:W.name}:{}});continue}const Y=P1(W.$type);if(!md(Y)){u.push({id:W.id,type:W.$type,reason:"type-outside-mvp"});continue}x(W.id);const Z=Y==="boundaryEvent"?li(W.attachedToRef):void 0;o.push({id:W.id,type:Y,...W.name?{name:W.name}:{},...le?{participant:le}:{},...Oe.has(W.id)?{lane:Oe.get(W.id)}:{},...Z?{attachedTo:Z}:{}}),Y==="subProcess"&&T(W);const Me=zh(W,"bwl:band");Me!==void 0&&(l.bands[W.id]=Me);for(const mt of W.dataOutputAssociations??[])b(mt.id),m.push({id:mt.id,type:mt.$type,source:W.id,target:li(mt.targetRef)});for(const mt of W.dataInputAssociations??[])b(mt.id),m.push({id:mt.id,type:mt.$type,source:li((mt.sourceRef??[])[0]),target:W.id})}D(q.artifacts??[])};if(n){const q=new Set;for(const le of n.participants??[]){x(le.id);const oe=li(le.processRef);oe&&q.add(oe);const fe=oe?i.get(oe):void 0,Oe=((fe==null?void 0:fe.laneSets)??[]).flatMap(Me=>Me.lanes??[]),W=Oe.map(Me=>({id:Me.id,...Me.name?{name:Me.name}:{}}));for(const Me of W)x(Me.id);const Y=!fe||(fe.flowElements??[]).length===0&&Oe.length===0&&(fe.artifacts??[]).length===0;r.push({id:le.id,...le.name?{name:le.name}:{},...Y?{blackBox:!0}:{},...W.length?{lanes:W}:{}});const Z=zh(le,"bwl:poolOrder");Z!==void 0&&(l.poolOrders[le.id]=Z),fe&&I(fe,le.id)}for(const le of n.messageFlows??[])b(le.id),p.push({id:le.id,source:li(le.sourceRef),target:li(le.targetRef),...typeof le.name=="string"&&le.name?{name:le.name}:{}});D(n.artifacts??[]);for(const[le,oe]of i)!q.has(le)&&(oe.flowElements??[]).length>0&&u.push({id:le,type:oe.$type,reason:"unreachable-process"})}else for(const q of i.values())I(q);const k=[],L=[],z=[],ae=[],me=(q,le)=>!!q&&!!le&&v.has(q)&&v.has(le);for(const q of f){if(!me(q.source,q.target)){u.push({id:q.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}k.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),v.add(q.id)}for(const q of p){if(!me(q.source,q.target)){u.push({id:q.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}L.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),v.add(q.id)}for(const q of m){if(!me(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}ae.push({...q.id?{id:q.id}:{},source:q.source,target:q.target}),q.id&&v.add(q.id)}for(const q of d){if(!me(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}z.push({...q.id?{id:q.id}:{},source:q.source,target:q.target})}const Ue=new Map(c.map(q=>[q.id,q]));for(const{owner:q,refs:le}of g){const oe=le.filter(Oe=>y.has(Oe)),fe=Ue.get(q);fe&&oe.length&&(fe.members=oe)}for(const q of h)y.has(q.anchor)&&(l.placements[q.owner]={anchor:q.anchor,side:q.side,...q.offset!==void 0?{offset:q.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:k,...L.length?{messageFlows:L}:{},...a.length?{dataStores:a}:{},...ae.length?{dataAssociations:ae}:{},...s.length?{annotations:s}:{},...z.length?{associations:z}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function M1(e){const{definitions:t,warnings:n}=await il(e);return{...Vh(t),warnings:n}}function k1(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Wh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Hh(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 O1=Symbol("bpmn-editor");function D1(){const e=It.ref(!1),t=It.ref(!0),n=It.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const f=u.get("keyboard");l?(r&&f.bind(r),r=void 0):r||(r=f.getBinding(),f.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 f=s();n.value=!0;try{const p=await Wh(f,u,{currentVersion:l});return p.status==="applied"&&(e.value=!1),p}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:rl(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 ye(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function L1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xl={exports:{}},Uh;function I1(){if(Uh)return xl.exports;Uh=1;var e=xl.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},xl.exports}var B1=I1(),N1=L1(B1);function yi(e){if(!(this instanceof yi))return new yi(e);e=e||[128,36,1],this._seed=e.length?N1.rack(e[0],e[1],e[2]):e}yi.prototype.next=function(e){return this._seed(e||!0)},yi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},yi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},yi.prototype.assigned=function(e){return this._seed.get(e)||!1},yi.prototype.unclaim=function(e){delete this._seed.hats[e]},yi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Gt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Gt.td=Gt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Gt.option=Gt.optgroup=[1,'<select multiple="multiple">',"</select>"],Gt.thead=Gt.tbody=Gt.colgroup=Gt.caption=Gt.tfoot=[1,"<table>","</table>"],Gt.polyline=Gt.ellipse=Gt.polygon=Gt.circle=Gt.text=Gt.line=Gt.path=Gt.rect=Gt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function bt(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:f}=l;return f.remove(),f}let[r,o,a]=Object.hasOwn(Gt,i)?Gt[i]:Gt._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 $1(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 wn(e,...t){const n=e.style;return $(t,function(i){i&&$(i,function(r,o){n[o]=r})}),e}function hn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const F1=Object.prototype.toString;function Et(e){return new er(e)}function er(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}er.prototype.add=function(e){return this.list.add(e),this},er.prototype.remove=function(e){return F1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},er.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},er.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},er.prototype.array=function(){return Array.from(this.list)},er.prototype.has=er.prototype.contains=function(e){return this.list.contains(e)};function ks(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Lr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function j1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Os={},Yh;function H1(){if(Yh)return Os;Yh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Os.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Os.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Os}var qh=H1(),z1=j1(qh),Ne=$1({__proto__:null,default:z1},[qh]),Kh=["focus","blur"];function G1(e,t,n,i,r){return Kh.indexOf(n)!==-1&&(r=!0),Ne.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Lr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function V1(e,t,n,i){return Kh.indexOf(t)!==-1&&(i=!0),Ne.unbind(e,t,n,i)}var Dn={bind:G1,unbind:V1};function _l(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function ut(e,t){return t=t||document,t.querySelector(e)}function Ds(e,t){return t=t||document,t.querySelectorAll(e)}function vi(e){e.parentNode&&e.parentNode.removeChild(e)}function W1(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function U1(e,t){return t.appendChild(W1(e,t))}function Fe(e,t){return U1(t,e),e}var wl=2,Xh={"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":wl,"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":wl,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function Y1(e,t){return Xh[t]?e.style[t]:e.getAttributeNS(null,t)}function Zh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Xh[i];r?(r===wl&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function q1(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Zh(e,r,t[r])}function ve(e,t,n){if(typeof t=="string")if(n!==void 0)Zh(e,t,n);else return Y1(e,t);else q1(e,t);return e}const K1=Object.prototype.toString;function Ze(e){return new tr(e)}function tr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}tr.prototype.add=function(e){return this.list.add(e),this},tr.prototype.remove=function(e){return K1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},tr.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},tr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},tr.prototype.array=function(){return Array.from(this.list)},tr.prototype.has=tr.prototype.contains=function(e){return this.list.contains(e)};function Ls(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Qh(e){return e.cloneNode(!0)}var El={svg:"http://www.w3.org/2000/svg"},Jh='<svg xmlns="'+El.svg+'"';function X1(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(El.svg)===-1&&(e=Jh+e.substring(4)):(e=Jh+">"+e+"</svg>",t=!0);var n=Z1(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function Z1(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Ce(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=X1(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(El.svg,e),t&&ve(n,t),n}var Sl=null;function em(){return Sl===null&&(Sl=Ce("svg")),Sl}function tm(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function Q1(e,t,n,i,r,o){var a=em().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return tm(a,e);case 6:return tm(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function ra(e){return em().createSVGTransform()}var nm=/([&<>]{1})/g,J1=/([&<>\n\r"]{1})/g,eS={"&":"&","<":"<",">":">",'"':"'"};function Rl(e,t){function n(i,r){return eS[r]||r}return e.replace(t,n)}function im(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Rl(e.textContent,nm));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,'="',Rl(o.value,J1),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)im(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Rl(e.nodeValue,nm),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function tS(e){for(var t=e.firstChild,n=[];t;)im(t,n),t=t.nextSibling;return n.join("")}function rm(e,t){return tS(e)}function Vt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function nS(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function iS(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(nS(e,i))}function oa(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),iS(n,t)),n.consolidate()}const rS=/^class[ {]/;function oS(e){return rS.test(e.toString())}function Cl(e){return Array.isArray(e)}function Pl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Is(...e){e.length===1&&Cl(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const aS=/constructor\s*[^(]*\(\s*([^)]*)\)/m,sS=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,cS=/\/\*([^*]*)\*\//m;function uS(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(oS(e)?aS:sS);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(cS);return(r&&r[1]||i).trim()})||[]}function om(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 C=b.split(".");let P=c(C.shift());for(;C.length;)P=P[C.shift()];return P}if(Pl(o,b))return o[b];if(Pl(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(Cl(b))b=Is(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const P=(b.$inject||uS(b)).map(D=>Pl(x,D)?x[D]:c(D));return{fn:b,dependencies:P}}function l(b){const{fn:x,dependencies:C}=u(b),P=Function.prototype.bind.call(x,null,...C);return new P}function f(b,x,C){const{fn:P,dependencies:D}=u(b,C);return P.apply(x,D)}function p(b){return Is(x=>b.get(x))}function d(b,x){if(x&&x.length){const C=Object.create(null),P=Object.create(null),D=[],T=[],I=[];let k,L,z,ae;for(let me in r)k=r[me],x.indexOf(me)!==-1&&(k[2]==="private"?(L=D.indexOf(k[3]),L===-1?(z=k[3].createChild([],x),ae=p(z),D.push(k[3]),T.push(z),I.push(ae),C[me]=[ae,me,"private",z]):C[me]=[I[L],me,"private",T[L]]):C[me]=[k[2],k[1]],P[me]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&x.forEach(Ue=>{k[1].$scope.indexOf(Ue)!==-1&&(C[me]=[k[2],k[1]],P[Ue]=!0)});x.forEach(me=>{if(!P[me])throw new Error('No provider for "'+me+'". Cannot use provider from the parent!')}),b.unshift(C)}return new om(b,a)}const m={factory:f,type:l,value:function(b){return b}};function h(b,x){const C=b.__init__||[];return function(){C.forEach(P=>{typeof P=="string"?x.get(P):x.invoke(P)})}}function g(b){const x=b.__exports__;if(x){const C=b.__modules__,P=Object.keys(b).reduce((L,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&(L[z]=b[z]),L),Object.create(null)),D=(C||[]).concat(P),T=d(D),I=Is(function(L){return T.get(L)});x.forEach(function(L){r[L]=[I,L,"private",T]});const k=(b.__init__||[]).slice();return k.unshift(function(){T.init()}),b=Object.assign({},b,{__init__:k}),h(b,T)}return Object.keys(b).forEach(function(C){if(C==="__init__"||C==="__depends__")return;const P=b[C];if(P[2]==="private"){r[C]=P;return}const D=P[0],T=P[1];r[C]=[m[D],lS(D,T),D]}),h(b,a)}function y(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(y,b),b.indexOf(x)!==-1)?b:b.concat(x)}function v(b){const x=b.reduce(y,[]).map(g);let C=!1;return function(){C||(C=!0,x.forEach(P=>P()))}}this.get=c,this.invoke=f,this.instantiate=l,this.createChild=d,this.init=v(e)}function lS(e,t){return e!=="value"&&Cl(t)&&(t=Is(t.slice())),t}var pS=1e3;function Li(e,t){var n=this;t=t||pS,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)})}Li.prototype.canRender=function(e){},Li.prototype.drawShape=function(e,t){},Li.prototype.drawConnection=function(e,t){},Li.prototype.getShapePath=function(e){},Li.prototype.getConnectionPath=function(e){};function Ir(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function fS(e){return["M",e.x,e.y]}function Al(e){return["L",e.x,e.y]}function dS(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function hS(e,t){const n=e.length,i=[fS(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(Al(a));continue}const c=Math.min(t,Tl(a.x-o.x,a.y-o.y),Tl(s.x-a.x,s.y-a.y));if(!c){i.push(Al(a));continue}const u=Bs(a,o,c),l=Bs(a,o,c*.5),f=Bs(a,s,c),p=Bs(a,s,c*.5);i.push(Al(u)),i.push(dS(l,p,f))}return i}function Bs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Tl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Tl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function aa(e,t,n){Be(t)&&(n=t,t=null),t||(t={});const i=Ce("path",t);return Be(n)&&(i.dataset.cornerRadius=String(n)),Ml(i,e)}function Ml(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return ve(e,{d:Ir(hS(t,n))}),e}function Ns(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 Br(e,t,n){n=n||0,De(e)||(e=[e]),$(e,function(i,r){var o=t(i,r,n);De(o)&&o.length&&Br(o,t,n+1)})}function kl(e,t,n){var i=new Set,r=new Set;return Br(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 sa(e,t){return kl(e)}function mS(e,t,n){Tr(t)&&(t=!0),Kt(t)&&(n=t,t=!0),n=n||{};var i=ca(n.allShapes),r=ca(n.allConnections),o=ca(n.enclosedElements),a=ca(n.enclosedConnections),s=ca(n.topLevel,t&&ro(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,$(l.incoming,c),$(l.outgoing,c),l.children}return Br(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Bt(e,t){t=!!t,De(e)||(e=[e]);var n,i,r,o;return $(e,function(a){var s=a;a.waypoints&&!t&&(s=Bt(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+f>r||r===void 0)&&(r=c+f),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function go(e,t){var n={};return $(e,function(i){var r=i;r.waypoints&&(r=Bt(r)),!Be(t.y)&&r.x>t.x&&(n[i.id]=i),!Be(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Be(t.width)&&Be(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Be(t.width)||!Be(t.height))&&(n[i.id]=i)}),n}function am(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function sm(e){return!!(e&&e.isFrame)}function ca(e,t){return V({},e||{},t||{})}var gS=1;function nr(e,t){Li.call(this,e,gS),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})}ye(nr,Li),nr.prototype.canRender=function(){return!0},nr.prototype.drawShape=function(t,n,i){var r=Ce("rect");return ve(r,{x:0,y:0,width:n.width||0,height:n.height||0}),sm(n)?ve(r,V({},this.FRAME_STYLE,i||{})):ve(r,V({},this.SHAPE_STYLE,i||{})),Fe(t,r),r},nr.prototype.drawConnection=function(t,n,i){var r=aa(n.waypoints,V({},this.CONNECTION_STYLE,i||{}));return Fe(t,r),r},nr.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 Ir(a)},nr.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 Ir(o)},nr.$inject=["eventBus","styles"];function yS(){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 V(o,{class:n})},this.style=function(n,i){!De(n)&&!i&&(i=n,n=[]);var r=kn(n,function(o,a){return V(o,e[a]||{})},{});return i?V(r,i):r},this.computeStyle=function(n,i,r){return De(i)||(r=i,i=[]),t.style(i||[],V({},r,n||{}))}}const vS={__init__:["defaultRenderer"],defaultRenderer:["type",nr],styles:["type",yS]};function Mt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Ot(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 Ol(e,t){return!e||!t?-1:e.indexOf(t)}function ua(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Dl(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=ua(e,t);return Math.abs(r/o)<=i}var bS=2;function Ii(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(xS(r,n))return o;return!1}function xS(e,t){const n=t[0];return Mr(t,function(i){return Math.abs(n[e]-i[e])<=bS})}function cm(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 Ll(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var _S=/,?([a-z]),?/gi,um=parseFloat,Nt=Math,ir=Nt.PI,bi=Nt.min,xi=Nt.max,lm=Nt.pow,rr=Nt.abs,wS=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,ES=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,pm=Array.isArray||function(e){return e instanceof Array};function SS(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function RS(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 CS(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 SS(r,i)?(RS(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function PS(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(wS,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(ES,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=Bl,n}function AS(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 TS(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 Il(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 Bl(){return this.join(",").replace(_S,"$1")}function MS(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=Bl,t}function fm(e,t,n,i,r,o,a,s,c){var u=1-c,l=lm(u,3),f=lm(u,2),p=c*c,d=p*c,m=l*e+f*3*c*n+u*3*c*c*r+d*a,h=l*t+f*3*c*i+u*3*c*c*o+d*s;return{x:$s(m),y:$s(h)}}function dm(e){var t=BS(...e);return Il(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function or(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function kS(e,t){return e=Il(e),t=Il(t),or(t,e.x,e.y)||or(t,e.x2,e.y)||or(t,e.x,e.y2)||or(t,e.x2,e.y2)||or(e,t.x,t.y)||or(e,t.x2,t.y)||or(e,t.x,t.y2)||or(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 hm(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 mm(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,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,m=0;m<l;m++){var h=u*f[m]+u,g=hm(h,e,n,r,a),y=hm(h,t,i,o,s),v=g*g+y*y;d+=p[m]*Nt.sqrt(v)}return u*d}function OS(e,t,n,i,r,o,a,s){if(!(xi(e,n)<bi(r,a)||bi(e,n)>xi(r,a)||xi(t,i)<bi(o,s)||bi(t,i)>xi(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 f=$s(c/l),p=$s(u/l),d=+f.toFixed(2),m=+p.toFixed(2);if(!(d<+bi(e,n).toFixed(2)||d>+xi(e,n).toFixed(2)||d<+bi(r,a).toFixed(2)||d>+xi(r,a).toFixed(2)||m<+bi(t,i).toFixed(2)||m>+xi(t,i).toFixed(2)||m<+bi(o,s).toFixed(2)||m>+xi(o,s).toFixed(2)))return{x:f,y:p}}}}function $s(e){return Math.round(e*1e11)/1e11}function DS(e,t,n){var i=dm(e),r=dm(t);if(!kS(i,r))return[];var o=mm(...e),a=mm(...t),s=ym(e)?1:~~(o/5)||1,c=ym(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),f={},p=[],d,m;for(d=0;d<s+1;d++){var h=fm(...e,d/s);u[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=fm(...t,d/c),l[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(m=0;m<c;m++){var g=u[d],y=u[d+1],v=l[m],b=l[m+1],x=rr(y.x-g.x)<.01?"y":"x",C=rr(b.x-v.x)<.01?"y":"x",P=OS(g.x,g.y,y.x,y.y,v.x,v.y,b.x,b.y),D;if(P){if(D=P.x.toFixed(9)+"#"+P.y.toFixed(9),f[D])continue;f[D]=!0;var T=g.t+rr((P[x]-g[x])/(y[x]-g[x]))*(y.t-g.t),I=v.t+rr((P[C]-v[C])/(b[C]-v[C]))*(b.t-v.t);T>=0&&T<=1&&I>=0&&I<=1&&p.push({x:P.x,y:P.y,t1:T,t2:I})}}return p}function gm(e,t,n){e=xm(e),t=xm(t);for(var i,r,o,a,s,c,u,l,f,p,d=n?0:[],m=0,h=e.length;m<h;m++){var g=e[m];if(g[0]=="M")i=s=g[1],r=c=g[2];else{g[0]=="C"?(f=[i,r,...g.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var y=0,v=t.length;y<v;y++){var b=t[y];if(b[0]=="M")o=u=b[1],a=l=b[2];else{b[0]=="C"?(p=[o,a,...b.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,u,l,u,l],o=u,a=l);var x=DS(f,p);{for(var C=0,P=x.length;C<P;C++)x[C].segment1=m,x[C].segment2=y,x[C].bez1=f,x[C].bez2=p;d=d.concat(x)}}}}}return d}function LS(e){return pm(e)&&pm(e[0])}function IS(e){if(AS(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,f=e.length;l<f;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 p=1,d=u.length;p<d;p++)c[p]=+u[p]+(p%2?n:i)}else for(var m=0,h=u.length;m<h;m++)c[m]=u[m];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=Bl,t}function ym(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Fs(e,t,n,i){return[e,t,n,i,n,i]}function vm(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 bm(e,t,n,i,r,o,a,s,c,u){var l=ir*120/180,f=ir/180*(+r||0),p=[],d,m=CS(function(M,S,w){var G=M*Nt.cos(w)-S*Nt.sin(w),U=M*Nt.sin(w)+S*Nt.cos(w);return{x:G,y:U}});if(u)D=u[0],T=u[1],C=u[2],P=u[3];else{d=m(e,t,-f),e=d.x,t=d.y,d=m(s,c,-f),s=d.x,c=d.y;var h=(e-s)/2,g=(t-c)/2,y=h*h/(n*n)+g*g/(i*i);y>1&&(y=Nt.sqrt(y),n=y*n,i=y*i);var v=n*n,b=i*i,x=(o==a?-1:1)*Nt.sqrt(rr((v*b-v*g*g-b*h*h)/(v*g*g+b*h*h))),C=x*n*g/i+(e+s)/2,P=x*-i*h/n+(t+c)/2,D=Nt.asin(((t-P)/i).toFixed(9)),T=Nt.asin(((c-P)/i).toFixed(9));D=e<C?ir-D:D,T=s<C?ir-T:T,D<0&&(D=ir*2+D),T<0&&(T=ir*2+T),a&&D>T&&(D=D-ir*2),!a&&T>D&&(T=T-ir*2)}var I=T-D;if(rr(I)>l){var k=T,L=s,z=c;T=D+l*(a&&T>D?1:-1),s=C+n*Nt.cos(T),c=P+i*Nt.sin(T),p=bm(s,c,n,i,r,0,a,L,z,[T,k,C,P])}I=T-D;var ae=Nt.cos(D),me=Nt.sin(D),Ue=Nt.cos(T),$e=Nt.sin(T),q=Nt.tan(I/4),le=4/3*n*q,oe=4/3*i*q,fe=[e,t],Oe=[e+le*me,t-oe*ae],W=[s+le*$e,c-oe*Ue],Y=[s,c];if(Oe[0]=2*fe[0]-Oe[0],Oe[1]=2*fe[1]-Oe[1],u)return[Oe,W,Y].concat(p);p=[Oe,W,Y].concat(p).join().split(",");for(var Z=[],Me=0,mt=p.length;Me<mt;Me++)Z[Me]=Me%2?m(p[Me-1],p[Me],f).y:m(p[Me],p[Me+1],f).x;return Z}function BS(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,f,p,d,m,h,g,y,v=0;v<2;++v){if(v==0?(f=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,p=3*i-3*t),rr(l)<1e-12){if(rr(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}g=f*f-4*p*l,y=Nt.sqrt(g),!(g<0)&&(m=(-f+y)/(2*l),0<m&&m<1&&c.push(m),h=(-f-y)/(2*l),0<h&&h<1&&c.push(h))}for(var b=c.length,x=b,C;b--;)d=c[b],C=1-d,u[0][b]=C*C*C*e+3*C*C*d*n+3*C*d*d*r+d*d*d*a,u[1][b]=C*C*C*t+3*C*C*d*i+3*C*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:bi(...u[0]),y0:bi(...u[1]),x1:xi(...u[0]),y1:xi(...u[1])}}function xm(e){if(LS(e)||(e=PS(e)),TS(e))return e;for(var t=MS(IS(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,m){var h,g;if(!p)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(p[0]in{T:1,Q:1})&&(d.qx=d.qy=null),p[0]){case"M":d.X=p[1],d.Y=p[2];break;case"A":p=["C",...bm(d.x,d.y,...p.slice(1))];break;case"S":m=="C"||m=="S"?(h=d.x*2-d.bx,g=d.y*2-d.by):(h=d.x,g=d.y),p=["C",h,g,...p.slice(1)];break;case"T":m=="Q"||m=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),p=["C",...vm(d.x,d.y,d.qx,d.qy,p[1],p[2])];break;case"Q":d.qx=p[1],d.qy=p[2],p=["C",...vm(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Fs(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Fs(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Fs(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Fs(d.x,d.y,d.X,d.Y)];break}return p},r=function(p,d){if(p[d].length>7){p[d].shift();for(var m=p[d];m.length;)o[d]="A",p.splice(d++,0,["C",...m.splice(0,6)]);p.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],f=l.length;n.x=l[f-2],n.y=l[f-1],n.bx=um(l[f-4])||n.x,n.by=um(l[f-3])||n.y}return t}function pt(e){return Kt(e)&&Mn(e,"waypoints")}function Ge(e){return Kt(e)&&Mn(e,"labelTarget")}function NS(e){return Kt(e)&&no(e.parent)}function _m(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Bi(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Te(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function js(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function $S(e){return Bi({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function FS(e){for(var t=e.waypoints,n=t.reduce(function(u,l,f){var p=t[f-1];if(p){var d=u[u.length-1],m=d&&d.endLength||0,h=zS(p,l);u.push({start:p,end:l,startLength:m,endLength:m+h,length:h})}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 Le(e){return pt(e)?FS(e):$S(e)}function rn(e,t,n){n=n||0,Kt(n)||(n={x:n,y:n});var i=Te(e),r=Te(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 la(e,t,n){var i=jS(e,t);return i.length===1||i.length===2&&ua(i[0],i[1])<1?Bi(i[0]):i.length>1?(i=di(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Bi(i[n?0:i.length-1])):null}function jS(e,t){return gm(e,t)}function HS(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ua(n,r)===0||Dl(i,r,n)?e.splice(t,1):t++;return e}function zS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Hs(e,t){return Math.round(e*t)/t}function wm(e){return Be(e)?e+"px":e}function GS(e){for(;e.parent;)e=e.parent;return e}function VS(e){e=V({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),wn(n,{position:"relative",overflow:"hidden",width:wm(e.width),height:wm(e.height)}),t.appendChild(n),n}function Em(e,t,n){const i=Ce("g");Ze(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const WS="base",Sm=0,US=1,YS={shape:["x","y","width","height"],connection:["waypoints"]};function Ie(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||{})}Ie.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Ie.prototype._init=function(e){const t=this._eventBus,n=this._container=VS(e),i=this._svg=Ce("svg");ve(i,{width:"100%",height:"100%"}),hn(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")}),Fe(n,i);const r=this._viewport=Em(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Vu(this._viewboxChanged,300)),this._restoreFocus=Vu(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)},Ie.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},Ie.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Ie.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=am(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Ie.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Ie.prototype.restoreFocus=function(){this._restoreFocus()},Ie.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Ie.prototype.isFocused=function(){return this._focused},Ie.prototype.getDefaultLayer=function(){return this.getLayer(WS,Sm)},Ie.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},Ie.prototype._getChildIndex=function(e){return kn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Ie.prototype._createLayer=function(e,t){typeof t>"u"&&(t=US);const n=this._getChildIndex(t);return{group:Em(this._viewport,"layer-"+e,n),index:t,visible:!0}},Ie.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},Ie.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&&(Vt(n),t.visible=!1),n},Ie.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Vt(t.group))},Ie.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Ie.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(GS(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Ie.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Ie.prototype._findPlaneForRoot=function(e){return ht(this._planes,function(t){return t.rootElement===e})},Ie.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Ie.prototype._resolveElements=function(e){return De(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Ie.prototype.getContainer=function(){return this._container},Ie.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&&($([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Ze(r).add(t)):(e.markers.delete(t),Ze(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ie.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ie.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ie.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Ie.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ie.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Ie.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,Sm);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Ie.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},Ie.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},Ie.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)},Ie.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})},Ie.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})},Ie.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=YS[e];if(!Mr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ie.prototype._setParent=function(e,t,n){Ot(t.children,e,n),e.parent=t},Ie.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},Ie.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ie.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ie.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),Mt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Ie.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ie.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ie.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ie.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ie.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ie.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);oa(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=oa(t),r=a?a.matrix:Q1(),s=Hs(r.a,1e3),c=Hs(-r.e||0,1e3),u=Hs(-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},Ie.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=V({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Rm(t,n)}),{x:n.e,y:n.f}},Ie.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(m=>m!=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=Bt(o),s=Te(a),c=this.viewbox(),u=this.zoom();let l,f;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 p=Te(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,f=a.y-c.y;else{const m=Math.max(0,s.right-p.right),h=Math.min(0,s.left-p.left),g=Math.max(0,s.bottom-p.bottom),y=Math.min(0,s.top-p.top);l=m||h,f=g||y}this.scroll({dx:-l*u,dy:-f*u})},Ie.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)}),Hs(i.a,1e3)};function Rm(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ie.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},Ie.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 f=c.a;return t?(a=V(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),Rm(this._viewport,l),l},Ie.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ie.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}},Ie.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var yo="data-element-id";function Un(e){this._elements={},this._eventBus=e}Un.$inject=["eventBus"],Un.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),ve(t,yo,i),n&&ve(n,yo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Un.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(ve(i.gfx,yo,""),i.secondaryGfx&&ve(i.secondaryGfx,yo,""),delete t[n])},Un.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)},Un.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&ve(t,yo,i),t},Un.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&ve(e,yo);var n=this._elements[t];return n&&n.element},Un.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Un.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}},Un.prototype.getAll=function(){return this.filter(function(e){return e})},Un.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)})},Un.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Un.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 qS(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 KS(e){return e.__refs_collection===!0}function XS(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Cm(e,t,n){var i=qS(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 ZS(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 Xn(e,t){if(!(this instanceof Xn))return new Xn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Xn.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?Cm(this,t,e):ZS(this,t,e)},Xn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return KS(n)||Cm(this,t,e),n},Xn.prototype.ensureBound=function(e,t){XS(e,t)||this.bind(e,t)},Xn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Xn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Nl=new Xn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Pm=new Xn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Am=new Xn({name:"attachers",collection:!0},{name:"host"}),Tm=new Xn({name:"outgoing",collection:!0},{name:"source"}),Mm=new Xn({name:"incoming",collection:!0},{name:"target"});function vo(){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)}}),Nl.bind(this,"parent"),Pm.bind(this,"labels"),Tm.bind(this,"outgoing"),Mm.bind(this,"incoming")}function pa(){vo.call(this),Nl.bind(this,"children"),Am.bind(this,"host"),Am.bind(this,"attachers")}ye(pa,vo);function km(){vo.call(this),Nl.bind(this,"children")}ye(km,pa);function Om(){pa.call(this),Pm.bind(this,"labelTarget")}ye(Om,pa);function Dm(){vo.call(this),Tm.bind(this,"source"),Mm.bind(this,"target")}ye(Dm,vo);var QS={connection:Dm,shape:pa,label:Om,root:km};function JS(e,t){var n=QS[e];if(!n)throw new Error("unknown type: <"+e+">");return V(new n,t)}function eR(e){return e instanceof vo}function Ni(){this._uid=12}Ni.prototype.createRoot=function(e){return this.create("root",e)},Ni.prototype.createLabel=function(e){return this.create("label",e)},Ni.prototype.createShape=function(e){return this.create("shape",e)},Ni.prototype.createConnection=function(e){return this.create("connection",e)},Ni.prototype.create=function(e,t){return t=V({},t||{}),t.id||(t.id=e+"_"+this._uid++),JS(e,t)};var zs="__fn",Lm=1e3,tR=Array.prototype.slice;function Ln(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Ln.prototype.on=function(e,t,n,i){if(e=De(e)?e:[e],Xt(t)&&(i=n,n=t,t=Lm),!Be(t))throw new Error("priority must be a number");var r=n;i&&(r=Cn(n,i),r[zs]=n[zs]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Ln.prototype.once=function(e,t,n,i){var r=this;if(Xt(t)&&(i=n,n=t,t=Lm),!Be(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[zs]=n,this.on(e,t,o)},Ln.prototype.off=function(e,t){e=De(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Ln.prototype.createEvent=function(e){var t=new fa;return t.init(e),t},Ln.prototype.fire=function(e,t){var n,i,r,o;if(o=tR.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 fa?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}},Ln.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Ln.prototype._destroy=function(){this._listeners={}},Ln.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Ln.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=nR(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},Ln.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},Ln.prototype._getListeners=function(e){return this._listeners[e]},Ln.prototype._setListeners=function(e,t){this._listeners[e]=t},Ln.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[zs]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function fa(){}fa.prototype.stopPropagation=function(){this.cancelBubble=!0},fa.prototype.preventDefault=function(){this.defaultPrevented=!0},fa.prototype.init=function(e){V(this,e||{})};function nR(e,t){return e.apply(null,t)}function Nr(e){return e.childNodes[0]}function iR(e){return e.parentNode.childNodes[1]}function Gs(e,t,n,i,r){var o=ra();o.setTranslate(t,n);var a=ra();a.setRotate(i||0,0,0);var s=ra();s.setScale(1,1),oa(e,[o,a,s])}function on(e,t,n){var i=ra();i.setTranslate(t,n),oa(e,i)}function Im(e,t){var n=ra();n.setRotate(t,0,0),oa(e,n)}function Yn(e,t){this._eventBus=e,this._elementRegistry=t}Yn.$inject=["eventBus","elementRegistry"],Yn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=iR(t),n||(n=Ce("g"),Ze(n).add("djs-children"),Fe(t.parentNode,n))):n=t,n},Yn.prototype._clear=function(e){var t=Nr(e);return ks(t),t},Yn.prototype._createContainer=function(e,t,n,i){var r=Ce("g");Ze(r).add("djs-group"),typeof n<"u"?rR(r,t,t.childNodes[n]):Fe(t,r);var o=Ce("g");Ze(o).add("djs-element"),Ze(o).add("djs-"+e),i&&Ze(o).add("djs-frame"),Fe(r,o);var a=Ce("g");return Ze(a).add("djs-visual"),Fe(o,a),o},Yn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,sm(t))},Yn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=kn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),$(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;$(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Yn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Yn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Yn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Yn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Yn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),on(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?ve(n,"display","none"):ve(n,"display","block")}},Yn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Vt(t.parentNode)};function rR(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const oR={__depends__:[vS],__init__:["canvas"],canvas:["type",Ie],elementRegistry:["type",Un],elementFactory:["type",Ni],eventBus:["type",Ln],graphicsFactory:["type",Yn]};function aR(e){var t=new om(e);return t.init(),t}function sR(e){e=e||{};var t={config:["value",e]},n=[t,oR].concat(e.modules||[]);return aR(n)}function ar(e,t){this._injector=t||sR(e),this.get("eventBus").fire("diagram.init")}ar.prototype.get=function(e,t){return this._injector.get(e,t)},ar.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ar.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ar.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function mn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Pn(e,t){return e.$instanceOf(t)}function cR(e){return ht(e.rootElements,function(t){return Pn(t,"bpmn:Process")||Pn(t,"bpmn:Collaboration")})}function uR(e){var t={},n=[],i={};function r(W,Y){return function(Z){W(Z,Y)}}function o(W){t[W.id]=W}function a(W){return t[W.id]}function s(W,Y){var Z=W.gfx;if(Z)throw new Error(`already rendered ${mn(W)}`);return e.element(W,i[W.id],Y)}function c(W,Y){return e.root(W,i[W.id],Y)}function u(W,Y){try{var Z=i[W.id]&&s(W,Y);return o(W),Z}catch(Me){l(Me.message,{element:W,error:Me}),console.error(`failed to import ${mn(W)}`,Me)}}function l(W,Y){e.error(W,Y)}var f=this.registerDi=function(Y){var Z=Y.bpmnElement;Z?i[Z.id]?l(`multiple DI elements defined for ${mn(Z)}`,{element:Z}):i[Z.id]=Y:l(`no bpmnElement referenced in ${mn(Y)}`,{element:Y})};function p(W){d(W.plane)}function d(W){f(W),$(W.planeElement,m)}function m(W){f(W)}this.handleDefinitions=function(Y,Z){var Me=Y.diagrams;if(Z&&Me.indexOf(Z)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!Z&&Me&&Me.length&&(Z=Me[0]),!Z)throw new Error("no diagram to display");i={},p(Z);var mt=Z.plane;if(!mt)throw new Error(`no plane for ${mn(Z)}`);var M=mt.bpmnElement;if(!M)if(M=cR(Y),M)l(`correcting missing bpmnElement on ${mn(mt)} to ${mn(M)}`),mt.bpmnElement=M,f(mt);else throw new Error("no process or collaboration to display");var S=c(M,mt);if(Pn(M,"bpmn:Process")||Pn(M,"bpmn:SubProcess"))g(M,S);else if(Pn(M,"bpmn:Collaboration"))fe(M,S),y(Y.rootElements,S);else throw new Error(`unsupported bpmnElement for ${mn(mt)}: ${mn(M)}`);h(n)};var h=this.handleDeferred=function(){for(var Y;n.length;)Y=n.shift(),Y()};function g(W,Y){q(W,Y),I(W.ioSpecification,Y),T(W.artifacts,Y),o(W)}function y(W,Y){var Z=Ye(W,function(Me){return!a(Me)&&Pn(Me,"bpmn:Process")&&Me.laneSets});Z.forEach(r(g,Y))}function v(W,Y){u(W,Y)}function b(W,Y){$(W,r(v,Y))}function x(W,Y){u(W,Y)}function C(W,Y){u(W,Y)}function P(W,Y){u(W,Y)}function D(W,Y){u(W,Y)}function T(W,Y){$(W,function(Z){Pn(Z,"bpmn:Association")?n.push(function(){D(Z,Y)}):D(Z,Y)})}function I(W,Y){W&&($(W.dataInputs,r(C,Y)),$(W.dataOutputs,r(P,Y)))}var k=this.handleSubProcess=function(Y,Z){q(Y,Z),T(Y.artifacts,Z)};function L(W,Y){var Z=u(W,Y);Pn(W,"bpmn:SubProcess")&&k(W,Z||Y),Pn(W,"bpmn:Activity")&&I(W.ioSpecification,Y),n.push(function(){$(W.dataInputAssociations,r(x,Y)),$(W.dataOutputAssociations,r(x,Y))})}function z(W,Y){u(W,Y)}function ae(W,Y){u(W,Y)}function me(W,Y){n.push(function(){var Z=u(W,Y);W.childLaneSet&&Ue(W.childLaneSet,Z||Y),Oe(W)})}function Ue(W,Y){$(W.lanes,r(me,Y))}function $e(W,Y){$(W,r(Ue,Y))}function q(W,Y){le(W.flowElements,Y),W.laneSets&&$e(W.laneSets,Y)}function le(W,Y){$(W,function(Z){Pn(Z,"bpmn:SequenceFlow")?n.push(function(){z(Z,Y)}):Pn(Z,"bpmn:BoundaryEvent")?n.unshift(function(){L(Z,Y)}):Pn(Z,"bpmn:FlowNode")?L(Z,Y):Pn(Z,"bpmn:DataObject")||(Pn(Z,"bpmn:DataStoreReference")||Pn(Z,"bpmn:DataObjectReference")?ae(Z,Y):l(`unrecognized flowElement ${mn(Z)} in context ${mn(Y&&Y.businessObject)}`,{element:Z,context:Y}))})}function oe(W,Y){var Z=u(W,Y),Me=W.processRef;Me&&g(Me,Z||Y)}function fe(W,Y){$(W.participants,r(oe,Y)),n.push(function(){b(W.messageFlows,Y)}),T(W.artifacts,Y)}function Oe(W){$(W.flowNodeRef,function(Y){var Z=Y.get("lanes");Z&&Z.push(W)})}}function E(e,t){var n=te(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function We(e,t){return Xi(t,function(n){return E(e,n)})}function te(e){return e&&e.businessObject||e}function Qe(e){return e&&e.di}function lR(e,t,n){var i,r,o,a,s=[];function c(u,l){var f={root:function(h,g){return i.add(h,g)},element:function(h,g,y){return i.add(h,g,y)},error:function(h,g){s.push({message:h,context:g})}},p=new uR(f);l=l||u.diagrams&&u.diagrams[0];var d=pR(u,l);if(!d)throw new Error("no diagram to display");$(d,function(h){p.handleDefinitions(u,h)});var m=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(m+"_plane")||o.findRoot(m))}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(f){return f.warnings=s,l(f)}})}function pR(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!E(n,"bpmn:Process")&&!E(n,"bpmn:Collaboration")&&(i=fR(n));var r;E(i,"bpmn:Collaboration")?r=i:r=ht(e.rootElements,function(u){if(E(u,"bpmn:Collaboration"))return ht(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=pn(r.participants,function(u){return u.processRef}),o.push(r));var a=Bm(o),s=[t],c=[n];return $(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 Bm(e){var t=[];return $(e,function(n){n&&(t.push(n),t=t.concat(Bm(n.flowElements)))}),t}function fR(e){for(var t=e;t;){if(E(t,"bpmn:Process"))return t;t=t.$parent}}var dR='<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>',Nm=dR,$m={verticalAlign:"middle"},Fm={color:"#404040"},hR={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},mR={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},gR={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"},yR='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Nm+'</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>',_i;function vR(){_i=bt(yR),wn(_i,hR),wn(ut("svg",_i),$m),wn(ut(".backdrop",_i),mR),wn(ut(".notice",_i),gR),wn(ut(".link",_i),Fm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function bR(){_i||(vR(),Dn.bind(_i,".backdrop","click",function(e){document.body.removeChild(_i)})),document.body.appendChild(_i)}const Vs=5,jm="djs-outline-hidden";function St(e){e=V({},_R,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),ER(this._container)}ye(St,ar),St.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(p){throw this._emit("import.parse.complete",{error:p}),p}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 f=await this.importDefinitions(s,n);return o=o.concat(f.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Ws(s,o),s=xR(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},St.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},St.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ws(o,[]),o}if(typeof t=="string"&&(i=wR(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ws(o,[]),o}try{this.clear()}catch(o){throw Ws(o,[]),o}const{warnings:r}=await lR(this,n,i);return{warnings:r}},St.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},St.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=ut(":scope > defs",i._svg),a=rm(r),s=o?"<defs>"+rm(o)+"</defs>":"",c=i.getContainer();Et(c).add(jm);let u;try{u=r.getBBox()}finally{Et(c).remove(jm)}const l=u.x-Vs,f=u.y-Vs,p=u.width+Vs*2,d=u.height+Vs*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}},Ke.prototype._setDefinitions=function(e){this._definitions=e},Ke.prototype.getModules=function(){return this._modules},Ke.prototype.clear=function(){this.getDefinitions()&&Si.prototype.clear.call(this)},Ke.prototype.destroy=function(){Si.prototype.destroy.call(this),On(this._container)},Ke.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Ke.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Ke.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=$e(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Ke.prototype.getDefinitions=function(){return this._definitions},Ke.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Ke.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=k(An(n,["additionalModules"]),{canvas:k({},n.canvas,{container:e}),modules:a});Si.call(this,s),n&&n.container&&this.attachTo(n.container)},Ke.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Ke.prototype._createContainer=function(e){const t=We('<div class="bjs-container"></div>');return zt(t,{width:Hd(e.width),height:Hd(e.height),position:e.position}),t},Ke.prototype._createModdle=function(e){const t=k({},this._moddleExtensions,e.moddleExtensions);return new hf(t)},Ke.prototype._modules=[];function Na(e,t){return e.warnings=t,e}function lw(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 pw={width:"100%",height:"100%",position:"relative"};function Hd(e){return e+(me(e)?"px":"")}function fw(e,t){return t&&ze(e.diagrams,function(n){return n.id===t})||null}function dw(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Nd+"</a>",i=We(n);zt($e("svg",i),$d),zt(i,jd,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),ve.bind(i,"click",function(r){uw(),r.preventDefault()})}function Tr(e){Ke.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(Tr,Ke),Tr.prototype._createModdle=function(e){var t=Ke.prototype._createModdle.call(this,e);return t.ids=new Dn([32,36,1]),t},Tr.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 Pe(e,t){return y(e,"bpmn:CallActivity")?!1:y(e,"bpmn:SubProcess")?(t=t||De(e),t&&y(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):y(e,"bpmn:Participant")?!!U(e).processRef:!0}function Et(e){if(!(!y(e,"bpmn:Participant")&&!y(e,"bpmn:Lane"))){var t=De(e).isHorizontal;return t===void 0?!0:t}}function hw(e){return e&&U(e).isInterrupting!==!1}function Nt(e){return e&&!!U(e).triggeredByEvent}function Mr(e,t){var n=U(e).eventDefinitions;return di(n,function(i){return y(i,t)})}function mw(e){return Mr(e,"bpmn:ErrorEventDefinition")}function gw(e){return Mr(e,"bpmn:EscalationEventDefinition")}function vw(e){return Mr(e,"bpmn:CompensateEventDefinition")}var rr={width:90,height:20},zd=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 $a(e){return xe(e.label)}function yw(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=_w(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-=zd:a+=zd,{x:a,y:s}}function _w(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 mu(e){return e.waypoints?yw(e.waypoints):y(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+rr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+rr.height/2}}function bw(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(rr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=mu(t),i=rr),k({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Vd(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 xw(e){var t=e.categoryValueRef;return t&&t.value||""}function un(e){var t=e.businessObject,n=Vd(t);if(n)return n==="categoryValueRef"?xw(t):t[n]||""}function Ew(e,t){var n=e.businessObject,i=Vd(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function ww(e){return xe(e)&&Ri(e.labelTarget)}var kr=7;function Gd(e){let t=[];return P(e.incoming,n=>{y(n,"bpmn:Association")&&y(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),P(e.outgoing,n=>{y(n,"bpmn:Association")&&y(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function _o(e){const t=new Map;return P(cu(e),n=>{P(Gd(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 gu="hsl(225, 10%, 15%)",Sw="white";function Nn(e,t){return di(e.eventDefinitions,function(n){return n.$type===t})}function Rw(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function Cw(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ce(e,t,n){var i=De(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||Sw}function K(e,t,n){var i=De(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||gu}function bo(e,t,n,i){var r=De(e),o=r.get("label");return i||o&&o.get("color:color")||t||K(e,n)}function Wd(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 tr(r)}function vu(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 tr(a)}function Pw(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 tr(s)}function Aw(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 tr(o)}function xo(e,t={}){return{width:fn(e,t),height:Qt(e,t)}}function fn(e,t={}){return Yt(t,"width")?t.width:e.width}function Qt(e,t={}){return Yt(t,"height")?t.height:e.height}var Tw=new Dn,Mw=10,ja=3,kw=1.5,Fa=10,Dw=4,Dr=.95,Ow=1,Iw=.25;function or(e,t,n,i,r,o,a){Yn.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(R){return n.computeStyle(R,{strokeLinecap:"round",strokeLinejoin:"round",stroke:gu,strokeWidth:2,fill:"white"})}function p(R){return n.computeStyle(R,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:gu,strokeWidth:2})}function f(R,_){var{ref:v={x:0,y:0},scale:M=1,element:O,parentGfx:z=r._svg}=_,J=oe("marker",{id:R,viewBox:"0 0 20 20",refX:v.x,refY:v.y,markerWidth:20*M,markerHeight:20*M,orient:"auto"});ye(J,O);var ge=$e(":scope > defs",z);ge||(ge=oe("defs"),ye(z,ge)),ye(ge,J)}function d(R,_,v,M){var O=Tw.nextPrefixed("marker-");return h(R,O,_,v,M),"url(#"+O+")"}function h(R,_,v,M,O){if(v==="sequenceflow-end"){var z=oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:O,stroke:O,strokeWidth:1})});f(_,{element:z,ref:{x:11,y:10},scale:.5,parentGfx:R})}if(v==="messageflow-start"){var J=oe("circle",{cx:6,cy:6,r:3.5,...l({fill:M,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:J,ref:{x:6,y:6},parentGfx:R})}if(v==="messageflow-end"){var ge=oe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:M,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:ge,ref:{x:8.5,y:5},parentGfx:R})}if(v==="association-start"){var Ie=oe("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:Ie,ref:{x:1,y:10},scale:.5,parentGfx:R})}if(v==="association-end"){var tt=oe("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:tt,ref:{x:11,y:10},scale:.5,parentGfx:R})}if(v==="conditional-flow-marker"){var Ne=oe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:M,stroke:O})});f(_,{element:Ne,ref:{x:-1,y:10},scale:.5,parentGfx:R})}if(v==="conditional-default-flow-marker"){var ft=oe("path",{d:"M 6 4 L 10 16",...l({stroke:O,fill:"none"})});f(_,{element:ft,ref:{x:0,y:10},scale:.5,parentGfx:R})}}function m(R,_,v,M,O={}){bt(M)&&(O=M,M=0),M=M||0,O=l(O);var z=_/2,J=v/2,ge=oe("circle",{cx:z,cy:J,r:Math.round((_+v)/4-M),...O});return ye(R,ge),ge}function g(R,_,v,M,O,z){bt(O)&&(z=O,O=0),O=O||0,z=l(z);var J=oe("rect",{x:O,y:O,width:_-O*2,height:v-O*2,rx:M,ry:M,...z});return ye(R,J),J}function w(R,_,v,M){var O=_/2,z=v/2,J=[{x:O,y:0},{x:_,y:z},{x:O,y:v},{x:0,y:z}],ge=J.map(function(tt){return tt.x+","+tt.y}).join(" ");M=l(M);var Ie=oe("polygon",{...M,points:ge});return ye(R,Ie),Ie}function E(R,_,v,M){v=p(v);var O=po(_,v,M);return ye(R,O),O}function b(R,_,v){return E(R,_,v,5)}function x(R,_,v){v=p(v);var M=oe("path",{...v,d:_});return ye(R,M),M}function S(R,_,v,M){return x(_,v,k({"data-marker":R},M))}function A(R){return _t[R]}function I(R){return function(_,v,M){return A(R)(_,v,M)}}var C={"bpmn:MessageEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.235,my:.315}}),z=M?K(_,c,v.stroke):Ce(_,s,v.fill),J=M?Ce(_,s,v.fill):K(_,c,v.stroke),ge=x(R,O,{fill:z,stroke:J,strokeWidth:1});return ge},"bpmn:TimerEventDefinition":function(R,_,v={}){var M=v.width||_.width,O=v.height||_.height,z=v.width?1:2,J=m(R,M,O,.2*O,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:z}),ge=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:M,containerHeight:O,position:{mx:.5,my:.5}});x(R,ge,{stroke:K(_,c,v.stroke),strokeWidth:z});for(var Ie=0;Ie<12;Ie++){var tt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:M,containerHeight:O,position:{mx:.5,my:.5}}),Ne=M/2,ft=O/2;x(R,tt,{strokeWidth:1,stroke:K(_,c,v.stroke),transform:"rotate("+Ie*30+","+ft+","+Ne+")"})}return J},"bpmn:EscalationEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),z=M?K(_,c,v.stroke):Ce(_,s,v.fill);return x(R,O,{fill:z,stroke:K(_,c,v.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(R,_,v={}){var M=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.222}});return x(R,M,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),z=M?K(_,c,v.stroke):Ce(_,s,v.fill);return x(R,O,{fill:z,stroke:K(_,c,v.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.2,my:.722}}),z=M?K(_,c,v.stroke):Ce(_,s,v.fill);return x(R,O,{fill:z,stroke:K(_,c,v.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),z=M?K(_,c,v.stroke):"none",J=x(R,O,{fill:z,stroke:K(_,c,v.stroke),strokeWidth:1});return Ld(J,45),J},"bpmn:CompensateEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.22,my:.5}}),z=M?K(_,c,v.stroke):Ce(_,s,v.fill);return x(R,O,{fill:z,stroke:K(_,c,v.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),z=M?K(_,c,v.stroke):Ce(_,s,v.fill);return x(R,O,{strokeWidth:1,fill:z,stroke:K(_,c,v.stroke)})},"bpmn:MultipleEventDefinition":function(R,_,v={},M){var O=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.211,my:.36}}),z=M?K(_,c,v.stroke):Ce(_,s,v.fill);return x(R,O,{fill:z,stroke:K(_,c,v.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(R,_,v={}){var M=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.458,my:.194}});return x(R,M,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(R,_,v={}){var M=m(R,_.width,_.height,8,{fill:K(_,c,v.stroke),stroke:K(_,c,v.stroke),strokeWidth:4});return M}};function $(R,_,v={},M){var O=U(R),z=Rw(O),J=M||R;return O.get("eventDefinitions")&&O.get("eventDefinitions").length>1?O.get("parallelMultiple")?C["bpmn:ParallelMultipleEventDefinition"](_,J,v,z):C["bpmn:MultipleEventDefinition"](_,J,v,z):Nn(O,"bpmn:MessageEventDefinition")?C["bpmn:MessageEventDefinition"](_,J,v,z):Nn(O,"bpmn:TimerEventDefinition")?C["bpmn:TimerEventDefinition"](_,J,v,z):Nn(O,"bpmn:ConditionalEventDefinition")?C["bpmn:ConditionalEventDefinition"](_,J,v,z):Nn(O,"bpmn:SignalEventDefinition")?C["bpmn:SignalEventDefinition"](_,J,v,z):Nn(O,"bpmn:EscalationEventDefinition")?C["bpmn:EscalationEventDefinition"](_,J,v,z):Nn(O,"bpmn:LinkEventDefinition")?C["bpmn:LinkEventDefinition"](_,J,v,z):Nn(O,"bpmn:ErrorEventDefinition")?C["bpmn:ErrorEventDefinition"](_,J,v,z):Nn(O,"bpmn:CancelEventDefinition")?C["bpmn:CancelEventDefinition"](_,J,v,z):Nn(O,"bpmn:CompensateEventDefinition")?C["bpmn:CompensateEventDefinition"](_,J,v,z):Nn(O,"bpmn:TerminateEventDefinition")?C["bpmn:TerminateEventDefinition"](_,J,v,z):null}var j={ParticipantMultiplicityMarker:function(R,_,v={}){var M=fn(_,v),O=Qt(_,v),z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:O,position:{mx:(M/2-6)/M,my:(O-15)/O}});S("participant-multiplicity",R,z,{strokeWidth:2,fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke)})},SubProcessMarker:function(R,_,v={}){var M=g(R,14,14,0,{strokeWidth:1,fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke)});Ct(M,_.width/2-7.5,_.height-20);var O=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",R,O,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke)})},ParallelMarker:function(R,_,v){var M=fn(_,v),O=Qt(_,v),z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:O,position:{mx:(M/2+v.parallel)/M,my:(O-20)/O}});S("parallel",R,z,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke)})},SequentialMarker:function(R,_,v){var M=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+v.seq)/_.width,my:(_.height-19)/_.height}});S("sequential",R,M,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke)})},CompensationMarker:function(R,_,v){var M=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+v.compensation)/_.width,my:(_.height-13)/_.height}});S("compensation",R,M,{strokeWidth:1,fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke)})},LoopMarker:function(R,_,v){var M=fn(_,v),O=Qt(_,v),z=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:O,position:{mx:(M/2+v.loop)/M,my:(O-7)/O}});S("loop",R,z,{strokeWidth:1.5,fill:"none",stroke:K(_,c,v.stroke),strokeMiterlimit:.5})},AdhocMarker:function(R,_,v){var M=fn(_,v),O=Qt(_,v),z=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:O,position:{mx:(M/2+v.adhoc)/M,my:(O-15)/O}});S("adhoc",R,z,{strokeWidth:1,fill:K(_,c,v.stroke),stroke:K(_,c,v.stroke)})}};function L(R,_,v,M){j[R](_,v,M)}function F(R,_,v=[],M={}){M={fill:M.fill,stroke:M.stroke,width:fn(_,M),height:Qt(_,M)};var O=U(_),z=v.includes("SubProcessMarker");z?M={...M,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:M={...M,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},O.get("isForCompensation")&&v.push("CompensationMarker"),y(O,"bpmn:AdHocSubProcess")&&(v.push("AdhocMarker"),z||k(M,{compensation:M.compensation-18}));var J=O.get("loopCharacteristics"),ge=J&&J.get("isSequential");J&&(k(M,{compensation:M.compensation-18}),v.includes("AdhocMarker")&&k(M,{seq:-23,loop:-18,parallel:-24}),ge===void 0&&v.push("LoopMarker"),ge===!1&&v.push("ParallelMarker"),ge===!0&&v.push("SequentialMarker")),v.includes("CompensationMarker")&&v.length===1&&k(M,{compensation:-8}),P(v,function(Ie){L(Ie,R,_,M)})}function te(R,_,v={}){v=k({size:{width:100}},v);var M=o.createText(_||"",v);return Me(M).add("djs-label"),ye(R,M),M}function ke(R,_,v,M={}){var O=U(_),z=xo({x:_.x,y:_.y,width:_.width,height:_.height},M);return te(R,O.name,{align:v,box:z,padding:7,style:{fill:bo(_,u,c,M.stroke)}})}function Je(R,_,v={}){var M={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return te(R,un(_),{box:M,style:k({},o.getExternalStyle(),{fill:bo(_,u,c,v.stroke)})})}function q(R,_,v,M={}){var O=Et(v),z=te(R,_,{box:{height:30,width:O?Qt(v,M):fn(v,M)},align:"center-middle",style:{fill:bo(v,u,c,M.stroke)}});if(O){var J=-1*Qt(v,M);La(z,0,-J,270)}}function ne(R,_,v={}){var{width:M,height:O}=xo(_,v);return g(R,M,O,Fa,{...v,fill:Ce(_,s,v.fill),fillOpacity:Dr,stroke:K(_,c,v.stroke)})}function ce(R,_,v={}){var M=U(_),O=Ce(_,s,v.fill),z=K(_,c,v.stroke);return(M.get("associationDirection")==="One"||M.get("associationDirection")==="Both")&&(v.markerEnd=d(R,"association-end",O,z)),M.get("associationDirection")==="Both"&&(v.markerStart=d(R,"association-start",O,z)),v=Oe(v,["markerStart","markerEnd"]),b(R,_.waypoints,{...v,stroke:z,strokeDasharray:"0, 5"})}function ee(R,_,v={}){var M=Ce(_,s,v.fill),O=K(_,c,v.stroke),z=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),J=x(R,z,{fill:M,fillOpacity:Dr,stroke:O}),ge=U(_);if(Cw(ge)){var Ie=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});x(R,Ie,{strokeWidth:2,fill:M,stroke:O})}return J}function ae(R,_,v={}){return m(R,_.width,_.height,{fillOpacity:Dr,...v,fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke)})}function Y(R,_,v={}){return w(R,_.width,_.height,{fill:Ce(_,s,v.fill),fillOpacity:Dr,stroke:K(_,c,v.stroke)})}function B(R,_,v={}){var M=g(R,fn(_,v),Qt(_,v),0,{fill:Ce(_,s,v.fill),fillOpacity:v.fillOpacity||Dr,stroke:K(_,c,v.stroke),strokeWidth:1.5}),O=U(_);if(y(O,"bpmn:Lane")){var z=O.get("name");q(R,z,_,v)}return M}function N(R,_,v={}){var M=ne(R,_,v),O=Pe(_);if(Nt(_)&&(Z(M,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!O)){var z=U(_).flowElements||[],J=z.filter(ge=>y(ge,"bpmn:StartEvent"));J.length===1&&V(J[0],R,v,_)}return ke(R,_,O?"center-top":"center-middle",v),O?F(R,_,void 0,v):F(R,_,["SubProcessMarker"],v),M}function V(R,_,v,M){var O=22,z={fill:Ce(M,s,v.fill),stroke:K(M,c,v.stroke),width:O,height:O},J=U(R).isInterrupting,ge=J?0:3,Ie=J?1:1.2,tt=20,Ne=(O-tt)/2,ft="translate("+Ne+","+Ne+")";m(_,tt,tt,{fill:z.fill,stroke:z.stroke,strokeWidth:Ie,strokeDasharray:ge,transform:ft}),$(R,_,z,M)}function Ee(R,_,v={}){var M=ne(R,_,v);return ke(R,_,"center-middle",v),F(R,_,void 0,v),M}var _t=this.handlers={"bpmn:AdHocSubProcess":function(R,_,v={}){return Pe(_)?v=Oe(v,["fill","stroke","width","height"]):v=Oe(v,["fill","stroke"]),N(R,_,v)},"bpmn:Association":function(R,_,v={}){return v=Oe(v,["fill","stroke"]),ce(R,_,v)},"bpmn:BoundaryEvent":function(R,_,v={}){var{renderIcon:M=!0}=v;v=Oe(v,["fill","stroke"]);var O=U(_),z=O.get("cancelActivity");v={strokeWidth:1.5,fill:Ce(_,s,v.fill),fillOpacity:Ow,stroke:K(_,c,v.stroke)},z||(v.strokeDasharray="6");var J=ae(R,_,v);return m(R,_.width,_.height,ja,{...v,fill:"none"}),M&&$(_,R,v),J},"bpmn:BusinessRuleTask":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Ee(R,_,v),O=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),z=x(R,O);Z(z,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:1});var J=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),ge=x(R,J);return Z(ge,{fill:K(_,c,v.stroke),stroke:K(_,c,v.stroke),strokeWidth:1}),M},"bpmn:CallActivity":function(R,_,v={}){return v=Oe(v,["fill","stroke"]),N(R,_,{strokeWidth:5,...v})},"bpmn:ComplexGateway":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Y(R,_,v),O=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return x(R,O,{fill:K(_,c,v.stroke),stroke:K(_,c,v.stroke),strokeWidth:1}),M},"bpmn:DataInput":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=i.getRawPath("DATA_ARROW"),O=ee(R,_,v);return x(R,M,{fill:"none",stroke:K(_,c,v.stroke),strokeWidth:1}),O},"bpmn:DataInputAssociation":function(R,_,v={}){return v=Oe(v,["fill","stroke"]),ce(R,_,{...v,markerEnd:d(R,"association-end",Ce(_,s,v.fill),K(_,c,v.stroke))})},"bpmn:DataObject":function(R,_,v={}){return v=Oe(v,["fill","stroke"]),ee(R,_,v)},"bpmn:DataObjectReference":I("bpmn:DataObject"),"bpmn:DataOutput":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=i.getRawPath("DATA_ARROW"),O=ee(R,_,v);return x(R,M,{strokeWidth:1,fill:K(_,c,v.stroke),stroke:K(_,c,v.stroke)}),O},"bpmn:DataOutputAssociation":function(R,_,v={}){return v=Oe(v,["fill","stroke"]),ce(R,_,{...v,markerEnd:d(R,"association-end",Ce(_,s,v.fill),K(_,c,v.stroke))})},"bpmn:DataStoreReference":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return x(R,M,{fill:Ce(_,s,v.fill),fillOpacity:Dr,stroke:K(_,c,v.stroke),strokeWidth:2})},"bpmn:EndEvent":function(R,_,v={}){var{renderIcon:M=!0}=v;v=Oe(v,["fill","stroke"]);var O=ae(R,_,{...v,strokeWidth:4});return M&&$(_,R,v),O},"bpmn:EventBasedGateway":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=U(_),O=Y(R,_,v);m(R,_.width,_.height,_.height*.2,{fill:Ce(_,"none",v.fill),stroke:K(_,c,v.stroke),strokeWidth:1});var z=M.get("eventGatewayType"),J=!!M.get("instantiate");function ge(){var tt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});x(R,tt,{fill:"none",stroke:K(_,c,v.stroke),strokeWidth:2})}if(z==="Parallel"){var Ie=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}});x(R,Ie,{fill:"none",stroke:K(_,c,v.stroke),strokeWidth:1})}else z==="Exclusive"&&(J||m(R,_.width,_.height,_.height*.26,{fill:"none",stroke:K(_,c,v.stroke),strokeWidth:1}),ge());return O},"bpmn:ExclusiveGateway":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Y(R,_,v),O=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),z=De(_);return z.get("isMarkerVisible")&&x(R,O,{fill:K(_,c,v.stroke),stroke:K(_,c,v.stroke),strokeWidth:1}),M},"bpmn:Gateway":function(R,_,v={}){return v=Oe(v,["fill","stroke"]),Y(R,_,v)},"bpmn:Group":function(R,_,v={}){return v=Oe(v,["fill","stroke","width","height"]),g(R,_.width,_.height,Fa,{stroke:K(_,c,v.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:fn(_,v),height:Qt(_,v)})},"bpmn:InclusiveGateway":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Y(R,_,v);return m(R,_.width,_.height,_.height*.24,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:2.5}),M},"bpmn:IntermediateEvent":function(R,_,v={}){var{renderIcon:M=!0}=v;v=Oe(v,["fill","stroke"]);var O=ae(R,_,{...v,strokeWidth:1.5});return m(R,_.width,_.height,ja,{fill:"none",stroke:K(_,c,v.stroke),strokeWidth:1.5}),M&&$(_,R,v),O},"bpmn:IntermediateCatchEvent":I("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":I("bpmn:IntermediateEvent"),"bpmn:Lane":function(R,_,v={}){return v=Oe(v,["fill","stroke","width","height"]),B(R,_,{...v,fillOpacity:Iw})},"bpmn:ManualTask":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Ee(R,_,v),O=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(R,O,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:.5}),M},"bpmn:MessageFlow":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=U(_),O=De(_),z=Ce(_,s,v.fill),J=K(_,c,v.stroke),ge=b(R,_.waypoints,{markerEnd:d(R,"messageflow-end",z,J),markerStart:d(R,"messageflow-start",z,J),stroke:J,strokeDasharray:"10, 11",strokeWidth:1.5});if(M.get("messageRef")){var Ie=ge.getPointAtLength(ge.getTotalLength()/2),tt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ie.x,y:Ie.y}}),Ne={strokeWidth:1};O.get("messageVisibleKind")==="initiating"?(Ne.fill=z,Ne.stroke=J):(Ne.fill=J,Ne.stroke=z);var ft=x(R,tt,Ne),Tt=M.get("messageRef"),T=Tt.get("name"),D=te(R,T,{align:"center-top",fitBox:!0,style:{fill:J}}),H=ft.getBBox(),Q=D.getBBox(),le=Ie.x-Q.width/2,re=Ie.y+H.height/2+Mw;La(D,le,re,0)}return ge},"bpmn:ParallelGateway":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Y(R,_,v),O=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return x(R,O,{fill:K(_,c,v.stroke),stroke:K(_,c,v.stroke),strokeWidth:1}),M},"bpmn:Participant":function(R,_,v={}){v=Oe(v,["fill","stroke","width","height"]);var M=B(R,_,v),O=Pe(_),z=Et(_),J=U(_),ge=J.get("name");if(O){var Ie=z?[{x:30,y:0},{x:30,y:Qt(_,v)}]:[{x:0,y:30},{x:fn(_,v),y:30}];E(R,Ie,{stroke:K(_,c,v.stroke),strokeWidth:kw}),q(R,ge,_,v)}else{var tt=xo(_,v);z||(tt.height=fn(_,v),tt.width=Qt(_,v));var Ne=te(R,ge,{box:tt,align:"center-middle",style:{fill:bo(_,u,c,v.stroke)}});if(!z){var ft=-1*Qt(_,v);La(Ne,0,-ft,270)}}return J.get("participantMultiplicity")&&L("ParticipantMultiplicityMarker",R,_,v),M},"bpmn:ReceiveTask":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=U(_),O=Ee(R,_,v),z;return M.get("instantiate")?(m(R,28,28,20*.22,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:1}),z=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):z=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(R,z,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:1}),O},"bpmn:ScriptTask":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Ee(R,_,v),O=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(R,O,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:1}),M},"bpmn:SendTask":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Ee(R,_,v),O=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(R,O,{fill:K(_,c,v.stroke),stroke:Ce(_,s,v.fill),strokeWidth:1}),M},"bpmn:SequenceFlow":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Ce(_,s,v.fill),O=K(_,c,v.stroke),z=b(R,_.waypoints,{markerEnd:d(R,"sequenceflow-end",M,O),stroke:O}),J=U(_),{source:ge}=_;if(ge){var Ie=U(ge);J.get("conditionExpression")&&y(Ie,"bpmn:Activity")&&Z(z,{markerStart:d(R,"conditional-flow-marker",M,O)}),Ie.get("default")&&(y(Ie,"bpmn:Gateway")||y(Ie,"bpmn:Activity"))&&Ie.get("default")===J&&Z(z,{markerStart:d(R,"conditional-default-flow-marker",M,O)})}return z},"bpmn:ServiceTask":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Ee(R,_,v);m(R,10,10,{fill:Ce(_,s,v.fill),stroke:"none",transform:"translate(6, 6)"});var O=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(R,O,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:1}),m(R,10,10,{fill:Ce(_,s,v.fill),stroke:"none",transform:"translate(11, 10)"});var z=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(R,z,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:1}),M},"bpmn:StartEvent":function(R,_,v={}){var{renderIcon:M=!0}=v;v=Oe(v,["fill","stroke"]);var O=U(_);O.get("isInterrupting")||(v={...v,strokeDasharray:"6"});var z=ae(R,_,v);return M&&$(_,R,v),z},"bpmn:SubProcess":function(R,_,v={}){return Pe(_)?v=Oe(v,["fill","stroke","width","height"]):v=Oe(v,["fill","stroke"]),N(R,_,v)},"bpmn:Task":function(R,_,v={}){return v=Oe(v,["fill","stroke"]),Ee(R,_,v)},"bpmn:TextAnnotation":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var{width:M,height:O}=xo(_,v),z=g(R,M,O,0,0,{fill:"none",stroke:"none"}),J=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:M,containerHeight:O,position:{mx:0,my:0}});x(R,J,{stroke:K(_,c,v.stroke)});var ge=U(_),Ie=ge.get("text")||"";return te(R,Ie,{align:"left-top",box:xo(_,v),padding:kr,style:{fill:bo(_,u,c,v.stroke)}}),z},"bpmn:Transaction":function(R,_,v={}){Pe(_)?v=Oe(v,["fill","stroke","width","height"]):v=Oe(v,["fill","stroke"]);var M=N(R,_,{strokeWidth:1.5,...v}),O=n.style(["no-fill","no-events"],{stroke:K(_,c,v.stroke),strokeWidth:1.5}),z=Pe(_);return z||(v={}),g(R,fn(_,v),Qt(_,v),Fa-ja,ja,O),M},"bpmn:UserTask":function(R,_,v={}){v=Oe(v,["fill","stroke"]);var M=Ee(R,_,v),O=15,z=12,J=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:O,y:z}});x(R,J,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:.5});var ge=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:O,y:z}});x(R,ge,{fill:Ce(_,s,v.fill),stroke:K(_,c,v.stroke),strokeWidth:.5});var Ie=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:O,y:z}});return x(R,Ie,{fill:K(_,c,v.stroke),stroke:K(_,c,v.stroke),strokeWidth:.5}),M},label:function(R,_,v={}){return Je(R,_,v)}};this._drawPath=x,this._renderer=A}X(or,Yn),or.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],or.prototype.canRender=function(e){return y(e,"bpmn:BaseElement")},or.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},or.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},or.prototype.getShapePath=function(e){return xe(e)?vu(e,Dw):y(e,"bpmn:Event")?Wd(e):y(e,"bpmn:Activity")?vu(e,Fa):y(e,"bpmn:Gateway")?Pw(e):Aw(e)};function Oe(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var Lw=0,Bw={width:150,height:50};function Nw(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function $w(e){return bt(e)?k({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var yu=null;function jw(){return yu||(yu=document.createElement("canvas").getContext("2d")),yu}function Fw(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(Ud(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Ud(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function Hw(e,t){var n=jw();if(!n)return{width:0,height:0};n.font=Fw(t),"letterSpacing"in n&&(n.letterSpacing=Ud(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 zw(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=Hw(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return Vw(e,r,i,o);r=Ww(r,o.width,t)}}function Vw(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 qd="";function Gw(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===qd)&&r.pop();break}var a=r[r.length-1];return a&&a===qd&&(r[r.length-1]="-"),r.join("")}function Ww(e,t,n){var i=Math.max(e.length*(n/t),1),r=Gw(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ha(e){this._config=k({},{size:Bw,padding:Lw,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=k({},this._config.size,t.box),i=k({},this._config.style,t.style),r=Nw(t.align||this._config.align),o=$w(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=Uw(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(zw(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Kt(u,function(g,w,E){return g+(s||w.height)},0)+o.top+o.bottom,f=Kt(u,function(g,w,E){return w.width>g?w.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var h=oe("text");Z(h,i),P(u,function(g){var w;switch(d+=s||g.height,r.horizontal){case"left":w=o.left;break;case"right":w=(a?f:l)-o.right-g.width;break;default:w=Math.max(((a?f:l)-g.width)/2+o.left,0)}var E=oe("tspan");Z(E,{x:w,y:d}),E.textContent=g.text,ye(h,E)});var m={width:f,height:p};return{dimensions:m,element:h}};function Uw(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var qw=12,Yw=1.2,Kw=40;function Yd(e){var t=k({fontFamily:"Arial, sans-serif",fontSize:qw,fontWeight:"normal",lineHeight:Yw},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=k({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ha({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,rr.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:kr});return{x:a.x,y:a.y,width:a.width,height:Math.max(Kw,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,k({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Yd.$inject=["config.textRenderer"];function Xw(){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=e1(i.d,{mx:r,my:o,e:a});return p}}var Zw=/\{([^{}]+)\}/g,Qw=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function Jw(e,t,n){var i=n;return t.replace(Qw,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 e1(e,t){return String(e).replace(Zw,function(n,i){return Jw(n,i,t)})}const t1={__init__:["bpmnRenderer"],bpmnRenderer:["type",or],textRenderer:["type",Yd],pathMap:["type",Xw]};function n1(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Eo={translate:["value",n1]};function za(e,t,n){return k({id:e.id,type:e.$type,businessObject:e,di:t},n)}function i1(e,t,n){var i=e.waypoint;return!i||i.length<2?[fe(t),fe(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Kd(e,t,n){return new Error(`element ${Bt(t)} referenced by ${Bt(e)}#${n} not yet drawn`)}function Qn(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Qn.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Qn.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(za(e,t,a)),this._canvas.addRootElement(i)}else if(y(t,"bpmndi:BPMNShape")){var s=!Pe(e,t),c=o1(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(za(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")&&(r1(n,fe(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(za(e,t,{hidden:r,source:l,target:p,waypoints:i1(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)&&un(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Qn.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 Kd(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Qn.prototype.addLabel=function(e,t,n){var i,r,o;return i=bw(t,n),r=un(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(za(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!un(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)},Qn.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?Kd(e,i,t+"Ref"):new Error(`${Bt(e)}#${t} Ref not specified`)},Qn.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Qn.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Qn.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function r1(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 o1(e){return y(e,"bpmn:Group")}const Xd={__depends__:[t1,{__depends__:[Eo],bpmnImporter:["type",Qn]}]};function wo(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Rn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function _u(e){return Math.log(e)/Math.log(10)}var a1=1e3;function W(e){this._eventBus=e}W.$inject=["eventBus"];function s1(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}W.prototype.on=function(e,t,n,i,r,o){if((xt(t)||me(t))&&(o=r,r=i,i=n,n=t,t=null),xt(n)&&(o=r,r=i,i=n,n=a1),bt(r)&&(o=r,r=!1),!xt(i))throw new Error("handlerFn must be a function");pe(e)||(e=[e]);var a=this._eventBus;P(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?s1(i,o):i,o)})},W.prototype.canExecute=Jn("canExecute"),W.prototype.preExecute=Jn("preExecute"),W.prototype.preExecuted=Jn("preExecuted"),W.prototype.execute=Jn("execute"),W.prototype.executed=Jn("executed"),W.prototype.postExecute=Jn("postExecute"),W.prototype.postExecuted=Jn("postExecuted"),W.prototype.revert=Jn("revert"),W.prototype.reverted=Jn("reverted");function Jn(e){return function(n,i,r,o,a){(xt(n)||me(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var bu=["top","bottom","left","right"],Va=10;function xu(e,t){W.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($a(r)&&!je(r)){var o=l1(r);o&&i(r,o)}}function i(r,o){var a=fe(r),s=r.label,c=fe(s);if(s.parent){var u=ue(r),l;switch(o){case"top":l={x:a.x,y:u.top-Va-s.height/2};break;case"left":l={x:u.left-Va-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Va+s.height/2};break;case"right":l={x:u.right+Va+s.width/2,y:a.y};break}var p=Rn(l,c);t.moveShape(s,p)}}}X(xu,W),xu.$inject=["eventBus","modeling"];function c1(e){var t=e.host,n=fe(e),i=Rt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=bu.filter(function(a){return r.indexOf(a)===-1});return o}function u1(e){var t=fe(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 Zd(t,i)});return n}function l1(e){var t=fe(e.label),n=fe(e),i=Zd(n,t);if(p1(i)){var r=u1(e);if(e.host){var o=c1(e);r=r.concat(o)}var a=bu.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Rt(e.label,e)!=="intersect"?void 0:i:a[0]}}function Zd(e,t){return Rt(t,e,5)}function p1(e){return bu.indexOf(e)!==-1}function Eu(e){W.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(Eu,W),Eu.$inject=["eventBus"];var f1=1500;function wu(e,t,n){e.invoke(W,this),this.preExecute("elements.delete",f1,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=Re(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 P(o,u=>{const l=new Set(_r(Cr(Array.from(s),at(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}X(wu,W),wu.$inject=["injector","eventBus","canvas"];function Su(e,t){e.invoke(W,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Re(r.incoming.concat(r.outgoing),function(a){return y(a,"bpmn:Association")});P(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}X(Su,W),Su.$inject=["injector","modeling"];function Or(e,t){for(qt(t)&&(t=[t]);e=e.parent;)if(Se(e,t))return e;return null}function Qd(e,t){var n=Or(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Or(e,i),n)return Et(n);if(Se(e,i))return Et(e);var r;for(r=U(e);r&&!y(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=U(a);return s&&s.get("processRef")===r});return o?Et(o):!0}var Jd=500;function Ga(e,t){t.invoke(W,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Jd,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return eh(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",Jd,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];eh(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Ga.$inject=["bpmnReplace","injector"],X(Ga,W),Ga.prototype._replaceShape=function(e,t){var n=d1(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function d1(e){var t=U(e),n=t.eventDefinitions;return n&&n[0]}function eh(e,t){return!xe(e)&&Se(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Ru(e,t){W.call(this,e);function n(i){return Re(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")&&P(o.outgoing,function(a){var s=a.target,c=n(s);y(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Ru.$inject=["eventBus","modeling"],X(Ru,W);function th(e){return e.create("bpmn:Category")}function h1(e){return e.create("bpmn:CategoryValue")}function nh(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=h1(e)),n.$parent||(n.$parent=th(e)),n}function m1(e,t,n){return it(t.get("categoryValue"),e),e.$parent=t,it(n.get("rootElements"),t),t.$parent=n,e}function g1(e){var t=e.$parent;return t&&(et(t.get("categoryValue"),e),e.$parent=null),e}function v1(e){var t=e.$parent;return t&&(et(t.get("rootElements"),e),e.$parent=null),e}var y1=500;function Cu(e,t,n){n.invoke(W,this);function i(c){return t.filter(function(u){return y(u,"bpmn:Group")&&!u.labelTarget}).map(U).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&&m1(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&v1(u),c&&!r(c,l)&&g1(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,U(u))},!0),this.executed(["shape.move","shape.resize"],y1,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,U(u))},!0),this.executed("group.updateRefs",function(c){ih(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){ih(c).forEach(function(u){s(u.categoryValue,u.category,U(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,U(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!y(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Cu.$inject=["bpmnjs","elementRegistry","injector"],X(Cu,W);function ih(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Pu(e,t,n){W.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 w=g.source,E=g.target;Ir(w)&&So(E)&&l(E)}function r(g){const w=g.connection,E=g.source,b=g.target;Ir(E)&&Wa(b)&&(u(b),f(E,[w]))}function o(g){const w=g.newTarget,E=g.oldSource,b=g.oldTarget;if(b!==w){const x=E;So(b)&&l(b),Ir(x)&&Wa(w)&&u(w)}}function a(g){const{element:w}=g;So(w)?(p(w),d(w)):Wa(w)&&h(w)}function s(g){const{newData:w,oldShape:E}=g;if(Ir(g.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>So(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!Ir(g.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>Wa(x));b&&b.target&&(g._connectionTarget=b.target),m(E)}}function c(g){const{_connectionTarget:w,newShape:E}=g;w&&t.connect(E,w)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function p(g){for(const w of g.incoming)n.canConnect(w.source,g)||t.removeConnection(w);for(const w of g.outgoing)n.canConnect(g,w.target)||t.removeConnection(w)}function f(g,w){g.outgoing.filter(x=>y(x,"bpmn:Association")).filter(x=>So(x.target)&&!w.includes(x)).forEach(x=>t.removeConnection(x))}function d(g){const w=g.attachers.slice();w.length&&t.removeElements(w)}function h(g){const w=g.incoming.filter(E=>Ir(E.source));t.removeElements(w)}function m(g){const w=g.outgoing.filter(E=>y(E,"bpmn:SequenceFlow"));t.removeElements(w)}}X(Pu,W),Pu.$inject=["eventBus","modeling","bpmnRules"];function So(e){const t=U(e);return t&&t.get("isForCompensation")}function Ir(e){return e&&y(e,"bpmn:BoundaryEvent")&&Mr(e,"bpmn:CompensateEventDefinition")}function Wa(e){return e&&y(e,"bpmn:Activity")&&!Nt(e)}function Au(e){e.invoke(W,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=Or(i,"bpmn:Participant"))})}Au.$inject=["injector"],X(Au,W);function Tu(e,t){W.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}})}Tu.$inject=["eventBus","bpmnFactory"],X(Tu,W);var Mu=20,ku=20,rh=30,Ua=2e3;function Du(e,t,n){W.call(this,t),t.on(["create.start","shape.move.start"],Ua,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")&&!xe(p)&&!je(p)});if(c.length){var u=at(c),l=_1(a,u);k(a,l),o.createConstraints=b1(a,u)}}}),t.on("create.start",Ua,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",Ua,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",Ua,function(r){var o=r.elements,a=r.parent,s=x1(o),c;s&&y(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=U(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=U(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)&&U(s).set("processRef",U(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)&&U(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)}Du.$inject=["canvas","eventBus","modeling"],X(Du,W);function _1(e,t){t={width:t.width+Mu*2+rh,height:t.height+ku*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 b1(e,t){return t=ue(t),{bottom:t.top+e.height/2-ku,left:t.right-e.width/2+Mu,top:t.bottom-e.height/2+ku,right:t.left+e.width/2-Mu-rh}}function x1(e){return ze(e,function(t){return y(t,"bpmn:Participant")})}var oh="__targetRef_placeholder";function Ou(e,t){W.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],ah(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],ah(o));function n(a,s,c){var u=a.get("dataInputAssociations");return ze(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=ze(c,function(l){return l.name===oh});return!u&&s&&(u=t.create("bpmn:Property",{name:oh}),it(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||et(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,w;m&&m!==p&&r(m,u),d&&d!==p&&r(d,u),p?(w=i(p,!0),g.targetRef=w):g.targetRef=null}}Ou.$inject=["eventBus","bpmnFactory"],X(Ou,W);function ah(e){return function(t){var n=t.context,i=n.connection;if(y(i,"bpmn:DataInputAssociation"))return e(t)}}function qa(e){this._bpmnUpdater=e}qa.$inject=["bpmnUpdater"],qa.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),[]},qa.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){W.call(this,i),t.registerHandler("dataStore.updateContainment",qa);function r(){return n.filter(function(s){return y(s,"bpmn:Participant")&&U(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:De(s),newSemanticParent:l.processRef||l,newDiParent:De(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:w1(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Se(u,["bpmn:Participant","bpmn:SubProcess"])&&y(l,"bpmn:Collaboration")&&o(l).filter(function(p){return E1(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,W);function E1(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 w1(e,t){for(;e.parent;){if(y(e.parent,t))return e.parent;e=e.parent}}var Ya=Math.max,Ka=Math.min,S1=20;function sh(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function R1(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 C1(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 Xa(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return me(r)&&(i=(/top|left/.test(e)?Ka:Ya)(i,r)),me(o)&&(i=(/top|left/.test(e)?Ya:Ka)(i,o)),i}function P1(e,t){if(!t)return e;var n=ue(e);return Da({top:Xa("top",n,t),right:Xa("right",n,t),bottom:Xa("bottom",n,t),left:Xa("left",n,t)})}function A1(e,t,n,i){var r=ue(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?ue(i):o,s={top:Ka(o.top,a.top),left:Ka(o.left,a.left),bottom:Ya(o.bottom,a.bottom),right:Ya(o.right,a.right)};return Da(s)}function Ro(e,t){return typeof e<"u"?e:S1}function T1(e,t){var n,i,r,o;return typeof t=="object"?(n=Ro(t.left),i=Ro(t.right),r=Ro(t.top),o=Ro(t.bottom)):n=i=r=o=Ro(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function M1(e){return!(e.waypoints||e.type==="label")}function ch(e,t){var n;if(e.length===void 0?n=Re(e.children,M1):n=e,n.length)return T1(at(n),t)}var Ci=Math.abs;function k1(e,t){return sh(ue(t),ue(e))}var D1=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],dn=30;function Za(e,t){return t=t||[],e.children.filter(function(n){y(n,"bpmn:Lane")&&(Za(n,t),t.push(n))}),t}function Pi(e){return e.children.filter(function(t){return y(t,"bpmn:Lane")})}function hn(e){return Or(e,D1)||e}function O1(e,t){var n=hn(e),i=y(n,"bpmn:Process")?[]:[n],r=Za(n,i),o=ue(e),a=ue(t),s=k1(e,t),c=[],u=Et(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=ue(l);s.top&&(Ci(m.bottom-o.top)<10&&(d=a.top-m.bottom),Ci(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(Ci(m.right-o.left)<10&&(f=a.left-m.right),Ci(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(Ci(m.top-o.bottom)<10&&(p=a.bottom-m.top),Ci(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(Ci(m.left-o.right)<10&&(h=a.right-m.left),Ci(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:C1(l,{top:p,right:f,bottom:d,left:h})})}}),c}var I1=500;function Lu(e,t){W.call(this,e);function n(i,r){var o=Et(i),a=Pi(r),s=[],c=[],u=[],l=[];if(nr(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",I1,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))})}Lu.$inject=["eventBus","spaceTool"],X(Lu,W);var uh=500;function Qa(e,t){t.invoke(W,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",uh,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return lh(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",uh,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;lh(a,B1(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Qa.$inject=["bpmnReplace","injector"],X(Qa,W),Qa.prototype._replaceShape=function(e){var t=L1(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function L1(e){var t=U(e),n=t.eventDefinitions;return n&&n[0]}function lh(e,t){return!xe(e)&&y(e,"bpmn:BoundaryEvent")&&!t}function B1(e,t){return e.indexOf(t)!==-1}var Ja=Math.round,N1=Math.max;function $1(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 j1(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var ph=10;function F1(e,t){var n,i;for(n=0;i=e[n];n++)if(mo(i,t)<=ph)return{point:e[n],bendpoint:!0,index:n};return null}function H1(e,t){var n=gd($1(t,ph),j1(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=N1(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ja(i.x+r.x)/2,y:Ja(i.y+r.y)/2},index:i.segment2}:{point:{x:Ja(i.x),y:Ja(i.y)},index:i.segment2}:null}function Bu(e,t){return F1(e,t)||H1(e,t)}function Nu(e,t,n){W.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(),w;me(a.width)?w=fe(a):w=a;var E=Bu(s,w);if(E){if(c=s.slice(0,E.index),u=s.slice(E.index+(E.bendpoint?1:0)),!c.length||!u.length)return;l=E.bendpoint?s[E.index]:w,(c.length===1||!fh(r,c[c.length-1]))&&c.push(dh(l)),(u.length===1||!fh(r,u[0]))&&u.unshift(dh(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||w),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||w),h=o));var b=[].concat(d&&Re(g,function(x){return x.source===d.source})||[],h&&Re(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=fe(c),l={x:u.x+s.x,y:u.y+s.y},p=ze(o.children,function(f){var d=t.canInsert(a,f);return d&&Bu(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(Nu,W),Nu.$inject=["eventBus","bpmnRules","modeling"];function fh(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 dh(e){return k({},e)}function $u(e,t){W.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)&&Lr(r)){var c=[];y(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&Lr(u)):c=a.incoming.filter(u=>u!==r&&Lr(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(Lr).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Lr).forEach(function(s){const c=a.incoming.filter(Lr).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}$u.$inject=["eventBus","modeling"],X($u,W);function Lr(e){return y(e,"bpmn:SequenceFlow")}var es=1500,hh=2e3;function mh(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"],es,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;y(a,"bpmn:Lane")&&!Se(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=hn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Se(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"],es,function(i){var r=i.hover;y(r,"bpmn:Lane")&&(i.hover=hn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],es,function(i){var r=i.context,o=i.hover,a=r.type;y(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=hn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],es,function(i){var r=i.context,o=r.start;y(o,"bpmn:Lane")&&(r.start=hn(o)||o)}),t.on("shape.move.start",hh,function(i){var r=i.shape;y(r,"bpmn:Lane")&&(i.shape=hn(r)||r)}),t.on("spaceTool.move",hh,function(i){var r=i.hover;r&&y(r,"bpmn:Lane")&&(i.hover=hn(r))})}mh.$inject=["elementRegistry","eventBus","canvas"];var gh=770;function ju(e,t,n,i){n.invoke(W,this);function r(s,c){var u=U(s),l=c.categoryValue||u.categoryValueRef;l||(l=nh(e,u));var p=c.category||l.$parent||th(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=U(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=U(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=U(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&&!U(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&&!U(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||U(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",gh,function(s){var c=s.descriptor,u=s.element;if(!(!y(u,"bpmn:Group")||u.labelTarget)){var l=U(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",gh,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})}ju.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],X(ju,W);function Fu(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 vh(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Fu(i,r,o,a),u=Fu(i,r,o,s),l;c&&u?yh(c,o)>yh(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],fe(i.source)),t(r[r.length-1],r[r.length-2],fe(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}vh.$inject=["eventBus"];function yh(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Hu(e){W.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=U(i),o=De(i);if(Se(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Hu.$inject=["eventBus"],X(Hu,W);function _h(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function bh(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function z1(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 V1(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 zu(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=V1([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 xh(e,t){var n=zu(e,t),i={x:n.x-e.x,y:n.y-e.y};return _h(i)}function Co(e,t){return _h({x:e.x-t.x,y:e.y-t.y})}var Eh=Math.sqrt,wh=Math.min,G1=Math.max,Sh=Math.abs;function Rh(e){return Math.pow(e,2)}function Po(e,t){return Eh(Rh(e.x-t.x)+Rh(e.y-t.y))}function W1(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],Ph(i,r)?u=[i]:(o=Po(e,i),a=Po(e,r),c=wh(o,a),u=U1(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:Ph(i,u[0])?n:n+1}),u.length===2&&(s=Y1(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:Po(i,s)/Po(i,r)}),p=Po(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function U1(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=Eh(d),m=-p+h,g=-p-h,w={x:e.x-r*m,y:e.y-o*m};if(d===0)return[w];var E={x:e.x-r*g,y:e.y-o*g};return[w,E].filter(function(b){return q1(b,e,t)})}function q1(e,t,n){return Ch(e.x,t.x,n.x)&&Ch(e.y,t.y,n.y)}function Ch(e,t,n){return e>=wh(t,n)-ts&&e<=G1(t,n)+ts}function Y1(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var ts=.1;function Ph(e,t){return Sh(e.x-t.x)<=ts&&Sh(e.y-t.y)<=ts}function K1(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=Th(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 Ah(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=W1(e,n),c=s.segmentIndex,u=K1(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Mh(n,c),p=Mh(t,u),f=s.position,d=Z1(l,f),h=X1(l,p);if(s.type==="bendpoint"){var m=t.length-n.length,g=s.bendpointIndex,w=n[g];if(t.indexOf(w)!==-1)return a;if(m===0){var E=t[g];return r=E.x-s.position.x,o=E.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=Th(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=z1({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:Xn(b),delta:Xn({x:r,y:o})}}function Th(e,t){var n=Co(e[t-1],e[t]),i=Co(e[t],e[t+1]),r=n/(n+i);return r}function X1(e,t){var n=bh(e),i=bh(t);return i-n}function Mh(e,t){return[e[t],e[t+1]]}function Z1(e,t){var n=Co(e[0],e[1]),i=Co(e[0],t);return n===0?0:i/n}function Q1(e,t,n,i){var r=fe(e);return Ah(r,t,n,i).delta}function Ao(e,t,n){var i=wo(t),r=wo(n),o=Rn(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Xn({x:r.x+a.x,y:r.y+a.y})}function kh(e,t,n){var i=wo(e),r=wo(t),o=wo(n),a=Rn(e,i),s=Rn(i,r),c=J1(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 Xn({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function J1(e,t,n){var i=ue(t),r=ue(n);if(eS(i,r))return null;var o=Rt(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=Rt(n,s),c!==o?null:a}function eS(e,t){return tS(e,t)||nS(e,t)}function tS(e,t){return e.right!==t.right&&e.left!==t.left}function nS(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Dh="name",Oh="text";function Vu(e,t,n,i){W.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{U(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(Dh in u&&t.updateLabel(c,u[Dh]),Oh in u&&y(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Oh]||"");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;xe(u)||!Ri(u)||un(u)&&t.updateLabel(u,un(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=k({},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),Q1(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=U(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(!(!xe(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(un(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($a(c)){var p=c.label,f=fe(p),d=oS(l),h=rS(f,d),m=iS(h,l,u);t.moveShape(p,m)}})}X(Vu,W),Vu.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function iS(e,t,n){var i=Ao(e,t,n);return Xn(Rn(i,e))}function rS(e,t){if(t.length){var n=aS(e,t);return zu(e,n)}}function oS(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 aS(e,t){var n=t.map(function(r){return{line:r,distance:xh(e,r)}}),i=Pn(n,"distance");return i[0].line}function sS(e,t,n,i){return Ah(e,t,n,i).point}function Gu(e,t){W.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=k({},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),sS(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(Gu,W),Gu.$inject=["eventBus","modeling"];function ns(e,t,n){var i=rs(e),r=Lh(i,t),o=i[0];return r.length?r[r.length-1]:Ao(o.original||o,n,t)}function is(e,t,n){var i=rs(e),r=Lh(i,t),o=i[i.length-1];return r.length?r[0]:Ao(o.original||o,n,t)}function Wu(e,t,n){var i=rs(e),r=Ih(t,n),o=i[0];return Ao(o.original||o,r,t)}function Uu(e,t,n){var i=rs(e),r=Ih(t,n),o=i[i.length-1];return Ao(o.original||o,r,t)}function Ih(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function rs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Lh(e,t){var n=Dt(e,uS);return Re(n,function(i){return cS(i,t)})}function cS(e,t){return Rt(t,e,1)==="intersect"}function uS(e){return e.original||e}function qu(e,t){W.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(lS(i,r)){var o=pS(i);o.incoming.forEach(function(a){var s=is(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=ns(a,r,i);t.reconnectStart(a,r,s)})}},!0)}qu.$inject=["eventBus","modeling"],X(qu,W);function lS(e,t){return y(e,"bpmn:Participant")&&Pe(e)&&y(t,"bpmn:Participant")&&!Pe(t)}function pS(e){var t=fo([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 fS=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Bh(e){const t=U(e);if(!y(t,"bpmn:BoundaryEvent")&&!(y(t,"bpmn:StartEvent")&&Nt(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:fS.some(i=>y(n[0],i))}function Nh(e){return y(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Yu(e,t){e.invoke(W,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Bh(r))return;const a=Nh(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=U(i).get(a),u=U(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}Yu.$inject=["injector","modeling"],X(Yu,W);function Ku(e,t){W.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=De(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}X(Ku,W),Ku.$inject=["eventBus","modeling"];function Xu(e,t,n){W.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=dS(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}X(Xu,W),Xu.$inject=["eventBus","bpmnRules","modeling"];function Br(e){return e.original||e}function dS(e,t){var n=Fu(Br(e[e.length-2]),Br(e[e.length-1]),Br(t[1]),Br(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Br(e[0]),Br(t[t.length-1])]}function Zu(e,t){W.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)}Zu.$inject=["eventBus","modeling"],X(Zu,W);function Qu(e,t,n,i){W.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;P(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=ze(p.outgoing,xr({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(Qu,W),Qu.$inject=["eventBus","modeling","bpmnRules","injector"];function os(e,t,n,i,r,o){i.invoke(W,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=[];P(s.closure.topLevel,function(f){Nt(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(os,W),os.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;P(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)},os.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var hS=1500,mS={width:140,height:120},Ju={width:300,height:60},el={width:60,height:300},as={width:300,height:150},ss={width:150,height:300},$h={width:140,height:120},jh={width:100,height:40};function Fh(e){e.on("resize.start",hS,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=bS(i,r,o)),y(i,"bpmn:SubProcess")&&Pe(i)&&(n.minDimensions=$h),y(i,"bpmn:TextAnnotation")&&(n.minDimensions=jh)})}Fh.$inject=["eventBus"];var Ai=Math.abs,gS=Math.min,vS=Math.max;function Hh(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Nr(e,t,n){return Hh(e,t,n,gS)}function $r(e,t,n){return Hh(e,t,n,vS)}var yS={top:20,left:50,right:20,bottom:20},_S={top:50,left:20,right:20,bottom:20};function bS(e,t,n){var i=hn(e),r=!0,o=!0,a=Za(i,[i]),s=ue(e),c={},u={},l=Et(e),p=l?Ju:el;/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=ue(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&&Ai(s.top-m.bottom)<10&&$r(c,"top",m.top+p.height),Ai(s.top-m.top)<5&&Nr(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&Ai(s.right-m.left)<10&&Nr(c,"right",m.right-p.width),Ai(s.right-m.right)<5&&$r(u,"right",m.left+p.width)),/s/.test(t)&&(n&&Ai(s.bottom-m.top)<10&&Nr(c,"bottom",m.bottom-p.height),Ai(s.bottom-m.bottom)<5&&$r(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&Ai(s.left-m.right)<10&&$r(c,"left",m.left+p.width),Ai(s.left-m.left)<5&&Nr(u,"left",m.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?yS:_S;return f.forEach(function(h){var m=ue(h);/n/.test(t)&&(!l||r)&&Nr(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&$r(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&$r(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&Nr(u,"left",m.left-d.left)}),{min:u,max:c}}function zh(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function jr(e){return e.originalEvent||e.srcEvent}function tl(e){zh(e),zh(jr(e))}function ar(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 Vh(){return/mac/i.test(navigator.platform)}function Gh(e,t){return(jr(e)||e).button===t}function Ti(e){return Gh(e,0)}function xS(e){return Gh(e,1)}function To(e){var t=jr(e)||e;return Ti(e)?Vh()?t.metaKey:t.ctrlKey:!1}function cs(e){var t=jr(e)||e;return Ti(e)&&t.shiftKey}var Wh=1001;function Uh(e,t){e.on("resize.start",Wh+500,function(n){var i=n.context,r=i.shape;(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))&&(i.balanced=!To(n))}),e.on("resize.end",Wh,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=xd(a),t.resizeLane(r,a,i.balanced)),!1})}Uh.$inject=["eventBus","modeling"];var ES=500;function nl(e,t,n,i,r){n.invoke(W,this);function o(l){return Se(l,["bpmn:ReceiveTask","bpmn:SendTask"])||wS(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!ze(f,xr({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(Se(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(Se(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=U(p),d=c(f),h;d&&!a(d)&&(h=e.getDefinitions().get("rootElements"),it(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");et(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=U(f),h=c(d);h&&(p.referencedRootElement=h)}}),t.on("copyPaste.pasteElement",ES,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)})}nl.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],X(nl,W);function wS(e,t){return pe(t)||(t=[t]),di(t,function(n){return Mr(e,n)})}var qh=Math.max;function Yh(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return P(n,function(a){var s=a.id;y(a,"bpmn:Participant")&&(o[s]=RS(a,i,r)),y(a,"bpmn:Lane")&&(o[s]=Et(a)?Ju:el),y(a,"bpmn:SubProcess")&&Pe(a)&&(o[s]=$h),y(a,"bpmn:TextAnnotation")&&(o[s]=jh),y(a,"bpmn:Group")&&(o[s]=mS)}),o})}Yh.$inject=["eventBus"];function SS(e){return e==="x"}function RS(e,t,n){var i=Et(e);if(!AS(e))return i?as:ss;var r=SS(t),o={};return r?i?o=as:o={width:PS(e,n,r),height:ss.height}:i?o={width:as.width,height:CS(e,n,r)}:o=ss,o}function CS(e,t,n){var i;return i=TS(e,t,n),qh(as.height,i)}function PS(e,t,n){var i;return i=MS(e,t,n),qh(ss.width,i)}function AS(e){return!!Pi(e).length}function TS(e,t,n){var i=Pi(e),r;return r=il(i,t,n),e.height-r.height+Ju.height}function MS(e,t,n){var i=Pi(e),r;return r=il(i,t,n),e.width-r.width+el.width}function il(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=Pi(r),o.length?il(o,t,n):r}var Kh="_plane";function Xh(e){var t=e.id;return kS(t)}function $n(e){var t=e.id;return y(e,"bpmn:SubProcess")?Zh(t):t}function sr(e){return Zh(e)}function us(e){var t=De(e);return y(t,"bpmndi:BPMNPlane")}function Zh(e){return e+Kh}function kS(e){return e.replace(new RegExp(Kh+"$"),"")}var Qh=400,DS=600,Jh={x:180,y:160};function ei(e,t,n,i,r,o,a){W.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")&&!Pe(p)}function u(p){var f=p.shape,d=p.newRootElement,h=U(f);d=s._addDiagram(d||h),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=U(f);s._removeDiagram(d);var h=p.newRootElement=a.get($n(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;P(f,function(d){if(c(d)){var h=a.get($n(d));if(!(!h||!d.children||!d.children.length)){var m=em(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;!y(f,"bpmn:SubProcess")||!Pe(f)||P(_o([f]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(p){var f=p.shape;if(c(f)){var d=a.get($n(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($n(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot($n(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(y(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(us(f)){a.updateId(f,sr(g)),a.updateId(m,g);return}var w=a.get(sr(m));w&&a.updateId(sr(m),sr(g))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(y(f,"bpmn:SubProcess")){var d=p.properties,h=p.oldProperties,m=h.id,g=d.id;if(m!==g){if(us(f)){a.updateId(f,sr(m)),a.updateId(g,m);return}var w=a.get(sr(g));w&&a.updateId(w,sr(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(us(f)){var d=f,h=a.get(Xh(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",Qh,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Pe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Qh,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Pe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",DS,function(p){var f=p.shape;if(y(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Pe(f))s._moveChildrenToShape(d.children.slice(),f),P(_o(f.children),m=>{n.moveShape(m.annotation,{x:0,y:0},f.parent),P(m.associations,g=>{n.moveConnection(g,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=em(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=$n(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=y(De(m),"bpmndi:BPMNPlane");if(g){var w=Xh(m),E=ze(h,function(b){return b.id===w});E&&(f.parent=E.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}X(ei,W),ei.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:Jh.x-r.x,y:Jh.y-r.y};else{var a=fe(t),s=fe(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},ei.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Gd(e).map(i=>i.annotation));n.size&&P(_o(e.children),i=>{n.has(i.annotation)&&P(i.associations,r=>{t.removeConnection(r)})})},ei.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},ei.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},ei.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:$n(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},ei.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=ze(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},ei.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function OS(e){var t=[];return P(_o(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function em(e){return e.children.slice().concat(OS(e.children)).concat(IS(e))}function IS(e){return cu(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function rl(e,t){e.invoke(W,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"))||!Pe(r))){var o=LS(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}rl.$inject=["injector","modeling"],X(rl,W);function LS(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function ol(e,t){W.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,un(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(ol,W),ol.$inject=["eventBus","textRenderer"];function al(e,t){W.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Pe(i))return;var r=fo(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();P(s,function(u){o(u,!0)}),P(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,fe(i)):t.reconnectStart(a,i,fe(i)))}},!0)}X(al,W),al.$inject=["eventBus","modeling"];var sl=500;function cl(e,t,n){W.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=BS(c).concat([a]),p=ch(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"],sl,function(a){var s=a.context,c=s.shape;y(c,"bpmn:SubProcess")&&(c.collapsed?De(c).isExpanded=!1:(i(c.children),De(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],sl,function(a){var s=a.context,c=s.shape;c.collapsed?De(c).isExpanded=!1:De(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],sl,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(cl,W),cl.$inject=["eventBus","elementFactory","modeling"];function BS(e){return e.filter(function(t){return!t.hidden})}function ul(e,t,n,i){t.invoke(W,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;xe(a)||(y(a,"bpmn:Participant")&&Pe(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(ul,W),ul.$inject=["canvas","injector","moddle","modeling"];function ll(e,t){W.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;NS(r,o)&&t.updateProperties(o,{default:null})})}X(ll,W),ll.$inject=["eventBus","modeling"];function NS(e,t){if(!y(e,"bpmn:SequenceFlow"))return!1;var n=U(t),i=U(e);return n.get("default")===i}var $S=500,jS=5e3,tm=["shape.create","shape.delete","shape.move","shape.resize"],nm=[...tm,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function pl(e,t){W.call(this,e);var n;function i(){return n=n||new FS,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(nm,jS,function(){i()}),this.postExecuted(nm,$S,function(){o()}),this.preExecute(tm,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))})}pl.$inject=["eventBus","modeling"],X(pl,W);function FS(){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 HS=500,zS=5e3,im=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],rm=[...im,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function fl(e,t){W.call(this,e);var n;function i(){return n=n||new VS,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(rm,zS,function(){i()}),this.postExecuted(rm,HS,function(){o()}),this.preExecute(im,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)})}fl.$inject=["eventBus","modeling"],X(fl,W);function VS(){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 dl(e,t){W.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)GS(o)&&!US(o)&&t.updateProperties(o,{isForCompensation:void 0})})}X(dl,W),dl.$inject=["eventBus","modeling"];function GS(e){const t=U(e);return t&&t.isForCompensation}function WS(e){return e&&y(e,"bpmn:BoundaryEvent")&&Mr(e,"bpmn:CompensateEventDefinition")}function US(e){return e.incoming.filter(n=>WS(n.source)).length>0}const qS={__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",xu],appendBehavior:["type",Eu],associationBehavior:["type",Su],attachEventBehavior:["type",Ga],artifactBehavior:["type",wu],boundaryEventBehavior:["type",Ru],categoryRootElementReferenceBehavior:["type",Cu],compensateBoundaryEventBehaviour:["type",Pu],createBehavior:["type",Au],createDataObjectBehavior:["type",Tu],createParticipantBehavior:["type",Du],dataInputAssociationBehavior:["type",Ou],dataStoreBehavior:["type",Iu],deleteLaneBehavior:["type",Lu],detachEventBehavior:["type",Qa],dropOnFlowBehavior:["type",Nu],eventBasedGatewayBehavior:["type",$u],fixHoverBehavior:["type",mh],groupBehavior:["type",ju],importDockingFix:["type",vh],isHorizontalFix:["type",Hu],labelBehavior:["type",Vu],layoutConnectionBehavior:["type",Gu],messageFlowBehavior:["type",qu],nonInterruptingBehavior:["type",Yu],removeElementBehavior:["type",Xu],removeEmbeddedLabelBoundsBehavior:["type",Ku],removeParticipantBehavior:["type",Zu],replaceConnectionBehavior:["type",Qu],replaceElementBehaviour:["type",os],resizeBehavior:["type",Fh],resizeLaneBehavior:["type",Uh],rootElementReferenceBehavior:["type",nl],spaceToolBehavior:["type",Yh],subProcessPlaneBehavior:["type",ei],subProcessStartEventBehavior:["type",rl],textAnnotationBehavior:["type",ol],toggleCollapseConnectionBehaviour:["type",al],toggleElementCollapseBehaviour:["type",cl],unclaimIdBehavior:["type",ul],unsetDefaultFlowBehavior:["type",ll],updateFlowNodeRefsBehavior:["type",pl],updateCategoryValueRefsBehavior:["type",fl],setCompensationActivityAfterPasteBehavior:["type",dl]};function hl(e){this._commandStack=e.get("commandStack",!1)}hl.$inject=["injector"],hl.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const jn={__init__:["rules"],rules:["type",hl]};function mn(e){W.call(this,e),this.init()}mn.$inject=["eventBus"],X(mn,W),mn.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)})},mn.prototype.init=function(){};function om(e,t){var n=Rt(e,t,-15);return n!=="intersect"?n:null}function Pt(e){mn.call(this,e)}X(Pt,mn),Pt.$inject=["eventBus"],Pt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return YS(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 ps(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return ps(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 ym(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return je(i)&&!fs(t,i)?!1:qi(t,function(r){return je(r)?ps(r.source,r.target,r):r.host?Mo(r,r.host,null,n):yl(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 fm(a)&&!n.includes(a.host)})?!1:Mo(n,t,null,i)||gm(n,t,i)||vm(n,t)||fs(n,t)}),this.addRule("shape.create",function(e){return yl(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Mo(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return wm(n,t)})},Pt.prototype.canConnectMessageFlow=xm,Pt.prototype.canConnectSequenceFlow=Em,Pt.prototype.canConnectDataAssociation=_l,Pt.prototype.canConnectAssociation=_m,Pt.prototype.canConnectCompensationAssociation=bm,Pt.prototype.canMove=vm,Pt.prototype.canAttach=Mo,Pt.prototype.canReplace=gm,Pt.prototype.canDrop=Fr,Pt.prototype.canInsert=fs,Pt.prototype.canCreate=yl,Pt.prototype.canConnect=ps,Pt.prototype.canResize=ym,Pt.prototype.canCopy=wm;function YS(e){return ml(e)?null:Se(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function ml(e){return!e||xe(e)}function am(e){do{if(y(e,"bpmn:Process"))return U(e);if(y(e,"bpmn:Participant"))return U(e).processRef||U(e)}while(e=e.parent)}function gl(e){return y(e,"bpmn:TextAnnotation")}function vl(e){return y(e,"bpmn:Group")&&!e.labelTarget}function sm(e){return y(e,"bpmn:BoundaryEvent")&&Fn(e,"bpmn:CompensateEventDefinition")}function ls(e){return U(e).isForCompensation}function KS(e,t){var n=am(e),i=am(t);return n===i}function XS(e){return y(e,"bpmn:InteractionNode")&&!y(e,"bpmn:BoundaryEvent")&&(!y(e,"bpmn:Event")||y(e,"bpmn:ThrowEvent")&&lm(e,"bpmn:MessageEventDefinition"))}function ZS(e){return y(e,"bpmn:InteractionNode")&&!ls(e)&&(!y(e,"bpmn:Event")||y(e,"bpmn:CatchEvent")&&lm(e,"bpmn:MessageEventDefinition"))&&!(y(e,"bpmn:BoundaryEvent")&&!Fn(e,"bpmn:MessageEventDefinition"))}function cm(e){for(var t=e;t=t.parent;){if(y(t,"bpmn:FlowElementsContainer"))return U(t);if(y(t,"bpmn:Participant"))return U(t).processRef}return null}function um(e,t){var n=cm(e),i=cm(t);return n===i}function Fn(e,t){var n=U(e);return!!ze(n.eventDefinitions||[],function(i){return y(i,t)})}function lm(e,t){var n=U(e);return(n.eventDefinitions||[]).every(function(i){return y(i,t)})}function QS(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:EndEvent")&&!Nt(e)&&!(y(e,"bpmn:IntermediateThrowEvent")&&Fn(e,"bpmn:LinkEventDefinition"))&&!sm(e)&&!ls(e)}function JS(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:StartEvent")&&!y(e,"bpmn:BoundaryEvent")&&!Nt(e)&&!(y(e,"bpmn:IntermediateCatchEvent")&&Fn(e,"bpmn:LinkEventDefinition"))&&!ls(e)}function eR(e){return y(e,"bpmn:ReceiveTask")||y(e,"bpmn:IntermediateCatchEvent")&&(Fn(e,"bpmn:MessageEventDefinition")||Fn(e,"bpmn:TimerEventDefinition")||Fn(e,"bpmn:ConditionalEventDefinition")||Fn(e,"bpmn:SignalEventDefinition"))}function tR(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function pm(e,t){var n=tR(t);return n.indexOf(e)!==-1}function ps(e,t,n){if(ml(e)||ml(t))return null;if(!y(n,"bpmn:DataAssociation")){if(xm(e,t))return{type:"bpmn:MessageFlow"};if(Em(e,t))return{type:"bpmn:SequenceFlow"}}var i=_l(e,t);return i||(bm(e,t)?{type:"bpmn:Association",associationDirection:"One"}:_m(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Fr(e,t){return xe(e)||vl(e)?!0:y(t,"bpmn:Participant")&&!Pe(t)?!1:y(e,"bpmn:Participant")?y(t,"bpmn:Process")||y(t,"bpmn:Collaboration"):Se(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")&&!nR(e)?!1:y(e,"bpmn:FlowElement")&&!y(e,"bpmn:DataStoreReference")?y(t,"bpmn:FlowElementsContainer")?Pe(t):Se(t,["bpmn:Participant","bpmn:Lane"]):y(e,"bpmn:DataStoreReference")&&y(t,"bpmn:Collaboration")?di(U(t).get("participants"),function(n){return!!n.get("processRef")}):Se(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Se(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 nR(e){return U(e).cancelActivity&&(dm(e)||hm(e))}function fm(e){return!xe(e)&&y(e,"bpmn:BoundaryEvent")}function iR(e){return y(e,"bpmn:Lane")}function rR(e){return fm(e)||y(e,"bpmn:IntermediateThrowEvent")&&dm(e)?!0:y(e,"bpmn:IntermediateCatchEvent")&&hm(e)}function dm(e){var t=U(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function hm(e){return mm(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function mm(e,t){return t.some(function(n){return Fn(e,n)})}function oR(e){return y(e,"bpmn:ReceiveTask")&&ze(e.incoming,function(t){return y(t.source,"bpmn:EventBasedGateway")})}function Mo(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return xe(r)||!rR(r)||Nt(t)||!y(t,"bpmn:Activity")||ls(t)||i&&!om(i,t)||oR(t)?!1:"attach"}function gm(e,t,n){if(!t)return!1;var i={replacements:[]};return P(e,function(r){Nt(t)||y(r,"bpmn:StartEvent")&&r.type!=="label"&&Fr(r,t)&&(hw(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(mw(r)||gw(r)||vw(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),mm(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")||Fn(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(y(r,"bpmn:EndEvent")&&Fr(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),y(r,"bpmn:BoundaryEvent")&&Mo(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function vm(e,t){return di(e,iR)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Fr(n,t)})}function yl(e,t,n,i){return t?xe(e)||vl(e)?!0:Fr(e,t)||fs(e,t):!1}function ym(e,t,n){return y(e,"bpmn:SubProcess")?Pe(e)&&(!t||t.width>=100&&t.height>=80):y(e,"bpmn:Lane")||y(e,"bpmn:Participant")?!0:gl(e)?n?n==="e"||n==="w":!0:vl(e)?!0:xe(e)?n?n==="e"||n==="w":!0:!1}function aR(e,t){var n=gl(e),i=gl(t);return(n||i)&&n!==i}function _m(e,t){return pm(t,e)||pm(e,t)?!1:aR(e,t)?!0:!!_l(e,t)}function bm(e,t){return um(e,t)&&sm(e)&&y(t,"bpmn:Activity")&&!cR(t,e)&&!Nt(t)}function xm(e,t){return Rm(e)&&!Rm(t)?!1:XS(e)&&ZS(t)&&!KS(e,t)}function Em(e,t){return QS(e)&&JS(t)&&um(e,t)&&!(y(e,"bpmn:EventBasedGateway")&&!eR(t))}function _l(e,t){return Se(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Se(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Se(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Se(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function fs(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:Se(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!xe(t)&&y(e,"bpmn:FlowNode")&&!y(e,"bpmn:BoundaryEvent")&&Fr(e,t.parent)}function bl(e,t){return e&&t&&e.indexOf(t)!==-1}function wm(e,t){return xe(t)?!0:!(y(t,"bpmn:Lane")&&!bl(e,t.parent)||y(t,"bpmn:MessageFlow")&&!sR(e,t))}function sR(e,t){var n=Sm(t.source),i=Sm(t.target);return bl(e,n)&&bl(e,i)}function Sm(e){for(;e;e=e.parent)if(y(e,"bpmn:Participant"))return e;return null}function Rm(e){return Or(e,"bpmn:Process")||Or(e,"bpmn:Collaboration")}function cR(e,t){return e.attachers.includes(t)}const uR={__depends__:[jn],__init__:["bpmnRules"],bpmnRules:["type",Pt]};var lR=2e3;function Cm(e,t){e.on("saveXML.start",lR,n);function n(){var i=t.getRootElements();P(i,function(r){var o=De(r),a,s;a=fo([r]),a=Re(a,function(c){return c!==r&&!c.labelTarget}),s=Dt(a,De),o.set("planeElement",s)})}}Cm.$inject=["eventBus","canvas"];const pR={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Cm]};function ds(e){W.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)})}ds.prototype.getOrdering=function(e,t){return null},X(ds,W);function xl(e,t){ds.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=ze(n,function(c){return Se(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&&!Se(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=Yp(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}}}xl.$inject=["eventBus","canvas"],X(xl,ds);const fR={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",xl]};function ko(){}ko.prototype.get=function(){return this._data},ko.prototype.set=function(e){this._data=e},ko.prototype.clear=function(){var e=this._data;return delete this._data,e},ko.prototype.isEmpty=function(){return!this._data};const dR={clipboard:["type",ko]};var Pm=1500;function Am(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",Pm,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Pm,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=ar(a),c=document.elementFromPoint(s.x,s.y),hR(c)}}Am.$inject=["elementRegistry","eventBus","injector"];function hR(e){return er(e,"svg, .djs-element",!0)}const mR={__init__:["hoverFix"],hoverFix:["type",Am]};function gR(e){return!0}function hs(e){return Ti(e)||xS(e)}var Tm=500;function Mm(e,t,n){var i=this;function r(C,$,j){if(!s(C,$)){var L,F,te;j?F=t.getGraphics(j):(L=$.delegateTarget||$.target,L&&(F=L,j=t.get(F))),!(!F||!j)&&(te=e.fire(C,{element:j,gfx:F,originalEvent:$}),te===!1&&($.stopPropagation(),$.preventDefault()))}}var o={};function a(C){return o[C]}function s(C,$){var j=u[C]||Ti;return!j($)}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":gR,"element.mousedown":hs,"element.mouseup":hs,"element.click":hs,"element.dblclick":hs};function l(C,$,j){var L=c[C];if(!L)throw new Error("unmapped DOM event name <"+C+">");return r(L,$,j)}var p="svg, .djs-element";function f(C,$,j,L){var F=o[j]=function(te){r(j,te)};L&&(u[j]=L),F.$delegate=Xt.bind(C,p,$,F)}function d(C,$,j){var L=a(j);L&&Xt.unbind(C,$,L.$delegate)}function h(C){P(c,function($,j){f(C,j,$)})}function m(C){P(c,function($,j){d(C,j,$)})}e.on("canvas.destroy",function(C){m(C.svg)}),e.on("canvas.init",function(C){h(C.svg)}),e.on(["shape.added","connection.added"],function(C){var $=C.element,j=C.gfx;e.fire("interactionEvents.createHit",{element:$,gfx:j})}),e.on(["shape.changed","connection.changed"],Tm,function(C){var $=C.element,j=C.gfx;e.fire("interactionEvents.updateHit",{element:$,gfx:j})}),e.on("interactionEvents.createHit",Tm,function(C){var $=C.element,j=C.gfx;i.createDefaultHit($,j)}),e.on("interactionEvents.updateHit",function(C){var $=C.element,j=C.gfx;i.updateDefaultHit($,j)});var g=S("djs-hit djs-hit-stroke"),w=S("djs-hit djs-hit-click-stroke"),E=S("djs-hit djs-hit-all"),b=S("djs-hit djs-hit-no-move"),x={all:E,"click-stroke":w,stroke:g,"no-move":b};function S(C,$){return $=k({stroke:"white",strokeWidth:15},$||{}),n.cls(C,["no-fill","no-border"],$)}function A(C,$){var j=x[$];if(!j)throw new Error("invalid hit type <"+$+">");return Z(C,j),C}function I(C,$){ye(C,$)}this.removeHits=function(C){var $=Ra(".djs-hit",C);P($,gt)},this.createDefaultHit=function(C,$){var j=C.waypoints,L=C.isFrame,F;return j?this.createWaypointsHit($,j):(F=L?"stroke":"all",this.createBoxHit($,F,{width:C.width,height:C.height}))},this.createWaypointsHit=function(C,$){var j=po($);return A(j,"stroke"),I(C,j),j},this.createBoxHit=function(C,$,j){j=k({x:0,y:0},j);var L=oe("rect");return A(L,$),Z(L,j),I(C,L),L},this.updateDefaultHit=function(C,$){var j=$e(".djs-hit",$);if(j)return C.waypoints?su(j,C.waypoints):Z(j,{width:C.width,height:C.height}),j},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Mm.$inject=["eventBus","elementRegistry","styles"];const ms={__init__:["interactionEvents"],interactionEvents:["type",Mm]};function Hr(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)})}Hr.$inject=["eventBus","canvas"],Hr.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()})}},Hr.prototype.get=function(){return Array.from(this._selectedElements)},Hr.prototype.isSelected=function(e){return this._selectedElements.has(e)},Hr.prototype.select=function(e,t){var n=this.get();pe(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?P(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var km="hover",Dm="selected";function Om(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,km)}),t.on("element.out",function(r){i(r.element,km)}),t.on("selection.changed",function(r){function o(u){i(u,Dm)}function a(u){n(u,Dm)}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)})}Om.$inject=["canvas","eventBus"];function Im(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;pe(u)?t.select(u):t.select(s.filter(vR))}}),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=ze(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Ti(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=cs(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Im.$inject=["eventBus","selection","canvas","elementRegistry"];function vR(e){return!e.hidden}const gn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[ms],selection:["type",Hr],selectionVisuals:["type",Om],selectionBehavior:["type",Im]};var yR=/^djs-cursor-.*$/;function gs(e){var t=Ye(document.body);t.removeMatching(yR),e&&t.add("djs-cursor-"+e)}function Lm(){gs(null)}var _R=5e3;function Bm(e,t){t=t||"element.click";function n(){return!1}return e.once(t,_R,n),function(){e.off(t,n)}}var bR=["c","C"],xR=["v","V"],ER=["d","D"],wR=["x","X"],SR=["y","Y"],Nm=["z","Z"];function RR(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Jt(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function vt(e,t){return e=pe(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function El(e){return e.shiftKey}function CR(e){return Jt(e)&&vt(bR,e)}function PR(e){return Jt(e)&&vt(xR,e)}function AR(e){return Jt(e)&&vt(ER,e)}function TR(e){return Jt(e)&&vt(wR,e)}function MR(e){return Jt(e)&&!El(e)&&vt(Nm,e)}function kR(e){return Jt(e)&&(vt(SR,e)||vt(Nm,e)&&El(e))}var zr=Math.round,$m="djs-drag-active";function cr(e){e.preventDefault()}function DR(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function OR(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function jm(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(k({},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,A=o.displacement,I=o.globalStart,C=ar(b),$=Rn(C,I),j=o.localStart,L=a(C),F=Rn(L,j);if(!o.active&&(x||OR($)>o.threshold)){if(k(S,{x:zr(j.x+A.x),y:zr(j.y+A.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&&gs(o.cursor),t.addMarker(t.getRootElement(),$m)}tl(b),o.active&&(k(S,{x:zr(L.x+A.x),y:zr(L.y+A.y),dx:zr(F.x),dy:zr(F.y)},{originalEvent:b}),s("move"))}function l(b){var x,S=!0;o.active&&(b&&(o.payload.originalEvent=b,tl(b)),S=s("end")),S===!1&&s("rejected"),x=w(S!==!0),s("ended",x)}function p(b){vt("Escape",b)&&(cr(b),g())}function f(b){var x;o.active&&(x=Bm(e),setTimeout(x,400),cr(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=w(b),S&&s("canceled",x)}}function w(b){var x,S;s("cleanup"),Lm(),o.trapClick?S=f:S=l,ve.unbind(document,"mousemove",u),ve.unbind(document,"dragstart",cr),ve.unbind(document,"selectstart",cr),ve.unbind(document,"mousedown",S,!0),ve.unbind(document,"mouseup",S,!0),ve.unbind(document,"keyup",p),ve.unbind(document,"touchstart",d,!0),ve.unbind(document,"touchcancel",g,!0),ve.unbind(document,"touchmove",u,!0),ve.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),$m);var A=o.payload.previousSelection;return b!==!1&&A&&!n.get().length&&c(A),x=o,o=null,x}function E(b,x,S,A){o&&g(!1),typeof x=="string"&&(A=S,S=x,x=null),A=k({},r,A||{});var I=A.data||{},C,$,j,L,F;if(A.trapClick?L=f:L=l,b?(C=jr(b)||b,$=ar(b),tl(b),C.type==="dragstart"&&cr(C)):(C=null,$={x:0,y:0}),j=a($),x||(x=j),F=DR(C),o=k({prefix:S,data:I,payload:{},globalStart:$,displacement:Rn(x,j),localStart:j,isTouch:F},A),A.manual||(F?(ve.bind(document,"touchstart",d,!0),ve.bind(document,"touchcancel",g,!0),ve.bind(document,"touchmove",u,!0),ve.bind(document,"touchend",l,!0)):(ve.bind(document,"mousemove",u),ve.bind(document,"dragstart",cr),ve.bind(document,"selectstart",cr),ve.bind(document,"mousedown",L,!0),ve.bind(document,"mouseup",L,!0)),ve.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",m)),s("init")===!1)return g(),!1;A.autoActivate&&u(b,!0)}e.on("diagram.destroy",g),this.init=E,this.move=u,this.hover=h,this.out=m,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(b){k(r,b)}}jm.$inject=["eventBus","canvas","selection","elementRegistry"];const ti={__depends__:[mR,gn],dragging:["type",jm]};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 IR=new Vr("ps");var LR=["marker-start","marker-mid","marker-end"],BR=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Mi(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Mi.$inject=["elementRegistry","eventBus","canvas","styles"],Mi.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")},Mi.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Mi.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Qf(n);return this._cloneMarkers(ir(r),i),Z(r,this._styles.cls(i,[])),ye(t,r),Z(r,"data-preview-support-element-id",e.id),r},Mi.prototype.addFrame=function(e,t){var n=oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ye(t,n),Z(n,"data-preview-support-element-id",e.id),n},Mi.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),FR(e)&&LR.forEach(function(r){if(Z(e,r)){var o=NR(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},Mi.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,IR.next()].join("-"),a=$e("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Qf(n);s.id=o,Me(s).add(r);var c=$e(":scope > defs",e);c||(c=oe("defs"),ye(e,c)),ye(c,s);var u=jR(s.id);Z(t,i,u)};function NR(e,t,n){var i=$R(Z(e,t));return $e("marker#"+i,n||document)}function $R(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function jR(e){return"url(#"+e+")"}function FR(e){return BR.indexOf(e.nodeName)!==-1}const Gr={__init__:["previewSupport"],previewSupport:["type",Mi]};var HR="drop-ok",Fm="drop-not-ok",Hm="attach-ok",zm="new-parent",Vm="create",zR=2e3;function Gm(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Re(c,function(E){var b=E.labelTarget;return!E.parent&&!(xe(E)&&c.indexOf(b)!==-1)});var d=ze(c,function(E){return!je(E)}),h=!1,m=!1,g=!1;Um(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(Um(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 w=f.connectionTarget;return g||h?(d&&p&&(m=r.allowed("connection.create",{source:w===p?d:p,target:w===p?p:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[Hm,HR,Fm,zm].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}Wm(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,Hm):a(p,m?zm:Fm))}),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,w=u.hints||{};if(h===!1||!d)return!1;Wm(c);var E={x:c.x,y:c.y};g?p=i.appendShape(l,p,E,d,{attach:m,connection:g===!0?{}:g,connectionTarget:w.connectionTarget}):(f=i.createElements(f,E,d,k({},w,{attach:m})),p=ze(f,function(b){return!je(b)})),k(u,{elements:f,shape:p}),k(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Vm&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],zR,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){pe(u)||(u=[u]);var p=ze(u,function(h){return!je(h)});if(p){l=k({elements:u,hints:{},shape:p},l||{}),P(u,function(h){me(h.x)||(h.x=0),me(h.y)||(h.y=0)});var f=Re(u,function(h){return!h.hidden}),d=at(f);P(u,function(h){je(h)&&(h.waypoints=Dt(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),k(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,Vm,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}Gm.$inject=["canvas","dragging","eventBus","modeling","rules"];function Wm(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 Um(e){return e&&e.length===1&&!je(e[0])}var VR=750;function qm(e,t,n,i,r){function o(a){var s=oe("g");Z(s,r.cls("djs-drag-group",["no-events"]));var c=oe("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),Ct(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",VR,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(),ye(p,l)),Ct(l,a.x,a.y)):gt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&>(c)})}qm.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const vs={__depends__:[ti,Gr,jn,gn],__init__:["create","createPreview"],create:["type",Gm],createPreview:["type",qm]};function wl(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)})}wl.$inject=["eventBus"],wl.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||GR(0,0)};function GR(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 Do={__init__:["mouse"],mouse:["type",wl]};var Ym=2e3;function en(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),WR(l)&&(u.priority=2,u.host=l.host.id),je(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=UR(l)),xe(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),P(["x","y","width","height"],function(f){me(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",Ym,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Ym,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;k(u,{createElementsBehavior:!1})})}en.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],en.prototype.copy=function(e,t={}){var n,i;return pe(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(pe(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},en.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})}}},en.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},en.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},en.prototype._getElementIdsFromTree=function(e){var t={};return P(e,function(n){P(n,function(i){i.id&&(t[i.id]=!0)})}),t},en.prototype._paste=function(e,t,n,i){P(e,function(o){me(o.x)||(o.x=0),me(o.y)||(o.y=0)});var r=at(e);return P(e,function(o){je(o)&&(o.waypoints=Dt(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),k(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,k({},i))},en.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return P(e,function(o,a){o=Pn(o,"priority"),P(o,function(s){var c=k({},An(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(je(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(xe(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},en.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(An(e,["id"]));return t},en.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(An(e,["id"]));return t},en.prototype.createShape=function(e){var t=this._elementFactory.createShape(An(e,["id"]));return t},en.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(je(e)&&(!n.has(e.source)||!n.has(e.target))||xe(e)&&!n.has(e.labelTarget))},en.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Ta(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}nr(a,function(p,f,d){if(xe(p))return;P(p.labels,function(g){c(g,d)});function h(g){g&&g.length&&P(g,function(w){P(w.labels,function(E){c(E,d)}),c(w,d)})}P([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=Dt(r,function(p){return p.element});var l=new Set(e);return r=Dt(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=Pn(r,function(p){return p.descriptor.priority}),e=Dt(r,function(p){return p.element}),P(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){Xm(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){Xm(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function WR(e){return!!e.host}function UR(e){return Dt(e.waypoints,function(t){return t=Km(t),t.original&&(t.original=Km(t.original)),t})}function Km(e){return k({},e)}function Xm(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const qR={__depends__:[dR,vs,Do,jn],__init__:["copyPaste"],copyPaste:["type",en]};function Sl(e,t,n){pe(n)||(n=[n]),P(n,function(i){Ui(e[i])||(t[i]=e[i])})}var Rl=750;function Zm(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Rl,function(c){var u=c.descriptor,l=c.element,p=U(l);if(xe(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(De(l),!0);d.bpmnElement=f,Sl(f,u,"name"),Sl(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=U(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(U(c).attachedToRef=U(u[c.host])),An(l,Kt(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(xe(l)){l.businessObject=U(u[l.labelTarget]),l.di=De(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,Sl(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",Rl,function(c){var u=c.descriptor,l=c.element;if(y(l,"bpmn:Participant")){var p=U(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")&&P(_o(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",Rl,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Zm.$inject=["bpmnFactory","eventBus","moddleCopy"];const YR=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],KR=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Oo(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 Pn(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=bt(r)&&r.$descriptor;if(a&&KR.includes(a))return o;if(a&&YR.includes(a)||a&&s&&!ze(s.properties,xr({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})}Oo.$inject=["eventBus","bpmnFactory","moddle"],Oo.prototype.copyElement=function(e,t,n,i=!1){n&&!pe(n)&&(n=[n]),n=n||Cl(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(pe(r)&&(n=r),P(n,o=>{let a;Yt(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!ht(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Oo.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 bt(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):pe(e)?Kt(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):bt(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},Oo.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 Cl(e,t){return Kt(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Qm={__depends__:[qR],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Zm],moddleCopy:["type",Oo]};var Jm=Math.round;function Pl(e,t){this._modeling=e,this._eventBus=t}Pl.$inject=["modeling","eventBus"],Pl.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=Jm(s+o/2),l=Jm(c+a/2),p=i.replaceShape(e,k({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function eg(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}eg.$inject=["selection","eventBus"];const XR={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",eg],replace:["type",Pl]};function ZR(e,t,n){pe(n)||(n=[n]),P(n,function(i){Ui(e[i])||(t[i]=e[i])})}var QR=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function JR(e,t){var n=e&&Yt(e,"collapsed")?e.collapsed:!Pe(e),i;return t&&(Yt(t,"collapsed")||Yt(t,"isExpanded"))?i=Yt(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function tg(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(ys(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&JR(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),ZR(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=Cl(p.$descriptor),m=Cl(f.$descriptor,!0),g=eC(h,m);k(f,Sn(c,QR));var w=Re(g,function(x){return x==="eventDefinitions"?ng(s,c.eventDefinitionType):x==="loopCharacteristics"?!Nt(f):Yt(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!Nt(f):!0});if(f=n.copyElement(p,f,w),c.eventDefinitionType&&(ng(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),y(p,"bpmn:Activity")){if(ys(p))d.isExpanded=Pe(s);else if(c&&Yt(c,"isExpanded")){d.isExpanded=c.isExpanded;var E=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=E.width,d.height=E.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Pe(s)&&!y(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(ys(p)&&!ys(f)&&(u.moveChildren=!1),y(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=Et(s);De(s).isHorizontal||(De(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,Se(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Se(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}tg.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function ys(e){return y(e,"bpmn:SubProcess")}function ng(e,t){var n=U(e);return t&&n.get("eventDefinitions").some(function(i){return y(i,t)})}function eC(e,t){return e.filter(function(n){return t.includes(n)})}const ig={__depends__:[Qm,XR,gn],bpmnReplace:["type",tg]};var tC=250;function ur(e){this._eventBus=e,this._tools=[],this._active=null}ur.$inject=["eventBus"],ur.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)},ur.prototype.isActive=function(e){return e&&this._active===e},ur.prototype.length=function(e){return this._tools.length},ur.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},ur.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),P(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,tC,function(r){this._active&&(nC(r)||this.setActive(null))},this)};function nC(e){var t=e.originalEvent&&e.originalEvent.target;return t&&er(t,'.group[data-group="tools"]')}const _s={__depends__:[ti],__init__:["toolManager"],toolManager:["type",ur]};function iC(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 rC(e,t){var n=[],i=new Set(e);P(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;P(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 oC(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 Al=Math.abs,aC=Math.round,ni={x:"width",y:"height"},rg="crosshair",ki={n:"top",w:"left",s:"bottom",e:"right"},sC=1500,bs={n:"s",w:"e",s:"n",e:"w"},xs=20;function vn(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",sC,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&ag(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){ag(c);var m={x:0,y:0};m[l]=aC(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}vn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],vn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:rg,data:{context:{reactivate:n}},trapClick:!1})},vn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:rg,data:{context:{}}})},vn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},vn.prototype.init=function(e,t){var n=Al(e.dx)>Al(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Al(i)<5)return!1;i<0&&(i*=-1),To(e)&&(i*=-1);var o=iC(n,i),a=this._canvas.getRootElement();!cs(e)&&e.hover&&(a=e.hover);var s=[...fo(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=cC(c,n,o,r,u);return k(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),gs("resize-"+(n==="x"?"ew":"ns")),!0},vn.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 P(e,function(d){if(!(!d.parent||xe(d))){if(je(d)){l.push(d);return}var h=d[t],m=h+d[ni[t]];if(uC(d)&&(n>0&&fe(d)[t]>i||n<0&&fe(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}}}),P(o,function(d){var h=d.attachers;h&&P(h,function(m){p(m)})}),P(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&p(d)}),P(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}},vn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},vn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function og(e){return{top:e.top-xs,right:e.right+xs,bottom:e.bottom+xs,left:e.left-xs}}function ag(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;me(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),me(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),me(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),me(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function cC(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 P(a,function(f){var d=f.attachers,h=f.children,m=ue(f),g=Re(h,function(F){return!je(F)&&!xe(F)&&!l.has(F)&&!p.has(F)}),w=Re(h,function(F){return!je(F)&&!xe(F)&&l.has(F)}),E,b,x,S=[],A=[],I,C,$,j;g.length&&(b=og(ue(at(g))),E=i-m[ki[n]]+b[ki[n]],n==="n"?s.bottom=u=me(u)?Math.min(u,E):E:n==="w"?s.right=u=me(u)?Math.min(u,E):E:n==="s"?s.top=c=me(c)?Math.max(c,E):E:n==="e"&&(s.left=c=me(c)?Math.max(c,E):E)),w.length&&(x=og(ue(at(w))),E=i-x[ki[bs[n]]]+m[ki[bs[n]]],n==="n"?s.bottom=u=me(u)?Math.min(u,E):E:n==="w"?s.right=u=me(u)?Math.min(u,E):E:n==="s"?s.top=c=me(c)?Math.max(c,E):E:n==="e"&&(s.left=c=me(c)?Math.max(c,E):E)),d&&d.length&&(d.forEach(function(F){l.has(F)?S.push(F):A.push(F)}),S.length&&(I=ue(at(S.map(fe))),C=m[ki[bs[n]]]-(I[ki[bs[n]]]-i)),A.length&&($=ue(at(A.map(fe))),j=$[ki[n]]-(m[ki[n]]-i)),n==="n"?(E=Math.min(C||1/0,j||1/0),s.bottom=u=me(u)?Math.min(u,E):E):n==="w"?(E=Math.min(C||1/0,j||1/0),s.right=u=me(u)?Math.min(u,E):E):n==="s"?(E=Math.max(C||-1/0,j||-1/0),s.top=c=me(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(C||-1/0,j||-1/0),s.left=c=me(c)?Math.max(c,E):E));var L=r&&r[f.id];L&&(n==="n"?(E=i+f[ni[t]]-L[ni[t]],s.bottom=u=me(u)?Math.min(u,E):E):n==="w"?(E=i+f[ni[t]]-L[ni[t]],s.right=u=me(u)?Math.min(u,E):E):n==="s"?(E=i-f[ni[t]]+L[ni[t]],s.top=c=me(c)?Math.max(c,E):E):n==="e"&&(E=i-f[ni[t]]+L[ni[t]],s.left=c=me(c)?Math.max(c,E):E))}),s}}function uC(e){return!!e.host}var Tl="djs-dragging",sg="djs-resizing",lC=250,Es=Math.max;function cg(e,t,n,i,r){function o(a,s){P(a,function(c){r.addDragger(c,s),n.addMarker(c,Tl)})}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=oe("g");Z(l,i.cls("djs-crosshair-group",["no-events"])),ye(s,l);var p=oe("path");Z(p,"d",u.x),Me(p).add("djs-crosshair"),ye(l,p);var f=oe("path");Z(f,"d",u.y),Me(f).add("djs-crosshair"),ye(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Ct(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&>(c)}),e.on("spaceTool.move",lC,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=oe("path"),Z(c,"d","M0,0 L0,0"),Me(c).add("djs-crosshair"),ye(f,c),s.line=c;var d=oe("g");Z(d,i.cls("djs-drag-group",["no-events"])),ye(n.getActiveLayer(),d),o(l,d);var h=new Set(l);P(p,function(A){h.add(A)});var m=new Set,g=s.movingConnections=[];h.forEach(function(A){P(A.outgoing,function(I){m.has(I)||!je(I)||!h.has(I.target)||(m.add(I),g.push(I))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var w=oe("g");Z(w,i.cls("djs-frame-group",["no-events"])),ye(n.getActiveLayer(),w);var E=[];P(p,function(A){var I=r.addFrame(A,w),C=I.getBBox();E.push({element:I,initialBounds:C}),n.addMarker(A,sg)}),s.frameGroup=w,s.frames=E}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Z(c,{d:b[u]});var x={x:"y",y:"x"},S={x:a.dx,y:a.dy};S[x[s.axis]]=0,Ct(s.dragGroup,S.x,S.y),P(s.frames,function(A){var I=A.element,C=A.initialBounds,$,j;s.direction==="e"?Z(I,{width:Es(C.width+S.x,5)}):($=Es(C.width-S.x,5),Z(I,{width:$,x:C.x+C.width-$})),s.direction==="s"?Z(I,{height:Es(C.height+S.y,5)}):(j=Es(C.height-S.y,5),Z(I,{height:j,y:C.y+C.height-j}))})}}),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;P(c,function(h){n.removeMarker(h,Tl)}),P(u,function(h){n.removeMarker(h,Tl)}),f&&(gt(p),gt(f)),P(l,function(h){n.removeMarker(h,sg)}),d&>(d)})}cg.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const pC={__init__:["spaceToolPreview"],__depends__:[ti,jn,_s,Gr,Do],spaceTool:["type",vn],spaceToolPreview:["type",cg]};function ws(e,t){e.invoke(vn,this),this._canvas=t}ws.$inject=["injector","canvas"],X(ws,vn),ws.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=_r(Cr(r.children.filter(u=>y(u,"bpmn:Artifact")),at(o))));const s=[...e,...a];var c=vn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(y(u,"bpmn:TextAnnotation")||fC(u)&&(t==="y"&&Et(u)||t==="x"&&!Et(u)))}),c};function fC(e){return y(e,"bpmn:Participant")&&!U(e).processRef}const ug={__depends__:[pC],spaceTool:["type",ws]};function Xe(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)}Xe.$inject=["eventBus","injector"],Xe.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()},Xe.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},Xe.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Xe.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()}},Xe.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()}},Xe.prototype.register=function(e,t){this._setHandler(e,t)},Xe.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)},Xe.prototype.canUndo=function(){return!!this._getUndoAction()},Xe.prototype.canRedo=function(){return!!this._getRedoAction()},Xe.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Xe.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Xe.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)})},Xe.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},Xe.prototype._createId=function(){return this._uid++},Xe.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Xe.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()},Xe.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)},Xe.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:Kp("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Xe.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=pe(e)?e:[e],t.dirty=t.dirty.concat(e))},Xe.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Xe.prototype._revertedAction=function(e){this._stackIdx--},Xe.prototype._getHandler=function(e){return this._handlerMap[e]},Xe.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 dC={commandStack:["type",Xe]};function Di(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 hC=250,lg=1400;function Ml(e,t,n){W.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",lg,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=pg(a),o.validatedShapes=pg(s)}),i&&t.on("shape.move.start",hC,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",lg,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];P(s,function(u){P(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;Di(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=uu(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&&(it(s.labels,a,c),a.labelTarget=s)})}X(Ml,W),Ml.$inject=["injector","eventBus","modeling"];function pg(e){var t=new Set(e);return Re(e,function(n){return!t.has(n.labelTarget)})}const mC={__init__:["labelSupport"],labelSupport:["type",Ml]};var gC=251,fg=1401,dg="attach-ok";function kl(e,t,n,i,r){W.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",fg,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=vC(c),s.validatedShapes=yC(u)}),o&&t.on("shape.move.start",gC,function(a){var s=a.context,c=s.shapes,u=Dl(c);P(u,function(l){o.makeDraggable(s,l,!0),P(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,dg),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,dg)}))}}),this.preExecuted("elements.move",fg,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Dl(u);P(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=Re(c,function(p){var f=p.host;return _C(p)&&!bC(c,f)}),P(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;P(s,function(c){P(c.attachers,function(u){P(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),P(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;Di(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&&P(u.attachers,function(l){var p=kh(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&&P(p,function(d){var h=kh(d,u,l);r.moveShape(d,h,d.parent),P(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Di(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}X(kl,W),kl.$inject=["injector","eventBus","canvas","rules","modeling"];function Dl(e){return Mc(Dt(e,function(t){return t.attachers||[]}))}function vC(e){var t=Dl(e);return yb("id",e,t)}function yC(e){var t=br(e,"id");return Re(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function _C(e){return!!e.host}function bC(e,t){return e.indexOf(t)!==-1}const xC={__depends__:[jn],__init__:["attachSupport"],attachSupport:["type",kl]};function hg(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(ad(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)})}hg.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Ol={__init__:["changeSupport"],changeSupport:["type",hg]};function yn(e){this._model=e}yn.$inject=["moddle"],yn.prototype._needsId=function(e){return Se(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"])},yn.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":Se(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))},yn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},yn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},yn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",k({bpmnElement:e,bounds:this.createDiBounds()},t))},yn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},yn.prototype.createDiWaypoints=function(e){var t=this;return Dt(e,function(n){return t.createDiWaypoint(n)})},yn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Sn(e,["x","y"]))},yn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",k({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},yn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",k({bpmnElement:e},t))};function tn(e,t,n){W.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"],nn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],nn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;P(g,function(w){y(w,"bpmn:BaseElement")&&i.updateParent(w)})}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"],nn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],nn(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"],nn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],nn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],nn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],nn(l)),this.executed("connection.reconnect",nn(function(d){var h=d.context,m=h.connection,g=h.oldSource,w=h.newSource,E=U(m),b=U(g),x=U(w);E.conditionExpression&&!Se(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=E.conditionExpression,delete E.conditionExpression),g!==w&&b.default===E&&(h.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",nn(function(d){var h=d.context,m=h.connection,g=h.oldSource,w=h.newSource,E=U(m),b=U(g),x=U(w);h.oldConditionExpression&&(E.conditionExpression=h.oldConditionExpression),h.oldDefault&&(b.default=h.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],nn(p)),this.reverted(["element.updateAttachment"],nn(p)),this.executed("element.updateLabel",nn(f)),this.reverted("element.updateLabel",nn(f));function f(d){const{element:h}=d.context,m=un(h),g=De(h),w=g&&g.get("label");Ri(h)||us(h)||(m&&!w?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&w&&g.set("label",void 0))}}X(tn,W),tn.$inject=["eventBus","bpmnFactory","connectionDocking"],tn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},tn.prototype.updateParent=function(e,t){if(!xe(e)&&!(y(e,"bpmn:DataStoreReference")&&e.parent&&y(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=De(e),o=n&&n.businessObject,a=De(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)}},tn.prototype.updateBounds=function(e){var t=De(e),n=wC(e);if(n){var i=Rn(n,t.get("bounds"));k(n,{x:e.x+i.x,y:e.y+i.y})}var r=xe(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),k(o,{x:e.x,y:e.y,width:e.width,height:e.height})},tn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;y(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),et(i,e)),y(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),it(r,e))}},tn.prototype.updateDiConnection=function(e,t,n){var i=De(e),r=De(t),o=De(n);i.sourceElement&&i.sourceElement.bpmnElement!==U(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==U(n)&&(i.targetElement=n&&o)},tn.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):(et(n,e),e.$parent=null)}};function EC(e){for(;e&&!y(e,"bpmn:Definitions");)e=e.$parent;return e}tn.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)},tn.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=EC(e.$parent||t),e.$parent&&(et(o.get("rootElements"),r),r.$parent=null),t&&(it(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),et(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);et(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},tn.prototype.updateConnectionWaypoints=function(e){var t=De(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},tn.prototype.updateConnection=function(e){var t=e.connection,n=U(t),i=t.source,r=U(i),o=t.target,a=U(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&&(et(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(et(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)},tn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function nn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;y(i,"bpmn:BaseElement")&&e(t)}}function wC(e){if(y(e,"bpmn:Activity")){var t=De(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Oi(e,t){Zn.call(this),this._bpmnFactory=e,this._moddle=t}X(Oi,Zn),Oi.$inject=["bpmnFactory","moddle"],Oi.prototype._baseCreate=Zn.prototype.create,Oi.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,k({type:"label",di:n},rr,t))}return this.createElement(e,t)},Oi.prototype.createElement=function(e,t){t=k({},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(!RC(r)){var o=k({},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=k({isFrame:!0},t)),t=SC(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Il(r,t,"isExpanded")),Se(i,["bpmn:Lane","bpmn:Participant"])&&(t=Il(r,t,"isHorizontal")),y(i,"bpmn:SubProcess")&&(t.collapsed=!Pe(i,r)),y(i,"bpmn:ExclusiveGateway")&&(Yt(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),ht(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),ht(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=k({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},Oi.prototype.getDefaultSize=function(e,t){var n=U(e);if(t=t||De(e),y(n,"bpmn:SubProcess"))return Pe(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 Pe(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}},Oi.prototype.createParticipantShape=function(e){return bt(e)||(e={isExpanded:e}),e=k({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function SC(e,t,n){return P(n,function(i){t=Il(e,t,i)}),t}function Il(e,t,n){return t[n]===void 0?t:(e[n]=t[n],An(t,[n]))}function RC(e){return Se(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Ss(e,t){this._modeling=e,this._canvas=t}Ss.$inject=["modeling","canvas"],Ss.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;P(n,function(r){var o={x:0,y:0};ht(i.left)?o.x=i.left-r.x:ht(i.right)?o.x=i.right-r.width-r.x:ht(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:ht(i.top)?o.y=i.top-r.y:ht(i.bottom)?o.y=i.bottom-r.height-r.y:ht(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Ss.prototype.postExecute=function(e){};function Rs(e){this._modeling=e}Rs.$inject=["modeling"],Rs.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},Rs.prototype.postExecute=function(e){var t=e.hints||{};CC(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 CC(e,t){return di(e.outgoing,function(n){return n.target===t})}function Cs(e,t){this._canvas=e,this._layouter=t}Cs.$inject=["canvas","layouter"],Cs.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},Cs.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Ps=Math.round;function Ll(e){this._modeling=e}Ll.$inject=["modeling"],Ll.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;P(t,function(p){me(p.x)||(p.x=0),me(p.y)||(p.y=0)});var s=Re(t,function(p){return!p.hidden}),c=at(s);P(t,function(p){je(p)&&(p.waypoints=Dt(p.waypoints,function(f){return{x:Ps(f.x-c.x-c.width/2+r.x),y:Ps(f.y-c.y-c.height/2+r.y)}})),k(p,{x:Ps(p.x-c.x-c.width/2+r.x),y:Ps(p.y-c.y-c.height/2+r.y)})});var u=new Set(Ta(t)),l={};P(t,function(p){if(je(p)){l[p.id]=me(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=k({},o);u.has(p)||(f.autoResize=!1),xe(p)&&(f=An(f,["attach"])),l[p.id]=me(i)?a.createShape(p,Sn(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,Sn(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=_r(l)};var mg=Math.round;function Ii(e){this._canvas=e}Ii.$inject=["canvas"],Ii.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?k(t,n):k(t,{x:n.x-mg(t.width/2),y:n.y-mg(t.height/2)}),this._canvas.addShape(t,i,r),t},Ii.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Io(e){Ii.call(this,e)}X(Io,Ii),Io.$inject=["canvas"];var PC=Ii.prototype.execute;Io.prototype.execute=function(e){var t=e.shape;return TC(t),t.labelTarget=e.labelTarget,PC.call(this,e)};var AC=Ii.prototype.revert;Io.prototype.revert=function(e){return e.shape.labelTarget=null,AC.call(this,e)};function TC(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Lo(e,t){this._canvas=e,this._modeling=t}Lo.$inject=["canvas","modeling"],Lo.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Di(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Di(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Lo.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=uu(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Lo.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,it(n.children,t,i),this._canvas.addConnection(t,n),t};function Bl(e,t){this._modeling=e,this._elementRegistry=t}Bl.$inject=["modeling","elementRegistry"],Bl.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;P(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function Bo(e,t){this._canvas=e,this._modeling=t}Bo.$inject=["canvas","modeling"],Bo.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Di(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Di(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Di(n.children,function(i){je(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Bo.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=uu(i.children,n),t.removeShape(n),n},Bo.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return it(i.children,n,r),t.addShape(n,i),n};function As(e){this._modeling=e}As.$inject=["modeling"];var gg={x:"y",y:"x"};As.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,w){g.range.min=Math.min(w[i],g.range.min),g.range.max=Math.max(w[i]+w[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,w){var E={y:0};E[i]=g-a(w),E[i]&&(E[gg[i]]=0,t.moveElements([w],E,w.parent))}var l=n[0],p=s(n),f=n[p],d,h,m=0;P(n,function(g,w){var E,b,x;if(g.elements.length<2){w&&w!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}E=Pn(g.elements,i),b=E[0],w===p&&(b=E[s(E)]),x=a(b),g.range=null,P(E,function(S){if(u(x,S),g.range===null){g.range={min:S[i],max:S[i]+S[r]};return}o(g,S)}),w&&w!==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)&&P(n,function(g,w){var E={},b;g===l||g===f||(b=n[w-1],g.range.max=0,P(g.elements,function(x,S){E[gg[i]]=0,E[i]=b.range.max-x[i]+d,g.range.min!==x[i]&&(E[i]+=x[i]-g.range.min),E[i]&&t.moveElements([x],E,x.parent),g.range.max=Math.max(x[i]+x[r],S?g.range.max:0)}))})},As.prototype.postExecute=function(e){};function Ts(e,t){this._layouter=e,this._canvas=t}Ts.$inject=["layouter","canvas"],Ts.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return k(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Ts.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Nl(){}Nl.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=et(o.children,t),it(i.children,t,r),t.parent=i,P(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},Nl.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return et(n.children,t),it(i.children,t,r),t.parent=i,P(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 $l(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}$l.prototype.add=function(e,t){return this.addAll([e],t)},$l.prototype.addAll=function(e,t){var n=oE(e,!!t,this);return k(this,n),this};function No(e){this._modeling=e}No.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},No.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),P(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),P(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&&Wu(p,p.source,t),connectionEnd:d&&Uu(p,p.target,t)})})},No.prototype.getClosure=function(e){return new $l().addAll(e,!0)};function Ms(e){this._helper=new No(e)}Ms.$inject=["modeling"],Ms.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Ms.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 lr(e){this._modeling=e,this._helper=new No(e)}lr.$inject=["modeling"],lr.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=Sn(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=et(o.children,t),it(i.children,t,r),k(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},lr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(P(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Uu(o,t,n)})}),P(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Wu(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},lr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return it(n.children,t,i),k(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},lr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},lr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function $o(e){this._modeling=e}$o.$inject=["modeling"],$o.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 pe(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},$o.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||vg(pe(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||vg(pe(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},$o.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 vg(e){return e.original||e}function ii(e,t){this._modeling=e,this._rules=t}ii.$inject=["modeling","rules"],ii.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();P(f,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,is(h,s,l),a)}),P(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,ns(h,s,l),a)})},ii.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},ii.prototype.execute=function(e){},ii.prototype.revert=function(e){},ii.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},ii.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},ii.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function jo(e){this._modeling=e}jo.$inject=["modeling"],jo.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},k(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},jo.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(P(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:is(o,n,i)})}),P(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:ns(o,n,i)})}))},jo.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return k(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Li(e){this._modeling=e}Li.$inject=["modeling"],Li.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),P(r,function(s){a[s.id]=kC(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(rC(i,r),t,n,o,i,r,a)},Li.prototype.execute=function(){},Li.prototype.revert=function(){},Li.prototype.moveShapes=function(e,t){var n=this;P(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Li.prototype.resizeShapes=function(e,t,n){var i=this;P(e,function(r){var o=oC(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Li.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);P(e,function(l){var p=l.source,f=l.target,d=MC(l),h=_g(n),m={},g=c.has(p)||u.has(p),w=c.has(f)||u.has(f);g&&w?(d=Dt(d,function(E){return bg(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&bg(E.original,i,n)&&(E.original[h]=E.original[h]+t[h]),E}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||w)&&(c.has(p)?m.connectionStart=Wu(l,p,t):c.has(f)?m.connectionEnd=Uu(l,f,t):u.has(p)?m.connectionStart=ns(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=is(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function yg(e){return k({},e)}function MC(e){return Dt(e.waypoints,function(t){return t=yg(t),t.original&&(t.original=yg(t.original)),t})}function _g(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function bg(e,t,n){var i=_g(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function kC(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function ks(e){this._modeling=e}ks.$inject=["modeling"],ks.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=xg(n),t.collapsed=!t.collapsed;var i=Eg(n,t.collapsed);return[t].concat(i)},ks.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=wg(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function xg(e){var t={};return P(e,function(n){t[n.id]=n.hidden,n.children&&(t=k({},t,xg(n.children)))}),t}function Eg(e,t){var n=[];return P(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Eg(i.children,i.collapsed||t)))}),n}function wg(e,t){var n=[];return P(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(wg(i.children,t)))}),n}function Ds(e){this._modeling=e}Ds.$inject=["modeling"],Ds.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Sg(i,t),Rg(n,t),t.host=n,t},Ds.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Sg(n,t),Rg(i,t,r),t};function Sg(e,t){return et(e&&e.attachers,t)}function Rg(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),it(i,t,n)}}function jl(){}jl.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},jl.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Fe(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Fe.$inject=["eventBus","elementFactory","commandStack"],Fe.prototype.getHandlers=function(){return{"shape.append":Rs,"shape.create":Ii,"shape.delete":Bo,"shape.move":lr,"shape.resize":jo,"shape.replace":ii,"shape.toggleCollapse":ks,spaceTool:Li,"label.create":Io,"connection.create":Cs,"connection.delete":Lo,"connection.move":Nl,"connection.layout":Ts,"connection.updateWaypoints":jl,"connection.reconnect":$o,"elements.create":Ll,"elements.move":Ms,"elements.delete":Bl,"elements.distribute":As,"elements.align":Ss,"element.updateAttachment":Ds}},Fe.prototype.registerHandlers=function(e){P(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Fe.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)},Fe.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Fe.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)},Fe.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)},Fe.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Fe.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},Fe.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},Fe.prototype.createElements=function(e,t,n,i,r){pe(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},Fe.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},Fe.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},Fe.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Fe.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Fe.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Fe.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Fe.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Fe.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Fe.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Fe.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)},Fe.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Fe.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)},Fe.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,k(i,{docking:"source"}))},Fe.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,k(i,{docking:"target"}))},Fe.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Fe.prototype._create=function(e,t){return GE(t)?t:this._elementFactory.create(e,t)},Fe.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Fo(e){this._elementRegistry=e}Fo.$inject=["elementRegistry"],Fo.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||DC(n,pa(i));return Cg(n,i),e.oldProperties=o,e.changed=r,r},Fo.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Cg(n,t),i},Fo.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return y(e,"bpmn:DataObject")?OC(e,t):[]};function DC(e,t){return Kt(t,function(n,i){return n[i]=e.get(i),n},{})}function Cg(e,t){P(t,function(n,i){e.set(i,n)})}function OC(e,t){return t.filter(function(n){return y(n,"bpmn:DataObjectReference")&&U(n).dataObjectRef===e})}var Ho="default",ri="id",Pg="di",IC={width:0,height:0};function zo(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}zo.$inject=["elementRegistry","moddle","modeling","textRenderer"],zo.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=jC(e.properties),s=e.oldProperties||LC(t,a);return Ag(a,o)&&(r.unclaim(o[ri]),i.updateId(t,a[ri]),r.claim(a[ri],o)),Ho in a&&(a[Ho]&&n.push(i.get(a[Ho].id)),o[Ho]&&n.push(i.get(o[Ho].id))),Tg(t,a),e.oldProperties=s,e.changed=n,n},zo.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&U(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,IC)}},zo.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 Tg(t,i),Ag(n,r)&&(a.unclaim(n[ri]),o.updateId(t,i[ri]),a.claim(i[ri],r)),e.changed};function Ag(e,t){return ri in e&&e[ri]!==t[ri]}function LC(e,t){var n=pa(t),i=e.businessObject,r=De(e);return Kt(n,function(o,a){return a!==Pg?o[a]=i.get(a):o[a]=BC(r,pa(t.di)),o},{})}function BC(e,t){return Kt(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Tg(e,t){var n=e.businessObject,i=De(e);P(t,function(r,o){o!==Pg?n.set(o,r):i&&NC(i,r)})}function NC(e,t){P(t,function(n,i){e.set(i,n)})}var $C=["default"];function jC(e){var t=k({},e);return $C.forEach(function(n){n in e&&(t[n]=U(t[n]))}),t}function Os(e,t){this._canvas=e,this._modeling=t}Os.$inject=["canvas","modeling"],Os.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=De(r);return t.setRootElement(n),t.removeRootElement(r),it(a.rootElements,i),i.$parent=a,et(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Os.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=De(n);return t.setRootElement(r),t.removeRootElement(n),et(a.rootElements,i),i.$parent=null,it(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Fl(e,t){this._modeling=e,this._spaceTool=t}Fl.$inject=["modeling","spaceTool"],Fl.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=hn(i),a=o===i,s=a?i:i.parent,c=Pi(s),u=Et(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+dn,y:i.y,width:i.width-dn,height:i.height}:{x:i.x,y:i.y+dn,width:i.width,height:i.height-dn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];nr(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:Re(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 w=t.calculateAdjustments(p,g,f,h),E=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(w.movingShapes,w.resizingShapes,E,m,h);var b=u?{x:i.x+(a?dn:0),y:d-(r==="top"?120:0),width:i.width-(a?dn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?dn:0),width:120,height:i.height-(a?dn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function Hl(e){this._modeling=e}Hl.$inject=["modeling"],Hl.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Pi(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Et(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+dn,y:n.y+f*c,width:n.width-dn,height:u}:{x:n.x+f*c,y:n.y+dn,width:u,height:n.height-dn},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=O1(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=ue(e),r=ue(t),o=sh(r,i),a=hn(e),s=[],c=[];nr(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 Go="flowNodeRef",zl="lanes";function Is(){}Is.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=ue(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=hn(l);return r[p.id]||(r[p.id]=Za(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=hn(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(zl),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(Go).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},Is.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(zl);n.remove.forEach(function(o){et(r,o),et(o.get(Go),i)}),n.add.forEach(function(o){it(r,o),it(o.get(Go),i)})}),[]},Is.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(zl);n.add.forEach(function(o){et(r,o),et(o.get(Go),i)}),n.remove.forEach(function(o){it(r,o),it(o.get(Go),i)})}),[]};var Vl="categoryValueRef";function Wo(e,t){this._bpmnFactory=e,this._elementRegistry=t}Wo.$inject=["bpmnFactory","elementRegistry"],Wo.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(E,b,x){if(b){var S=a.get(E);S||(S={},a.set(E,S)),!(x&&S.present)&&(!x&&S.past||(x?S.present={categoryValue:b,root:Gl(E)}:S.past={categoryValue:b}))}}function c(E){r.set(E,U(E))}function u(){n.filter(function(E){return y(E,"bpmn:FlowElement")&&!xe(E)&&E.parent}).forEach(c)}function l(E){var b=U(E),x=b.get("categoryValueRef");return x||(x=nh(i,b),o.push(FC(E,x))),x}function p(E){return E.reduce(function(b,x){var S=Gl(x),A=b.get(S);return A||(A=[],b.set(S,A)),A.push(x),b},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(E){return y(E,"bpmn:Group")&&!xe(E)&&E.parent}).forEach(function(E){var b=U(E).get("categoryValueRef");if(!b){var x=Gl(E),S=f.get(x)||[],A=Cr(S,E),I=Object.keys(A).length>0;I&&(b=l(E))}s(E,b,!0)}),t.forEach(function(E){s(E.groupShape,E.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),h=Array.from(a.values()).reduce(function(E,b){return b.present&&E.add(b.present.categoryValue),b.past&&E.add(b.past.categoryValue),E},new Set),m=new Map,g=p(d);a.forEach(function(E,b){var x=E.present;if(x){var S=g.get(x.root)||[],A=Cr(S,b);S.forEach(function(I){if(A[I.id]){var C=m.get(I);C||(C=new Set,m.set(I,C)),C.add(x.categoryValue)}})}});var w=d.reduce(function(E,b){var x=r.get(b),S=x.get(Vl),A=new Set(S),I=m.get(b)||new Set,C=Array.from(I).filter(function(j){return!A.has(j)}),$=S.filter(function(j){return h.has(j)&&!I.has(j)});return(C.length||$.length)&&E.push({businessObject:x,categoryValuesToAdd:C,categoryValuesToRemove:$}),E},[]);return{flowElements:w,groups:o}},Wo.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),HC(t.groups),VC(t.flowElements),[]},Wo.prototype.revert=function(e){var t=e.updates;return GC(t.flowElements),zC(t.groups),[]};function FC(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function HC(e){e.forEach(function(t){U(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function zC(e){e.forEach(function(t){U(t.groupShape).categoryValueRef=null})}function VC(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Vl);t.categoryValuesToRemove.forEach(function(r){et(i,r)}),t.categoryValuesToAdd.forEach(function(r){it(i,r,!0)})})}function GC(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Vl);t.categoryValuesToAdd.forEach(function(r){et(i,r)}),t.categoryValuesToRemove.forEach(function(r){it(i,r,!0)})})}function Gl(e){for(;e.parent;)e=e.parent;return e}function Ls(e){this._moddle=e}Ls.$inject=["moddle"],Ls.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),[]},Ls.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 WC={fill:void 0,stroke:void 0};function Wl(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(qt(t)){var n=UC(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}Wl.$inject=["commandStack"],Wl.prototype.postExecute=function(e){var t=e.elements,n=e.colors||WC,i=this,r={};"fill"in n&&k(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&k(r,{"border-color":this._normalizeColor(n.stroke)}),P(t,function(o){var a=je(o)?Sn(r,["border-color"]):r,s=De(o);if(qC(a),xe(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(!Se(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function UC(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 qC(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var YC={width:0,height:0};function Mg(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return Ew(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!xe(u)&&Ri(u)&&!$a(u)&&!kg(p)){var f=7,d=mu(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=un(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(!(!xe(l)&&!y(l,"bpmn:TextAnnotation"))){if(xe(l)&&kg(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=un(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,YC)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Mg.$inject=["modeling","textRenderer","bpmnFactory"];function kg(e){return!e||!e.trim()}function At(e,t,n,i){Fe.call(this,e,t,n),this._bpmnRules=i}X(At,Fe),At.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],At.prototype.getHandlers=function(){var e=Fe.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Fo,e["element.updateProperties"]=zo,e["canvas.updateRoot"]=Os,e["lane.add"]=Fl,e["lane.resize"]=Vo,e["lane.split"]=Hl,e["lane.updateRefs"]=Is,e["group.updateRefs"]=Wo,e["id.updateClaim"]=Ls,e["element.setColor"]=Wl,e["element.updateLabel"]=Mg,e},At.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},At.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)},At.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},At.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},At.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},At.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},At.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},At.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},At.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},At.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},At.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},At.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},At.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},At.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Dg(){}Dg.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||fe(t.source||e.source),t.connectionEnd||fe(t.target||e.target)]};var Bs=20,KC=5,Ns=Math.round,Og=20,XC={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function ZC(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function QC(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Ig(e,t,n){var i=Rt(t,e,KC),r=n.split(":")[0],o=Ns((t.x-e.x)/2+e.x),a=Ns((t.y-e.y)/2+e.y),s,c,u=QC(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=ZC(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Bs*(/l/.test(r)?-1:1),y:f?a+Bs:a}):(f=o===e.x,s={x:f?o+Bs:o,y:e.y+Bs*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Ul(e,s,c).concat(s),directions:c,turnNextDirections:f}}function JC(e,t,n){return Ig(e,t,n)}function eP(e,t,n){var i=Ig(t,e,Lg(n));return{waypoints:i.waypoints.slice().reverse(),directions:Lg(i.directions),turnNextDirections:i.turnNextDirections}}function tP(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=Ul(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Lg(e){return e.split(":").reverse().join(":")}function nP(e,t,n){var i=Ns((t.x-e.x)/2+e.x),r=Ns((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 Ul(e,t,n){if(n=n||"h:h",!pP(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Ng(n)){var i=JC(e,t,n),r=eP(e,t,n),o=tP(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return nP(e,t,n)}function iP(e,t,n){var i=Ul(e,t,n);return i.unshift(e),i.push(t),jg(i)}function rP(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=gb(o,"straight")[0]||"h:h",s=XC[a]||0,c=Rt(e,t,s),u=lP(c,a);n=n||fe(e),i=i||fe(t);var l=u.split(":"),p=$g(n,e,l[0],fP(c)),f=$g(i,t,l[1],c);return iP(p,f,u)}function oP(e,t,n,i,r,o){pe(n)&&(r=n,o=i,n=fe(e),i=fe(t)),o=k({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&sP(e,t,n,i,o),c||(c=o.connectionEnd&&uP(t,e,i,r),c)||(c=o.connectionStart&&cP(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:rP(e,t,n,i,o)}function aP(e,t,n){return e>=t&&e<=n}function Bg(e,t,n){var i={x:"width",y:"height"};return aP(t[e],n[e],n[e]+n[i[e]])}function sP(e,t,n,i,r){var o={},a,s;return s=Rt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Bg(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:Bg(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 cP(e,t,n,i){return ql(e,t,n,i)}function uP(e,t,n,i){var r=i.slice().reverse();return r=ql(e,t,n,r),r?r.reverse():null}function ql(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!ze(l,function(p,f){var d=l[f-1];return d&&mo(p,d)<3})}function o(l,p,f){var d=Kn(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(cd(l[d],p,Og)||cd(l[d],f,Og))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=ql(e,t,n,u)),c&&Kn(c)?null:c}function lP(e,t){if(Ng(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 pP(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Ng(e){return e&&/t|r|b|l/.test(e)}function fP(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 $g(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 jg(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return lu(r,o,n,0)||t.push(n),t},[])}var dP=-10,hP=40,mP={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},gP={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},Yl={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Uo={top:"t",right:"r",bottom:"b",left:"l"};function $s(e){this._elementRegistry=e}X($s,Dg),$s.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=Fg(r&&r[0],n)),a||(a=Fg(r&&r[r.length-1],i)),(y(e,"bpmn:Association")||y(e,"bpmn:DataAssociation"))&&r&&!Hg(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Qd(n,s)?mP:gP;return y(e,"bpmn:MessageFlow")?c=yP(n,i,l):(y(e,"bpmn:SequenceFlow")||Hg(n,i))&&(n===i?c={preferredLayouts:SP(n,e,l)}:y(n,"bpmn:BoundaryEvent")?c={preferredLayouts:RP(n,i,a,l)}:qo(n)||qo(i)?c={preferredLayouts:l.subProcess,preserveDocking:bP(n)}:y(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:y(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=k(c,t),u=jg(oP(n,i,o,a,r,c))),u||[o,a]};function vP(e){var t=e.host;return Rt(fe(e),t,dP)}function yP(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:_P(e,t)}}function _P(e,t){return y(t,"bpmn:Participant")?"source":y(e,"bpmn:Participant")?"target":qo(t)?"source":qo(e)||y(t,"bpmn:Event")?"target":y(e,"bpmn:Event")?"source":null}function bP(e){return qo(e)?"target":"source"}function Fg(e,t){return e?e.original||e:fe(t)}function Hg(e,t){return y(t,"bpmn:Activity")&&y(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function qo(e){return y(e,"bpmn:SubProcess")&&Pe(e)}function pr(e,t){return e===t}function xP(e,t){return t.indexOf(e)!==-1}function Wr(e){var t=/right|left/.exec(e);return t&&t[0]}function Ur(e){var t=/top|bottom/.exec(e);return t&&t[0]}function zg(e,t){return Yl[e]===t}function EP(e,t){var n=Wr(e),i=Yl[n];return t.indexOf(i)!==-1}function wP(e,t){var n=Ur(e),i=Yl[n];return t.indexOf(i)!==-1}function Vg(e){return e==="right"||e==="left"}function SP(e,t,n){var i=t.waypoints,r=i&&i.length&&Rt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function RP(e,t,n,i){var r=fe(e),o=fe(t),a=vP(e),s,c,u=pr(e.host,t),l=xP(a,["top","right","bottom","left"]),p=Rt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?CP(a,l,e,t,n,i):(s=PP(a,p,l,i.isHorizontal),c=AP(a,p,l,i.isHorizontal),[s+":"+c])}function CP(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Ur(e):Wr(e),s=Uo[a],c;return t?Vg(e)?c=Gg("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Gg("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Gg(e,t,n,i){var r=hP;return!(Kl(e,i,n,r)||Kl(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Kl(e,i,fe(t),r))}function Kl(e,t,n,i){return Math.abs(t[e]-n[e])<i}function PP(e,t,n,i){if(n)return Uo[e];var r=Ur(e),o=Wr(e),a=Ur(t),s=Wr(t);if(i){if(pr(r,a)||zg(o,s))return Uo[r]}else if(pr(o,s)||zg(r,a))return Uo[o];return Uo[i?o:r]}function AP(e,t,n,i){if(n)return Vg(e)?EP(e,t)||pr(e,t)?"h":"v":wP(e,t)||pr(e,t)?"v":"h";var r=Ur(e),o=Wr(e),a=Ur(t),s=Wr(t);return a&&!s?"v":s&&!a?"h":i?pr(r,a)?"h":"v":pr(o,s)?"v":"h"}$s.$inject=["elementRegistry"];function Wg(e){return k({original:e.point.original||e.point},e.actual)}function Bi(e,t){this._elementRegistry=e,this._graphicsFactory=t}Bi.$inject=["elementRegistry","graphicsFactory"],Bi.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(Wg(i)),o.push(Wg(r)),o},Bi.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}},Bi.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return go(i,r,n)},Bi.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Bi.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Bi.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Xl={__init__:["modeling","bpmnUpdater"],__depends__:[qS,uR,pR,fR,ig,dC,mC,xC,gn,Ol,ug],bpmnFactory:["type",yn],bpmnUpdater:["type",tn],elementFactory:["type",Oi],modeling:["type",At],layouter:["type",$s],connectionDocking:["type",Bi]};var TP=10,Ug=50,MP=250;function Zl(e,t,n,i){for(var r;r=kP(e,n,t);)n=i(t,n,r);return n}function Ql(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 kP(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=OP(e);return ze(r,function(o){if(o===n)return!1;var a=Rt(o,i,TP);return a==="intersect"})}function DP(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||Ug,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||MP,c=t.reference||"start";o||(o=BP);function u(h,m){return r==="n"?c==="start"?ue(h).top-ue(m).bottom:c==="center"?ue(h).top-fe(m).y:ue(h).top-ue(m).top:r==="w"?c==="start"?ue(h).left-ue(m).right:c==="center"?ue(h).left-fe(m).x:ue(h).left-ue(m).left:r==="s"?c==="start"?ue(m).top-ue(h).bottom:c==="center"?fe(m).y-ue(h).bottom:ue(m).bottom-ue(h).bottom:c==="start"?ue(m).left-ue(h).right:c==="center"?fe(m).x-ue(h).right:ue(m).right-ue(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=Kt(f,function(h,m){var g=m.distance,w=m.weight;return g<0||g>s||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*w,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function OP(e){var t=Jl(e);return e.host&&(t=t.concat(Jl(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Jl(i))},[]))),t}function Jl(e){return LP(e).concat(IP(e))}function IP(e){return e.incoming.map(function(t){return t.source})}function LP(e){return e.outgoing.map(function(t){return t.target})}function BP(){return!0}var NP=100;function qg(e,t,n){e.on("autoPlace",NP,function(i){var r=i.shape,o=i.source;return $P(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}}qg.$inject=["eventBus","modeling","canvas"];function $P(e,t,n){n||(n={});var i=n.defaultDistance||Ug,r=fe(e),o=ue(e);return{x:o.right+i+t.width/2,y:r.y}}function Yg(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Yg.$inject=["eventBus","selection"];const jP={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",qg],autoPlaceSelectionBehavior:["type",Yg]};function Kg(e,t,n){var i=Qd(e,n);if(y(t,"bpmn:TextAnnotation"))return HP(e,t,i);if(Se(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return zP(e,t,i);if(y(t,"bpmn:FlowNode"))return FP(e,t,i)}function FP(e,t,n){var i=ue(e),r=fe(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=DP(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=Rt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+Xg(u,c,o)}:{x:r.x+Xg(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Zl(e,t,l,Ql(f))}function Xg(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function HP(e,t,n){var i=ue(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};je(e)&&(r=fe(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 Zl(e,t,r,Ql(a))}function zP(e,t,n){var i=ue(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 Zl(e,t,r,Ql(a))}function Zg(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Kg(r,i,t)})}Zg.$inject=["eventBus","elementRegistry"];const js={__depends__:[jP],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Zg]},qr={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},VP=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function GP(e){const t=qr;return VP.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 ep(e,t){let n=0;for(const i of e)n+=t*GP(i);return n}function Qg(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&WP(e),UP(e),qP(e),YP(e)}function WP(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:ep(r,o),fontBoundingBoxAscent:o*qr.ascentEm,fontBoundingBoxDescent:o*qr.descentEm,actualBoundingBoxAscent:o*qr.ascentEm,actualBoundingBoxDescent:o*qr.descentEm}}};t.getContext=()=>n}function UP(e){if(e.SVGMatrix)return;class t{constructor(){vr(this,"a",1);vr(this,"b",0);vr(this,"c",0);vr(this,"d",1);vr(this,"e",0);vr(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 qP(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 YP(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:ep(n,12),height:14}})}const Jg=[Xd,Eo,Xl,js];function KP(e={}){Qg(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Tr({container:t,moddleExtensions:e.moddleExtensions??ya,additionalModules:[...Jg,...e.additionalModules??[]]})}var XP=new Vr("ov"),ZP=500;function wt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=XP,this._overlayDefaults=k({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=QP(n.getContainer()),this._init()}wt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],wt.prototype.get=function(e){if(qt(e)&&(e={id:e}),qt(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Re(t.overlays,xr({type:e.type})):t.overlays.slice():[]}else return e.type?Re(this._overlays,xr({type:e.type})):e.id?this._overlays[e.id]:null},wt.prototype.add=function(e,t,n){if(bt(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=k({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},wt.prototype.remove=function(e){var t=this.get(e)||[];pe(t)||(t=[t]);var n=this;P(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(On(i.html),On(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)}})},wt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},wt.prototype.show=function(){Fs(this._overlayRoot)},wt.prototype.hide=function(){Fs(this._overlayRoot,!1)},wt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],wa(this._overlayRoot)},wt.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}ev(n,i,r),Lt(e.html,"data-container-id",t.id)},wt.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}ev(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},wt.prototype._createOverlayContainer=function(e){var t=We('<div class="djs-overlays" />');zt(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},wt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";tv(this._overlayRoot,n)},wt.prototype._getOverlayContainer=function(e,t){var n=ze(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},wt.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)),qt(i)&&(i=We(i)),o=this._getOverlayContainer(n),r=We('<div class="djs-overlay" data-overlay-id="'+t+'">'),zt(r,{position:"absolute"}),r.appendChild(i),e.type&&Ye(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Fs(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())},wt.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&&(ht(r)&&r>t.scale||ht(o)&&o<t.scale))&&(c=!1),Fs(a,c),this._updateOverlayScale(e,t)},wt.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),ht(i)&&t.scale<i&&(a=(1/t.scale||1)*i),ht(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),ht(a)&&(s="scale("+a+","+a+")"),tv(o,s)},wt.prototype._updateOverlaysVisibilty=function(e){var t=this;P(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},wt.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});P(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){On(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",ZP,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(P(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&&Ye(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 QP(e){var t=We('<div class="djs-overlay-container" />');return zt(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function ev(e,t,n){zt(e,{left:t+"px",top:n+"px"})}function Fs(e,t){e.style.display=t===!1?"none":""}function tv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Hs={__init__:["overlays"],overlays:["type",wt]};function tp(e,t){t.invoke(W,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(tp,W),tp.$inject=["canvas","injector"];const JP={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",tp]};function Yo(e){return CSS.escape(e)}var eA={"&":"&","<":"<",">":">",'"':""","'":"'"};function nv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return eA[t]})}var tA="bjs-breadcrumbs-shown";function iv(e,t,n){var i=We('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Ye(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=U(u),p=ze(a,function(f){return f===l});p&&s()});function s(c){c&&(a=nA(c));var u=a.flatMap(function(p){var f=n.findRoot($n(p))||n.findRoot(p.id);if(!f&&y(p,"bpmn:Process")){var d=t.find(function(g){var w=U(g);return w&&w.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=nv(p.name||p.id),m=We('<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(tA,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}iv.$inject=["eventBus","elementRegistry","canvas"];function nA(e){for(var t=U(e),n=[],i=t;i;i=i.$parent)(y(i,"bpmn:SubProcess")||y(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function rv(e,t){var n=null,i=new iA;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})}rv.$inject=["eventBus","canvas"];function iA(){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 ov={x:180,y:160};function fr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}fr.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)})}},fr.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),oA(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},fr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=rA(e),i={x:n.x-ov.x,y:n.y-ov.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)})},fr.prototype._moveToDiPlane=function(e,t){var n=av(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},fr.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},fr.$inject=["eventBus","moddle"];function av(e){return y(e,"bpmndi:BPMNDiagram")?e:av(e.$parent)}function rA(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=ue(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Da(t)}function oA(e,t){var n=e.$parent;return!(!y(n,"bpmn:SubProcess")||n===t.bpmnElement||Se(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var zs=250,aA='<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>',sA="bjs-drilldown-empty";function Ni(e,t,n,i,r){W.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",zs,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",zs,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],zs,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"],zs,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(Ni,W),Ni.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Ni.prototype._canDrillDown=function(e){var t=this._canvas;return y(e,"bpmn:SubProcess")&&t.findRoot($n(e))},Ni.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=U(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Ye(i.html).toggle(sA,!r)}},Ni.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=U(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=We('<button type="button" class="bjs-drilldown">'+aA+"</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($n(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},Ni.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Ni.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const cA={__depends__:[Hs,Ol,JP],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",iv],drilldownCentering:["type",rv],drilldownOverlayBehavior:["type",Ni],subprocessCompatibility:["type",fr]};function $i(e){Ke.call(this,e)}X($i,Ke),$i.prototype._modules=[Xd,cA,Hs,gn,Eo],$i.prototype._moddleExtensions={};var Vs="keyboard.keydown",uA="keyboard.keyup",lA=1e3,sv="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 Vt(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(sv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Vt.$inject=["config.keyboard","eventBus"],Vt.prototype._keydownHandler=function(e){this._keyHandler(e,Vs)},Vt.prototype._keyupHandler=function(e){this._keyHandler(e,uA)},Vt.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Vs,i),n&&e.preventDefault()}},Vt.prototype._isEventIgnored=function(e){return!1},Vt.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(sv)),this.unbind(),e=this._node=this._target,ve.bind(e,"keydown",this._keydownHandler),ve.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Vt.prototype.getBinding=function(){return this._node},Vt.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),ve.unbind(e,"keydown",this._keydownHandler),ve.unbind(e,"keyup",this._keyupHandler)),this._node=null},Vt.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Vt.prototype.addListener=function(e,t,n){xt(e)&&(n=t,t=e,e=lA),this._eventBus.on(n||Vs,e,t)},Vt.prototype.removeListener=function(e,t){this._eventBus.off(t||Vs,e)},Vt.prototype.hasModifier=RR,Vt.prototype.isCmd=Jt,Vt.prototype.isShift=El,Vt.prototype.isKey=vt;var pA=500;function Yr(e,t){var n=this;e.on("editorActions.init",pA,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Yr.$inject=["eventBus","keyboard"],Yr.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(MR(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(kR(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(CR(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(PR(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(AR(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(TR(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(vt(["+","Add","="],r)&&Jt(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(vt(["-","Subtract"],r)&&Jt(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(vt("0",r)&&Jt(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(vt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const np={__init__:["keyboard","keyboardBindings"],keyboard:["type",Vt],keyboardBindings:["type",Yr]};var fA={moveSpeed:50,moveSpeedAccelerated:200};function cv(e,t,n){var i=this;this._config=k({},fA,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})}}cv.$inject=["config.keyboardMove","keyboard","canvas"];const uv={__depends__:[np],__init__:["keyboardMove"],keyboardMove:["type",cv]};var dA=15;function lv(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=ar(s),p=Rn(l,c);if(!n.dragging&&hA(p)>dA&&(n.dragging=!0,u===0&&Bm(e),gs("grab")),n.dragging){var f=n.last||n.start;p=Rn(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){ve.unbind(document,"mousemove",r),ve.unbind(document,"mouseup",o),n=null,Lm()}function a(s){if(!er(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:ar(s)},ve.bind(document,"mousemove",r),ve.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}lv.$inject=["eventBus","canvas"];function hA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const pv={__init__:["moveCanvas"],moveCanvas:["type",lv]};function fv(e,t){var n=_u(e.min),i=_u(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function mA(e,t){return Math.max(e.min,Math.min(e.max,t))}var gA=Math.sign||function(e){return e>=0?1:-1},ip={min:.2,max:4},dv=10,vA=.1,yA=.75;function Hn(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Gt(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||yA;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Hn.$inject=["config.zoomScroll","eventBus","canvas"],Hn.prototype.scroll=function(t){this._canvas.scroll(t)},Hn.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Hn.prototype.zoom=function(t,n){var i=fv(ip,dv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>vA&&(this._zoom(t,n,i),this._totalDelta=0)},Hn.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Vh()&&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))*gA(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)}},Hn.prototype.stepZoom=function(t,n){var i=fv(ip,dv);this._zoom(t,n,i)},Hn.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=_u(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(mA(ip,s),t)},Hn.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&ve[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Hn.prototype._init=function(e){this.toggle(e)};const hv={__init__:["zoomScroll"],zoomScroll:["type",Hn]};function Ko(e){$i.call(this,e)}X(Ko,$i),Ko.prototype._navigationModules=[uv,pv,hv],Ko.prototype._modules=[].concat($i.prototype._modules,Ko.prototype._navigationModules);function rp(e){return e&&e[e.length-1]}function mv(e){return e.y}function gv(e){return e.x}var _A={left:gv,center:gv,right:function(e){return e.x+e.width},top:mv,middle:mv,bottom:function(e){return e.y+e.height}};function Kr(e,t){this._modeling=e,this._rules=t}Kr.$inject=["modeling","rules"],Kr.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}},Kr.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Kr.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=rp(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(P(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=Pn(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=rp(c).center,o;u=t[0],t=Pn(t,function(f){return f[i]+f[r]}),l=rp(t),o[e]=p(u,l)}return o},Kr.prototype.trigger=function(e,t){var n=this._modeling,i,r=Re(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),pe(i)&&(r=i),!(r.length<2||!i)){var o=_A[t],a=Pn(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const bA={__init__:["alignElements"],alignElements:["type",Kr]},xA=new Vr;function Xr(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Xr.$inject=["eventBus"],Xr.prototype.schedule=function(e,t=xA.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Xr.prototype._schedule=function(e,t){const n=EA();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}},Xr.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Xr.prototype._cancel=function(e){clearTimeout(e.executionId)};function EA(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const wA={scheduler:["type",Xr]};var SA="djs-element-hidden",Gs=".entry",RA=1e3,vv=8,CA=300;function ct(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}ct.$inject=["canvas","elementRegistry","eventBus","scheduler"],ct.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=pe(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=pe(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},ct.prototype._createContainer=function(){var e=We('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},ct.prototype.registerProvider=function(e,t){t||(t=e,e=RA),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},ct.prototype.getEntries=function(e){var t=this._getProviders(),n=pe(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return P(t,function(r){if(xt(r[n])){var o=r[n](e);xt(o)?i=o(i):P(o,function(a,s){i[s]=a})}}),i},ct.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=Lt(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},CA);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},ct.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(xt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},ct.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))}},ct.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ct.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;P(t,function(r,o){var a=r.group||"default",s=We(r.html||'<div class="entry" draggable="true"></div>'),c;Lt(s,"data-action",o),c=$e("[data-group="+Yo(a)+"]",n),c||(c=We('<div class="group"></div>'),Lt(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&PA(s,r.className),r.title&&Lt(s,"title",r.title),r.imageUrl&&(i=We("<img>"),Lt(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Ye(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},ct.prototype._createHtml=function(e){var t=this,n=We('<div class="djs-context-pad"></div>');return Xt.bind(n,Gs,"click",function(i){t.trigger("click",i)}),Xt.bind(n,Gs,"dragstart",function(i){t.trigger("dragstart",i)}),Xt.bind(n,Gs,"mouseover",function(i){t.trigger("mouseover",i)}),Xt.bind(n,Gs,"mouseout",function(i){t.trigger("mouseout",i)}),ve.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},ct.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()&&TA(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},ct.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},ct.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return pe(e)!==pe(n)?!1:pe(e)?e.length===n.length&&qi(e,function(i){return n.includes(i)}):n===e},ct.prototype.isShown=function(){return this.isOpen()&&Ye(this._current.html).has("open")},ct.prototype.show=function(){this.isOpen()&&(Ye(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},ct.prototype.hide=function(){this.isOpen()&&(Ye(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},ct.prototype._getPosition=function(e){if(!pe(e)&&je(e)){var t=this._canvas.viewbox(),n=AA(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+vv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+vv*this._canvas.zoom(),top:s.top-a.top}},ct.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")},ct.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=pe(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,SA)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},ct.prototype._getTargetBounds=function(e){var t=this,n=pe(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 PA(e,t){var n=Ye(e);t=pe(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function AA(e){return e.waypoints[e.waypoints.length-1]}function TA(e,t){return e=pe(e)?e:[e],t=pe(t)?t:[t],e.length===t.length&&qi(e,function(n){return t.includes(n)})}const yv={__depends__:[ms,wA,Hs],contextPad:["type",ct]};var Ws,Ze,_v,ji,bv,xv,Ev,op,Us,Xo,wv,ap,sp,cp,qs={},Ys=[],MA=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ks=Array.isArray;function oi(e,t){for(var n in t)e[n]=t[n];return e}function up(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Sv(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?Ws.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 Xs(e,a,i,r,null)}function Xs(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??++_v,__i:-1,__u:0};return r==null&&Ze.vnode!=null&&Ze.vnode(o),o}function Zs(e){return e.children}function Qs(e,t){this.props=e,this.context=t}function dr(e,t){if(t==null)return e.__?dr(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"?dr(e):null}function kA(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=oi({},t);o.__v=t.__v+1,Ze.vnode&&Ze.vnode(o),lp(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??dr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Dv(i,o,r),t.__e=t.__=null,o.__e!=n&&Rv(o)}}function Rv(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}),Rv(e)}function Cv(e){(!e.__d&&(e.__d=!0)&&ji.push(e)&&!Js.__r++||bv!=Ze.debounceRendering)&&((bv=Ze.debounceRendering)||xv)(Js)}function Js(){try{for(var e,t=1;ji.length;)ji.length>t&&ji.sort(Ev),e=ji.shift(),t=ji.length,kA(e)}finally{ji.length=Js.__r=0}}function Pv(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,w=i&&i.__k||Ys,E=t.length;for(c=DA(n,t,w,c,E),p=0;p<E;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&w[d.__i]||qs,d.__i=p,g=lp(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&pp(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=Av(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 DA(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]=Xs(null,a,null,null,null):Ks(a)?a=e.__k[o]=Xs(Zs,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Xs(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=OA(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=dr(s)),Iv(s,s));return i}function Av(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=Av(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=dr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function OA(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 Tv(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||MA.test(t)?n:n+"px"}function ec(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||Tv(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Tv(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(wv,"$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[Xo]=i[Xo]:(n[Xo]=ap,e.addEventListener(t,o?cp:sp,o)):e.removeEventListener(t,o?cp:sp,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 Mv(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Us]==null)t[Us]=ap++;else if(t[Us]<n[Xo])return;return n(Ze.event?Ze.event(t):t)}}}function lp(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,h,m,g,w,E,b,x,S,A,I,C,$,j=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=Ze.__b)&&l(t);e:if(typeof j=="function"){p=a.length;try{if(E=t.props,b=j.prototype&&j.prototype.render,x=(l=j.contextType)&&i[l.__c],S=l?x?x.props.value:l.__:i,n.__c?w=(f=t.__c=n.__c).__=f.__E:(b?t.__c=f=new j(E,S):(t.__c=f=new Qs(E,S),f.constructor=j,f.render=LA),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&&j.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=oi({},f.__s)),oi(f.__s,j.getDerivedStateFromProps(E,f.__s))),h=f.props,m=f.state,f.__v=t,d)b&&j.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),b&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(b&&j.getDerivedStateFromProps==null&&E!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(E,S),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(E,f.__s,S)===!1){t.__v!=n.__v&&(f.props=E,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(L){L&&(L.__=t)}),Ys.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=dr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(E,f.__s,S),b&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,g)})}if(f.context=S,f.props=E,f.__P=e,f.__e=!1,A=Ze.__r,I=0,b)f.state=f.__s,f.__d=!1,A&&A(t),l=f.render(f.props,f.state,f.context),Ys.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,A&&A(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=oi(oi({},i),f.getChildContext())),b&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),C=l!=null&&l.type===Zs&&l.key==null?Ov(l.props.children):l,s=Pv(e,Ks(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),w&&(f.__E=f.__=null)}catch(L){if(a.length=p,t.__v=null,c||o!=null){if(L.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($=o.length;$--;)up(o[$])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),L.then||kv(t),Ze.__e(L,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=IA(n.__e,t,n,i,r,o,a,c,u);return(l=Ze.diffed)&&l(t),128&t.__u?void 0:s}function kv(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(kv))}function Dv(e,t,n){for(var i=0;i<n.length;i++)pp(n[i],n[++i],n[++i]);Ze.__c&&Ze.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Ze.__e(o,r.__v)}})}function Ov(e){return typeof e!="object"||e==null||e.__b>0?e:Ks(e)?e.map(Ov):e.constructor!==void 0?null:oi({},e)}function IA(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||qs,w=t.props,E=t.type;if(E=="svg"?r="http://www.w3.org/2000/svg":E=="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==!!E&&(E?d.localName==E:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(E==null)return document.createTextNode(w);e=document.createElementNS(r,E,w.is&&w),s&&(Ze.__m&&Ze.__m(t,o),s=!1),o=null}if(E==null)g===w||s&&e.data==w||(e.data=w);else{if(o=E=="textarea"&&w.defaultValue!=null?null:o&&Ws.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 w||u=="value"&&"defaultValue"in w||u=="checked"&&"defaultChecked"in w||ec(e,u,null,d,r);for(u in w)d=w[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||ec(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=""),Pv(t.type=="template"?e.content:e,Ks(f)?f:[f],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&dr(n,0),s,c),o!=null)for(u=o.length;u--;)up(o[u]);s&&E!="textarea"||(u="value",E=="progress"&&h==null?e.removeAttribute("value"):h!=null&&(h!==e[u]||E=="progress"&&!h||E=="option"&&h!=g[u])&&ec(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&ec(e,u,m,g[u],r))}return e}function pp(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){Ze.__e(r,n)}}function Iv(e,t,n){var i,r;if(Ze.unmount&&Ze.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||pp(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Ze.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Iv(i[r],t,n||typeof e.type!="function");n||up(e.__e),e.__c=e.__=e.__e=void 0}function LA(e,t,n){return this.constructor(e,n)}function Lv(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Ze.__&&Ze.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],lp(t,e=t.__k=Sv(Zs,null,[e]),r||qs,qs,t.namespaceURI,r?null:t.firstChild?Ws.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Dv(o,e,a),e.props.children=null}Ws=Ys.slice,Ze={__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}},_v=0,Qs.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=oi({},this.state),typeof e=="function"&&(e=e(oi({},n),this.props)),e&&oi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Cv(this))},Qs.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Cv(this))},Qs.prototype.render=Zs,ji=[],xv=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ev=function(e,t){return e.__v.__b-t.__v.__b},Js.__r=0,op=Math.random().toString(8),Us="__d"+op,Xo="__a"+op,wv=/(PointerCapture)$|Capture$/i,ap=0,sp=Mv(!1),cp=Mv(!0);var Bv=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,Bv(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Nv=new Map;function BA(e){var t=Nv.get(this);return t||(t=new Map,Nv.set(this,t)),(t=Bv(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
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+p+'" height="'+d+'" viewBox="'+l+" "+f+" "+p+" "+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}},St.prototype._setDefinitions=function(e){this._definitions=e},St.prototype.getModules=function(){return this._modules},St.prototype.clear=function(){this.getDefinitions()&&ar.prototype.clear.call(this)},St.prototype.destroy=function(){ar.prototype.destroy.call(this),vi(this._container)},St.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},St.prototype.off=function(e,t){this.get("eventBus").off(e,t)},St.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=ut(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},St.prototype.getDefinitions=function(){return this._definitions},St.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},St.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=V(hi(n,["additionalModules"]),{canvas:V({},n.canvas,{container:e}),modules:a});ar.call(this,s),n&&n.container&&this.attachTo(n.container)},St.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},St.prototype._createContainer=function(e){const t=bt('<div class="bjs-container"></div>');return wn(t,{width:Hm(e.width),height:Hm(e.height),position:e.position}),t},St.prototype._createModdle=function(e){const t=V({},this._moddleExtensions,e.moddleExtensions);return new zd(t)},St.prototype._modules=[];function Ws(e,t){return e.warnings=t,e}function xR(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 _R={width:"100%",height:"100%",position:"relative"};function Hm(e){return e+(Be(e)?"px":"")}function wR(e,t){return t&&ht(e.diagrams,function(n){return n.id===t})||null}function ER(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Nm+"</a>",i=bt(n);wn(ut("svg",i),$m),wn(i,Fm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ne.bind(i,"click",function(r){bR(),r.preventDefault()})}function bo(e){St.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)}ye(bo,St),bo.prototype._createModdle=function(e){var t=St.prototype._createModdle.call(this,e);return t.ids=new yi([32,36,1]),t},bo.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 Xe(e,t){return E(e,"bpmn:CallActivity")?!1:E(e,"bpmn:SubProcess")?(t=t||Qe(e),t&&E(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):E(e,"bpmn:Participant")?!!te(e).processRef:!0}function Qt(e){if(!(!E(e,"bpmn:Participant")&&!E(e,"bpmn:Lane"))){var t=Qe(e).isHorizontal;return t===void 0?!0:t}}function SR(e){return e&&te(e).isInterrupting!==!1}function gn(e){return e&&!!te(e).triggeredByEvent}function xo(e,t){var n=te(e).eventDefinitions;return Xi(n,function(i){return E(i,t)})}function RR(e){return xo(e,"bpmn:ErrorEventDefinition")}function CR(e){return xo(e,"bpmn:EscalationEventDefinition")}function PR(e){return xo(e,"bpmn:CompensateEventDefinition")}var $r={width:90,height:20},zm=15;function sr(e){return E(e,"bpmn:Event")||E(e,"bpmn:Gateway")||E(e,"bpmn:DataStoreReference")||E(e,"bpmn:DataObjectReference")||E(e,"bpmn:DataInput")||E(e,"bpmn:DataOutput")||E(e,"bpmn:SequenceFlow")||E(e,"bpmn:MessageFlow")||E(e,"bpmn:Group")}function Us(e){return Ge(e.label)}function AR(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=TR(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-=zm:a+=zm,{x:a,y:s}}function TR(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 $l(e){return e.waypoints?AR(e.waypoints):E(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+$r.height/2}:{x:e.x+e.width/2,y:e.y+e.height+$r.height/2}}function MR(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max($r.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=$l(t),i=$r),V({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Gm(e){if(E(e,"bpmn:FlowElement")||E(e,"bpmn:Participant")||E(e,"bpmn:Lane")||E(e,"bpmn:SequenceFlow")||E(e,"bpmn:MessageFlow")||E(e,"bpmn:DataInput")||E(e,"bpmn:DataOutput"))return"name";if(E(e,"bpmn:TextAnnotation"))return"text";if(E(e,"bpmn:Group"))return"categoryValueRef"}function kR(e){var t=e.categoryValueRef;return t&&t.value||""}function qn(e){var t=e.businessObject,n=Gm(t);if(n)return n==="categoryValueRef"?kR(t):t[n]||""}function OR(e,t){var n=e.businessObject,i=Gm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function DR(e){return Ge(e)&&sr(e.labelTarget)}var _o=7;function Vm(e){let t=[];return $(e.incoming,n=>{E(n,"bpmn:Association")&&E(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),$(e.outgoing,n=>{E(n,"bpmn:Association")&&E(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function da(e){const t=new Map;return $(kl(e),n=>{$(Vm(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 Fl="hsl(225, 10%, 15%)",LR="white";function wi(e,t){return Xi(e.eventDefinitions,function(n){return n.$type===t})}function IR(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function BR(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Ke(e,t,n){var i=Qe(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||LR}function he(e,t,n){var i=Qe(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Fl}function ha(e,t,n,i){var r=Qe(e),o=r.get("label");return i||o&&o.get("color:color")||t||he(e,n)}function Wm(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 Ir(r)}function jl(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 Ir(a)}function NR(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 Ir(s)}function $R(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 Ir(o)}function ma(e,t={}){return{width:Zn(e,t),height:In(e,t)}}function Zn(e,t={}){return Mn(t,"width")?t.width:e.width}function In(e,t={}){return Mn(t,"height")?t.height:e.height}var FR=new yi,jR=10,Ys=3,HR=1.5,qs=10,zR=4,wo=.95,GR=1,VR=.25;function Fr(e,t,n,i,r,o,a){Li.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(M){return n.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Fl,strokeWidth:2,fill:"white"})}function f(M){return n.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Fl,strokeWidth:2})}function p(M,S){var{ref:w={x:0,y:0},scale:G=1,element:U,parentGfx:X=r._svg}=S,xe=Ce("marker",{id:M,viewBox:"0 0 20 20",refX:w.x,refY:w.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});Fe(xe,U);var He=ut(":scope > defs",X);He||(He=Ce("defs"),Fe(X,He)),Fe(He,xe)}function d(M,S,w,G){var U=FR.nextPrefixed("marker-");return m(M,U,S,w,G),"url(#"+U+")"}function m(M,S,w,G,U){if(w==="sequenceflow-end"){var X=Ce("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:U,stroke:U,strokeWidth:1})});p(S,{element:X,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(w==="messageflow-start"){var xe=Ce("circle",{cx:6,cy:6,r:3.5,...l({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(S,{element:xe,ref:{x:6,y:6},parentGfx:M})}if(w==="messageflow-end"){var He=Ce("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(S,{element:He,ref:{x:8.5,y:5},parentGfx:M})}if(w==="association-start"){var tt=Ce("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(S,{element:tt,ref:{x:1,y:10},scale:.5,parentGfx:M})}if(w==="association-end"){var kt=Ce("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(S,{element:kt,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(w==="conditional-flow-marker"){var ot=Ce("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:G,stroke:U})});p(S,{element:ot,ref:{x:-1,y:10},scale:.5,parentGfx:M})}if(w==="conditional-default-flow-marker"){var At=Ce("path",{d:"M 6 4 L 10 16",...l({stroke:U,fill:"none"})});p(S,{element:At,ref:{x:0,y:10},scale:.5,parentGfx:M})}}function h(M,S,w,G,U={}){Kt(G)&&(U=G,G=0),G=G||0,U=l(U);var X=S/2,xe=w/2,He=Ce("circle",{cx:X,cy:xe,r:Math.round((S+w)/4-G),...U});return Fe(M,He),He}function g(M,S,w,G,U,X){Kt(U)&&(X=U,U=0),U=U||0,X=l(X);var xe=Ce("rect",{x:U,y:U,width:S-U*2,height:w-U*2,rx:G,ry:G,...X});return Fe(M,xe),xe}function y(M,S,w,G){var U=S/2,X=w/2,xe=[{x:U,y:0},{x:S,y:X},{x:U,y:w},{x:0,y:X}],He=xe.map(function(kt){return kt.x+","+kt.y}).join(" ");G=l(G);var tt=Ce("polygon",{...G,points:He});return Fe(M,tt),tt}function v(M,S,w,G){w=f(w);var U=aa(S,w,G);return Fe(M,U),U}function b(M,S,w){return v(M,S,w,5)}function x(M,S,w){w=f(w);var G=Ce("path",{...w,d:S});return Fe(M,G),G}function C(M,S,w,G){return x(S,w,V({"data-marker":M},G))}function P(M){return mt[M]}function D(M){return function(S,w,G){return P(M)(S,w,G)}}var T={"bpmn:MessageEventDefinition":function(M,S,w={},G){var U=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.235,my:.315}}),X=G?he(S,c,w.stroke):Ke(S,s,w.fill),xe=G?Ke(S,s,w.fill):he(S,c,w.stroke),He=x(M,U,{fill:X,stroke:xe,strokeWidth:1});return He},"bpmn:TimerEventDefinition":function(M,S,w={}){var G=w.width||S.width,U=w.height||S.height,X=w.width?1:2,xe=h(M,G,U,.2*U,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke),strokeWidth:X}),He=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}});x(M,He,{stroke:he(S,c,w.stroke),strokeWidth:X});for(var tt=0;tt<12;tt++){var kt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}}),ot=G/2,At=U/2;x(M,kt,{strokeWidth:1,stroke:he(S,c,w.stroke),transform:"rotate("+tt*30+","+At+","+ot+")"})}return xe},"bpmn:EscalationEventDefinition":function(M,S,w={},G){var U=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.5,my:.2}}),X=G?he(S,c,w.stroke):Ke(S,s,w.fill);return x(M,U,{fill:X,stroke:he(S,c,w.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(M,S,w={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.5,my:.222}});return x(M,G,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(M,S,w={},G){var U=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.57,my:.263}}),X=G?he(S,c,w.stroke):Ke(S,s,w.fill);return x(M,U,{fill:X,stroke:he(S,c,w.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(M,S,w={},G){var U=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.2,my:.722}}),X=G?he(S,c,w.stroke):Ke(S,s,w.fill);return x(M,U,{fill:X,stroke:he(S,c,w.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(M,S,w={},G){var U=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.638,my:-.055}}),X=G?he(S,c,w.stroke):"none",xe=x(M,U,{fill:X,stroke:he(S,c,w.stroke),strokeWidth:1});return Im(xe,45),xe},"bpmn:CompensateEventDefinition":function(M,S,w={},G){var U=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.22,my:.5}}),X=G?he(S,c,w.stroke):Ke(S,s,w.fill);return x(M,U,{fill:X,stroke:he(S,c,w.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(M,S,w={},G){var U=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.5,my:.2}}),X=G?he(S,c,w.stroke):Ke(S,s,w.fill);return x(M,U,{strokeWidth:1,fill:X,stroke:he(S,c,w.stroke)})},"bpmn:MultipleEventDefinition":function(M,S,w={},G){var U=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.211,my:.36}}),X=G?he(S,c,w.stroke):Ke(S,s,w.fill);return x(M,U,{fill:X,stroke:he(S,c,w.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(M,S,w={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.458,my:.194}});return x(M,G,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(M,S,w={}){var G=h(M,S.width,S.height,8,{fill:he(S,c,w.stroke),stroke:he(S,c,w.stroke),strokeWidth:4});return G}};function I(M,S,w={},G){var U=te(M),X=IR(U),xe=G||M;return U.get("eventDefinitions")&&U.get("eventDefinitions").length>1?U.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](S,xe,w,X):T["bpmn:MultipleEventDefinition"](S,xe,w,X):wi(U,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](S,xe,w,X):wi(U,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](S,xe,w,X):wi(U,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](S,xe,w,X):wi(U,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](S,xe,w,X):wi(U,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](S,xe,w,X):wi(U,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](S,xe,w,X):wi(U,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](S,xe,w,X):wi(U,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](S,xe,w,X):wi(U,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](S,xe,w,X):wi(U,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](S,xe,w,X):null}var k={ParticipantMultiplicityMarker:function(M,S,w={}){var G=Zn(S,w),U=In(S,w),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2-6)/G,my:(U-15)/U}});C("participant-multiplicity",M,X,{strokeWidth:2,fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke)})},SubProcessMarker:function(M,S,w={}){var G=g(M,14,14,0,{strokeWidth:1,fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke)});on(G,S.width/2-7.5,S.height-20);var U=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:S.width,containerHeight:S.height,position:{mx:(S.width/2-7.5)/S.width,my:(S.height-20)/S.height}});C("sub-process",M,U,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke)})},ParallelMarker:function(M,S,w){var G=Zn(S,w),U=In(S,w),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+w.parallel)/G,my:(U-20)/U}});C("parallel",M,X,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke)})},SequentialMarker:function(M,S,w){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:(S.width/2+w.seq)/S.width,my:(S.height-19)/S.height}});C("sequential",M,G,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke)})},CompensationMarker:function(M,S,w){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:(S.width/2+w.compensation)/S.width,my:(S.height-13)/S.height}});C("compensation",M,G,{strokeWidth:1,fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke)})},LoopMarker:function(M,S,w){var G=Zn(S,w),U=In(S,w),X=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+w.loop)/G,my:(U-7)/U}});C("loop",M,X,{strokeWidth:1.5,fill:"none",stroke:he(S,c,w.stroke),strokeMiterlimit:.5})},AdhocMarker:function(M,S,w){var G=Zn(S,w),U=In(S,w),X=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+w.adhoc)/G,my:(U-15)/U}});C("adhoc",M,X,{strokeWidth:1,fill:he(S,c,w.stroke),stroke:he(S,c,w.stroke)})}};function L(M,S,w,G){k[M](S,w,G)}function z(M,S,w=[],G={}){G={fill:G.fill,stroke:G.stroke,width:Zn(S,G),height:In(S,G)};var U=te(S),X=w.includes("SubProcessMarker");X?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},U.get("isForCompensation")&&w.push("CompensationMarker"),E(U,"bpmn:AdHocSubProcess")&&(w.push("AdhocMarker"),X||V(G,{compensation:G.compensation-18}));var xe=U.get("loopCharacteristics"),He=xe&&xe.get("isSequential");xe&&(V(G,{compensation:G.compensation-18}),w.includes("AdhocMarker")&&V(G,{seq:-23,loop:-18,parallel:-24}),He===void 0&&w.push("LoopMarker"),He===!1&&w.push("ParallelMarker"),He===!0&&w.push("SequentialMarker")),w.includes("CompensationMarker")&&w.length===1&&V(G,{compensation:-8}),$(w,function(tt){L(tt,M,S,G)})}function ae(M,S,w={}){w=V({size:{width:100}},w);var G=o.createText(S||"",w);return Ze(G).add("djs-label"),Fe(M,G),G}function me(M,S,w,G={}){var U=te(S),X=ma({x:S.x,y:S.y,width:S.width,height:S.height},G);return ae(M,U.name,{align:w,box:X,padding:7,style:{fill:ha(S,u,c,G.stroke)}})}function Ue(M,S,w={}){var G={width:S.width,height:S.height,x:S.width/2+S.x,y:S.height/2+S.y};return ae(M,qn(S),{box:G,style:V({},o.getExternalStyle(),{fill:ha(S,u,c,w.stroke)})})}function $e(M,S,w,G={}){var U=Qt(w),X=ae(M,S,{box:{height:30,width:U?In(w,G):Zn(w,G)},align:"center-middle",style:{fill:ha(w,u,c,G.stroke)}});if(U){var xe=-1*In(w,G);Gs(X,0,-xe,270)}}function q(M,S,w={}){var{width:G,height:U}=ma(S,w);return g(M,G,U,qs,{...w,fill:Ke(S,s,w.fill),fillOpacity:wo,stroke:he(S,c,w.stroke)})}function le(M,S,w={}){var G=te(S),U=Ke(S,s,w.fill),X=he(S,c,w.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(w.markerEnd=d(M,"association-end",U,X)),G.get("associationDirection")==="Both"&&(w.markerStart=d(M,"association-start",U,X)),w=Je(w,["markerStart","markerEnd"]),b(M,S.waypoints,{...w,stroke:X,strokeDasharray:"0, 5"})}function oe(M,S,w={}){var G=Ke(S,s,w.fill),U=he(S,c,w.stroke),X=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.474,my:.296}}),xe=x(M,X,{fill:G,fillOpacity:wo,stroke:U}),He=te(S);if(BR(He)){var tt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.33,my:(S.height-18)/S.height}});x(M,tt,{strokeWidth:2,fill:G,stroke:U})}return xe}function fe(M,S,w={}){return h(M,S.width,S.height,{fillOpacity:wo,...w,fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke)})}function Oe(M,S,w={}){return y(M,S.width,S.height,{fill:Ke(S,s,w.fill),fillOpacity:wo,stroke:he(S,c,w.stroke)})}function W(M,S,w={}){var G=g(M,Zn(S,w),In(S,w),0,{fill:Ke(S,s,w.fill),fillOpacity:w.fillOpacity||wo,stroke:he(S,c,w.stroke),strokeWidth:1.5}),U=te(S);if(E(U,"bpmn:Lane")){var X=U.get("name");$e(M,X,S,w)}return G}function Y(M,S,w={}){var G=q(M,S,w),U=Xe(S);if(gn(S)&&(ve(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!U)){var X=te(S).flowElements||[],xe=X.filter(He=>E(He,"bpmn:StartEvent"));xe.length===1&&Z(xe[0],M,w,S)}return me(M,S,U?"center-top":"center-middle",w),U?z(M,S,void 0,w):z(M,S,["SubProcessMarker"],w),G}function Z(M,S,w,G){var U=22,X={fill:Ke(G,s,w.fill),stroke:he(G,c,w.stroke),width:U,height:U},xe=te(M).isInterrupting,He=xe?0:3,tt=xe?1:1.2,kt=20,ot=(U-kt)/2,At="translate("+ot+","+ot+")";h(S,kt,kt,{fill:X.fill,stroke:X.stroke,strokeWidth:tt,strokeDasharray:He,transform:At}),I(M,S,X,G)}function Me(M,S,w={}){var G=q(M,S,w);return me(M,S,"center-middle",w),z(M,S,void 0,w),G}var mt=this.handlers={"bpmn:AdHocSubProcess":function(M,S,w={}){return Xe(S)?w=Je(w,["fill","stroke","width","height"]):w=Je(w,["fill","stroke"]),Y(M,S,w)},"bpmn:Association":function(M,S,w={}){return w=Je(w,["fill","stroke"]),le(M,S,w)},"bpmn:BoundaryEvent":function(M,S,w={}){var{renderIcon:G=!0}=w;w=Je(w,["fill","stroke"]);var U=te(S),X=U.get("cancelActivity");w={strokeWidth:1.5,fill:Ke(S,s,w.fill),fillOpacity:GR,stroke:he(S,c,w.stroke)},X||(w.strokeDasharray="6");var xe=fe(M,S,w);return h(M,S.width,S.height,Ys,{...w,fill:"none"}),G&&I(S,M,w),xe},"bpmn:BusinessRuleTask":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=Me(M,S,w),U=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),X=x(M,U);ve(X,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke),strokeWidth:1});var xe=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),He=x(M,xe);return ve(He,{fill:he(S,c,w.stroke),stroke:he(S,c,w.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(M,S,w={}){return w=Je(w,["fill","stroke"]),Y(M,S,{strokeWidth:5,...w})},"bpmn:ComplexGateway":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=Oe(M,S,w),U=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:S.width,containerHeight:S.height,position:{mx:.46,my:.26}});return x(M,U,{fill:he(S,c,w.stroke),stroke:he(S,c,w.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=oe(M,S,w);return x(M,G,{fill:"none",stroke:he(S,c,w.stroke),strokeWidth:1}),U},"bpmn:DataInputAssociation":function(M,S,w={}){return w=Je(w,["fill","stroke"]),le(M,S,{...w,markerEnd:d(M,"association-end",Ke(S,s,w.fill),he(S,c,w.stroke))})},"bpmn:DataObject":function(M,S,w={}){return w=Je(w,["fill","stroke"]),oe(M,S,w)},"bpmn:DataObjectReference":D("bpmn:DataObject"),"bpmn:DataOutput":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=oe(M,S,w);return x(M,G,{strokeWidth:1,fill:he(S,c,w.stroke),stroke:he(S,c,w.stroke)}),U},"bpmn:DataOutputAssociation":function(M,S,w={}){return w=Je(w,["fill","stroke"]),le(M,S,{...w,markerEnd:d(M,"association-end",Ke(S,s,w.fill),he(S,c,w.stroke))})},"bpmn:DataStoreReference":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:0,my:.133}});return x(M,G,{fill:Ke(S,s,w.fill),fillOpacity:wo,stroke:he(S,c,w.stroke),strokeWidth:2})},"bpmn:EndEvent":function(M,S,w={}){var{renderIcon:G=!0}=w;w=Je(w,["fill","stroke"]);var U=fe(M,S,{...w,strokeWidth:4});return G&&I(S,M,w),U},"bpmn:EventBasedGateway":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=te(S),U=Oe(M,S,w);h(M,S.width,S.height,S.height*.2,{fill:Ke(S,"none",w.fill),stroke:he(S,c,w.stroke),strokeWidth:1});var X=G.get("eventGatewayType"),xe=!!G.get("instantiate");function He(){var kt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:S.width,containerHeight:S.height,position:{mx:.36,my:.44}});x(M,kt,{fill:"none",stroke:he(S,c,w.stroke),strokeWidth:2})}if(X==="Parallel"){var tt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:S.width,containerHeight:S.height,position:{mx:.474,my:.296}});x(M,tt,{fill:"none",stroke:he(S,c,w.stroke),strokeWidth:1})}else X==="Exclusive"&&(xe||h(M,S.width,S.height,S.height*.26,{fill:"none",stroke:he(S,c,w.stroke),strokeWidth:1}),He());return U},"bpmn:ExclusiveGateway":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=Oe(M,S,w),U=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:S.width,containerHeight:S.height,position:{mx:.32,my:.3}}),X=Qe(S);return X.get("isMarkerVisible")&&x(M,U,{fill:he(S,c,w.stroke),stroke:he(S,c,w.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(M,S,w={}){return w=Je(w,["fill","stroke"]),Oe(M,S,w)},"bpmn:Group":function(M,S,w={}){return w=Je(w,["fill","stroke","width","height"]),g(M,S.width,S.height,qs,{stroke:he(S,c,w.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Zn(S,w),height:In(S,w)})},"bpmn:InclusiveGateway":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=Oe(M,S,w);return h(M,S.width,S.height,S.height*.24,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(M,S,w={}){var{renderIcon:G=!0}=w;w=Je(w,["fill","stroke"]);var U=fe(M,S,{...w,strokeWidth:1.5});return h(M,S.width,S.height,Ys,{fill:"none",stroke:he(S,c,w.stroke),strokeWidth:1.5}),G&&I(S,M,w),U},"bpmn:IntermediateCatchEvent":D("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":D("bpmn:IntermediateEvent"),"bpmn:Lane":function(M,S,w={}){return w=Je(w,["fill","stroke","width","height"]),W(M,S,{...w,fillOpacity:VR})},"bpmn:ManualTask":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=Me(M,S,w),U=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(M,U,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=te(S),U=Qe(S),X=Ke(S,s,w.fill),xe=he(S,c,w.stroke),He=b(M,S.waypoints,{markerEnd:d(M,"messageflow-end",X,xe),markerStart:d(M,"messageflow-start",X,xe),stroke:xe,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var tt=He.getPointAtLength(He.getTotalLength()/2),kt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:tt.x,y:tt.y}}),ot={strokeWidth:1};U.get("messageVisibleKind")==="initiating"?(ot.fill=X,ot.stroke=xe):(ot.fill=xe,ot.stroke=X);var At=x(M,kt,ot),yn=G.get("messageRef"),Jt=yn.get("name"),gt=ae(M,Jt,{align:"center-top",fitBox:!0,style:{fill:xe}}),Dt=At.getBBox(),cn=gt.getBBox(),qo=tt.x-cn.width/2,Hn=tt.y+Dt.height/2+jR;Gs(gt,qo,Hn,0)}return He},"bpmn:ParallelGateway":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=Oe(M,S,w),U=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:S.width,containerHeight:S.height,position:{mx:.46,my:.2}});return x(M,U,{fill:he(S,c,w.stroke),stroke:he(S,c,w.stroke),strokeWidth:1}),G},"bpmn:Participant":function(M,S,w={}){w=Je(w,["fill","stroke","width","height"]);var G=W(M,S,w),U=Xe(S),X=Qt(S),xe=te(S),He=xe.get("name");if(U){var tt=X?[{x:30,y:0},{x:30,y:In(S,w)}]:[{x:0,y:30},{x:Zn(S,w),y:30}];v(M,tt,{stroke:he(S,c,w.stroke),strokeWidth:HR}),$e(M,He,S,w)}else{var kt=ma(S,w);X||(kt.height=Zn(S,w),kt.width=In(S,w));var ot=ae(M,He,{box:kt,align:"center-middle",style:{fill:ha(S,u,c,w.stroke)}});if(!X){var At=-1*In(S,w);Gs(ot,0,-At,270)}}return xe.get("participantMultiplicity")&&L("ParticipantMultiplicityMarker",M,S,w),G},"bpmn:ReceiveTask":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=te(S),U=Me(M,S,w),X;return G.get("instantiate")?(h(M,28,28,20*.22,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke),strokeWidth:1}),X=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):X=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(M,X,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke),strokeWidth:1}),U},"bpmn:ScriptTask":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=Me(M,S,w),U=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(M,U,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=Me(M,S,w),U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(M,U,{fill:he(S,c,w.stroke),stroke:Ke(S,s,w.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=Ke(S,s,w.fill),U=he(S,c,w.stroke),X=b(M,S.waypoints,{markerEnd:d(M,"sequenceflow-end",G,U),stroke:U}),xe=te(S),{source:He}=S;if(He){var tt=te(He);xe.get("conditionExpression")&&E(tt,"bpmn:Activity")&&ve(X,{markerStart:d(M,"conditional-flow-marker",G,U)}),tt.get("default")&&(E(tt,"bpmn:Gateway")||E(tt,"bpmn:Activity"))&&tt.get("default")===xe&&ve(X,{markerStart:d(M,"conditional-default-flow-marker",G,U)})}return X},"bpmn:ServiceTask":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=Me(M,S,w);h(M,10,10,{fill:Ke(S,s,w.fill),stroke:"none",transform:"translate(6, 6)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(M,U,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke),strokeWidth:1}),h(M,10,10,{fill:Ke(S,s,w.fill),stroke:"none",transform:"translate(11, 10)"});var X=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(M,X,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(M,S,w={}){var{renderIcon:G=!0}=w;w=Je(w,["fill","stroke"]);var U=te(S);U.get("isInterrupting")||(w={...w,strokeDasharray:"6"});var X=fe(M,S,w);return G&&I(S,M,w),X},"bpmn:SubProcess":function(M,S,w={}){return Xe(S)?w=Je(w,["fill","stroke","width","height"]):w=Je(w,["fill","stroke"]),Y(M,S,w)},"bpmn:Task":function(M,S,w={}){return w=Je(w,["fill","stroke"]),Me(M,S,w)},"bpmn:TextAnnotation":function(M,S,w={}){w=Je(w,["fill","stroke"]);var{width:G,height:U}=ma(S,w),X=g(M,G,U,0,0,{fill:"none",stroke:"none"}),xe=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:0,my:0}});x(M,xe,{stroke:he(S,c,w.stroke)});var He=te(S),tt=He.get("text")||"";return ae(M,tt,{align:"left-top",box:ma(S,w),padding:_o,style:{fill:ha(S,u,c,w.stroke)}}),X},"bpmn:Transaction":function(M,S,w={}){Xe(S)?w=Je(w,["fill","stroke","width","height"]):w=Je(w,["fill","stroke"]);var G=Y(M,S,{strokeWidth:1.5,...w}),U=n.style(["no-fill","no-events"],{stroke:he(S,c,w.stroke),strokeWidth:1.5}),X=Xe(S);return X||(w={}),g(M,Zn(S,w),In(S,w),qs-Ys,Ys,U),G},"bpmn:UserTask":function(M,S,w={}){w=Je(w,["fill","stroke"]);var G=Me(M,S,w),U=15,X=12,xe=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:X}});x(M,xe,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke),strokeWidth:.5});var He=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:X}});x(M,He,{fill:Ke(S,s,w.fill),stroke:he(S,c,w.stroke),strokeWidth:.5});var tt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:X}});return x(M,tt,{fill:he(S,c,w.stroke),stroke:he(S,c,w.stroke),strokeWidth:.5}),G},label:function(M,S,w={}){return Ue(M,S,w)}};this._drawPath=x,this._renderer=P}ye(Fr,Li),Fr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Fr.prototype.canRender=function(e){return E(e,"bpmn:BaseElement")},Fr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Fr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Fr.prototype.getShapePath=function(e){return Ge(e)?jl(e,zR):E(e,"bpmn:Event")?Wm(e):E(e,"bpmn:Activity")?jl(e,qs):E(e,"bpmn:Gateway")?NR(e):$R(e)};function Je(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var WR=0,UR={width:150,height:50};function YR(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function qR(e){return Kt(e)?V({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Hl=null;function KR(){return Hl||(Hl=document.createElement("canvas").getContext("2d")),Hl}function XR(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(Um(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Um(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function ZR(e,t){var n=KR();if(!n)return{width:0,height:0};n.font=XR(t),"letterSpacing"in n&&(n.letterSpacing=Um(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 QR(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=ZR(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return JR(e,r,i,o);r=tC(r,o.width,t)}}function JR(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 Ym="";function eC(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===Ym)&&r.pop();break}var a=r[r.length-1];return a&&a===Ym&&(r[r.length-1]="-"),r.join("")}function tC(e,t,n){var i=Math.max(e.length*(n/t),1),r=eC(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ks(e){this._config=V({},{size:UR,padding:WR,style:{},align:"center-top"},e||{})}Ks.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ks.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ks.prototype.layoutText=function(e,t){for(var n=V({},this._config.size,t.box),i=V({},this._config.style,t.style),r=YR(t.align||this._config.align),o=qR(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=nC(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(QR(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=kn(u,function(g,y,v){return g+(s||y.height)},0)+o.top+o.bottom,p=kn(u,function(g,y,v){return y.width>g?y.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||u[0].height)/4;var m=Ce("text");ve(m,i),$(u,function(g){var y;switch(d+=s||g.height,r.horizontal){case"left":y=o.left;break;case"right":y=(a?p:l)-o.right-g.width;break;default:y=Math.max(((a?p:l)-g.width)/2+o.left,0)}var v=Ce("tspan");ve(v,{x:y,y:d}),v.textContent=g.text,Fe(m,v)});var h={width:p,height:f};return{dimensions:h,element:m}};function nC(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var iC=12,rC=1.2,oC=40;function qm(e){var t=V({fontFamily:"Arial, sans-serif",fontSize:iC,fontWeight:"normal",lineHeight:rC},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=V({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ks({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,$r.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:_o});return{x:a.x,y:a.y,width:a.width,height:Math.max(oC,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,V({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}qm.$inject=["config.textRenderer"];function aC(){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 f=lC(i.d,{mx:r,my:o,e:a});return f}}var sC=/\{([^{}]+)\}/g,cC=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function uC(e,t,n){var i=n;return t.replace(cC,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 lC(e,t){return String(e).replace(sC,function(n,i){return uC(n,i,t)})}const pC={__init__:["bpmnRenderer"],bpmnRenderer:["type",Fr],textRenderer:["type",qm],pathMap:["type",aC]};function fC(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ga={translate:["value",fC]};function Xs(e,t,n){return V({id:e.id,type:e.$type,businessObject:e,di:t},n)}function dC(e,t,n){var i=e.waypoint;return!i||i.length<2?[Le(t),Le(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Km(e,t,n){return new Error(`element ${mn(t)} referenced by ${mn(e)}#${n} not yet drawn`)}function $i(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}$i.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],$i.prototype.add=function(e,t,n){var i,r,o;if(E(t,"bpmndi:BPMNPlane")){var a=E(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Xs(e,t,a)),this._canvas.addRootElement(i)}else if(E(t,"bpmndi:BPMNShape")){var s=!Xe(e,t),c=mC(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Xs(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})),E(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),E(e,"bpmn:Lane")&&(o=0),E(e,"bpmn:DataStoreReference")&&(hC(n,Le(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(E(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Xs(e,t,{hidden:r,source:l,target:f,waypoints:dC(t,l,f)})),E(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${mn(t)} for element ${mn(e)}`);return sr(e)&&qn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},$i.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${mn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Km(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},$i.prototype.addLabel=function(e,t,n){var i,r,o;return i=MR(t,n),r=qn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Xs(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!qn(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)},$i.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?Km(e,i,t+"Ref"):new Error(`${mn(e)}#${t} Ref not specified`)},$i.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},$i.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},$i.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function hC(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 mC(e){return E(e,"bpmn:Group")}const Xm={__depends__:[pC,{__depends__:[ga],bpmnImporter:["type",$i]}]};function ya(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function pi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function zl(e){return Math.log(e)/Math.log(10)}var gC=1e3;function ee(e){this._eventBus=e}ee.$inject=["eventBus"];function yC(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}ee.prototype.on=function(e,t,n,i,r,o){if((Xt(t)||Be(t))&&(o=r,r=i,i=n,n=t,t=null),Xt(n)&&(o=r,r=i,i=n,n=gC),Kt(r)&&(o=r,r=!1),!Xt(i))throw new Error("handlerFn must be a function");De(e)||(e=[e]);var a=this._eventBus;$(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?yC(i,o):i,o)})},ee.prototype.canExecute=Fi("canExecute"),ee.prototype.preExecute=Fi("preExecute"),ee.prototype.preExecuted=Fi("preExecuted"),ee.prototype.execute=Fi("execute"),ee.prototype.executed=Fi("executed"),ee.prototype.postExecute=Fi("postExecute"),ee.prototype.postExecuted=Fi("postExecuted"),ee.prototype.revert=Fi("revert"),ee.prototype.reverted=Fi("reverted");function Fi(e){return function(n,i,r,o,a){(Xt(n)||Be(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Gl=["top","bottom","left","right"],Zs=10;function Vl(e,t){ee.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(Us(r)&&!pt(r)){var o=xC(r);o&&i(r,o)}}function i(r,o){var a=Le(r),s=r.label,c=Le(s);if(s.parent){var u=Te(r),l;switch(o){case"top":l={x:a.x,y:u.top-Zs-s.height/2};break;case"left":l={x:u.left-Zs-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Zs+s.height/2};break;case"right":l={x:u.right+Zs+s.width/2,y:a.y};break}var f=pi(l,c);t.moveShape(s,f)}}}ye(Vl,ee),Vl.$inject=["eventBus","modeling"];function vC(e){var t=e.host,n=Le(e),i=rn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Gl.filter(function(a){return r.indexOf(a)===-1});return o}function bC(e){var t=Le(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 Zm(t,i)});return n}function xC(e){var t=Le(e.label),n=Le(e),i=Zm(n,t);if(_C(i)){var r=bC(e);if(e.host){var o=vC(e);r=r.concat(o)}var a=Gl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?rn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Zm(e,t){return rn(t,e,5)}function _C(e){return Gl.indexOf(e)!==-1}function Wl(e){ee.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(E(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)}ye(Wl,ee),Wl.$inject=["eventBus"];var wC=1500;function Ul(e,t,n){e.invoke(ee,this),this.preExecute("elements.delete",wC,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=>E(u,"bpmn:Participant")||E(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>E(u,"bpmn:Artifact"))),c=new Set;return $(o,u=>{const l=new Set(io(go(Array.from(s),Bt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ye(Ul,ee),Ul.$inject=["injector","eventBus","canvas"];function Yl(e,t){e.invoke(ee,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ye(r.incoming.concat(r.outgoing),function(a){return E(a,"bpmn:Association")});$(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}ye(Yl,ee),Yl.$inject=["injector","modeling"];function Eo(e,t){for(Tn(t)&&(t=[t]);e=e.parent;)if(We(e,t))return e;return null}function Qm(e,t){var n=Eo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Eo(e,i),n)return Qt(n);if(We(e,i))return Qt(e);var r;for(r=te(e);r&&!E(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=te(a);return s&&s.get("processRef")===r});return o?Qt(o):!0}var Jm=500;function Qs(e,t){t.invoke(ee,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Jm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return eg(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",Jm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];eg(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Qs.$inject=["bpmnReplace","injector"],ye(Qs,ee),Qs.prototype._replaceShape=function(e,t){var n=EC(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function EC(e){var t=te(e),n=t.eventDefinitions;return n&&n[0]}function eg(e,t){return!Ge(e)&&We(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function ql(e,t){ee.call(this,e);function n(i){return Ye(i.attachers,function(r){return E(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);E(r,"bpmn:EventBasedGateway")&&E(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;E(r,"bpmn:Gateway")&&E(o,"bpmn:EventBasedGateway")&&$(o.outgoing,function(a){var s=a.target,c=n(s);E(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}ql.$inject=["eventBus","modeling"],ye(ql,ee);function tg(e){return e.create("bpmn:Category")}function SC(e){return e.create("bpmn:CategoryValue")}function ng(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=SC(e)),n.$parent||(n.$parent=tg(e)),n}function RC(e,t,n){return Ot(t.get("categoryValue"),e),e.$parent=t,Ot(n.get("rootElements"),t),t.$parent=n,e}function CC(e){var t=e.$parent;return t&&(Mt(t.get("categoryValue"),e),e.$parent=null),e}function PC(e){var t=e.$parent;return t&&(Mt(t.get("rootElements"),e),e.$parent=null),e}var AC=500;function Kl(e,t,n){n.invoke(ee,this);function i(c){return t.filter(function(u){return E(u,"bpmn:Group")&&!u.labelTarget}).map(te).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 f=l.get("categoryValueRef");return f&&f.$parent===c})}function a(c,u){c&&u&&RC(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&PC(u),c&&!r(c,l)&&CC(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!E(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;!E(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,te(u))},!0),this.executed(["shape.move","shape.resize"],AC,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,te(u))},!0),this.executed("group.updateRefs",function(c){ig(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){ig(c).forEach(function(u){s(u.categoryValue,u.category,te(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!E(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,te(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!E(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Kl.$inject=["bpmnjs","elementRegistry","injector"],ye(Kl,ee);function ig(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Xl(e,t,n){ee.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 y=g.source,v=g.target;So(y)&&va(v)&&l(v)}function r(g){const y=g.connection,v=g.source,b=g.target;So(v)&&Js(b)&&(u(b),p(v,[y]))}function o(g){const y=g.newTarget,v=g.oldSource,b=g.oldTarget;if(b!==y){const x=v;va(b)&&l(b),So(x)&&Js(y)&&u(y)}}function a(g){const{element:y}=g;va(y)?(f(y),d(y)):Js(y)&&m(y)}function s(g){const{newData:y,oldShape:v}=g;if(So(g.oldShape)&&y.eventDefinitionType!=="bpmn:CompensateEventDefinition"||y.type!=="bpmn:BoundaryEvent"){const b=v.outgoing.find(({target:x})=>va(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!So(g.oldShape)&&y.eventDefinitionType==="bpmn:CompensateEventDefinition"&&y.type==="bpmn:BoundaryEvent"){const b=v.outgoing.find(({target:x})=>Js(x));b&&b.target&&(g._connectionTarget=b.target),h(v)}}function c(g){const{_connectionTarget:y,newShape:v}=g;y&&t.connect(v,y)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function f(g){for(const y of g.incoming)n.canConnect(y.source,g)||t.removeConnection(y);for(const y of g.outgoing)n.canConnect(g,y.target)||t.removeConnection(y)}function p(g,y){g.outgoing.filter(x=>E(x,"bpmn:Association")).filter(x=>va(x.target)&&!y.includes(x)).forEach(x=>t.removeConnection(x))}function d(g){const y=g.attachers.slice();y.length&&t.removeElements(y)}function m(g){const y=g.incoming.filter(v=>So(v.source));t.removeElements(y)}function h(g){const y=g.outgoing.filter(v=>E(v,"bpmn:SequenceFlow"));t.removeElements(y)}}ye(Xl,ee),Xl.$inject=["eventBus","modeling","bpmnRules"];function va(e){const t=te(e);return t&&t.get("isForCompensation")}function So(e){return e&&E(e,"bpmn:BoundaryEvent")&&xo(e,"bpmn:CompensateEventDefinition")}function Js(e){return e&&E(e,"bpmn:Activity")&&!gn(e)}function Zl(e){e.invoke(ee,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;E(i,"bpmn:Lane")&&!E(r,"bpmn:Lane")&&(n.parent=Eo(i,"bpmn:Participant"))})}Zl.$inject=["injector"],ye(Zl,ee);function Ql(e,t){ee.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(E(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}})}Ql.$inject=["eventBus","bpmnFactory"],ye(Ql,ee);var Jl=20,ep=20,rg=30,ec=2e3;function tp(e,t,n){ee.call(this,t),t.on(["create.start","shape.move.start"],ec,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!E(a,"bpmn:Participant")||!E(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(f){return!E(f,"bpmn:Group")&&!Ge(f)&&!pt(f)});if(c.length){var u=Bt(c),l=TC(a,u);V(a,l),o.createConstraints=MC(a,u)}}}),t.on("create.start",ec,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}E(a,"bpmn:Participant")&&E(s,"bpmn:Process")&&(t.on("element.hover",ec,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return E(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",ec,function(r){var o=r.elements,a=r.parent,s=kC(o),c;s&&E(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=te(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;E(a,"bpmn:Participant")&&E(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=te(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)&&te(s).set("processRef",te(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)&&te(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)}tp.$inject=["canvas","eventBus","modeling"],ye(tp,ee);function TC(e,t){t={width:t.width+Jl*2+rg,height:t.height+ep*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 MC(e,t){return t=Te(t),{bottom:t.top+e.height/2-ep,left:t.right-e.width/2+Jl,top:t.bottom-e.height/2+ep,right:t.left+e.width/2-Jl-rg}}function kC(e){return ht(e,function(t){return E(t,"bpmn:Participant")})}var og="__targetRef_placeholder";function np(e,t){ee.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],ag(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],ag(o));function n(a,s,c){var u=a.get("dataInputAssociations");return ht(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=ht(c,function(l){return l.name===og});return!u&&s&&(u=t.create("bpmn:Property",{name:og}),Ot(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||Mt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,f=l&&l.businessObject,p=s.newTarget,d=p&&p.businessObject,m=s.oldTarget||s.target,h=m&&m.businessObject,g=c.businessObject,y;h&&h!==f&&r(h,u),d&&d!==f&&r(d,u),f?(y=i(f,!0),g.targetRef=y):g.targetRef=null}}np.$inject=["eventBus","bpmnFactory"],ye(np,ee);function ag(e){return function(t){var n=t.context,i=n.connection;if(E(i,"bpmn:DataInputAssociation"))return e(t)}}function tc(e){this._bpmnUpdater=e}tc.$inject=["bpmnUpdater"],tc.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),[]},tc.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 ip(e,t,n,i){ee.call(this,i),t.registerHandler("dataStore.updateContainment",tc);function r(){return n.filter(function(s){return E(s,"bpmn:Participant")&&te(s).processRef})[0]}function o(s){return s.children.filter(function(c){return E(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:Qe(s),newSemanticParent:l.processRef||l,newDiParent:Qe(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;E(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(f){return E(f,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(f){return!E(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;E(u,"bpmn:DataStoreReference")&&u.type!=="label"&&E(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,f=u.parent;if(!E(l,"bpmn:Collaboration")&&E(u,"bpmn:DataStoreReference")&&u.type!=="label"&&E(f,"bpmn:Collaboration")){var p=E(l,"bpmn:Participant")?l:DC(l,"bpmn:Participant");a(u,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();We(u,["bpmn:Participant","bpmn:SubProcess"])&&E(l,"bpmn:Collaboration")&&o(l).filter(function(f){return OC(f,u)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,f=o(u);f.forEach(function(p){E(l,"bpmn:Process")&&a(p,l)})})}ip.$inject=["canvas","commandStack","elementRegistry","eventBus"],ye(ip,ee);function OC(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 DC(e,t){for(;e.parent;){if(E(e.parent,t))return e.parent;e=e.parent}}var nc=Math.max,ic=Math.min,LC=20;function sg(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function IC(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 BC(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 rc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Be(r)&&(i=(/top|left/.test(e)?ic:nc)(i,r)),Be(o)&&(i=(/top|left/.test(e)?nc:ic)(i,o)),i}function NC(e,t){if(!t)return e;var n=Te(e);return js({top:rc("top",n,t),right:rc("right",n,t),bottom:rc("bottom",n,t),left:rc("left",n,t)})}function $C(e,t,n,i){var r=Te(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?Te(i):o,s={top:ic(o.top,a.top),left:ic(o.left,a.left),bottom:nc(o.bottom,a.bottom),right:nc(o.right,a.right)};return js(s)}function ba(e,t){return typeof e<"u"?e:LC}function FC(e,t){var n,i,r,o;return typeof t=="object"?(n=ba(t.left),i=ba(t.right),r=ba(t.top),o=ba(t.bottom)):n=i=r=o=ba(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function jC(e){return!(e.waypoints||e.type==="label")}function cg(e,t){var n;if(e.length===void 0?n=Ye(e.children,jC):n=e,n.length)return FC(Bt(n),t)}var cr=Math.abs;function HC(e,t){return sg(Te(t),Te(e))}var zC=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Qn=30;function oc(e,t){return t=t||[],e.children.filter(function(n){E(n,"bpmn:Lane")&&(oc(n,t),t.push(n))}),t}function ur(e){return e.children.filter(function(t){return E(t,"bpmn:Lane")})}function Jn(e){return Eo(e,zC)||e}function GC(e,t){var n=Jn(e),i=E(n,"bpmn:Process")?[]:[n],r=oc(n,i),o=Te(e),a=Te(t),s=HC(e,t),c=[],u=Qt(e);return r.forEach(function(l){if(l!==e){var f=u?0:s.top,p=u?s.right:0,d=u?0:s.bottom,m=u?s.left:0,h=Te(l);s.top&&(cr(h.bottom-o.top)<10&&(d=a.top-h.bottom),cr(h.top-o.top)<5&&(f=a.top-h.top)),s.left&&(cr(h.right-o.left)<10&&(p=a.left-h.right),cr(h.left-o.left)<5&&(m=a.left-h.left)),s.bottom&&(cr(h.top-o.bottom)<10&&(f=a.bottom-h.top),cr(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(cr(h.left-o.right)<10&&(m=a.right-h.left),cr(h.right-o.right)<5&&(p=a.right-h.right)),(f||p||d||m)&&c.push({shape:l,newBounds:BC(l,{top:f,right:p,bottom:d,left:m})})}}),c}var VC=500;function rp(e,t){ee.call(this,e);function n(i,r){var o=Qt(i),a=ur(r),s=[],c=[],u=[],l=[];if(Br(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 f;o?c.length&&s.length?f=i.height/2:f=i.height:l.length&&u.length?f=i.width/2:f=i.width;var p,d,m,h;s.length&&(p=t.calculateAdjustments(s,"y",f,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:f},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-f,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-f},"n")),u.length&&(m=t.calculateAdjustments(u,"x",f,i.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:f,y:0},"e")),l.length&&(h=t.calculateAdjustments(l,"x",-f,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",VC,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;E(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}rp.$inject=["eventBus","spaceTool"],ye(rp,ee);var ug=500;function ac(e,t){t.invoke(ee,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ug,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return lg(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",ug,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;lg(a,UC(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}ac.$inject=["bpmnReplace","injector"],ye(ac,ee),ac.prototype._replaceShape=function(e){var t=WC(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function WC(e){var t=te(e),n=t.eventDefinitions;return n&&n[0]}function lg(e,t){return!Ge(e)&&E(e,"bpmn:BoundaryEvent")&&!t}function UC(e,t){return e.indexOf(t)!==-1}var sc=Math.round,YC=Math.max;function qC(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 KC(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var pg=10;function XC(e,t){var n,i;for(n=0;i=e[n];n++)if(ua(i,t)<=pg)return{point:e[n],bendpoint:!0,index:n};return null}function ZC(e,t){var n=gm(qC(t,pg),KC(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=YC(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:sc(i.x+r.x)/2,y:sc(i.y+r.y)/2},index:i.segment2}:{point:{x:sc(i.x),y:sc(i.y)},index:i.segment2}:null}function op(e,t){return XC(e,t)||ZC(e,t)}function ap(e,t,n){ee.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,f,p,d,m,h=r.outgoing.slice(),g=r.incoming.slice(),y;Be(a.width)?y=Le(a):y=a;var v=op(s,y);if(v){if(c=s.slice(0,v.index),u=s.slice(v.index+(v.bendpoint?1:0)),!c.length||!u.length)return;l=v.bendpoint?s[v.index]:y,(c.length===1||!fg(r,c[c.length-1]))&&c.push(dg(l)),(u.length===1||!fg(r,u[0]))&&u.unshift(dg(l))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||y),d=o),t.canConnect(r,p,o)&&(d?m=n.connect(r,p,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||y),m=o));var b=[].concat(d&&Ye(g,function(x){return x.source===d.source})||[],m&&Ye(h,function(x){return x.target===m.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=Le(c),l={x:u.x+s.x,y:u.y+s.y},f=ht(o.children,function(p){var d=t.canInsert(a,p);return d&&op(p.waypoints,l)});f&&(r.targetFlow=f,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)}ye(ap,ee),ap.$inject=["eventBus","bpmnRules","modeling"];function fg(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 dg(e){return V({},e)}function sp(e,t){ee.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)&&Ro(r)){var c=[];E(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&Ro(u)):c=a.incoming.filter(u=>u!==r&&Ro(u)&&E(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(E(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(Ro).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Ro).forEach(function(s){const c=a.incoming.filter(Ro).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}sp.$inject=["eventBus","modeling"],ye(sp,ee);function Ro(e){return E(e,"bpmn:SequenceFlow")}var cc=1500,hg=2e3;function mg(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"],cc,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;E(a,"bpmn:Lane")&&!We(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Jn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||We(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"],cc,function(i){var r=i.hover;E(r,"bpmn:Lane")&&(i.hover=Jn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],cc,function(i){var r=i.context,o=i.hover,a=r.type;E(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Jn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],cc,function(i){var r=i.context,o=r.start;E(o,"bpmn:Lane")&&(r.start=Jn(o)||o)}),t.on("shape.move.start",hg,function(i){var r=i.shape;E(r,"bpmn:Lane")&&(i.shape=Jn(r)||r)}),t.on("spaceTool.move",hg,function(i){var r=i.hover;r&&E(r,"bpmn:Lane")&&(i.hover=Jn(r))})}mg.$inject=["elementRegistry","eventBus","canvas"];var gg=770;function cp(e,t,n,i){n.invoke(ee,this);function r(s,c){var u=te(s),l=c.categoryValue||u.categoryValueRef;l||(l=ng(e,u));var f=c.category||l.$parent||tg(e);u.categoryValueRef=l,l.$parent=f,c.categoryValue=l,c.category=f}function o(s,c){var u=te(s),l=c.categoryValue||u.categoryValueRef,f=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=f,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;E(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;E(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=te(u);if(!(!E(u,"bpmn:Group")||u.labelTarget)){var f=c.categoryValue=l.categoryValueRef;f&&(c.category=f.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!E(u,"bpmn:Group")||u.labelTarget)){var l=c.category,f=c.categoryValue,p=te(u);f&&(p.categoryValueRef=f,f.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!E(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!te(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!E(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!te(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!E(u,"bpmn:Group")||u.labelTarget||te(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!E(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",gg,function(s){var c=s.descriptor,u=s.element;if(!(!E(u,"bpmn:Group")||u.labelTarget)){var l=te(u);if(l.categoryValueRef){var f=l.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",gg,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,f=c.category;l&&(l=u.categoryValueRef=a(l)),f&&(l.$parent=a(f)),delete c.category,delete c.categoryValue})}cp.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ye(cp,ee);function up(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 yg(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=up(i,r,o,a),u=up(i,r,o,s),l;c&&u?vg(c,o)>vg(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],Le(i.source)),t(r[r.length-1],r[r.length-2],Le(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}yg.$inject=["eventBus"];function vg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function lp(e){ee.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=te(i),o=Qe(i);if(We(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}lp.$inject=["eventBus"],ye(lp,ee);function bg(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function xg(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function QC(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 JC(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 pp(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=JC([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 _g(e,t){var n=pp(e,t),i={x:n.x-e.x,y:n.y-e.y};return bg(i)}function xa(e,t){return bg({x:e.x-t.x,y:e.y-t.y})}var wg=Math.sqrt,Eg=Math.min,eP=Math.max,Sg=Math.abs;function Rg(e){return Math.pow(e,2)}function _a(e,t){return wg(Rg(e.x-t.x)+Rg(e.y-t.y))}function tP(e,t){var n=0,i,r,o,a,s,c,u,l,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Pg(i,r)?u=[i]:(o=_a(e,i),a=_a(e,r),c=Eg(o,a),u=nP(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:Pg(i,u[0])?n:n+1}),u.length===2&&(s=rP(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:_a(i,s)/_a(i,r)}),f=_a(l.position,e),(!d||p>f)&&(d=l,p=f)}return d}function nP(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,f=u/c,p=l/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var m=wg(d),h=-f+m,g=-f-m,y={x:e.x-r*h,y:e.y-o*h};if(d===0)return[y];var v={x:e.x-r*g,y:e.y-o*g};return[y,v].filter(function(b){return iP(b,e,t)})}function iP(e,t,n){return Cg(e.x,t.x,n.x)&&Cg(e.y,t.y,n.y)}function Cg(e,t,n){return e>=Eg(t,n)-uc&&e<=eP(t,n)+uc}function rP(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var uc=.1;function Pg(e,t){return Sg(e.x-t.x)<=uc&&Sg(e.y-t.y)<=uc}function oP(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 f=Tg(t,u);f<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 Ag(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=tP(e,n),c=s.segmentIndex,u=oP(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Mg(n,c),f=Mg(t,u),p=s.position,d=sP(l,p),m=aP(l,f);if(s.type==="bendpoint"){var h=t.length-n.length,g=s.bendpointIndex,y=n[g];if(t.indexOf(y)!==-1)return a;if(h===0){var v=t[g];return r=v.x-s.position.x,o=v.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&g!==0&&g<n.length-1&&(d=Tg(n,g))}var b={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},x=QC({x:e.x-p.x,y:e.y-p.y},m);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:Bi(b),delta:Bi({x:r,y:o})}}function Tg(e,t){var n=xa(e[t-1],e[t]),i=xa(e[t],e[t+1]),r=n/(n+i);return r}function aP(e,t){var n=xg(e),i=xg(t);return i-n}function Mg(e,t){return[e[t],e[t+1]]}function sP(e,t){var n=xa(e[0],e[1]),i=xa(e[0],t);return n===0?0:i/n}function cP(e,t,n,i){var r=Le(e);return Ag(r,t,n,i).delta}function wa(e,t,n){var i=ya(t),r=ya(n),o=pi(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Bi({x:r.x+a.x,y:r.y+a.y})}function kg(e,t,n){var i=ya(e),r=ya(t),o=ya(n),a=pi(e,i),s=pi(i,r),c=uP(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 Bi({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function uP(e,t,n){var i=Te(t),r=Te(n);if(lP(i,r))return null;var o=rn(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=rn(n,s),c!==o?null:a}function lP(e,t){return pP(e,t)||fP(e,t)}function pP(e,t){return e.right!==t.right&&e.left!==t.left}function fP(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Og="name",Dg="text";function fp(e,t,n,i){ee.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{te(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(Og in u&&t.updateLabel(c,u[Og]),Dg in u&&E(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Dg]||"");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;Ge(u)||!sr(u)||qn(u)&&t.updateLabel(u,qn(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=V({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),cP(u,f,p,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,f;!l||!l.parent||(f=o(a),t.moveShape(l,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=te(c);l&&sr(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(!(!Ge(c)||u.autoResize)){var l=s.newBounds,f=i.getDimensions(qn(c)||"",{box:l,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=l.y!==c.y,m=c.y+c.height;s.newBounds={width:l.width,height:p,x:l.x,y:d?m-p:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Us(c)){var f=c.label,p=Le(f),d=mP(l),m=hP(p,d),h=dP(m,l,u);t.moveShape(f,h)}})}ye(fp,ee),fp.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function dP(e,t,n){var i=wa(e,t,n);return Bi(pi(i,e))}function hP(e,t){if(t.length){var n=gP(e,t);return pp(e,n)}}function mP(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 gP(e,t){var n=t.map(function(r){return{line:r,distance:_g(e,r)}}),i=di(n,"distance");return i[0].line}function yP(e,t,n,i){return Ag(e,t,n,i).point}function dp(e,t){ee.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=V({},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),yP(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),f=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,f)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),f=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,f)})}),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],f={x:l.x+c.x,y:l.y+c.y},p=[].concat(u.waypoints.slice(0,-1),[f]);t.updateWaypoints(u,p)}),a.forEach(function(u){var l=u.waypoints[0],f={x:l.x+c.x,y:l.y+c.y},p=[].concat([f],u.waypoints.slice(1));t.updateWaypoints(u,p)})})}ye(dp,ee),dp.$inject=["eventBus","modeling"];function lc(e,t,n){var i=fc(e),r=Ig(i,t),o=i[0];return r.length?r[r.length-1]:wa(o.original||o,n,t)}function pc(e,t,n){var i=fc(e),r=Ig(i,t),o=i[i.length-1];return r.length?r[0]:wa(o.original||o,n,t)}function hp(e,t,n){var i=fc(e),r=Lg(t,n),o=i[0];return wa(o.original||o,r,t)}function mp(e,t,n){var i=fc(e),r=Lg(t,n),o=i[i.length-1];return wa(o.original||o,r,t)}function Lg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function fc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Ig(e,t){var n=pn(e,bP);return Ye(n,function(i){return vP(i,t)})}function vP(e,t){return rn(t,e,1)==="intersect"}function bP(e){return e.original||e}function gp(e,t){ee.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(xP(i,r)){var o=_P(i);o.incoming.forEach(function(a){var s=pc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=lc(a,r,i);t.reconnectStart(a,r,s)})}},!0)}gp.$inject=["eventBus","modeling"],ye(gp,ee);function xP(e,t){return E(e,"bpmn:Participant")&&Xe(e)&&E(t,"bpmn:Participant")&&!Xe(t)}function _P(e){var t=sa([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){E(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){E(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const wP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Bg(e){const t=te(e);if(!E(t,"bpmn:BoundaryEvent")&&!(E(t,"bpmn:StartEvent")&&gn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:wP.some(i=>E(n[0],i))}function Ng(e){return E(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function yp(e,t){e.invoke(ee,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Bg(r))return;const a=Ng(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=te(i).get(a),u=te(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}yp.$inject=["injector","modeling"],ye(yp,ee);function vp(e,t){ee.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Qe(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ye(vp,ee),vp.$inject=["eventBus","modeling"];function bp(e,t,n){ee.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(!(!E(o,"bpmn:SequenceFlow")||!E(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=EP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ye(bp,ee),bp.$inject=["eventBus","bpmnRules","modeling"];function Co(e){return e.original||e}function EP(e,t){var n=up(Co(e[e.length-2]),Co(e[e.length-1]),Co(t[1]),Co(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Co(e[0]),Co(t[t.length-1])]}function xp(e,t){ee.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;E(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)}xp.$inject=["eventBus","modeling"],ye(xp,ee);function _p(e,t,n,i){ee.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,f=c.parent;if(f){var p,d;E(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(p="bpmn:MessageFlow")),E(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(u,l,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,f=u.newSource||l.source,p=u.newTarget||l.target,d,m;d=n.canConnect(f,p),!(!d||d.type===l.type)&&(m=t.connect(f,p,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=m,r&&s(l,m))}function s(c,u){var l=r.context(),f=l&&l.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;$(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,f=u.element,p=f.businessObject,d;l.default&&(d=ht(f.outgoing,oo({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}ye(_p,ee),_p.$inject=["eventBus","modeling","bpmnRules","injector"];function dc(e,t,n,i,r,o){i.invoke(ee,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=kn(u,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);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=[];$(s.closure.topLevel,function(p){gn(p)?l=l.concat(p.children):l=l.concat(p)}),l.length===1&&u&&(c=u);var f=t.canReplace(l,c);f&&this._replaceElements(l,f.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,f;l&&l.length&&(f=t.canReplace(l,u),this._replaceElements(l,f.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})})}ye(dc,ee),dc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;$(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)},dc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var SP=1500,RP={width:140,height:120},wp={width:300,height:60},Ep={width:60,height:300},hc={width:300,height:150},mc={width:150,height:300},$g={width:140,height:120},Fg={width:100,height:40};function jg(e){e.on("resize.start",SP,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(E(i,"bpmn:Lane")||E(i,"bpmn:Participant"))&&(n.resizeConstraints=MP(i,r,o)),E(i,"bpmn:SubProcess")&&Xe(i)&&(n.minDimensions=$g),E(i,"bpmn:TextAnnotation")&&(n.minDimensions=Fg)})}jg.$inject=["eventBus"];var lr=Math.abs,CP=Math.min,PP=Math.max;function Hg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Po(e,t,n){return Hg(e,t,n,CP)}function Ao(e,t,n){return Hg(e,t,n,PP)}var AP={top:20,left:50,right:20,bottom:20},TP={top:50,left:20,right:20,bottom:20};function MP(e,t,n){var i=Jn(e),r=!0,o=!0,a=oc(i,[i]),s=Te(e),c={},u={},l=Qt(e),f=l?wp:Ep;/n/.test(t)?u.top=s.bottom-f.height:/e/.test(t)?u.right=s.left+f.width:/s/.test(t)?u.bottom=s.top+f.height:/w/.test(t)&&(u.left=s.right-f.width),a.forEach(function(m){var h=Te(m);l?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&lr(s.top-h.bottom)<10&&Ao(c,"top",h.top+f.height),lr(s.top-h.top)<5&&Po(u,"top",h.bottom-f.height)),/e/.test(t)&&(n&&lr(s.right-h.left)<10&&Po(c,"right",h.right-f.width),lr(s.right-h.right)<5&&Ao(u,"right",h.left+f.width)),/s/.test(t)&&(n&&lr(s.bottom-h.top)<10&&Po(c,"bottom",h.bottom-f.height),lr(s.bottom-h.bottom)<5&&Ao(u,"bottom",h.top+f.height)),/w/.test(t)&&(n&&lr(s.left-h.right)<10&&Ao(c,"left",h.left+f.width),lr(s.left-h.left)<5&&Po(u,"left",h.right-f.width))});var p=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(E(m,"bpmn:FlowElement")||E(m,"bpmn:Artifact"))}),d=l?AP:TP;return p.forEach(function(m){var h=Te(m);/n/.test(t)&&(!l||r)&&Po(u,"top",h.top-d.top),/e/.test(t)&&(l||o)&&Ao(u,"right",h.right+d.right),/s/.test(t)&&(!l||o)&&Ao(u,"bottom",h.bottom+d.bottom),/w/.test(t)&&(l||r)&&Po(u,"left",h.left-d.left)}),{min:u,max:c}}function zg(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function To(e){return e.originalEvent||e.srcEvent}function Sp(e){zg(e),zg(To(e))}function jr(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 Gg(){return/mac/i.test(navigator.platform)}function Vg(e,t){return(To(e)||e).button===t}function pr(e){return Vg(e,0)}function kP(e){return Vg(e,1)}function Ea(e){var t=To(e)||e;return pr(e)?Gg()?t.metaKey:t.ctrlKey:!1}function gc(e){var t=To(e)||e;return pr(e)&&t.shiftKey}var Wg=1001;function Ug(e,t){e.on("resize.start",Wg+500,function(n){var i=n.context,r=i.shape;(E(r,"bpmn:Lane")||E(r,"bpmn:Participant"))&&(i.balanced=!Ea(n))}),e.on("resize.end",Wg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(E(r,"bpmn:Lane")||E(r,"bpmn:Participant"))return o&&(a=_m(a),t.resizeLane(r,a,i.balanced)),!1})}Ug.$inject=["eventBus","modeling"];var OP=500;function Rp(e,t,n,i,r){n.invoke(ee,this);function o(l){return We(l,["bpmn:ReceiveTask","bpmn:SendTask"])||DP(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var f=e.getDefinitions(),p=f.get("rootElements");return!!ht(p,oo({id:l.id}))}function s(l){if(E(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(E(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(E(l,"bpmn:MessageEventDefinition"))return"messageRef";if(E(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(We(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var f=l.get("eventDefinitions"),p=f[0];return p.get(s(p))}function u(l,f){if(We(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",f);var p=l.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.shape||l.element;if(o(f)){var p=te(f),d=c(p),m;d&&!a(d)&&(m=e.getDefinitions().get("rootElements"),Ot(m,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");Mt(p,f)}},!0),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,p=l.element;if(!(p.labelTarget||!o(p))){var d=te(p),m=c(d);m&&(f.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",OP,function(l){var f=l.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(p,d),delete f.referencedRootElement)})}Rp.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ye(Rp,ee);function DP(e,t){return De(t)||(t=[t]),Xi(t,function(n){return xo(e,n)})}var Yg=Math.max;function qg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return $(n,function(a){var s=a.id;E(a,"bpmn:Participant")&&(o[s]=IP(a,i,r)),E(a,"bpmn:Lane")&&(o[s]=Qt(a)?wp:Ep),E(a,"bpmn:SubProcess")&&Xe(a)&&(o[s]=$g),E(a,"bpmn:TextAnnotation")&&(o[s]=Fg),E(a,"bpmn:Group")&&(o[s]=RP)}),o})}qg.$inject=["eventBus"];function LP(e){return e==="x"}function IP(e,t,n){var i=Qt(e);if(!$P(e))return i?hc:mc;var r=LP(t),o={};return r?i?o=hc:o={width:NP(e,n,r),height:mc.height}:i?o={width:hc.width,height:BP(e,n,r)}:o=mc,o}function BP(e,t,n){var i;return i=FP(e,t,n),Yg(hc.height,i)}function NP(e,t,n){var i;return i=jP(e,t,n),Yg(mc.width,i)}function $P(e){return!!ur(e).length}function FP(e,t,n){var i=ur(e),r;return r=Cp(i,t,n),e.height-r.height+wp.height}function jP(e,t,n){var i=ur(e),r;return r=Cp(i,t,n),e.width-r.width+Ep.width}function Cp(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=ur(r),o.length?Cp(o,t,n):r}var Kg="_plane";function Xg(e){var t=e.id;return HP(t)}function Ei(e){var t=e.id;return E(e,"bpmn:SubProcess")?Zg(t):t}function Hr(e){return Zg(e)}function yc(e){var t=Qe(e);return E(t,"bpmndi:BPMNPlane")}function Zg(e){return e+Kg}function HP(e){return e.replace(new RegExp(Kg+"$"),"")}var Qg=400,zP=600,Jg={x:180,y:160};function ji(e,t,n,i,r,o,a){ee.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(f){return E(f,"bpmn:SubProcess")&&!Xe(f)}function u(f){var p=f.shape,d=f.newRootElement,m=te(p);d=s._addDiagram(d||m),f.newRootElement=e.addRootElement(d)}function l(f){var p=f.shape,d=te(p);s._removeDiagram(d);var m=f.newRootElement=a.get(Ei(d));e.removeRootElement(m)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;$(p,function(d){if(c(d)){var m=a.get(Ei(d));if(!(!m||!d.children||!d.children.length)){var h=ey(d);s._showRecursively(h),s._moveChildrenToShape(h,m)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!E(p,"bpmn:SubProcess")||!Xe(p)||$(da([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(Ei(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(Ei(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,m=e.findRoot(Ei(p));if(!(!d||!m)){var h=d.children;n.moveElements(h,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(E(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,g=d.id;if(h!==g){if(yc(p)){a.updateId(p,Hr(g)),a.updateId(h,g);return}var y=a.get(Hr(h));y&&a.updateId(Hr(h),Hr(g))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(E(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,g=d.id;if(h!==g){if(yc(p)){a.updateId(p,Hr(h)),a.updateId(g,h);return}var y=a.get(Hr(g));y&&a.updateId(y,Hr(h))}}},!0),t.on("element.changed",function(f){var p=f.element;if(yc(p)){var d=p,m=a.get(Xg(d));!m||m===d||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",Qg,function(f){var p=f.shape;E(p,"bpmn:SubProcess")&&(Xe(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",Qg,function(f){var p=f.shape;E(p,"bpmn:SubProcess")&&(Xe(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",zP,function(f){var p=f.shape;if(E(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(Xe(p))s._moveChildrenToShape(d.children.slice(),p),$(da(p.children),h=>{n.moveShape(h.annotation,{x:0,y:0},p.parent),$(h.associations,g=>{n.moveConnection(g,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var m=ey(p);s._moveChildrenToShape(m,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var m=Ei(p),h=a.get(m);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,m=f.elements,h=d.parent,g=E(Qe(h),"bpmndi:BPMNPlane");if(g){var y=Xg(h),v=ht(m,function(b){return b.id===y});v&&(p.parent=v.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}ye(ji,ee),ji.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=Bt(i),o;if(!t.x)o={x:Jg.x-r.x,y:Jg.y-r.y};else{var a=Le(t),s=Le(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},ji.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Vm(e).map(i=>i.annotation));n.size&&$(da(e.children),i=>{n.has(i.annotation)&&$(i.associations,r=>{t.removeConnection(r)})})},ji.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},ji.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},ji.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:Ei(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},ji.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=ht(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},ji.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function GP(e){var t=[];return $(da(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function ey(e){return e.children.slice().concat(GP(e.children)).concat(VP(e))}function VP(e){return kl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Pp(e,t){e.invoke(ee,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!E(r,"bpmn:SubProcess")||E(r,"bpmn:AdHocSubProcess")||!(E(i,"bpmn:Task")||E(i,"bpmn:CallActivity"))||!Xe(r))){var o=WP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Pp.$inject=["injector","modeling"],ye(Pp,ee);function WP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Ap(e,t){ee.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;E(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&&E(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(!(!E(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,qn(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}}})}ye(Ap,ee),Ap.$inject=["eventBus","textRenderer"];function Tp(e,t){ee.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Xe(i))return;var r=sa(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();$(s,function(u){o(u,!0)}),$(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||E(a,"bpmn:Association")&&(E(a.source,"bpmn:TextAnnotation")||E(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Le(i)):t.reconnectStart(a,i,Le(i)))}},!0)}ye(Tp,ee),Tp.$inject=["eventBus","modeling"];var Mp=500;function kp(e,t,n){ee.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,f;return l=UP(c).concat([a]),f=cg(l),f?(u.width=Math.max(f.width,u.width),u.height=Math.max(f.height,u.height),u.x=f.x+(f.width-u.width)/2,u.y=f.y+(f.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"],Mp,function(a){var s=a.context,c=s.shape;E(c,"bpmn:SubProcess")&&(c.collapsed?Qe(c).isExpanded=!1:(i(c.children),Qe(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Mp,function(a){var s=a.context,c=s.shape;c.collapsed?Qe(c).isExpanded=!1:Qe(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Mp,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"})})}ye(kp,ee),kp.$inject=["eventBus","elementFactory","modeling"];function UP(e){return e.filter(function(t){return!t.hidden})}function Op(e,t,n,i){t.invoke(ee,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Ge(a)||(E(a,"bpmn:Participant")&&Xe(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;E(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}ye(Op,ee),Op.$inject=["canvas","injector","moddle","modeling"];function Dp(e,t){ee.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;YP(r,o)&&t.updateProperties(o,{default:null})})}ye(Dp,ee),Dp.$inject=["eventBus","modeling"];function YP(e,t){if(!E(e,"bpmn:SequenceFlow"))return!1;var n=te(t),i=te(e);return n.get("default")===i}var qP=500,KP=5e3,ty=["shape.create","shape.delete","shape.move","shape.resize"],ny=[...ty,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Lp(e,t){ee.call(this,e);var n;function i(){return n=n||new XP,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(ny,KP,function(){i()}),this.postExecuted(ny,qP,function(){o()}),this.preExecute(ty,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(E(c,"bpmn:Lane")&&u.addLane(c),E(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}Lp.$inject=["eventBus","modeling"],ye(Lp,ee);function XP(){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 ZP=500,QP=5e3,iy=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],ry=[...iy,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Ip(e,t){ee.call(this,e);var n;function i(){return n=n||new JP,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(ry,QP,function(){i()}),this.postExecuted(ry,ZP,function(){o()}),this.preExecute(iy,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(E(s,"bpmn:FlowElement")&&c.addFlowElement(s),E(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;E(s,"bpmn:Group")&&r().addGroup(s)})}Ip.$inject=["eventBus","modeling"],ye(Ip,ee);function JP(){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 Bp(e,t){ee.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)eA(o)&&!nA(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ye(Bp,ee),Bp.$inject=["eventBus","modeling"];function eA(e){const t=te(e);return t&&t.isForCompensation}function tA(e){return e&&E(e,"bpmn:BoundaryEvent")&&xo(e,"bpmn:CompensateEventDefinition")}function nA(e){return e.incoming.filter(n=>tA(n.source)).length>0}const iA={__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",Vl],appendBehavior:["type",Wl],associationBehavior:["type",Yl],attachEventBehavior:["type",Qs],artifactBehavior:["type",Ul],boundaryEventBehavior:["type",ql],categoryRootElementReferenceBehavior:["type",Kl],compensateBoundaryEventBehaviour:["type",Xl],createBehavior:["type",Zl],createDataObjectBehavior:["type",Ql],createParticipantBehavior:["type",tp],dataInputAssociationBehavior:["type",np],dataStoreBehavior:["type",ip],deleteLaneBehavior:["type",rp],detachEventBehavior:["type",ac],dropOnFlowBehavior:["type",ap],eventBasedGatewayBehavior:["type",sp],fixHoverBehavior:["type",mg],groupBehavior:["type",cp],importDockingFix:["type",yg],isHorizontalFix:["type",lp],labelBehavior:["type",fp],layoutConnectionBehavior:["type",dp],messageFlowBehavior:["type",gp],nonInterruptingBehavior:["type",yp],removeElementBehavior:["type",bp],removeEmbeddedLabelBoundsBehavior:["type",vp],removeParticipantBehavior:["type",xp],replaceConnectionBehavior:["type",_p],replaceElementBehaviour:["type",dc],resizeBehavior:["type",jg],resizeLaneBehavior:["type",Ug],rootElementReferenceBehavior:["type",Rp],spaceToolBehavior:["type",qg],subProcessPlaneBehavior:["type",ji],subProcessStartEventBehavior:["type",Pp],textAnnotationBehavior:["type",Ap],toggleCollapseConnectionBehaviour:["type",Tp],toggleElementCollapseBehaviour:["type",kp],unclaimIdBehavior:["type",Op],unsetDefaultFlowBehavior:["type",Dp],updateFlowNodeRefsBehavior:["type",Lp],updateCategoryValueRefsBehavior:["type",Ip],setCompensationActivityAfterPasteBehavior:["type",Bp]};function Np(e){this._commandStack=e.get("commandStack",!1)}Np.$inject=["injector"],Np.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Si={__init__:["rules"],rules:["type",Np]};function ei(e){ee.call(this,e),this.init()}ei.$inject=["eventBus"],ye(ei,ee),ei.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)})},ei.prototype.init=function(){};function oy(e,t){var n=rn(e,t,-15);return n!=="intersect"?n:null}function an(e){ei.call(this,e)}ye(an,ei),an.$inject=["eventBus"],an.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return rA(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 bc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return bc(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 vy(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return pt(i)&&!xc(t,i)?!1:Mr(t,function(r){return pt(r)?bc(r.source,r.target,r):r.host?Sa(r,r.host,null,n):Hp(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 fy(a)&&!n.includes(a.host)})?!1:Sa(n,t,null,i)||gy(n,t,i)||yy(n,t)||xc(n,t)}),this.addRule("shape.create",function(e){return Hp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Sa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Ey(n,t)})},an.prototype.canConnectMessageFlow=_y,an.prototype.canConnectSequenceFlow=wy,an.prototype.canConnectDataAssociation=zp,an.prototype.canConnectAssociation=by,an.prototype.canConnectCompensationAssociation=xy,an.prototype.canMove=yy,an.prototype.canAttach=Sa,an.prototype.canReplace=gy,an.prototype.canDrop=Mo,an.prototype.canInsert=xc,an.prototype.canCreate=Hp,an.prototype.canConnect=bc,an.prototype.canResize=vy,an.prototype.canCopy=Ey;function rA(e){return $p(e)?null:We(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function $p(e){return!e||Ge(e)}function ay(e){do{if(E(e,"bpmn:Process"))return te(e);if(E(e,"bpmn:Participant"))return te(e).processRef||te(e)}while(e=e.parent)}function Fp(e){return E(e,"bpmn:TextAnnotation")}function jp(e){return E(e,"bpmn:Group")&&!e.labelTarget}function sy(e){return E(e,"bpmn:BoundaryEvent")&&Ri(e,"bpmn:CompensateEventDefinition")}function vc(e){return te(e).isForCompensation}function oA(e,t){var n=ay(e),i=ay(t);return n===i}function aA(e){return E(e,"bpmn:InteractionNode")&&!E(e,"bpmn:BoundaryEvent")&&(!E(e,"bpmn:Event")||E(e,"bpmn:ThrowEvent")&&ly(e,"bpmn:MessageEventDefinition"))}function sA(e){return E(e,"bpmn:InteractionNode")&&!vc(e)&&(!E(e,"bpmn:Event")||E(e,"bpmn:CatchEvent")&&ly(e,"bpmn:MessageEventDefinition"))&&!(E(e,"bpmn:BoundaryEvent")&&!Ri(e,"bpmn:MessageEventDefinition"))}function cy(e){for(var t=e;t=t.parent;){if(E(t,"bpmn:FlowElementsContainer"))return te(t);if(E(t,"bpmn:Participant"))return te(t).processRef}return null}function uy(e,t){var n=cy(e),i=cy(t);return n===i}function Ri(e,t){var n=te(e);return!!ht(n.eventDefinitions||[],function(i){return E(i,t)})}function ly(e,t){var n=te(e);return(n.eventDefinitions||[]).every(function(i){return E(i,t)})}function cA(e){return E(e,"bpmn:FlowNode")&&!E(e,"bpmn:EndEvent")&&!gn(e)&&!(E(e,"bpmn:IntermediateThrowEvent")&&Ri(e,"bpmn:LinkEventDefinition"))&&!sy(e)&&!vc(e)}function uA(e){return E(e,"bpmn:FlowNode")&&!E(e,"bpmn:StartEvent")&&!E(e,"bpmn:BoundaryEvent")&&!gn(e)&&!(E(e,"bpmn:IntermediateCatchEvent")&&Ri(e,"bpmn:LinkEventDefinition"))&&!vc(e)}function lA(e){return E(e,"bpmn:ReceiveTask")||E(e,"bpmn:IntermediateCatchEvent")&&(Ri(e,"bpmn:MessageEventDefinition")||Ri(e,"bpmn:TimerEventDefinition")||Ri(e,"bpmn:ConditionalEventDefinition")||Ri(e,"bpmn:SignalEventDefinition"))}function pA(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function py(e,t){var n=pA(t);return n.indexOf(e)!==-1}function bc(e,t,n){if($p(e)||$p(t))return null;if(!E(n,"bpmn:DataAssociation")){if(_y(e,t))return{type:"bpmn:MessageFlow"};if(wy(e,t))return{type:"bpmn:SequenceFlow"}}var i=zp(e,t);return i||(xy(e,t)?{type:"bpmn:Association",associationDirection:"One"}:by(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Mo(e,t){return Ge(e)||jp(e)?!0:E(t,"bpmn:Participant")&&!Xe(t)?!1:E(e,"bpmn:Participant")?E(t,"bpmn:Process")||E(t,"bpmn:Collaboration"):We(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:E(e,"bpmn:Lane")?E(t,"bpmn:Participant")||E(t,"bpmn:Lane"):E(e,"bpmn:BoundaryEvent")&&!fA(e)?!1:E(e,"bpmn:FlowElement")&&!E(e,"bpmn:DataStoreReference")?E(t,"bpmn:FlowElementsContainer")?Xe(t):We(t,["bpmn:Participant","bpmn:Lane"]):E(e,"bpmn:DataStoreReference")&&E(t,"bpmn:Collaboration")?Xi(te(t).get("participants"),function(n){return!!n.get("processRef")}):We(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?We(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):E(e,"bpmn:MessageFlow")?E(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function fA(e){return te(e).cancelActivity&&(dy(e)||hy(e))}function fy(e){return!Ge(e)&&E(e,"bpmn:BoundaryEvent")}function dA(e){return E(e,"bpmn:Lane")}function hA(e){return fy(e)||E(e,"bpmn:IntermediateThrowEvent")&&dy(e)?!0:E(e,"bpmn:IntermediateCatchEvent")&&hy(e)}function dy(e){var t=te(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function hy(e){return my(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function my(e,t){return t.some(function(n){return Ri(e,n)})}function mA(e){return E(e,"bpmn:ReceiveTask")&&ht(e.incoming,function(t){return E(t.source,"bpmn:EventBasedGateway")})}function Sa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Ge(r)||!hA(r)||gn(t)||!E(t,"bpmn:Activity")||vc(t)||i&&!oy(i,t)||mA(t)?!1:"attach"}function gy(e,t,n){if(!t)return!1;var i={replacements:[]};return $(e,function(r){gn(t)||E(r,"bpmn:StartEvent")&&r.type!=="label"&&Mo(r,t)&&(SR(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(RR(r)||CR(r)||PR(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),my(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&E(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),E(t,"bpmn:Transaction")||Ri(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(E(r,"bpmn:EndEvent")&&Mo(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),E(r,"bpmn:BoundaryEvent")&&Sa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function yy(e,t){return Xi(e,dA)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Mo(n,t)})}function Hp(e,t,n,i){return t?Ge(e)||jp(e)?!0:Mo(e,t)||xc(e,t):!1}function vy(e,t,n){return E(e,"bpmn:SubProcess")?Xe(e)&&(!t||t.width>=100&&t.height>=80):E(e,"bpmn:Lane")||E(e,"bpmn:Participant")?!0:Fp(e)?n?n==="e"||n==="w":!0:jp(e)?!0:Ge(e)?n?n==="e"||n==="w":!0:!1}function gA(e,t){var n=Fp(e),i=Fp(t);return(n||i)&&n!==i}function by(e,t){return py(t,e)||py(e,t)?!1:gA(e,t)?!0:!!zp(e,t)}function xy(e,t){return uy(e,t)&&sy(e)&&E(t,"bpmn:Activity")&&!vA(t,e)&&!gn(t)}function _y(e,t){return Ry(e)&&!Ry(t)?!1:aA(e)&&sA(t)&&!oA(e,t)}function wy(e,t){return cA(e)&&uA(t)&&uy(e,t)&&!(E(e,"bpmn:EventBasedGateway")&&!lA(t))}function zp(e,t){return We(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&We(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:We(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&We(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function xc(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:We(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ge(t)&&E(e,"bpmn:FlowNode")&&!E(e,"bpmn:BoundaryEvent")&&Mo(e,t.parent)}function Gp(e,t){return e&&t&&e.indexOf(t)!==-1}function Ey(e,t){return Ge(t)?!0:!(E(t,"bpmn:Lane")&&!Gp(e,t.parent)||E(t,"bpmn:MessageFlow")&&!yA(e,t))}function yA(e,t){var n=Sy(t.source),i=Sy(t.target);return Gp(e,n)&&Gp(e,i)}function Sy(e){for(;e;e=e.parent)if(E(e,"bpmn:Participant"))return e;return null}function Ry(e){return Eo(e,"bpmn:Process")||Eo(e,"bpmn:Collaboration")}function vA(e,t){return e.attachers.includes(t)}const bA={__depends__:[Si],__init__:["bpmnRules"],bpmnRules:["type",an]};var xA=2e3;function Cy(e,t){e.on("saveXML.start",xA,n);function n(){var i=t.getRootElements();$(i,function(r){var o=Qe(r),a,s;a=sa([r]),a=Ye(a,function(c){return c!==r&&!c.labelTarget}),s=pn(a,Qe),o.set("planeElement",s)})}}Cy.$inject=["eventBus","canvas"];const _A={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Cy]};function _c(e){ee.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)})}_c.prototype.getOrdering=function(e,t){return null},ye(_c,ee);function Vp(e,t){_c.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=ht(n,function(c){return We(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&&!We(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||E(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=Ed(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}Vp.$inject=["eventBus","canvas"],ye(Vp,_c);const wA={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Vp]};function Ra(){}Ra.prototype.get=function(){return this._data},Ra.prototype.set=function(e){this._data=e},Ra.prototype.clear=function(){var e=this._data;return delete this._data,e},Ra.prototype.isEmpty=function(){return!this._data};const EA={clipboard:["type",Ra]};var Py=1500;function Ay(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",Py,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Py,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=jr(a),c=document.elementFromPoint(s.x,s.y),SA(c)}}Ay.$inject=["elementRegistry","eventBus","injector"];function SA(e){return Lr(e,"svg, .djs-element",!0)}const RA={__init__:["hoverFix"],hoverFix:["type",Ay]};function CA(e){return!0}function wc(e){return pr(e)||kP(e)}var Ty=500;function My(e,t,n){var i=this;function r(T,I,k){if(!s(T,I)){var L,z,ae;k?z=t.getGraphics(k):(L=I.delegateTarget||I.target,L&&(z=L,k=t.get(z))),!(!z||!k)&&(ae=e.fire(T,{element:k,gfx:z,originalEvent:I}),ae===!1&&(I.stopPropagation(),I.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,I){var k=u[T]||pr;return!k(I)}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":CA,"element.mousedown":wc,"element.mouseup":wc,"element.click":wc,"element.dblclick":wc};function l(T,I,k){var L=c[T];if(!L)throw new Error("unmapped DOM event name <"+T+">");return r(L,I,k)}var f="svg, .djs-element";function p(T,I,k,L){var z=o[k]=function(ae){r(k,ae)};L&&(u[k]=L),z.$delegate=Dn.bind(T,f,I,z)}function d(T,I,k){var L=a(k);L&&Dn.unbind(T,I,L.$delegate)}function m(T){$(c,function(I,k){p(T,k,I)})}function h(T){$(c,function(I,k){d(T,k,I)})}e.on("canvas.destroy",function(T){h(T.svg)}),e.on("canvas.init",function(T){m(T.svg)}),e.on(["shape.added","connection.added"],function(T){var I=T.element,k=T.gfx;e.fire("interactionEvents.createHit",{element:I,gfx:k})}),e.on(["shape.changed","connection.changed"],Ty,function(T){var I=T.element,k=T.gfx;e.fire("interactionEvents.updateHit",{element:I,gfx:k})}),e.on("interactionEvents.createHit",Ty,function(T){var I=T.element,k=T.gfx;i.createDefaultHit(I,k)}),e.on("interactionEvents.updateHit",function(T){var I=T.element,k=T.gfx;i.updateDefaultHit(I,k)});var g=C("djs-hit djs-hit-stroke"),y=C("djs-hit djs-hit-click-stroke"),v=C("djs-hit djs-hit-all"),b=C("djs-hit djs-hit-no-move"),x={all:v,"click-stroke":y,stroke:g,"no-move":b};function C(T,I){return I=V({stroke:"white",strokeWidth:15},I||{}),n.cls(T,["no-fill","no-border"],I)}function P(T,I){var k=x[I];if(!k)throw new Error("invalid hit type <"+I+">");return ve(T,k),T}function D(T,I){Fe(T,I)}this.removeHits=function(T){var I=Ds(".djs-hit",T);$(I,Vt)},this.createDefaultHit=function(T,I){var k=T.waypoints,L=T.isFrame,z;return k?this.createWaypointsHit(I,k):(z=L?"stroke":"all",this.createBoxHit(I,z,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,I){var k=aa(I);return P(k,"stroke"),D(T,k),k},this.createBoxHit=function(T,I,k){k=V({x:0,y:0},k);var L=Ce("rect");return P(L,I),ve(L,k),D(T,L),L},this.updateDefaultHit=function(T,I){var k=ut(".djs-hit",I);if(k)return T.waypoints?Ml(k,T.waypoints):ve(k,{width:T.width,height:T.height}),k},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}My.$inject=["eventBus","elementRegistry","styles"];const Ec={__init__:["interactionEvents"],interactionEvents:["type",My]};function ko(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)})}ko.$inject=["eventBus","canvas"],ko.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()})}},ko.prototype.get=function(){return Array.from(this._selectedElements)},ko.prototype.isSelected=function(e){return this._selectedElements.has(e)},ko.prototype.select=function(e,t){var n=this.get();De(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?$(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var ky="hover",Oy="selected";function Dy(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,ky)}),t.on("element.out",function(r){i(r.element,ky)}),t.on("selection.changed",function(r){function o(u){i(u,Oy)}function a(u){n(u,Oy)}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)})}Dy.$inject=["canvas","eventBus"];function Ly(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;De(u)?t.select(u):t.select(s.filter(PA))}}),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=ht(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(pr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=gc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Ly.$inject=["eventBus","selection","canvas","elementRegistry"];function PA(e){return!e.hidden}const ti={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ec],selection:["type",ko],selectionVisuals:["type",Dy],selectionBehavior:["type",Ly]};var AA=/^djs-cursor-.*$/;function Sc(e){var t=Et(document.body);t.removeMatching(AA),e&&t.add("djs-cursor-"+e)}function Iy(){Sc(null)}var TA=5e3;function By(e,t){t=t||"element.click";function n(){return!1}return e.once(t,TA,n),function(){e.off(t,n)}}var MA=["c","C"],kA=["v","V"],OA=["d","D"],DA=["x","X"],LA=["y","Y"],Ny=["z","Z"];function IA(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Bn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Wt(e,t){return e=De(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Wp(e){return e.shiftKey}function BA(e){return Bn(e)&&Wt(MA,e)}function NA(e){return Bn(e)&&Wt(kA,e)}function $A(e){return Bn(e)&&Wt(OA,e)}function FA(e){return Bn(e)&&Wt(DA,e)}function jA(e){return Bn(e)&&!Wp(e)&&Wt(Ny,e)}function HA(e){return Bn(e)&&(Wt(LA,e)||Wt(Ny,e)&&Wp(e))}var Oo=Math.round,$y="djs-drag-active";function zr(e){e.preventDefault()}function zA(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function GA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Fy(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),C=t._container.getBoundingClientRect();return{x:x.x+(b.x-C.left)/x.scale,y:x.y+(b.y-C.top)/x.scale}}function s(b,x){x=x||o;var C=e.createEvent(V({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,C)===!1?!1:e.fire(x.prefix+"."+b,C)}function c(b){var x=b.filter(function(C){return i.get(C.id)});x.length&&n.select(x)}function u(b,x){var C=o.payload,P=o.displacement,D=o.globalStart,T=jr(b),I=pi(T,D),k=o.localStart,L=a(T),z=pi(L,k);if(!o.active&&(x||GA(I)>o.threshold)){if(V(C,{x:Oo(k.x+P.x),y:Oo(k.y+P.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return g();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&Sc(o.cursor),t.addMarker(t.getRootElement(),$y)}Sp(b),o.active&&(V(C,{x:Oo(L.x+P.x),y:Oo(L.y+P.y),dx:Oo(z.x),dy:Oo(z.y)},{originalEvent:b}),s("move"))}function l(b){var x,C=!0;o.active&&(b&&(o.payload.originalEvent=b,Sp(b)),C=s("end")),C===!1&&s("rejected"),x=y(C!==!0),s("ended",x)}function f(b){Wt("Escape",b)&&(zr(b),g())}function p(b){var x;o.active&&(x=By(e),setTimeout(x,400),zr(b)),l(b)}function d(b){u(b)}function m(b){var x=o.payload;x.hoverGfx=b.gfx,x.hover=b.element,s("hover")}function h(b){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function g(b){var x;if(o){var C=o.active;C&&s("cancel"),x=y(b),C&&s("canceled",x)}}function y(b){var x,C;s("cleanup"),Iy(),o.trapClick?C=p:C=l,Ne.unbind(document,"mousemove",u),Ne.unbind(document,"dragstart",zr),Ne.unbind(document,"selectstart",zr),Ne.unbind(document,"mousedown",C,!0),Ne.unbind(document,"mouseup",C,!0),Ne.unbind(document,"keyup",f),Ne.unbind(document,"touchstart",d,!0),Ne.unbind(document,"touchcancel",g,!0),Ne.unbind(document,"touchmove",u,!0),Ne.unbind(document,"touchend",l,!0),e.off("element.hover",m),e.off("element.out",h),t.removeMarker(t.getRootElement(),$y);var P=o.payload.previousSelection;return b!==!1&&P&&!n.get().length&&c(P),x=o,o=null,x}function v(b,x,C,P){o&&g(!1),typeof x=="string"&&(P=C,C=x,x=null),P=V({},r,P||{});var D=P.data||{},T,I,k,L,z;if(P.trapClick?L=p:L=l,b?(T=To(b)||b,I=jr(b),Sp(b),T.type==="dragstart"&&zr(T)):(T=null,I={x:0,y:0}),k=a(I),x||(x=k),z=zA(T),o=V({prefix:C,data:D,payload:{},globalStart:I,displacement:pi(x,k),localStart:k,isTouch:z},P),P.manual||(z?(Ne.bind(document,"touchstart",d,!0),Ne.bind(document,"touchcancel",g,!0),Ne.bind(document,"touchmove",u,!0),Ne.bind(document,"touchend",l,!0)):(Ne.bind(document,"mousemove",u),Ne.bind(document,"dragstart",zr),Ne.bind(document,"selectstart",zr),Ne.bind(document,"mousedown",L,!0),Ne.bind(document,"mouseup",L,!0)),Ne.bind(document,"keyup",f),e.on("element.hover",m),e.on("element.out",h)),s("init")===!1)return g(),!1;P.autoActivate&&u(b,!0)}e.on("diagram.destroy",g),this.init=v,this.move=u,this.hover=m,this.out=h,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(b){V(r,b)}}Fy.$inject=["eventBus","canvas","selection","elementRegistry"];const Hi={__depends__:[RA,ti],dragging:["type",Fy]};function Do(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Do.prototype.next=function(){return this._prefix+ ++this._counter};const VA=new Do("ps");var WA=["marker-start","marker-mid","marker-end"],UA=["circle","ellipse","line","path","polygon","polyline","path","rect"];function fr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}fr.$inject=["elementRegistry","eventBus","canvas","styles"],fr.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")},fr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},fr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Qh(n);return this._cloneMarkers(Nr(r),i),ve(r,this._styles.cls(i,[])),Fe(t,r),ve(r,"data-preview-support-element-id",e.id),r},fr.prototype.addFrame=function(e,t){var n=Ce("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Fe(t,n),ve(n,"data-preview-support-element-id",e.id),n},fr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),XA(e)&&WA.forEach(function(r){if(ve(e,r)){var o=YA(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},fr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,VA.next()].join("-"),a=ut("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Qh(n);s.id=o,Ze(s).add(r);var c=ut(":scope > defs",e);c||(c=Ce("defs"),Fe(e,c)),Fe(c,s);var u=KA(s.id);ve(t,i,u)};function YA(e,t,n){var i=qA(ve(e,t));return ut("marker#"+i,n||document)}function qA(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function KA(e){return"url(#"+e+")"}function XA(e){return UA.indexOf(e.nodeName)!==-1}const Lo={__init__:["previewSupport"],previewSupport:["type",fr]};var ZA="drop-ok",jy="drop-not-ok",Hy="attach-ok",zy="new-parent",Gy="create",QA=2e3;function Vy(e,t,n,i,r){function o(c,u,l,f,p){if(!u)return!1;c=Ye(c,function(v){var b=v.labelTarget;return!v.parent&&!(Ge(v)&&c.indexOf(b)!==-1)});var d=ht(c,function(v){return!pt(v)}),m=!1,h=!1,g=!1;Uy(c)&&(m=r.allowed("shape.attach",{position:l,shape:d,target:u})),m||(Uy(c)?g=r.allowed("shape.create",{position:l,shape:d,source:f,target:u}):g=r.allowed("elements.create",{elements:c,position:l,target:u}));var y=p.connectionTarget;return g||m?(d&&f&&(h=r.allowed("connection.create",{source:y===f?d:f,target:y===f?f:d,hints:{targetParent:u,targetAttach:m}})),{attach:m,connect:h}):g===null||m===null?null:!1}function a(c,u){[Hy,ZA,jy,zy].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,f=c.hover,p=u.source,d=u.hints||{};if(!f){u.canExecute=!1,u.target=null;return}Wy(c);var m={x:c.x,y:c.y},h=u.canExecute=f&&o(l,f,m,p,d);f&&h!==null&&(u.target=f,h&&h.attach?a(f,Hy):a(f,h?zy:jy))}),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,f=u.shape,p=u.elements,d=u.target,m=u.canExecute,h=m&&m.attach,g=m&&m.connect,y=u.hints||{};if(m===!1||!d)return!1;Wy(c);var v={x:c.x,y:c.y};g?f=i.appendShape(l,f,v,d,{attach:h,connection:g===!0?{}:g,connectionTarget:y.connectionTarget}):(p=i.createElements(p,v,d,V({},y,{attach:h})),f=ht(p,function(b){return!pt(b)})),V(u,{elements:p,shape:f}),V(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===Gy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],QA,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){De(u)||(u=[u]);var f=ht(u,function(m){return!pt(m)});if(f){l=V({elements:u,hints:{},shape:f},l||{}),$(u,function(m){Be(m.x)||(m.x=0),Be(m.y)||(m.y=0)});var p=Ye(u,function(m){return!m.hidden}),d=Bt(p);$(u,function(m){pt(m)&&(m.waypoints=pn(m.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),V(m,{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2})}),t.init(c,Gy,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:u,context:l}})}}}Vy.$inject=["canvas","dragging","eventBus","modeling","rules"];function Wy(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 Uy(e){return e&&e.length===1&&!pt(e[0])}var JA=750;function Yy(e,t,n,i,r){function o(a){var s=Ce("g");ve(s,r.cls("djs-drag-group",["no-events"]));var c=Ce("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Nr(l),u)):(l=n._createContainer("shape",c),n.drawShape(Nr(l),u),on(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",JA,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var f;s?(l.parentNode||(f=e.getActiveLayer(),Fe(f,l)),on(l,a.x,a.y)):Vt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Vt(c)})}Yy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Rc={__depends__:[Hi,Lo,Si,ti],__init__:["create","createPreview"],create:["type",Vy],createPreview:["type",Yy]};function Up(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)})}Up.$inject=["eventBus"],Up.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||eT(0,0)};function eT(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 Ca={__init__:["mouse"],mouse:["type",Up]};var qy=2e3;function Nn(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,f=c.elementsSet;u.priority=1,u.id=l.id,f.has(l.parent)&&(u.parent=l.parent.id),tT(l)&&(u.priority=2,u.host=l.host.id),pt(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=nT(l)),Ge(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),$(["x","y","width","height"],function(p){Be(l[p])&&(u[p]=l[p])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",qy,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",qy,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;V(u,{createElementsBehavior:!1})})}Nn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Nn.prototype.copy=function(e,t={}){var n,i;return De(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(De(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Nn.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})}}},Nn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Nn.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},Nn.prototype._getElementIdsFromTree=function(e){var t={};return $(e,function(n){$(n,function(i){i.id&&(t[i.id]=!0)})}),t},Nn.prototype._paste=function(e,t,n,i){$(e,function(o){Be(o.x)||(o.x=0),Be(o.y)||(o.y=0)});var r=Bt(e);return $(e,function(o){pt(o)&&(o.waypoints=pn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),V(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,V({},i))},Nn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return $(e,function(o,a){o=di(o,"priority"),$(o,function(s){var c=V({},hi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(pt(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(Ge(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},Nn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(hi(e,["id"]));return t},Nn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(hi(e,["id"]));return t},Nn.prototype.createShape=function(e){var t=this._elementFactory.createShape(hi(e,["id"]));return t},Nn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(pt(e)&&(!n.has(e.source)||!n.has(e.target))||Ge(e)&&!n.has(e.labelTarget))},Nn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Ns(e);function s(f,p){return t.allowed("element.copy",{element:f,elements:p})}function c(f,p){var d=o.get(f);if(!d){var m={element:f,depth:p};r.push(m),o.set(f,m);return}if(d.depth<p){r=u(d,r);var h={element:d.element,depth:p};r.push(h),o.set(f,h)}}function u(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}Br(a,function(f,p,d){if(Ge(f))return;$(f.labels,function(g){c(g,d)});function m(g){g&&g.length&&$(g,function(y){$(y.labels,function(v){c(v,d)}),c(y,d)})}$([f.attachers,f.incoming,f.outgoing],m),c(f,d);var h=[];return f.children&&(h=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:h}),h}),e=pn(r,function(f){return f.element});var l=new Set(e);return r=pn(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:l}),f}),r=di(r,function(f){return f.descriptor.priority}),e=pn(r,function(f){return f.element}),$(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,l)){Xy(f.element,e),l.delete(f.element);return}if(!s(f.element,e)){Xy(f.element,e),l.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function tT(e){return!!e.host}function nT(e){return pn(e.waypoints,function(t){return t=Ky(t),t.original&&(t.original=Ky(t.original)),t})}function Ky(e){return V({},e)}function Xy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const iT={__depends__:[EA,Rc,Ca,Si],__init__:["copyPaste"],copyPaste:["type",Nn]};function Yp(e,t,n){De(n)||(n=[n]),$(n,function(i){Tr(e[i])||(t[i]=e[i])})}var qp=750;function Zy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",qp,function(c){var u=c.descriptor,l=c.element,f=te(l);if(Ge(l))return u;var p=u.businessObject=i(f,!0),d=u.di=i(Qe(l),!0);d.bpmnElement=p,Yp(p,u,"name"),Yp(d,u,"isExpanded"),f.default&&(u.default=f.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 f=te(c);return c.default&&(l[c.default]={element:f,property:"default"}),c.host&&(te(c).attachedToRef=te(u[c.host])),hi(l,kn(l,function(p,d,m){var h=d.element,g=d.property;return m===c.id&&(h.set(g,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,f=l.businessObject,p=l.di;if(Ge(l)){l.businessObject=te(u[l.labelTarget]),l.di=Qe(u[l.labelTarget]);return}f=l.businessObject=i(f),p=l.di=i(p),p.bpmnElement=f,Yp(l,f,["isExpanded","name"]),l.type=f.$type}),t.on("copyPaste.copyElement",qp,function(c){var u=c.descriptor,l=c.element;if(E(l,"bpmn:Participant")){var f=te(l);f.processRef&&(u.processRef=i(f.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;E(u,"bpmn:SubProcess")&&$(da(l),f=>{l.push(f.annotation)})}),t.on("copyPaste.pasteElement",qp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Zy.$inject=["bpmnFactory","eventBus","moddleCopy"];const rT=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],oT=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Pa(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 di(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Kt(r)&&r.$descriptor;if(a&&oT.includes(a))return o;if(a&&rT.includes(a)||a&&s&&!ht(s.properties,oo({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(E(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}Pa.$inject=["eventBus","bpmnFactory","moddle"],Pa.prototype.copyElement=function(e,t,n,i=!1){n&&!De(n)&&(n=[n]),n=n||Kp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(De(r)&&(n=r),$(n,o=>{let a;Mn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!zt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Pa.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 Kt(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):De(e)?kn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Kt(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},Pa.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 Kp(e,t){return kn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Qy={__depends__:[iT],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Zy],moddleCopy:["type",Pa]};var Jy=Math.round;function Xp(e,t){this._modeling=e,this._eventBus=t}Xp.$inject=["modeling","eventBus"],Xp.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=Jy(s+o/2),l=Jy(c+a/2),f=i.replaceShape(e,V({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function ev(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}ev.$inject=["selection","eventBus"];const aT={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",ev],replace:["type",Xp]};function sT(e,t,n){De(n)||(n=[n]),$(n,function(i){Tr(e[i])||(t[i]=e[i])})}var cT=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function uT(e,t){var n=e&&Mn(e,"collapsed")?e.collapsed:!Xe(e),i;return t&&(Mn(t,"collapsed")||Mn(t,"isExpanded"))?i=Mn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function tv(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,f=s.businessObject;if(Cc(f)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&uT(s,c))return i.toggleCollapse(s),s;var p=e.create(l),d={type:l,businessObject:p};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),sT(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var m=Kp(f.$descriptor),h=Kp(p.$descriptor,!0),g=lT(m,h);V(p,ui(c,cT));var y=Ye(g,function(x){return x==="eventDefinitions"?nv(s,c.eventDefinitionType):x==="loopCharacteristics"?!gn(p):Mn(p,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!gn(p):!0});if(p=n.copyElement(f,p,y),c.eventDefinitionType&&(nv(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),E(f,"bpmn:Activity")){if(Cc(f))d.isExpanded=Xe(s);else if(c&&Mn(c,"isExpanded")){d.isExpanded=c.isExpanded;var v=t.getDefaultSize(p,{isExpanded:d.isExpanded});d.width=v.width,d.height=v.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Xe(s)&&!E(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Cc(f)&&!Cc(p)&&(u.moveChildren=!1),E(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=Qt(s);Qe(s).isHorizontal||(Qe(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:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,We(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&We(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!E(f,"bpmn:BoundaryEvent")&&E(p,"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}tv.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Cc(e){return E(e,"bpmn:SubProcess")}function nv(e,t){var n=te(e);return t&&n.get("eventDefinitions").some(function(i){return E(i,t)})}function lT(e,t){return e.filter(function(n){return t.includes(n)})}const iv={__depends__:[Qy,aT,ti],bpmnReplace:["type",tv]};var pT=250;function Gr(e){this._eventBus=e,this._tools=[],this._active=null}Gr.$inject=["eventBus"],Gr.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)},Gr.prototype.isActive=function(e){return e&&this._active===e},Gr.prototype.length=function(e){return this._tools.length},Gr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Gr.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),$(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,pT,function(r){this._active&&(fT(r)||this.setActive(null))},this)};function fT(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Lr(t,'.group[data-group="tools"]')}const Pc={__depends__:[Hi],__init__:["toolManager"],toolManager:["type",Gr]};function dT(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 hT(e,t){var n=[],i=new Set(e);$(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;$(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 mT(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 Zp=Math.abs,gT=Math.round,zi={x:"width",y:"height"},rv="crosshair",dr={n:"top",w:"left",s:"bottom",e:"right"},yT=1500,Ac={n:"s",w:"e",s:"n",e:"w"},Tc=20;function ni(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",yT,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&av(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,f=u.direction,p=u.movingShapes,d=u.resizingShapes,m=u.start;if(u.initialized){av(c);var h={x:0,y:0};h[l]=gT(c["d"+l]),s.makeSpace(p,d,h,f,m),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}ni.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],ni.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:rv,data:{context:{reactivate:n}},trapClick:!1})},ni.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:rv,data:{context:{}}})},ni.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},ni.prototype.init=function(e,t){var n=Zp(e.dx)>Zp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Zp(i)<5)return!1;i<0&&(i*=-1),Ea(e)&&(i*=-1);var o=dT(n,i),a=this._canvas.getRootElement();!gc(e)&&e.hover&&(a=e.hover);var s=[...sa(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=vT(c,n,o,r,u);return V(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),Sc("resize-"+(n==="x"?"ew":"ns")),!0},ni.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function f(d){s.has(d)||(s.add(d),o.push(d));var m=d.label;m&&!s.has(m)&&(s.add(m),o.push(m))}function p(d){c.has(d)||(c.add(d),a.push(d))}return $(e,function(d){if(!(!d.parent||Ge(d))){if(pt(d)){l.push(d);return}var m=d[t],h=m+d[zi[t]];if(bT(d)&&(n>0&&Le(d)[t]>i||n<0&&Le(d)[t]<i)){u.push(d);return}if(n>0&&m>i||n<0&&h<i){f(d);return}if(m<i&&h>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),$(o,function(d){var m=d.attachers;m&&$(m,function(h){f(h)})}),$(u,function(d){var m=d.host;(s.has(m)||c.has(m))&&f(d)}),$(l,function(d){var m=d.source,h=d.target,g=d.label;(s.has(m)||c.has(m))&&(s.has(h)||c.has(h))&&g&&f(g)}),{movingShapes:o,resizingShapes:a}},ni.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},ni.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function ov(e){return{top:e.top-Tc,right:e.right+Tc,bottom:e.bottom+Tc,left:e.left-Tc}}function av(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Be(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Be(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Be(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Be(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function vT(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),f=new Set(a);return $(a,function(p){var d=p.attachers,m=p.children,h=Te(p),g=Ye(m,function(z){return!pt(z)&&!Ge(z)&&!l.has(z)&&!f.has(z)}),y=Ye(m,function(z){return!pt(z)&&!Ge(z)&&l.has(z)}),v,b,x,C=[],P=[],D,T,I,k;g.length&&(b=ov(Te(Bt(g))),v=i-h[dr[n]]+b[dr[n]],n==="n"?s.bottom=u=Be(u)?Math.min(u,v):v:n==="w"?s.right=u=Be(u)?Math.min(u,v):v:n==="s"?s.top=c=Be(c)?Math.max(c,v):v:n==="e"&&(s.left=c=Be(c)?Math.max(c,v):v)),y.length&&(x=ov(Te(Bt(y))),v=i-x[dr[Ac[n]]]+h[dr[Ac[n]]],n==="n"?s.bottom=u=Be(u)?Math.min(u,v):v:n==="w"?s.right=u=Be(u)?Math.min(u,v):v:n==="s"?s.top=c=Be(c)?Math.max(c,v):v:n==="e"&&(s.left=c=Be(c)?Math.max(c,v):v)),d&&d.length&&(d.forEach(function(z){l.has(z)?C.push(z):P.push(z)}),C.length&&(D=Te(Bt(C.map(Le))),T=h[dr[Ac[n]]]-(D[dr[Ac[n]]]-i)),P.length&&(I=Te(Bt(P.map(Le))),k=I[dr[n]]-(h[dr[n]]-i)),n==="n"?(v=Math.min(T||1/0,k||1/0),s.bottom=u=Be(u)?Math.min(u,v):v):n==="w"?(v=Math.min(T||1/0,k||1/0),s.right=u=Be(u)?Math.min(u,v):v):n==="s"?(v=Math.max(T||-1/0,k||-1/0),s.top=c=Be(c)?Math.max(c,v):v):n==="e"&&(v=Math.max(T||-1/0,k||-1/0),s.left=c=Be(c)?Math.max(c,v):v));var L=r&&r[p.id];L&&(n==="n"?(v=i+p[zi[t]]-L[zi[t]],s.bottom=u=Be(u)?Math.min(u,v):v):n==="w"?(v=i+p[zi[t]]-L[zi[t]],s.right=u=Be(u)?Math.min(u,v):v):n==="s"?(v=i-p[zi[t]]+L[zi[t]],s.top=c=Be(c)?Math.max(c,v):v):n==="e"&&(v=i-p[zi[t]]+L[zi[t]],s.left=c=Be(c)?Math.max(c,v):v))}),s}}function bT(e){return!!e.host}var Qp="djs-dragging",sv="djs-resizing",xT=250,Mc=Math.max;function cv(e,t,n,i,r){function o(a,s){$(a,function(c){r.addDragger(c,s),n.addMarker(c,Qp)})}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=Ce("g");ve(l,i.cls("djs-crosshair-group",["no-events"])),Fe(s,l);var f=Ce("path");ve(f,"d",u.x),Ze(f).add("djs-crosshair"),Fe(l,f);var p=Ce("path");ve(p,"d",u.y),Ze(p).add("djs-crosshair"),Fe(l,p),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;on(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Vt(c)}),e.on("spaceTool.move",xT,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=Ce("path"),ve(c,"d","M0,0 L0,0"),Ze(c).add("djs-crosshair"),Fe(p,c),s.line=c;var d=Ce("g");ve(d,i.cls("djs-drag-group",["no-events"])),Fe(n.getActiveLayer(),d),o(l,d);var m=new Set(l);$(f,function(P){m.add(P)});var h=new Set,g=s.movingConnections=[];m.forEach(function(P){$(P.outgoing,function(D){h.has(D)||!pt(D)||!m.has(D.target)||(h.add(D),g.push(D))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var y=Ce("g");ve(y,i.cls("djs-frame-group",["no-events"])),Fe(n.getActiveLayer(),y);var v=[];$(f,function(P){var D=r.addFrame(P,y),T=D.getBBox();v.push({element:D,initialBounds:T}),n.addMarker(P,sv)}),s.frameGroup=y,s.frames=v}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};ve(c,{d:b[u]});var x={x:"y",y:"x"},C={x:a.dx,y:a.dy};C[x[s.axis]]=0,on(s.dragGroup,C.x,C.y),$(s.frames,function(P){var D=P.element,T=P.initialBounds,I,k;s.direction==="e"?ve(D,{width:Mc(T.width+C.x,5)}):(I=Mc(T.width-C.x,5),ve(D,{width:I,x:T.x+T.width-I})),s.direction==="s"?ve(D,{height:Mc(T.height+C.y,5)}):(k=Mc(T.height-C.y,5),ve(D,{height:k,y:T.y+T.height-k}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;$(c,function(m){n.removeMarker(m,Qp)}),$(u,function(m){n.removeMarker(m,Qp)}),p&&(Vt(f),Vt(p)),$(l,function(m){n.removeMarker(m,sv)}),d&&Vt(d)})}cv.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const _T={__init__:["spaceToolPreview"],__depends__:[Hi,Si,Pc,Lo,Ca],spaceTool:["type",ni],spaceToolPreview:["type",cv]};function kc(e,t){e.invoke(ni,this),this._canvas=t}kc.$inject=["injector","canvas"],ye(kc,ni),kc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=io(go(r.children.filter(u=>E(u,"bpmn:Artifact")),Bt(o))));const s=[...e,...a];var c=ni.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(E(u,"bpmn:TextAnnotation")||wT(u)&&(t==="y"&&Qt(u)||t==="x"&&!Qt(u)))}),c};function wT(e){return E(e,"bpmn:Participant")&&!te(e).processRef}const uv={__depends__:[_T],spaceTool:["type",kc]};function Rt(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)}Rt.$inject=["eventBus","injector"],Rt.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()},Rt.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},Rt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Rt.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()}},Rt.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()}},Rt.prototype.register=function(e,t){this._setHandler(e,t)},Rt.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)},Rt.prototype.canUndo=function(){return!!this._getUndoAction()},Rt.prototype.canRedo=function(){return!!this._getRedoAction()},Rt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Rt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Rt.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)})},Rt.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},Rt.prototype._createId=function(){return this._uid++},Rt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Rt.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()},Rt.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)},Rt.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:Sd("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Rt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=De(e)?e:[e],t.dirty=t.dirty.concat(e))},Rt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Rt.prototype._revertedAction=function(e){this._stackIdx--},Rt.prototype._getHandler=function(e){return this._handlerMap[e]},Rt.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 ET={commandStack:["type",Rt]};function hr(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 ST=250,lv=1400;function Jp(e,t,n){ee.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",lv,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=pv(a),o.validatedShapes=pv(s)}),i&&t.on("shape.move.start",ST,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",lv,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];$(s,function(u){$(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;hr(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=Ol(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&&(Ot(s.labels,a,c),a.labelTarget=s)})}ye(Jp,ee),Jp.$inject=["injector","eventBus","modeling"];function pv(e){var t=new Set(e);return Ye(e,function(n){return!t.has(n.labelTarget)})}const RT={__init__:["labelSupport"],labelSupport:["type",Jp]};var CT=251,fv=1401,dv="attach-ok";function ef(e,t,n,i,r){ee.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",fv,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=PT(c),s.validatedShapes=AT(u)}),o&&t.on("shape.move.start",CT,function(a){var s=a.context,c=s.shapes,u=tf(c);$(u,function(l){o.makeDraggable(s,l,!0),$(l.labels,function(f){o.makeDraggable(s,f,!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,dv),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,dv)}))}}),this.preExecuted("elements.move",fv,function(a){var s=a.context,c=s.closure,u=s.shapes,l=tf(u);$(l,function(f){c.add(f,c.topLevel[f.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(f){var p=f.host;return TT(f)&&!MT(c,p)}),$(l,function(f){r.updateAttachment(f,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;$(s,function(c){$(c.attachers,function(u){$(u.outgoing.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)}),$(u.incoming.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||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;hr(c.attachers,function(l){var f=i.allowed("elements.move",{target:u,shapes:[l]});f==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&$(u.attachers,function(l){var f=kg(l,c,u);r.moveShape(l,f,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&$(f,function(d){var m=kg(d,u,l);r.moveShape(d,m,d.parent),$(d.labels,function(h){r.moveShape(h,m,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;hr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ye(ef,ee),ef.$inject=["injector","eventBus","canvas","rules","modeling"];function tf(e){return zu(pn(e,function(t){return t.attachers||[]}))}function PT(e){var t=tf(e);return ow("id",e,t)}function AT(e){var t=ro(e,"id");return Ye(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function TT(e){return!!e.host}function MT(e,t){return e.indexOf(t)!==-1}const kT={__depends__:[Si],__init__:["attachSupport"],attachSupport:["type",ef]};function hv(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(am(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)})}hv.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const nf={__init__:["changeSupport"],changeSupport:["type",hv]};function ii(e){this._model=e}ii.$inject=["moddle"],ii.prototype._needsId=function(e){return We(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"])},ii.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;E(e,"bpmn:Activity")?t="Activity":E(e,"bpmn:Event")?t="Event":E(e,"bpmn:Gateway")?t="Gateway":We(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))},ii.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},ii.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},ii.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",V({bpmnElement:e,bounds:this.createDiBounds()},t))},ii.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},ii.prototype.createDiWaypoints=function(e){var t=this;return pn(e,function(n){return t.createDiWaypoint(n)})},ii.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ui(e,["x","y"]))},ii.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",V({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},ii.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",V({bpmnElement:e},t))};function $n(e,t,n){ee.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var m=d.context,h=m.hints||{},g;!m.cropped&&h.createElementsBehavior!==!1&&(g=m.connection,g.waypoints=n.getCroppedWaypoints(g),m.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var m=d.context;i.updateParent(m.shape||m.connection,m.oldParent)}function a(d){var m=d.context,h=m.shape||m.connection,g=m.parent||m.newParent;i.updateParent(h,g)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Fn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Fn(a));function s(d){var m=d.context,h=m.oldRoot,g=h.children;$(g,function(y){E(y,"bpmn:BaseElement")&&i.updateParent(y)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var m=d.context.shape;E(m,"bpmn:BaseElement")&&i.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],Fn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Fn(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"],Fn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Fn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Fn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Fn(l)),this.executed("connection.reconnect",Fn(function(d){var m=d.context,h=m.connection,g=m.oldSource,y=m.newSource,v=te(h),b=te(g),x=te(y);v.conditionExpression&&!We(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=v.conditionExpression,delete v.conditionExpression),g!==y&&b.default===v&&(m.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",Fn(function(d){var m=d.context,h=m.connection,g=m.oldSource,y=m.newSource,v=te(h),b=te(g),x=te(y);m.oldConditionExpression&&(v.conditionExpression=m.oldConditionExpression),m.oldDefault&&(b.default=m.oldDefault,delete x.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Fn(f)),this.reverted(["element.updateAttachment"],Fn(f)),this.executed("element.updateLabel",Fn(p)),this.reverted("element.updateLabel",Fn(p));function p(d){const{element:m}=d.context,h=qn(m),g=Qe(m),y=g&&g.get("label");sr(m)||yc(m)||(h&&!y?g.set("label",t.create("bpmndi:BPMNLabel")):!h&&y&&g.set("label",void 0))}}ye($n,ee),$n.$inject=["eventBus","bpmnFactory","connectionDocking"],$n.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},$n.prototype.updateParent=function(e,t){if(!Ge(e)&&!(E(e,"bpmn:DataStoreReference")&&e.parent&&E(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Qe(e),o=n&&n.businessObject,a=Qe(n);E(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),E(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),E(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),E(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},$n.prototype.updateBounds=function(e){var t=Qe(e),n=DT(e);if(n){var i=pi(n,t.get("bounds"));V(n,{x:e.x+i.x,y:e.y+i.y})}var r=Ge(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),V(o,{x:e.x,y:e.y,width:e.width,height:e.height})},$n.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;E(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Mt(i,e)),E(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Ot(r,e))}},$n.prototype.updateDiConnection=function(e,t,n){var i=Qe(e),r=Qe(t),o=Qe(n);i.sourceElement&&i.sourceElement.bpmnElement!==te(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==te(n)&&(i.targetElement=n&&o)},$n.prototype.updateDiParent=function(e,t){if(t&&!E(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Mt(n,e),e.$parent=null)}};function OT(e){for(;e&&!E(e,"bpmn:Definitions");)e=e.$parent;return e}$n.prototype.getLaneSet=function(e){var t,n;return E(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(E(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)},$n.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((E(e,"bpmn:DataInput")||E(e,"bpmn:DataOutput"))&&(E(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(E(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(E(e,"bpmn:FlowElement")){if(t){if(E(t,"bpmn:Participant"))t=t.processRef;else if(E(t,"bpmn:Lane"))do t=t.$parent.$parent;while(E(t,"bpmn:Lane"))}i="flowElements"}else if(E(e,"bpmn:Artifact")){for(;t&&!E(t,"bpmn:Process")&&!E(t,"bpmn:SubProcess")&&!E(t,"bpmn:Collaboration");)if(E(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(E(e,"bpmn:MessageFlow"))i="messageFlows";else if(E(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=OT(e.$parent||t),e.$parent&&(Mt(o.get("rootElements"),r),r.$parent=null),t&&(Ot(o.get("rootElements"),r),r.$parent=o))}else E(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":E(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),Mt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Mt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},$n.prototype.updateConnectionWaypoints=function(e){var t=Qe(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},$n.prototype.updateConnection=function(e){var t=e.connection,n=te(t),i=t.source,r=te(i),o=t.target,a=te(t.target),s;if(E(n,"bpmn:DataAssociation"))E(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):E(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=E(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Mt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Mt(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)},$n.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Fn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;E(i,"bpmn:BaseElement")&&e(t)}}function DT(e){if(E(e,"bpmn:Activity")){var t=Qe(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function mr(e,t){Ni.call(this),this._bpmnFactory=e,this._moddle=t}ye(mr,Ni),mr.$inject=["bpmnFactory","moddle"],mr.prototype._baseCreate=Ni.prototype.create,mr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,V({type:"label",di:n},$r,t))}return this.createElement(e,t)},mr.prototype.createElement=function(e,t){t=V({},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(!IT(r)){var o=V({},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)}E(i,"bpmn:Group")&&(t=V({isFrame:!0},t)),t=LT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=rf(r,t,"isExpanded")),We(i,["bpmn:Lane","bpmn:Participant"])&&(t=rf(r,t,"isHorizontal")),E(i,"bpmn:SubProcess")&&(t.collapsed=!Xe(i,r)),E(i,"bpmn:ExclusiveGateway")&&(Mn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),zt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),zt(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=V({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},mr.prototype.getDefaultSize=function(e,t){var n=te(e);if(t=t||Qe(e),E(n,"bpmn:SubProcess"))return Xe(n,t)?{width:350,height:200}:{width:100,height:80};if(E(n,"bpmn:Task"))return{width:100,height:80};if(E(n,"bpmn:Gateway"))return{width:50,height:50};if(E(n,"bpmn:Event"))return{width:36,height:36};if(E(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Xe(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return E(n,"bpmn:Lane")?{width:400,height:100}:E(n,"bpmn:DataObjectReference")?{width:36,height:50}:E(n,"bpmn:DataStoreReference")?{width:50,height:50}:E(n,"bpmn:TextAnnotation")?{width:100,height:40}:E(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},mr.prototype.createParticipantShape=function(e){return Kt(e)||(e={isExpanded:e}),e=V({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function LT(e,t,n){return $(n,function(i){t=rf(e,t,i)}),t}function rf(e,t,n){return t[n]===void 0?t:(e[n]=t[n],hi(t,[n]))}function IT(e){return We(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Oc(e,t){this._modeling=e,this._canvas=t}Oc.$inject=["modeling","canvas"],Oc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;$(n,function(r){var o={x:0,y:0};zt(i.left)?o.x=i.left-r.x:zt(i.right)?o.x=i.right-r.width-r.x:zt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:zt(i.top)?o.y=i.top-r.y:zt(i.bottom)?o.y=i.bottom-r.height-r.y:zt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Oc.prototype.postExecute=function(e){};function Dc(e){this._modeling=e}Dc.$inject=["modeling"],Dc.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},Dc.prototype.postExecute=function(e){var t=e.hints||{};BT(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 BT(e,t){return Xi(e.outgoing,function(n){return n.target===t})}function Lc(e,t){this._canvas=e,this._layouter=t}Lc.$inject=["canvas","layouter"],Lc.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},Lc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Ic=Math.round;function of(e){this._modeling=e}of.$inject=["modeling"],of.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;$(t,function(f){Be(f.x)||(f.x=0),Be(f.y)||(f.y=0)});var s=Ye(t,function(f){return!f.hidden}),c=Bt(s);$(t,function(f){pt(f)&&(f.waypoints=pn(f.waypoints,function(p){return{x:Ic(p.x-c.x-c.width/2+r.x),y:Ic(p.y-c.y-c.height/2+r.y)}})),V(f,{x:Ic(f.x-c.x-c.width/2+r.x),y:Ic(f.y-c.y-c.height/2+r.y)})});var u=new Set(Ns(t)),l={};$(t,function(f){if(pt(f)){l[f.id]=Be(i)?a.createConnection(l[f.source.id],l[f.target.id],i,f,f.parent||n,o):a.createConnection(l[f.source.id],l[f.target.id],f,f.parent||n,o);return}var p=V({},o);u.has(f)||(p.autoResize=!1),Ge(f)&&(p=hi(p,["attach"])),l[f.id]=Be(i)?a.createShape(f,ui(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,ui(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=io(l)};var mv=Math.round;function gr(e){this._canvas=e}gr.$inject=["canvas"],gr.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?V(t,n):V(t,{x:n.x-mv(t.width/2),y:n.y-mv(t.height/2)}),this._canvas.addShape(t,i,r),t},gr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Aa(e){gr.call(this,e)}ye(Aa,gr),Aa.$inject=["canvas"];var NT=gr.prototype.execute;Aa.prototype.execute=function(e){var t=e.shape;return FT(t),t.labelTarget=e.labelTarget,NT.call(this,e)};var $T=gr.prototype.revert;Aa.prototype.revert=function(e){return e.shape.labelTarget=null,$T.call(this,e)};function FT(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Ta(e,t){this._canvas=e,this._modeling=t}Ta.$inject=["canvas","modeling"],Ta.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;hr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),hr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Ta.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Ol(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Ta.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Ot(n.children,t,i),this._canvas.addConnection(t,n),t};function af(e,t){this._modeling=e,this._elementRegistry=t}af.$inject=["modeling","elementRegistry"],af.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;$(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function Ma(e,t){this._canvas=e,this._modeling=t}Ma.$inject=["canvas","modeling"],Ma.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;hr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),hr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),hr(n.children,function(i){pt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Ma.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Ol(i.children,n),t.removeShape(n),n},Ma.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Ot(i.children,n,r),t.addShape(n,i),n};function Bc(e){this._modeling=e}Bc.$inject=["modeling"];var gv={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,y){g.range.min=Math.min(y[i],g.range.min),g.range.max=Math.max(y[i]+y[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,y){var v={y:0};v[i]=g-a(y),v[i]&&(v[gv[i]]=0,t.moveElements([y],v,y.parent))}var l=n[0],f=s(n),p=n[f],d,m,h=0;$(n,function(g,y){var v,b,x;if(g.elements.length<2){y&&y!==n.length-1&&(o(g,g.elements[0]),h+=c(g.range));return}v=di(g.elements,i),b=v[0],y===f&&(b=v[s(v)]),x=a(b),g.range=null,$(v,function(C){if(u(x,C),g.range===null){g.range={min:C[i],max:C[i]+C[r]};return}o(g,C)}),y&&y!==n.length-1&&(h+=c(g.range))}),m=Math.abs(p.range.min-l.range.max),d=Math.round((m-h)/(n.length-1)),!(d<n.length-1)&&$(n,function(g,y){var v={},b;g===l||g===p||(b=n[y-1],g.range.max=0,$(g.elements,function(x,C){v[gv[i]]=0,v[i]=b.range.max-x[i]+d,g.range.min!==x[i]&&(v[i]+=x[i]-g.range.min),v[i]&&t.moveElements([x],v,x.parent),g.range.max=Math.max(x[i]+x[r],C?g.range.max:0)}))})},Bc.prototype.postExecute=function(e){};function Nc(e,t){this._layouter=e,this._canvas=t}Nc.$inject=["layouter","canvas"],Nc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return V(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Nc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function sf(){}sf.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=Mt(o.children,t),Ot(i.children,t,r),t.parent=i,$(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},sf.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Mt(n.children,t),Ot(i.children,t,r),t.parent=i,$(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 cf(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}cf.prototype.add=function(e,t){return this.addAll([e],t)},cf.prototype.addAll=function(e,t){var n=mS(e,!!t,this);return V(this,n),this};function ka(e){this._modeling=e}ka.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ka.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,function(f){o.moveShape(f,t,u[f.id]&&!l&&n,{recurse:!1,layout:!1})}),$(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,u[f.id]&&!l&&n):o.layoutConnection(f,{connectionStart:p&&hp(f,f.source,t),connectionEnd:d&&mp(f,f.target,t)})})},ka.prototype.getClosure=function(e){return new cf().addAll(e,!0)};function $c(e){this._helper=new ka(e)}$c.$inject=["modeling"],$c.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},$c.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 Vr(e){this._modeling=e,this._helper=new ka(e)}Vr.$inject=["modeling"],Vr.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=ui(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Mt(o.children,t),Ot(i.children,t,r),V(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Vr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&($(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:mp(o,t,n)})}),$(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:hp(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Vr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Ot(n.children,t,i),V(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Vr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Vr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Oa(e){this._modeling=e}Oa.$inject=["modeling"],Oa.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 De(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},Oa.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||yv(De(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||yv(De(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Oa.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 yv(e){return e.original||e}function Gi(e,t){this._modeling=e,this._rules=t}Gi.$inject=["modeling","rules"],Gi.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(m,h,g){return i.allowed("connection.reconnect",{connection:g,source:m,target:h})}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 f;a.moveChildren!==!1&&(f=r.children.slice(),n.moveElements(f,{x:0,y:0},s,a));var p=r.incoming.slice(),d=r.outgoing.slice();$(p,function(m){var h=m.source,g=c(h,s,m);g&&t.reconnectEnd(m,s,pc(m,s,l),a)}),$(d,function(m){var h=m.target,g=c(s,h,m);g&&t.reconnectStart(m,s,lc(m,s,l),a)})},Gi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Gi.prototype.execute=function(e){},Gi.prototype.revert=function(e){},Gi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Gi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Gi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Da(e){this._modeling=e}Da.$inject=["modeling"],Da.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},V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Da.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&($(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:pc(o,n,i)})}),$(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:lc(o,n,i)})}))},Da.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function yr(e){this._modeling=e}yr.$inject=["modeling"],yr.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),$(r,function(s){a[s.id]=HT(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(hT(i,r),t,n,o,i,r,a)},yr.prototype.execute=function(){},yr.prototype.revert=function(){},yr.prototype.moveShapes=function(e,t){var n=this;$(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},yr.prototype.resizeShapes=function(e,t,n){var i=this;$(e,function(r){var o=mT(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},yr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);$(e,function(l){var f=l.source,p=l.target,d=jT(l),m=bv(n),h={},g=c.has(f)||u.has(f),y=c.has(p)||u.has(p);g&&y?(d=pn(d,function(v){return xv(v,i,n)&&(v[m]=v[m]+t[m]),v.original&&xv(v.original,i,n)&&(v.original[m]=v.original[m]+t[m]),v}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||y)&&(c.has(f)?h.connectionStart=hp(l,f,t):c.has(p)?h.connectionEnd=mp(l,p,t):u.has(f)?h.connectionStart=lc(l,f,a[f.id]):u.has(p)&&(h.connectionEnd=pc(l,p,a[p.id])),s._modeling.layoutConnection(l,h))})};function vv(e){return V({},e)}function jT(e){return pn(e.waypoints,function(t){return t=vv(t),t.original&&(t.original=vv(t.original)),t})}function bv(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function xv(e,t,n){var i=bv(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function HT(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Fc(e){this._modeling=e}Fc.$inject=["modeling"],Fc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=_v(n),t.collapsed=!t.collapsed;var i=wv(n,t.collapsed);return[t].concat(i)},Fc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Ev(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function _v(e){var t={};return $(e,function(n){t[n.id]=n.hidden,n.children&&(t=V({},t,_v(n.children)))}),t}function wv(e,t){var n=[];return $(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(wv(i.children,i.collapsed||t)))}),n}function Ev(e,t){var n=[];return $(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Ev(i.children,t)))}),n}function jc(e){this._modeling=e}jc.$inject=["modeling"],jc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Sv(i,t),Rv(n,t),t.host=n,t},jc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Sv(n,t),Rv(i,t,r),t};function Sv(e,t){return Mt(e&&e.attachers,t)}function Rv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Ot(i,t,n)}}function uf(){}uf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},uf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function ft(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}ft.$inject=["eventBus","elementFactory","commandStack"],ft.prototype.getHandlers=function(){return{"shape.append":Dc,"shape.create":gr,"shape.delete":Ma,"shape.move":Vr,"shape.resize":Da,"shape.replace":Gi,"shape.toggleCollapse":Fc,spaceTool:yr,"label.create":Aa,"connection.create":Lc,"connection.delete":Ta,"connection.move":sf,"connection.layout":Nc,"connection.updateWaypoints":uf,"connection.reconnect":Oa,"elements.create":of,"elements.move":$c,"elements.delete":af,"elements.distribute":Bc,"elements.align":Oc,"element.updateAttachment":jc}},ft.prototype.registerHandlers=function(e){$(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},ft.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)},ft.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},ft.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)},ft.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)},ft.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},ft.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},ft.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},ft.prototype.createElements=function(e,t,n,i,r){De(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},ft.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},ft.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},ft.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},ft.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},ft.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},ft.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},ft.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},ft.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},ft.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},ft.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)},ft.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},ft.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)},ft.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,V(i,{docking:"source"}))},ft.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,V(i,{docking:"target"}))},ft.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},ft.prototype._create=function(e,t){return eR(t)?t:this._elementFactory.create(e,t)},ft.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function La(e){this._elementRegistry=e}La.$inject=["elementRegistry"],La.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||zT(n,ls(i));return Cv(n,i),e.oldProperties=o,e.changed=r,r},La.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Cv(n,t),i},La.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return E(e,"bpmn:DataObject")?GT(e,t):[]};function zT(e,t){return kn(t,function(n,i){return n[i]=e.get(i),n},{})}function Cv(e,t){$(t,function(n,i){e.set(i,n)})}function GT(e,t){return t.filter(function(n){return E(n,"bpmn:DataObjectReference")&&te(n).dataObjectRef===e})}var Ia="default",Vi="id",Pv="di",VT={width:0,height:0};function Ba(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ba.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ba.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=KT(e.properties),s=e.oldProperties||WT(t,a);return Av(a,o)&&(r.unclaim(o[Vi]),i.updateId(t,a[Vi]),r.claim(a[Vi],o)),Ia in a&&(a[Ia]&&n.push(i.get(a[Ia].id)),o[Ia]&&n.push(i.get(o[Ia].id))),Tv(t,a),e.oldProperties=s,e.changed=n,n},Ba.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&te(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,VT)}},Ba.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 Tv(t,i),Av(n,r)&&(a.unclaim(n[Vi]),o.updateId(t,i[Vi]),a.claim(i[Vi],r)),e.changed};function Av(e,t){return Vi in e&&e[Vi]!==t[Vi]}function WT(e,t){var n=ls(t),i=e.businessObject,r=Qe(e);return kn(n,function(o,a){return a!==Pv?o[a]=i.get(a):o[a]=UT(r,ls(t.di)),o},{})}function UT(e,t){return kn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Tv(e,t){var n=e.businessObject,i=Qe(e);$(t,function(r,o){o!==Pv?n.set(o,r):i&&YT(i,r)})}function YT(e,t){$(t,function(n,i){e.set(i,n)})}var qT=["default"];function KT(e){var t=V({},e);return qT.forEach(function(n){n in e&&(t[n]=te(t[n]))}),t}function Hc(e,t){this._canvas=e,this._modeling=t}Hc.$inject=["canvas","modeling"],Hc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Qe(r);return t.setRootElement(n),t.removeRootElement(r),Ot(a.rootElements,i),i.$parent=a,Mt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Hc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Qe(n);return t.setRootElement(r),t.removeRootElement(n),Mt(a.rootElements,i),i.$parent=null,Ot(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function lf(e,t){this._modeling=e,this._spaceTool=t}lf.$inject=["modeling","spaceTool"],lf.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Jn(i),a=o===i,s=a?i:i.parent,c=ur(s),u=Qt(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+Qn,y:i.y,width:i.width-Qn,height:i.height}:{x:i.x,y:i.y+Qn,width:i.width,height:i.height-Qn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var f=[];Br(o,function(x){return f.push(x),x.label&&f.push(x.label),x===i?[]:Ye(x.children,function(C){return C!==i})});var p,d,m,h,g;r==="top"?(p=-120,d=i.y,m=d+10,h="n",g="y"):r==="left"?(p=-120,d=i.x,m=d+10,h="w",g="x"):r==="bottom"?(p=120,d=i.y+i.height,m=d-10,h="s",g="y"):r==="right"&&(p=120,d=i.x+i.width,m=d-10,h="e",g="x");var y=t.calculateAdjustments(f,g,p,m),v=u?{x:0,y:p}:{x:p,y:0};t.makeSpace(y.movingShapes,y.resizingShapes,v,h,m);var b=u?{x:i.x+(a?Qn:0),y:d-(r==="top"?120:0),width:i.width-(a?Qn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Qn:0),width:120,height:i.height-(a?Qn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function pf(e){this._modeling=e}pf.$inject=["modeling"],pf.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=ur(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Qt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,f,p;for(p=0;p<i;p++)p===i-1?u=s-c*p:u=c,l=a?{x:n.x+Qn,y:n.y+p*c,width:n.width-Qn,height:u}:{x:n.x+p*c,y:n.y+Qn,width:u,height:n.height-Qn},p<o?t.resizeShape(r[p],l):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,l,n))};function Na(e,t){this._modeling=e,this._spaceTool=t}Na.$inject=["modeling","spaceTool"],Na.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Na.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=GC(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Na.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Te(e),r=Te(t),o=sg(r,i),a=Jn(e),s=[],c=[];Br(a,function(m){return s.push(m),(E(m,"bpmn:Lane")||E(m,"bpmn:Participant"))&&c.push(m),m.children});var u,l,f,p,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},f)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},f))};var $a="flowNodeRef",ff="lanes";function zc(){}zc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,f){var p=Te(f),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var f=Jn(l);return r[f.id]||(r[f.id]=oc(f)),r[f.id]}function u(l){if(!l.parent)return[];var f=c(l);return f.filter(function(p){return a(l,p)}).map(function(p){return p.businessObject})}return t.forEach(function(l){var f=Jn(l);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return E(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(l){var f=l.businessObject,p=f.get(ff),d=p.slice(),m=u(l);i.push({flowNode:f,remove:d,add:m})}),t.forEach(function(l){var f=l.businessObject;l.parent||f.get($a).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},zc.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(ff);n.remove.forEach(function(o){Mt(r,o),Mt(o.get($a),i)}),n.add.forEach(function(o){Ot(r,o),Ot(o.get($a),i)})}),[]},zc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(ff);n.add.forEach(function(o){Mt(r,o),Mt(o.get($a),i)}),n.remove.forEach(function(o){Ot(r,o),Ot(o.get($a),i)})}),[]};var df="categoryValueRef";function Fa(e,t){this._bpmnFactory=e,this._elementRegistry=t}Fa.$inject=["bpmnFactory","elementRegistry"],Fa.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(v,b,x){if(b){var C=a.get(v);C||(C={},a.set(v,C)),!(x&&C.present)&&(!x&&C.past||(x?C.present={categoryValue:b,root:hf(v)}:C.past={categoryValue:b}))}}function c(v){r.set(v,te(v))}function u(){n.filter(function(v){return E(v,"bpmn:FlowElement")&&!Ge(v)&&v.parent}).forEach(c)}function l(v){var b=te(v),x=b.get("categoryValueRef");return x||(x=ng(i,b),o.push(XT(v,x))),x}function f(v){return v.reduce(function(b,x){var C=hf(x),P=b.get(C);return P||(P=[],b.set(C,P)),P.push(x),b},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&u(),e.forEach(c),n.filter(function(v){return E(v,"bpmn:Group")&&!Ge(v)&&v.parent}).forEach(function(v){var b=te(v).get("categoryValueRef");if(!b){var x=hf(v),C=p.get(x)||[],P=go(C,v),D=Object.keys(P).length>0;D&&(b=l(v))}s(v,b,!0)}),t.forEach(function(v){s(v.groupShape,v.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),m=Array.from(a.values()).reduce(function(v,b){return b.present&&v.add(b.present.categoryValue),b.past&&v.add(b.past.categoryValue),v},new Set),h=new Map,g=f(d);a.forEach(function(v,b){var x=v.present;if(x){var C=g.get(x.root)||[],P=go(C,b);C.forEach(function(D){if(P[D.id]){var T=h.get(D);T||(T=new Set,h.set(D,T)),T.add(x.categoryValue)}})}});var y=d.reduce(function(v,b){var x=r.get(b),C=x.get(df),P=new Set(C),D=h.get(b)||new Set,T=Array.from(D).filter(function(k){return!P.has(k)}),I=C.filter(function(k){return m.has(k)&&!D.has(k)});return(T.length||I.length)&&v.push({businessObject:x,categoryValuesToAdd:T,categoryValuesToRemove:I}),v},[]);return{flowElements:y,groups:o}},Fa.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),ZT(t.groups),JT(t.flowElements),[]},Fa.prototype.revert=function(e){var t=e.updates;return eM(t.flowElements),QT(t.groups),[]};function XT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function ZT(e){e.forEach(function(t){te(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function QT(e){e.forEach(function(t){te(t.groupShape).categoryValueRef=null})}function JT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(df);t.categoryValuesToRemove.forEach(function(r){Mt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Ot(i,r,!0)})})}function eM(e){e.forEach(function(t){var n=t.businessObject,i=n.get(df);t.categoryValuesToAdd.forEach(function(r){Mt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Ot(i,r,!0)})})}function hf(e){for(;e.parent;)e=e.parent;return e}function Gc(e){this._moddle=e}Gc.$inject=["moddle"],Gc.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),[]},Gc.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 tM={fill:void 0,stroke:void 0};function mf(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Tn(t)){var n=nM(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}mf.$inject=["commandStack"],mf.prototype.postExecute=function(e){var t=e.elements,n=e.colors||tM,i=this,r={};"fill"in n&&V(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&V(r,{"border-color":this._normalizeColor(n.stroke)}),$(t,function(o){var a=pt(o)?ui(r,["border-color"]):r,s=Qe(o);if(iM(a),Ge(o)){if(!s||!E(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!We(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function nM(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 iM(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var rM={width:0,height:0};function Mv(e,t,n){function i(c,u){var l=c.label||c,f=c.labelTarget||c;return OR(l,u),[l,f]}function r(c){var u=c.element,l=u.businessObject,f=c.newLabel;if(!Ge(u)&&sr(u)&&!Us(u)&&!kv(f)){var p=7,d=$l(u);d={x:d.x,y:d.y+p},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=qn(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,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!Ge(l)&&!E(l,"bpmn:TextAnnotation"))){if(Ge(l)&&kv(f)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var m=qn(u);typeof p>"u"&&(p=t.getExternalLabelBounds(l,m)),p&&e.resizeShape(l,p,rM)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Mv.$inject=["modeling","textRenderer","bpmnFactory"];function kv(e){return!e||!e.trim()}function sn(e,t,n,i){ft.call(this,e,t,n),this._bpmnRules=i}ye(sn,ft),sn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],sn.prototype.getHandlers=function(){var e=ft.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=La,e["element.updateProperties"]=Ba,e["canvas.updateRoot"]=Hc,e["lane.add"]=lf,e["lane.resize"]=Na,e["lane.split"]=pf,e["lane.updateRefs"]=zc,e["group.updateRefs"]=Fa,e["id.updateClaim"]=Gc,e["element.setColor"]=mf,e["element.updateLabel"]=Mv,e},sn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},sn.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)},sn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},sn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},sn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},sn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},sn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},sn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},sn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},sn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},sn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},sn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},sn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},sn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Ov(){}Ov.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Le(t.source||e.source),t.connectionEnd||Le(t.target||e.target)]};var Vc=20,oM=5,Wc=Math.round,Dv=20,aM={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function sM(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function cM(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Lv(e,t,n){var i=rn(t,e,oM),r=n.split(":")[0],o=Wc((t.x-e.x)/2+e.x),a=Wc((t.y-e.y)/2+e.y),s,c,u=cM(r,i),l=/h|r|l/.test(r),f=!1,p=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(f=sM(i,r),c=l?"h:v":"v:h",f?l?(p=a===e.y,s={x:e.x+Vc*(/l/.test(r)?-1:1),y:p?a+Vc:a}):(p=o===e.x,s={x:p?o+Vc:o,y:e.y+Vc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:gf(e,s,c).concat(s),directions:c,turnNextDirections:p}}function uM(e,t,n){return Lv(e,t,n)}function lM(e,t,n){var i=Lv(t,e,Iv(n));return{waypoints:i.waypoints.slice().reverse(),directions:Iv(i.directions),turnNextDirections:i.turnNextDirections}}function pM(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=gf(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Iv(e){return e.split(":").reverse().join(":")}function fM(e,t,n){var i=Wc((t.x-e.x)/2+e.x),r=Wc((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 gf(e,t,n){if(n=n||"h:h",!_M(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Nv(n)){var i=uM(e,t,n),r=lM(e,t,n),o=pM(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return fM(e,t,n)}function dM(e,t,n){var i=gf(e,t,n);return i.unshift(e),i.push(t),Fv(i)}function hM(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=iw(o,"straight")[0]||"h:h",s=aM[a]||0,c=rn(e,t,s),u=xM(c,a);n=n||Le(e),i=i||Le(t);var l=u.split(":"),f=$v(n,e,l[0],wM(c)),p=$v(i,t,l[1],c);return dM(f,p,u)}function mM(e,t,n,i,r,o){De(n)&&(r=n,o=i,n=Le(e),i=Le(t)),o=V({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&yM(e,t,n,i,o),c||(c=o.connectionEnd&&bM(t,e,i,r),c)||(c=o.connectionStart&&vM(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:hM(e,t,n,i,o)}function gM(e,t,n){return e>=t&&e<=n}function Bv(e,t,n){var i={x:"width",y:"height"};return gM(t[e],n[e],n[e]+n[i[e]])}function yM(e,t,n,i,r){var o={},a,s;return s=rn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Bv(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:Bv(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 vM(e,t,n,i){return yf(e,t,n,i)}function bM(e,t,n,i){var r=i.slice().reverse();return r=yf(e,t,n,r),r?r.reverse():null}function yf(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!ht(l,function(f,p){var d=l[p-1];return d&&ua(f,d)<3})}function o(l,f,p){var d=Ii(f,l);switch(d){case"v":return{x:p.x,y:l.y};case"h":return{x:l.x,y:p.y}}return{x:l.x,y:l.y}}function a(l,f,p){var d;for(d=l.length-2;d!==0;d--)if(cm(l[d],f,Dv)||cm(l[d],p,Dv))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=yf(e,t,n,u)),c&&Ii(c)?null:c}function xM(e,t){if(Nv(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 _M(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Nv(e){return e&&/t|r|b|l/.test(e)}function wM(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 $v(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 Fv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return Dl(r,o,n,0)||t.push(n),t},[])}var EM=-10,SM=40,RM={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},CM={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},vf={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ja={top:"t",right:"r",bottom:"b",left:"l"};function Uc(e){this._elementRegistry=e}ye(Uc,Ov),Uc.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=jv(r&&r[0],n)),a||(a=jv(r&&r[r.length-1],i)),(E(e,"bpmn:Association")||E(e,"bpmn:DataAssociation"))&&r&&!Hv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Qm(n,s)?RM:CM;return E(e,"bpmn:MessageFlow")?c=AM(n,i,l):(E(e,"bpmn:SequenceFlow")||Hv(n,i))&&(n===i?c={preferredLayouts:LM(n,e,l)}:E(n,"bpmn:BoundaryEvent")?c={preferredLayouts:IM(n,i,a,l)}:Ha(n)||Ha(i)?c={preferredLayouts:l.subProcess,preserveDocking:MM(n)}:E(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:E(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=V(c,t),u=Fv(mM(n,i,o,a,r,c))),u||[o,a]};function PM(e){var t=e.host;return rn(Le(e),t,EM)}function AM(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:TM(e,t)}}function TM(e,t){return E(t,"bpmn:Participant")?"source":E(e,"bpmn:Participant")?"target":Ha(t)?"source":Ha(e)||E(t,"bpmn:Event")?"target":E(e,"bpmn:Event")?"source":null}function MM(e){return Ha(e)?"target":"source"}function jv(e,t){return e?e.original||e:Le(t)}function Hv(e,t){return E(t,"bpmn:Activity")&&E(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Ha(e){return E(e,"bpmn:SubProcess")&&Xe(e)}function Wr(e,t){return e===t}function kM(e,t){return t.indexOf(e)!==-1}function Io(e){var t=/right|left/.exec(e);return t&&t[0]}function Bo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function zv(e,t){return vf[e]===t}function OM(e,t){var n=Io(e),i=vf[n];return t.indexOf(i)!==-1}function DM(e,t){var n=Bo(e),i=vf[n];return t.indexOf(i)!==-1}function Gv(e){return e==="right"||e==="left"}function LM(e,t,n){var i=t.waypoints,r=i&&i.length&&rn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function IM(e,t,n,i){var r=Le(e),o=Le(t),a=PM(e),s,c,u=Wr(e.host,t),l=kM(a,["top","right","bottom","left"]),f=rn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?BM(a,l,e,t,n,i):(s=NM(a,f,l,i.isHorizontal),c=$M(a,f,l,i.isHorizontal),[s+":"+c])}function BM(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Bo(e):Io(e),s=ja[a],c;return t?Gv(e)?c=Vv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Vv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Vv(e,t,n,i){var r=SM;return!(bf(e,i,n,r)||bf(e,i,{x:n.x+n.width,y:n.y+n.height},r)||bf(e,i,Le(t),r))}function bf(e,t,n,i){return Math.abs(t[e]-n[e])<i}function NM(e,t,n,i){if(n)return ja[e];var r=Bo(e),o=Io(e),a=Bo(t),s=Io(t);if(i){if(Wr(r,a)||zv(o,s))return ja[r]}else if(Wr(o,s)||zv(r,a))return ja[o];return ja[i?o:r]}function $M(e,t,n,i){if(n)return Gv(e)?OM(e,t)||Wr(e,t)?"h":"v":DM(e,t)||Wr(e,t)?"v":"h";var r=Bo(e),o=Io(e),a=Bo(t),s=Io(t);return a&&!s?"v":s&&!a?"h":i?Wr(r,a)?"h":"v":Wr(o,s)?"v":"h"}Uc.$inject=["elementRegistry"];function Wv(e){return V({original:e.point.original||e.point},e.actual)}function vr(e,t){this._elementRegistry=e,this._graphicsFactory=t}vr.$inject=["elementRegistry","graphicsFactory"],vr.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(Wv(i)),o.push(Wv(r)),o},vr.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}},vr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return la(i,r,n)},vr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},vr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},vr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const xf={__init__:["modeling","bpmnUpdater"],__depends__:[iA,bA,_A,wA,iv,ET,RT,kT,ti,nf,uv],bpmnFactory:["type",ii],bpmnUpdater:["type",$n],elementFactory:["type",mr],modeling:["type",sn],layouter:["type",Uc],connectionDocking:["type",vr]};var FM=10,Uv=50,jM=250;function _f(e,t,n,i){for(var r;r=HM(e,n,t);)n=i(t,n,r);return n}function wf(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 HM(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=GM(e);return ht(r,function(o){if(o===n)return!1;var a=rn(o,i,FM);return a==="intersect"})}function zM(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||Uv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||jM,c=t.reference||"start";o||(o=UM);function u(m,h){return r==="n"?c==="start"?Te(m).top-Te(h).bottom:c==="center"?Te(m).top-Le(h).y:Te(m).top-Te(h).top:r==="w"?c==="start"?Te(m).left-Te(h).right:c==="center"?Te(m).left-Le(h).x:Te(m).left-Te(h).left:r==="s"?c==="start"?Te(h).top-Te(m).bottom:c==="center"?Le(h).y-Te(m).bottom:Te(h).bottom-Te(m).bottom:c==="start"?Te(h).left-Te(m).right:c==="center"?Le(h).x-Te(m).right:Te(h).right-Te(m).right}var l=e.incoming.filter(o).map(function(m){var h=a(m),g=h<0?u(m.source,e):u(e,m.source);return{id:m.source.id,distance:g,weight:h}}),f=e.outgoing.filter(o).map(function(m){var h=a(m),g=h>0?u(e,m.target):u(m.target,e);return{id:m.target.id,distance:g,weight:h}}),p=l.concat(f).reduce(function(m,h){return m[h.id+"__weight_"+h.weight]=h,m},{}),d=kn(p,function(m,h){var g=h.distance,y=h.weight;return g<0||g>s||(m[String(g)]||(m[String(g)]=0),m[String(g)]+=1*y,(!m.distance||m[m.distance]<m[String(g)])&&(m.distance=g)),m},{});return d.distance||i}function GM(e){var t=Ef(e);return e.host&&(t=t.concat(Ef(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Ef(i))},[]))),t}function Ef(e){return WM(e).concat(VM(e))}function VM(e){return e.incoming.map(function(t){return t.source})}function WM(e){return e.outgoing.map(function(t){return t.target})}function UM(){return!0}var YM=100;function Yv(e,t,n){e.on("autoPlace",YM,function(i){var r=i.shape,o=i.source;return qM(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}}Yv.$inject=["eventBus","modeling","canvas"];function qM(e,t,n){n||(n={});var i=n.defaultDistance||Uv,r=Le(e),o=Te(e);return{x:o.right+i+t.width/2,y:r.y}}function qv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}qv.$inject=["eventBus","selection"];const KM={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Yv],autoPlaceSelectionBehavior:["type",qv]};function Kv(e,t,n){var i=Qm(e,n);if(E(t,"bpmn:TextAnnotation"))return ZM(e,t,i);if(We(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return QM(e,t,i);if(E(t,"bpmn:FlowNode"))return XM(e,t,i)}function XM(e,t,n){var i=Te(e),r=Le(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=zM(e,{filter:function(d){return E(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;E(e,"bpmn:BoundaryEvent")&&(u=rn(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+Xv(u,c,o)}:{x:r.x+Xv(u,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return _f(e,t,l,wf(p))}function Xv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function ZM(e,t,n){var i=Te(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};pt(e)&&(r=Le(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 _f(e,t,r,wf(a))}function QM(e,t,n){var i=Te(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 _f(e,t,r,wf(a))}function Zv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Kv(r,i,t)})}Zv.$inject=["eventBus","elementRegistry"];const Yc={__depends__:[KM],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Zv]},Qv=[Xm,ga,xf,Yc];function JM(e={}){Ud(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new bo({container:t,moddleExtensions:e.moddleExtensions??ys,additionalModules:[...Qv,...e.additionalModules??[]]})}var e2=new Do("ov"),t2=500;function en(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=e2,this._overlayDefaults=V({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=n2(n.getContainer()),this._init()}en.$inject=["config.overlays","eventBus","canvas","elementRegistry"],en.prototype.get=function(e){if(Tn(e)&&(e={id:e}),Tn(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,oo({type:e.type})):t.overlays.slice():[]}else return e.type?Ye(this._overlays,oo({type:e.type})):e.id?this._overlays[e.id]:null},en.prototype.add=function(e,t,n){if(Kt(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=V({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},en.prototype.remove=function(e){var t=this.get(e)||[];De(t)||(t=[t]);var n=this;$(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(vi(i.html),vi(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)}})},en.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},en.prototype.show=function(){qc(this._overlayRoot)},en.prototype.hide=function(){qc(this._overlayRoot,!1)},en.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ks(this._overlayRoot)},en.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Bt(t);i=o.x,r=o.y}Jv(n,i,r),hn(e.html,"data-container-id",t.id)},en.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=Bt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Bt(i).height:s=i.height,o=t.bottom*-1+s}Jv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},en.prototype._createOverlayContainer=function(e){var t=bt('<div class="djs-overlays" />');wn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},en.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";eb(this._overlayRoot,n)},en.prototype._getOverlayContainer=function(e,t){var n=ht(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},en.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)),Tn(i)&&(i=bt(i)),o=this._getOverlayContainer(n),r=bt('<div class="djs-overlay" data-overlay-id="'+t+'">'),wn(r,{position:"absolute"}),r.appendChild(i),e.type&&Et(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();qc(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())},en.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&&(zt(r)&&r>t.scale||zt(o)&&o<t.scale))&&(c=!1),qc(a,c),this._updateOverlayScale(e,t)},en.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),zt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),zt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),zt(a)&&(s="scale("+a+","+a+")"),eb(o,s)},en.prototype._updateOverlaysVisibilty=function(e){var t=this;$(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},en.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});$(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){vi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",t2,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&($(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&&Et(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 n2(e){var t=bt('<div class="djs-overlay-container" />');return wn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Jv(e,t,n){wn(e,{left:t+"px",top:n+"px"})}function qc(e,t){e.style.display=t===!1?"none":""}function eb(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Kc={__init__:["overlays"],overlays:["type",en]};function Sf(e,t){t.invoke(ee,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)})}ye(Sf,ee),Sf.$inject=["canvas","injector"];const i2={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Sf]};function za(e){return CSS.escape(e)}var r2={"&":"&","<":"<",">":">",'"':""","'":"'"};function tb(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return r2[t]})}var o2="bjs-breadcrumbs-shown";function nb(e,t,n){var i=bt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Et(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=te(u),f=ht(a,function(p){return p===l});f&&s()});function s(c){c&&(a=a2(c));var u=a.flatMap(function(f){var p=n.findRoot(Ei(f))||n.findRoot(f.id);if(!p&&E(f,"bpmn:Process")){var d=t.find(function(g){var y=te(g);return y&&y.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var m=tb(f.name||f.id),h=bt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(p)}),h});i.innerHTML="";var l=u.length>1;o.toggle(o2,l),u.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}nb.$inject=["eventBus","elementRegistry","canvas"];function a2(e){for(var t=te(e),n=[],i=t;i;i=i.$parent)(E(i,"bpmn:SubProcess")||E(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function ib(e,t){var n=null,i=new s2;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,!(!E(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})}ib.$inject=["eventBus","canvas"];function s2(){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 rb={x:180,y:160};function Ur(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Ur.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)})}},Ur.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;E(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),u2(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},Ur.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=c2(e),i={x:n.x-rb.x,y:n.y-rb.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)})},Ur.prototype._moveToDiPlane=function(e,t){var n=ob(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Ur.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},Ur.$inject=["eventBus","moddle"];function ob(e){return E(e,"bpmndi:BPMNDiagram")?e:ob(e.$parent)}function c2(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=Te(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),js(t)}function u2(e,t){var n=e.$parent;return!(!E(n,"bpmn:SubProcess")||n===t.bpmnElement||We(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Xc=250,l2='<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>',p2="bjs-drilldown-empty";function br(e,t,n,i,r){ee.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",Xc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Xc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Xc,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"],Xc,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)})})}ye(br,ee),br.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},br.prototype._canDrillDown=function(e){var t=this._canvas;return E(e,"bpmn:SubProcess")&&t.findRoot(Ei(e))},br.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=te(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Et(i.html).toggle(p2,!r)}},br.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=te(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=bt('<button type="button" class="bjs-drilldown">'+l2+"</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(Ei(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},br.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},br.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const f2={__depends__:[Kc,nf,i2],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",nb],drilldownCentering:["type",ib],drilldownOverlayBehavior:["type",br],subprocessCompatibility:["type",Ur]};function xr(e){St.call(this,e)}ye(xr,St),xr.prototype._modules=[Xm,f2,Kc,ti,ga],xr.prototype._moddleExtensions={};var Zc="keyboard.keydown",d2="keyboard.keyup",h2=1e3,ab="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 En(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(ab));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}En.$inject=["config.keyboard","eventBus"],En.prototype._keydownHandler=function(e){this._keyHandler(e,Zc)},En.prototype._keyupHandler=function(e){this._keyHandler(e,d2)},En.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Zc,i),n&&e.preventDefault()}},En.prototype._isEventIgnored=function(e){return!1},En.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(ab)),this.unbind(),e=this._node=this._target,Ne.bind(e,"keydown",this._keydownHandler),Ne.bind(e,"keyup",this._keyupHandler),this._fire("bind")},En.prototype.getBinding=function(){return this._node},En.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ne.unbind(e,"keydown",this._keydownHandler),Ne.unbind(e,"keyup",this._keyupHandler)),this._node=null},En.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},En.prototype.addListener=function(e,t,n){Xt(e)&&(n=t,t=e,e=h2),this._eventBus.on(n||Zc,e,t)},En.prototype.removeListener=function(e,t){this._eventBus.off(t||Zc,e)},En.prototype.hasModifier=IA,En.prototype.isCmd=Bn,En.prototype.isShift=Wp,En.prototype.isKey=Wt;var m2=500;function No(e,t){var n=this;e.on("editorActions.init",m2,function(i){var r=i.editorActions;n.registerBindings(t,r)})}No.$inject=["eventBus","keyboard"],No.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(jA(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(HA(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(BA(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(NA(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if($A(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(FA(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Wt(["+","Add","="],r)&&Bn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Wt(["-","Subtract"],r)&&Bn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Wt("0",r)&&Bn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Wt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Rf={__init__:["keyboard","keyboardBindings"],keyboard:["type",En],keyboardBindings:["type",No]};var g2={moveSpeed:50,moveSpeedAccelerated:200};function sb(e,t,n){var i=this;this._config=V({},g2,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})}}sb.$inject=["config.keyboardMove","keyboard","canvas"];const cb={__depends__:[Rf],__init__:["keyboardMove"],keyboardMove:["type",sb]};var y2=15;function ub(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=jr(s),f=pi(l,c);if(!n.dragging&&v2(f)>y2&&(n.dragging=!0,u===0&&By(e),Sc("grab")),n.dragging){var p=n.last||n.start;f=pi(l,p),t.scroll({dx:f.x,dy:f.y}),n.last=l}s.preventDefault()}function o(s){Ne.unbind(document,"mousemove",r),Ne.unbind(document,"mouseup",o),n=null,Iy()}function a(s){if(!Lr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:jr(s)},Ne.bind(document,"mousemove",r),Ne.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}ub.$inject=["eventBus","canvas"];function v2(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const lb={__init__:["moveCanvas"],moveCanvas:["type",ub]};function pb(e,t){var n=zl(e.min),i=zl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function b2(e,t){return Math.max(e.min,Math.min(e.max,t))}var x2=Math.sign||function(e){return e>=0?1:-1},Cf={min:.2,max:4},fb=10,_2=.1,w2=.75;function Ci(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Cn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||w2;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Ci.$inject=["config.zoomScroll","eventBus","canvas"],Ci.prototype.scroll=function(t){this._canvas.scroll(t)},Ci.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Ci.prototype.zoom=function(t,n){var i=pb(Cf,fb*2);this._totalDelta+=t,Math.abs(this._totalDelta)>_2&&(this._zoom(t,n,i),this._totalDelta=0)},Ci.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Gg()&&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))*x2(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)}},Ci.prototype.stepZoom=function(t,n){var i=pb(Cf,fb);this._zoom(t,n,i)},Ci.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=zl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(b2(Cf,s),t)},Ci.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Ne[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Ci.prototype._init=function(e){this.toggle(e)};const db={__init__:["zoomScroll"],zoomScroll:["type",Ci]};function Ga(e){xr.call(this,e)}ye(Ga,xr),Ga.prototype._navigationModules=[cb,lb,db],Ga.prototype._modules=[].concat(xr.prototype._modules,Ga.prototype._navigationModules);function Pf(e){return e&&e[e.length-1]}function hb(e){return e.y}function mb(e){return e.x}var E2={left:mb,center:mb,right:function(e){return e.x+e.width},top:hb,middle:hb,bottom:function(e){return e.y+e.height}};function $o(e,t){this._modeling=e,this._rules=t}$o.$inject=["modeling","rules"],$o.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}},$o.prototype._isType=function(e,t){return t.indexOf(e)!==-1},$o.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function f(p,d){return Math.round((p[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=Pf(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if($(t,function(p){var d=p[i]+Math.round(p[r]/2);a[d]?a[d].elements.push(p):a[d]={elements:[p],center:d}}),c=di(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=Pf(c).center,o;u=t[0],t=di(t,function(p){return p[i]+p[r]}),l=Pf(t),o[e]=f(u,l)}return o},$o.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}),De(i)&&(r=i),!(r.length<2||!i)){var o=E2[t],a=di(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const S2={__init__:["alignElements"],alignElements:["type",$o]},R2=new Do;function Fo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Fo.$inject=["eventBus"],Fo.prototype.schedule=function(e,t=R2.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Fo.prototype._schedule=function(e,t){const n=C2();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}},Fo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Fo.prototype._cancel=function(e){clearTimeout(e.executionId)};function C2(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const P2={scheduler:["type",Fo]};var A2="djs-element-hidden",Qc=".entry",T2=1e3,gb=8,M2=300;function $t(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}$t.$inject=["canvas","elementRegistry","eventBus","scheduler"],$t.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=De(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=De(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},$t.prototype._createContainer=function(){var e=bt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},$t.prototype.registerProvider=function(e,t){t||(t=e,e=T2),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},$t.prototype.getEntries=function(e){var t=this._getProviders(),n=De(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return $(t,function(r){if(Xt(r[n])){var o=r[n](e);Xt(o)?i=o(i):$(o,function(a,s){i[s]=a})}}),i},$t.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=hn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},M2);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},$t.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(Xt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},$t.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))}},$t.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},$t.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;$(t,function(r,o){var a=r.group||"default",s=bt(r.html||'<div class="entry" draggable="true"></div>'),c;hn(s,"data-action",o),c=ut("[data-group="+za(a)+"]",n),c||(c=bt('<div class="group"></div>'),hn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&k2(s,r.className),r.title&&hn(s,"title",r.title),r.imageUrl&&(i=bt("<img>"),hn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Et(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},$t.prototype._createHtml=function(e){var t=this,n=bt('<div class="djs-context-pad"></div>');return Dn.bind(n,Qc,"click",function(i){t.trigger("click",i)}),Dn.bind(n,Qc,"dragstart",function(i){t.trigger("dragstart",i)}),Dn.bind(n,Qc,"mouseover",function(i){t.trigger("mouseover",i)}),Dn.bind(n,Qc,"mouseout",function(i){t.trigger("mouseout",i)}),Ne.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},$t.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()&&D2(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},$t.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},$t.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return De(e)!==De(n)?!1:De(e)?e.length===n.length&&Mr(e,function(i){return n.includes(i)}):n===e},$t.prototype.isShown=function(){return this.isOpen()&&Et(this._current.html).has("open")},$t.prototype.show=function(){this.isOpen()&&(Et(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},$t.prototype.hide=function(){this.isOpen()&&(Et(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},$t.prototype._getPosition=function(e){if(!De(e)&&pt(e)){var t=this._canvas.viewbox(),n=O2(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+gb*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+gb*this._canvas.zoom(),top:s.top-a.top}},$t.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")},$t.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=De(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,A2)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},$t.prototype._getTargetBounds=function(e){var t=this,n=De(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 k2(e,t){var n=Et(e);t=De(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function O2(e){return e.waypoints[e.waypoints.length-1]}function D2(e,t){return e=De(e)?e:[e],t=De(t)?t:[t],e.length===t.length&&Mr(e,function(n){return t.includes(n)})}const yb={__depends__:[Ec,P2,Kc],contextPad:["type",$t]};var Jc,Ct,vb,_r,bb,xb,_b,Af,eu,Va,wb,Tf,Mf,kf,tu={},nu=[],L2=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,iu=Array.isArray;function Wi(e,t){for(var n in t)e[n]=t[n];return e}function Of(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Eb(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?Jc.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 ru(e,a,i,r,null)}function ru(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??++vb,__i:-1,__u:0};return r==null&&Ct.vnode!=null&&Ct.vnode(o),o}function ou(e){return e.children}function au(e,t){this.props=e,this.context=t}function Yr(e,t){if(t==null)return e.__?Yr(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"?Yr(e):null}function I2(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Wi({},t);o.__v=t.__v+1,Ct.vnode&&Ct.vnode(o),Df(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Yr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,kb(i,o,r),t.__e=t.__=null,o.__e!=n&&Sb(o)}}function Sb(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}),Sb(e)}function Rb(e){(!e.__d&&(e.__d=!0)&&_r.push(e)&&!su.__r++||bb!=Ct.debounceRendering)&&((bb=Ct.debounceRendering)||xb)(su)}function su(){try{for(var e,t=1;_r.length;)_r.length>t&&_r.sort(_b),e=_r.shift(),t=_r.length,I2(e)}finally{_r.length=su.__r=0}}function Cb(e,t,n,i,r,o,a,s,c,u,l){var f,p,d,m,h,g,y=i&&i.__k||nu,v=t.length;for(c=B2(n,t,y,c,v),f=0;f<v;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&y[d.__i]||tu,d.__i=f,g=Df(e,d,p,r,o,a,s,c,u,l),m=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&Lf(p.ref,null,d),l.push(d.ref,d.__c||m,d)),h==null&&m!=null&&(h=m),4&d.__u?(c=Pb(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&g!==void 0?c=g:m&&(c=m.nextSibling),d.__u&=-7);return n.__e=h,c}function B2(e,t,n,i,r){var o,a,s,c,u,l=n.length,f=l,p=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]=ru(null,a,null,null,null):iu(a)?a=e.__k[o]=ru(ou,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=ru(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=N2(a,n,c,f))!=-1&&(f--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?p--:r<l&&p++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?p--:u==c+1?p++:(u>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Yr(s)),Db(s,s));return i}function Pb(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=Pb(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Yr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function N2(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 Ab(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||L2.test(t)?n:n+"px"}function cu(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||Ab(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Ab(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(wb,"$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[Va]=i[Va]:(n[Va]=Tf,e.addEventListener(t,o?kf:Mf,o)):e.removeEventListener(t,o?kf:Mf,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 Tb(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[eu]==null)t[eu]=Tf++;else if(t[eu]<n[Va])return;return n(Ct.event?Ct.event(t):t)}}}function Df(e,t,n,i,r,o,a,s,c,u){var l,f,p,d,m,h,g,y,v,b,x,C,P,D,T,I,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=Ct.__b)&&l(t);e:if(typeof k=="function"){f=a.length;try{if(v=t.props,b=k.prototype&&k.prototype.render,x=(l=k.contextType)&&i[l.__c],C=l?x?x.props.value:l.__:i,n.__c?y=(p=t.__c=n.__c).__=p.__E:(b?t.__c=p=new k(v,C):(t.__c=p=new au(v,C),p.constructor=k,p.render=F2),x&&x.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),b&&p.__s==null&&(p.__s=p.state),b&&k.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Wi({},p.__s)),Wi(p.__s,k.getDerivedStateFromProps(v,p.__s))),m=p.props,h=p.state,p.__v=t,d)b&&k.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),b&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(b&&k.getDerivedStateFromProps==null&&v!==m&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(v,C),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(v,p.__s,C)===!1){t.__v!=n.__v&&(p.props=v,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(L){L&&(L.__=t)}),nu.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=Yr(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(v,p.__s,C),b&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(m,h,g)})}if(p.context=C,p.props=v,p.__P=e,p.__e=!1,P=Ct.__r,D=0,b)p.state=p.__s,p.__d=!1,P&&P(t),l=p.render(p.props,p.state,p.context),nu.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,P&&P(t),l=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++D<25);p.state=p.__s,p.getChildContext!=null&&(i=Wi(Wi({},i),p.getChildContext())),b&&!d&&p.getSnapshotBeforeUpdate!=null&&(g=p.getSnapshotBeforeUpdate(m,h)),T=l!=null&&l.type===ou&&l.key==null?Ob(l.props.children):l,s=Cb(e,iu(T)?T:[T],t,n,i,r,o,a,s,c,u),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),y&&(p.__E=p.__=null)}catch(L){if(a.length=f,t.__v=null,c||o!=null){if(L.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(I=o.length;I--;)Of(o[I])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),L.then||Mb(t),Ct.__e(L,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=$2(n.__e,t,n,i,r,o,a,c,u);return(l=Ct.diffed)&&l(t),128&t.__u?void 0:s}function Mb(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Mb))}function kb(e,t,n){for(var i=0;i<n.length;i++)Lf(n[i],n[++i],n[++i]);Ct.__c&&Ct.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Ct.__e(o,r.__v)}})}function Ob(e){return typeof e!="object"||e==null||e.__b>0?e:iu(e)?e.map(Ob):e.constructor!==void 0?null:Wi({},e)}function $2(e,t,n,i,r,o,a,s,c){var u,l,f,p,d,m,h,g=n.props||tu,y=t.props,v=t.type;if(v=="svg"?r="http://www.w3.org/2000/svg":v=="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==!!v&&(v?d.localName==v:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(v==null)return document.createTextNode(y);e=document.createElementNS(r,v,y.is&&y),s&&(Ct.__m&&Ct.__m(t,o),s=!1),o=null}if(v==null)g===y||s&&e.data==y||(e.data=y);else{if(o=v=="textarea"&&y.defaultValue!=null?null:o&&Jc.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"?f=d:u=="children"||u in y||u=="value"&&"defaultValue"in y||u=="checked"&&"defaultChecked"in y||cu(e,u,null,d,r);for(u in y)d=y[u],u=="children"?p=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?m=d:u=="checked"?h=d:s&&typeof d!="function"||g[u]===d||cu(e,u,d,g[u],r);if(l)s||f&&(l.__html==f.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(f&&(e.innerHTML=""),Cb(t.type=="template"?e.content:e,iu(p)?p:[p],t,n,i,v=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Yr(n,0),s,c),o!=null)for(u=o.length;u--;)Of(o[u]);s&&v!="textarea"||(u="value",v=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[u]||v=="progress"&&!m||v=="option"&&m!=g[u])&&cu(e,u,m,g[u],r),u="checked",h!=null&&h!=e[u]&&cu(e,u,h,g[u],r))}return e}function Lf(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){Ct.__e(r,n)}}function Db(e,t,n){var i,r;if(Ct.unmount&&Ct.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Lf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Ct.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Db(i[r],t,n||typeof e.type!="function");n||Of(e.__e),e.__c=e.__=e.__e=void 0}function F2(e,t,n){return this.constructor(e,n)}function Lb(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Ct.__&&Ct.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Df(t,e=t.__k=Eb(ou,null,[e]),r||tu,tu,t.namespaceURI,r?null:t.firstChild?Jc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),kb(o,e,a),e.props.children=null}Jc=nu.slice,Ct={__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}},vb=0,au.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Wi({},this.state),typeof e=="function"&&(e=e(Wi({},n),this.props)),e&&Wi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Rb(this))},au.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Rb(this))},au.prototype.render=ou,_r=[],xb=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_b=function(e,t){return e.__v.__b-t.__v.__b},su.__r=0,Af=Math.random().toString(8),eu="__d"+Af,Va="__a"+Af,wb=/(PointerCapture)$|Capture$/i,Tf=0,Mf=Tb(!1),kf=Tb(!0);var Ib=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,Ib(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Bb=new Map;function j2(e){var t=Bb.get(this);return t||(t=new Map,Bb.set(this,t)),(t=Ib(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var f=0;f<n[l].length;f++)i=n[l][f],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][f+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 dt=j2.bind(Eb),jo,Ft,If,Nb,Wa=0,$b=[],Ut=Ct,Fb=Ut.__b,jb=Ut.__r,Hb=Ut.diffed,zb=Ut.__c,Gb=Ut.unmount,Vb=Ut.__;function uu(e,t){Ut.__h&&Ut.__h(Ft,e,Wa||t),Wa=0;var n=Ft.__H||(Ft.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Bf(e){return Wa=1,H2(Ub,e)}function H2(e,t,n){var i=uu(jo++,2);if(i.t=e,!i.__c&&(i.__=[Ub(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=Ft,!Ft.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,f=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var m=d.__[0];d.__=d.__N,d.__N=void 0,m!==d.__[0]&&(f=!0)}}),o){var p=o.call(this,s,c,u);return l?p||f:p}return!l||f};Ft.__f=!0;var o=Ft.shouldComponentUpdate,a=Ft.componentWillUpdate;Ft.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)},Ft.shouldComponentUpdate=r}return i.__N||i.__}function lu(e,t){var n=uu(jo++,3);!Ut.__s&&Ff(n.__H,t)&&(n.__=e,n.u=t,Ft.__H.__h.push(n))}function Nf(e,t){var n=uu(jo++,4);!Ut.__s&&Ff(n.__H,t)&&(n.__=e,n.u=t,Ft.__h.push(n))}function pu(e){return Wa=5,Ui(function(){return{current:e}},[])}function Ui(e,t){var n=uu(jo++,7);return Ff(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ua(e,t){return Wa=8,Ui(function(){return e},t)}function z2(){for(var e;e=$b.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(fu),t.__h.some($f),t.__h=[]}catch(n){t.__h=[],Ut.__e(n,e.__v)}}}Ut.__b=function(e){Ft=null,Fb&&Fb(e)},Ut.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Vb&&Vb(e,t)},Ut.__r=function(e){jb&&jb(e),jo=0;var t=(Ft=e.__c).__H;t&&(If===Ft?(t.__h=[],Ft.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(fu),t.__h.some($f),t.__h=[],jo=0)),If=Ft},Ut.diffed=function(e){Hb&&Hb(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&($b.push(t)!==1&&Nb===Ut.requestAnimationFrame||((Nb=Ut.requestAnimationFrame)||G2)(z2)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),If=Ft=null},Ut.__c=function(e,t){t.some(function(n){try{n.__h.some(fu),n.__h=n.__h.filter(function(i){return!i.__||$f(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Ut.__e(i,n.__v)}}),zb&&zb(e,t)},Ut.unmount=function(e){Gb&&Gb(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{fu(i)}catch(r){t=r}}),n.__H=void 0,t&&Ut.__e(t,n.__v))};var Wb=typeof requestAnimationFrame=="function";function G2(e){var t,n=function(){clearTimeout(i),Wb&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Wb&&(t=requestAnimationFrame(n))}function fu(e){var t=Ft,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ft=t}function $f(e){var t=Ft;e.__c=e.__(),Ft=t}function Ff(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Ub(e,t){return typeof t=="function"?t(e):t}function V2(e){const{navigationStack:t,setNavigationStack:n}=e,i=Ui(()=>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 dt`
|
|
11
12
|
<div class="djs-popup-breadcrumbs">
|
|
12
|
-
${r&&
|
|
13
|
+
${r&&dt`
|
|
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)=>
|
|
26
|
+
${i.map((a,s)=>dt`
|
|
26
27
|
<button
|
|
27
28
|
key=${s}
|
|
28
29
|
type="button"
|
|
@@ -34,23 +35,23 @@
|
|
|
34
35
|
</button>
|
|
35
36
|
<span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
|
|
36
37
|
`)}
|
|
37
|
-
${o&&
|
|
38
|
+
${o&&dt`
|
|
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
|
|
44
|
+
`}function Yb(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=Yb(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function du(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Yb(e))&&(i&&(i+=" "),i+=t);return i}function W2(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Ui(()=>U2(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return dt`
|
|
44
45
|
<div class="djs-popup-header">
|
|
45
46
|
<h3 class="djs-popup-title" title=${o}>${o}</h3>
|
|
46
|
-
${a.map(u=>
|
|
47
|
+
${a.map(u=>dt`
|
|
47
48
|
<ul key=${u.id} class="djs-popup-header-group" data-header-group=${u.id}>
|
|
48
49
|
|
|
49
|
-
${u.entries.map(l=>
|
|
50
|
+
${u.entries.map(l=>dt`
|
|
50
51
|
<li key=${l.id}>
|
|
51
52
|
<${s(l)?"button":"span"}
|
|
52
|
-
class=${
|
|
53
|
-
onClick=${
|
|
53
|
+
class=${Y2(l,l===i)}
|
|
54
|
+
onClick=${f=>c(f,l)}
|
|
54
55
|
title=${l.title||l.label}
|
|
55
56
|
data-id=${l.id}
|
|
56
57
|
aria-disabled=${l.disabled||void 0}
|
|
@@ -59,8 +60,8 @@
|
|
|
59
60
|
onFocus=${()=>s(l)&&r(l)}
|
|
60
61
|
onBlur=${()=>s(l)&&r(null)}
|
|
61
62
|
>
|
|
62
|
-
${l.imageUrl&&
|
|
63
|
-
${l.label?
|
|
63
|
+
${l.imageUrl&&dt`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&dt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
|
|
64
|
+
${l.label?dt`
|
|
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
|
|
73
|
+
`}function U2(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 Y2(e,t){return du("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function qb(e,t){return`${e}-entry-${t.id}`}function q2(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 dt`
|
|
73
74
|
<li
|
|
74
|
-
class=${
|
|
75
|
+
class=${du("entry",{selected:i,disabled:n.disabled})}
|
|
75
76
|
data-id=${n.id}
|
|
76
|
-
id=${
|
|
77
|
+
id=${qb(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=${
|
|
91
|
+
class=${du("djs-popup-entry-name",n.className)}
|
|
91
92
|
>
|
|
92
|
-
${n.imageUrl&&
|
|
93
|
+
${n.imageUrl&&dt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&dt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
|
|
93
94
|
|
|
94
|
-
${n.label?
|
|
95
|
+
${n.label?dt`
|
|
95
96
|
<span class="djs-popup-label">
|
|
96
97
|
${n.label}
|
|
97
98
|
</span>
|
|
98
99
|
`:null}
|
|
99
100
|
|
|
100
|
-
${n.documentationRef&&
|
|
101
|
+
${n.documentationRef&&dt`
|
|
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&&
|
|
118
|
+
${n.description&&dt`
|
|
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&&
|
|
126
|
+
${n.entries&&dt`
|
|
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,73 +131,73 @@
|
|
|
130
131
|
</div>
|
|
131
132
|
`}
|
|
132
133
|
</li>
|
|
133
|
-
`}function
|
|
134
|
+
`}function K2(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,f=pu();Nf(()=>{if(!r||!r.current)return;const h=f.current;if(!h)return;const g=h.querySelector(".selected");g&&X2(g)},[t]);const p=()=>{r.current=!1},d=h=>{r.current||n(h)},m=()=>{r.current||n(null)};return dt`
|
|
134
135
|
<div
|
|
135
136
|
class="djs-popup-results"
|
|
136
|
-
ref=${
|
|
137
|
+
ref=${f}
|
|
137
138
|
id=${a}
|
|
138
139
|
role="listbox"
|
|
139
140
|
aria-label=${s}
|
|
140
141
|
tabIndex=${c}
|
|
141
142
|
aria-activedescendant=${u}
|
|
142
|
-
onMouseMove=${
|
|
143
|
+
onMouseMove=${p}
|
|
143
144
|
>
|
|
144
|
-
${i.map(
|
|
145
|
-
${
|
|
146
|
-
<div key=${
|
|
147
|
-
${
|
|
145
|
+
${i.map(h=>dt`
|
|
146
|
+
${h.name&&dt`
|
|
147
|
+
<div key=${h.id} id=${Kb(o,h)} class="entry-header" title=${h.name}>
|
|
148
|
+
${h.name}
|
|
148
149
|
</div>
|
|
149
150
|
`}
|
|
150
151
|
<ul
|
|
151
152
|
class="djs-popup-group"
|
|
152
|
-
data-group=${
|
|
153
|
+
data-group=${h.id}
|
|
153
154
|
role="group"
|
|
154
|
-
aria-labelledby=${
|
|
155
|
+
aria-labelledby=${h.name?Kb(o,h):void 0}
|
|
155
156
|
>
|
|
156
|
-
${
|
|
157
|
-
<${
|
|
157
|
+
${h.entries.map(g=>dt`
|
|
158
|
+
<${q2}
|
|
158
159
|
key=${g.id}
|
|
159
160
|
idPrefix=${o}
|
|
160
161
|
entry=${g}
|
|
161
162
|
selected=${g===t}
|
|
162
163
|
onMouseEnter=${()=>d(g)}
|
|
163
|
-
onMouseLeave=${
|
|
164
|
+
onMouseLeave=${m}
|
|
164
165
|
...${l}
|
|
165
166
|
/>
|
|
166
167
|
`)}
|
|
167
168
|
</ul>
|
|
168
169
|
`)}
|
|
169
170
|
</div>
|
|
170
|
-
`}function
|
|
171
|
-
<${
|
|
171
|
+
`}function Kb(e,t){return`${e}-group-${t.id}`}function X2(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const Z2=new Do("djs-popup");function Q2(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:f,entries:p,onOpened:d,onClosed:m}=e,[h,g]=Bf([]);lu(()=>{g([])},[p]);const[y,v]=Bf(""),b=y.trim().length>0,x=Ui(()=>tk(p),[p]),C=Ui(()=>zt(u)?x.length>5:!1,[u,x]),P=Ui(()=>{const W=h.length?h[h.length-1].entries:p;return C?b?f(x.filter(({searchable:Y})=>Y!==!1),y,{keys:["label","search","description"]}).map(({item:Y})=>Y):W.filter(({rank:Y=0})=>Y>=0):W},[C,b,x,y,f,h,p]),D=Ui(()=>b?P.length?[{id:"default",entries:P}]:[]:nk(P),[P,b]),[T,I]=Bf(P[0]),k=pu(null),L=pu(!1),z=Ui(()=>Z2.next(),[]),ae=`${z}-results`,me=T&&qb(z,T);lu(()=>{const W=k.current;W&&P.includes(W)?I(W):I(P[0]),k.current=null},[P]);const Ue=Ua(W=>{const Y=ek(D);let Me=Y.indexOf(T)+W;Me<0&&(Me=Y.length-1),Me>=Y.length&&(Me=0),L.current=!0,I(Y[Me])},[D,T]),$e=Ua(W=>{W>0&&T&&T.entries&&(L.current=!0,g(Y=>[...Y,T])),W<0&&h.length>0&&(L.current=!0,k.current=h[h.length+W],g(Y=>Y.slice(0,W)))},[T,h]),q=Ua((W,Y,Z)=>{if(!(!Y||Y.disabled))return Y.entries?(W.preventDefault(),$e(1)):n(W,Y,Z)},[n,$e]),le=Ua(W=>{if(W.key==="Enter"&&T){const Y=W.target;return!!Lr(Y,"a, button",!0)||T.disabled?void 0:q(W,T)}if(W.key==="Backspace"){const Y=W.target;if(!(_l(Y,"input")&&Y.value!==""))return $e(-1),W.preventDefault()}if(W.key==="ArrowUp")return Ue(-1),W.preventDefault();if(W.key==="ArrowDown")return Ue(1),W.preventDefault();if(W.key==="ArrowRight")return $e(1),W.preventDefault();if(W.key==="ArrowLeft")return $e(-1),W.preventDefault()},[T,Ue,$e,q]),oe=Ua(W=>{_l(W.target,"input")&&v(()=>W.target.value)},[v]);lu(()=>(d(),()=>{m()}),[]);const fe=!b&&h.length>0,Oe=(a||r.length>0)&&!fe;return dt`
|
|
172
|
+
<${Xb}
|
|
172
173
|
onClose=${t}
|
|
173
|
-
onKeyup=${
|
|
174
|
-
onKeydown=${
|
|
174
|
+
onKeyup=${oe}
|
|
175
|
+
onKeydown=${le}
|
|
175
176
|
className=${i}
|
|
176
177
|
position=${o}
|
|
177
178
|
width=${s}
|
|
178
179
|
scale=${c}
|
|
179
|
-
navigationStack=${
|
|
180
|
+
navigationStack=${h}
|
|
180
181
|
>
|
|
181
|
-
${
|
|
182
|
-
<${
|
|
182
|
+
${Oe&&dt`
|
|
183
|
+
<${W2}
|
|
183
184
|
headerEntries=${r}
|
|
184
185
|
onSelect=${n}
|
|
185
|
-
selectedEntry=${
|
|
186
|
-
setSelectedEntry=${
|
|
186
|
+
selectedEntry=${T}
|
|
187
|
+
setSelectedEntry=${I}
|
|
187
188
|
title=${a}
|
|
188
189
|
/>
|
|
189
190
|
`}
|
|
190
|
-
${
|
|
191
|
-
<${
|
|
192
|
-
navigationStack=${
|
|
191
|
+
${fe&&dt`
|
|
192
|
+
<${V2}
|
|
193
|
+
navigationStack=${h}
|
|
193
194
|
setNavigationStack=${g}
|
|
194
195
|
/>
|
|
195
196
|
`}
|
|
196
|
-
${
|
|
197
|
+
${p.length>0&&dt`
|
|
197
198
|
<div class="djs-popup-body">
|
|
198
199
|
|
|
199
|
-
${
|
|
200
|
+
${C&&dt`
|
|
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=${
|
|
211
|
-
aria-activedescendant=${
|
|
211
|
+
aria-controls=${ae}
|
|
212
|
+
aria-activedescendant=${me||void 0}
|
|
212
213
|
aria-autocomplete="list"
|
|
213
214
|
/>
|
|
214
215
|
</div>
|
|
215
216
|
`}
|
|
216
217
|
|
|
217
|
-
${b&&
|
|
218
|
+
${b&&dt`
|
|
218
219
|
<div class="djs-popup-search-count" aria-live="polite">
|
|
219
|
-
${
|
|
220
|
+
${P.length} ${P.length===1?"result":"results"} found
|
|
220
221
|
</div>
|
|
221
222
|
`}
|
|
222
223
|
|
|
223
|
-
<${
|
|
224
|
-
groupedEntries=${
|
|
225
|
-
selectedEntry=${
|
|
226
|
-
setSelectedEntry=${
|
|
224
|
+
<${K2}
|
|
225
|
+
groupedEntries=${D}
|
|
226
|
+
selectedEntry=${T}
|
|
227
|
+
setSelectedEntry=${I}
|
|
227
228
|
keyboardSelection=${L}
|
|
228
|
-
onAction=${
|
|
229
|
-
idPrefix=${
|
|
230
|
-
id=${
|
|
229
|
+
onAction=${q}
|
|
230
|
+
idPrefix=${z}
|
|
231
|
+
id=${ae}
|
|
231
232
|
ariaLabel=${a||"Results"}
|
|
232
|
-
tabIndex=${
|
|
233
|
-
ariaActivedescendant=${
|
|
233
|
+
tabIndex=${C?-1:0}
|
|
234
|
+
ariaActivedescendant=${C?void 0:me||void 0}
|
|
234
235
|
/>
|
|
235
236
|
|
|
236
|
-
${
|
|
237
|
+
${T&&T.documentationRef&&dt`
|
|
237
238
|
<div class="djs-popup-footer">
|
|
238
239
|
<a
|
|
239
240
|
class="djs-popup-footer-docs"
|
|
240
|
-
href=${
|
|
241
|
-
onClick=${
|
|
242
|
-
aria-label=${
|
|
241
|
+
href=${T.documentationRef}
|
|
242
|
+
onClick=${W=>W.stopPropagation()}
|
|
243
|
+
aria-label=${T.label?`Open entry documentation for ${T.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&&
|
|
257
|
-
<div class="djs-popup-no-results">${
|
|
257
|
+
${l&&P.length===0&&dt`
|
|
258
|
+
<div class="djs-popup-no-results">${Xt(l)?l(y):l}</div>
|
|
258
259
|
`}
|
|
259
|
-
</${
|
|
260
|
-
`}function
|
|
260
|
+
</${Xb}>
|
|
261
|
+
`}function Xb(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=pu();return Nf(()=>{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]),Nf(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),lu(()=>{const u=f=>{if(f.key==="Escape")return f.preventDefault(),t()},l=f=>{if(!Lr(f.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)}},[]),dt`
|
|
261
262
|
<div
|
|
262
|
-
class=${
|
|
263
|
-
style=${
|
|
263
|
+
class=${du("djs-popup",r)}
|
|
264
|
+
style=${J2(e)}
|
|
264
265
|
onKeydown=${n}
|
|
265
266
|
onKeyup=${i}
|
|
266
267
|
ref=${c}
|
|
@@ -268,10 +269,10 @@
|
|
|
268
269
|
>
|
|
269
270
|
${o}
|
|
270
271
|
</div>
|
|
271
|
-
`}function
|
|
272
|
-
<${
|
|
273
|
-
onClose=${
|
|
274
|
-
onSelect=${(
|
|
272
|
+
`}function J2(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:zt(t)?n:void 0,maxWidth:zt(t)?"unset":void 0,"transform-origin":"top left"}}function ek(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function tk(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function nk(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 ik="data-id",Zb=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],rk=1e3;function Pt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=zt(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()})}Pt.$inject=["config.popupMenu","eventBus","canvas","search"],Pt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Qb(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),u=this._updateScale(this._current.container);Lb(dt`
|
|
273
|
+
<${Q2}
|
|
274
|
+
onClose=${p=>this.close(p)}
|
|
275
|
+
onSelect=${(p,d,m)=>this.trigger(p,d,m)}
|
|
275
276
|
position=${c}
|
|
276
277
|
className=${t}
|
|
277
278
|
entries=${a}
|
|
@@ -283,7 +284,7 @@
|
|
|
283
284
|
searchFn=${this._search}
|
|
284
285
|
...${{...o}}
|
|
285
286
|
/>
|
|
286
|
-
`,this._current.container)},
|
|
287
|
+
`,this._current.container)},Pt.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()},Pt.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()},Pt.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)}},Pt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Pt.prototype.reset=function(){const e=this._current.container;Lb(null,e),vi(e)},Pt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Pt.prototype._onOpened=function(){this._emit("opened")},Pt.prototype._onClosed=function(){this._emit("closed")},Pt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=bt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Pt.prototype._bindAutoClose=function(){this._eventBus.once(Zb,this.close,this)},Pt.prototype._unbindAutoClose=function(){this._eventBus.off(Zb,this.close,this)},Pt.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),zt(n)&&e<n&&(r=n),zt(i)&&e>i&&(r=i)),r},Pt.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}},Pt.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},Pt.prototype.registerProvider=function(e,t,n){n||(n=t,t=rk),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Pt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Pt.prototype._getEntries=function(e,t){var n={};return $(t,function(i){if(!i.getPopupMenuEntries){$(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=hi(o,["id"])});return}var r=i.getPopupMenuEntries(e);Xt(r)?n=r(n):$(r,function(o,a){n[a]=o})}),n},Pt.prototype._getHeaderEntries=function(e,t){var n={};return $(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;$(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=hi(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Xt(r)?n=r(n):$(r,function(o,a){n[a]=o})}),n},Pt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Xt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Pt.prototype.isOpen=function(){return!!this._current},Pt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Lr(e.delegateTarget||e.target,".entry",!0),o=hn(r,ik);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Xt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Pt.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 Qb(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Qb(r.entries,[...t,...Jb(r.search)]):t.length&&(r.search=[...t,...Jb(r.search)]),r})}function Jb(e){return e?De(e)?e:[e]:[]}function ok(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=ak(o,r,i);return a?{item:o,tokens:a}:[]}).sort(sk(i))}function ak(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=De(s)?s.reduce((l,f)=>{const{tokens:p,matchedWords:d}=rx(f,t);return{tokens:[...l.tokens,p],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):rx(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function sk(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=ck(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=ex;continue}const s=uk(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=ex;continue}}return i}}function ck(e,t){return tx(t)-tx(e)}const ex=.5,Ho={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function tx(e){const t=e.reduce((s,c)=>s+nx(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 nx(e){if(De(e))return Math.max(...e.map(nx));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Ho.FULL:e.wordEnd?Ho.START_FULL_WORD:Ho.START_WORD_PART:e.wordStart?Ho.WORD_START:Ho.WORD_PART)*t:Ho.NO_MATCH*t}function ix(e=""){return De(e)?e.join(", "):e}function uk(e,t){return ix(e).localeCompare(ix(t))}function rx(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(lk),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,f=s.index,p=s.index+l.length,d=f===0,m=p===e.length,h=!!((u=s.groups)!=null&&u.all),g=d||/\s/.test(e.charAt(f-1)),y=m||/\s/.test(e.charAt(p));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:y,start:d,end:m,all:h});const v=h?t:[l];for(const b of v)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 lk(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const ox={search:["value",ok]},jf={__depends__:[ox],__init__:["popupMenu"],popupMenu:["type",Pt]};var ax={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>`},sT=900;function Jr(e,t,n,i){e.registerProvider(sT,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Jr.$inject=["contextPad","popupMenu","translate","canvas"],Jr.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&k(t,this._getEntries(e)),t},Jr.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Jr.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${sy.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);k(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Jr.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 cT=["left","center","right","top","middle","bottom"];function Jo(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Jo.$inject=["popupMenu","alignElements","translate","rules"],Jo.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&k(t,this._getEntries(e)),t},Jo.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Jo.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return P(cT,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:sy[o],action:function(){t.trigger(e,o),i.close()}}}),r};function ac(e){mn.call(this,e)}ac.$inject=["eventBus"],X(ac,mn),ac.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Re(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Ta(n),n.length<2?!1:n})};const uT={__depends__:[bA,yv,vp],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Jr],alignElementsMenuProvider:["type",Jo],bpmnAlignElements:["type",ac]};function si(e,t,n,i){W.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=Mc(_r(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=br(s,function(p){return p.parent.id});P(l,function(p,f){pe(u)&&(p=p.filter(function(d){return ze(u,xr({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)})}si.$inject=["eventBus","elementRegistry","modeling","rules"],X(si,W),si.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ue(at(e)),o=ue(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),Da(k({},o,a))},si.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(lT(i,t)){var r=pT(Sn(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},si.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},si.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},si.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function lT(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function pT(e,t){var n="";return e=ue(e),t=ue(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 sc(e){e.invoke(si,this)}sc.$inject=["injector"],X(sc,si),sc.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 ea(e){mn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}ea.$inject=["eventBus"],X(ea,mn),ea.prototype.canResize=function(e,t){return!1};function cc(e,t){ea.call(this,e),this._modeling=t}X(cc,ea),cc.$inject=["eventBus","modeling"],cc.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 P(e,function(i){if(y(i,"bpmn:Lane")||xe(i)){n=!1;return}}),n};const fT={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",sc],bpmnAutoResizeProvider:["type",cc]};function eo(e,t,n){this._canvas=n,this._opts=k({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()})}eo.$inject=["config.autoScroll","eventBus","canvas"],eo.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++)dT(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 dT(e,t,n){return t<e&&e<n}eo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},eo.prototype.setOptions=function(e){this._opts=k({},this._opts,e)},eo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=ar(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const hT={__depends__:[ti],__init__:["autoScroll"],autoScroll:["type",eo]};var cy="djs-bendpoint",uy="djs-segment-dragger";function mT(e,t){var n=ar(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 yp(e,t,n){var i=mT(e,n),r=Bu(t,i);return r}function _p(e,t){var n=oe("g");Me(n).add(cy),ye(e,n);var i=oe("circle");Z(i,{cx:0,cy:0,r:4}),Me(i).add("djs-visual"),ye(n,i);var r=oe("circle");return Z(r,{cx:0,cy:0,r:10}),Me(r).add("djs-hit"),ye(n,r),t&&Me(n).add(t),n}function gT(e,t,n,i){var r=oe("g");ye(e,r);var o=18,a=6,s=11,c=yT(t,n,i),u=a+s,l=oe("rect");Z(l,{x:-o/2,y:-a/2,width:o,height:a}),Me(l).add("djs-visual"),ye(r,l);var p=oe("rect");return Z(p,{x:-c/2,y:-u/2,width:c,height:u}),Me(p).add("djs-hit"),ye(r,p),Ld(r,i==="v"?90:0),r}function ly(e,t,n){var i=oe("g"),r=pu(t,n),o=Kn(t,n);return ye(e,i),gT(i,t,n,o),Me(i).add(uy),Me(i).add(o==="h"?"horizontal":"vertical"),Ct(i,r.x,r.y),i}function bp(e){return Math.abs(Math.round(e*2/3))}function vT(e,t){var n=_T(e,t);return zu(e,n)}function yT(e,t,n){var i=t.x-e.x,r=t.y-e.y;return bp(n==="h"?i:r)}function _T(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=xh(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function py(e,t,n,i,r){function o(b,x,S){var A=b.index,I=b.point,C,$,j,L,F,te;return A<=0||b.bendpoint?!1:(C=x[A-1],$=x[A],j=pu(C,$),L=Kn(C,$),F=Math.abs(I.x-j.x),te=Math.abs(I.y-j.y),L&&F<=S&&te<=S)}function a(b,x){var S=b.waypoints,A,I,C,$;return x.index<=0||x.bendpoint||(A={start:S[x.index-1],end:S[x.index]},I=Kn(A.start,A.end),!I)?null:(I==="h"?C=A.end.x-A.start.x:C=A.end.y-A.start.y,$=bp(C)/2,$)}function s(b,x){var S=x.waypoints,A=yp(t,S,b),I;if(A){I=a(x,A);var C;if(o(A,S,I)?C=r.start(b,x,A.index):C=i.start(b,x,A.index,!A.bendpoint),C!==!1)return!0}}function c(b,x,S){ve.bind(b,x,function(A){n.triggerMouseEvent(x,A,S),A.stopPropagation()})}function u(b,x){var S=t.getLayer("overlays"),A=$e('.djs-bendpoints[data-element-id="'+Yo(b.id)+'"]',S);return!A&&x&&(A=oe("g"),Z(A,{"data-element-id":b.id}),Me(A).add("djs-bendpoints"),ye(S,A),c(A,"mousedown",b),c(A,"click",b),c(A,"dblclick",b)),A}function l(b,x){return $e('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function p(b,x){x.waypoints.forEach(function(S,A){var I=_p(b);ye(b,I),Ct(I,S.x,S.y)}),_p(b,"floating")}function f(b,x){for(var S=x.waypoints,A,I,C,$=1;$<S.length;$++)A=S[$-1],I=S[$],Kn(A,I)&&(C=ly(b,A,I),Z(C,{"data-segment-idx":$}),c(C,"mousemove",x))}function d(b){P(Ra("."+cy,b),function(x){gt(x)})}function h(b){P(Ra("."+uy,b),function(x){gt(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 w(b,x){var S=$e(".floating",b),A=x.point;S&&(Ct(S,A.x,A.y),Me(S).add("positioned"))}function E(b,x,S){var A=l(x.index,b),I=S[x.index-1],C=S[x.index],$=x.point,j=pu(I,C),L=Kn(I,C),F,te;A&&(F=bT(A),te={x:$.x-j.x,y:$.y-j.y},L==="v"&&(te={x:te.y,y:te.x}),Ct(F,te.x,te.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&>(x)}),e.on("element.marker.update",function(b){var x=b.element,S;x.waypoints&&(S=m(x),b.add?Me(S).add(b.marker):Me(S).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,S=x.waypoints,A,I;if(S){if(A=u(x,!0),I=yp(t,S,b.originalEvent),!I)return;w(A,I),I.bendpoint||E(A,I,S)}}),e.on("element.mousedown",function(b){if(Ti(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 A=$e(".floating",S);A&&Me(A).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,S=b.newId;if(x.waypoints){var A=u(x);A&&Z(A,{"data-element-id":S})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}py.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function bT(e){return $e(".djs-visual",e)}var fy=Math.round,hr="reconnectStart",mr="reconnectEnd",ta="updateWaypoints";function xp(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=hr:!u&&c===d.length-1?h=mr:h=ta;var m=h===ta?"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===ta?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===hr?p:u,target:f===mr?p:l}),d){s.source=f===hr?p:u,s.target=f===mr?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===mr?p:l,target:f===hr?p:u})),d&&(s.source=f===mr?p:l,s.target=f===hr?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!==ta&&(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||{},w={x:fy(a.x),y:fy(a.y)};if(!c)return!1;m===ta?(p?f.splice(u,0,w):f[u]=w,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,kE(f),g)):(m===hr?(g.docking="source",uc(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===mr&&(g.docking="target",uc(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,w,g))},this)}xp.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],xp.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 uc(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===hr)return t&&i&&t===i&&n!==i;if(r===mr)return t&&n&&t===n&&n!==i}var xT="reconnectStart",ET="reconnectEnd",dy="updateWaypoints",na="connect-ok",lc="connect-not-ok",hy="connect-hover",my="djs-updating",gy="djs-dragging",vy=1100;function yy(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=_p(i.getLayer("overlays"));Me(f).add("djs-dragging"),i.addMarker(c,gy),i.addMarker(c,my)}),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,hy),u===dy)return;s?(i.removeMarker(c,lc),i.addMarker(c,na)):s===!1&&(i.removeMarker(c,na),i.addMarker(c,lc))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],vy,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,hy),i.removeMarker(s,c?na:lc))}),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},w=a.hints||{},E={};r&&(w.connectionStart&&(E.connectionStart=w.connectionStart),w.connectionEnd&&(E.connectionEnd=w.connectionEnd),p===xT?uc(a)?(E.connectionEnd=E.connectionEnd||g,E.source=h,E.target=l||d,m=m.reverse()):(E.connectionStart=E.connectionStart||g,E.source=l||d,E.target=h):p===ET?uc(a)?(E.connectionStart=E.connectionStart||g,E.source=l||h,E.target=d,m=m.reverse()):(E.connectionEnd=E.connectionEnd||g,E.source=d,E.target=l||h):(E.noCropping=!0,E.noLayout=!0,m[c]=g),p===dy&&(m=e.cropWaypoints(f,m)),E.waypoints=m,r.drawPreview(a,s,E)),Ct(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],vy,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,gt(c),i.removeMarker(s,my),i.removeMarker(s,gy),u&&(i.removeMarker(u,na),i.removeMarker(u,l?na:lc)),r&&r.cleanUp(a)})}yy.$inject=["bendpointMove","injector","eventBus","canvas"];var _y="connect-hover",by="djs-updating";function xy(e,t,n){return Ep(e,t,e[t]+n)}function Ep(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function wT(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 Ep(t,i,s)}function Ey(e){return e==="x"?"y":"x"}function wy(e,t,n){var i,r;return e.original?e.original:(i=fe(t),r=Ey(n),Ep(e,r,i[r]))}function Sy(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,w=d,E=f.waypoints,b=E[g],x=E[w],S=yp(n,E,p),A,I,C;if(A=Kn(b,x),!!A)return I=A==="v"?"x":"y",g===0&&(b=wy(b,f.source,I)),w===E.length-1&&(x=wy(x,f.target,I)),S?C=S.point:C={x:(b.x+x.x)/2,y:(b.y+x.y)/2},h={connection:f,segmentStartIndex:g,segmentEndIndex:w,segmentStart:b,segmentEnd:x,axis:I,dragPosition:C},i.init(p,C,"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],w=p.segmentEndIndex+f,E=h[w],b=Ey(p.axis),x=wT(d,g,E,b);Ct(p.draggerGfx,x.x,x.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return lu(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=ly(h,f.segmentStart,f.segmentEnd),Me(f.draggerGfx).add("djs-dragging"),n.addMarker(d,by)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,g=f.segmentStart,w=f.segmentEnd,E=f.axis,b=f.originalWaypoints.slice(),x=xy(g,E,p["d"+E]),S=xy(w,E,p["d"+E]),A=b.length,I=0;b[h]=x,b[m]=S;var C,$;h<2&&(C=Rt(d.source,x),h===1?C==="intersect"&&(b.shift(),b[0]=x,I--):C!=="intersect"&&(b.unshift(g),I++)),m>A-3&&($=Rt(d.target,S),m===A-2?$==="intersect"&&(b.pop(),b[b.length-1]=S):$!=="intersect"&&b.push(w)),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,_y)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,_y)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&>(f.draggerGfx),n.removeMarker(d,by)}),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),w=g.waypoints,E=s(d,w),b=g.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+b}};o.updateWaypoints(d,E,x)})}Sy.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var ST=Math.abs,Ry=Math.round;function RT(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],ST(r-e)<=n)return r}function Cy(e){return{x:e.x,y:e.y}}function Py(e){return{x:e.x+e.width,y:e.y+e.height}}function _n(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Ry(e.x+e.width/2),y:Ry(e.y+e.height/2)}}function to(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function lt(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 Ay(e){return e.children||[]}var CT=Math.abs,Ty=Math.round,wp=10;function My(e){function t(o,a){if(pe(o)){for(var s=o.length;s--;)if(CT(o[s]-a)<=wp)return o[s]}else{o=+o;var c=a%o;if(c<wp)return a-c;if(c>o-wp)return a-c+o}return a}function n(o,a){if(o.waypoints)return vT(a,o);if(o.width)return{x:Ty(o.width/2+o.x),y:Ty(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:[]},P(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;k(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&<(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&<(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:[]},P(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);!je(s)||!c||!c.x||!c.y||(lt(o,"x",c.x),lt(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;k(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&<(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&<(o,"y",d)}})}My.$inject=["eventBus"];const PT={__depends__:[ti,jn],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",py],bendpointMove:["type",xp],bendpointMovePreview:["type",yy],connectionSegmentMove:["type",Sy],bendpointSnapping:["type",My]};function ky(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),!yr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!yr(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:Sp(s)?l:u,connectionEnd:Sp(s)?u:l};bt(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){bt(c)||(u=c,c=fe(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}ky.$inject=["eventBus","dragging","modeling","rules"];function Sp(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var AT=1100,TT=900,Dy="connect-ok",Oy="connect-not-ok";function Iy(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;Sp(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",TT,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?Dy:Oy)}),t.on(["connect.out","connect.cleanup"],AT,function(r){var o=r.hover;o&&(n.removeMarker(o,Dy),n.removeMarker(o,Oy))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Iy.$inject=["injector","eventBus","canvas"];const Rp={__depends__:[gn,jn,ti],__init__:["connectPreview"],connect:["type",ky],connectPreview:["type",Iy]};var MT="djs-dragger";function ci(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)}ci.$inject=["injector","canvas","graphicsFactory","elementFactory"],ci.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()),Ca(i),r||(r=e.getConnection=kT(function(m,g,w){return h.getConnection(m,g,w)})),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?fe(o):c,a?fe(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)"})},ci.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||fe(n),o=t.connectionEnd||fe(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);ye(e,s)},ci.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&&go(o,s,!0)||e,t=i&&go(a,s,!1)||t,[e,t]},ci.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&>(e.connectionPreviewGfx)},ci.prototype.getConnection=function(e){var t=DT(e);return this._elementFactory.createConnection(t)},ci.prototype.createConnectionPreviewGfx=function(){var e=oe("g");return Z(e,{pointerEvents:"none"}),Me(e).add(MT),ye(this._canvas.getActiveLayer(),e),e},ci.prototype.createNoopConnection=function(e,t){return po([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function kT(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 DT(e){return bt(e)?e:{}}const OT={__init__:["connectionPreview"],connectionPreview:["type",ci]},pc="complex-preview";class Ly{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(pc);n.filter(s=>!IT(s)).forEach(s=>{let c;je(s)?(c=this._graphicsFactory._createContainer("connection",oe("g")),this._graphicsFactory.drawConnection(ir(c),s)):(c=this._graphicsFactory._createContainer("shape",oe("g")),this._graphicsFactory.drawShape(ir(c),s),Ct(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);je(s)?Ct(u,c.x,c.y):Ct(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",oe("g"));this._graphicsFactory.drawShape(ir(u),s,{width:c.width,height:c.height}),Ct(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Ca(this._canvas.getLayer(pc)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(pc)}hide(){this._canvas.hideLayer(pc)}}Ly.$inject=["canvas","graphicsFactory","previewSupport"];function IT(e){return e.hidden}const LT={__depends__:[Gr],__init__:["complexPreview"],complexPreview:["type",Ly]},By=Math.round;function fc(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}fc.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(k({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;k(u,{x:l.x-By(u.width/2),y:l.y-By(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=>!yr(d))})},fc.prototype.cleanUp=function(){this._complexPreview.cleanUp()},fc.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const BT={__depends__:[js,LT,Xl],__init__:["appendPreview"],appendPreview:["type",fc]};var Ny=Math.min,$y=Math.max;function Cp(e){e.preventDefault()}function ia(e){e.stopPropagation()}function NT(e){return e.nodeType===Node.TEXT_NODE}function $T(e){return[].slice.call(e)}function Cn(e){this.container=e.container,this.parent=We('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=$e("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Gt(this.autoResize,this),this.handlePaste=Gt(this.handlePaste,this)}Cn.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=Sn(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);k(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=Sn(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return k(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&k(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,ve.bind(a,"keydown",this.keyHandler),ve.bind(a,"mousedown",ia),ve.bind(a,"paste",r.handlePaste),ve.bind(a,"focusout",this.focusoutHandler),i.autoResize&&ve.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Cn.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)}},Cn.prototype.insertText=function(e){e=jT(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Cn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=$T(a.childNodes),c,u;if(NT(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&&On(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},Cn.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})}},Cn.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=We('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){Cp(h),ia(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,ve.bind(document,"mousemove",f),ve.bind(document,"mouseup",d)},f=function(h){Cp(h),ia(h);var m=Ny($y(u+h.clientX-s,i),o),g=Ny($y(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){Cp(h),ia(h),ve.unbind(document,"mousemove",f,!1),ve.unbind(document,"mouseup",d,!1)};ve.bind(n,"mousedown",p)}k(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)},Cn.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ve.unbind(t,"keydown",this.keyHandler),ve.unbind(t,"mousedown",ia),ve.unbind(t,"input",this.autoResize),ve.unbind(t,"paste",this.handlePaste),ve.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),On(n)),On(e)},Cn.prototype.getValue=function(){return this.content.innerText.trim()},Cn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Cn.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 jT(e){return e.replace(/\r\n|\r|\n/g,`
|
|
315
|
-
`)}function rn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Cn({container:t.getContainer(),keyHandler:Gt(this._handleKey,this),resizeHandler:Gt(this._handleResize,this),focusoutHandler:Gt(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}rn.$inject=["eventBus","canvas"],rn.prototype.registerProvider=function(e){this._providers.push(e)},rn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},rn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},rn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},rn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},rn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},rn.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()}},rn.prototype.getValue=function(){return this._textbox.getValue()},rn.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()},rn.prototype._handleResize=function(e){this._fire("resize",e)},rn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},rn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=ze(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 jy={__depends__:[ms],__init__:["directEditing"],directEditing:["type",rn]};function FT(e){return function(t){var n=t.target,i=U(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===Pe(e);return!o||!a||!s||!c}}const HT={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 G(e,t={}){var n=HT[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var zT=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing"),G("none-end-event",{actionName:"replace-with-none-end"}),G("message-start"),G("timer-start"),G("conditional-start"),G("signal-start")],VT=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing"),G("none-end-event",{actionName:"replace-with-none-end"})],GT=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),G("none-end-event",{actionName:"replace-with-none-end"}),G("message-intermediate-catch"),G("message-intermediate-throw"),G("timer-intermediate-catch"),G("escalation-intermediate-throw"),G("conditional-intermediate-catch"),G("link-intermediate-catch"),G("link-intermediate-throw"),G("compensation-intermediate-throw"),G("signal-intermediate-catch"),G("signal-intermediate-throw")],WT=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),G("none-end-event",{actionName:"replace-with-none-end"}),G("message-end"),G("escalation-end"),G("error-end"),G("cancel-end"),G("compensation-end"),G("signal-end"),G("terminate-end")],UT=[G("exclusive-gateway"),G("parallel-gateway"),G("inclusive-gateway"),G("complex-gateway"),G("event-based-gateway")],qT=[G("transaction"),G("event-subprocess"),G("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),G("collapsed-subprocess")],YT=[G("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),G("transaction"),G("event-subprocess"),G("collapsed-ad-hoc-subprocess")],Fy=[G("transaction"),G("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),G("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),G("event-subprocess")],KT=Fy,Hy=[G("task"),G("user-task"),G("service-task"),G("send-task"),G("receive-task"),G("manual-task"),G("rule-task"),G("script-task"),G("call-activity"),G("collapsed-subprocess"),G("expanded-subprocess"),G("collapsed-ad-hoc-subprocess"),G("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],XT=[G("data-store-reference")],ZT=[G("data-object-reference")],QT=[G("message-boundary"),G("timer-boundary"),G("escalation-boundary"),G("conditional-boundary"),G("error-boundary"),G("cancel-boundary"),G("signal-boundary"),G("compensation-boundary"),G("non-interrupting-message-boundary"),G("non-interrupting-timer-boundary"),G("non-interrupting-escalation-boundary"),G("non-interrupting-conditional-boundary"),G("non-interrupting-signal-boundary")],JT=[G("message-start"),G("timer-start"),G("conditional-start"),G("signal-start"),G("error-start"),G("escalation-start"),G("compensation-start"),G("non-interrupting-message-start"),G("non-interrupting-timer-start"),G("non-interrupting-conditional-start"),G("non-interrupting-signal-start"),G("non-interrupting-escalation-start")],eM=[{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"}],tM=[G("expanded-pool"),G("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],nM={"bpmn:MessageEventDefinition":[G("message-start"),G("message-intermediate-catch"),G("message-intermediate-throw"),G("message-end")],"bpmn:TimerEventDefinition":[G("timer-start"),G("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[G("conditional-start"),G("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[G("signal-start"),G("signal-intermediate-catch"),G("signal-intermediate-throw"),G("signal-end")],"bpmn:ErrorEventDefinition":[G("error-start"),G("error-end")],"bpmn:EscalationEventDefinition":[G("escalation-start"),G("escalation-intermediate-throw"),G("escalation-end")],"bpmn:CompensateEventDefinition":[G("compensation-start"),G("compensation-intermediate-throw"),G("compensation-end")]};const zy={"start-event-non-interrupting":`
|
|
315
|
+
</svg>`},pk=900;function zo(e,t,n,i){e.registerProvider(pk,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}zo.$inject=["contextPad","popupMenu","translate","canvas"],zo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},zo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},zo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${ax.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);V(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},zo.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 fk=["left","center","right","top","middle","bottom"];function Ya(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ya.$inject=["popupMenu","alignElements","translate","rules"],Ya.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Ya.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ya.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return $(fk,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:ax[o],action:function(){t.trigger(e,o),i.close()}}}),r};function hu(e){ei.call(this,e)}hu.$inject=["eventBus"],ye(hu,ei),hu.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=Ns(n),n.length<2?!1:n})};const dk={__depends__:[S2,yb,jf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",zo],alignElementsMenuProvider:["type",Ya],bpmnAlignElements:["type",hu]};function Yi(e,t,n,i){ee.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=zu(io(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=ro(s,function(f){return f.parent.id});$(l,function(f,p){De(u)&&(f=f.filter(function(d){return ht(u,oo({id:d.id}))})),r._expand(f,p)})}}),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)})}Yi.$inject=["eventBus","elementRegistry","modeling","rules"],ye(Yi,ee),Yi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Te(Bt(e)),o=Te(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),js(V({},o,a))},Yi.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(hk(i,t)){var r=mk(ui(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Yi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Yi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Yi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function hk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function mk(e,t){var n="";return e=Te(e),t=Te(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 mu(e){e.invoke(Yi,this)}mu.$inject=["injector"],ye(mu,Yi),mu.prototype.resize=function(e,t,n){E(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function qa(e){ei.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}qa.$inject=["eventBus"],ye(qa,ei),qa.prototype.canResize=function(e,t){return!1};function gu(e,t){qa.call(this,e),this._modeling=t}ye(gu,qa),gu.$inject=["eventBus","modeling"],gu.prototype.canResize=function(e,t){if(E(t.di,"bpmndi:BPMNPlane")||!E(t,"bpmn:Participant")&&!E(t,"bpmn:Lane")&&!E(t,"bpmn:SubProcess"))return!1;var n=!0;return $(e,function(i){if(E(i,"bpmn:Lane")||Ge(i)){n=!1;return}}),n};const gk={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",mu],bpmnAutoResizeProvider:["type",gu]};function Go(e,t,n){this._canvas=n,this._opts=V({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()})}Go.$inject=["config.autoScroll","eventBus","canvas"],Go.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++)yk(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 yk(e,t,n){return t<e&&e<n}Go.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Go.prototype.setOptions=function(e){this._opts=V({},this._opts,e)},Go.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=jr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const vk={__depends__:[Hi],__init__:["autoScroll"],autoScroll:["type",Go]};var sx="djs-bendpoint",cx="djs-segment-dragger";function bk(e,t){var n=jr(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 Hf(e,t,n){var i=bk(e,n),r=op(t,i);return r}function zf(e,t){var n=Ce("g");Ze(n).add(sx),Fe(e,n);var i=Ce("circle");ve(i,{cx:0,cy:0,r:4}),Ze(i).add("djs-visual"),Fe(n,i);var r=Ce("circle");return ve(r,{cx:0,cy:0,r:10}),Ze(r).add("djs-hit"),Fe(n,r),t&&Ze(n).add(t),n}function xk(e,t,n,i){var r=Ce("g");Fe(e,r);var o=18,a=6,s=11,c=wk(t,n,i),u=a+s,l=Ce("rect");ve(l,{x:-o/2,y:-a/2,width:o,height:a}),Ze(l).add("djs-visual"),Fe(r,l);var f=Ce("rect");return ve(f,{x:-c/2,y:-u/2,width:c,height:u}),Ze(f).add("djs-hit"),Fe(r,f),Im(r,i==="v"?90:0),r}function ux(e,t,n){var i=Ce("g"),r=Ll(t,n),o=Ii(t,n);return Fe(e,i),xk(i,t,n,o),Ze(i).add(cx),Ze(i).add(o==="h"?"horizontal":"vertical"),on(i,r.x,r.y),i}function Gf(e){return Math.abs(Math.round(e*2/3))}function _k(e,t){var n=Ek(e,t);return pp(e,n)}function wk(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Gf(n==="h"?i:r)}function Ek(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=_g(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function lx(e,t,n,i,r){function o(b,x,C){var P=b.index,D=b.point,T,I,k,L,z,ae;return P<=0||b.bendpoint?!1:(T=x[P-1],I=x[P],k=Ll(T,I),L=Ii(T,I),z=Math.abs(D.x-k.x),ae=Math.abs(D.y-k.y),L&&z<=C&&ae<=C)}function a(b,x){var C=b.waypoints,P,D,T,I;return x.index<=0||x.bendpoint||(P={start:C[x.index-1],end:C[x.index]},D=Ii(P.start,P.end),!D)?null:(D==="h"?T=P.end.x-P.start.x:T=P.end.y-P.start.y,I=Gf(T)/2,I)}function s(b,x){var C=x.waypoints,P=Hf(t,C,b),D;if(P){D=a(x,P);var T;if(o(P,C,D)?T=r.start(b,x,P.index):T=i.start(b,x,P.index,!P.bendpoint),T!==!1)return!0}}function c(b,x,C){Ne.bind(b,x,function(P){n.triggerMouseEvent(x,P,C),P.stopPropagation()})}function u(b,x){var C=t.getLayer("overlays"),P=ut('.djs-bendpoints[data-element-id="'+za(b.id)+'"]',C);return!P&&x&&(P=Ce("g"),ve(P,{"data-element-id":b.id}),Ze(P).add("djs-bendpoints"),Fe(C,P),c(P,"mousedown",b),c(P,"click",b),c(P,"dblclick",b)),P}function l(b,x){return ut('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function f(b,x){x.waypoints.forEach(function(C,P){var D=zf(b);Fe(b,D),on(D,C.x,C.y)}),zf(b,"floating")}function p(b,x){for(var C=x.waypoints,P,D,T,I=1;I<C.length;I++)P=C[I-1],D=C[I],Ii(P,D)&&(T=ux(b,P,D),ve(T,{"data-segment-idx":I}),c(T,"mousemove",x))}function d(b){$(Ds("."+sx,b),function(x){Vt(x)})}function m(b){$(Ds("."+cx,b),function(x){Vt(x)})}function h(b){var x=u(b);return x||(x=u(b,!0),f(x,b),p(x,b)),x}function g(b){var x=u(b);x&&(m(x),d(x),p(x,b),f(x,b))}function y(b,x){var C=ut(".floating",b),P=x.point;C&&(on(C,P.x,P.y),Ze(C).add("positioned"))}function v(b,x,C){var P=l(x.index,b),D=C[x.index-1],T=C[x.index],I=x.point,k=Ll(D,T),L=Ii(D,T),z,ae;P&&(z=Sk(P),ae={x:I.x-k.x,y:I.y-k.y},L==="v"&&(ae={x:ae.y,y:ae.x}),on(z,ae.x,ae.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&Vt(x)}),e.on("element.marker.update",function(b){var x=b.element,C;x.waypoints&&(C=h(x),b.add?Ze(C).add(b.marker):Ze(C).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,C=x.waypoints,P,D;if(C){if(P=u(x,!0),D=Hf(t,C,b.originalEvent),!D)return;y(P,D),D.bendpoint||v(P,D,C)}}),e.on("element.mousedown",function(b){if(pr(b)){var x=b.originalEvent,C=b.element;if(C.waypoints)return s(x,C)}}),e.on("selection.changed",function(b){var x=b.newSelection,C=x[0];C&&C.waypoints&&h(C)}),e.on("element.hover",function(b){var x=b.element;x.waypoints&&h(x)}),e.on("element.out",function(b){var x=b.element;if(x.waypoints){var C=u(x);if(C){var P=ut(".floating",C);P&&Ze(P).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,C=b.newId;if(x.waypoints){var P=u(x);P&&ve(P,{"data-element-id":C})}}),this.addHandles=h,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}lx.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function Sk(e){return ut(".djs-visual",e)}var px=Math.round,qr="reconnectStart",Kr="reconnectEnd",Ka="updateWaypoints";function Vf(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),f=s.source,p=s.target,d=s.waypoints,m;!u&&c===0?m=qr:!u&&c===d.length-1?m=Kr:m=Ka;var h=m===Ka?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(h,{connection:s,source:f,target:p});if(g===!1&&(g=r.allowed(h,{connection:s,source:p,target:f})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:g,bendpointIndex:c,connection:s,source:f,target:p,insert:u,type:m}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,f=a.hover,p=s.type;s.hover=f;var d;if(f){var m=p===Ka?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(m,{connection:c,source:p===qr?f:u,target:p===Kr?f:l}),d){s.source=p===qr?f:u,s.target=p===Kr?f:l;return}d===!1&&(d=s.allowed=r.allowed(m,{connection:c,source:p===Kr?f:l,target:p===qr?f:u})),d&&(s.source=p===Kr?f:l,s.target=p===qr?f: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!==Ka&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,f=s.insert,p=l.waypoints.slice(),d=s.source,m=s.target,h=s.type,g=s.hints||{},y={x:px(a.x),y:px(a.y)};if(!c)return!1;h===Ka?(f?p.splice(u,0,y):p[u]=y,g.bendpointMove={insert:f,bendpointIndex:u},p=this.cropWaypoints(l,p),o.updateWaypoints(l,HS(p),g)):(h===qr?(g.docking="source",yu(s)&&(g.docking="target",g.newWaypoints=p.reverse())):h===Kr&&(g.docking="target",yu(s)&&(g.docking="source",g.newWaypoints=p.reverse())),o.reconnect(l,d,m,y,g))},this)}Vf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Vf.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 yu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===qr)return t&&i&&t===i&&n!==i;if(r===Kr)return t&&n&&t===n&&n!==i}var Rk="reconnectStart",Ck="reconnectEnd",fx="updateWaypoints",Xa="connect-ok",vu="connect-not-ok",dx="connect-hover",hx="djs-updating",mx="djs-dragging",gx=1100;function yx(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,f=l.slice();a.waypoints=l,u&&f.splice(s,0,{x:o.x,y:o.y}),c.waypoints=f;var p=a.draggerGfx=zf(i.getLayer("overlays"));Ze(p).add("djs-dragging"),i.addMarker(c,mx),i.addMarker(c,hx)}),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,dx),u===fx)return;s?(i.removeMarker(c,vu),i.addMarker(c,Xa)):s===!1&&(i.removeMarker(c,Xa),i.addMarker(c,vu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],gx,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,dx),i.removeMarker(s,c?Xa:vu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,f=a.type,p=a.connection,d=p.source,m=p.target,h=p.waypoints.slice(),g={x:o.x,y:o.y},y=a.hints||{},v={};r&&(y.connectionStart&&(v.connectionStart=y.connectionStart),y.connectionEnd&&(v.connectionEnd=y.connectionEnd),f===Rk?yu(a)?(v.connectionEnd=v.connectionEnd||g,v.source=m,v.target=l||d,h=h.reverse()):(v.connectionStart=v.connectionStart||g,v.source=l||d,v.target=m):f===Ck?yu(a)?(v.connectionStart=v.connectionStart||g,v.source=l||m,v.target=d,h=h.reverse()):(v.connectionEnd=v.connectionEnd||g,v.source=d,v.target=l||m):(v.noCropping=!0,v.noLayout=!0,h[c]=g),f===fx&&(h=e.cropWaypoints(p,h)),v.waypoints=h,r.drawPreview(a,s,v)),on(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],gx,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,f=a.waypoints;s.waypoints=f,Vt(c),i.removeMarker(s,hx),i.removeMarker(s,mx),u&&(i.removeMarker(u,Xa),i.removeMarker(u,l?Xa:vu)),r&&r.cleanUp(a)})}yx.$inject=["bendpointMove","injector","eventBus","canvas"];var vx="connect-hover",bx="djs-updating";function xx(e,t,n){return Wf(e,t,e[t]+n)}function Wf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function Pk(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 Wf(t,i,s)}function _x(e){return e==="x"?"y":"x"}function wx(e,t,n){var i,r;return e.original?e.original:(i=Le(t),r=_x(n),Wf(e,r,i[r]))}function Ex(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var m,h=n.getGraphics(p),g=d-1,y=d,v=p.waypoints,b=v[g],x=v[y],C=Hf(n,v,f),P,D,T;if(P=Ii(b,x),!!P)return D=P==="v"?"x":"y",g===0&&(b=wx(b,p.source,D)),y===v.length-1&&(x=wx(x,p.target,D)),C?T=C.point:T={x:(b.x+x.x)/2,y:(b.y+x.y)/2},m={connection:p,segmentStartIndex:g,segmentEndIndex:y,segmentStart:b,segmentEnd:x,axis:D,dragPosition:T},i.init(f,T,"connectionSegment.move",{cursor:D==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:h,context:m}})};function s(f,p){if(!a)return p;var d=f.waypoints,m;return f.waypoints=p,m=a.getCroppedWaypoints(f),f.waypoints=d,m}function c(f){r.update("connection",f.connection,f.connectionGfx)}function u(f,p,d){var m=f.newWaypoints,h=f.segmentStartIndex+p,g=m[h],y=f.segmentEndIndex+p,v=m[y],b=_x(f.axis),x=Pk(d,g,v,b);on(f.draggerGfx,x.x,x.y)}function l(f,p){var d=0,m=f.filter(function(h,g){return Dl(f[g-1],f[g+1],h)?(d=g<=p?d-1:d,!1):!0});return{waypoints:m,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,m=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=ux(m,p.segmentStart,p.segmentEnd),Ze(p.draggerGfx).add("djs-dragging"),n.addMarker(d,bx)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,m=p.segmentStartIndex,h=p.segmentEndIndex,g=p.segmentStart,y=p.segmentEnd,v=p.axis,b=p.originalWaypoints.slice(),x=xx(g,v,f["d"+v]),C=xx(y,v,f["d"+v]),P=b.length,D=0;b[m]=x,b[h]=C;var T,I;m<2&&(T=rn(d.source,x),m===1?T==="intersect"&&(b.shift(),b[0]=x,D--):T!=="intersect"&&(b.unshift(g),D++)),h>P-3&&(I=rn(d.target,C),h===P-2?I==="intersect"&&(b.pop(),b[b.length-1]=C):I!=="intersect"&&b.push(y)),p.newWaypoints=d.waypoints=s(d,b),u(p,D,f),p.newSegmentStartIndex=m+D,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,vx)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,vx)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&Vt(p.draggerGfx),n.removeMarker(d,bx)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var p=f.context,d=p.connection;d.waypoints=p.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var p=f.context,d=p.connection,m=p.newWaypoints,h=p.newSegmentStartIndex;m=m.map(function(C){return{original:C.original,x:Math.round(C.x),y:Math.round(C.y)}});var g=l(m,h),y=g.waypoints,v=s(d,y),b=g.segmentOffset,x={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:h+b}};o.updateWaypoints(d,v,x)})}Ex.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Ak=Math.abs,Sx=Math.round;function Tk(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],Ak(r-e)<=n)return r}function Rx(e){return{x:e.x,y:e.y}}function Cx(e){return{x:e.x+e.width,y:e.y+e.height}}function ri(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Sx(e.x+e.width/2),y:Sx(e.y+e.height/2)}}function Vo(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function jt(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 Px(e){return e.children||[]}var Mk=Math.abs,Ax=Math.round,Uf=10;function Tx(e){function t(o,a){if(De(o)){for(var s=o.length;s--;)if(Mk(o[s]-a)<=Uf)return o[s]}else{o=+o;var c=a%o;if(c<Uf)return a-c;if(c>o-Uf)return a-c+o}return a}function n(o,a){if(o.waypoints)return _k(a,o);if(o.width)return{x:Ax(o.width/2+o.x),y:Ax(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,m=a.axis;if(s)return s;var h=[u[f-1],l,p,u[d+1]];return f<2&&h.unshift(n(c.source,o)),d>u.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},$(h,function(g){g&&(g=g.original||g,m==="y"&&s.horizontal.push(g.y),m==="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 f=s-u,p=c-l;V(o,{dx:o.dx-f,dy:o.dy-p,x:u,y:l}),(f||a.vertical.indexOf(s)!==-1)&&jt(o,"x",u),(p||a.horizontal.indexOf(c)!==-1)&&jt(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:[]},$(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);!pt(s)||!c||!c.x||!c.y||(jt(o,"x",c.x),jt(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,f=o.y,p,d;if(s){p=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,f);var m=l-p,h=f-d;V(o,{dx:o.dx-m,dy:o.dy-h,x:o.x-m,y:o.y-h}),(m||s.vertical.indexOf(l)!==-1)&&jt(o,"x",p),(h||s.horizontal.indexOf(f)!==-1)&&jt(o,"y",d)}})}Tx.$inject=["eventBus"];const kk={__depends__:[Hi,Si],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",lx],bendpointMove:["type",Vf],bendpointMovePreview:["type",yx],connectionSegmentMove:["type",Ex],bendpointSnapping:["type",Tx]};function Mx(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),!no(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!no(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},f=s.source,p=s.target;if(!c)return!1;var d=null,m={connectionStart:Yf(s)?l:u,connectionEnd:Yf(s)?u:l};Kt(c)&&(d=c),s.connection=n.connect(f,p,d,m)}),this.start=function(a,s,c,u){Kt(c)||(u=c,c=Le(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}Mx.$inject=["eventBus","dragging","modeling","rules"];function Yf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var Ok=1100,Dk=900,kx="connect-ok",Ox="connect-not-ok";function Dx(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,f=o.target,p=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},m=p,h=d;Yf(o)&&(m=d,h=p),i.drawPreview(o,a,{source:c||u,target:f||s,connectionStart:m,connectionEnd:h})}),t.on("connect.hover",Dk,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?kx:Ox)}),t.on(["connect.out","connect.cleanup"],Ok,function(r){var o=r.hover;o&&(n.removeMarker(o,kx),n.removeMarker(o,Ox))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Dx.$inject=["injector","eventBus","canvas"];const qf={__depends__:[ti,Si,Hi],__init__:["connectPreview"],connect:["type",Mx],connectPreview:["type",Dx]};var Lk="djs-dragger";function qi(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)}qi.$inject=["injector","canvas","graphicsFactory","elementFactory"],qi.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,f=n.noCropping,p=n.noNoop,d,m=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ls(i),r||(r=e.getConnection=Ik(function(h,g,y){return m.getConnection(h,g,y)})),t&&(d=r(t,o,a)),!d){!p&&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?Le(o):c,a?Le(a):u]),this._connectionDocking&&(o||a)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},qi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Le(n),o=t.connectionEnd||Le(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Fe(e,s)},qi.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&&la(o,s,!0)||e,t=i&&la(a,s,!1)||t,[e,t]},qi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Vt(e.connectionPreviewGfx)},qi.prototype.getConnection=function(e){var t=Bk(e);return this._elementFactory.createConnection(t)},qi.prototype.createConnectionPreviewGfx=function(){var e=Ce("g");return ve(e,{pointerEvents:"none"}),Ze(e).add(Lk),Fe(this._canvas.getActiveLayer(),e),e},qi.prototype.createNoopConnection=function(e,t){return aa([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function Ik(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 Bk(e){return Kt(e)?e:{}}const Nk={__init__:["connectionPreview"],connectionPreview:["type",qi]},bu="complex-preview";class Lx{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(bu);n.filter(s=>!$k(s)).forEach(s=>{let c;pt(s)?(c=this._graphicsFactory._createContainer("connection",Ce("g")),this._graphicsFactory.drawConnection(Nr(c),s)):(c=this._graphicsFactory._createContainer("shape",Ce("g")),this._graphicsFactory.drawShape(Nr(c),s),on(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);pt(s)?on(u,c.x,c.y):on(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",Ce("g"));this._graphicsFactory.drawShape(Nr(u),s,{width:c.width,height:c.height}),on(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Ls(this._canvas.getLayer(bu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(bu)}hide(){this._canvas.hideLayer(bu)}}Lx.$inject=["canvas","graphicsFactory","previewSupport"];function $k(e){return e.hidden}const Fk={__depends__:[Lo],__init__:["complexPreview"],complexPreview:["type",Lx]},Ix=Math.round;function xu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}xu.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(V({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;V(u,{x:l.x-Ix(u.width/2),y:l.y-Ix(u.height/2)});const f=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let p=null;f&&(p=o.createConnection(f),p.waypoints=s.layoutConnection(p,{source:e,target:u}),p.waypoints=r.getCroppedWaypoints(p,e,u)),i.create({created:[u,p].filter(d=>!no(d))})},xu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},xu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const jk={__depends__:[Yc,Fk,xf],__init__:["appendPreview"],appendPreview:["type",xu]};var Bx=Math.min,Nx=Math.max;function Kf(e){e.preventDefault()}function Za(e){e.stopPropagation()}function Hk(e){return e.nodeType===Node.TEXT_NODE}function zk(e){return[].slice.call(e)}function fi(e){this.container=e.container,this.parent=bt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ut("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Cn(this.autoResize,this),this.handlePaste=Cn(this.handlePaste,this)}fi.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=ui(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);V(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=ui(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return V(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&V(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Ne.bind(a,"keydown",this.keyHandler),Ne.bind(a,"mousedown",Za),Ne.bind(a,"paste",r.handlePaste),Ne.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ne.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},fi.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)}},fi.prototype.insertText=function(e){e=Gk(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},fi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=zk(a.childNodes),c,u;if(Hk(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 f=document.createTextNode(e);this.content.insertBefore(f,s[r]),c=f,u=f.textContent.length}else{var p=s.indexOf(n),d=s.indexOf(i);s.forEach(function(m,h){h===p?m.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>p&&h<=d&&vi(m)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},fi.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})}},fi.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=bt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,f=function(m){Kf(m),Za(m),s=m.clientX,c=m.clientY;var h=t.getBoundingClientRect();u=h.width,l=h.height,Ne.bind(document,"mousemove",p),Ne.bind(document,"mouseup",d)},p=function(m){Kf(m),Za(m);var h=Bx(Nx(u+m.clientX-s,i),o),g=Bx(Nx(l+m.clientY-c,r),a);t.style.width=h+"px",t.style.height=g+"px",e.resizeHandler({width:u,height:l,dx:m.clientX-s,dy:m.clientY-c})},d=function(m){Kf(m),Za(m),Ne.unbind(document,"mousemove",p,!1),Ne.unbind(document,"mouseup",d,!1)};Ne.bind(n,"mousedown",f)}V(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)},fi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ne.unbind(t,"keydown",this.keyHandler),Ne.unbind(t,"mousedown",Za),Ne.unbind(t,"input",this.autoResize),Ne.unbind(t,"paste",this.handlePaste),Ne.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),vi(n)),vi(e)},fi.prototype.getValue=function(){return this.content.innerText.trim()},fi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},fi.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 Gk(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
+
`)}function jn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new fi({container:t.getContainer(),keyHandler:Cn(this._handleKey,this),resizeHandler:Cn(this._handleResize,this),focusoutHandler:Cn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}jn.$inject=["eventBus","canvas"],jn.prototype.registerProvider=function(e){this._providers.push(e)},jn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},jn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},jn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},jn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},jn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},jn.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()}},jn.prototype.getValue=function(){return this._textbox.getValue()},jn.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()},jn.prototype._handleResize=function(e){this._fire("resize",e)},jn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},jn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=ht(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 $x={__depends__:[Ec],__init__:["directEditing"],directEditing:["type",jn]};function Vk(e){return function(t){var n=t.target,i=te(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===Xe(e);return!o||!a||!s||!c}}const Wk={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 J(e,t={}){var n=Wk[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var Uk=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing"),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-start"),J("timer-start"),J("conditional-start"),J("signal-start")],Yk=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing"),J("none-end-event",{actionName:"replace-with-none-end"})],qk=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-intermediate-catch"),J("message-intermediate-throw"),J("timer-intermediate-catch"),J("escalation-intermediate-throw"),J("conditional-intermediate-catch"),J("link-intermediate-catch"),J("link-intermediate-throw"),J("compensation-intermediate-throw"),J("signal-intermediate-catch"),J("signal-intermediate-throw")],Kk=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-end"),J("escalation-end"),J("error-end"),J("cancel-end"),J("compensation-end"),J("signal-end"),J("terminate-end")],Xk=[J("exclusive-gateway"),J("parallel-gateway"),J("inclusive-gateway"),J("complex-gateway"),J("event-based-gateway")],Zk=[J("transaction"),J("event-subprocess"),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),J("collapsed-subprocess")],Qk=[J("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),J("transaction"),J("event-subprocess"),J("collapsed-ad-hoc-subprocess")],Fx=[J("transaction"),J("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),J("event-subprocess")],Jk=Fx,jx=[J("task"),J("user-task"),J("service-task"),J("send-task"),J("receive-task"),J("manual-task"),J("rule-task"),J("script-task"),J("call-activity"),J("collapsed-subprocess"),J("expanded-subprocess"),J("collapsed-ad-hoc-subprocess"),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],eO=[J("data-store-reference")],tO=[J("data-object-reference")],nO=[J("message-boundary"),J("timer-boundary"),J("escalation-boundary"),J("conditional-boundary"),J("error-boundary"),J("cancel-boundary"),J("signal-boundary"),J("compensation-boundary"),J("non-interrupting-message-boundary"),J("non-interrupting-timer-boundary"),J("non-interrupting-escalation-boundary"),J("non-interrupting-conditional-boundary"),J("non-interrupting-signal-boundary")],iO=[J("message-start"),J("timer-start"),J("conditional-start"),J("signal-start"),J("error-start"),J("escalation-start"),J("compensation-start"),J("non-interrupting-message-start"),J("non-interrupting-timer-start"),J("non-interrupting-conditional-start"),J("non-interrupting-signal-start"),J("non-interrupting-escalation-start")],rO=[{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"}],oO=[J("expanded-pool"),J("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],aO={"bpmn:MessageEventDefinition":[J("message-start"),J("message-intermediate-catch"),J("message-intermediate-throw"),J("message-end")],"bpmn:TimerEventDefinition":[J("timer-start"),J("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[J("conditional-start"),J("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[J("signal-start"),J("signal-intermediate-catch"),J("signal-intermediate-throw"),J("signal-end")],"bpmn:ErrorEventDefinition":[J("error-start"),J("error-end")],"bpmn:EscalationEventDefinition":[J("escalation-start"),J("escalation-intermediate-throw"),J("escalation-end")],"bpmn:CompensateEventDefinition":[J("compensation-start"),J("compensation-intermediate-throw"),J("compensation-end")]};const Hx={"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 bn(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()}bn.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],bn.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},bn.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(pe(e)||!n.allowed("shape.replace",{element:e}))return{};var a=FT(e);return y(t,"bpmn:DataObjectReference")?this._createEntries(e,XT):y(t,"bpmn:DataStoreReference")&&!y(e.parent,"bpmn:Collaboration")?this._createEntries(e,ZT):(y(t,"bpmn:Event")&&!y(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=nM[r]||[],!Nt(t.$parent)&&y(t.$parent,"bpmn:SubProcess")&&(i=Re(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),y(t,"bpmn:StartEvent")&&!y(t.$parent,"bpmn:SubProcess")?(o=Re(zT.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Participant")?(o=Re(tM,function(c){return Pe(e)!==c.target.isExpanded}),this._createEntries(e,o)):y(t,"bpmn:StartEvent")&&Nt(t.$parent)?(o=Re(JT.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")&&!Nt(t.$parent)&&y(t.$parent,"bpmn:SubProcess")?(o=Re(VT.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:EndEvent")?(o=Re(WT.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=Re(QT,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=Re(GT.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Gateway")?(o=Re(UT,a),this._createEntries(e,o)):y(t,"bpmn:Transaction")?(o=Re(Fy,a),this._createEntries(e,o)):Nt(t)&&Pe(e)?(o=Re(KT,a),this._createEntries(e,o)):y(t,"bpmn:AdHocSubProcess")&&Pe(e)?(o=Re(YT,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&Pe(e)?(o=Re(qT,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&!Pe(e)?(o=Re(Hy,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,eM):y(t,"bpmn:FlowNode")?(o=Re(Hy,a),this._createEntries(e,o)):{})},bn.prototype.getPopupMenuHeaderEntries=function(e){var t={};return y(e,"bpmn:Activity")&&!Nt(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),y(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),y(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Bh(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},bn.prototype._createEntries=function(e,t){var n={},i=this;return P(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},bn.prototype._createSequenceFlowEntries=function(e,t){var n=U(e),i={},r=this._modeling,o=this._moddle,a=this;return P(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},bn.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}},bn.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=U(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"}}}},bn.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}}},bn.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}}},bn.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=U(e),i=this,r=Nh(e),o=y(e,"bpmn:BoundaryEvent")?zy["intermediate-event-non-interrupting"]:zy["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 iM={__depends__:[vp,ig,js],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",bn]};function ra(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(!(!To(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}ra.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],ra.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&k(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},ra.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return pe(t)?qi(e,n=>t.includes(n)):t},ra.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])&&k(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,A=S.getBoundingClientRect(),I={x:A.left,y:A.bottom+x};return I}function g(b,x,S,A){function I(j,L){var F=i.createShape(k({type:b},A));o.start(j,F,{source:L})}var C=s?function(j,L){var F=i.createShape(k({type:b},A));s.append(L,F)}:I,$=s?function(j,L){return u.create(L,b,A),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:S,action:{dragstart:I,click:C,hover:$}}}function w(b){return function(x,S){n.splitLane(S,b),t.open(S,!0)}}if(Se(p,["bpmn:Lane","bpmn:Participant"])&&Pe(e)){var E=Pi(e);k(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")}}}}),E.length<2&&((Et(e)?e.height>=120:e.width>=120)&&k(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(Et(e)?e.height>=180:e.width>=180)&&k(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),k(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 y(p,"bpmn:FlowNode")&&(y(p,"bpmn:EventBasedGateway")?k(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"})}):Vy(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?k(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!y(p,"bpmn:EndEvent")&&!p.isForCompensation&&!Vy(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Nt(p)&&k(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")||k(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var S=k(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})}}}}),y(p,"bpmn:SequenceFlow")&&k(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),y(p,"bpmn:MessageFlow")&&k(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Se(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&k(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}}}),y(p,"bpmn:TextAnnotation")&&k(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),Se(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&k(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")&&k(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&k(l,h()),l};function Vy(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return P(o,function(a){a.$type===n&&(r=!0)}),i&&r}const rM={__depends__:[BT,jy,yv,gn,Rp,vs,iM],__init__:["contextPadProvider"],contextPadProvider:["type",ra]};var oM={horizontal:["x","width"],vertical:["y","height"]},Gy=5;function ui(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return pe(i)?i:i?n:[]})}ui.$inject=["modeling","rules"],ui.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},ui.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},ui.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(P(t,function(o){r=o(r,n,i)}),r):e},ui.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=Pn(e,i);return P(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},ui.prototype._setOrientation=function(e){var t=oM[e];this._axis=t[0],this._dimension=t[1]},ui.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)},ui.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+Gy,max:t+n-Gy}};const aM={__init__:["distributeElements"],distributeElements:["type",ui]};function dc(e){mn.call(this,e)}dc.$inject=["eventBus"],X(dc,mn),dc.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Re(t,function(n){var i=Se(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Ta(t),t.length<3?!1:t})};var Wy={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
327
|
+
</svg>`};function oi(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()}oi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],oi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},oi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(De(e)||!n.allowed("shape.replace",{element:e}))return{};var a=Vk(e);return E(t,"bpmn:DataObjectReference")?this._createEntries(e,eO):E(t,"bpmn:DataStoreReference")&&!E(e.parent,"bpmn:Collaboration")?this._createEntries(e,tO):(E(t,"bpmn:Event")&&!E(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=aO[r]||[],!gn(t.$parent)&&E(t.$parent,"bpmn:SubProcess")&&(i=Ye(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),E(t,"bpmn:StartEvent")&&!E(t.$parent,"bpmn:SubProcess")?(o=Ye(Uk.concat(i),a),this._createEntries(e,o)):E(t,"bpmn:Participant")?(o=Ye(oO,function(c){return Xe(e)!==c.target.isExpanded}),this._createEntries(e,o)):E(t,"bpmn:StartEvent")&&gn(t.$parent)?(o=Ye(iO.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,f=t.isInterrupting===l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):E(t,"bpmn:StartEvent")&&!gn(t.$parent)&&E(t.$parent,"bpmn:SubProcess")?(o=Ye(Yk.concat(i),a),this._createEntries(e,o)):E(t,"bpmn:EndEvent")?(o=Ye(Kk.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!E(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):E(t,"bpmn:BoundaryEvent")?(o=Ye(nO,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!E(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,f=t.cancelActivity==l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):E(t,"bpmn:IntermediateCatchEvent")||E(t,"bpmn:IntermediateThrowEvent")?(o=Ye(qk.concat(i),a),this._createEntries(e,o)):E(t,"bpmn:Gateway")?(o=Ye(Xk,a),this._createEntries(e,o)):E(t,"bpmn:Transaction")?(o=Ye(Fx,a),this._createEntries(e,o)):gn(t)&&Xe(e)?(o=Ye(Jk,a),this._createEntries(e,o)):E(t,"bpmn:AdHocSubProcess")&&Xe(e)?(o=Ye(Qk,a),this._createEntries(e,o)):E(t,"bpmn:SubProcess")&&Xe(e)?(o=Ye(Zk,a),this._createEntries(e,o)):E(t,"bpmn:SubProcess")&&!Xe(e)?(o=Ye(jx,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):E(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,rO):E(t,"bpmn:FlowNode")?(o=Ye(jx,a),this._createEntries(e,o)):{})},oi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return E(e,"bpmn:Activity")&&!gn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),E(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),E(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Bg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},oi.prototype._createEntries=function(e,t){var n={},i=this;return $(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},oi.prototype._createSequenceFlowEntries=function(e,t){var n=te(e),i={},r=this._modeling,o=this._moddle,a=this;return $(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(E(n.sourceRef,"bpmn:ExclusiveGateway")||E(n.sourceRef,"bpmn:InclusiveGateway")||E(n.sourceRef,"bpmn:ComplexGateway")||E(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&&E(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:E(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(E(n.sourceRef,"bpmn:ExclusiveGateway")||E(n.sourceRef,"bpmn:InclusiveGateway")||E(n.sourceRef,"bpmn:ComplexGateway")||E(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},oi.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}},oi.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 f=e.businessObject.get("loopCharacteristics");f&&E(f,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,f,{isSequential:l.options.isSequential}):(f=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:f}))}var r=te(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"}}}},oi.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}}},oi.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}}},oi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=te(e),i=this,r=Ng(e),o=E(e,"bpmn:BoundaryEvent")?Hx["intermediate-event-non-interrupting"]:Hx["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 sO={__depends__:[jf,iv,Yc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",oi]};function Qa(e,t,n,i,r,o,a,s,c,u,l,f,p){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=f,this._eventBus=n,this._appendPreview=p,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var m=d.context,h=m.shape;if(!(!Ea(d)||!i.isOpen(h))){var g=i.getEntries(h);g.replace&&g.replace.action.click(d,h)}}),n.on("contextPad.close",function(){p.cleanUp()})}Qa.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Qa.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&V(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Qa.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return De(t)?Mr(e,n=>t.includes(n)):t},Qa.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])&&V(l,m()),l;var f=e.businessObject;function p(b,x){r.start(b,x)}function d(b,x){n.removeElements([x])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(b){var x=5,C=t.getPad(b).html,P=C.getBoundingClientRect(),D={x:P.left,y:P.bottom+x};return D}function g(b,x,C,P){function D(k,L){var z=i.createShape(V({type:b},P));o.start(k,z,{source:L})}var T=s?function(k,L){var z=i.createShape(V({type:b},P));s.append(L,z)}:D,I=s?function(k,L){return u.create(L,b,P),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:C,action:{dragstart:D,click:T,hover:I}}}function y(b){return function(x,C){n.splitLane(C,b),t.open(C,!0)}}if(We(f,["bpmn:Lane","bpmn:Participant"])&&Xe(e)){var v=ur(e);V(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")}}}}),v.length<2&&((Qt(e)?e.height>=120:e.width>=120)&&V(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:y(2)}}}),(Qt(e)?e.height>=180:e.width>=180)&&V(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:y(3)}}})),V(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 E(f,"bpmn:FlowNode")&&(E(f,"bpmn:EventBasedGateway")?V(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"})}):zx(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?V(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!E(f,"bpmn:EndEvent")&&!f.isForCompensation&&!zx(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!gn(f)&&V(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")||V(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var C=V(h(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",C,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),E(f,"bpmn:SequenceFlow")&&V(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),E(f,"bpmn:MessageFlow")&&V(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),We(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(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:p,dragstart:p}}}),E(f,"bpmn:TextAnnotation")&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),We(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:p,dragstart:p}}}),E(f,"bpmn:Group")&&V(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&V(l,m()),l};function zx(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return $(o,function(a){a.$type===n&&(r=!0)}),i&&r}const cO={__depends__:[jk,$x,yb,ti,qf,Rc,sO],__init__:["contextPadProvider"],contextPadProvider:["type",Qa]};var uO={horizontal:["x","width"],vertical:["y","height"]},Gx=5;function Ki(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return De(i)?i:i?n:[]})}Ki.$inject=["modeling","rules"],Ki.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Ki.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},Ki.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?($(t,function(o){r=o(r,n,i)}),r):e},Ki.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=di(e,i);return $(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},Ki.prototype._setOrientation=function(e){var t=uO[e];this._axis=t[0],this._dimension=t[1]},Ki.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)},Ki.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+Gx,max:t+n-Gx}};const lO={__init__:["distributeElements"],distributeElements:["type",Ki]};function _u(e){ei.call(this,e)}_u.$inject=["eventBus"],ye(_u,ei),_u.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ye(t,function(n){var i=We(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Ns(t),t.length<3?!1:t})};var Vx={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>`},sM=900;function oa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",sM,this)}oa.$inject=["popupMenu","distributeElements","translate","rules"],oa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&k(t,this._getEntries(e)),t},oa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},oa.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:Wy.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Wy.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const cM={__depends__:[vp,aM],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",dc],distributeElementsMenuProvider:["type",oa]};var Uy="is not a registered action",uM="is already registered";function xn(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}xn.$inject=["eventBus","injector"],xn.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=pe(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&&(pe(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)})},xn.prototype.trigger=function(e,t){if(!this._actions[e])throw Pp(e,Uy);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},xn.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);P(e,function(i,r){n._registerAction(r,i)})},xn.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Pp(e,uM);this._actions[e]=t},xn.prototype.unregister=function(e){if(!this.isRegistered(e))throw Pp(e,Uy);this._actions[e]=void 0},xn.prototype.getActions=function(){return Object.keys(this._actions)},xn.prototype.isRegistered=function(e){return!!this._actions[e]};function Pp(e,t){return new Error(e+" "+t)}const lM={__init__:["editorActions"],editorActions:["type",xn]};function hc(e){e.invoke(xn,this)}X(hc,xn),hc.$inject=["injector"],hc.prototype._registerDefaultActions=function(e){xn.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=[],w=h.type;m.length&&(g=Re(m,function(E){return!y(E,"bpmn:Lane")}),u.trigger(g,w))}),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;y(h,"bpmn:Collaboration")?g=n.filter(function(w){return y(w.parent,"bpmn:Collaboration")}):g=n.filter(function(w){return w!==h&&!y(w.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 pM={__depends__:[lM],editorActions:["type",hc]};function qy(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Se(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}qy.$inject=["eventBus"];function gr(e,t){W.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;qt(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}gr.$inject=["eventBus","gridSnapping","modeling"],X(gr,W),gr.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},gr.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},gr.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),k(e,o),e},gr.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),k(e,o),e};var fM=2e3;function Yy(e,t){e.on(["spaceTool.move","spaceTool.end"],fM,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)}})}Yy.$inject=["eventBus","gridSnapping"];const dM={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",gr],gridSnappingSpaceToolBehavior:["type",Yy]};var mc=10;function Ap(e,t,n){return n||(n="round"),Math[n](e/t)*t}var hM=1200,mM=800;function Fi(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",mM,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"],hM,function(o){var a=o.originalEvent;if(!(!r.active||a&&Jt(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=vM(o,u,e);p&&(l.offset=p);var f=gM(o,u);f&&k(l,f),to(o,u)||r.snapEvent(o,u,l)})}})}Fi.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);lt(e,t,i)},Fi.prototype.getGridSpacing=function(){return mc},Fi.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Ap(e,mc);var i,r;return t&&t.min&&(i=t.min,me(i)&&(i=Ap(i+n,mc,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,me(r)&&(r=Ap(r+n,mc,"floor"),e=Math.min(e,r))),e-=n,e},Fi.prototype.isActive=function(){return this.active},Fi.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Fi.prototype.toggleActive=function(){this.setActive(!this.active)},Fi.$inject=["elementRegistry","eventBus","config.gridSnapping"];function gM(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&&(gc(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&&(gc(t)?Xy(s)?a.x.max=c.left:a.x.min=c.right:Ky(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(gc(t)?Xy(s)?a.x.min=u.left:a.x.max=u.right:Ky(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function vM(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&me(s[t])||(s||(s=o.snapOffset={}),me(s[t])||(s[t]=0),!r)||(n.get(r.id)||(gc(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 gc(e){return e==="x"}function Ky(e){return e.indexOf("n")!==-1}function Xy(e){return e.indexOf("w")!==-1}const yM={__depends__:[dM],__init__:["gridSnapping"],gridSnapping:["type",Fi]};var _M=2e3;function Zy(e,t,n){e.on("autoPlace",_M,function(i){var r=i.source,o=fe(r),a=i.shape,s=Kg(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")&&(bM(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}Zy.$inject=["eventBus","gridSnapping","elementRegistry"];function bM(e){return e==="x"}var xM=1750;function Qy(e,t,n){t.on(["create.start","shape.move.start"],xM,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}))}})}Qy.$inject=["canvas","eventBus","gridSnapping"];var EM=3e3;function vc(e,t,n){W.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],EM,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||wM(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}vc.$inject=["eventBus","gridSnapping","modeling"],X(vc,W),vc.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=CM(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function wM(e){return e.length>3}function SM(e){return e==="h"}function RM(e){return e==="v"}function CM(e,t,n){var i=Kn(t,n),r={};return SM(i)&&(r.y=e.snapValue(t.y)),RM(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=k({},t,r),n=k({},n,r)),[t,n]}const PM={__depends__:[yM,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Zy],gridSnappingParticipantBehavior:["type",Qy],gridSnappingLayoutConnectionBehavior:["type",vc]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",qy]};var AM=30,Jy=30;function aa(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 Pe(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(y(r,"bpmn:SubProcess"))return Pe(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}aa.$inject=["eventBus","interactionEvents"],aa.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},aa.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=Et(e)?{width:AM,height:e.height}:{width:e.width,height:Jy};return this._interactionEvents.createBoxHit(t,"all",n),!0},aa.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:Jy}),!0};const TM={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",aa]};function yc(e){e.invoke(Yr,this)}X(yc,Yr),yc.$inject=["injector"],yc.prototype.registerBindings=function(e,t){Yr.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 MM={__depends__:[np],__init__:["keyboardBindings"],keyboardBindings:["type",yc]};var kM={moveSpeed:1,moveSpeedAccelerated:10},DM=1500,e_="left",t_="up",n_="right",i_="down",OM={ArrowLeft:e_,Left:e_,ArrowUp:t_,Up:t_,ArrowRight:n_,Right:n_,ArrowDown:i_,Down:i_},IM={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 r_(e,t,n,i,r){var o=this;this._config=k({},kM,e||{}),t.addListener(DM,function(a){var s=a.keyEvent,c=OM[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=IM[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}r_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const LM={__depends__:[np,gn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",r_]};var o_=10;function sa(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=R1(l,p,u),c.newBounds=P1(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:ue(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=xd(p),!BM(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)})}sa.prototype.canResize=function(e){var t=this._rules,n=Sn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},sa.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=k({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,a_(t,o),"resize",{autoActivate:!0,cursor:NM(o),data:{shape:t,context:r}})},sa.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:o_,height:o_},r=ch(t,e.childrenBoxPadding),A1(n,t,i,r)},sa.$inject=["eventBus","rules","modeling","dragging"];function BM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function a_(e,t){var n=fe(e),i=ue(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 NM(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 s_="djs-resizing",c_="resize-not-ok",$M=500;function u_(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,s_)),s.width>5&&Z(c,{x:s.x,width:s.width}),s.height>5&&Z(c,{y:s.y,height:s.height}),o.canExecute?Me(c).remove(c_):Me(c).add(c_)}function r(o){var a=o.shape,s=o.frame;s&>(o.frame),t.removeMarker(a,s_)}e.on("resize.move",$M,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}u_.$inject=["eventBus","canvas","previewSupport"];var _c=-6,bc=8,xc=20,ca="djs-resizer",jM=["n","w","s","e","nw","ne","se","sw"];function Hi(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&&P(a,Gt(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}Hi.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Ti(o)&&i.activate(o,e,n)}ve.bind(t,"mousedown",r),ve.bind(t,"touchstart",r)},Hi.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=FM(i),a=oe("g");Me(a).add(ca),Me(a).add(ca+"-"+e.id),Me(a).add(ca+"-"+i),ye(r,a);var s=oe("rect");Z(s,{x:-bc/2+o.x,y:-bc/2+o.y,width:bc,height:bc}),Me(s).add(ca+"-visual"),ye(a,s);var c=oe("rect");return Z(c,{x:-xc/2+o.x,y:-xc/2+o.y,width:xc,height:xc}),Me(c).add(ca+"-hit"),ye(a,c),La(a,t,n),a},Hi.prototype.createResizer=function(e,t){var n=a_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Hi.prototype.addResizer=function(e){var t=this;je(e)||P(jM,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Hi.prototype.removeResizers=function(){var e=this._getResizersParent();Ca(e)},Hi.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Hi.$inject=["eventBus","canvas","selection","resize"];function FM(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-_c:e.indexOf("w")!==-1&&(t.x=_c),e.indexOf("s")!==-1?t.y=-_c:e.indexOf("n")!==-1&&(t.y=_c),t}const l_={__depends__:[jn,ti,Gr],__init__:["resize","resizePreview","resizeHandles"],resize:["type",sa],resizePreview:["type",u_],resizeHandles:["type",Hi]};var HM=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"],HM,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||Se(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=un(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);k(n,i);var r={},o=n.style||{};return k(o,{backgroundColor:null,border:null}),(Se(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||p_(e))&&k(r,{centerVertically:!0}),Ri(e)&&(k(r,{resizable:!0,autoResize:!0}),k(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),y(e,"bpmn:TextAnnotation")&&(k(r,{resizable:!0,autoResize:!0}),k(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),k(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(y(e,"bpmn:Lane")||GM(e)){var h=Et(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};k(o,m),k(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(VM(e)){var g=Et(e),w=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};k(o,w),k(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)"})}(Se(e,["bpmn:Task","bpmn:CallActivity"])||p_(e))&&(k(o,{width:i.width,height:i.height}),k(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),zM(e)&&(k(o,{width:i.width,x:i.x}),k(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var E=1,b=i.width+2*E;if(n.labelTarget&&(k(o,{width:b,height:i.height+2*E,x:i.x-E,y:i.y-E}),k(d,{fontSize:u+"px",lineHeight:l})),Ri(n)&&!$a(n)&&!xe(n)){var x=mu(e),S=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),A=u,I=rr.width*a+2*E;k(o,{width:I,height:A+2*E,x:S.x-I/2,y:S.y-A/2-E}),k(d,{fontSize:u+"px",lineHeight:l})}return y(e,"bpmn:TextAnnotation")&&(k(o,{width:i.width+2*E,height:i.height+2*E,x:i.x-E,y:i.y-E,minWidth:30*a,minHeight:10*a}),k(d,{textAlign:"left",paddingTop:kr*a+"px",paddingBottom:kr*a+"px",paddingLeft:kr*a+"px",paddingRight:kr*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},ua.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}),WM(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function p_(e){return y(e,"bpmn:SubProcess")&&!Pe(e)}function zM(e){return y(e,"bpmn:SubProcess")&&Pe(e)}function VM(e){return y(e,"bpmn:Participant")&&!Pe(e)}function GM(e){return y(e,"bpmn:Participant")&&Pe(e)}function WM(e){return!e||!e.trim()}var f_="djs-element-hidden",d_="djs-label-hidden";function h_(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=oe("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=oe("path");Z(p,{d:l,strokeWidth:2,stroke:UM(o)}),ye(s,p),ye(r,s),Ct(s,o.x,o.y)}y(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,f_):(y(o,"bpmn:Task")||y(o,"bpmn:CallActivity")||y(o,"bpmn:SubProcess")||y(o,"bpmn:Participant")||y(o,"bpmn:Lane"))&&t.addMarker(o,d_)}),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,f_),t.removeMarker(o,d_)),o=void 0,a=void 0,s&&(gt(s),s=void 0)})}h_.$inject=["eventBus","canvas","pathMap"];function UM(e,t){var n=De(e);return n.get("stroke")||t||"black"}const qM={__depends__:[Ol,l_,jy],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",ua],labelEditingPreview:["type",h_]};var YM=500,KM=1e3;function zn(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){PE(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){P(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],YM,function(o){var a=o.element,s=o.gfx,c=$e(".djs-outline",s);c&&i.updateOutline(a,c)})}zn.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=$e(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ye(t,n),this.updateOutline(e,n)),n},zn.prototype._createOutlineGfx=function(){var e=oe("rect");return Z(e,k({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},zn.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},zn.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&P(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})},zn.prototype.updateConnectionOutline=function(e,t){var n=at(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})},zn.prototype.registerProvider=function(e,t){t||(t=e,e=KM),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},zn.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},zn.prototype.getOutline=function(e){var t,n=this._getProviders();return P(n,function(i){xt(i.getOutline)&&(t=t||i.getOutline(e))}),t},zn.$inject=["eventBus","styles","elementRegistry"];var Ec=6;function Tp(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)})}Tp.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ca(t);var n=e.length>1,i=this._canvas.getContainer();if(Me(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=XM(at(e)),o=oe("rect");Z(o,k({rx:3},r)),Me(o).add("djs-selection-outline"),ye(t,o)}},Tp.$inject=["eventBus","canvas","selection"];function XM(e){return{x:e.x-Ec,y:e.y-Ec,width:e.width+Ec*2,height:e.height+Ec*2}}const Mp={__depends__:[gn],__init__:["outline","multiSelectionOutline"],outline:["type",zn],multiSelectionOutline:["type",Tp]},m_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],g_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},ZM=15,wc=2;function v_(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=>Se(h,m_));if(f.length===1){const h=f[0];xe(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(xe),m=f.find(g=>{var w;return(w=g.labels)==null?void 0:w.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!Se(p,m_)||!l(p)||(xe(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=po([fe(f),fe(p)],g_),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),w=go(g,h);if(!w)return;const b=r.isSelected(f)?c(f):u(f),x=go(b,h)||fe(f);Co(x,w)<ZM||(su(d,[x,w]),ye(o,d))}function s(){Ra(`.${g_.class}`,o).forEach(gt)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+zi(f,"x")-wc,y:p.y+zi(f,"y")-wc,width:zi(f,"width")+wc*2,height:zi(f,"height")+wc*2};return vu(d,zi(f,"rx"))}if(f.cx){const d=zi(f,"r"),h={x:p.x+zi(f,"cx")-d,y:p.y+zi(f,"cy")-d,width:d*2,height:d*2};return Wd(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}v_.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function zi(e,t){return parseFloat(Z(e,t)||0)}const QM={__depends__:[gn,Mp],__init__:["labelLink"],labelLink:["type",v_]};var JM=new Vr("tt");function e2(e){var t=We('<div class="djs-tooltip-container" />');return zt(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function t2(e,t,n){zt(e,{left:t+"px",top:n+"px"})}function kp(e,t){e.style.display=t===!1?"none":""}var y_="djs-tooltip",Dp="."+y_;function Ut(e,t){this._eventBus=e,this._canvas=t,this._ids=JM,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=e2(t.getContainer());var n=this;Xt.bind(this._tooltipRoot,Dp,"mousedown",function(i){i.stopPropagation()}),Xt.bind(this._tooltipRoot,Dp,"mouseover",function(i){n.trigger("mouseover",i)}),Xt.bind(this._tooltipRoot,Dp,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Ut.$inject=["eventBus","canvas"],Ut.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=k({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Ut.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Lt(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Ut.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Ut.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Ut.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)}},Ut.prototype.remove=function(e){var t=this.get(e);t&&(On(t.html),On(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Ut.prototype.show=function(){kp(this._tooltipRoot)},Ut.prototype.hide=function(){kp(this._tooltipRoot,!1)},Ut.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},Ut.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)),qt(n)&&(n=We(n)),i=We('<div data-tooltip-id="'+t+'" class="'+y_+'">'),zt(i,{position:"absolute"}),i.appendChild(n),e.type&&Ye(i).add("djs-tooltip-"+e.type),e.className&&Ye(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Ut.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;t2(n,t.x,t.y)},Ut.prototype._updateTooltipVisibilty=function(e){P(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),kp(i,r))})},Ut.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 n2={__init__:["tooltips"],tooltips:["type",Ut]};var i2="flow elements must be children of pools/participants",r2="Data object must be placed within a pool/participant.";function __(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(i2)):y(a,"bpmn:DataObjectReference")&&i(r,n(r2)))})}__.$inject=["eventBus","tooltips","translate"];const o2={__depends__:[n2],__init__:["modelingFeedback"],modelingFeedback:["type",__]};var a2=500,s2=1250,c2=1500,Sc=Math.round;function u2(e){return{x:e.x+Sc(e.width/2),y:e.y+Sc(e.height/2)}}function b_(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",c2,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=l2(l),k(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",s2,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",a2,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=Sc(u.x),u.y=Sc(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(Ti(s)){var c=jr(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(bt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Me(s.target).has("djs-hit-no-move")){var p=u2(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}b_.$inject=["eventBus","dragging","modeling","selection","rules"];function l2(e){var t=br(e,"id");return Re(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var x_=499,Op="djs-dragging",E_="drop-ok",w_="drop-not-ok",S_="new-parent",R_="attach-ok";function C_(e,t,n,i){function r(c){var u=o(c),l=p2(u);return l}function o(c){var u=fo(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[R_,E_,w_,S_].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,Op),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",x_,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=oe("g");Z(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();ye(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=Mc([p,o(l)]):p=o(l),P(p,function(m){t.addMarker(m,Op)}),u.allDraggedElements=p,u.differentParents=f2(l)}),e.on("shape.move.move",x_,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,R_):u.canExecute&&f&&p.id!==f.id?a(p,S_):a(p,u.canExecute?E_:w_)),Ct(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;P(l,function(f){t.removeMarker(f,Op)}),p&>(p)}),this.makeDraggable=s}C_.$inject=["eventBus","canvas","styles","previewSupport"];function p2(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Re(e,function(i){return je(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function f2(e){return vb(br(e,function(t){return t.parent&&t.parent.id}))!==1}const d2={__depends__:[ms,gn,Mp,jn,ti,Gr],__init__:["move","movePreview"],move:["type",b_],movePreview:["type",C_]};var P_=".djs-palette-toggle",A_=".entry",h2=P_+", "+A_,Ip="djs-palette-",m2="shown",Lp="open",T_="two-column",g2=1e3;function pt(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()})}pt.$inject=["eventBus","canvas"],pt.prototype.registerProvider=function(e,t){t||(t=e,e=g2),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},pt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(y2,{})},pt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},pt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=We(pt.HTML_MARKUP);n.appendChild(i),Ye(n).add(Ip+m2),Xt.bind(i,h2,"click",function(r){var o=r.delegateTarget;if(Qc(o,P_))return e.toggle();e.trigger("click",r)}),ve.bind(i,"mousedown",function(r){r.stopPropagation()}),Xt.bind(i,A_,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},pt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},pt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Ye(n),a=Ye(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(T_,r),a.toggle(Ip+T_,r),"open"in e&&(o.toggle(Lp,e.open),a.toggle(Ip+Lp,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},pt.prototype._update=function(){var e=$e(".djs-palette-entries",this._container),t=this._entries=this.getEntries();wa(e),P(t,function(n,i){var r=n.group||"default",o=$e("[data-group="+Yo(r)+"]",e);o||(o=We('<div class="group"></div>'),Lt(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=We(a);if(o.appendChild(s),!n.separator&&(Lt(s,"data-action",i),n.title&&Lt(s,"title",n.title),n.className&&v2(s,n.className),n.imageUrl)){var c=We("<img>");Lt(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},pt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=Lt(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},pt.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(xt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},pt.prototype._layoutChanged=function(){this._toggleState({})},pt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},pt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},pt.prototype.open=function(){this._toggleState({open:!0})},pt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},pt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},pt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=$e(".djs-palette-entries",this._container),this._toolsContainer=$e("[data-group=tools]",t)),n=this._toolsContainer,P(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Ye(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},pt.prototype.isOpen=function(){return Ye(this._container).has(Lp)},pt.prototype._getParentContainer=function(){return this._canvas.getContainer()},pt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function v2(e,t){var n=Ye(e),i=pe(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function y2(e,t){var n=t.getPaletteEntries();return xt(n)?n(e):(P(n,function(i,r){e[r]=i}),e)}const _2={__init__:["palette"],palette:["type",pt]};var M_="crosshair",k_="selected",b2="djs-dragging-active-lasso";function Vi(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=oe("rect");Z(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ye(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,m=p.lastMarked;if(h&&m){for(const g of m)h.has(g)||t.removeMarker(g,k_);for(const g of h)m.has(g)||t.addMarker(g,k_)}},remove:function(p){this.update(p),p.frame&>(p.frame),u(!1)}};function u(p){Me(t.getContainer()).toggle(b2,p)}function l(p){var f=i.getAll();return new Set(_r(Cr(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=D_(p),f.add=cs(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=D_(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(cs(p))return s.activateLasso(p.originalEvent),!0})}Vi.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Vi.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:M_,data:{context:{}},keepSelection:!0})},Vi.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:M_,data:{context:{}},keepSelection:!0})},Vi.prototype._select=function(e){this._selection.select(e)},Vi.prototype.select=function(e,t,n=[]){var i=_r(Cr(e,t));this._select([...n,...i])},Vi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Vi.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function D_(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 x2={__depends__:[_s,Do],__init__:["lassoTool"],lassoTool:["type",Vi]};var Bp=1500,O_="grab";function no(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",Bp,function(c){if(To(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Bp,function(c){if(!(!I_(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(Bp,function(c){!I_(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!To(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}no.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],no.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:O_,data:{context:n||{}}})},no.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:O_,data:{context:{reactivate:n}}})},no.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},no.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function I_(e){return vt("Space",e)}const E2={__depends__:[_s,Do],__init__:["handTool"],handTool:["type",no]};var L_="connect-ok",B_="connect-not-ok";function io(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?L_:B_))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?L_:B_)}),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})}io.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],io.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},io.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},io.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},io.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const w2={__depends__:[Rp,jn,ti,_s,Do],globalConnect:["type",io]};function Np(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)}Np.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Np.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(w){var E=n.createShape(k({type:p},m));t.start(w,E)}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 k(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 S2={__depends__:[_2,vs,ug,x2,E2,w2,Eo],__init__:["paletteProvider"],paletteProvider:["type",Np]};var R2=250;function $p(e,t,n,i,r){W.call(this,e);function o(s){var c=s.canExecute.replacements;P(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);k(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=$e('[data-element-id="'+Yo(f.id)+'"]',s.dragGroup);h&&Z(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;P(c,function(u,l){var p=$e('[data-element-id="'+Yo(l)+'"]',s.dragGroup);p&&Z(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",R2,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}$p.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],X($p,W);const C2={__depends__:[Gr],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",$p]};var P2=1250,jp=40,A2=20,T2=10,N_=20,$_=["x","y"],M2=Math.abs;function j_(e){e.on(["connect.hover","connect.move","connect.end"],P2,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Jt(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&k2(t,o,L2(o)),o&&I2(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=_n(r),Se(o,["bpmn:Event","bpmn:Gateway"])&&F_(t,_n(o)),Se(o,["bpmn:Task","bpmn:SubProcess"])&&D2(t,o),y(a,"bpmn:BoundaryEvent")&&s===a.host&&O2(t)):H_(i,"bpmn:MessageFlow")?(y(r,"bpmn:Event")&&(n.connectionStart=_n(r)),y(o,"bpmn:Event")&&F_(t,_n(o))):n.connectionStart=n.initialConnectionStart)})}j_.$inject=["eventBus"];function k2(e,t,n){$_.forEach(function(i){var r=z_(i,t);e[i]<t[i]+n?lt(e,i,t[i]+n):e[i]>t[i]+r-n&<(e,i,t[i]+r-n)})}function D2(e,t){var n=_n(t);$_.forEach(function(i){B2(e,t,i)&<(e,i,n[i])})}function O2(e){var t=e.context,n=t.source,i=t.target;if(!N2(t)){var r=_n(n),o=Rt(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;M2(c-r[s])<jp&&(c>r[s]?u=r[s]+jp:u=r[s]-jp,lt(e,s,u))})}}function F_(e,t){lt(e,"x",t.x),lt(e,"y",t.y)}function H_(e,t){return e&&e.type===t}function I2(e,t){return di(t,function(n){return H_(e,n)})}function z_(e,t){return e==="x"?t.width:t.height}function L2(e){return y(e,"bpmn:Task")?T2:A2}function B2(e,t,n){return e[n]>t[n]+N_&&e[n]<t[n]+z_(n,t)-N_}function N2(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Gi(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Gi.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Gi.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Gi.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Gi.prototype.getSnapLocations=function(){return this._snapLocations},Gi.prototype.setSnapLocations=function(e){this._snapLocations=e},Gi.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Rc,n.initDefaults(this._defaultSnaps)),n};function Rc(){this._snapValues={}}Rc.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)},Rc.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&RT(e[n],r[n],i)},Rc.prototype.initDefaults=function(e){var t=this;P(e||{},function(n,i){P(n,function(r){t.add(i,r)})})};var $2=1250;function Vn(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"],$2,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Jt(r.originalEvent))&&!(to(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()})}Vn.$inject=["elementRegistry","eventBus","snapping"],Vn.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Gi);var o;t.get(i.id)?o=_n(i,e):o={x:e.x+_n(i).x,y:e.y+_n(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}),xe(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},Vn.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return P(i,function(r){if(xe(r)){xe(t)&&e.add("mid",_n(r));return}if(je(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);P(o,function(a){e.add("mid",a)});return}e.add("mid",_n(r))}),!me(t.x)||!me(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",_n(t)),e},Vn.prototype.getSnapTargets=function(e,t){return Ay(t).filter(function(n){return!j2(n)})};function j2(e){return!!e.hidden}var V_=1500;function ro(e,t){t.invoke(Vn,this),e.on(["create.move","create.end"],V_,V2),e.on(["create.move","create.end","shape.move.move","shape.move.end"],V_,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!to(n)&&F2(n,o)})}X(ro,Vn),ro.$inject=["eventBus","injector"],ro.prototype.initSnap=function(e){var t=Vn.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return P(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",W_(o,i,e))}),P(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",W_(o,i,e))}),y(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},ro.prototype.addSnapTargetPoints=function(e,t,n){Vn.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);P(i,function(o){(z2(o)||H2([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Cy(o)),e.add("bottom-right",Py(o)))});var r=this._elementRegistry;return P(t.incoming,function(o){if(r.get(t.id)){G_(i,o.source)||e.add("mid",fe(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),P(t.outgoing,function(o){if(r.get(t.id)){G_(i,o.target)||e.add("mid",fe(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},ro.prototype.getSnapTargets=function(e,t){return Vn.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!y(n,"bpmn:Lane")})};function F2(e,t){var n=ue(t),i=om(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=fe(o),/top/.test(i)?lt(e,"y",n.top-a.y):/bottom/.test(i)&<(e,"y",n.bottom-a.y),/left/.test(i)?lt(e,"x",n.left-a.x):/right/.test(i)&<(e,"x",n.right-a.x)}function H2(e,t){return e.every(function(n){return y(n,t)})}function z2(e){return y(e,"bpmn:SubProcess")&&Pe(e)?!0:y(e,"bpmn:Participant")}function V2(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)&<(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&<(e,"y",e.y)}}function G_(e,t){return e.indexOf(t)!==-1}function W_(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var G2=1250;function la(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],G2,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Jt(i.originalEvent))&&!to(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),q2(s)&<(i,"x",i.x),Y2(s)&<(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}la.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Gi);var o=U_(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},la.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return P(r,function(o){e.add("corner",Py(o)),e.add("corner",Cy(o))}),e.add("corner",U_(t,i)),e},la.$inject=["eventBus","snapping"],la.prototype.getSnapTargets=function(e,t){return Ay(t).filter(function(n){return!W2(n,e)&&!je(n)&&!U2(n)&&!xe(n)})};function U_(e,t){var n=fe(e),i=ue(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 W2(e,t){return e.host===t}function U2(e){return!!e.hidden}function q2(e){return e==="n"||e==="s"}function Y2(e){return e==="e"||e==="w"}var K2=7,X2=1e3;function Wi(e){this._canvas=e,this._asyncHide=Dc(Gt(this.hide,this),X2)}Wi.$inject=["canvas"],Wi.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:to(e,"x"),y:to(e,"y")};P(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(P(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,K2),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),P(["x","y"],function(a){var s=o[a];bt(s)&<(e,a,s.originValue)})},Wi.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=oe("path");return Z(n,{d:"M0,0 L0,0"}),Me(n).add("djs-snap-line"),ye(t,n),{update:function(i){me(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"})}}},Wi.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Wi.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Wi.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Wi.prototype.hide=function(){P(this._snapLines,function(e){e.update()})};const Z2={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Vn],resizeSnapping:["type",la],snapping:["type",Wi]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",j_],createMoveSnapping:["type",ro]};var q_=300;function _e(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=$e(_e.INPUT_SELECTOR,this._container),this._resultsContainer=$e(_e.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}_e.$inject=["canvas","eventBus","selection","translate"],_e.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Xt.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,_e.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,_e.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,_e.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,_e.INPUT_SELECTOR,"keydown",function(n){vt("ArrowUp",n)&&n.preventDefault(),vt("ArrowDown",n)&&n.preventDefault()}),t(this._container,_e.INPUT_SELECTOR,"keyup",function(n){if(vt("Escape",n))return e.close();if(vt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(vt("ArrowUp",n))return e._scrollToDirection(!0);if(vt("ArrowDown",n))return e._scrollToDirection();vt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},_e.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Xt.unbind(e.el,e.type,e.listener)})},_e.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=$e(_e.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},_e.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},_e.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)}},_e.prototype._clearResults=function(){wa(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},_e.prototype._getCurrentResult=function(){return $e(_e.RESULT_SELECTED_SELECTOR,this._resultsContainer)},_e.prototype._createResultNode=function(e,t){var n=We(_e.RESULT_HTML);return e.primaryTokens.length>0&&Y_(n,e.primaryTokens,_e.RESULT_PRIMARY_HTML),Y_(n,e.secondaryTokens,_e.RESULT_SECONDARY_HTML),Lt(n,_e.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},_e.prototype.registerProvider=function(e){this._searchProvider=e},_e.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,Ye(this._canvas.getContainer()).add("djs-search-open"),Ye(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},_e.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,Ye(this._canvas.getContainer()).remove("djs-search-open"),Ye(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},_e.prototype.toggle=function(){this.isOpen()?this.close():this.open()},_e.prototype.isOpen=function(){return this._open},_e.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Ye(t).remove(_e.RESULT_SELECTED_CLASS);var n=Lt(e,_e.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Ye(e).add(_e.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:q_}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},_e.prototype._select=function(e){var t=Lt(e,_e.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:q_}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},_e.prototype._getBoxHtml=function(){const e=We(_e.BOX_HTML),t=$e(_e.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Y_(e,t,n){var i=Q2(t),r=We(n);r.innerHTML=i,e.appendChild(r)}function Q2(e){var t="";return e.forEach(function(n){var i=nv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+_e.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}_e.CONTAINER_SELECTOR=".djs-search-container",_e.INPUT_SELECTOR=".djs-search-input input",_e.RESULTS_CONTAINER_SELECTOR=".djs-search-results",_e.RESULT_SELECTOR=".djs-search-result",_e.RESULT_SELECTED_CLASS="djs-search-result-selected",_e.RESULT_SELECTED_SELECTOR="."+_e.RESULT_SELECTED_CLASS,_e.RESULT_ID_ATTRIBUTE="data-result-id",_e.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",_e.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
335
|
+
</svg>`},pO=900;function Ja(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",pO,this)}Ja.$inject=["popupMenu","distributeElements","translate","rules"],Ja.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Ja.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ja.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:Vx.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Vx.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const fO={__depends__:[jf,lO],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",_u],distributeElementsMenuProvider:["type",Ja]};var Wx="is not a registered action",dO="is already registered";function ai(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}ai.$inject=["eventBus","injector"],ai.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 f=s.allowed("elements.delete",{elements:l});if(f!==!1){var p=De(f)?f:l;return o.cut(p.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 f=s.allowed("elements.delete",{elements:l}),p;f!==!1&&(De(f)?p=f:p=l,p.length&&n.removeElements(p.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},ai.prototype.trigger=function(e,t){if(!this._actions[e])throw Xf(e,Wx);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},ai.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);$(e,function(i,r){n._registerAction(r,i)})},ai.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Xf(e,dO);this._actions[e]=t},ai.prototype.unregister=function(e){if(!this.isRegistered(e))throw Xf(e,Wx);this._actions[e]=void 0},ai.prototype.getActions=function(){return Object.keys(this._actions)},ai.prototype.isRegistered=function(e){return!!this._actions[e]};function Xf(e,t){return new Error(e+" "+t)}const hO={__init__:["editorActions"],editorActions:["type",ai]};function wu(e){e.invoke(ai,this)}ye(wu,ai),wu.$inject=["injector"],wu.prototype._registerDefaultActions=function(e){ai.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),f=e.get("searchPad",!1),p=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var m=t.getRootElement(),h=n.filter(function(g){return g!==m});return i.select(h),h}),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(m){var h=i.get(),g=m.type;h.length&&c.trigger(h,g)}),i&&u&&this._registerAction("alignElements",function(m){var h=i.get(),g=[],y=m.type;h.length&&(g=Ye(h,function(v){return!E(v,"bpmn:Lane")}),u.trigger(g,y))}),i&&p&&this._registerAction("setColor",function(m){var h=i.get();h.length&&p.setColor(h,m)}),i&&l&&this._registerAction("directEditing",function(){var m=i.get();m.length&&l.activate(m[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),h,g;E(m,"bpmn:Collaboration")?g=n.filter(function(y){return E(y.parent,"bpmn:Collaboration")}):g=n.filter(function(y){return y!==m&&!E(y.parent,"bpmn:SubProcess")}),h=Bt(g),p.moveElements(g,{x:-h.x,y:-h.y},m)}),i&&d&&this._registerAction("replaceElement",function(m){d.triggerEntry("replace","click",m)})};const mO={__depends__:[hO],editorActions:["type",wu]};function Ux(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;We(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}Ux.$inject=["eventBus"];function Xr(e,t){ee.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;Tn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Xr.$inject=["eventBus","gridSnapping","modeling"],ye(Xr,ee),Xr.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},Xr.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},Xr.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),V(e,o),e},Xr.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),V(e,o),e};var gO=2e3;function Yx(e,t){e.on(["spaceTool.move","spaceTool.end"],gO,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)}})}Yx.$inject=["eventBus","gridSnapping"];const yO={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Xr],gridSnappingSpaceToolBehavior:["type",Yx]};var Eu=10;function Zf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var vO=1200,bO=800;function wr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",bO,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"],vO,function(o){var a=o.originalEvent;if(!(!r.active||a&&Bn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},f=_O(o,u,e);f&&(l.offset=f);var p=xO(o,u);p&&V(l,p),Vo(o,u)||r.snapEvent(o,u,l)})}})}wr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);jt(e,t,i)},wr.prototype.getGridSpacing=function(){return Eu},wr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Zf(e,Eu);var i,r;return t&&t.min&&(i=t.min,Be(i)&&(i=Zf(i+n,Eu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Be(r)&&(r=Zf(r+n,Eu,"floor"),e=Math.min(e,r))),e-=n,e},wr.prototype.isActive=function(){return this.active},wr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},wr.prototype.toggleActive=function(){this.setActive(!this.active)},wr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function xO(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&&(Su(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&&(Su(t)?Kx(s)?a.x.max=c.left:a.x.min=c.right:qx(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(Su(t)?Kx(s)?a.x.min=u.left:a.x.max=u.right:qx(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function _O(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Be(s[t])||(s||(s=o.snapOffset={}),Be(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Su(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 Su(e){return e==="x"}function qx(e){return e.indexOf("n")!==-1}function Kx(e){return e.indexOf("w")!==-1}const wO={__depends__:[yO],__init__:["gridSnapping"],gridSnapping:["type",wr]};var EO=2e3;function Xx(e,t,n){e.on("autoPlace",EO,function(i){var r=i.source,o=Le(r),a=i.shape,s=Kv(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],E(a,"bpmn:TextAnnotation")&&(SO(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}Xx.$inject=["eventBus","gridSnapping","elementRegistry"];function SO(e){return e==="x"}var RO=1750;function Zx(e,t,n){t.on(["create.start","shape.move.start"],RO,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!E(o,"bpmn:Participant")||!E(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}))}})}Zx.$inject=["canvas","eventBus","gridSnapping"];var CO=3e3;function Ru(e,t,n){ee.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],CO,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||PO(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Ru.$inject=["eventBus","gridSnapping","modeling"],ye(Ru,ee),Ru.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=MO(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function PO(e){return e.length>3}function AO(e){return e==="h"}function TO(e){return e==="v"}function MO(e,t,n){var i=Ii(t,n),r={};return AO(i)&&(r.y=e.snapValue(t.y)),TO(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=V({},t,r),n=V({},n,r)),[t,n]}const kO={__depends__:[wO,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Xx],gridSnappingParticipantBehavior:["type",Zx],gridSnappingLayoutConnectionBehavior:["type",Ru]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Ux]};var OO=30,Qx=30;function es(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(E(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(E(r,"bpmn:Participant"))return Xe(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(E(r,"bpmn:SubProcess"))return Xe(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}es.$inject=["eventBus","interactionEvents"],es.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},es.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=Qt(e)?{width:OO,height:e.height}:{width:e.width,height:Qx};return this._interactionEvents.createBoxHit(t,"all",n),!0},es.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:Qx}),!0};const DO={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",es]};function Cu(e){e.invoke(No,this)}ye(Cu,No),Cu.$inject=["injector"],Cu.prototype.registerBindings=function(e,t){No.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 LO={__depends__:[Rf],__init__:["keyboardBindings"],keyboardBindings:["type",Cu]};var IO={moveSpeed:1,moveSpeedAccelerated:10},BO=1500,Jx="left",e_="up",t_="right",n_="down",NO={ArrowLeft:Jx,Left:Jx,ArrowUp:e_,Up:e_,ArrowRight:t_,Right:t_,ArrowDown:n_,Down:n_},$O={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 i_(e,t,n,i,r){var o=this;this._config=V({},IO,e||{}),t.addListener(BO,function(a){var s=a.keyEvent,c=NO[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=$O[a](u),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,l)}}}i_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const FO={__depends__:[Rf,ti],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",i_]};var r_=10;function ts(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=u,d=IC(l,f,u),c.newBounds=NC(d,p),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:Te(l)})}function s(c){var u=c.shape,l=c.canExecute,f=c.newBounds;if(l){if(f=_m(f),!jO(u,f))return;n.resizeShape(u,f)}}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)})}ts.prototype.canResize=function(e){var t=this._rules,n=ui(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},ts.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=V({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,o_(t,o),"resize",{autoActivate:!0,cursor:HO(o),data:{shape:t,context:r}})},ts.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:r_,height:r_},r=cg(t,e.childrenBoxPadding),$C(n,t,i,r)},ts.$inject=["eventBus","rules","modeling","dragging"];function jO(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function o_(e,t){var n=Le(e),i=Te(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 HO(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 a_="djs-resizing",s_="resize-not-ok",zO=500;function c_(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,a_)),s.width>5&&ve(c,{x:s.x,width:s.width}),s.height>5&&ve(c,{y:s.y,height:s.height}),o.canExecute?Ze(c).remove(s_):Ze(c).add(s_)}function r(o){var a=o.shape,s=o.frame;s&&Vt(o.frame),t.removeMarker(a,a_)}e.on("resize.move",zO,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}c_.$inject=["eventBus","canvas","previewSupport"];var Pu=-6,Au=8,Tu=20,ns="djs-resizer",GO=["n","w","s","e","nw","ne","se","sw"];function Er(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,Cn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}Er.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){pr(o)&&i.activate(o,e,n)}Ne.bind(t,"mousedown",r),Ne.bind(t,"touchstart",r)},Er.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=VO(i),a=Ce("g");Ze(a).add(ns),Ze(a).add(ns+"-"+e.id),Ze(a).add(ns+"-"+i),Fe(r,a);var s=Ce("rect");ve(s,{x:-Au/2+o.x,y:-Au/2+o.y,width:Au,height:Au}),Ze(s).add(ns+"-visual"),Fe(a,s);var c=Ce("rect");return ve(c,{x:-Tu/2+o.x,y:-Tu/2+o.y,width:Tu,height:Tu}),Ze(c).add(ns+"-hit"),Fe(a,c),Gs(a,t,n),a},Er.prototype.createResizer=function(e,t){var n=o_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Er.prototype.addResizer=function(e){var t=this;pt(e)||$(GO,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Er.prototype.removeResizers=function(){var e=this._getResizersParent();Ls(e)},Er.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Er.$inject=["eventBus","canvas","selection","resize"];function VO(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 u_={__depends__:[Si,Hi,Lo],__init__:["resize","resizePreview","resizeHandles"],resize:["type",ts],resizePreview:["type",c_],resizeHandles:["type",Er]};var WO=2e3;function is(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"],WO,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,f=c.context.canExecute,p=c.isTouch;p||f&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||We(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}is.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],is.prototype.activate=function(e){var t=qn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);V(n,i);var r={},o=n.style||{};return V(o,{backgroundColor:null,border:null}),(We(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||l_(e))&&V(r,{centerVertically:!0}),sr(e)&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),E(e,"bpmn:TextAnnotation")&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),V(n,{options:r,style:o}),n}},is.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,f=s.fontSize*a,p=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(E(e,"bpmn:Lane")||qO(e)){var m=Qt(e),h=m?{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};V(o,h),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(YO(e)){var g=Qt(e),y=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};V(o,y),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(We(e,["bpmn:Task","bpmn:CallActivity"])||l_(e))&&(V(o,{width:i.width,height:i.height}),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),UO(e)&&(V(o,{width:i.width,x:i.x}),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var v=1,b=i.width+2*v;if(n.labelTarget&&(V(o,{width:b,height:i.height+2*v,x:i.x-v,y:i.y-v}),V(d,{fontSize:u+"px",lineHeight:l})),sr(n)&&!Us(n)&&!Ge(n)){var x=$l(e),C=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),P=u,D=$r.width*a+2*v;V(o,{width:D,height:P+2*v,x:C.x-D/2,y:C.y-P/2-v}),V(d,{fontSize:u+"px",lineHeight:l})}return E(e,"bpmn:TextAnnotation")&&(V(o,{width:i.width+2*v,height:i.height+2*v,x:i.x-v,y:i.y-v,minWidth:30*a,minHeight:10*a}),V(d,{textAlign:"left",paddingTop:_o*a+"px",paddingBottom:_o*a+"px",paddingLeft:_o*a+"px",paddingRight:_o*a+"px",fontSize:f+"px",lineHeight:p})),{bounds:o,style:d}},is.prototype.update=function(e,t,n,i){var r,o;E(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}),KO(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function l_(e){return E(e,"bpmn:SubProcess")&&!Xe(e)}function UO(e){return E(e,"bpmn:SubProcess")&&Xe(e)}function YO(e){return E(e,"bpmn:Participant")&&!Xe(e)}function qO(e){return E(e,"bpmn:Participant")&&Xe(e)}function KO(e){return!e||!e.trim()}var p_="djs-element-hidden",f_="djs-label-hidden";function d_(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,E(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Ce("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),f=i.path=Ce("path");ve(f,{d:l,strokeWidth:2,stroke:XO(o)}),Fe(s,f),Fe(r,s),on(s,o.x,o.y)}E(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,p_):(E(o,"bpmn:Task")||E(o,"bpmn:CallActivity")||E(o,"bpmn:SubProcess")||E(o,"bpmn:Participant")||E(o,"bpmn:Lane"))&&t.addMarker(o,f_)}),e.on("directEditing.resize",function(c){if(E(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,f=Math.max(o.height/a.height*(u+l),0),p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:f,position:{mx:0,my:0}});ve(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,p_),t.removeMarker(o,f_)),o=void 0,a=void 0,s&&(Vt(s),s=void 0)})}d_.$inject=["eventBus","canvas","pathMap"];function XO(e,t){var n=Qe(e);return n.get("stroke")||t||"black"}const ZO={__depends__:[nf,u_,$x],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",is],labelEditingPreview:["type",d_]};var QO=500,JO=1e3;function Pi(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){NS(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){$(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],QO,function(o){var a=o.element,s=o.gfx,c=ut(".djs-outline",s);c&&i.updateOutline(a,c)})}Pi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=ut(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Fe(t,n),this.updateOutline(e,n)),n},Pi.prototype._createOutlineGfx=function(){var e=Ce("rect");return ve(e,V({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Pi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Pi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&$(i,function(r){n=n||r.updateOutline(t,e)}),n||ve(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Pi.prototype.updateConnectionOutline=function(e,t){var n=Bt(t);ve(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Pi.prototype.registerProvider=function(e,t){t||(t=e,e=JO),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Pi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Pi.prototype.getOutline=function(e){var t,n=this._getProviders();return $(n,function(i){Xt(i.getOutline)&&(t=t||i.getOutline(e))}),t},Pi.$inject=["eventBus","styles","elementRegistry"];var Mu=6;function Qf(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)})}Qf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ls(t);var n=e.length>1,i=this._canvas.getContainer();if(Ze(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=eD(Bt(e)),o=Ce("rect");ve(o,V({rx:3},r)),Ze(o).add("djs-selection-outline"),Fe(t,o)}},Qf.$inject=["eventBus","canvas","selection"];function eD(e){return{x:e.x-Mu,y:e.y-Mu,width:e.width+Mu*2,height:e.height+Mu*2}}const Jf={__depends__:[ti],__init__:["outline","multiSelectionOutline"],outline:["type",Pi],multiSelectionOutline:["type",Qf]},h_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],m_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},tD=15,ku=2;function g_(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:f}){var d;const p=f.filter(m=>We(m,h_));if(p.length===1){const m=p[0];Ge(m)?a(m,m.labelTarget):(d=m.labels)!=null&&d.length&&a(m.labels[0],m)}if(p.length===2){const m=p.find(Ge),h=p.find(g=>{var y;return(y=g.labels)==null?void 0:y.includes(m)});m&&h&&a(m,h)}}),e.on("shape.changed",function({element:f}){var p;!We(f,h_)||!l(f)||(Ge(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=aa([Le(p),Le(f)],m_),m=d.getAttribute("d"),g=r.isSelected(f)?c(f):u(f),y=la(g,m);if(!y)return;const b=r.isSelected(p)?c(p):u(p),x=la(b,m)||Le(p);xa(x,y)<tD||(Ml(d,[x,y]),Fe(o,d))}function s(){Ds(`.${m_.class}`,o).forEach(Vt)}function c(f){const p=i.getOutline(f);if(!p)return u(f);if(p.x){const d={x:f.x+Sr(p,"x")-ku,y:f.y+Sr(p,"y")-ku,width:Sr(p,"width")+ku*2,height:Sr(p,"height")+ku*2};return jl(d,Sr(p,"rx"))}if(p.cx){const d=Sr(p,"r"),m={x:f.x+Sr(p,"cx")-d,y:f.y+Sr(p,"cy")-d,width:d*2,height:d*2};return Wm(m)}}function u(f){return n.getShapePath(f)}function l(f){return r.isSelected(f)}}g_.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function Sr(e,t){return parseFloat(ve(e,t)||0)}const nD={__depends__:[ti,Jf],__init__:["labelLink"],labelLink:["type",g_]};var iD=new Do("tt");function rD(e){var t=bt('<div class="djs-tooltip-container" />');return wn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function oD(e,t,n){wn(e,{left:t+"px",top:n+"px"})}function ed(e,t){e.style.display=t===!1?"none":""}var y_="djs-tooltip",td="."+y_;function An(e,t){this._eventBus=e,this._canvas=t,this._ids=iD,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=rD(t.getContainer());var n=this;Dn.bind(this._tooltipRoot,td,"mousedown",function(i){i.stopPropagation()}),Dn.bind(this._tooltipRoot,td,"mouseover",function(i){n.trigger("mouseover",i)}),Dn.bind(this._tooltipRoot,td,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}An.$inject=["eventBus","canvas"],An.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=V({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},An.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(hn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},An.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},An.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},An.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)}},An.prototype.remove=function(e){var t=this.get(e);t&&(vi(t.html),vi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},An.prototype.show=function(){ed(this._tooltipRoot)},An.prototype.hide=function(){ed(this._tooltipRoot,!1)},An.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},An.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)),Tn(n)&&(n=bt(n)),i=bt('<div data-tooltip-id="'+t+'" class="'+y_+'">'),wn(i,{position:"absolute"}),i.appendChild(n),e.type&&Et(i).add("djs-tooltip-"+e.type),e.className&&Et(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},An.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;oD(n,t.x,t.y)},An.prototype._updateTooltipVisibilty=function(e){$(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),ed(i,r))})},An.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 aD={__init__:["tooltips"],tooltips:["type",An]};var sD="flow elements must be children of pools/participants",cD="Data object must be placed within a pool/participant.";function v_(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;E(s,"bpmn:Collaboration")&&(E(a,"bpmn:FlowNode")?i(r,n(sD)):E(a,"bpmn:DataObjectReference")&&i(r,n(cD)))})}v_.$inject=["eventBus","tooltips","translate"];const uD={__depends__:[aD],__init__:["modelingFeedback"],modelingFeedback:["type",v_]};var lD=500,pD=1250,fD=1500,Ou=Math.round;function dD(e){return{x:e.x+Ou(e.width/2),y:e.y+Ou(e.height/2)}}function b_(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",fD,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=hD(l),V(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",pD,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",lD,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,f={x:s.dx,y:s.dy},p={x:s.x,y:s.y},d;if(d=o(u,f,p,l),c.delta=f,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,f=l==="attach",p=c.shapes;if(l===!1)return!1;u.x=Ou(u.x),u.y=Ou(u.y),!(u.x===0&&u.y===0)&&n.moveElements(p,u,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(pr(s)){var c=To(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Kt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Ze(s.target).has("djs-hit-no-move")){var f=dD(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(p!==!1)return!0}}this.start=a}b_.$inject=["eventBus","dragging","modeling","selection","rules"];function hD(e){var t=ro(e,"id");return Ye(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var x_=499,nd="djs-dragging",__="drop-ok",w_="drop-not-ok",E_="new-parent",S_="attach-ok";function R_(e,t,n,i){function r(c){var u=o(c),l=mD(u);return l}function o(c){var u=sa(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=u.concat(l),p=[...new Set(f)];return p}function a(c,u){[S_,__,w_,E_].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,nd),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",x_,function(c){var u=c.context,l=u.shapes,f=u.allDraggedElements,p=r(l);if(!u.dragGroup){var d=Ce("g");ve(d,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();Fe(m,d),u.dragGroup=d}p.forEach(function(h){i.addDragger(h,u.dragGroup)}),f?f=zu([f,o(l)]):f=o(l),$(f,function(h){t.addMarker(h,nd)}),u.allDraggedElements=f,u.differentParents=gD(l)}),e.on("shape.move.move",x_,function(c){var u=c.context,l=u.dragGroup,f=u.target,p=u.shape.parent,d=u.canExecute;f&&(d==="attach"?a(f,S_):u.canExecute&&p&&f.id!==p.id?a(f,E_):a(f,u.canExecute?__:w_)),on(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,f=u.dragGroup;$(l,function(p){t.removeMarker(p,nd)}),f&&Vt(f)}),this.makeDraggable=s}R_.$inject=["eventBus","canvas","styles","previewSupport"];function mD(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ye(e,function(i){return pt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function gD(e){return rw(ro(e,function(t){return t.parent&&t.parent.id}))!==1}const yD={__depends__:[Ec,ti,Jf,Si,Hi,Lo],__init__:["move","movePreview"],move:["type",b_],movePreview:["type",R_]};var C_=".djs-palette-toggle",P_=".entry",vD=C_+", "+P_,id="djs-palette-",bD="shown",rd="open",A_="two-column",xD=1e3;function Ht(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()})}Ht.$inject=["eventBus","canvas"],Ht.prototype.registerProvider=function(e,t){t||(t=e,e=xD),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Ht.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(wD,{})},Ht.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Ht.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=bt(Ht.HTML_MARKUP);n.appendChild(i),Et(n).add(id+bD),Dn.bind(i,vD,"click",function(r){var o=r.delegateTarget;if(_l(o,C_))return e.toggle();e.trigger("click",r)}),Ne.bind(i,"mousedown",function(r){r.stopPropagation()}),Dn.bind(i,P_,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Ht.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ht.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Et(n),a=Et(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(A_,r),a.toggle(id+A_,r),"open"in e&&(o.toggle(rd,e.open),a.toggle(id+rd,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Ht.prototype._update=function(){var e=ut(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ks(e),$(t,function(n,i){var r=n.group||"default",o=ut("[data-group="+za(r)+"]",e);o||(o=bt('<div class="group"></div>'),hn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=bt(a);if(o.appendChild(s),!n.separator&&(hn(s,"data-action",i),n.title&&hn(s,"title",n.title),n.className&&_D(s,n.className),n.imageUrl)){var c=bt("<img>");hn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Ht.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=hn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Ht.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(Xt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Ht.prototype._layoutChanged=function(){this._toggleState({})},Ht.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Ht.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ht.prototype.open=function(){this._toggleState({open:!0})},Ht.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ht.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ht.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=ut(".djs-palette-entries",this._container),this._toolsContainer=ut("[data-group=tools]",t)),n=this._toolsContainer,$(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Et(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Ht.prototype.isOpen=function(){return Et(this._container).has(rd)},Ht.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ht.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function _D(e,t){var n=Et(e),i=De(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function wD(e,t){var n=t.getPaletteEntries();return Xt(n)?n(e):($(n,function(i,r){e[r]=i}),e)}const ED={__init__:["palette"],palette:["type",Ht]};var T_="crosshair",M_="selected",SD="djs-dragging-active-lasso";function Rr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(f){var p=t.getActiveLayer(),d=f.frame=Ce("rect");ve(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Fe(p,d),u(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&ve(p,{x:d.x,y:d.y,width:d.width,height:d.height});var m=f.marked,h=f.lastMarked;if(m&&h){for(const g of h)m.has(g)||t.removeMarker(g,M_);for(const g of m)h.has(g)||t.addMarker(g,M_)}},remove:function(f){this.update(f),f.frame&&Vt(f.frame),u(!1)}};function u(f){Ze(t.getContainer()).toggle(SD,f)}function l(f){var p=i.getAll();return new Set(io(go(p,f)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(f){var p=f.originalEvent.target;!f.hover&&!(p instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(f.originalEvent,!0)})}),e.on("lasso.end",0,function(f){var p=f.context;s._select(Array.from(p.marked))}),e.on("lasso.start",function(f){var p=f.context;p.bbox=k_(f),p.add=gc(f),p.lastMarked=new Set(r.get()),p.add?p.marked=p.lastMarked:p.marked=new Set,p.initialMarked=p.marked,c.create(p)}),e.on("lasso.move",function(f){var p=f.context,d=p.bbox=k_(f),m=l(d),h=p.initialMarked.union(m);p.lastMarked=p.marked,p.marked=h,c.update(p)}),e.on("lasso.cleanup",function(f){var p=f.context;p.lastMarked=p.marked,p.marked=new Set(r.get()),c.remove(f.context)}),e.on("element.mousedown",1500,function(f){if(gc(f))return s.activateLasso(f.originalEvent),!0})}Rr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Rr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:T_,data:{context:{}},keepSelection:!0})},Rr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:T_,data:{context:{}},keepSelection:!0})},Rr.prototype._select=function(e){this._selection.select(e)},Rr.prototype.select=function(e,t,n=[]){var i=io(go(e,t));this._select([...n,...i])},Rr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Rr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function k_(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 RD={__depends__:[Pc,Ca],__init__:["lassoTool"],lassoTool:["type",Rr]};var od=1500,O_="grab";function Wo(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",od,function(c){if(Ea(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(od,function(c){if(!(!D_(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(od,function(c){!D_(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!Ea(c)&&l&&e.once("hand.move.ended",function(f){a.activateHand(f.originalEvent,!0,!0)}),!1})}Wo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Wo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:O_,data:{context:n||{}}})},Wo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:O_,data:{context:{reactivate:n}}})},Wo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Wo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function D_(e){return Wt("Space",e)}const CD={__depends__:[Pc,Ca],__init__:["handTool"],handTool:["type",Wo]};var L_="connect-ok",I_="connect-not-ok";function Uo(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,f=u.canStartConnect=s.canStartConnect(l);f!==null&&(u.startTarget=l,i.addMarker(l,f?L_:I_))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?L_:I_)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,f={x:c.x,y:c.y},p=s.canStartConnect(l);if(p)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,f)}),!1})}Uo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Uo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Uo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Uo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Uo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const PD={__depends__:[qf,Si,Hi,Pc,Ca],globalConnect:["type",Uo]};function ad(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)}ad.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],ad.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(f,p,d,m,h){function g(y){var v=n.createShape(V({type:f},h));t.start(y,v)}return{group:p,className:d,title:m,action:{dragstart:g,click:g}}}function u(f){var p=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:p});t.start(f,[p,d],{hints:{autoSelect:[p]}})}function l(f){t.start(f,n.createParticipantShape())}return V(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(f){o.activateHand(f)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(f){r.activateSelection(f)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(f){i.activateSelection(f)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(f){a.start(f)}}},"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 AD={__depends__:[ED,Rc,uv,RD,CD,PD,ga],__init__:["paletteProvider"],paletteProvider:["type",ad]};var TD=250;function sd(e,t,n,i,r){ee.call(this,e);function o(s){var c=s.canExecute.replacements;$(c,function(u){var l=u.oldElementId,f={type:u.newElementType};if(!s.visualReplacements[l]){var p=t.get(l);V(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var m=ut('[data-element-id="'+za(p.id)+'"]',s.dragGroup);m&&ve(m,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;$(c,function(u,l){var f=ut('[data-element-id="'+za(l)+'"]',s.dragGroup);f&&ve(f,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",TD,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}sd.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ye(sd,ee);const MD={__depends__:[Lo],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",sd]};var kD=1250,cd=40,OD=20,DD=10,B_=20,N_=["x","y"],LD=Math.abs;function $_(e){e.on(["connect.hover","connect.move","connect.end"],kD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Bn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&ID(t,o,FD(o)),o&&$D(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=ri(r),We(o,["bpmn:Event","bpmn:Gateway"])&&F_(t,ri(o)),We(o,["bpmn:Task","bpmn:SubProcess"])&&BD(t,o),E(a,"bpmn:BoundaryEvent")&&s===a.host&&ND(t)):j_(i,"bpmn:MessageFlow")?(E(r,"bpmn:Event")&&(n.connectionStart=ri(r)),E(o,"bpmn:Event")&&F_(t,ri(o))):n.connectionStart=n.initialConnectionStart)})}$_.$inject=["eventBus"];function ID(e,t,n){N_.forEach(function(i){var r=H_(i,t);e[i]<t[i]+n?jt(e,i,t[i]+n):e[i]>t[i]+r-n&&jt(e,i,t[i]+r-n)})}function BD(e,t){var n=ri(t);N_.forEach(function(i){jD(e,t,i)&&jt(e,i,n[i])})}function ND(e){var t=e.context,n=t.source,i=t.target;if(!HD(t)){var r=ri(n),o=rn(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;LD(c-r[s])<cd&&(c>r[s]?u=r[s]+cd:u=r[s]-cd,jt(e,s,u))})}}function F_(e,t){jt(e,"x",t.x),jt(e,"y",t.y)}function j_(e,t){return e&&e.type===t}function $D(e,t){return Xi(t,function(n){return j_(e,n)})}function H_(e,t){return e==="x"?t.width:t.height}function FD(e){return E(e,"bpmn:Task")?DD:OD}function jD(e,t,n){return e[n]>t[n]+B_&&e[n]<t[n]+H_(n,t)-B_}function HD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Cr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Cr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Cr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Cr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Cr.prototype.getSnapLocations=function(){return this._snapLocations},Cr.prototype.setSnapLocations=function(e){this._snapLocations=e},Cr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Du,n.initDefaults(this._defaultSnaps)),n};function Du(){this._snapValues={}}Du.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)},Du.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&Tk(e[n],r[n],i)},Du.prototype.initDefaults=function(e){var t=this;$(e||{},function(n,i){$(n,function(r){t.add(i,r)})})};var zD=1250;function Ai(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"],zD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Bn(r.originalEvent))&&!(Vo(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()})}Ai.$inject=["elementRegistry","eventBus","snapping"],Ai.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Cr);var o;t.get(i.id)?o=ri(i,e):o={x:e.x+ri(i).x,y:e.y+ri(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}),Ge(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},Ai.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return $(i,function(r){if(Ge(r)){Ge(t)&&e.add("mid",ri(r));return}if(pt(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);$(o,function(a){e.add("mid",a)});return}e.add("mid",ri(r))}),!Be(t.x)||!Be(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",ri(t)),e},Ai.prototype.getSnapTargets=function(e,t){return Px(t).filter(function(n){return!GD(n)})};function GD(e){return!!e.hidden}var z_=1500;function Yo(e,t){t.invoke(Ai,this),e.on(["create.move","create.end"],z_,YD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],z_,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Vo(n)&&VD(n,o)})}ye(Yo,Ai),Yo.$inject=["eventBus","injector"],Yo.prototype.initSnap=function(e){var t=Ai.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return $(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",V_(o,i,e))}),$(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",V_(o,i,e))}),E(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Yo.prototype.addSnapTargetPoints=function(e,t,n){Ai.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);$(i,function(o){(UD(o)||WD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Rx(o)),e.add("bottom-right",Cx(o)))});var r=this._elementRegistry;return $(t.incoming,function(o){if(r.get(t.id)){G_(i,o.source)||e.add("mid",Le(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),$(t.outgoing,function(o){if(r.get(t.id)){G_(i,o.target)||e.add("mid",Le(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),E(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Yo.prototype.getSnapTargets=function(e,t){return Ai.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!E(n,"bpmn:Lane")})};function VD(e,t){var n=Te(t),i=oy(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Le(o),/top/.test(i)?jt(e,"y",n.top-a.y):/bottom/.test(i)&&jt(e,"y",n.bottom-a.y),/left/.test(i)?jt(e,"x",n.left-a.x):/right/.test(i)&&jt(e,"x",n.right-a.x)}function WD(e,t){return e.every(function(n){return E(n,t)})}function UD(e){return E(e,"bpmn:SubProcess")&&Xe(e)?!0:E(e,"bpmn:Participant")}function YD(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)&&jt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&jt(e,"y",e.y)}}function G_(e,t){return e.indexOf(t)!==-1}function V_(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var qD=1250;function rs(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],qD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Bn(i.originalEvent))&&!Vo(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),ZD(s)&&jt(i,"x",i.x),QD(s)&&jt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}rs.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Cr);var o=W_(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},rs.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return $(r,function(o){e.add("corner",Cx(o)),e.add("corner",Rx(o))}),e.add("corner",W_(t,i)),e},rs.$inject=["eventBus","snapping"],rs.prototype.getSnapTargets=function(e,t){return Px(t).filter(function(n){return!KD(n,e)&&!pt(n)&&!XD(n)&&!Ge(n)})};function W_(e,t){var n=Le(e),i=Te(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 KD(e,t){return e.host===t}function XD(e){return!!e.hidden}function ZD(e){return e==="n"||e==="s"}function QD(e){return e==="e"||e==="w"}var JD=7,eL=1e3;function Pr(e){this._canvas=e,this._asyncHide=Vu(Cn(this.hide,this),eL)}Pr.$inject=["canvas"],Pr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Vo(e,"x"),y:Vo(e,"y")};$(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if($(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,JD),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),$(["x","y"],function(a){var s=o[a];Kt(s)&&jt(e,a,s.originValue)})},Pr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Ce("path");return ve(n,{d:"M0,0 L0,0"}),Ze(n).add("djs-snap-line"),Fe(t,n),{update:function(i){Be(i)?e==="horizontal"?ve(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):ve(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):ve(n,{display:"none"})}}},Pr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Pr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Pr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Pr.prototype.hide=function(){$(this._snapLines,function(e){e.update()})};const tL={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ai],resizeSnapping:["type",rs],snapping:["type",Pr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",$_],createMoveSnapping:["type",Yo]};var U_=300;function je(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=ut(je.INPUT_SELECTOR,this._container),this._resultsContainer=ut(je.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}je.$inject=["canvas","eventBus","selection","translate"],je.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Dn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,je.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,je.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,je.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,je.INPUT_SELECTOR,"keydown",function(n){Wt("ArrowUp",n)&&n.preventDefault(),Wt("ArrowDown",n)&&n.preventDefault()}),t(this._container,je.INPUT_SELECTOR,"keyup",function(n){if(Wt("Escape",n))return e.close();if(Wt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Wt("ArrowUp",n))return e._scrollToDirection(!0);if(Wt("ArrowDown",n))return e._scrollToDirection();Wt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},je.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Dn.unbind(e.el,e.type,e.listener)})},je.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=ut(je.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},je.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},je.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)}},je.prototype._clearResults=function(){ks(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},je.prototype._getCurrentResult=function(){return ut(je.RESULT_SELECTED_SELECTOR,this._resultsContainer)},je.prototype._createResultNode=function(e,t){var n=bt(je.RESULT_HTML);return e.primaryTokens.length>0&&Y_(n,e.primaryTokens,je.RESULT_PRIMARY_HTML),Y_(n,e.secondaryTokens,je.RESULT_SECONDARY_HTML),hn(n,je.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},je.prototype.registerProvider=function(e){this._searchProvider=e},je.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,Et(this._canvas.getContainer()).add("djs-search-open"),Et(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},je.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,Et(this._canvas.getContainer()).remove("djs-search-open"),Et(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},je.prototype.toggle=function(){this.isOpen()?this.close():this.open()},je.prototype.isOpen=function(){return this._open},je.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Et(t).remove(je.RESULT_SELECTED_CLASS);var n=hn(e,je.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Et(e).add(je.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:U_}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},je.prototype._select=function(e){var t=hn(e,je.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:U_}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},je.prototype._getBoxHtml=function(){const e=bt(je.BOX_HTML),t=ut(je.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Y_(e,t,n){var i=nL(t),r=bt(n);r.innerHTML=i,e.appendChild(r)}function nL(e){var t="";return e.forEach(function(n){var i=tb(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+je.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}je.CONTAINER_SELECTOR=".djs-search-container",je.INPUT_SELECTOR=".djs-search-input input",je.RESULTS_CONTAINER_SELECTOR=".djs-search-results",je.RESULT_SELECTOR=".djs-search-result",je.RESULT_SELECTED_CLASS="djs-search-result-selected",je.RESULT_SELECTED_SELECTOR="."+je.RESULT_SELECTED_CLASS,je.RESULT_ID_ATTRIBUTE="data-result-id",je.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",je.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>`,
|
|
343
|
+
</div>`,je.RESULT_HTML='<div class="djs-search-result"></div>',je.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',je.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const iL={__depends__:[ga,Kc,ti],searchPad:["type",je]};function ud(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}ud.$inject=["elementRegistry","searchPad","canvas","search"],ud.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Ge(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:qn(i),id:i.id})),e,{keys:["label","id"]}).map(rL)};function rL(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const oL={__depends__:[iL,ox],__init__:["bpmnSearch"],bpmnSearch:["type",ud]},aL="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",sL="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",cL={width:36,height:50},uL={width:50,height:50};function q_(e,t,n){return Ce("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const si=5;function Lu(e,t){this._styles=t,e.registerProvider(this)}Lu.$inject=["outline","styles"],Lu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(DR(e))return n=Ce("rect"),ve(n,V({x:-si,y:-si,rx:4,width:e.width+si*2,height:e.height+si*2},t)),n;if(!Ge(e))return E(e,"bpmn:Gateway")?(n=Ce("rect"),V(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),ve(n,V({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):We(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Ce("rect"),ve(n,V({x:-si,y:-si,rx:14,width:e.width+si*2,height:e.height+si*2},t))):E(e,"bpmn:EndEvent")?(n=Ce("circle"),ve(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+si+1},t))):E(e,"bpmn:Event")?(n=Ce("circle"),ve(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+si},t))):E(e,"bpmn:DataObjectReference")&&K_(e,"bpmn:DataObjectReference")?n=q_(aL,{x:-6,y:-6},t):E(e,"bpmn:DataStoreReference")&&K_(e,"bpmn:DataStoreReference")&&(n=q_(sL,{x:-6,y:-6},t)),n},Lu.prototype.updateOutline=function(e,t){if(!Ge(e))return We(e,["bpmn:SubProcess","bpmn:Group"])?(ve(t,{width:e.width+si*2,height:e.height+si*2}),!0):!!We(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function K_(e,t){var n;return t==="bpmn:DataObjectReference"?n=cL:t==="bpmn:DataStoreReference"&&(n=uL),e.width===n.width&&e.height===n.height}const lL={__depends__:[Jf],__init__:["outlineProvider"],outlineProvider:["type",Lu]};var pL='<?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 Ti(e){bo.call(this,e)}ye(Ti,bo),Ti.Viewer=xr,Ti.NavigatedViewer=Ga,Ti.prototype.createDiagram=function(){return this.importXML(pL)},Ti.prototype._interactionModules=[cb,lb,db],Ti.prototype._modelingModules=[dk,Yc,vk,gk,kk,qf,Nk,cO,Qy,Rc,fO,mO,kO,DO,LO,FO,ZO,nD,xf,uD,yD,AD,MD,u_,tL,oL,lL],Ti.prototype._modules=[].concat(xr.prototype._modules,Ti.prototype._interactionModules,Ti.prototype._modelingModules);const fL=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(It.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=It.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),f=rl(l);return r("imported",f),{warnings:f}}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 It.onMounted(async()=>{a=new Ti({container:o.value,moddleExtensions:ys}),i.xml&&await s(i.xml),r("ready")}),It.watch(()=>i.xml,u=>{u&&a&&s(u)}),It.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(It.openBlock(),It.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);se.ADDABLE_FLOW_NODE_TYPES=us,se.APPLY_BPMN_OPS_SCHEMA=ew,se.BPMN_MODDLE_EXTENSIONS=ys,se.BWL_MODDLE_SCHEMA=vd,se.BWL_NS=yd,se.BWL_PREFIX=Fu,se.BWL_SIDES=ju,se.BpmnModelerView=fL,se.EDITOR=O1,se.FLOW_LABEL_INDENT=Qd,se.HEADLESS_BPMN_MODULES=Qv,se.HEADLESS_TEXT_METRICS=co,se.I18N_NS=OE,se.I18N_PREFIX=Gd,se.IR_FLOW_NODE_TYPES=Ar,se.LABEL_FORK_MARGIN=cl,se.SYMBOLIC_OP_KINDS=_d,se.SYMBOLIC_OP_SCHEMA=wd,se.UNDO_EPISODE_COMMAND=Hu,se.applyBpmnOpBatch=Wh,se.applyBpmnOps=Hh,se.approximateTextWidth=uo,se.auditBpmnGeometry=uh,se.auditBpmnGeometryXml=i1,se.auditGeometry=dn,se.auditTargetsOf=Wn,se.axisSegmentsOf=_n,se.blackBoxNameRect=al,se.buildBpmnOpBatch=k1,se.buildRegistryIndex=ph,se.containerBoundarySegments=na,se.createBpmnEditorController=D1,se.createBpmnModdle=Vd,se.createHeadlessBpmnModeler=JM,se.crossedShapesOf=tn,se.crossingCost=Vn,se.describeProcess=Vh,se.describeProcessXml=M1,se.edgeCrossCount=ia,se.edgeCrossingPairsOf=ws,se.edgeCrossingStatsOf=ih,se.executeAsUndoEpisode=xd,se.forwardThreePointCandidates=Ss,se.geometryFindingKey=xn,se.installHeadlessBpmnDom=Ud,se.isAddableFlowNodeType=gd,se.isEdgeOverlapFinding=sl,se.isIrFlowNodeType=md,se.labelRectsOf=fo,se.lineCrossesLabel=Oi,se.lineThroughLabel=eh,se.lineThroughShapeLabel=sh,se.loadBpmnXml=il,se.lowerOps=jh,se.oppositeOverlapCount=WE,se.oppositeOverlapOf=Zd,se.planBackEdgeBoundaryClearance=xh,se.planCrossPoolRoute=yh,se.planEdgeRepair=fl,se.planLabelLineClearance=Mh,se.planLabelPlacement=Th,se.planMiddleSegmentShifts=dh,se.planOppositeOverlapRepair=wh,se.planSegmentDetours=Es,se.planShapeLabelClearance=Dh,se.repairIntroducedBoundaryHugging=_h,se.repairIntroducedCrossings=dl,se.repairIntroducedEdgeCrossings=mh,se.repairIntroducedFakeMerges=Sh,se.repairIntroducedLabelLines=kh,se.repairIntroducedOppositeOverlaps=Ah,se.repairIntroducedShapeLabelLines=Lh,se.repairIntroducedSharedSegmentLabels=Oh,se.rerouteIntroducedCrossPoolEdges=vh,se.resolverServicesOf=$h,se.saveBpmnXml=DE,se.sceneCrossingCost=nh,se.sceneFromDefinitions=ch,se.sceneFromRegistry=rt,se.sharedSegmentUnderLabel=_s,se.sharedSpansOf=xs,se.unreadableOverlapCount=Gn,se.unreadableOverlapOf=lo,se.validateOps=Nh,se.warningMessages=rl,Object.defineProperty(se,Symbol.toStringTag,{value:"Module"})}));
|