@g1cloud/bpmn-modeler-next 5.0.0-alpha.11 → 5.0.0-alpha.12
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/resolver/routeRepair.d.ts +12 -1
- package/dist/bpmn-modeler.js +6325 -6278
- package/dist/bpmn-modeler.umd.cjs +43 -43
- package/package.json +1 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
(function(Z,pt){typeof exports=="object"&&typeof module<"u"?pt(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],pt):(Z=typeof globalThis<"u"?globalThis:Z||self,pt(Z.BpmnModeler={},Z.Vue))})(this,(function(Z,pt){"use strict";var Yk=Object.defineProperty;var Kk=(Z,pt,ui)=>pt in Z?Yk(Z,pt,{enumerable:!0,configurable:!0,writable:!0,value:ui}):Z[pt]=ui;var Lr=(Z,pt,ui)=>Kk(Z,typeof pt!="symbol"?pt+"":pt,ui);const ui=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function vf(e){return ui.includes(e)}const yf="http://g1project.net/spec/bpmn/bwl/1.0",Zc="bwl",Qc=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],_f={name:"bwl-hints",uri:yf,prefix:Zc,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"}]}]},Jc="bwl.undoEpisode",bf=new WeakSet;function Nb(e){bf.has(e)||(e.register(Jc,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),bf.add(e))}function xf(e,t){Nb(e);const n={run:t};if(e.execute(Jc,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Ef=["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"],Bb={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},$b={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},jb={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},Fb={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...ui]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},Hb={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},zb={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},Vb={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Gb={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Wb={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Ub={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},qb={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Yb={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},Kb={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Qc]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function Ft(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Xb={"participant.add":Ft("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Ft("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":Ft("node.add",{description:"플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 보조 스트랜드 1…). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.",properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":Ft("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...ui]}},required:["id"]}),"sequenceFlow.add":Ft("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Ft("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":Ft("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Ft("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":Ft("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Ft("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":Ft("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Ft("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Ft("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Ft("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":Ft("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Ft("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":Ft("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},wf={anyOf:Ef.map(e=>Xb[e])},Zb={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:$b,irParticipant:jb,irNode:Fb,irFlowCondition:Hb,irSequenceFlow:zb,irMessageFlow:Vb,irDataStore:Gb,irDataAssociation:Wb,irTextAnnotation:Ub,irAssociation:qb,irGroup:Yb,bwlPlacement:Kb,nullableString:Bb,symbolicOp:wf}};function eu(e){return Array.prototype.concat.apply([],e)}const So=Object.prototype.toString,Qb=Object.prototype.hasOwnProperty;function ur(e){return e===void 0}function xt(e){return e!==void 0}function Nr(e){return e==null}function le(e){return So.call(e)==="[object Array]"}function At(e){return So.call(e)==="[object Object]"}function de(e){return So.call(e)==="[object Number]"}function Tt(e){const t=So.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function nn(e){return So.call(e)==="[object String]"}function Jb(e){if(!le(e))throw new Error("must supply array")}function rn(e,t){return!Nr(e)&&Qb.call(e,t)}function qe(e,t){const n=Da(t);let i;return T(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Sf(e,t){const n=Da(t);let i=le(e)?-1:void 0;return T(e,function(r,o){if(n(r,o))return i=o,!1}),i}function we(e,t){const n=Da(t);let i=[];return T(e,function(r,o){n(r,o)&&i.push(r)}),i}function T(e,t){let n,i;if(ur(e))return;const r=le(e)?r0:i0;for(let o in e)if(rn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function e0(e,t){if(ur(e))return[];Jb(e);const n=Da(t);return e.filter(function(i,r){return!n(i,r)})}function on(e,t,n){return T(e,function(i,r){n=t(n,i,r)}),n}function lr(e,t){return!!on(e,function(n,i,r){return n&&t(i,r)},!0)}function Pi(e,t){return!!qe(e,t)}function Ht(e,t){let n=[];return T(e,function(i,r){n.push(t(i,r))}),n}function ka(e){return e&&Object.keys(e)||[]}function t0(e){return ka(e).length}function Br(e){return Ht(e,t=>t)}function $r(e,t,n={}){return t=tu(t),T(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Rf(e,...t){e=tu(e);let n={};return T(t,r=>$r(r,e,n)),Ht(n,function(r,o){return r[0]})}const n0=Rf;function Wn(e,t){t=tu(t);let n=[];return T(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)}),Ht(n,i=>i.v)}function jr(e){return function(t){return lr(e,function(n,i){return t[i]===n})}}function tu(e){return Tt(e)?e:t=>t[e]}function Da(e){return Tt(e)?e:t=>t===e}function i0(e){return e}function r0(e){return Number(e)}function nu(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 Jt(e,t){return e.bind(t)}function D(e,...t){return Object.assign(e,...t)}function o0(e,t,n){let i=e;return T(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];xt(a)&&Nr(s)&&(s=i[r]=isNaN(+a)?{}:[]),ur(a)?ur(n)?delete i[r]:i[r]=n:i=s}),e}function jn(e,t){let n={},i=Object(e);return T(t,function(r){r in i&&(n[r]=e[r])}),n}function Un(e,t){let n={},i=Object(e);return T(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function iu(){}iu.prototype.get=function(e){return this.$model.properties.get(this,e)},iu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Cf(e,t){this.model=e,this.properties=t}Cf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(iu.prototype);T(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}),T(a,Jt(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var a0=D(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Pf=D(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function ru(e,t){var n=Pf[e];return n?n(t):t}function ou(e){return!!a0[e]}function Af(e){return!!Pf[e]}function zt(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 vn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}vn.prototype.build=function(){return jn(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},vn.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)},vn.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},vn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=zt(r[0],i),a=zt(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},vn.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},vn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},vn.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},vn.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},vn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},vn.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")},vn.prototype.hasProperty=function(e){return this.propertiesByName[e]},vn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(T(e.properties,Jt(function(o){o=D({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Ai(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,T(e,Jt(this.registerPackage,this))}Ai.prototype.getPackage=function(e){return this.packageMap[e]},Ai.prototype.getPackages=function(){return this.packages},Ai.prototype.registerPackage=function(e){e=D({},e);var t=this.packageMap;Tf(t,e,"prefix"),Tf(t,e,"uri"),T(e.types,Jt(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Ai.prototype.registerType=function(e,t){e=D({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:D({},e.meta||{})});var n=zt(e.name,t.prefix),i=n.name,r=Object.create(null);T(e.properties,Jt(function(o){var a=zt(o.name,n.prefix),s=a.name;ou(o.type)||(o.type=zt(o.type,a.prefix).name),D(o,{ns:a,name:s}),r[s]=o},this)),D(e,{ns:n,name:i,propertiesByName:r}),T(e.extends,Jt(function(o){var a=zt(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},Ai.prototype.mapTypes=function(e,t,n){var i=ou(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=zt(c,ou(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+">");T(i.superClass,n?a:s),t(i,!n),T(i.traits,a)},Ai.prototype.getEffectiveDescriptor=function(e){var t=zt(e),n=new vn(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},Ai.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Tf(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function pr(e){this.model=e}pr.prototype.set=function(e,t,n){if(!nn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;s0(n)?i?delete e[r]:delete e.$attrs[au(t)]:i?r in e?e[r]=n:Mf(e,i,n):e.$attrs[au(t)]=n},pr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[au(t)];var i=n.name;return!e[i]&&n.isMany&&Mf(e,n,[]),e[i]},pr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=D({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},pr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},pr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},pr.prototype.getProperty=function(e,t){var n=this.model,i=n.getPropertyDescriptor(e,t);if(i)return i;if(t.includes(":"))return null;const r=n.config.strict;if(typeof r<"u"){const o=new TypeError(`unknown property <${t}> on <${e.$type}>`);if(r)throw o;typeof console<"u"&&console.warn(o)}return null};function s0(e){return typeof e>"u"}function Mf(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function au(e){return e.replace(/^:/,"")}function wn(e,t={}){this.properties=new pr(this),this.factory=new Cf(this,this.properties),this.registry=new Ai(e,this.properties),this.typeCache=Object.create(null),this.config=t}wn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},wn.prototype.getType=function(e){var t=this.typeCache,n=nn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},wn.prototype.createAny=function(e,t,n){var i=zt(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){o0(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),T(n,function(a,s){At(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},wn.prototype.getPackage=function(e){return this.registry.getPackage(e)},wn.prototype.getPackages=function(){return this.registry.getPackages()},wn.prototype.getElementDescriptor=function(e){return e.$descriptor},wn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},wn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},wn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var kf=String.fromCharCode,c0=Object.prototype.hasOwnProperty,u0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Ro={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Ro).forEach(function(e){Ro[e.toUpperCase()]=Ro[e]});function l0(e,t,n,i){return i?c0.call(Ro,i)?Ro[i]:"&"+i+";":kf(t||parseInt(n,16))}function fr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(u0,l0):e}var Df="non-whitespace outside of root node";function Ti(e){return new Error(e)}function p0(e){return"missing namespace for prefix <"+e+">"}function Oa(e){return{get:e,enumerable:!0}}function f0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Of=Symbol("nameCache");function su(e){return e+"$uri"}function d0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[su(i)]=n;return t}function Ia(){return{line:0,column:0}}function h0(e){throw e}function If(e){if(!this)return new If(e);var t=e&&e.proxy,n,i,r,o,a=h0,s,c,u,l,p=Ia,f=!1,d=!1,h="",m=!1,g=!1,w=null,E=!1,b,x,S,A;function I(L){L instanceof Error||(L=Ti(L)),w=L,a(L,p)}function P(L){s&&(L instanceof Error||(L=Ti(L)),s(L,p))}this.on=function(L,H){if(typeof H!="function")throw Ti("required args <name, cb>");switch(L){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":r=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":o=H;break;case"attention":l=H;break;case"question":u=H;break;case"comment":c=H;break;default:throw Ti("unsupported event: "+L)}return this},this.ns=function(L){if(typeof L>"u"&&(L={}),typeof L!="object")throw Ti("required args <nsMap={}>");var H=Object.create(null),re;for(re in L)H[re]=L[re];return g=!0,A=H,this};function $(){b=g?[]:null,x=g?d0(A):null,S=[],p=Ia,E=!1,w=null,d=!1,h=""}this.parse=function(L){if(typeof L!="string")throw Ti("required args <xml=string>");if(f)throw Ti("parse during stream; call end() first");return $(),j(L),p=Ia,E=!1,w},this.write=function(L){if(typeof L!="string")throw Ti("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=Ia,E=!1,w},this.stop=function(){E=!0};function j(L,H=!1){var re=null,Pe=null,et,q=0,ne=!1,ce=!1,oe=0,se=0,K,N,B,V,xe,Ct,R,_,v,k="",O=0,z;function ie(He,ct){var jt=He.indexOf(":");if(jt===-1)return He;var qt=x[He.substring(0,jt)];return qt?ct===qt?He.substr(jt+1):qt+He.substr(jt):(P(p0(He.substring(0,jt))),null)}function _e(){if(z!==null)return z;var He,ct,jt=g&&x.xmlns,qt=g&&m?[]:null,Ye=O,yt=k,Ot=yt.length,Or,xn,Vn,En,_t,Gn={},Ma=new Set,hn,De,$e;e:for(;Ye<Ot;Ye++)if(hn=!1,De=yt.charCodeAt(Ye),!(De===32||De<14&&De>8)){for((De<65||De>122||De>90&&De<97)&&De!==95&&De!==58&&(P("illegal first char attribute name"),hn=!0),$e=Ye+1;$e<Ot;$e++)if(De=yt.charCodeAt($e),!(De>96&&De<123||De>64&&De<91||De>47&&De<59||De===46||De===45||De===95)){if(De===32||De<14&&De>8){P("missing attribute value"),Ye=$e;continue e}if(De===61)break;P("illegal attribute name char"),hn=!0}if(_t=yt.substring(Ye,$e),_t==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),hn=!0),De=yt.charCodeAt($e+1),De===34)$e=yt.indexOf('"',Ye=$e+2),$e===-1&&($e=yt.indexOf("'",Ye),$e!==-1&&(P("attribute value quote missmatch"),hn=!0));else if(De===39)$e=yt.indexOf("'",Ye=$e+2),$e===-1&&($e=yt.indexOf('"',Ye),$e!==-1&&(P("attribute value quote missmatch"),hn=!0));else for(P("missing attribute value quotes"),hn=!0,$e=$e+1;$e<Ot&&(De=yt.charCodeAt($e+1),!(De===32||De<14&&De>8));$e++);for($e===-1&&(P("missing closing quotes"),$e=Ot,hn=!0),hn||(Vn=yt.substring(Ye,$e)),Ye=$e;$e+1<Ot&&(De=yt.charCodeAt($e+1),!(De===32||De<14&&De>8));$e++)Ye===$e&&(P("illegal character after attribute end"),hn=!0);if(Ye=$e+1,hn)continue e;if(Ma.has(_t)){P("attribute <"+_t+"> already defined");continue}if(Ma.add(_t),!g){Gn[_t]=Vn;continue}if(m){if(xn=_t==="xmlns"?"xmlns":_t.charCodeAt(0)===120&&_t.substr(0,6)==="xmlns:"?_t.substr(6):null,xn!==null){if(He=fr(Vn),ct=su(xn),En=A[He],!En){if(xn==="xmlns"||ct in x&&x[ct]!==He)do En="ns"+q++;while(typeof x[En]<"u");else En=xn;A[He]=En}x[xn]!==En&&(Or||(x=f0(x),Or=!0),x[xn]=En,xn==="xmlns"&&(x[su(En)]=He,jt=En),x[ct]=He),Gn[_t]=Vn;continue}qt.push(_t,Vn);continue}_t=ie(_t,jt),_t!==null&&(Gn[_t]=Vn)}if(m)for(Ye=0,Ot=qt.length;Ye<Ot;Ye++)_t=ie(qt[Ye++],jt),Vn=qt[Ye],_t!==null&&(Gn[_t]=Vn);return z=Gn}function Ie(){for(var He=/(\r\n|\r|\n)/g,ct=0,jt=0,qt=0,Ye=se,yt,Ot;oe>=qt&&(yt=He.exec(L),!(!yt||(Ye=yt[0].length+yt.index,Ye>oe)));)ct+=1,qt=Ye;return oe==-1?(jt=Ye,Ot=L.substring(se)):se===0?Ot=L.substring(se,oe):(jt=oe-qt,Ot=se==-1?L.substring(oe):L.substring(oe,se+1)),{data:Ot,line:ct,column:jt}}for(p=Ie,t&&(v=Object.create({},{name:Oa(function(){return R}),originalName:Oa(function(){return _}),attrs:Oa(_e),ns:Oa(function(){return x})}));se!==-1;){if(L.charCodeAt(se)===60?oe=se:oe=L.indexOf("<",se),oe===-1){if(H)return L.substring(se);if(S.length)return I("unexpected end of file");if(!d)return I("missing start tag");se<L.length&&L.substring(se).trim()&&P(Df);return}if(d||(d=!0),se!==oe){if(S.length){if(n&&(n(L.substring(se,oe),fr,p),E))return}else if(L.substring(se,oe).trim()&&(P(Df),E))return}if(V=L.charCodeAt(oe+1),V===33){if(B=L.charCodeAt(oe+2),B===91&&L.substr(oe+3,6)==="CDATA["){if(se=L.indexOf("]]>",oe),se===-1)return H?L.substring(oe):I("unclosed cdata");if(o&&(o(L.substring(oe+9,se),p),E))return;se+=3;continue}if(B===45&&L.charCodeAt(oe+3)===45){if(se=L.indexOf("-->",oe),se===-1)return H?L.substring(oe):I("unclosed comment");if(c&&(c(L.substring(oe+4,se),fr,p),E))return;se+=3;continue}}if(V===63){if(se=L.indexOf("?>",oe),se===-1)return H?L.substring(oe):I("unclosed question");if(u&&(u(L.substring(oe,se+2),p),E))return;se+=2;continue}for(K=oe+1;;K++){if(xe=L.charCodeAt(K),isNaN(xe))return H?L.substring(oe):(se=-1,I("unclosed tag"));if(xe===34)B=L.indexOf('"',K+1),K=B!==-1?B:K;else if(xe===39)B=L.indexOf("'",K+1),K=B!==-1?B:K;else if(xe===62){se=K;break}}if(V===33){if(l&&(l(L.substring(oe,se+1),fr,p),E))return;se+=1;continue}if(z={},V===47){if(ne=!1,ce=!0,!S.length)return I("missing open tag");if(K=R=S.pop(),B=oe+2+K.length,L.substring(oe+2,B)!==K)return I("closing tag mismatch");for(;B<se;B++)if(V=L.charCodeAt(B),!(V===32||V>8&&V<14))return I("close tag")}else{if(L.charCodeAt(se-1)===47?(K=R=L.substring(oe+1,se-1),ne=!0,ce=!0):(K=R=L.substring(oe+1,se),ne=!0,ce=!1),!(V>96&&V<123||V>64&&V<91||V===95||V===58))return I("illegal first char nodeName");for(B=1,N=K.length;B<N;B++)if(V=K.charCodeAt(B),!(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=K.substring(0,B),z=null;break}return I("invalid nodeName")}ce||S.push(R)}if(g){et=x,ne&&(ce||b.push(et),z===null&&(m=K.indexOf("xmlns",B)!==-1)&&(O=B,k=K,_e(),m=!1)),_=R,Pe!==x&&(re=x[Of],re===void 0&&(re=x[Of]=Object.create(null)),Pe=x);var ot=re[R];if(ot!==void 0)R=ot;else{if(V=R.indexOf(":"),V!==-1){if(Ct=x[R.substring(0,V)],!Ct)return I("missing namespace on <"+_+">");R=R.substr(V+1)}else Ct=x.xmlns;Ct&&(R=Ct+":"+R),re[_]=R}}if(ne&&(O=B,k=K,i&&(t?i(v,fr,ce,p):i(R,_e,fr,ce,p),E)))return;if(ce){if(r&&(r(t?v:R,fr,ne,p),E))return;g&&(ne?x=et:x=b.pop())}se+=1}}}function Lf(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var cu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Nf="property";function Bf(e){return e.xml&&e.xml.serialize}function m0(e){const t=Bf(e);return t!==Nf&&(t||null)}function g0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function $f(e,t){return Lf(t)?e.prefix+":"+g0(e.localName):e.name}function v0(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 y0(e,t,n){const i=zt(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=zt(r);var a=n.getPackage(o.prefix);return v0(o,a)}function Mi(e){return new Error(e)}function li(e){return e.$descriptor}function _0(e){D(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Mi("expected element");var n=this.elementsById,i=li(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 Mi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Co(){}Co.prototype.handleEnd=function(){},Co.prototype.handleText=function(){},Co.prototype.handleNode=function(){};function uu(){}uu.prototype=Object.create(Co.prototype),uu.prototype.handleNode=function(){return this};function Fr(){}Fr.prototype=Object.create(Co.prototype),Fr.prototype.handleText=function(e){this.body=(this.body||"")+e};function Po(e,t){this.property=e,this.context=t}Po.prototype=Object.create(Fr.prototype),Po.prototype.handleNode=function(e){if(this.element)throw Mi("expected no sub nodes");return this.element=this.createReference(e),this},Po.prototype.handleEnd=function(){this.element.id=this.body},Po.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function lu(e,t){this.element=t,this.propertyDesc=e}lu.prototype=Object.create(Fr.prototype),lu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=ru(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function La(){}La.prototype=Object.create(Fr.prototype),La.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 Yt(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Yt.prototype=Object.create(La.prototype),Yt.prototype.addReference=function(e){this.context.addReference(e)},Yt.prototype.handleText=function(e){var t=this.element,n=li(t),i=n.bodyProperty;if(!i)throw Mi("unexpected body text <"+e+">");Fr.prototype.handleText.call(this,e)},Yt.prototype.handleEnd=function(){var e=this.body,t=this.element,n=li(t),i=n.bodyProperty;i&&e!==void 0&&(e=ru(i.type,e),t.set(i.name,e))},Yt.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=li(n),r=this.context,o=new n({}),a=this.model,s;return T(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),T(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=ru(l.type,c):u==="xmlns"?u=":"+u:(s=zt(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},Yt.prototype.getPropertyForNode=function(e){var t=e.name,n=zt(t),i=this.type,r=this.model,o=li(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=m0(s);if(u){const l=e.attributes[u];if(l){const p=y0(l,e.ns,r),f=r.getType(p);return D({},s,{effectiveType:li(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=$f(n,c),l=r.getType(u);if(s=qe(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return D({},s,{effectiveType:li(l).name})}else if(s=qe(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Mi("unrecognized element <"+n.name+">")},Yt.prototype.toString=function(){return"ElementDescriptor["+li(this.type).name+"]"},Yt.prototype.valueHandler=function(e,t){return new lu(e,t)},Yt.prototype.referenceHandler=function(e){return new Po(e,this.context)},Yt.prototype.handler=function(e){return e==="Element"?new Hr(this.model,e,this.context):new Yt(this.model,e,this.context)},Yt.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Af(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(D(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function pu(e,t,n){Yt.call(this,e,t,n)}pu.prototype=Object.create(Yt.prototype),pu.prototype.createElement=function(e){var t=e.name,n=zt(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&$f(n,o)||t;if(!r.hasType(a))throw Mi("unexpected element <"+e.originalName+">");return Yt.prototype.createElement.call(this,e)};function Hr(e,t,n){this.model=e,this.context=n}Hr.prototype=Object.create(La.prototype),Hr.prototype.createElement=function(e){var t=e.name,n=zt(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Hr.prototype.handleChild=function(e){var t=new Hr(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},Hr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function fu(e){e instanceof wn&&(e={model:e}),D(this,{lax:!1},e)}fu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Yt?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new _0(D({},t,{rootHandler:i})),s=new If({proxy:!0}),c=b0();i.context=a,c.push(i);function u(S,A,I){var P=A(),$=P.line,j=P.column,L=P.data;L.charAt(0)==="<"&&L.indexOf(" ")!==-1&&(L=L.slice(0,L.indexOf(" "))+">");var H="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 B0(e){e=D({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new L0,o=new N0(r,e.format);e.preamble&&o.append(x0);var a=new Qe,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes($0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function $0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in cu)n[i]=cu[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 Ba(e,t){wn.call(this,e,t)}Ba.prototype=Object.create(wn.prototype),Ba.prototype.fromXML=function(e,t,n){nn(t)||(n=t,t="bpmn:Definitions");var i=new fu(D({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Ba.prototype.toXML=function(e,t){var n=new B0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var j0="BPMN20",F0="http://www.omg.org/spec/BPMN/20100524/MODEL",H0="bpmn",z0=[],V0=[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",isAttr:!0,type:"String"}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",isMany:!0,replaces:"FlowElementsContainer#laneSets",type:"LaneSet"},{name:"flowElements",isMany:!0,replaces:"FlowElementsContainer#flowElements",type:"FlowElement"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}},{name:"assignment",type:"Assignment",isMany:!0}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",isBody:!0,type:"String"}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isMany:!0,isVirtual:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isMany:!0,isVirtual:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity","InteractionNode"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],G0=[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],W0={tagAlias:"lowerCase",typePrefix:"t"},U0={name:j0,uri:F0,prefix:H0,associations:z0,types:V0,enumerations:G0,xml:W0},q0="BPMNDI",Y0="http://www.omg.org/spec/BPMN/20100524/DI",K0="bpmndi",X0=[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],Z0=[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],Q0=[],J0={name:q0,uri:Y0,prefix:K0,types:X0,enumerations:Z0,associations:Q0},ex="DC",tx="http://www.omg.org/spec/DD/20100524/DC",nx="dc",ix=[{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}]}],rx=[],ox={name:ex,uri:tx,prefix:nx,types:ix,associations:rx},ax="DI",sx="http://www.omg.org/spec/DD/20100524/DI",cx="di",ux=[{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"}]}],lx=[],px={tagAlias:"lowerCase"},fx={name:ax,uri:sx,prefix:cx,types:ux,associations:lx,xml:px},dx="bpmn.io colors for BPMN",hx="http://bpmn.io/schema/bpmn/biocolor/1.0",mx="bioc",gx=[{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"}]}],vx=[],yx=[],_x={name:dx,uri:hx,prefix:mx,types:gx,enumerations:vx,associations:yx},bx="BPMN in Color",xx="http://www.omg.org/spec/BPMN/non-normative/color/1.0",Ex="color",wx=[{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"}]}],Sx=[],Rx=[],Cx={name:bx,uri:xx,prefix:Ex,types:wx,enumerations:Sx,associations:Rx};const Px={bpmn:U0,bpmndi:J0,dc:ox,di:fx,bioc:_x,color:Cx};function Vf(e,t){const n=D({},Px,e);return new Ba(n,t)}const Ax={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"}},Tx="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Gf="i18n",$a={[Gf]:Ax,[Zc]:_f};function Wf(){return Vf($a)}const Uf=Wf();async function mu(e){const{rootElement:t,warnings:n}=await Uf.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function Mx(e){const{xml:t}=await Uf.toXML(e,{format:!0});return t}function gu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ja=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),kx=1,Dx=2;function ki(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]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`}}const qf=20,Yf=1;function hr(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 Fa(e,t){let n=null;const i=e.type!==t.type;for(const r of hr(e))for(const o of hr(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>Yf)continue;const a=r.dir!==o.dir?"opposite":i?"mixed":null;if(!a)continue;const s=Math.min(r.hi,o.hi)-Math.max(r.lo,o.lo);s>=qf&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function Kf(e,t){const n=Fa(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function Ox(e,t){let n=0;for(const i of t)i.id!==e.id&&Kf(e,i)&&n++;return n}function vu(e,t){let n=0;for(const i of t)i.id!==e.id&&Fa(e,i)&&n++;return n}const yu=15,Xf=20;function Ix(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Xf||t.at>n[1]+Xf)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 _u=20;function bu(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Yf)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<qf||n.push([r-_u,o+_u])}return n}function Ha(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of hr(e)){const o=Ix(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of bu(r,hr(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const Lx=1,Nx=(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 Bx(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 $x(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 jx=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height;function Di(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(Bx(e.waypoints[o],e.waypoints[o+1],r,Dx)){i.push(r);break}}return i}function Fx(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 Zf=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function za(e,t){let n=0;for(const i of t){if(i.id===e.id||Zf(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++)Fx(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Ao(e,t){let n=0;for(const i of t)i.id===e.id||Zf(e,i)||za(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Qf(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++)za(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function xu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(za(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 zr=e=>e.shapes.filter(t=>!t.container);function Oi(e){const t=[],n=e.shapes.filter(o=>!o.container);for(const o of e.edges)for(const a of Di(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(!$x(s,c,kx))continue;const u=s.id<c.id?[s.id,c.id]:[c.id,s.id];t.push({kind:"shape-overlap",shapes:u,identical:jx(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=Fa(s,c);if(!u)continue;const l=s.id<c.id?[s.id,c.id]:[c.id,s.id];t.push({kind:u.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:l,axis:u.axis,length:Math.round(u.length)})}for(const o of e.edges){if(!o.label)continue;const a=Ha(o,e.edges);a&&t.push({kind:"label-on-shared-segment",edge:o.id,other:a.other,axis:a.axis})}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||Nx(a,o,Lx)||t.push({kind:"shape-outside-container",shape:o.id,container:a.id})}return t.sort((o,a)=>ki(o).localeCompare(ki(a)))}const Mt=e=>typeof e=="object"&&e!==null?e:void 0,Vt=e=>typeof e=="number"?e:0,mr=e=>{const t=Mt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function Hx(e){const t=Mt(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=mr(o);a&&n.push(a)}}return n}function zx(e,t){const n=Mt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=mr(n);return r?t.get(r):void 0}if(ja.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return mr(n)}function Jf(e){var o,a,s,c;const t=[],n=[],i=((o=Mt(e))==null?void 0:o.diagrams)??[],r=new Map;for(const u of((a=Mt(e))==null?void 0:a.rootElements)??[]){const l=Mt(u);if((l==null?void 0:l.$type)==="bpmn:Collaboration")for(const p of l.participants??[]){const f=Mt(p),d=mr(f),h=mr(f==null?void 0:f.processRef);d&&h&&r.set(h,d)}}for(const u of i){const l=Mt((s=Mt(u))==null?void 0:s.plane),p=(l==null?void 0:l.planeElement)??[];for(const f of p){const d=Mt(f);if(!d)continue;const h=Mt(d.bpmnElement),m=typeof(h==null?void 0:h.id)=="string"?h.id:void 0;if(!m)continue;const g=typeof(h==null?void 0:h.$type)=="string"?h.$type:"",w=Mt(d.bounds);if(w){const b=d.isExpanded===!1;t.push({id:m,type:g,x:Vt(w.x),y:Vt(w.y),width:Vt(w.width),height:Vt(w.height),container:ja.has(g)&&!b,attached:(h==null?void 0:h.attachedToRef)!==void 0,...h?{parent:zx(h,r)}:{}});continue}const E=d.waypoint;if(Array.isArray(E)){const b=Mt((c=Mt(d.label))==null?void 0:c.bounds);n.push({id:m,type:g,waypoints:E.map(x=>{var S,A;return{x:Vt((S=Mt(x))==null?void 0:S.x),y:Vt((A=Mt(x))==null?void 0:A.y)}}),endpoints:Hx(h),...b?{label:{x:Vt(b.x),y:Vt(b.y),width:Vt(b.width),height:Vt(b.height)}}:{}})}}}return{shapes:t,edges:n}}function ed(e){return Oi(Jf(e))}async function Vx(e){const{definitions:t,warnings:n}=await mu(e);return{findings:ed(t),warnings:n}}function Fn(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){const p=Mt(r.label);n.push({id:r.id,type:o,waypoints:a.map(f=>({x:Vt(f.x),y:Vt(f.y)})),endpoints:[mr(r.source),mr(r.target)].filter(f=>!!f),...p&&typeof p.x=="number"?{label:{x:p.x,y:Vt(p.y),width:Vt(p.width),height:Vt(p.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const s=Mt(r.businessObject);let c=Mt(r.parent);for(;c&&c.type==="bpmn:Lane";)c=Mt(c.parent);const u=typeof(c==null?void 0:c.type)=="string"?c.type:"",l=c&&ja.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:Vt(r.width),height:Vt(r.height),container:ja.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 Gx={"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 Wx(e,t){const n=Gx[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function td(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function nd(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 Wx(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&td(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?td(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 id=20,Ux=4,Kt=(e,t)=>Math.abs(e-t)<.5;function rd(e,t,n,i=id){if(Kt(e.y,t.y)&&!Kt(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(Kt(e.x,t.x)&&!Kt(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 od(e,t,n=id){if(e.length!==4)return null;const[i,r,o,a]=e;if(Kt(i.y,r.y)&&Kt(r.x,o.x)&&Kt(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(Kt(i.x,r.x)&&Kt(r.y,o.y)&&Kt(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 ad(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const qx=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],Eu=(e,t,n)=>Di({...e,waypoints:t},n).length;function sd(e,t,n){let i=[...e.waypoints],r=Eu(e,i,t);if(r===0)return null;let o=!1;for(const s of ad(e,t))if(Eu(e,s,t)===0)return s;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)||Di({...e,waypoints:[l,p]},[f]).length===0)continue;const d=rd(l,p,f),h=d?d.map(g=>qx(i,u,g)):od(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=Eu(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 cd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Fn(n),o=zr(r),a=Oi(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(ki(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const p=l.parent,f=p&&typeof p.x=="number"&&typeof p.width=="number"?{x:p.x,y:p.y,width:p.width,height:p.height}:void 0,d=sd(u,o,f);d&&i.updateWaypoints(l,d)}}const Yx=10;function ud(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 ld(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(H=>H.type==="bpmn:Participant"&&H.container),i=t.shapes.find(H=>H.id===e.endpoints[0]),r=t.shapes.find(H=>H.id===e.endpoints[1]);if(!i||!r)return null;const o=ud(i,n),a=ud(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(H=>H.id!==o.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=u.y).sort((H,re)=>H.y-re.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=zr(t),x=t.edges.filter(H=>H.id!==e.id),S=Ao(e,x),A=Di(e,b).length;if(S===0&&A===0)return null;const I=Math.min(...l.map(H=>H.x)),P=Math.max(...l.map(H=>H.x+H.width)),$=(w.x+E.x)/2,j=H=>H.filter((re,Pe)=>Pe===0||!(Kt(re.x,H[Pe-1].x)&&Kt(re.y,H[Pe-1].y)));let L;for(let H=I;H<=P;H+=Yx){const re=j([w,{x:w.x,y:m},{x:H,y:m},{x:H,y:g},{x:E.x,y:g},E]),Pe={...e,waypoints:re};if(Di(Pe,b).length>0)continue;const et=Ao(Pe,x),q=Math.abs(H-$);(!L||et<L.cross||et===L.cross&&q<L.detour)&&(L={pts:re,cross:et,detour:q})}return L&&(A>0?L.cross<=S:L.cross<S)?L.pts:null}function pd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Fn(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Fn(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=ld(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const wu=[25,-25,40,-40],fd=35;function Kx(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-fd:n.y+n.height+fd,p=[];for(const f of[0,...wu]){if(Math.abs(f)>=i.width/2-5)continue;const d=o+f;p.push({pts:[{x:n.x,y:r},{x:d,y:r},{x:d,y:c}],cost:Math.abs(f)});for(const h of[0,...wu]){if(Math.abs(h)>=n.width/2-5)continue;const m=a+h;p.push({pts:[{x:m,y:u},{x:m,y:l},{x:d,y:l},{x:d,y:c}],cost:Math.abs(f)+Math.abs(h)})}}return p}function Xx(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=Kt(n[0].x,n[1].x)&&!Kt(n[0].y,n[1].y),s=Kt(n[n.length-1].x,n[n.length-2].x)&&!Kt(n[n.length-1].y,n[n.length-2].y);for(const c of wu){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 dd(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=zr(t),r=t.edges.filter(l=>l.id!==e.id),o=vu(e,r);if(o===0)return null;const a=Ao(e,r);let s;const c=l=>l.reduce((p,f,d)=>d?p+Math.abs(f.x-l[d-1].x)+Math.abs(f.y-l[d-1].y):0,0),u=[...Kx(e,n),...Xx(e,n)];for(const{pts:l,cost:p}of u){const f={...e,waypoints:l};if(Di(f,i).length>0)continue;const d=vu(f,r),h=Ao(f,r);if(d>=o||h-a>o-d)continue;const m=c(l);(!s||d<s.opposite||d===s.opposite&&(h<s.cross||h===s.cross&&(p<s.cost||p===s.cost&&m<s.len)))&&(s={pts:l,opposite:d,cross:h,cost:p,len:m})}return(s==null?void 0:s.pts)??null}function hd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Fn(i),a=Oi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(ki(l)));if(!a.length)return;const s=new Set;for(const l of a)if(!(l.kind!=="edge-overlap-opposite"&&l.kind!=="edge-overlap-mixed"))for(const p of l.edges)n.has(p)||s.add(p);const c=l=>{var p;return((p=o.edges.find(f=>f.id===l))==null?void 0:p.type)??""},u=[...s].sort((l,p)=>{const f=c(l)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:l.localeCompare(p)});for(const l of u){const p=Fn(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=dd(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const Zx=10,Qx=(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 md(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Ha(e,i))return null;const r=zr(t),o=i.flatMap(hr);for(const a of hr(e)){let s=[[a.lo,a.hi]];for(const[d,h]of bu(a,o))s=s.flatMap(([m,g])=>{const w=[];return d>m&&w.push([m,Math.min(g,d)]),h<g&&w.push([Math.max(m,h),g]),w.filter(([E,b])=>b>E)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+Zx*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-yu}:{x:a.at+yu,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!Ha({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&Qx(f,d)))return f}return null}function gd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Fn(i),a=Oi(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ki(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(f=>f.id===s.edge);if(!c)continue;const u=md(c,o);if(!u)continue;const l=i.get(s.edge),p=l==null?void 0:l.label;p&&r.moveElements([p],{x:u.x-p.x,y:u.y-p.y})}}const Jx=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,vd=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),yd={"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}]},Va=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Su=e=>typeof e=="string"&&e!=="";function eE(e){const t=[];function n(i,r,o,a){if(a===null){Su(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!Va(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Su(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!Va(i)||!Su(i.kind)||!(i.kind in yd)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of yd[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(!Va(u))break;u=u[p]}if(!Va(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 _d(e,t){const n=eE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!Jx.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&&vd.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&&vd.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 bd(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 Ga(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const xd={"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 It(e,t){return e.filter(n=>n.kind===t)}function Ed(e,t){var hn,De,$e,Ob,Ib;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=C=>o.get(C),p=C=>{const M=l(C);if(!M)throw new Error(`하강 참조 해소 실패: ${C}`);return M},f=C=>{let M=C.parent;for(;M;){if(M.type==="bpmn:Participant")return M;M=M.parent}},d=It(e,"participant.add"),h=It(e,"node.add"),m=It(e,"sequenceFlow.add"),g=It(e,"messageFlow.add"),w=It(e,"dataStore.add"),E=It(e,"dataAssociation.add"),b=It(e,"annotation.add"),x=It(e,"group.add"),S=new Map(h.map(C=>[C.node.id,C])),A=(C,M,F)=>{var bt;const X=C.businessObject,te=(((bt=X.extensionElements)==null?void 0:bt.values)??[]).filter(Le=>Le.$type!==M),Y=F?[...te,i.create(M,F)]:te;if(!Y.length){X.extensionElements&&n.updateProperties(C,{extensionElements:void 0});return}const me=i.create("bpmn:ExtensionElements",{values:Y});Y.forEach(Le=>{Le.$parent=me}),n.updateProperties(C,{extensionElements:me})},I=C=>({anchor:C.anchor,side:C.side,...C.offset!==void 0?{offset:C.offset}:{}});for(const C of It(e,"element.remove")){const M=l(C.id);M&&n.removeElements([M])}const P=C=>o.filter(M=>{var F;return M.type==="bpmn:Lane"&&((F=f(M))==null?void 0:F.id)===C}).sort((M,F)=>M.y-F.y);for(const C of It(e,"participant.update")){const M=p(C.id);if(C.name!==void 0&&n.updateProperties(M,{name:C.name??void 0}),!C.lanes)continue;const F=P(C.id);if(!F.length){n.splitLane(M,C.lanes.length),P(C.id).forEach((te,Y)=>{const me=C.lanes[Y];me&&n.updateProperties(te,{id:me.id,name:me.name})});continue}const X=new Set(F.map(te=>te.id));C.lanes.forEach((te,Y)=>{if(X.has(te.id)){n.updateProperties(p(te.id),{name:te.name});return}const me=Y===0?n.addLane(P(C.id)[0],"top"):n.addLane(p(C.lanes[Y-1].id),"bottom");n.updateProperties(me,{id:te.id,name:te.name})})}const $=150,j=80,L=90,H=180,re=new Set;for(const C of d){re.add(`pool:${C.participant.id}`);for(const M of C.participant.lanes??[])re.add(M.id)}const Pe=new Map;for(const C of h){const M=C.node.lane??`pool:${C.node.participant??""}`;let F=Pe.get(M);F||Pe.set(M,F=new Set([0])),C.band!==void 0&&F.add(C.band)}const et=new Map;for(const[C,M]of Pe){if(!re.has(C))continue;const F=[...M].sort((Y,me)=>Y-me),X=F.map((Y,me)=>me===0?0:me%2===1?Math.ceil(me/2):-(me/2)),te=Math.min(...X);et.set(C,new Map(F.map((Y,me)=>[Y,X[me]-te])))}const q=C=>{var M;return(((M=Pe.get(C))==null?void 0:M.size)??0)>1},ne=C=>C.band??(C.node.lane||!q(`pool:${C.node.participant??""}`)?void 0:0),ce=(C,M)=>{var F;return((F=et.get(C))==null?void 0:F.get(M))??M},oe=new Map;for(const[C,M]of Pe){let F=0;for(const X of M)F=Math.max(F,ce(C,X));oe.set(C,F)}const se=C=>H+$*C,K=d.map((C,M)=>({op:C,declared:M}));K.sort((C,M)=>{const F=C.op.order??Number.POSITIVE_INFINITY,X=M.op.order??Number.POSITIVE_INFINITY;return F!==X?F-X:C.declared-M.declared});let N=80;for(const C of o.getAll())C.parent===u()&&"height"in C&&typeof C.y=="number"&&(N=Math.max(N,C.y+C.height+60));for(const{op:C}of K){const M=C.participant,F=h.filter(mn=>mn.node.participant===M.id).length,X=((hn=M.lanes)==null?void 0:hn.length)??0,te=Math.max(1200,F*160+300),Y=(M.lanes??[]).map(mn=>se(oe.get(mn.id)??0)),me=Y.reduce((mn,Xe)=>mn+Xe,0);X&&me<300&&(Y[X-1]+=300-me);const bt=Math.max(300,$*((oe.get(`pool:${M.id}`)??0)+1)),Le=M.blackBox||F+X===0?120:X?Math.max(300,me):bt,Ae=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:M.id,name:M.name,...C.order!==void 0?{"bwl:poolOrder":C.order}:{},...M.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:te,height:Le,isExpanded:!0}),Pt=n.createShape(Ae,{x:100+te/2,y:N+Le/2},u()),ci=M.lanes??[];if(ci.length&&n.splitLane(Pt,ci.length),ci.length){const mn=o.filter(Xe=>{var Qt;return Xe.type==="bpmn:Lane"&&((Qt=f(Xe))==null?void 0:Qt.id)===M.id}).sort((Xe,Qt)=>Xe.y-Qt.y);if(mn.forEach((Xe,Qt)=>{const Nn=ci[Qt];Nn&&n.updateProperties(Xe,{id:Nn.id,name:Nn.name})}),Y.some(Xe=>Xe!==Pt.height/X)){let Xe=Pt.y;mn.forEach((Qt,Nn)=>{const cr=Y[Nn];n.resizeShape(Qt,{x:Qt.x,y:Xe,width:Qt.width,height:cr}),Xe+=cr})}}N=Pt.y+Pt.height+60}const B=C=>{var X;const M=S.get(C);if(M)return M.node.participant??"";const F=l(C);return F?F.type==="bpmn:Participant"?F.id:((X=f(F))==null?void 0:X.id)??"":""},V=new Map,xe=C=>{let M=V.get(C);return M||V.set(C,M={nodes:[],flows:[]}),M};for(const C of h)xe(C.node.participant??"").nodes.push(C);for(const C of m)xe(B(C.flow.source)).flows.push(C);const Ct=C=>{var M;return i.create("bpmn:SequenceFlow",{id:C.id,name:C.name??((M=C.condition)==null?void 0:M.label)})},R=(C,M)=>r.createShape({type:Ga(C.type),businessObject:i.create(Ga(C.type),{id:C.id,name:C.name,...M!==void 0?{"bwl:band":M}:{}})}),_=[...K.map(({op:C})=>C.participant.id).filter(C=>V.has(C)),...[...V.keys()].filter(C=>!d.some(M=>M.participant.id===C))],v=C=>C.endsWith("Gateway");for(const C of _){const M=V.get(C),F=C?p(C):void 0,X=F?F.x+150:250;let te=F?F.y+80:120;const Y=(Te,je,Be)=>{const ge=u().children.filter(Ue=>!("waypoints"in Ue&&Ue.waypoints)&&Ue.id!==je&&typeof Ue.y=="number"&&Ue.y>=Te);ge.length&&n.moveElements(ge,{x:0,y:Be})},me=(Te,je)=>{if(Te){const Ne=p(Te),Oe=se(je);if(Ne.height>=Oe)return;const gn=Oe-Ne.height,ze=f(Ne),ut=ze?ze.y+ze.height:Ne.y+Ne.height;n.resizeLane(Ne,{x:Ne.x,y:Ne.y,width:Ne.width,height:Oe},!1),Y(ut,ze==null?void 0:ze.id,gn);return}if(!F)return;const Be=$*(je+1);if(F.height>=Be)return;const ge=Be-F.height,Ue=F.y+F.height;n.resizeShape(F,{x:F.x,y:F.y,width:F.width,height:Be}),Y(Ue,F.id,ge)},bt=(Te,je,Be)=>{if(Te){const ge=p(Te);return ge.y+Math.min(ge.height/2,L)+ce(Te,je??0)*$}return je!==void 0&&F?F.y+j+ce(`pool:${C}`,je)*$:Be},Le=(Te,je,Be)=>{if(Te){const ge=p(Te);return ge.y+Math.min(ge.height/2,L)+je*$}return F?F.y+j+je*$:Be},Ae=Te=>Te.participant?p(Te.participant):u(),Pt=30,ci=(Te,je,Be,ge)=>{const Ue=Be-je.width/2,Ne=ge-je.height/2;return(Te.children??[]).find(Oe=>!("waypoints"in Oe&&Oe.waypoints)&&Oe.type!=="bpmn:Lane"&&Oe.type!=="label"&&typeof Oe.x=="number"&&Ue<Oe.x+Oe.width+Pt&&Ue+je.width+Pt>Oe.x&&Ne<Oe.y+Oe.height&&Ne+je.height>Oe.y)},mn=(Te,je,Be,ge,Ue,Ne)=>{const Oe=Be!==void 0||ge!==void 0,gn=ce(Be??`pool:${C}`,ge??0);if(Oe)for(let at=0;at<4;at++){const Ze=Le(Be,gn+at,Ne);if(!ci(Te,je,Ue,Ze))return me(Be,gn+at),{x:Ue,y:Ze}}const ze=bt(Be,ge,Ne);Oe&&me(Be,gn);let ut=Ue;for(let at=0;at<64;at++){const Ze=ci(Te,je,ut,ze);if(!Ze)break;ut=Ze.x+Ze.width+130+je.width/2}return{x:ut,y:ze}},Xe=new Set(M.flows.map(Te=>Te.flow.target)),Qt=new Map;for(const Te of M.nodes){if(Xe.has(Te.node.id))continue;const je=R(Te.node,Te.band),Be=ne(Te),ge=Te.node.lane?`${Te.node.lane}|${Be??""}`:Be!==void 0?`band:${Be}`:"",Ue=Ae(Te.node),Ne=mn(Ue,je,Te.node.lane,Be,Qt.get(ge)??X,te);n.createShape(je,Ne,Ue),Qt.set(ge,Ne.x+je.width+130),!Te.node.lane&&Be===void 0&&(te+=160)}const Nn=new Set,cr=new Map,Kc=new Map,Bn=new Map;if(C&&re.has(`pool:${C}`)){const Te=new Map;for(const ge of M.flows)Te.set(ge.flow.target,(Te.get(ge.flow.target)??0)+1);const je=ge=>bt(ge.node.lane,ne(ge),Number.NaN);for(const ge of M.nodes){if(!v(ge.node.type))continue;const Ue=je(ge);if(Number.isNaN(Ue)||b.some(ut=>{var at,Ze;return(((at=ut.placement)==null?void 0:at.anchor)??(ut.association?ut.association.source===ut.annotation.id?ut.association.target:ut.association.source:void 0))===ge.node.id&&((Ze=ut.placement)==null?void 0:Ze.side.startsWith("bottom"))}))continue;let Oe,gn=!1,ze;for(const ut of M.flows){if(ut.flow.source!==ge.node.id)continue;const at=S.get(ut.flow.target);if(!at||!at.node.lane&&ne(at)===void 0)continue;const Ze=je(at);Number.isNaN(Ze)||(Math.abs(Ze-Ue)<.5&&(gn=!0),Ze>Ue?!Oe||Ze>Oe.row?Oe={id:at.node.id,row:Ze,count:1}:Ze===Oe.row&&Oe.count++:Ze<Ue&&at.node.lane===ge.node.lane&&(!ze||Ze>ze.row?ze={op:at,row:Ze,count:1}:Ze===ze.row&&ze.count++))}Oe&&Oe.count===1&&(Te.get(Oe.id)??0)===1&&Nn.add(Oe.id),!gn&&ze&&ze.count===1&&(Te.get(ze.op.node.id)??0)===1&&cr.set(ze.op.node.id,{lane:ge.node.lane,band:ne(ge)})}const Be=new Map;for(const ge of g)Be.set(ge.flow.target,[...Be.get(ge.flow.target)??[],ge]);for(const ge of M.nodes){const Ue=Be.get(ge.node.id);if(!Ue||Ue.length!==1||!Te.get(ge.node.id)||!ge.node.lane&&ne(ge)===void 0)continue;const Ne=(De=S.get(Ue[0].flow.source))==null?void 0:De.node.participant,Oe=Ne?l(Ne):void 0;if(!Oe||!F||Oe.id===F.id)continue;const gn=ge.node.lane??`pool:${C}`,ze=et.get(gn);if(!ze)continue;const ut=ze.get(0)??0,at=(ze.get(ne(ge)??0)??ut)-ut;if(at===0)continue;const Ze=Oe.y<F.y;if(Ze&&at<0||!Ze&&at>0)continue;let $n;for(const[Xc,wo]of ze){const Ir=wo-ut;(Ze&&Ir<0&&(!$n||Ir<$n.row)||!Ze&&Ir>0&&(!$n||Ir>$n.row))&&($n={band:Xc,row:Ir})}$n&&Kc.set(ge.node.id,{lane:ge.node.lane,band:$n.band})}}const Lb=new Set;let qk=0;for(;qk++<M.nodes.length+2;){for(let Be=0;Be<M.nodes.length+M.flows.length+2;Be++){let ge=!1;for(const Ue of M.flows){const Ne=Ue.flow;if(Lb.has(Ne.id))continue;const Oe=l(Ne.source);if(!Oe)continue;const gn=l(Ne.target),ze=S.get(Ne.target);if(!gn&&ze){const ut=R(ze.node,ze.band),at=ne(ze);if(ze.node.lane||at!==void 0){const Ze=Ae(ze.node),$n=Oe,Xc=$n.x+(Bn.get(Ne.source)??0)+$n.width+130,wo=cr.get(Ne.target)??Kc.get(Ne.target),Ir=mn(Ze,ut,wo?wo.lane:ze.node.lane,wo?wo.band:at,Nn.has(Ne.target)?$n.x+$n.width/2:Xc,Number.NaN),gf=n.createShape(ut,Ir,Ze);Nn.has(Ne.target)&&Bn.set(Ne.target,Xc-(gf.x+gf.width/2)),n.connect(Oe,gf,{type:"bpmn:SequenceFlow",businessObject:Ct(Ne)})}else s.append(Oe,ut,{connection:{type:"bpmn:SequenceFlow",businessObject:Ct(Ne)}})}else if(gn)n.connect(Oe,gn,{type:"bpmn:SequenceFlow",businessObject:Ct(Ne)});else continue;Lb.add(Ne.id),ge=!0}if(!ge)break}const Te=M.nodes.filter(Be=>!l(Be.node.id));if(!Te.length)break;const je=Te[0];{const Be=R(je.node,je.band),ge=Ae(je.node),Ue=ne(je);n.createShape(Be,mn(ge,Be,je.node.lane,Ue,X,te),ge),!je.node.lane&&Ue===void 0&&(te+=160)}}}const k=40,O=(C,M=()=>!0)=>{const F=l(C);if(!F)return[];const X=[F],te=new Set([C]);for(let Y=0;Y<X.length;Y++){const me=X[Y].id;for(const bt of m){const Le=bt.flow.target;if(bt.flow.source!==me||te.has(Le)||!S.has(Le))continue;te.add(Le);const Ae=l(Le);Ae&&M(Ae)&&X.push(Ae)}}return X};for(const C of It(e,"sequenceFlow.update")){if(C.target===void 0)continue;const M=S.get(C.target);if(!M)continue;const F=l(C.target),X=l(C.id);if(!F||!X)continue;const te=C.source!==void 0?l(C.source):X.source,Y=X.target;if(!te||!Y||Y.id===F.id)continue;const me=O(C.target),bt=new Set(me.map(Xe=>Xe.id)),Le=Math.min(...me.map(Xe=>Xe.x)),Ae=Math.max(...me.map(Xe=>Xe.x+Xe.width)),Pt=te.x+te.width,ci=Ae-Le+k*2-(Y.x-Pt);if(ci>0){const Xe=f(F),Qt=(Xe==null?void 0:Xe.children)??[],Nn=Bn=>Bn.type==="bpmn:Lane",cr=Qt.filter(Bn=>!("waypoints"in Bn&&Bn.waypoints)&&!Nn(Bn)&&!bt.has(Bn.id)&&Bn.x>=Y.x),Kc=Xe?[Xe,...Qt.filter(Bn=>Nn(Bn))]:[];cr.length&&n.createSpace(cr,Kc,{x:ci,y:0},"e",Y.x-1)}const mn=M.node.lane||M.band!==void 0?F.y+F.height/2:te.y+te.height/2;n.moveElements(me,{x:Pt+k-Le,y:mn-(F.y+F.height/2)})}const z=(C,M)=>{const F=M.target===C,X=p(M.source),te=p(M.target),Y=F?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(X,te,M.id?{type:Y,businessObject:i.create(Y,{id:M.id})}:{type:Y})};for(const C of w){const M=C.associations??[],F=M.map(Y=>Y.source===C.dataStore.id?Y.target:Y.source).map(l).find(Boolean),X=F?f(F)??u():u(),te=F?{x:F.x+F.width/2,y:F.y+F.height+110}:{x:200,y:N+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:C.dataStore.id,name:C.dataStore.name})},te,X);for(const Y of M)z(C.dataStore.id,Y)}for(const C of E){const F=p(C.association.target).type==="bpmn:DataStoreReference"?C.association.target:C.association.source;z(F,C.association)}for(const C of g){const M=C.flow;n.connect(p(M.source),p(M.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:M.id,name:M.name})})}const ie=100,_e=30,Ie=4,ot=new Map;for(const C of g)ot.set(C.flow.target,(ot.get(C.flow.target)??0)+1);const He=C=>!("waypoints"in C&&C.waypoints)&&C.type!=="bpmn:Lane"&&C.type!=="label"&&typeof C.x=="number",ct=()=>{const C=Fn(o);return{bad:Oi(C).filter(M=>M.kind==="edge-crosses-shape"||M.kind==="edge-overlap-opposite"||M.kind==="edge-overlap-mixed").length,crossings:Qf(C)}},jt=C=>{const M=Fn(o),F=M.edges.find(X=>X.id===C);return!!F&&Di(F,zr(M)).length>0},qt=(C,M,F)=>{const X=new Set(C.map(Ae=>Ae.id)),te=(M.children??[]).filter(He).filter(Ae=>!X.has(Ae.id));if(C.some(Ae=>te.some(Pt=>Ae.x+F<Pt.x+Pt.width+_e&&Ae.x+F+Ae.width+_e>Pt.x&&Ae.y<Pt.y+Pt.height&&Ae.y+Ae.height>Pt.y)))return null;const me=M.width;n.moveElements(C,{x:F,y:0});const Le=Math.max(...C.map(Ae=>Ae.x+Ae.width))+150-(M.x+M.width);return Le>0&&n.resizeShape(M,{x:M.x,y:M.y,width:M.width+Le,height:M.height}),()=>{n.moveElements(C,{x:-F,y:0}),Le>0&&n.resizeShape(M,{x:M.x,y:M.y,width:me,height:M.height})}},Ye=(C,M)=>M.bad>C.bad||M.crossings>C.crossings,yt=(C,M,F,X=()=>!0)=>{const te=ct(),Y=qt(C,M,F);if(!Y)return!1;const me=ct();return Ye(te,me)||!X()?(Y(),!1):!0},Ot=g.filter(C=>{const M=S.get(C.flow.target),F=M==null?void 0:M.node.participant;return!!M&&!!F&&re.has(`pool:${F}`)&&(ot.get(C.flow.target)??0)===1}),Or=new Set(m.map(C=>C.flow.target)),xn=C=>K.findIndex(({op:M})=>M.participant.id===C);Ot.sort((C,M)=>{var te,Y;const F=Or.has(C.flow.target)?1:0,X=Or.has(M.flow.target)?1:0;return F!==X?F-X:xn((te=S.get(C.flow.target))==null?void 0:te.node.participant)-xn((Y=S.get(M.flow.target))==null?void 0:Y.node.participant)});const Vn=C=>{const M=l(C.flow.target),F=l(C.flow.source);if(!M||!F)return null;const X=F.x+F.width/2-(M.x+M.width/2);if(X<ie)return null;const te=p(S.get(C.flow.target).node.participant);return{subtree:O(C.flow.target,Y=>Y.x>=M.x),pool:te,dx:X}};for(let C=0;C<3;C++){const M=ct(),F=[];for(const te of Ot){const Y=Vn(te);if(!Y)continue;const me=qt(Y.subtree,Y.pool,Y.dx);me&&F.push(me)}if(!F.length)break;if(!Ye(M,ct()))continue;for(const te of F.reverse())te();let X=!1;for(const te of Ot){const Y=Vn(te);Y&&yt(Y.subtree,Y.pool,Y.dx)&&(X=!0)}if(!X)break}for(const C of Ot){if(!jt(C.flow.id))continue;const M=l(C.flow.target);if(!M)continue;const F=p(S.get(C.flow.target).node.participant),X=O(C.flow.target,Y=>Y.x>=M.x),te=M.width+130;for(let Y=1;Y<=Ie&&!yt(X,F,te*Y,()=>!jt(C.flow.id));Y++);}let En=0;for(const C of x){const M=(C.group.members??[]).map(l).filter(Y=>!!Y),F=40;let X;if(M.length){const Y=Math.min(...M.map(Ae=>Ae.x))-F,me=Math.min(...M.map(Ae=>Ae.y))-F,bt=Math.max(...M.map(Ae=>Ae.x+Ae.width))+F,Le=Math.max(...M.map(Ae=>Ae.y+Ae.height))+F;X={x:Y,y:me,width:bt-Y,height:Le-me}}else X={x:300+En*350,y:40,width:300,height:200},En++;const te=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:C.group.id}),width:X.width,height:X.height},{x:X.x+X.width/2,y:X.y+X.height/2},u());C.group.name&&n.updateLabel(te,C.group.name),($e=C.group.members)!=null&&$e.length&&A(te,"bwl:Members",{refs:C.group.members.join(" ")})}const _t=C=>{const M=C.waypoints;if(M!=null&&M.length){const X=M[Math.floor((M.length-1)/2)];return{x:X.x,y:X.y,width:0,height:0}}const F=C;return{x:F.x,y:F.y,width:F.width,height:F.height}};let Gn=0;const Ma={width:100,height:30};for(const C of b){const M=C.association,F=((Ob=C.placement)==null?void 0:Ob.anchor)??(M?M.source===C.annotation.id?M.target:M.source:void 0),X=F?l(F):void 0,te=X?_t(X):void 0;let Y;if(te&&C.placement){const[Le,Ae]=xd[C.placement.side],Pt=C.placement.offset??50;Y={x:te.x+te.width/2+Le*(te.width/2+Ma.width/2+Pt),y:te.y+te.height/2+Ae*(te.height/2+Ma.height/2+Pt)}}else te?(Y={x:te.x+te.width/2+180+Gn%3*260,y:te.y-110-Gn%2*95},Gn++):(Y={x:300+Gn*260,y:60},Gn++);const me=X?f(X)??u():u(),bt=n.createShape({type:"bpmn:TextAnnotation",businessObject:i.create("bpmn:TextAnnotation",{id:C.annotation.id,text:C.annotation.text})},Y,me);if(M){const Le=Ae=>Ae===C.annotation.id?bt:p(Ae);n.connect(Le(M.source),Le(M.target),M.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:M.id})}:{type:"bpmn:Association"})}C.placement&&A(bt,"bwl:Placement",I(C.placement))}for(const C of It(e,"association.add")){const M=C.association;n.connect(p(M.source),p(M.target),M.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:M.id})}:{type:"bpmn:Association"})}for(const C of It(e,"node.update")){let M=p(C.id);if(C.type&&Ga(C.type)!==M.type&&(M=c.replaceElement(M,{type:Ga(C.type)})),C.name!==void 0&&n.updateProperties(M,{name:C.name??void 0}),C.lane){const F=p(C.lane),X=F.y+F.height/2-(M.y+M.height/2);X!==0&&n.moveElements([M],{x:0,y:X})}}for(const C of It(e,"sequenceFlow.update")){const M=p(C.id);if(C.source!==void 0||C.target!==void 0){const F=M,X=C.source!==void 0?p(C.source):F.source,te=C.target!==void 0?p(C.target):F.target,Y=me=>({x:me.x+me.width/2,y:me.y+me.height/2});n.reconnect(F,X,te,[Y(X),Y(te)])}C.name!==void 0&&n.updateProperties(M,{name:C.name??void 0}),C.condition!==void 0&&n.updateProperties(M,{name:((Ib=C.condition)==null?void 0:Ib.label)??void 0})}for(const C of It(e,"messageFlow.update"))C.name!==void 0&&n.updateProperties(p(C.id),{name:C.name??void 0});for(const C of It(e,"dataStore.update"))C.name!==void 0&&n.updateProperties(p(C.id),{name:C.name??void 0});for(const C of It(e,"annotation.update")){const M=p(C.id);if(C.text!==void 0&&n.updateProperties(M,{text:C.text}),C.placement===null)A(M,"bwl:Placement",null);else if(C.placement){const F=_t(p(C.placement.anchor)),[X,te]=xd[C.placement.side],Y=C.placement.offset??50,me=F.x+F.width/2+X*(F.width/2+M.width/2+Y),bt=F.y+F.height/2+te*(F.height/2+M.height/2+Y);n.moveElements([M],{x:me-(M.x+M.width/2),y:bt-(M.y+M.height/2)}),A(M,"bwl:Placement",I(C.placement))}}for(const C of It(e,"group.update")){const M=p(C.id);if(C.name!==void 0&&n.updateLabel(M,C.name??""),C.members){const F=C.members.map(l).filter(X=>!!X);if(F.length){const te=Math.min(...F.map(Le=>Le.x))-40,Y=Math.min(...F.map(Le=>Le.y))-40,me=Math.max(...F.map(Le=>Le.x+Le.width))+40,bt=Math.max(...F.map(Le=>Le.y+Le.height))+40;n.resizeShape(M,{x:te,y:Y,width:me-te,height:bt-Y})}A(M,"bwl:Members",{refs:C.members.join(" ")})}}}function wd(e,t,n=Ed){const i=bd(e),r=_d(t,nd(i.elementRegistry)),o={edgeCrossings:{before:0,after:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Fn(i.elementRegistry),s=new Set(Oi(a).map(ki)),c=new Set(a.edges.map(d=>d.id)),u=xu(a).length,l=e.get("commandStack");try{xf(l,()=>{n(t,i),pd(i,c),cd(i,s),hd(i,s,c),gd(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=Fn(i.elementRegistry),f=Oi(p).filter(d=>!s.has(ki(d)));return{ok:!0,issues:[],findings:f,stats:{edgeCrossings:{before:u,after:xu(p).length}}}}function tE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function nE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Sd(e,t){const n=nE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Rd(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function iE(e){return typeof e=="string"&&Qc.includes(e)}function Yn(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Cd(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=Rd(q,"bwl:Placement");if(!ne)return;const ce=typeof ne.anchor=="string"?ne.anchor:void 0;if(!ce||!iE(ne.side))return;const oe=typeof ne.offset=="number"?ne.offset:void 0;m.push({owner:q.id,anchor:ce,side:ne.side,...oe!==void 0?{offset:oe}:{}})},A=q=>{const ne=Rd(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:Yn(ce.sourceRef),target:Yn(ce.targetRef)});break;case"bpmn:Group":{x(ce.id);const oe=(ne=ce.categoryValueRef)==null?void 0:ne.value;c.push({id:ce.id,...typeof oe=="string"&&oe?{name:oe}:{}}),A(ce);break}default:u.push({id:ce.id,type:ce.$type,reason:"type-outside-mvp"})}},P=(q,ne)=>{const ce=q.flowElements??[],oe=(q.laneSets??[]).flatMap(K=>K.lanes??[]),se=new Map;for(const K of oe){b(K.id);for(const N of K.flowNodeRef??[]){const B=Yn(N);B&&se.set(B,K.id)}}for(const K of ce){if(b(K.id),K.$type==="bpmn:SequenceFlow"){p.push({id:K.id,source:Yn(K.sourceRef),target:Yn(K.targetRef),...typeof K.name=="string"&&K.name?{name:K.name}:{}});continue}if(K.$type==="bpmn:DataStoreReference"){x(K.id),a.push({id:K.id,...K.name?{name:K.name}:{}});continue}const N=tE(K.$type);if(!vf(N)){u.push({id:K.id,type:K.$type,reason:"type-outside-mvp"});continue}x(K.id),o.push({id:K.id,type:N,...K.name?{name:K.name}:{},...ne?{participant:ne}:{},...se.has(K.id)?{lane:se.get(K.id)}:{}});const B=Sd(K,"bwl:band");B!==void 0&&(l.bands[K.id]=B);for(const V of K.dataOutputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:K.id,target:Yn(V.targetRef)});for(const V of K.dataInputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:Yn((V.sourceRef??[])[0]),target:K.id})}I(q.artifacts??[])};if(n){const q=new Set;for(const ne of n.participants??[]){x(ne.id);const ce=Yn(ne.processRef);ce&&q.add(ce);const oe=ce?i.get(ce):void 0,se=((oe==null?void 0:oe.laneSets)??[]).flatMap(V=>V.lanes??[]),K=se.map(V=>({id:V.id,...V.name?{name:V.name}:{}}));for(const V of K)x(V.id);const N=!oe||(oe.flowElements??[]).length===0&&se.length===0&&(oe.artifacts??[]).length===0;r.push({id:ne.id,...ne.name?{name:ne.name}:{},...N?{blackBox:!0}:{},...K.length?{lanes:K}:{}});const B=Sd(ne,"bwl:poolOrder");B!==void 0&&(l.poolOrders[ne.id]=B),oe&&P(oe,ne.id)}for(const ne of n.messageFlows??[])b(ne.id),f.push({id:ne.id,source:Yn(ne.sourceRef),target:Yn(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())P(q);const $=[],j=[],L=[],H=[],re=(q,ne)=>!!q&&!!ne&&E.has(q)&&E.has(ne);for(const q of p){if(!re(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(!re(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(!re(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}H.push({...q.id?{id:q.id}:{},source:q.source,target:q.target}),q.id&&E.add(q.id)}for(const q of d){if(!re(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 Pe=new Map(c.map(q=>[q.id,q]));for(const{owner:q,refs:ne}of g){const ce=ne.filter(se=>w.has(se)),oe=Pe.get(q);oe&&ce.length&&(oe.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}:{},...H.length?{dataAssociations:H}:{},...s.length?{annotations:s}:{},...L.length?{associations:L}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function rE(e){const{definitions:t,warnings:n}=await mu(e);return{...Cd(t),warnings:n}}function oE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Pd(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=wd(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 aE=Symbol("bpmn-editor");function sE(){const e=pt.ref(!1),t=pt.ref(!0),n=pt.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 Pd(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:gu(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 J(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function cE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ru={exports:{}},Ad;function uE(){if(Ad)return Ru.exports;Ad=1;var e=Ru.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},Ru.exports}var lE=uE(),pE=cE(lE);function Kn(e){if(!(this instanceof Kn))return new Kn(e);e=e||[128,36,1],this._seed=e.length?pE.rack(e[0],e[1],e[2]):e}Kn.prototype.next=function(e){return this._seed(e||!0)},Kn.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Kn.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Kn.prototype.assigned=function(e){return this._seed.get(e)||!1},Kn.prototype.unclaim=function(e){delete this._seed.hats[e]},Kn.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Et={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Et.td=Et.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Et.option=Et.optgroup=[1,'<select multiple="multiple">',"</select>"],Et.thead=Et.tbody=Et.colgroup=Et.caption=Et.tfoot=[1,"<table>","</table>"],Et.polyline=Et.ellipse=Et.polygon=Et.circle=Et.text=Et.line=Et.path=Et.rect=Et.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Ke(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:p}=l;return p.remove(),p}let[r,o,a]=Object.hasOwn(Et,i)?Et[i]:Et._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:l}=s;return l.remove(),l}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function fE(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 Xt(e,...t){const n=e.style;return T(t,function(i){i&&T(i,function(r,o){n[o]=r})}),e}function Gt(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const dE=Object.prototype.toString;function Je(e){return new Ii(e)}function Ii(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ii.prototype.add=function(e){return this.list.add(e),this},Ii.prototype.remove=function(e){return dE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ii.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},Ii.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ii.prototype.array=function(){return Array.from(this.list)},Ii.prototype.has=Ii.prototype.contains=function(e){return this.list.contains(e)};function Wa(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function gr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function hE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ua={},Td;function mE(){if(Td)return Ua;Td=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Ua.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Ua.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Ua}var Md=mE(),gE=hE(Md),he=fE({__proto__:null,default:gE},[Md]),kd=["focus","blur"];function vE(e,t,n,i,r){return kd.indexOf(n)!==-1&&(r=!0),he.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=gr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function yE(e,t,n,i){return kd.indexOf(t)!==-1&&(i=!0),he.unbind(e,t,n,i)}var an={bind:vE,unbind:yE};function Cu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Fe(e,t){return t=t||document,t.querySelector(e)}function qa(e,t){return t=t||document,t.querySelectorAll(e)}function Xn(e){e.parentNode&&e.parentNode.removeChild(e)}function _E(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function bE(e,t){return t.appendChild(_E(e,t))}function ve(e,t){return bE(t,e),e}var Pu=2,Dd={"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":Pu,"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":Pu,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function xE(e,t){return Dd[t]?e.style[t]:e.getAttributeNS(null,t)}function Od(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Dd[i];r?(r===Pu&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function EE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Od(e,r,t[r])}function ee(e,t,n){if(typeof t=="string")if(n!==void 0)Od(e,t,n);else return xE(e,t);else EE(e,t);return e}const wE=Object.prototype.toString;function Ce(e){return new Li(e)}function Li(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Li.prototype.add=function(e){return this.list.add(e),this},Li.prototype.remove=function(e){return wE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Li.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},Li.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Li.prototype.array=function(){return Array.from(this.list)},Li.prototype.has=Li.prototype.contains=function(e){return this.list.contains(e)};function Ya(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Id(e){return e.cloneNode(!0)}var Au={svg:"http://www.w3.org/2000/svg"},Ld='<svg xmlns="'+Au.svg+'"';function SE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Au.svg)===-1&&(e=Ld+e.substring(4)):(e=Ld+">"+e+"</svg>",t=!0);var n=RE(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function RE(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function ae(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=SE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Au.svg,e),t&&ee(n,t),n}var Tu=null;function Nd(){return Tu===null&&(Tu=ae("svg")),Tu}function Bd(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function CE(e,t,n,i,r,o){var a=Nd().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Bd(a,e);case 6:return Bd(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function To(e){return Nd().createSVGTransform()}var $d=/([&<>]{1})/g,PE=/([&<>\n\r"]{1})/g,AE={"&":"&","<":"<",">":">",'"':"'"};function Mu(e,t){function n(i,r){return AE[r]||r}return e.replace(t,n)}function jd(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Mu(e.textContent,$d));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,'="',Mu(o.value,PE),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)jd(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Mu(e.nodeValue,$d),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function TE(e){for(var t=e.firstChild,n=[];t;)jd(t,n),t=t.nextSibling;return n.join("")}function Fd(e,t){return TE(e)}function wt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function ME(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function kE(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(ME(e,i))}function Mo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),kE(n,t)),n.consolidate()}const DE=/^class[ {]/;function OE(e){return DE.test(e.toString())}function ku(e){return Array.isArray(e)}function Du(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ka(...e){e.length===1&&ku(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const IE=/constructor\s*[^(]*\(\s*([^)]*)\)/m,LE=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,NE=/\/\*([^*]*)\*\//m;function BE(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(OE(e)?IE:LE);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(NE);return(r&&r[1]||i).trim()})||[]}function Hd(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(Du(o,b))return o[b];if(Du(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(ku(b))b=Ka(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const A=(b.$inject||BE(b)).map(I=>Du(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 Ka(x=>b.get(x))}function d(b,x){if(x&&x.length){const S=Object.create(null),A=Object.create(null),I=[],P=[],$=[];let j,L,H,re;for(let Pe in r)j=r[Pe],x.indexOf(Pe)!==-1&&(j[2]==="private"?(L=I.indexOf(j[3]),L===-1?(H=j[3].createChild([],x),re=f(H),I.push(j[3]),P.push(H),$.push(re),S[Pe]=[re,Pe,"private",H]):S[Pe]=[$[L],Pe,"private",P[L]]):S[Pe]=[j[2],j[1]],A[Pe]=!0),(j[2]==="factory"||j[2]==="type")&&j[1].$scope&&x.forEach(et=>{j[1].$scope.indexOf(et)!==-1&&(S[Pe]=[j[2],j[1]],A[et]=!0)});x.forEach(Pe=>{if(!A[Pe])throw new Error('No provider for "'+Pe+'". Cannot use provider from the parent!')}),b.unshift(S)}return new Hd(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,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&(L[H]=b[H]),L),Object.create(null)),I=(S||[]).concat(A),P=d(I),$=Ka(function(L){return P.get(L)});x.forEach(function(L){r[L]=[$,L,"private",P]});const j=(b.__init__||[]).slice();return j.unshift(function(){P.init()}),b=Object.assign({},b,{__init__:j}),m(b,P)}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],P=A[1];r[S]=[h[I],$E(I,P),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 $E(e,t){return e!=="value"&&ku(t)&&(t=Ka(t.slice())),t}var jE=1e3;function pi(e,t){var n=this;t=t||jE,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)})}pi.prototype.canRender=function(e){},pi.prototype.drawShape=function(e,t){},pi.prototype.drawConnection=function(e,t){},pi.prototype.getShapePath=function(e){},pi.prototype.getConnectionPath=function(e){};function vr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function FE(e){return["M",e.x,e.y]}function Ou(e){return["L",e.x,e.y]}function HE(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function zE(e,t){const n=e.length,i=[FE(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,Iu(a.x-o.x,a.y-o.y),Iu(s.x-a.x,s.y-a.y));if(!c){i.push(Ou(a));continue}const u=Xa(a,o,c),l=Xa(a,o,c*.5),p=Xa(a,s,c),f=Xa(a,s,c*.5);i.push(Ou(u)),i.push(HE(l,f,p))}return i}function Xa(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Iu(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Iu(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ko(e,t,n){de(t)&&(n=t,t=null),t||(t={});const i=ae("path",t);return de(n)&&(i.dataset.cornerRadius=String(n)),Lu(i,e)}function Lu(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return ee(e,{d:vr(zE(t,n))}),e}function Za(e){var t=new Set(e);return we(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function yr(e,t,n){n=n||0,le(e)||(e=[e]),T(e,function(i,r){var o=t(i,r,n);le(o)&&o.length&&yr(o,t,n+1)})}function Nu(e,t,n){var i=new Set,r=new Set;return yr(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 Do(e,t){return Nu(e)}function VE(e,t,n){ur(t)&&(t=!0),At(t)&&(n=t,t=!0),n=n||{};var i=Oo(n.allShapes),r=Oo(n.allConnections),o=Oo(n.enclosedElements),a=Oo(n.enclosedConnections),s=Oo(n.topLevel,t&&$r(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,T(l.incoming,c),T(l.outgoing,c),l.children}return yr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function ft(e,t){t=!!t,le(e)||(e=[e]);var n,i,r,o;return T(e,function(a){var s=a;a.waypoints&&!t&&(s=ft(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 Vr(e,t){var n={};return T(e,function(i){var r=i;r.waypoints&&(r=ft(r)),!de(t.y)&&r.x>t.x&&(n[i.id]=i),!de(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(de(t.width)&&de(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!de(t.width)||!de(t.height))&&(n[i.id]=i)}),n}function zd(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Vd(e){return!!(e&&e.isFrame)}function Oo(e,t){return D({},e||{},t||{})}var GE=1;function Ni(e,t){pi.call(this,e,GE),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})}J(Ni,pi),Ni.prototype.canRender=function(){return!0},Ni.prototype.drawShape=function(t,n,i){var r=ae("rect");return ee(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Vd(n)?ee(r,D({},this.FRAME_STYLE,i||{})):ee(r,D({},this.SHAPE_STYLE,i||{})),ve(t,r),r},Ni.prototype.drawConnection=function(t,n,i){var r=ko(n.waypoints,D({},this.CONNECTION_STYLE,i||{}));return ve(t,r),r},Ni.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 vr(a)},Ni.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 vr(o)},Ni.$inject=["eventBus","styles"];function WE(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return D(o,{class:n})},this.style=function(n,i){!le(n)&&!i&&(i=n,n=[]);var r=on(n,function(o,a){return D(o,e[a]||{})},{});return i?D(r,i):r},this.computeStyle=function(n,i,r){return le(i)||(r=i,i=[]),t.style(i||[],D({},r,n||{}))}}const UE={__init__:["defaultRenderer"],defaultRenderer:["type",Ni],styles:["type",WE]};function st(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function lt(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 Bu(e,t){return!e||!t?-1:e.indexOf(t)}function Io(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function $u(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=Io(e,t);return Math.abs(r/o)<=i}var qE=2;function fi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(YE(r,n))return o;return!1}function YE(e,t){const n=t[0];return lr(t,function(i){return Math.abs(n[e]-i[e])<=qE})}function Gd(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 ju(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var KE=/,?([a-z]),?/gi,Wd=parseFloat,dt=Math,Bi=dt.PI,Zn=dt.min,Qn=dt.max,Ud=dt.pow,$i=dt.abs,XE=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,ZE=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,qd=Array.isArray||function(e){return e instanceof Array};function QE(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function JE(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 ew(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 QE(r,i)?(JE(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function tw(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(XE,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(ZE,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=Hu,n}function nw(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 iw(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 Hu(){return this.join(",").replace(KE,"$1")}function rw(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=Hu,t}function Yd(e,t,n,i,r,o,a,s,c){var u=1-c,l=Ud(u,3),p=Ud(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:Qa(h),y:Qa(m)}}function Kd(e){var t=lw(...e);return Fu(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function ji(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function ow(e,t){return e=Fu(e),t=Fu(t),ji(t,e.x,e.y)||ji(t,e.x2,e.y)||ji(t,e.x,e.y2)||ji(t,e.x2,e.y2)||ji(e,t.x,t.y)||ji(e,t.x2,t.y)||ji(e,t.x,t.y2)||ji(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 Xd(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 Zd(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=Xd(m,e,n,r,a),w=Xd(m,t,i,o,s),E=g*g+w*w;d+=f[h]*dt.sqrt(E)}return u*d}function aw(e,t,n,i,r,o,a,s){if(!(Qn(e,n)<Zn(r,a)||Zn(e,n)>Qn(r,a)||Qn(t,i)<Zn(o,s)||Zn(t,i)>Qn(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=Qa(c/l),f=Qa(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+Zn(e,n).toFixed(2)||d>+Qn(e,n).toFixed(2)||d<+Zn(r,a).toFixed(2)||d>+Qn(r,a).toFixed(2)||h<+Zn(t,i).toFixed(2)||h>+Qn(t,i).toFixed(2)||h<+Zn(o,s).toFixed(2)||h>+Qn(o,s).toFixed(2)))return{x:p,y:f}}}}function Qa(e){return Math.round(e*1e11)/1e11}function sw(e,t,n){var i=Kd(e),r=Kd(t);if(!ow(i,r))return[];var o=Zd(...e),a=Zd(...t),s=Jd(e)?1:~~(o/5)||1,c=Jd(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=Yd(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=Yd(...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=$i(w.x-g.x)<.01?"y":"x",S=$i(b.x-E.x)<.01?"y":"x",A=aw(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 P=g.t+$i((A[x]-g[x])/(w[x]-g[x]))*(w.t-g.t),$=E.t+$i((A[S]-E[S])/(b[S]-E[S]))*(b.t-E.t);P>=0&&P<=1&&$>=0&&$<=1&&f.push({x:A.x,y:A.y,t1:P,t2:$})}}return f}function Qd(e,t,n){e=nh(e),t=nh(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=sw(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 cw(e){return qd(e)&&qd(e[0])}function uw(e){if(nw(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=Hu,t}function Jd(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Ja(e,t,n,i){return[e,t,n,i,n,i]}function eh(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 th(e,t,n,i,r,o,a,s,c,u){var l=Bi*120/180,p=Bi/180*(+r||0),f=[],d,h=ew(function(R,_,v){var k=R*dt.cos(v)-_*dt.sin(v),O=R*dt.sin(v)+_*dt.cos(v);return{x:k,y:O}});if(u)I=u[0],P=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=dt.sqrt(w),n=w*n,i=w*i);var E=n*n,b=i*i,x=(o==a?-1:1)*dt.sqrt($i((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=dt.asin(((t-A)/i).toFixed(9)),P=dt.asin(((c-A)/i).toFixed(9));I=e<S?Bi-I:I,P=s<S?Bi-P:P,I<0&&(I=Bi*2+I),P<0&&(P=Bi*2+P),a&&I>P&&(I=I-Bi*2),!a&&P>I&&(P=P-Bi*2)}var $=P-I;if($i($)>l){var j=P,L=s,H=c;P=I+l*(a&&P>I?1:-1),s=S+n*dt.cos(P),c=A+i*dt.sin(P),f=th(s,c,n,i,r,0,a,L,H,[P,j,S,A])}$=P-I;var re=dt.cos(I),Pe=dt.sin(I),et=dt.cos(P),q=dt.sin(P),ne=dt.tan($/4),ce=4/3*n*ne,oe=4/3*i*ne,se=[e,t],K=[e+ce*Pe,t-oe*re],N=[s+ce*q,c-oe*et],B=[s,c];if(K[0]=2*se[0]-K[0],K[1]=2*se[1]-K[1],u)return[K,N,B].concat(f);f=[K,N,B].concat(f).join().split(",");for(var V=[],xe=0,Ct=f.length;xe<Ct;xe++)V[xe]=xe%2?h(f[xe-1],f[xe],p).y:h(f[xe],f[xe+1],p).x;return V}function lw(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),$i(l)<1e-12){if($i(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*l,w=dt.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:Zn(...u[0]),y0:Zn(...u[1]),x1:Qn(...u[0]),y1:Qn(...u[1])}}function nh(e){if(cw(e)||(e=tw(e)),iw(e))return e;for(var t=rw(uw(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",...th(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",...eh(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",...eh(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Ja(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Ja(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Ja(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Ja(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=Wd(l[p-4])||n.x,n.by=Wd(l[p-3])||n.y}return t}function Ve(e){return At(e)&&rn(e,"waypoints")}function be(e){return At(e)&&rn(e,"labelTarget")}function pw(e){return At(e)&&Nr(e.parent)}function ih(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function di(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 es(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function fw(e){return di({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function dw(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=gw(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 pe(e){return Ve(e)?dw(e):fw(e)}function Lt(e,t,n){n=n||0,At(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 Lo(e,t,n){var i=hw(e,t);return i.length===1||i.length===2&&Io(i[0],i[1])<1?di(i[0]):i.length>1?(i=Wn(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),di(i[n?0:i.length-1])):null}function hw(e,t){return Qd(e,t)}function mw(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Io(n,r)===0||$u(i,r,n)?e.splice(t,1):t++;return e}function gw(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ts(e,t){return Math.round(e*t)/t}function rh(e){return de(e)?e+"px":e}function vw(e){for(;e.parent;)e=e.parent;return e}function yw(e){e=D({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Xt(n,{position:"relative",overflow:"hidden",width:rh(e.width),height:rh(e.height)}),t.appendChild(n),n}function oh(e,t,n){const i=ae("g");Ce(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const _w="base",ah=0,bw=1,xw={shape:["x","y","width","height"],connection:["waypoints"]};function fe(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||{})}fe.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],fe.prototype._init=function(e){const t=this._eventBus,n=this._container=yw(e),i=this._svg=ae("svg");ee(i,{width:"100%",height:"100%"}),Gt(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")}),ve(n,i);const r=this._viewport=oh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=nu(this._viewboxChanged,300)),this._restoreFocus=nu(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)},fe.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},fe.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},fe.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=zd(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},fe.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},fe.prototype.restoreFocus=function(){this._restoreFocus()},fe.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},fe.prototype.isFocused=function(){return this._focused},fe.prototype.getDefaultLayer=function(){return this.getLayer(_w,ah)},fe.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},fe.prototype._getChildIndex=function(e){return on(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},fe.prototype._createLayer=function(e,t){typeof t>"u"&&(t=bw);const n=this._getChildIndex(t);return{group:oh(this._viewport,"layer-"+e,n),index:t,visible:!0}},fe.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},fe.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&&(wt(n),t.visible=!1),n},fe.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],wt(t.group))},fe.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},fe.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(vw(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},fe.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},fe.prototype._findPlaneForRoot=function(e){return qe(this._planes,function(t){return t.rootElement===e})},fe.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},fe.prototype._resolveElements=function(e){return le(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},fe.prototype.getContainer=function(){return this._container},fe.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&&(T([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Ce(r).add(t)):(e.markers.delete(t),Ce(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},fe.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},fe.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},fe.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},fe.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},fe.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},fe.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,ah);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},fe.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},fe.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},fe.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)},fe.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})},fe.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})},fe.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=xw[e];if(!lr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},fe.prototype._setParent=function(e,t,n){lt(t.children,e,n),e.parent=t},fe.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},fe.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},fe.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},fe.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),st(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},fe.prototype.removeShape=function(e){return this._removeElement(e,"shape")},fe.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},fe.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},fe.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},fe.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},fe.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);Mo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Mo(t),r=a?a.matrix:CE(),s=ts(r.a,1e3),c=ts(-r.e||0,1e3),u=ts(-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},fe.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=D({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),sh(t,n)}),{x:n.e,y:n.f}},fe.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=ft(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})},fe.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)}),ts(i.a,1e3)};function sh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}fe.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},fe.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const p=c.a;return t?(a=D(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),sh(this._viewport,l),l},fe.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},fe.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}},fe.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Gr="data-element-id";function yn(e){this._elements={},this._eventBus=e}yn.$inject=["eventBus"],yn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),ee(t,Gr,i),n&&ee(n,Gr,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},yn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(ee(i.gfx,Gr,""),i.secondaryGfx&&ee(i.secondaryGfx,Gr,""),delete t[n])},yn.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)},yn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&ee(t,Gr,i),t},yn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&ee(e,Gr);var n=this._elements[t];return n&&n.element},yn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},yn.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}},yn.prototype.getAll=function(){return this.filter(function(e){return e})},yn.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)})},yn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},yn.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 Ew(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 ww(e){return e.__refs_collection===!0}function Sw(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function ch(e,t,n){var i=Ew(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 Rw(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 Sn(e,t){if(!(this instanceof Sn))return new Sn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Sn.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?ch(this,t,e):Rw(this,t,e)},Sn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return ww(n)||ch(this,t,e),n},Sn.prototype.ensureBound=function(e,t){Sw(e,t)||this.bind(e,t)},Sn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Sn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var zu=new Sn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),uh=new Sn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),lh=new Sn({name:"attachers",collection:!0},{name:"host"}),ph=new Sn({name:"outgoing",collection:!0},{name:"source"}),fh=new Sn({name:"incoming",collection:!0},{name:"target"});function Wr(){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)}}),zu.bind(this,"parent"),uh.bind(this,"labels"),ph.bind(this,"outgoing"),fh.bind(this,"incoming")}function No(){Wr.call(this),zu.bind(this,"children"),lh.bind(this,"host"),lh.bind(this,"attachers")}J(No,Wr);function dh(){Wr.call(this),zu.bind(this,"children")}J(dh,No);function hh(){No.call(this),uh.bind(this,"labelTarget")}J(hh,No);function mh(){Wr.call(this),ph.bind(this,"source"),fh.bind(this,"target")}J(mh,Wr);var Cw={connection:mh,shape:No,label:hh,root:dh};function Pw(e,t){var n=Cw[e];if(!n)throw new Error("unknown type: <"+e+">");return D(new n,t)}function Aw(e){return e instanceof Wr}function hi(){this._uid=12}hi.prototype.createRoot=function(e){return this.create("root",e)},hi.prototype.createLabel=function(e){return this.create("label",e)},hi.prototype.createShape=function(e){return this.create("shape",e)},hi.prototype.createConnection=function(e){return this.create("connection",e)},hi.prototype.create=function(e,t){return t=D({},t||{}),t.id||(t.id=e+"_"+this._uid++),Pw(e,t)};var ns="__fn",gh=1e3,Tw=Array.prototype.slice;function sn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}sn.prototype.on=function(e,t,n,i){if(e=le(e)?e:[e],Tt(t)&&(i=n,n=t,t=gh),!de(t))throw new Error("priority must be a number");var r=n;i&&(r=Jt(n,i),r[ns]=n[ns]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},sn.prototype.once=function(e,t,n,i){var r=this;if(Tt(t)&&(i=n,n=t,t=gh),!de(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[ns]=n,this.on(e,t,o)},sn.prototype.off=function(e,t){e=le(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},sn.prototype.createEvent=function(e){var t=new Bo;return t.init(e),t},sn.prototype.fire=function(e,t){var n,i,r,o;if(o=Tw.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 Bo?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}},sn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},sn.prototype._destroy=function(){this._listeners={}},sn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},sn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=Mw(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},sn.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},sn.prototype._getListeners=function(e){return this._listeners[e]},sn.prototype._setListeners=function(e,t){this._listeners[e]=t},sn.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[ns]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Bo(){}Bo.prototype.stopPropagation=function(){this.cancelBubble=!0},Bo.prototype.preventDefault=function(){this.defaultPrevented=!0},Bo.prototype.init=function(e){D(this,e||{})};function Mw(e,t){return e.apply(null,t)}function _r(e){return e.childNodes[0]}function kw(e){return e.parentNode.childNodes[1]}function is(e,t,n,i,r){var o=To();o.setTranslate(t,n);var a=To();a.setRotate(i||0,0,0);var s=To();s.setScale(1,1),Mo(e,[o,a,s])}function Nt(e,t,n){var i=To();i.setTranslate(t,n),Mo(e,i)}function vh(e,t){var n=To();n.setRotate(t,0,0),Mo(e,n)}function _n(e,t){this._eventBus=e,this._elementRegistry=t}_n.$inject=["eventBus","elementRegistry"],_n.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=kw(t),n||(n=ae("g"),Ce(n).add("djs-children"),ve(t.parentNode,n))):n=t,n},_n.prototype._clear=function(e){var t=_r(e);return Wa(t),t},_n.prototype._createContainer=function(e,t,n,i){var r=ae("g");Ce(r).add("djs-group"),typeof n<"u"?Dw(r,t,t.childNodes[n]):ve(t,r);var o=ae("g");Ce(o).add("djs-element"),Ce(o).add("djs-"+e),i&&Ce(o).add("djs-frame"),ve(r,o);var a=ae("g");return Ce(a).add("djs-visual"),ve(o,a),o},_n.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Vd(t))},_n.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=on(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),T(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;T(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},_n.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},_n.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},_n.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},_n.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},_n.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Nt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?ee(n,"display","none"):ee(n,"display","block")}},_n.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);wt(t.parentNode)};function Dw(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const Ow={__depends__:[UE],__init__:["canvas"],canvas:["type",fe],elementRegistry:["type",yn],elementFactory:["type",hi],eventBus:["type",sn],graphicsFactory:["type",_n]};function Iw(e){var t=new Hd(e);return t.init(),t}function Lw(e){e=e||{};var t={config:["value",e]},n=[t,Ow].concat(e.modules||[]);return Iw(n)}function Fi(e,t){this._injector=t||Lw(e),this.get("eventBus").fire("diagram.init")}Fi.prototype.get=function(e,t){return this._injector.get(e,t)},Fi.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Fi.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Fi.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Wt(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function en(e,t){return e.$instanceOf(t)}function Nw(e){return qe(e.rootElements,function(t){return en(t,"bpmn:Process")||en(t,"bpmn:Collaboration")})}function Bw(e){var t={},n=[],i={};function r(N,B){return function(V){N(V,B)}}function o(N){t[N.id]=N}function a(N){return t[N.id]}function s(N,B){var V=N.gfx;if(V)throw new Error(`already rendered ${Wt(N)}`);return e.element(N,i[N.id],B)}function c(N,B){return e.root(N,i[N.id],B)}function u(N,B){try{var V=i[N.id]&&s(N,B);return o(N),V}catch(xe){l(xe.message,{element:N,error:xe}),console.error(`failed to import ${Wt(N)}`,xe)}}function l(N,B){e.error(N,B)}var p=this.registerDi=function(B){var V=B.bpmnElement;V?i[V.id]?l(`multiple DI elements defined for ${Wt(V)}`,{element:V}):i[V.id]=B:l(`no bpmnElement referenced in ${Wt(B)}`,{element:B})};function f(N){d(N.plane)}function d(N){p(N),T(N.planeElement,h)}function h(N){p(N)}this.handleDefinitions=function(B,V){var xe=B.diagrams;if(V&&xe.indexOf(V)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!V&&xe&&xe.length&&(V=xe[0]),!V)throw new Error("no diagram to display");i={},f(V);var Ct=V.plane;if(!Ct)throw new Error(`no plane for ${Wt(V)}`);var R=Ct.bpmnElement;if(!R)if(R=Nw(B),R)l(`correcting missing bpmnElement on ${Wt(Ct)} to ${Wt(R)}`),Ct.bpmnElement=R,p(Ct);else throw new Error("no process or collaboration to display");var _=c(R,Ct);if(en(R,"bpmn:Process")||en(R,"bpmn:SubProcess"))g(R,_);else if(en(R,"bpmn:Collaboration"))se(R,_),w(B.rootElements,_);else throw new Error(`unsupported bpmnElement for ${Wt(Ct)}: ${Wt(R)}`);m(n)};var m=this.handleDeferred=function(){for(var B;n.length;)B=n.shift(),B()};function g(N,B){ne(N,B),$(N.ioSpecification,B),P(N.artifacts,B),o(N)}function w(N,B){var V=we(N,function(xe){return!a(xe)&&en(xe,"bpmn:Process")&&xe.laneSets});V.forEach(r(g,B))}function E(N,B){u(N,B)}function b(N,B){T(N,r(E,B))}function x(N,B){u(N,B)}function S(N,B){u(N,B)}function A(N,B){u(N,B)}function I(N,B){u(N,B)}function P(N,B){T(N,function(V){en(V,"bpmn:Association")?n.push(function(){I(V,B)}):I(V,B)})}function $(N,B){N&&(T(N.dataInputs,r(S,B)),T(N.dataOutputs,r(A,B)))}var j=this.handleSubProcess=function(B,V){ne(B,V),P(B.artifacts,V)};function L(N,B){var V=u(N,B);en(N,"bpmn:SubProcess")&&j(N,V||B),en(N,"bpmn:Activity")&&$(N.ioSpecification,B),n.push(function(){T(N.dataInputAssociations,r(x,B)),T(N.dataOutputAssociations,r(x,B))})}function H(N,B){u(N,B)}function re(N,B){u(N,B)}function Pe(N,B){n.push(function(){var V=u(N,B);N.childLaneSet&&et(N.childLaneSet,V||B),K(N)})}function et(N,B){T(N.lanes,r(Pe,B))}function q(N,B){T(N,r(et,B))}function ne(N,B){ce(N.flowElements,B),N.laneSets&&q(N.laneSets,B)}function ce(N,B){T(N,function(V){en(V,"bpmn:SequenceFlow")?n.push(function(){H(V,B)}):en(V,"bpmn:BoundaryEvent")?n.unshift(function(){L(V,B)}):en(V,"bpmn:FlowNode")?L(V,B):en(V,"bpmn:DataObject")||(en(V,"bpmn:DataStoreReference")||en(V,"bpmn:DataObjectReference")?re(V,B):l(`unrecognized flowElement ${Wt(V)} in context ${Wt(B&&B.businessObject)}`,{element:V,context:B}))})}function oe(N,B){var V=u(N,B),xe=N.processRef;xe&&g(xe,V||B)}function se(N,B){T(N.participants,r(oe,B)),n.push(function(){b(N.messageFlows,B)}),P(N.artifacts,B)}function K(N){T(N.flowNodeRef,function(B){var V=B.get("lanes");V&&V.push(N)})}}function y(e,t){var n=U(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Ee(e,t){return Pi(t,function(n){return y(e,n)})}function U(e){return e&&e.businessObject||e}function Me(e){return e&&e.di}function $w(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 Bw(p);l=l||u.diagrams&&u.diagrams[0];var d=jw(u,l);if(!d)throw new Error("no diagram to display");T(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 jw(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!y(n,"bpmn:Process")&&!y(n,"bpmn:Collaboration")&&(i=Fw(n));var r;y(i,"bpmn:Collaboration")?r=i:r=qe(e.rootElements,function(u){if(y(u,"bpmn:Collaboration"))return qe(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=Ht(r.participants,function(u){return u.processRef}),o.push(r));var a=yh(o),s=[t],c=[n];return T(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 yh(e){var t=[];return T(e,function(n){n&&(t.push(n),t=t.concat(yh(n.flowElements)))}),t}function Fw(e){for(var t=e;t;){if(y(t,"bpmn:Process"))return t;t=t.$parent}}var Hw='<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>',_h=Hw,bh={verticalAlign:"middle"},xh={color:"#404040"},zw={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},Vw={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},Gw={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"},Ww='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+_h+'</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>',Jn;function Uw(){Jn=Ke(Ww),Xt(Jn,zw),Xt(Fe("svg",Jn),bh),Xt(Fe(".backdrop",Jn),Vw),Xt(Fe(".notice",Jn),Gw),Xt(Fe(".link",Jn),xh,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function qw(){Jn||(Uw(),an.bind(Jn,".backdrop","click",function(e){document.body.removeChild(Jn)})),document.body.appendChild(Jn)}const rs=5,Eh="djs-outline-hidden";function tt(e){e=D({},Kw,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),Zw(this._container)}J(tt,Fi),tt.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||[]),os(s,o),s=Yw(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},tt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},tt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw os(o,[]),o}if(typeof t=="string"&&(i=Xw(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw os(o,[]),o}try{this.clear()}catch(o){throw os(o,[]),o}const{warnings:r}=await $w(this,n,i);return{warnings:r}},tt.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},tt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=Fe(":scope > defs",i._svg),a=Fd(r),s=o?"<defs>"+Fd(o)+"</defs>":"",c=i.getContainer();Je(c).add(Eh);let u;try{u=r.getBBox()}finally{Je(c).remove(Eh)}const l=u.x-rs,p=u.y-rs,f=u.width+rs*2,d=u.height+rs*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
1
|
+
(function(Q,lt){typeof exports=="object"&&typeof module<"u"?lt(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],lt):(Q=typeof globalThis<"u"?globalThis:Q||self,lt(Q.BpmnModeler={},Q.Vue))})(this,(function(Q,lt){"use strict";var iD=Object.defineProperty;var rD=(Q,lt,ci)=>lt in Q?iD(Q,lt,{enumerable:!0,configurable:!0,writable:!0,value:ci}):Q[lt]=ci;var Lr=(Q,lt,ci)=>rD(Q,typeof lt!="symbol"?lt+"":lt,ci);const ci=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function yf(e){return ci.includes(e)}const _f="http://g1project.net/spec/bpmn/bwl/1.0",eu="bwl",tu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],bf={name:"bwl-hints",uri:_f,prefix:eu,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"}]}]},nu="bwl.undoEpisode",xf=new WeakSet;function Vb(e){xf.has(e)||(e.register(nu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),xf.add(e))}function Ef(e,t){Vb(e);const n={run:t};if(e.execute(nu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const wf=["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"],Gb={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},Wb={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Ub={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},qb={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다.",properties:{id:{type:"string"},type:{type:"string",enum:[...ci]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},Yb={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},Kb={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},Xb={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Zb={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Qb={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Jb={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},e0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},t0={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},n0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...tu]},offset:{type:"number"}},required:["anchor","side"],additionalProperties:!1};function Ft(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const i0={"participant.add":Ft("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트(생략 시 op 순서가 곧 배치 순서).",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Ft("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":Ft("node.add",{description:"플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 보조 스트랜드 1…). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.",properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer"}},required:["node"]}),"node.update":Ft("node.update",{description:"노드 이름/레인/타입 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...ci]}},required:["id"]}),"sequenceFlow.add":Ft("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Ft("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":Ft("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Ft("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":Ft("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Ft("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":Ft("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Ft("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Ft("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Ft("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":Ft("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Ft("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":Ft("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Sf={anyOf:wf.map(e=>i0[e])},r0={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:Wb,irParticipant:Ub,irNode:qb,irFlowCondition:Yb,irSequenceFlow:Kb,irMessageFlow:Xb,irDataStore:Zb,irDataAssociation:Qb,irTextAnnotation:Jb,irAssociation:e0,irGroup:t0,bwlPlacement:n0,nullableString:Gb,symbolicOp:Sf}};function iu(e){return Array.prototype.concat.apply([],e)}const So=Object.prototype.toString,o0=Object.prototype.hasOwnProperty;function lr(e){return e===void 0}function xt(e){return e!==void 0}function Nr(e){return e==null}function pe(e){return So.call(e)==="[object Array]"}function At(e){return So.call(e)==="[object Object]"}function he(e){return So.call(e)==="[object Number]"}function Tt(e){const t=So.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function on(e){return So.call(e)==="[object String]"}function a0(e){if(!pe(e))throw new Error("must supply array")}function an(e,t){return!Nr(e)&&o0.call(e,t)}function qe(e,t){const n=Da(t);let i;return M(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Rf(e,t){const n=Da(t);let i=pe(e)?-1:void 0;return M(e,function(r,o){if(n(r,o))return i=o,!1}),i}function we(e,t){const n=Da(t);let i=[];return M(e,function(r,o){n(r,o)&&i.push(r)}),i}function M(e,t){let n,i;if(lr(e))return;const r=pe(e)?p0:l0;for(let o in e)if(an(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function s0(e,t){if(lr(e))return[];a0(e);const n=Da(t);return e.filter(function(i,r){return!n(i,r)})}function sn(e,t,n){return M(e,function(i,r){n=t(n,i,r)}),n}function pr(e,t){return!!sn(e,function(n,i,r){return n&&t(i,r)},!0)}function Pi(e,t){return!!qe(e,t)}function Ht(e,t){let n=[];return M(e,function(i,r){n.push(t(i,r))}),n}function ka(e){return e&&Object.keys(e)||[]}function c0(e){return ka(e).length}function Br(e){return Ht(e,t=>t)}function $r(e,t,n={}){return t=ru(t),M(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Cf(e,...t){e=ru(e);let n={};return M(t,r=>$r(r,e,n)),Ht(n,function(r,o){return r[0]})}const u0=Cf;function Gn(e,t){t=ru(t);let n=[];return M(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)}),Ht(n,i=>i.v)}function jr(e){return function(t){return pr(e,function(n,i){return t[i]===n})}}function ru(e){return Tt(e)?e:t=>t[e]}function Da(e){return Tt(e)?e:t=>t===e}function l0(e){return e}function p0(e){return Number(e)}function ou(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 en(e,t){return e.bind(t)}function D(e,...t){return Object.assign(e,...t)}function f0(e,t,n){let i=e;return M(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];xt(a)&&Nr(s)&&(s=i[r]=isNaN(+a)?{}:[]),lr(a)?lr(n)?delete i[r]:i[r]=n:i=s}),e}function jn(e,t){let n={},i=Object(e);return M(t,function(r){r in i&&(n[r]=e[r])}),n}function Wn(e,t){let n={},i=Object(e);return M(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function au(){}au.prototype.get=function(e){return this.$model.properties.get(this,e)},au.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Pf(e,t){this.model=e,this.properties=t}Pf.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(au.prototype);M(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}),M(a,en(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 d0=D(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Af=D(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function su(e,t){var n=Af[e];return n?n(t):t}function cu(e){return!!d0[e]}function Tf(e){return!!Af[e]}function zt(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 yn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}yn.prototype.build=function(){return jn(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},yn.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)},yn.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},yn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=zt(r[0],i),a=zt(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},yn.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},yn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},yn.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},yn.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},yn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},yn.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")},yn.prototype.hasProperty=function(e){return this.propertiesByName[e]},yn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(M(e.properties,en(function(o){o=D({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Ai(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,M(e,en(this.registerPackage,this))}Ai.prototype.getPackage=function(e){return this.packageMap[e]},Ai.prototype.getPackages=function(){return this.packages},Ai.prototype.registerPackage=function(e){e=D({},e);var t=this.packageMap;Mf(t,e,"prefix"),Mf(t,e,"uri"),M(e.types,en(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Ai.prototype.registerType=function(e,t){e=D({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:D({},e.meta||{})});var n=zt(e.name,t.prefix),i=n.name,r=Object.create(null);M(e.properties,en(function(o){var a=zt(o.name,n.prefix),s=a.name;cu(o.type)||(o.type=zt(o.type,a.prefix).name),D(o,{ns:a,name:s}),r[s]=o},this)),D(e,{ns:n,name:i,propertiesByName:r}),M(e.extends,en(function(o){var a=zt(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},Ai.prototype.mapTypes=function(e,t,n){var i=cu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=zt(c,cu(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+">");M(i.superClass,n?a:s),t(i,!n),M(i.traits,a)},Ai.prototype.getEffectiveDescriptor=function(e){var t=zt(e),n=new yn(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},Ai.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Mf(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function fr(e){this.model=e}fr.prototype.set=function(e,t,n){if(!on(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;h0(n)?i?delete e[r]:delete e.$attrs[uu(t)]:i?r in e?e[r]=n:kf(e,i,n):e.$attrs[uu(t)]=n},fr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[uu(t)];var i=n.name;return!e[i]&&n.isMany&&kf(e,n,[]),e[i]},fr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=D({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},fr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},fr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},fr.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 h0(e){return typeof e>"u"}function kf(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function uu(e){return e.replace(/^:/,"")}function wn(e,t={}){this.properties=new fr(this),this.factory=new Pf(this,this.properties),this.registry=new Ai(e,this.properties),this.typeCache=Object.create(null),this.config=t}wn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},wn.prototype.getType=function(e){var t=this.typeCache,n=on(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},wn.prototype.createAny=function(e,t,n){var i=zt(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){f0(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}),M(n,function(a,s){At(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},wn.prototype.getPackage=function(e){return this.registry.getPackage(e)},wn.prototype.getPackages=function(){return this.registry.getPackages()},wn.prototype.getElementDescriptor=function(e){return e.$descriptor},wn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},wn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},wn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Df=String.fromCharCode,m0=Object.prototype.hasOwnProperty,g0=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Ro={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Ro).forEach(function(e){Ro[e.toUpperCase()]=Ro[e]});function v0(e,t,n,i){return i?m0.call(Ro,i)?Ro[i]:"&"+i+";":Df(t||parseInt(n,16))}function dr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(g0,v0):e}var Of="non-whitespace outside of root node";function Ti(e){return new Error(e)}function y0(e){return"missing namespace for prefix <"+e+">"}function Oa(e){return{get:e,enumerable:!0}}function _0(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var If=Symbol("nameCache");function lu(e){return e+"$uri"}function b0(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[lu(i)]=n;return t}function Ia(){return{line:0,column:0}}function x0(e){throw e}function Lf(e){if(!this)return new Lf(e);var t=e&&e.proxy,n,i,r,o,a=x0,s,c,u,l,p=Ia,f=!1,d=!1,h="",m=!1,g=!1,S=null,E=!1,b,x,w,A;function I(L){L instanceof Error||(L=Ti(L)),S=L,a(L,p)}function P(L){s&&(L instanceof Error||(L=Ti(L)),s(L,p))}this.on=function(L,H){if(typeof H!="function")throw Ti("required args <name, cb>");switch(L){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":r=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":o=H;break;case"attention":l=H;break;case"question":u=H;break;case"comment":c=H;break;default:throw Ti("unsupported event: "+L)}return this},this.ns=function(L){if(typeof L>"u"&&(L={}),typeof L!="object")throw Ti("required args <nsMap={}>");var H=Object.create(null),re;for(re in L)H[re]=L[re];return g=!0,A=H,this};function j(){b=g?[]:null,x=g?b0(A):null,w=[],p=Ia,E=!1,S=null,d=!1,h=""}this.parse=function(L){if(typeof L!="string")throw Ti("required args <xml=string>");if(f)throw Ti("parse during stream; call end() first");return j(),F(L),p=Ia,E=!1,S},this.write=function(L){if(typeof L!="string")throw Ti("required args <xml=string>");return f||(j(),f=!0),S||(h=F(h+L,!0)||""),this},this.end=function(){return f||j(),f=!1,S||F(h),h="",p=Ia,E=!1,S},this.stop=function(){E=!0};function F(L,H=!1){var re=null,Pe=null,et,q=0,ie=!1,ce=!1,oe=0,se=0,X,N,B,V,xe,Ct,C,_,v,k="",O=0,z;function ne($e,vt){var jt=$e.indexOf(":");if(jt===-1)return $e;var qt=x[$e.substring(0,jt)];return qt?vt===qt?$e.substr(jt+1):qt+$e.substr(jt):(P(y0($e.substring(0,jt))),null)}function _e(){if(z!==null)return z;var $e,vt,jt=g&&x.xmlns,qt=g&&m?[]:null,Ye=O,yt=k,Dt=yt.length,cr,En,Vn,Qt,_t,Or={},Zc=new Set,rn,De,je;e:for(;Ye<Dt;Ye++)if(rn=!1,De=yt.charCodeAt(Ye),!(De===32||De<14&&De>8)){for((De<65||De>122||De>90&&De<97)&&De!==95&&De!==58&&(P("illegal first char attribute name"),rn=!0),je=Ye+1;je<Dt;je++)if(De=yt.charCodeAt(je),!(De>96&&De<123||De>64&&De<91||De>47&&De<59||De===46||De===45||De===95)){if(De===32||De<14&&De>8){P("missing attribute value"),Ye=je;continue e}if(De===61)break;P("illegal attribute name char"),rn=!0}if(_t=yt.substring(Ye,je),_t==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),rn=!0),De=yt.charCodeAt(je+1),De===34)je=yt.indexOf('"',Ye=je+2),je===-1&&(je=yt.indexOf("'",Ye),je!==-1&&(P("attribute value quote missmatch"),rn=!0));else if(De===39)je=yt.indexOf("'",Ye=je+2),je===-1&&(je=yt.indexOf('"',Ye),je!==-1&&(P("attribute value quote missmatch"),rn=!0));else for(P("missing attribute value quotes"),rn=!0,je=je+1;je<Dt&&(De=yt.charCodeAt(je+1),!(De===32||De<14&&De>8));je++);for(je===-1&&(P("missing closing quotes"),je=Dt,rn=!0),rn||(Vn=yt.substring(Ye,je)),Ye=je;je+1<Dt&&(De=yt.charCodeAt(je+1),!(De===32||De<14&&De>8));je++)Ye===je&&(P("illegal character after attribute end"),rn=!0);if(Ye=je+1,rn)continue e;if(Zc.has(_t)){P("attribute <"+_t+"> already defined");continue}if(Zc.add(_t),!g){Or[_t]=Vn;continue}if(m){if(En=_t==="xmlns"?"xmlns":_t.charCodeAt(0)===120&&_t.substr(0,6)==="xmlns:"?_t.substr(6):null,En!==null){if($e=dr(Vn),vt=lu(En),Qt=A[$e],!Qt){if(En==="xmlns"||vt in x&&x[vt]!==$e)do Qt="ns"+q++;while(typeof x[Qt]<"u");else Qt=En;A[$e]=Qt}x[En]!==Qt&&(cr||(x=_0(x),cr=!0),x[En]=Qt,En==="xmlns"&&(x[lu(Qt)]=$e,jt=Qt),x[vt]=$e),Or[_t]=Vn;continue}qt.push(_t,Vn);continue}_t=ne(_t,jt),_t!==null&&(Or[_t]=Vn)}if(m)for(Ye=0,Dt=qt.length;Ye<Dt;Ye++)_t=ne(qt[Ye++],jt),Vn=qt[Ye],_t!==null&&(Or[_t]=Vn);return z=Or}function Ie(){for(var $e=/(\r\n|\r|\n)/g,vt=0,jt=0,qt=0,Ye=se,yt,Dt;oe>=qt&&(yt=$e.exec(L),!(!yt||(Ye=yt[0].length+yt.index,Ye>oe)));)vt+=1,qt=Ye;return oe==-1?(jt=Ye,Dt=L.substring(se)):se===0?Dt=L.substring(se,oe):(jt=oe-qt,Dt=se==-1?L.substring(oe):L.substring(oe,se+1)),{data:Dt,line:vt,column:jt}}for(p=Ie,t&&(v=Object.create({},{name:Oa(function(){return C}),originalName:Oa(function(){return _}),attrs:Oa(_e),ns:Oa(function(){return x})}));se!==-1;){if(L.charCodeAt(se)===60?oe=se:oe=L.indexOf("<",se),oe===-1){if(H)return L.substring(se);if(w.length)return I("unexpected end of file");if(!d)return I("missing start tag");se<L.length&&L.substring(se).trim()&&P(Of);return}if(d||(d=!0),se!==oe){if(w.length){if(n&&(n(L.substring(se,oe),dr,p),E))return}else if(L.substring(se,oe).trim()&&(P(Of),E))return}if(V=L.charCodeAt(oe+1),V===33){if(B=L.charCodeAt(oe+2),B===91&&L.substr(oe+3,6)==="CDATA["){if(se=L.indexOf("]]>",oe),se===-1)return H?L.substring(oe):I("unclosed cdata");if(o&&(o(L.substring(oe+9,se),p),E))return;se+=3;continue}if(B===45&&L.charCodeAt(oe+3)===45){if(se=L.indexOf("-->",oe),se===-1)return H?L.substring(oe):I("unclosed comment");if(c&&(c(L.substring(oe+4,se),dr,p),E))return;se+=3;continue}}if(V===63){if(se=L.indexOf("?>",oe),se===-1)return H?L.substring(oe):I("unclosed question");if(u&&(u(L.substring(oe,se+2),p),E))return;se+=2;continue}for(X=oe+1;;X++){if(xe=L.charCodeAt(X),isNaN(xe))return H?L.substring(oe):(se=-1,I("unclosed tag"));if(xe===34)B=L.indexOf('"',X+1),X=B!==-1?B:X;else if(xe===39)B=L.indexOf("'",X+1),X=B!==-1?B:X;else if(xe===62){se=X;break}}if(V===33){if(l&&(l(L.substring(oe,se+1),dr,p),E))return;se+=1;continue}if(z={},V===47){if(ie=!1,ce=!0,!w.length)return I("missing open tag");if(X=C=w.pop(),B=oe+2+X.length,L.substring(oe+2,B)!==X)return I("closing tag mismatch");for(;B<se;B++)if(V=L.charCodeAt(B),!(V===32||V>8&&V<14))return I("close tag")}else{if(L.charCodeAt(se-1)===47?(X=C=L.substring(oe+1,se-1),ie=!0,ce=!0):(X=C=L.substring(oe+1,se),ie=!0,ce=!1),!(V>96&&V<123||V>64&&V<91||V===95||V===58))return I("illegal first char nodeName");for(B=1,N=X.length;B<N;B++)if(V=X.charCodeAt(B),!(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){C=X.substring(0,B),z=null;break}return I("invalid nodeName")}ce||w.push(C)}if(g){et=x,ie&&(ce||b.push(et),z===null&&(m=X.indexOf("xmlns",B)!==-1)&&(O=B,k=X,_e(),m=!1)),_=C,Pe!==x&&(re=x[If],re===void 0&&(re=x[If]=Object.create(null)),Pe=x);var ut=re[C];if(ut!==void 0)C=ut;else{if(V=C.indexOf(":"),V!==-1){if(Ct=x[C.substring(0,V)],!Ct)return I("missing namespace on <"+_+">");C=C.substr(V+1)}else Ct=x.xmlns;Ct&&(C=Ct+":"+C),re[_]=C}}if(ie&&(O=B,k=X,i&&(t?i(v,dr,ce,p):i(C,_e,dr,ce,p),E)))return;if(ce){if(r&&(r(t?v:C,dr,ie,p),E))return;g&&(ie?x=et:x=b.pop())}se+=1}}}function Nf(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var pu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Bf="property";function $f(e){return e.xml&&e.xml.serialize}function E0(e){const t=$f(e);return t!==Bf&&(t||null)}function w0(e){return e.charAt(0).toUpperCase()+e.slice(1)}function jf(e,t){return Nf(t)?e.prefix+":"+w0(e.localName):e.name}function S0(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 R0(e,t,n){const i=zt(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=zt(r);var a=n.getPackage(o.prefix);return S0(o,a)}function Mi(e){return new Error(e)}function ui(e){return e.$descriptor}function C0(e){D(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Mi("expected element");var n=this.elementsById,i=ui(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 Mi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Co(){}Co.prototype.handleEnd=function(){},Co.prototype.handleText=function(){},Co.prototype.handleNode=function(){};function fu(){}fu.prototype=Object.create(Co.prototype),fu.prototype.handleNode=function(){return this};function Fr(){}Fr.prototype=Object.create(Co.prototype),Fr.prototype.handleText=function(e){this.body=(this.body||"")+e};function Po(e,t){this.property=e,this.context=t}Po.prototype=Object.create(Fr.prototype),Po.prototype.handleNode=function(e){if(this.element)throw Mi("expected no sub nodes");return this.element=this.createReference(e),this},Po.prototype.handleEnd=function(){this.element.id=this.body},Po.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function du(e,t){this.element=t,this.propertyDesc=e}du.prototype=Object.create(Fr.prototype),du.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=su(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function La(){}La.prototype=Object.create(Fr.prototype),La.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 Yt(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Yt.prototype=Object.create(La.prototype),Yt.prototype.addReference=function(e){this.context.addReference(e)},Yt.prototype.handleText=function(e){var t=this.element,n=ui(t),i=n.bodyProperty;if(!i)throw Mi("unexpected body text <"+e+">");Fr.prototype.handleText.call(this,e)},Yt.prototype.handleEnd=function(){var e=this.body,t=this.element,n=ui(t),i=n.bodyProperty;i&&e!==void 0&&(e=su(i.type,e),t.set(i.name,e))},Yt.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=ui(n),r=this.context,o=new n({}),a=this.model,s;return M(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),M(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=su(l.type,c):u==="xmlns"?u=":"+u:(s=zt(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},Yt.prototype.getPropertyForNode=function(e){var t=e.name,n=zt(t),i=this.type,r=this.model,o=ui(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=E0(s);if(u){const l=e.attributes[u];if(l){const p=R0(l,e.ns,r),f=r.getType(p);return D({},s,{effectiveType:ui(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=jf(n,c),l=r.getType(u);if(s=qe(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return D({},s,{effectiveType:ui(l).name})}else if(s=qe(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Mi("unrecognized element <"+n.name+">")},Yt.prototype.toString=function(){return"ElementDescriptor["+ui(this.type).name+"]"},Yt.prototype.valueHandler=function(e,t){return new du(e,t)},Yt.prototype.referenceHandler=function(e){return new Po(e,this.context)},Yt.prototype.handler=function(e){return e==="Element"?new Hr(this.model,e,this.context):new Yt(this.model,e,this.context)},Yt.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Tf(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(D(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function hu(e,t,n){Yt.call(this,e,t,n)}hu.prototype=Object.create(Yt.prototype),hu.prototype.createElement=function(e){var t=e.name,n=zt(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&jf(n,o)||t;if(!r.hasType(a))throw Mi("unexpected element <"+e.originalName+">");return Yt.prototype.createElement.call(this,e)};function Hr(e,t,n){this.model=e,this.context=n}Hr.prototype=Object.create(La.prototype),Hr.prototype.createElement=function(e){var t=e.name,n=zt(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Hr.prototype.handleChild=function(e){var t=new Hr(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},Hr.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function mu(e){e instanceof wn&&(e={model:e}),D(this,{lax:!1},e)}mu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Yt?(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 C0(D({},t,{rootHandler:i})),s=new Lf({proxy:!0}),c=P0();i.context=a,c.push(i);function u(w,A,I){var P=A(),j=P.line,F=P.column,L=P.data;L.charAt(0)==="<"&&L.indexOf(" ")!==-1&&(L=L.slice(0,L.indexOf(" "))+">");var H="unparsable content "+(L?L+" ":"")+`detected
|
|
2
|
+
line: `+j+`
|
|
3
|
+
column: `+F+`
|
|
4
|
+
nested error: `+w.message;if(I)return a.addWarning({message:H,error:w}),!0;throw Mi(H)}function l(w,A){return u(w,A,!0)}function p(){var w=a.elementsById,A=a.references,I,P;for(I=0;P=A[I];I++){var j=P.element,F=w[P.id],L=ui(j).propertiesByName[P.property];if(F||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),L.isMany){var H=j.get(L.name),re=H.indexOf(P);re===-1&&(re=H.length),F?H[re]=F:H.splice(re,1)}else j.set(L.name,F)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,h=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function g(w){if(d.test(w)){var A=h.exec(w),I=A&&A[1];!I||m.test(I)||a.addWarning({message:"unsupported document encoding <"+I+">, falling back to UTF-8"})}}function S(w,A){var I=c.peek();try{c.push(I.handleNode(w))}catch(P){u(P,A,o)&&c.push(new fu)}}function E(w,A){try{c.peek().handleText(w)}catch(I){l(I,A)}}function b(w,A){w.trim()&&E(w,A)}var x=r.getPackages().reduce(function(w,A){return w[A.uri]=A.prefix,w},Object.entries(pu).reduce(function(w,[A,I]){return w[I]=A,w},r.config&&r.config.nsMap||{}));return s.ns(x).on("openTag",function(w,A,I,P){var j=w.attrs||{},F=Object.keys(j).reduce(function(H,re){var Pe=A(j[re]);return H[re]=Pe,H},{}),L={name:w.name,originalName:w.originalName,attributes:F,ns:w.ns};S(L,P)}).on("question",g).on("closeTag",f).on("cdata",E).on("text",function(w,A,I){b(A(w),I)}).on("error",u).on("warn",l),new Promise(function(w,A){var I;try{s.parse(e),p()}catch(H){I=H}var P=i.element;!I&&!P&&(I=Mi("failed to parse document as <"+i.type.$descriptor.name+">"));var j=a.warnings,F=a.references,L=a.elementsById;return I?(I.warnings=j,A(I)):w({rootElement:P,elementsById:L,references:F,warnings:j})})},mu.prototype.handler=function(e){return new hu(this.model,e)};function P0(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var A0=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
+
`,T0=/<|>|'|"|&|\n\r|\n/g,Ff=/<|>|&/g;function Un(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Un.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Un.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Un.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Un.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)},Un.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Un.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Un.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Un.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Un.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 M0(e){return e.charAt(0).toLowerCase()+e.slice(1)}function k0(e,t){return Nf(t)?M0(e):e}function Hf(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function zf(e){return on(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function D0(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 O0(e,t){return t.isGeneric?D({localName:t.ns.localName},e):D({localName:k0(t.ns.localName,t.$pkg)},e)}function I0(e,t){return D({localName:t.ns.localName},e)}function L0(e){var t=e.$descriptor;return we(t.properties,function(n){var i=n.name;if(n.isVirtual||!an(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var N0={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},B0={"<":"lt",">":"gt","&":"amp"};function Vf(e,t,n){return e=on(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function $0(e){return Vf(e,T0,N0)}function j0(e){return Vf(e,Ff,B0)}function F0(e){return we(e,function(t){return t.isAttr})}function H0(e){return we(e,function(t){return!t.isAttr})}function gu(e){this.tagName=e}gu.prototype.build=function(e){return this.element=e,this},gu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function hr(){}hr.prototype.serializeValue=hr.prototype.serializeTo=function(e){e.append(this.escape?j0(this.value):this.value)},hr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Ff)!==-1&&(this.escape=!0),this};function vu(e){this.tagName=e}Hf(vu,hr),vu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Qe(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Qe.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=L0(e),this.parseAttributes(F0(r)),this.parseContainments(H0(r))),this.parseGenericAttributes(e,i),this},Qe.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return O0(t,e)},Qe.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return I0(t,e)},Qe.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Qe.prototype.nsAttributeName=function(e){var t;if(on(e)?t=zt(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:D({localName:t.localName},n)},Qe.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}))},Qe.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new hr().build({type:"String"},t));var n=e.$children;n&&M(n,i=>{this.body.push(new Qe(this).build(i))})},Qe.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=zt(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)}},Qe.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return M(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},Qe.prototype.parseGenericAttributes=function(e,t){var n=this;M(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)}})},Qe.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;M(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new hr().build(r,o[0]));else if(Tf(r.type))M(o,function(u){n.push(new vu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)M(o,function(u){n.push(new gu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=$f(r);M(o,function(u){var l;c?c===Bf?l=new Qe(t,r):l=new Na(t,r,c):l=new Qe(t),n.push(l.build(u))})}})},Qe.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Un(i):t=i),t},Qe.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},Qe.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},Qe.prototype.parseAttributes=function(e){var t=this,n=this.element;M(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];M(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},Qe.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),zf(e)},Qe.prototype.addAttribute=function(e,t){var n=this.attrs;on(t)&&(t=$0(t));var i=Rf(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)},Qe.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=D0(n).concat(t)),M(t,function(i){e.append(" ").append(zf(i.name)).append('="').append(i.value).append('"')})},Qe.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==hr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),M(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Na(e,t,n){Qe.call(this,e,t),this.serialization=n}Hf(Na,Qe),Na.prototype.parseNsAttributes=function(e){var t=Qe.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},Na.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function z0(){this.value="",this.write=function(e){this.value+=e}}function V0(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 G0(e){e=D({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new z0,o=new V0(r,e.format);e.preamble&&o.append(A0);var a=new Qe,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(W0(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function W0(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in pu)n[i]=pu[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 Ba(e,t){wn.call(this,e,t)}Ba.prototype=Object.create(wn.prototype),Ba.prototype.fromXML=function(e,t,n){on(t)||(n=t,t="bpmn:Definitions");var i=new mu(D({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Ba.prototype.toXML=function(e,t){var n=new G0(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var U0="BPMN20",q0="http://www.omg.org/spec/BPMN/20100524/MODEL",Y0="bpmn",K0=[],X0=[{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"}]}],Z0=[{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"}]}],Q0={tagAlias:"lowerCase",typePrefix:"t"},J0={name:U0,uri:q0,prefix:Y0,associations:K0,types:X0,enumerations:Z0,xml:Q0},ex="BPMNDI",tx="http://www.omg.org/spec/BPMN/20100524/DI",nx="bpmndi",ix=[{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"]}],rx=[{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"}]}],ox=[],ax={name:ex,uri:tx,prefix:nx,types:ix,enumerations:rx,associations:ox},sx="DC",cx="http://www.omg.org/spec/DD/20100524/DC",ux="dc",lx=[{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}]}],px=[],fx={name:sx,uri:cx,prefix:ux,types:lx,associations:px},dx="DI",hx="http://www.omg.org/spec/DD/20100524/DI",mx="di",gx=[{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"}]}],vx=[],yx={tagAlias:"lowerCase"},_x={name:dx,uri:hx,prefix:mx,types:gx,associations:vx,xml:yx},bx="bpmn.io colors for BPMN",xx="http://bpmn.io/schema/bpmn/biocolor/1.0",Ex="bioc",wx=[{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"}]}],Sx=[],Rx=[],Cx={name:bx,uri:xx,prefix:Ex,types:wx,enumerations:Sx,associations:Rx},Px="BPMN in Color",Ax="http://www.omg.org/spec/BPMN/non-normative/color/1.0",Tx="color",Mx=[{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"}]}],kx=[],Dx=[],Ox={name:Px,uri:Ax,prefix:Tx,types:Mx,enumerations:kx,associations:Dx};const Ix={bpmn:J0,bpmndi:ax,dc:fx,di:_x,bioc:Cx,color:Ox};function Gf(e,t){const n=D({},Ix,e);return new Ba(n,t)}const Lx={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"}},Nx="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Wf="i18n",$a={[Wf]:Lx,[eu]:bf};function Uf(){return Gf($a)}const qf=Uf();async function yu(e){const{rootElement:t,warnings:n}=await qf.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function Bx(e){const{xml:t}=await qf.toXML(e,{format:!0});return t}function _u(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ja=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),$x=1,jx=2;function ki(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]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`}}const Yf=20,Kf=1;function li(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 Fa(e,t){let n=null;const i=e.type!==t.type;for(const r of li(e))for(const o of li(t)){if(r.axis!==o.axis||Math.abs(r.at-o.at)>Kf)continue;const a=r.dir!==o.dir?"opposite":i?"mixed":null;if(!a)continue;const s=Math.min(r.hi,o.hi)-Math.max(r.lo,o.lo);s>=Yf&&(!n||s>n.length)&&(n={axis:r.axis,length:s,kind:a})}return n}function Xf(e,t){const n=Fa(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function Fx(e,t){let n=0;for(const i of t)i.id!==e.id&&Xf(e,i)&&n++;return n}function bu(e,t){let n=0;for(const i of t)i.id!==e.id&&Fa(e,i)&&n++;return n}const xu=15,Zf=20;function Hx(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Zf||t.at>n[1]+Zf)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 Eu=20;function Ha(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Kf)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Yf||n.push([r-Eu,o+Eu])}return n}function za(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of li(e)){const o=Hx(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Ha(r,li(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const zx=1,Vx=(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 Gx(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 Wx(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 Ux=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height;function Di(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(Gx(e.waypoints[o],e.waypoints[o+1],r,jx)){i.push(r);break}}return i}function qx(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 Qf=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Va(e,t){let n=0;for(const i of t){if(i.id===e.id||Qf(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++)qx(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Ao(e,t){let n=0;for(const i of t)i.id===e.id||Qf(e,i)||Va(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Jf(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++)Va(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function wu(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Va(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 zr=e=>e.shapes.filter(t=>!t.container);function Oi(e){const t=[],n=e.shapes.filter(o=>!o.container);for(const o of e.edges)for(const a of Di(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(!Wx(s,c,$x))continue;const u=s.id<c.id?[s.id,c.id]:[c.id,s.id];t.push({kind:"shape-overlap",shapes:u,identical:Ux(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=Fa(s,c);if(!u)continue;const l=s.id<c.id?[s.id,c.id]:[c.id,s.id];t.push({kind:u.kind==="opposite"?"edge-overlap-opposite":"edge-overlap-mixed",edges:l,axis:u.axis,length:Math.round(u.length)})}for(const o of e.edges){if(!o.label)continue;const a=za(o,e.edges);a&&t.push({kind:"label-on-shared-segment",edge:o.id,other:a.other,axis:a.axis})}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||Vx(a,o,zx)||t.push({kind:"shape-outside-container",shape:o.id,container:a.id})}return t.sort((o,a)=>ki(o).localeCompare(ki(a)))}const Mt=e=>typeof e=="object"&&e!==null?e:void 0,Vt=e=>typeof e=="number"?e:0,mr=e=>{const t=Mt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function Yx(e){const t=Mt(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=mr(o);a&&n.push(a)}}return n}function Kx(e,t){const n=Mt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=mr(n);return r?t.get(r):void 0}if(ja.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return mr(n)}function ed(e){var o,a,s,c;const t=[],n=[],i=((o=Mt(e))==null?void 0:o.diagrams)??[],r=new Map;for(const u of((a=Mt(e))==null?void 0:a.rootElements)??[]){const l=Mt(u);if((l==null?void 0:l.$type)==="bpmn:Collaboration")for(const p of l.participants??[]){const f=Mt(p),d=mr(f),h=mr(f==null?void 0:f.processRef);d&&h&&r.set(h,d)}}for(const u of i){const l=Mt((s=Mt(u))==null?void 0:s.plane),p=(l==null?void 0:l.planeElement)??[];for(const f of p){const d=Mt(f);if(!d)continue;const h=Mt(d.bpmnElement),m=typeof(h==null?void 0:h.id)=="string"?h.id:void 0;if(!m)continue;const g=typeof(h==null?void 0:h.$type)=="string"?h.$type:"",S=Mt(d.bounds);if(S){const b=d.isExpanded===!1;t.push({id:m,type:g,x:Vt(S.x),y:Vt(S.y),width:Vt(S.width),height:Vt(S.height),container:ja.has(g)&&!b,attached:(h==null?void 0:h.attachedToRef)!==void 0,...h?{parent:Kx(h,r)}:{}});continue}const E=d.waypoint;if(Array.isArray(E)){const b=Mt((c=Mt(d.label))==null?void 0:c.bounds);n.push({id:m,type:g,waypoints:E.map(x=>{var w,A;return{x:Vt((w=Mt(x))==null?void 0:w.x),y:Vt((A=Mt(x))==null?void 0:A.y)}}),endpoints:Yx(h),...b?{label:{x:Vt(b.x),y:Vt(b.y),width:Vt(b.width),height:Vt(b.height)}}:{}})}}}return{shapes:t,edges:n}}function td(e){return Oi(ed(e))}async function Xx(e){const{definitions:t,warnings:n}=await yu(e);return{findings:td(t),warnings:n}}function Fn(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){const p=Mt(r.label);n.push({id:r.id,type:o,waypoints:a.map(f=>({x:Vt(f.x),y:Vt(f.y)})),endpoints:[mr(r.source),mr(r.target)].filter(f=>!!f),...p&&typeof p.x=="number"?{label:{x:p.x,y:Vt(p.y),width:Vt(p.width),height:Vt(p.height)}}:{}});continue}if(typeof r.x!="number"||typeof r.y!="number")continue;const s=Mt(r.businessObject);let c=Mt(r.parent);for(;c&&c.type==="bpmn:Lane";)c=Mt(c.parent);const u=typeof(c==null?void 0:c.type)=="string"?c.type:"",l=c&&ja.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:Vt(r.width),height:Vt(r.height),container:ja.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 Zx={"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 Qx(e,t){const n=Zx[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function nd(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function id(e){const t=()=>e.getAll().filter(n=>n.type!=="label"&&!("labelTarget"in n&&n.labelTarget));return{isCollaboration:()=>t().some(n=>n.type==="bpmn:Participant"),categoryOf:n=>{const i=e.get(n);if(!(!i||i.type==="label"))return Qx(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&nd(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?nd(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 rd=20,Jx=4,Kt=(e,t)=>Math.abs(e-t)<.5;function od(e,t,n,i=rd){if(Kt(e.y,t.y)&&!Kt(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(Kt(e.x,t.x)&&!Kt(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 ad(e,t,n=rd){if(e.length!==4)return null;const[i,r,o,a]=e;if(Kt(i.y,r.y)&&Kt(r.x,o.x)&&Kt(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(Kt(i.x,r.x)&&Kt(r.y,o.y)&&Kt(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 sd(e,t){if(e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const cd=30,eE=[0,-25,25,-40,40];function tE(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+cd:s-cd,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return eE.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const nE=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],Ga=(e,t,n)=>Di({...e,waypoints:t},n).length;function ud(e,t,n,i){let r=[...e.waypoints],o=Ga(e,r,t);if(o===0)return null;let a=!1;for(const p of sd(e,t))if(Ga(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(li),c=p=>li({...e,waypoints:p}).some(f=>Ha(f,s).length>0),u=tE(e,t).filter(p=>Ga(e,p,t)===0);if(u.length)return u.find(p=>!c(p))??u[0];const l=p=>!n||p.every(f=>f.x>=n.x&&f.x<=n.x+n.width&&f.y>=n.y&&f.y<=n.y+n.height);for(let p=0;p<Jx&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const h=r[d],m=r[d+1];for(const g of t){if(e.endpoints.includes(g.id)||Di({...e,waypoints:[h,m]},[g]).length===0)continue;const S=od(h,m,g),E=S?S.map(x=>nE(r,d,x)):ad(r,g)??[];if(!E.length)continue;const b=[...E].sort((x,w)=>Number(l(w))-Number(l(x)));for(const x of b){const w=Ga(e,x,t);if(w<o){r=x,o=w,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function ld(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Fn(n),o=zr(r),a=Oi(r).filter(c=>c.kind==="edge-crosses-shape"&&!t.has(ki(c)));if(!a.length)return;const s=new Map;for(const c of a){if(c.kind!=="edge-crosses-shape"||s.has(c.edge))continue;const u=r.edges.find(l=>l.id===c.edge);u&&s.set(c.edge,u)}for(const[c,u]of s){const l=n.get(c);if(!l)continue;const p=l.parent,f=p&&typeof p.x=="number"&&typeof p.width=="number"?{x:p.x,y:p.y,width:p.width,height:p.height}:void 0,d=ud(u,o,f,r.edges);d&&i.updateWaypoints(l,d)}}const iE=10;function pd(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 fd(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(H=>H.type==="bpmn:Participant"&&H.container),i=t.shapes.find(H=>H.id===e.endpoints[0]),r=t.shapes.find(H=>H.id===e.endpoints[1]);if(!i||!r)return null;const o=pd(i,n),a=pd(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(H=>H.id!==o.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=u.y).sort((H,re)=>H.y-re.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,S=e.waypoints[0],E=e.waypoints[e.waypoints.length-1],b=zr(t),x=t.edges.filter(H=>H.id!==e.id),w=Ao(e,x),A=Di(e,b).length;if(w===0&&A===0)return null;const I=Math.min(...l.map(H=>H.x)),P=Math.max(...l.map(H=>H.x+H.width)),j=(S.x+E.x)/2,F=H=>H.filter((re,Pe)=>Pe===0||!(Kt(re.x,H[Pe-1].x)&&Kt(re.y,H[Pe-1].y)));let L;for(let H=I;H<=P;H+=iE){const re=F([S,{x:S.x,y:m},{x:H,y:m},{x:H,y:g},{x:E.x,y:g},E]),Pe={...e,waypoints:re};if(Di(Pe,b).length>0)continue;const et=Ao(Pe,x),q=Math.abs(H-j);(!L||et<L.cross||et===L.cross&&q<L.detour)&&(L={pts:re,cross:et,detour:q})}return L&&(A>0?L.cross<=w:L.cross<w)?L.pts:null}function dd(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Fn(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Fn(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=fd(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const Su=[25,-25,40,-40],hd=35;function rE(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-hd:n.y+n.height+hd,p=[];for(const f of[0,...Su]){if(Math.abs(f)>=i.width/2-5)continue;const d=o+f;p.push({pts:[{x:n.x,y:r},{x:d,y:r},{x:d,y:c}],cost:Math.abs(f)});for(const h of[0,...Su]){if(Math.abs(h)>=n.width/2-5)continue;const m=a+h;p.push({pts:[{x:m,y:u},{x:m,y:l},{x:d,y:l},{x:d,y:c}],cost:Math.abs(f)+Math.abs(h)})}}return p}function oE(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=Kt(n[0].x,n[1].x)&&!Kt(n[0].y,n[1].y),s=Kt(n[n.length-1].x,n[n.length-2].x)&&!Kt(n[n.length-1].y,n[n.length-2].y);for(const c of Su){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 md(e,t){const n=new Map(t.shapes.map(l=>[l.id,l])),i=zr(t),r=t.edges.filter(l=>l.id!==e.id),o=bu(e,r);if(o===0)return null;const a=Ao(e,r);let s;const c=l=>l.reduce((p,f,d)=>d?p+Math.abs(f.x-l[d-1].x)+Math.abs(f.y-l[d-1].y):0,0),u=[...rE(e,n),...oE(e,n)];for(const{pts:l,cost:p}of u){const f={...e,waypoints:l};if(Di(f,i).length>0)continue;const d=bu(f,r),h=Ao(f,r);if(d>=o||h-a>o-d)continue;const m=c(l);(!s||d<s.opposite||d===s.opposite&&(h<s.cross||h===s.cross&&(p<s.cost||p===s.cost&&m<s.len)))&&(s={pts:l,opposite:d,cross:h,cost:p,len:m})}return(s==null?void 0:s.pts)??null}function gd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Fn(i),a=Oi(o).filter(l=>(l.kind==="edge-overlap-opposite"||l.kind==="edge-overlap-mixed")&&!t.has(ki(l)));if(!a.length)return;const s=new Set;for(const l of a)if(!(l.kind!=="edge-overlap-opposite"&&l.kind!=="edge-overlap-mixed"))for(const p of l.edges)n.has(p)||s.add(p);const c=l=>{var p;return((p=o.edges.find(f=>f.id===l))==null?void 0:p.type)??""},u=[...s].sort((l,p)=>{const f=c(l)==="bpmn:SequenceFlow"?0:1,d=c(p)==="bpmn:SequenceFlow"?0:1;return f!==d?f-d:l.localeCompare(p)});for(const l of u){const p=Fn(i),f=p.edges.find(m=>m.id===l);if(!f)continue;const d=md(f,p);if(!d)continue;const h=i.get(l);h&&r.updateWaypoints(h,d)}}const aE=10,sE=(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 vd(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!za(e,i))return null;const r=zr(t),o=i.flatMap(li);for(const a of li(e)){let s=[[a.lo,a.hi]];for(const[d,h]of Ha(a,o))s=s.flatMap(([m,g])=>{const S=[];return d>m&&S.push([m,Math.min(g,d)]),h<g&&S.push([Math.max(m,h),g]),S.filter(([E,b])=>b>E)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,h])=>h-d>=c+aE*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-xu}:{x:a.at+xu,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!za({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&sE(f,d)))return f}return null}function yd(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Fn(i),a=Oi(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(ki(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(f=>f.id===s.edge);if(!c)continue;const u=vd(c,o);if(!u)continue;const l=i.get(s.edge),p=l==null?void 0:l.label;p&&r.moveElements([p],{x:u.x-p.x,y:u.y-p.y})}}const cE=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,_d=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),bd={"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}]},Wa=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Ru=e=>typeof e=="string"&&e!=="";function uE(e){const t=[];function n(i,r,o,a){if(a===null){Ru(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!Wa(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Ru(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{if(!Wa(i)||!Ru(i.kind)||!(i.kind in bd)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const o of bd[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(!Wa(u))break;u=u[p]}if(!Wa(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 xd(e,t){const n=uE(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,h){if(!cE.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:S,name:E,condition:b}=f.flow,x=u(d,g,"source",["flowNode"]),w=u(d,S,"target",["flowNode"]);x&&w&&c(g)!==c(S)&&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:S}=f.flow,E=u(d,g,"source",["flowNode","participant"]),b=u(d,S,"target",["flowNode","participant"]);if(E&&b){const x=c(g),w=c(S);x!==void 0&&x===w&&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 S=m.source===f.dataStore.id?m.target:m.source;u(d,S,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:m,target:g}=f.association,S=u(d,m,"source"),E=u(d,g,"target");if(S&&E){const b=new Set([S,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:S}=f.association,E=u(d,g,"source"),b=u(d,S,"target");E&&b&&E!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:m??`${g}->${S}`});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 S=m===f.annotation.id?g:m;u(d,S,"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&&_d.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 S=g.filter(E=>m.includes(E));S.length===m.length&&S.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,S=t.endpointsOf(f.id),E=f.source??(S==null?void 0:S.source),b=f.target??(S==null?void 0:S.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&&_d.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 Ed(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 Ua(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const wd={"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 It(e,t){return e.filter(n=>n.kind===t)}function Sd(e,t){var Bb,$b,jb,Fb,Hb;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=R=>o.get(R),p=R=>{const T=l(R);if(!T)throw new Error(`하강 참조 해소 실패: ${R}`);return T},f=R=>{let T=R.parent;for(;T;){if(T.type==="bpmn:Participant")return T;T=T.parent}},d=It(e,"participant.add"),h=It(e,"node.add"),m=It(e,"sequenceFlow.add"),g=It(e,"messageFlow.add"),S=It(e,"dataStore.add"),E=It(e,"dataAssociation.add"),b=It(e,"annotation.add"),x=It(e,"group.add"),w=new Map(h.map(R=>[R.node.id,R])),A=(R,T,$)=>{var bt;const Y=R.businessObject,Z=(((bt=Y.extensionElements)==null?void 0:bt.values)??[]).filter(Le=>Le.$type!==T),K=$?[...Z,i.create(T,$)]:Z;if(!K.length){Y.extensionElements&&n.updateProperties(R,{extensionElements:void 0});return}const le=i.create("bpmn:ExtensionElements",{values:K});K.forEach(Le=>{Le.$parent=le}),n.updateProperties(R,{extensionElements:le})},I=R=>({anchor:R.anchor,side:R.side,...R.offset!==void 0?{offset:R.offset}:{}});for(const R of It(e,"element.remove")){const T=l(R.id);T&&n.removeElements([T])}const P=R=>o.filter(T=>{var $;return T.type==="bpmn:Lane"&&(($=f(T))==null?void 0:$.id)===R}).sort((T,$)=>T.y-$.y);for(const R of It(e,"participant.update")){const T=p(R.id);if(R.name!==void 0&&n.updateProperties(T,{name:R.name??void 0}),!R.lanes)continue;const $=P(R.id);if(!$.length){n.splitLane(T,R.lanes.length),P(R.id).forEach((Z,K)=>{const le=R.lanes[K];le&&n.updateProperties(Z,{id:le.id,name:le.name})});continue}const Y=new Set($.map(Z=>Z.id));R.lanes.forEach((Z,K)=>{if(Y.has(Z.id)){n.updateProperties(p(Z.id),{name:Z.name});return}const le=K===0?n.addLane(P(R.id)[0],"top"):n.addLane(p(R.lanes[K-1].id),"bottom");n.updateProperties(le,{id:Z.id,name:Z.name})})}const j=150,F=80,L=90,H=180,re=new Set;for(const R of d){re.add(`pool:${R.participant.id}`);for(const T of R.participant.lanes??[])re.add(T.id)}const Pe=new Map;for(const R of h){const T=R.node.lane??`pool:${R.node.participant??""}`;let $=Pe.get(T);$||Pe.set(T,$=new Set([0])),R.band!==void 0&&$.add(R.band)}const et=new Map;for(const[R,T]of Pe){if(!re.has(R))continue;const $=[...T].sort((K,le)=>K-le),Y=$.map((K,le)=>le===0?0:le%2===1?Math.ceil(le/2):-(le/2)),Z=Math.min(...Y);et.set(R,new Map($.map((K,le)=>[K,Y[le]-Z])))}const q=R=>{var T;return(((T=Pe.get(R))==null?void 0:T.size)??0)>1},ie=R=>R.band??(R.node.lane||!q(`pool:${R.node.participant??""}`)?void 0:0),ce=(R,T)=>{var $;return(($=et.get(R))==null?void 0:$.get(T))??T},oe=new Map;for(const[R,T]of Pe){let $=0;for(const Y of T)$=Math.max($,ce(R,Y));oe.set(R,$)}const se=R=>H+j*R,X=d.map((R,T)=>({op:R,declared:T}));X.sort((R,T)=>{const $=R.op.order??Number.POSITIVE_INFINITY,Y=T.op.order??Number.POSITIVE_INFINITY;return $!==Y?$-Y:R.declared-T.declared});let N=80;for(const R of o.getAll())R.parent===u()&&"height"in R&&typeof R.y=="number"&&(N=Math.max(N,R.y+R.height+60));for(const{op:R}of X){const T=R.participant,$=h.filter(gn=>gn.node.participant===T.id).length,Y=((Bb=T.lanes)==null?void 0:Bb.length)??0,Z=Math.max(1200,$*160+300),K=(T.lanes??[]).map(gn=>se(oe.get(gn.id)??0)),le=K.reduce((gn,Xe)=>gn+Xe,0);Y&&le<300&&(K[Y-1]+=300-le);const bt=Math.max(300,j*((oe.get(`pool:${T.id}`)??0)+1)),Le=T.blackBox||$+Y===0?120:Y?Math.max(300,le):bt,Ae=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:T.id,name:T.name,...R.order!==void 0?{"bwl:poolOrder":R.order}:{},...T.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:Z,height:Le,isExpanded:!0}),Pt=n.createShape(Ae,{x:100+Z/2,y:N+Le/2},u()),si=T.lanes??[];if(si.length&&n.splitLane(Pt,si.length),si.length){const gn=o.filter(Xe=>{var Jt;return Xe.type==="bpmn:Lane"&&((Jt=f(Xe))==null?void 0:Jt.id)===T.id}).sort((Xe,Jt)=>Xe.y-Jt.y);if(gn.forEach((Xe,Jt)=>{const Nn=si[Jt];Nn&&n.updateProperties(Xe,{id:Nn.id,name:Nn.name})}),K.some(Xe=>Xe!==Pt.height/Y)){let Xe=Pt.y;gn.forEach((Jt,Nn)=>{const ur=K[Nn];n.resizeShape(Jt,{x:Jt.x,y:Xe,width:Jt.width,height:ur}),Xe+=ur})}}N=Pt.y+Pt.height+60}const B=R=>{var Y;const T=w.get(R);if(T)return T.node.participant??"";const $=l(R);return $?$.type==="bpmn:Participant"?$.id:((Y=f($))==null?void 0:Y.id)??"":""},V=new Map,xe=R=>{let T=V.get(R);return T||V.set(R,T={nodes:[],flows:[]}),T};for(const R of h)xe(R.node.participant??"").nodes.push(R);for(const R of m)xe(B(R.flow.source)).flows.push(R);const Ct=R=>{var T;return i.create("bpmn:SequenceFlow",{id:R.id,name:R.name??((T=R.condition)==null?void 0:T.label)})},C=(R,T)=>r.createShape({type:Ua(R.type),businessObject:i.create(Ua(R.type),{id:R.id,name:R.name,...T!==void 0?{"bwl:band":T}:{}})}),_=[...X.map(({op:R})=>R.participant.id).filter(R=>V.has(R)),...[...V.keys()].filter(R=>!d.some(T=>T.participant.id===R))],v=R=>R.endsWith("Gateway");for(const R of _){const T=V.get(R),$=R?p(R):void 0,Y=$?$.x+150:250;let Z=$?$.y+80:120;const K=(Te,Fe,Be)=>{const ge=u().children.filter(Ue=>!("waypoints"in Ue&&Ue.waypoints)&&Ue.id!==Fe&&typeof Ue.y=="number"&&Ue.y>=Te);ge.length&&n.moveElements(ge,{x:0,y:Be})},le=(Te,Fe)=>{if(Te){const Ne=p(Te),Oe=se(Fe);if(Ne.height>=Oe)return;const vn=Oe-Ne.height,ze=f(Ne),st=ze?ze.y+ze.height:Ne.y+Ne.height;n.resizeLane(Ne,{x:Ne.x,y:Ne.y,width:Ne.width,height:Oe},!1),K(st,ze==null?void 0:ze.id,vn);return}if(!$)return;const Be=j*(Fe+1);if($.height>=Be)return;const ge=Be-$.height,Ue=$.y+$.height;n.resizeShape($,{x:$.x,y:$.y,width:$.width,height:Be}),K(Ue,$.id,ge)},bt=(Te,Fe,Be)=>{if(Te){const ge=p(Te);return ge.y+Math.min(ge.height/2,L)+ce(Te,Fe??0)*j}return Fe!==void 0&&$?$.y+F+ce(`pool:${R}`,Fe)*j:Be},Le=(Te,Fe,Be)=>{if(Te){const ge=p(Te);return ge.y+Math.min(ge.height/2,L)+Fe*j}return $?$.y+F+Fe*j:Be},Ae=Te=>Te.participant?p(Te.participant):u(),Pt=30,si=(Te,Fe,Be,ge)=>{const Ue=Be-Fe.width/2,Ne=ge-Fe.height/2;return(Te.children??[]).find(Oe=>!("waypoints"in Oe&&Oe.waypoints)&&Oe.type!=="bpmn:Lane"&&Oe.type!=="label"&&typeof Oe.x=="number"&&Ue<Oe.x+Oe.width+Pt&&Ue+Fe.width+Pt>Oe.x&&Ne<Oe.y+Oe.height&&Ne+Fe.height>Oe.y)},gn=(Te,Fe,Be,ge,Ue,Ne)=>{const Oe=Be!==void 0||ge!==void 0,vn=ce(Be??`pool:${R}`,ge??0);if(Oe)for(let ot=0;ot<4;ot++){const Ze=Le(Be,vn+ot,Ne);if(!si(Te,Fe,Ue,Ze))return le(Be,vn+ot),{x:Ue,y:Ze}}const ze=bt(Be,ge,Ne);Oe&&le(Be,vn);let st=Ue;for(let ot=0;ot<64;ot++){const Ze=si(Te,Fe,st,ze);if(!Ze)break;st=Ze.x+Ze.width+130+Fe.width/2}return{x:st,y:ze}},Xe=new Set(T.flows.map(Te=>Te.flow.target)),Jt=new Map;for(const Te of T.nodes){if(Xe.has(Te.node.id))continue;const Fe=C(Te.node,Te.band),Be=ie(Te),ge=Te.node.lane?`${Te.node.lane}|${Be??""}`:Be!==void 0?`band:${Be}`:"",Ue=Ae(Te.node),Ne=gn(Ue,Fe,Te.node.lane,Be,Jt.get(ge)??Y,Z);n.createShape(Fe,Ne,Ue),Jt.set(ge,Ne.x+Fe.width+130),!Te.node.lane&&Be===void 0&&(Z+=160)}const Nn=new Set,ur=new Map,Qc=new Map,Bn=new Map;if(R&&re.has(`pool:${R}`)){const Te=new Map;for(const ge of T.flows)Te.set(ge.flow.target,(Te.get(ge.flow.target)??0)+1);const Fe=ge=>bt(ge.node.lane,ie(ge),Number.NaN);for(const ge of T.nodes){if(!v(ge.node.type))continue;const Ue=Fe(ge);if(Number.isNaN(Ue)||b.some(st=>{var ot,Ze;return(((ot=st.placement)==null?void 0:ot.anchor)??(st.association?st.association.source===st.annotation.id?st.association.target:st.association.source:void 0))===ge.node.id&&((Ze=st.placement)==null?void 0:Ze.side.startsWith("bottom"))}))continue;let Oe,vn=!1,ze;for(const st of T.flows){if(st.flow.source!==ge.node.id)continue;const ot=w.get(st.flow.target);if(!ot||!ot.node.lane&&ie(ot)===void 0)continue;const Ze=Fe(ot);Number.isNaN(Ze)||(Math.abs(Ze-Ue)<.5&&(vn=!0),Ze>Ue?!Oe||Ze>Oe.row?Oe={id:ot.node.id,row:Ze,count:1}:Ze===Oe.row&&Oe.count++:Ze<Ue&&ot.node.lane===ge.node.lane&&(!ze||Ze>ze.row?ze={op:ot,row:Ze,count:1}:Ze===ze.row&&ze.count++))}Oe&&Oe.count===1&&(Te.get(Oe.id)??0)===1&&Nn.add(Oe.id),!vn&&ze&&ze.count===1&&(Te.get(ze.op.node.id)??0)===1&&ur.set(ze.op.node.id,{lane:ge.node.lane,band:ie(ge)})}const Be=new Map;for(const ge of g)Be.set(ge.flow.target,[...Be.get(ge.flow.target)??[],ge]);for(const ge of T.nodes){const Ue=Be.get(ge.node.id);if(!Ue||Ue.length!==1||!Te.get(ge.node.id)||!ge.node.lane&&ie(ge)===void 0)continue;const Ne=($b=w.get(Ue[0].flow.source))==null?void 0:$b.node.participant,Oe=Ne?l(Ne):void 0;if(!Oe||!$||Oe.id===$.id)continue;const vn=ge.node.lane??`pool:${R}`,ze=et.get(vn);if(!ze)continue;const st=ze.get(0)??0,ot=(ze.get(ie(ge)??0)??st)-st;if(ot===0)continue;const Ze=Oe.y<$.y;if(Ze&&ot<0||!Ze&&ot>0)continue;let $n;for(const[Jc,wo]of ze){const Ir=wo-st;(Ze&&Ir<0&&(!$n||Ir<$n.row)||!Ze&&Ir>0&&(!$n||Ir>$n.row))&&($n={band:Jc,row:Ir})}$n&&Qc.set(ge.node.id,{lane:ge.node.lane,band:$n.band})}}const zb=new Set;let nD=0;for(;nD++<T.nodes.length+2;){for(let Be=0;Be<T.nodes.length+T.flows.length+2;Be++){let ge=!1;for(const Ue of T.flows){const Ne=Ue.flow;if(zb.has(Ne.id))continue;const Oe=l(Ne.source);if(!Oe)continue;const vn=l(Ne.target),ze=w.get(Ne.target);if(!vn&&ze){const st=C(ze.node,ze.band),ot=ie(ze);if(ze.node.lane||ot!==void 0){const Ze=Ae(ze.node),$n=Oe,Jc=$n.x+(Bn.get(Ne.source)??0)+$n.width+130,wo=ur.get(Ne.target)??Qc.get(Ne.target),Ir=gn(Ze,st,wo?wo.lane:ze.node.lane,wo?wo.band:ot,Nn.has(Ne.target)?$n.x+$n.width/2:Jc,Number.NaN),vf=n.createShape(st,Ir,Ze);Nn.has(Ne.target)&&Bn.set(Ne.target,Jc-(vf.x+vf.width/2)),n.connect(Oe,vf,{type:"bpmn:SequenceFlow",businessObject:Ct(Ne)})}else s.append(Oe,st,{connection:{type:"bpmn:SequenceFlow",businessObject:Ct(Ne)}})}else if(vn)n.connect(Oe,vn,{type:"bpmn:SequenceFlow",businessObject:Ct(Ne)});else continue;zb.add(Ne.id),ge=!0}if(!ge)break}const Te=T.nodes.filter(Be=>!l(Be.node.id));if(!Te.length)break;const Fe=Te[0];{const Be=C(Fe.node,Fe.band),ge=Ae(Fe.node),Ue=ie(Fe);n.createShape(Be,gn(ge,Be,Fe.node.lane,Ue,Y,Z),ge),!Fe.node.lane&&Ue===void 0&&(Z+=160)}}}const k=40,O=(R,T=()=>!0)=>{const $=l(R);if(!$)return[];const Y=[$],Z=new Set([R]);for(let K=0;K<Y.length;K++){const le=Y[K].id;for(const bt of m){const Le=bt.flow.target;if(bt.flow.source!==le||Z.has(Le)||!w.has(Le))continue;Z.add(Le);const Ae=l(Le);Ae&&T(Ae)&&Y.push(Ae)}}return Y};for(const R of It(e,"sequenceFlow.update")){if(R.target===void 0)continue;const T=w.get(R.target);if(!T)continue;const $=l(R.target),Y=l(R.id);if(!$||!Y)continue;const Z=R.source!==void 0?l(R.source):Y.source,K=Y.target;if(!Z||!K||K.id===$.id)continue;const le=O(R.target),bt=new Set(le.map(Xe=>Xe.id)),Le=Math.min(...le.map(Xe=>Xe.x)),Ae=Math.max(...le.map(Xe=>Xe.x+Xe.width)),Pt=Z.x+Z.width,si=Ae-Le+k*2-(K.x-Pt);if(si>0){const Xe=f($),Jt=(Xe==null?void 0:Xe.children)??[],Nn=Bn=>Bn.type==="bpmn:Lane",ur=Jt.filter(Bn=>!("waypoints"in Bn&&Bn.waypoints)&&!Nn(Bn)&&!bt.has(Bn.id)&&Bn.x>=K.x),Qc=Xe?[Xe,...Jt.filter(Bn=>Nn(Bn))]:[];ur.length&&n.createSpace(ur,Qc,{x:si,y:0},"e",K.x-1)}const gn=T.node.lane||T.band!==void 0?$.y+$.height/2:Z.y+Z.height/2;n.moveElements(le,{x:Pt+k-Le,y:gn-($.y+$.height/2)})}const z=(R,T)=>{const $=T.target===R,Y=p(T.source),Z=p(T.target),K=$?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(Y,Z,T.id?{type:K,businessObject:i.create(K,{id:T.id})}:{type:K})};for(const R of S){const T=R.associations??[],$=T.map(K=>K.source===R.dataStore.id?K.target:K.source).map(l).find(Boolean),Y=$?f($)??u():u(),Z=$?{x:$.x+$.width/2,y:$.y+$.height+110}:{x:200,y:N+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:R.dataStore.id,name:R.dataStore.name})},Z,Y);for(const K of T)z(R.dataStore.id,K)}for(const R of E){const $=p(R.association.target).type==="bpmn:DataStoreReference"?R.association.target:R.association.source;z($,R.association)}for(const R of g){const T=R.flow;n.connect(p(T.source),p(T.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:T.id,name:T.name})})}const ne=100,_e=30,Ie=4,ut=R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number",$e=()=>{const R=Fn(o);return{bad:Oi(R).filter(T=>T.kind==="edge-crosses-shape"||T.kind==="edge-overlap-opposite"||T.kind==="edge-overlap-mixed").length,crossings:Jf(R),straight:R.edges.filter(T=>T.type==="bpmn:MessageFlow"&&T.waypoints.length===2).length}},vt=R=>{const T=Fn(o),$=T.edges.find(Y=>Y.id===R);return!!$&&Di($,zr(T)).length>0},jt=(R,T,$)=>{const Y=new Set(R.map(Ae=>Ae.id)),Z=(T.children??[]).filter(ut).filter(Ae=>!Y.has(Ae.id));if(R.some(Ae=>Z.some(Pt=>Ae.x+$<Pt.x+Pt.width+_e&&Ae.x+$+Ae.width+_e>Pt.x&&Ae.y<Pt.y+Pt.height&&Ae.y+Ae.height>Pt.y)))return null;const le=T.width;n.moveElements(R,{x:$,y:0});const Le=Math.max(...R.map(Ae=>Ae.x+Ae.width))+150-(T.x+T.width);return Le>0&&n.resizeShape(T,{x:T.x,y:T.y,width:T.width+Le,height:T.height}),()=>{n.moveElements(R,{x:-$,y:0}),Le>0&&n.resizeShape(T,{x:T.x,y:T.y,width:le,height:T.height})}},qt=(R,T)=>T.bad>R.bad||T.crossings>R.crossings&&T.straight<=R.straight,Ye=(R,T,$,Y=()=>!0)=>{const Z=$e(),K=jt(R,T,$);if(!K)return!1;const le=$e();return qt(Z,le)||!Y()?(K(),!1):!0},yt=R=>{var $;const T=($=w.get(R))==null?void 0:$.node.participant;return!!T&&re.has(`pool:${T}`)},Dt=new Map;for(const R of g){if(!yt(R.flow.target))continue;const T=Dt.get(R.flow.target)??[];T.push(R),Dt.set(R.flow.target,T)}const cr=[...Dt.keys()],En=new Set(m.map(R=>R.flow.target)),Vn=R=>X.findIndex(({op:T})=>T.participant.id===R);cr.sort((R,T)=>{var Z,K;const $=En.has(R)?1:0,Y=En.has(T)?1:0;return $!==Y?$-Y:Vn((Z=w.get(R))==null?void 0:Z.node.participant)-Vn((K=w.get(T))==null?void 0:K.node.participant)});const Qt=R=>R.x+R.width/2,_t=R=>{let T;for(const $ of Dt.get(R)??[]){const Y=l($.flow.source);if(!Y)continue;const Z=Qt(Y);(!T||Z>T.cx)&&(T={op:$,cx:Z})}return T==null?void 0:T.op},Or=R=>{const T=_t(R),$=l(R),Y=T?l(T.flow.source):void 0;return $&&Y?Qt(Y)-Qt($):void 0},Zc=R=>{const T=Or(R);return T!==void 0&&Math.abs(T)<ne},rn=R=>{const T=_t(R);if(!T)return null;const $=l(R),Y=l(T.flow.source);if(!$||!Y)return null;const Z=Qt(Y)-Qt($);if(Z>=ne){const K=p(w.get(R).node.participant);return{subtree:O(R,le=>le.x>=$.x),pool:K,dx:Z}}if(-Z>=ne&&yt(T.flow.source)){const K=p(w.get(T.flow.source).node.participant);return{subtree:O(T.flow.source,le=>le.x>=Y.x&&!Zc(le.id)),pool:K,dx:-Z}}return null},De=()=>cr.map(R=>({id:R,plan:rn(R)})).filter(R=>!!R.plan).sort((R,T)=>Math.min(...R.plan.subtree.map($=>$.x))-Math.min(...T.plan.subtree.map($=>$.x))).map(R=>R.id);for(let R=0;R<3;R++){const T=$e(),$=[];for(const Z of De()){const K=rn(Z);if(!K)continue;const le=jt(K.subtree,K.pool,K.dx);le&&$.push(le)}if(!$.length)break;if(!qt(T,$e()))continue;for(const Z of $.reverse())Z();let Y=!1;for(const Z of De()){const K=rn(Z);K&&Ye(K.subtree,K.pool,K.dx)&&(Y=!0)}if(!Y)break}for(const R of cr.flatMap(T=>Dt.get(T)??[])){if(!vt(R.flow.id))continue;const T=l(R.flow.target);if(!T)continue;const $=p(w.get(R.flow.target).node.participant),Y=O(R.flow.target,K=>K.x>=T.x),Z=T.width+130;for(let K=1;K<=Ie&&!Ye(Y,$,Z*K,()=>!vt(R.flow.id));K++);}let je=0;for(const R of x){const T=(R.group.members??[]).map(l).filter(K=>!!K),$=40;let Y;if(T.length){const K=Math.min(...T.map(Ae=>Ae.x))-$,le=Math.min(...T.map(Ae=>Ae.y))-$,bt=Math.max(...T.map(Ae=>Ae.x+Ae.width))+$,Le=Math.max(...T.map(Ae=>Ae.y+Ae.height))+$;Y={x:K,y:le,width:bt-K,height:Le-le}}else Y={x:300+je*350,y:40,width:300,height:200},je++;const Z=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:R.group.id}),width:Y.width,height:Y.height},{x:Y.x+Y.width/2,y:Y.y+Y.height/2},u());R.group.name&&n.updateLabel(Z,R.group.name),(jb=R.group.members)!=null&&jb.length&&A(Z,"bwl:Members",{refs:R.group.members.join(" ")})}const Lb=R=>{const T=R.waypoints;if(T!=null&&T.length){const Y=T[Math.floor((T.length-1)/2)];return{x:Y.x,y:Y.y,width:0,height:0}}const $=R;return{x:$.x,y:$.y,width:$.width,height:$.height}};let Ma=0;const Nb={width:100,height:30};for(const R of b){const T=R.association,$=((Fb=R.placement)==null?void 0:Fb.anchor)??(T?T.source===R.annotation.id?T.target:T.source:void 0),Y=$?l($):void 0,Z=Y?Lb(Y):void 0;let K;if(Z&&R.placement){const[Le,Ae]=wd[R.placement.side],Pt=R.placement.offset??50;K={x:Z.x+Z.width/2+Le*(Z.width/2+Nb.width/2+Pt),y:Z.y+Z.height/2+Ae*(Z.height/2+Nb.height/2+Pt)}}else Z?(K={x:Z.x+Z.width/2+180+Ma%3*260,y:Z.y-110-Ma%2*95},Ma++):(K={x:300+Ma*260,y:60},Ma++);const le=Y?f(Y)??u():u(),bt=n.createShape({type:"bpmn:TextAnnotation",businessObject:i.create("bpmn:TextAnnotation",{id:R.annotation.id,text:R.annotation.text})},K,le);if(T){const Le=Ae=>Ae===R.annotation.id?bt:p(Ae);n.connect(Le(T.source),Le(T.target),T.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:T.id})}:{type:"bpmn:Association"})}R.placement&&A(bt,"bwl:Placement",I(R.placement))}for(const R of It(e,"association.add")){const T=R.association;n.connect(p(T.source),p(T.target),T.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:T.id})}:{type:"bpmn:Association"})}for(const R of It(e,"node.update")){let T=p(R.id);if(R.type&&Ua(R.type)!==T.type&&(T=c.replaceElement(T,{type:Ua(R.type)})),R.name!==void 0&&n.updateProperties(T,{name:R.name??void 0}),R.lane){const $=p(R.lane),Y=$.y+$.height/2-(T.y+T.height/2);Y!==0&&n.moveElements([T],{x:0,y:Y})}}for(const R of It(e,"sequenceFlow.update")){const T=p(R.id);if(R.source!==void 0||R.target!==void 0){const $=T,Y=R.source!==void 0?p(R.source):$.source,Z=R.target!==void 0?p(R.target):$.target,K=le=>({x:le.x+le.width/2,y:le.y+le.height/2});n.reconnect($,Y,Z,[K(Y),K(Z)])}R.name!==void 0&&n.updateProperties(T,{name:R.name??void 0}),R.condition!==void 0&&n.updateProperties(T,{name:((Hb=R.condition)==null?void 0:Hb.label)??void 0})}for(const R of It(e,"messageFlow.update"))R.name!==void 0&&n.updateProperties(p(R.id),{name:R.name??void 0});for(const R of It(e,"dataStore.update"))R.name!==void 0&&n.updateProperties(p(R.id),{name:R.name??void 0});for(const R of It(e,"annotation.update")){const T=p(R.id);if(R.text!==void 0&&n.updateProperties(T,{text:R.text}),R.placement===null)A(T,"bwl:Placement",null);else if(R.placement){const $=Lb(p(R.placement.anchor)),[Y,Z]=wd[R.placement.side],K=R.placement.offset??50,le=$.x+$.width/2+Y*($.width/2+T.width/2+K),bt=$.y+$.height/2+Z*($.height/2+T.height/2+K);n.moveElements([T],{x:le-(T.x+T.width/2),y:bt-(T.y+T.height/2)}),A(T,"bwl:Placement",I(R.placement))}}for(const R of It(e,"group.update")){const T=p(R.id);if(R.name!==void 0&&n.updateLabel(T,R.name??""),R.members){const $=R.members.map(l).filter(Y=>!!Y);if($.length){const Z=Math.min(...$.map(Le=>Le.x))-40,K=Math.min(...$.map(Le=>Le.y))-40,le=Math.max(...$.map(Le=>Le.x+Le.width))+40,bt=Math.max(...$.map(Le=>Le.y+Le.height))+40;n.resizeShape(T,{x:Z,y:K,width:le-Z,height:bt-K})}A(T,"bwl:Members",{refs:R.members.join(" ")})}}}function Rd(e,t,n=Sd){const i=Ed(e),r=xd(t,id(i.elementRegistry)),o={edgeCrossings:{before:0,after:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=Fn(i.elementRegistry),s=new Set(Oi(a).map(ki)),c=new Set(a.edges.map(d=>d.id)),u=wu(a).length,l=e.get("commandStack");try{Ef(l,()=>{n(t,i),dd(i,c),ld(i,s),gd(i,s,c),yd(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=Fn(i.elementRegistry),f=Oi(p).filter(d=>!s.has(ki(d)));return{ok:!0,issues:[],findings:f,stats:{edgeCrossings:{before:u,after:wu(p).length}}}}function lE(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function pE(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Cd(e,t){const n=pE(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Pd(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function fE(e){return typeof e=="string"&&tu.includes(e)}function qn(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Ad(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=[],S=new Set,E=new Set,b=q=>{q&&S.add(q)},x=q=>{S.add(q),E.add(q)},w=q=>{const ie=Pd(q,"bwl:Placement");if(!ie)return;const ce=typeof ie.anchor=="string"?ie.anchor:void 0;if(!ce||!fE(ie.side))return;const oe=typeof ie.offset=="number"?ie.offset:void 0;m.push({owner:q.id,anchor:ce,side:ie.side,...oe!==void 0?{offset:oe}:{}})},A=q=>{const ie=Pd(q,"bwl:Members"),ce=typeof(ie==null?void 0:ie.refs)=="string"?ie.refs.split(/\s+/).filter(Boolean):[];ce.length&&g.push({owner:q.id,refs:ce})},I=q=>{var ie;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:""}),w(ce);break;case"bpmn:Association":d.push({id:ce.id,type:ce.$type,source:qn(ce.sourceRef),target:qn(ce.targetRef)});break;case"bpmn:Group":{x(ce.id);const oe=(ie=ce.categoryValueRef)==null?void 0:ie.value;c.push({id:ce.id,...typeof oe=="string"&&oe?{name:oe}:{}}),A(ce);break}default:u.push({id:ce.id,type:ce.$type,reason:"type-outside-mvp"})}},P=(q,ie)=>{const ce=q.flowElements??[],oe=(q.laneSets??[]).flatMap(X=>X.lanes??[]),se=new Map;for(const X of oe){b(X.id);for(const N of X.flowNodeRef??[]){const B=qn(N);B&&se.set(B,X.id)}}for(const X of ce){if(b(X.id),X.$type==="bpmn:SequenceFlow"){p.push({id:X.id,source:qn(X.sourceRef),target:qn(X.targetRef),...typeof X.name=="string"&&X.name?{name:X.name}:{}});continue}if(X.$type==="bpmn:DataStoreReference"){x(X.id),a.push({id:X.id,...X.name?{name:X.name}:{}});continue}const N=lE(X.$type);if(!yf(N)){u.push({id:X.id,type:X.$type,reason:"type-outside-mvp"});continue}x(X.id),o.push({id:X.id,type:N,...X.name?{name:X.name}:{},...ie?{participant:ie}:{},...se.has(X.id)?{lane:se.get(X.id)}:{}});const B=Cd(X,"bwl:band");B!==void 0&&(l.bands[X.id]=B);for(const V of X.dataOutputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:X.id,target:qn(V.targetRef)});for(const V of X.dataInputAssociations??[])b(V.id),h.push({id:V.id,type:V.$type,source:qn((V.sourceRef??[])[0]),target:X.id})}I(q.artifacts??[])};if(n){const q=new Set;for(const ie of n.participants??[]){x(ie.id);const ce=qn(ie.processRef);ce&&q.add(ce);const oe=ce?i.get(ce):void 0,se=((oe==null?void 0:oe.laneSets)??[]).flatMap(V=>V.lanes??[]),X=se.map(V=>({id:V.id,...V.name?{name:V.name}:{}}));for(const V of X)x(V.id);const N=!oe||(oe.flowElements??[]).length===0&&se.length===0&&(oe.artifacts??[]).length===0;r.push({id:ie.id,...ie.name?{name:ie.name}:{},...N?{blackBox:!0}:{},...X.length?{lanes:X}:{}});const B=Cd(ie,"bwl:poolOrder");B!==void 0&&(l.poolOrders[ie.id]=B),oe&&P(oe,ie.id)}for(const ie of n.messageFlows??[])b(ie.id),f.push({id:ie.id,source:qn(ie.sourceRef),target:qn(ie.targetRef),...typeof ie.name=="string"&&ie.name?{name:ie.name}:{}});I(n.artifacts??[]);for(const[ie,ce]of i)!q.has(ie)&&(ce.flowElements??[]).length>0&&u.push({id:ie,type:ce.$type,reason:"unreachable-process"})}else for(const q of i.values())P(q);const j=[],F=[],L=[],H=[],re=(q,ie)=>!!q&&!!ie&&E.has(q)&&E.has(ie);for(const q of p){if(!re(q.source,q.target)){u.push({id:q.id,type:"bpmn:SequenceFlow",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 f){if(!re(q.source,q.target)){u.push({id:q.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}F.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(!re(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}H.push({...q.id?{id:q.id}:{},source:q.source,target:q.target}),q.id&&E.add(q.id)}for(const q of d){if(!re(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 Pe=new Map(c.map(q=>[q.id,q]));for(const{owner:q,refs:ie}of g){const ce=ie.filter(se=>S.has(se)),oe=Pe.get(q);oe&&ce.length&&(oe.members=ce)}for(const q of m)S.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,...F.length?{messageFlows:F}:{},...a.length?{dataStores:a}:{},...H.length?{dataAssociations:H}:{},...s.length?{annotations:s}:{},...L.length?{associations:L}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function dE(e){const{definitions:t,warnings:n}=await yu(e);return{...Ad(t),warnings:n}}function hE(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Td(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Rd(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 mE=Symbol("bpmn-editor");function gE(){const e=lt.ref(!1),t=lt.ref(!0),n=lt.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 Td(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:_u(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 ee(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function vE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Cu={exports:{}},Md;function yE(){if(Md)return Cu.exports;Md=1;var e=Cu.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},Cu.exports}var _E=yE(),bE=vE(_E);function Yn(e){if(!(this instanceof Yn))return new Yn(e);e=e||[128,36,1],this._seed=e.length?bE.rack(e[0],e[1],e[2]):e}Yn.prototype.next=function(e){return this._seed(e||!0)},Yn.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Yn.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Yn.prototype.assigned=function(e){return this._seed.get(e)||!1},Yn.prototype.unclaim=function(e){delete this._seed.hats[e]},Yn.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const Et={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};Et.td=Et.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],Et.option=Et.optgroup=[1,'<select multiple="multiple">',"</select>"],Et.thead=Et.tbody=Et.colgroup=Et.caption=Et.tfoot=[1,"<table>","</table>"],Et.polyline=Et.ellipse=Et.polygon=Et.circle=Et.text=Et.line=Et.path=Et.rect=Et.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Ke(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:p}=l;return p.remove(),p}let[r,o,a]=Object.hasOwn(Et,i)?Et[i]:Et._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:l}=s;return l.remove(),l}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function xE(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 Xt(e,...t){const n=e.style;return M(t,function(i){i&&M(i,function(r,o){n[o]=r})}),e}function Gt(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const EE=Object.prototype.toString;function Je(e){return new Ii(e)}function Ii(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ii.prototype.add=function(e){return this.list.add(e),this},Ii.prototype.remove=function(e){return EE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ii.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},Ii.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ii.prototype.array=function(){return Array.from(this.list)},Ii.prototype.has=Ii.prototype.contains=function(e){return this.list.contains(e)};function qa(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function gr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function wE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ya={},kd;function SE(){if(kd)return Ya;kd=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Ya.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Ya.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Ya}var Dd=SE(),RE=wE(Dd),me=xE({__proto__:null,default:RE},[Dd]),Od=["focus","blur"];function CE(e,t,n,i,r){return Od.indexOf(n)!==-1&&(r=!0),me.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=gr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function PE(e,t,n,i){return Od.indexOf(t)!==-1&&(i=!0),me.unbind(e,t,n,i)}var cn={bind:CE,unbind:PE};function Pu(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function He(e,t){return t=t||document,t.querySelector(e)}function Ka(e,t){return t=t||document,t.querySelectorAll(e)}function Kn(e){e.parentNode&&e.parentNode.removeChild(e)}function AE(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function TE(e,t){return t.appendChild(AE(e,t))}function ve(e,t){return TE(t,e),e}var Au=2,Id={"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":Au,"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":Au,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function ME(e,t){return Id[t]?e.style[t]:e.getAttributeNS(null,t)}function Ld(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Id[i];r?(r===Au&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function kE(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Ld(e,r,t[r])}function te(e,t,n){if(typeof t=="string")if(n!==void 0)Ld(e,t,n);else return ME(e,t);else kE(e,t);return e}const DE=Object.prototype.toString;function Ce(e){return new Li(e)}function Li(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Li.prototype.add=function(e){return this.list.add(e),this},Li.prototype.remove=function(e){return DE.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Li.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},Li.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Li.prototype.array=function(){return Array.from(this.list)},Li.prototype.has=Li.prototype.contains=function(e){return this.list.contains(e)};function Xa(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Nd(e){return e.cloneNode(!0)}var Tu={svg:"http://www.w3.org/2000/svg"},Bd='<svg xmlns="'+Tu.svg+'"';function OE(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Tu.svg)===-1&&(e=Bd+e.substring(4)):(e=Bd+">"+e+"</svg>",t=!0);var n=IE(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function IE(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function ae(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=OE(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Tu.svg,e),t&&te(n,t),n}var Mu=null;function $d(){return Mu===null&&(Mu=ae("svg")),Mu}function jd(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function LE(e,t,n,i,r,o){var a=$d().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return jd(a,e);case 6:return jd(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function To(e){return $d().createSVGTransform()}var Fd=/([&<>]{1})/g,NE=/([&<>\n\r"]{1})/g,BE={"&":"&","<":"<",">":">",'"':"'"};function ku(e,t){function n(i,r){return BE[r]||r}return e.replace(t,n)}function Hd(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(ku(e.textContent,Fd));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,'="',ku(o.value,NE),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Hd(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",ku(e.nodeValue,Fd),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function $E(e){for(var t=e.firstChild,n=[];t;)Hd(t,n),t=t.nextSibling;return n.join("")}function zd(e,t){return $E(e)}function wt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function jE(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function FE(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(jE(e,i))}function Mo(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),FE(n,t)),n.consolidate()}const HE=/^class[ {]/;function zE(e){return HE.test(e.toString())}function Du(e){return Array.isArray(e)}function Ou(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Za(...e){e.length===1&&Du(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const VE=/constructor\s*[^(]*\(\s*([^)]*)\)/m,GE=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,WE=/\/\*([^*]*)\*\//m;function UE(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(zE(e)?VE:GE);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(WE);return(r&&r[1]||i).trim()})||[]}function Vd(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 w=b.split(".");let A=c(w.shift());for(;w.length;)A=A[w.shift()];return A}if(Ou(o,b))return o[b];if(Ou(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(Du(b))b=Za(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const A=(b.$inject||UE(b)).map(I=>Ou(x,I)?x[I]:c(I));return{fn:b,dependencies:A}}function l(b){const{fn:x,dependencies:w}=u(b),A=Function.prototype.bind.call(x,null,...w);return new A}function p(b,x,w){const{fn:A,dependencies:I}=u(b,w);return A.apply(x,I)}function f(b){return Za(x=>b.get(x))}function d(b,x){if(x&&x.length){const w=Object.create(null),A=Object.create(null),I=[],P=[],j=[];let F,L,H,re;for(let Pe in r)F=r[Pe],x.indexOf(Pe)!==-1&&(F[2]==="private"?(L=I.indexOf(F[3]),L===-1?(H=F[3].createChild([],x),re=f(H),I.push(F[3]),P.push(H),j.push(re),w[Pe]=[re,Pe,"private",H]):w[Pe]=[j[L],Pe,"private",P[L]]):w[Pe]=[F[2],F[1]],A[Pe]=!0),(F[2]==="factory"||F[2]==="type")&&F[1].$scope&&x.forEach(et=>{F[1].$scope.indexOf(et)!==-1&&(w[Pe]=[F[2],F[1]],A[et]=!0)});x.forEach(Pe=>{if(!A[Pe])throw new Error('No provider for "'+Pe+'". Cannot use provider from the parent!')}),b.unshift(w)}return new Vd(b,a)}const h={factory:p,type:l,value:function(b){return b}};function m(b,x){const w=b.__init__||[];return function(){w.forEach(A=>{typeof A=="string"?x.get(A):x.invoke(A)})}}function g(b){const x=b.__exports__;if(x){const w=b.__modules__,A=Object.keys(b).reduce((L,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&(L[H]=b[H]),L),Object.create(null)),I=(w||[]).concat(A),P=d(I),j=Za(function(L){return P.get(L)});x.forEach(function(L){r[L]=[j,L,"private",P]});const F=(b.__init__||[]).slice();return F.unshift(function(){P.init()}),b=Object.assign({},b,{__init__:F}),m(b,P)}return Object.keys(b).forEach(function(w){if(w==="__init__"||w==="__depends__")return;const A=b[w];if(A[2]==="private"){r[w]=A;return}const I=A[0],P=A[1];r[w]=[h[I],qE(I,P),I]}),m(b,a)}function S(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(S,b),b.indexOf(x)!==-1)?b:b.concat(x)}function E(b){const x=b.reduce(S,[]).map(g);let w=!1;return function(){w||(w=!0,x.forEach(A=>A()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=E(e)}function qE(e,t){return e!=="value"&&Du(t)&&(t=Za(t.slice())),t}var YE=1e3;function pi(e,t){var n=this;t=t||YE,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)})}pi.prototype.canRender=function(e){},pi.prototype.drawShape=function(e,t){},pi.prototype.drawConnection=function(e,t){},pi.prototype.getShapePath=function(e){},pi.prototype.getConnectionPath=function(e){};function vr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function KE(e){return["M",e.x,e.y]}function Iu(e){return["L",e.x,e.y]}function XE(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function ZE(e,t){const n=e.length,i=[KE(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(Iu(a));continue}const c=Math.min(t,Lu(a.x-o.x,a.y-o.y),Lu(s.x-a.x,s.y-a.y));if(!c){i.push(Iu(a));continue}const u=Qa(a,o,c),l=Qa(a,o,c*.5),p=Qa(a,s,c),f=Qa(a,s,c*.5);i.push(Iu(u)),i.push(XE(l,f,p))}return i}function Qa(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Lu(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Lu(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ko(e,t,n){he(t)&&(n=t,t=null),t||(t={});const i=ae("path",t);return he(n)&&(i.dataset.cornerRadius=String(n)),Nu(i,e)}function Nu(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return te(e,{d:vr(ZE(t,n))}),e}function Ja(e){var t=new Set(e);return we(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function yr(e,t,n){n=n||0,pe(e)||(e=[e]),M(e,function(i,r){var o=t(i,r,n);pe(o)&&o.length&&yr(o,t,n+1)})}function Bu(e,t,n){var i=new Set,r=new Set;return yr(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 Do(e,t){return Bu(e)}function QE(e,t,n){lr(t)&&(t=!0),At(t)&&(n=t,t=!0),n=n||{};var i=Oo(n.allShapes),r=Oo(n.allConnections),o=Oo(n.enclosedElements),a=Oo(n.enclosedConnections),s=Oo(n.topLevel,t&&$r(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,M(l.incoming,c),M(l.outgoing,c),l.children}return yr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function pt(e,t){t=!!t,pe(e)||(e=[e]);var n,i,r,o;return M(e,function(a){var s=a;a.waypoints&&!t&&(s=pt(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 Vr(e,t){var n={};return M(e,function(i){var r=i;r.waypoints&&(r=pt(r)),!he(t.y)&&r.x>t.x&&(n[i.id]=i),!he(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(he(t.width)&&he(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!he(t.width)||!he(t.height))&&(n[i.id]=i)}),n}function Gd(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Wd(e){return!!(e&&e.isFrame)}function Oo(e,t){return D({},e||{},t||{})}var JE=1;function Ni(e,t){pi.call(this,e,JE),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})}ee(Ni,pi),Ni.prototype.canRender=function(){return!0},Ni.prototype.drawShape=function(t,n,i){var r=ae("rect");return te(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Wd(n)?te(r,D({},this.FRAME_STYLE,i||{})):te(r,D({},this.SHAPE_STYLE,i||{})),ve(t,r),r},Ni.prototype.drawConnection=function(t,n,i){var r=ko(n.waypoints,D({},this.CONNECTION_STYLE,i||{}));return ve(t,r),r},Ni.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 vr(a)},Ni.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 vr(o)},Ni.$inject=["eventBus","styles"];function ew(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return D(o,{class:n})},this.style=function(n,i){!pe(n)&&!i&&(i=n,n=[]);var r=sn(n,function(o,a){return D(o,e[a]||{})},{});return i?D(r,i):r},this.computeStyle=function(n,i,r){return pe(i)||(r=i,i=[]),t.style(i||[],D({},r,n||{}))}}const tw={__init__:["defaultRenderer"],defaultRenderer:["type",Ni],styles:["type",ew]};function at(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function ct(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 $u(e,t){return!e||!t?-1:e.indexOf(t)}function Io(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ju(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=Io(e,t);return Math.abs(r/o)<=i}var nw=2;function fi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(iw(r,n))return o;return!1}function iw(e,t){const n=t[0];return pr(t,function(i){return Math.abs(n[e]-i[e])<=nw})}function Ud(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 Fu(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var rw=/,?([a-z]),?/gi,qd=parseFloat,ft=Math,Bi=ft.PI,Xn=ft.min,Zn=ft.max,Yd=ft.pow,$i=ft.abs,ow=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,aw=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,Kd=Array.isArray||function(e){return e instanceof Array};function sw(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function cw(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 uw(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 sw(r,i)?(cw(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function lw(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(ow,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(aw,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=zu,n}function pw(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 fw(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 Hu(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 zu(){return this.join(",").replace(rw,"$1")}function dw(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=zu,t}function Xd(e,t,n,i,r,o,a,s,c){var u=1-c,l=Yd(u,3),p=Yd(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:es(h),y:es(m)}}function Zd(e){var t=_w(...e);return Hu(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function ji(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function hw(e,t){return e=Hu(e),t=Hu(t),ji(t,e.x,e.y)||ji(t,e.x2,e.y)||ji(t,e.x,e.y2)||ji(t,e.x2,e.y2)||ji(e,t.x,t.y)||ji(e,t.x2,t.y)||ji(e,t.x,t.y2)||ji(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 Qd(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 Jd(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=Qd(m,e,n,r,a),S=Qd(m,t,i,o,s),E=g*g+S*S;d+=f[h]*ft.sqrt(E)}return u*d}function mw(e,t,n,i,r,o,a,s){if(!(Zn(e,n)<Xn(r,a)||Xn(e,n)>Zn(r,a)||Zn(t,i)<Xn(o,s)||Xn(t,i)>Zn(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=es(c/l),f=es(u/l),d=+p.toFixed(2),h=+f.toFixed(2);if(!(d<+Xn(e,n).toFixed(2)||d>+Zn(e,n).toFixed(2)||d<+Xn(r,a).toFixed(2)||d>+Zn(r,a).toFixed(2)||h<+Xn(t,i).toFixed(2)||h>+Zn(t,i).toFixed(2)||h<+Xn(o,s).toFixed(2)||h>+Zn(o,s).toFixed(2)))return{x:p,y:f}}}}function es(e){return Math.round(e*1e11)/1e11}function gw(e,t,n){var i=Zd(e),r=Zd(t);if(!hw(i,r))return[];var o=Jd(...e),a=Jd(...t),s=th(e)?1:~~(o/5)||1,c=th(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=Xd(...e,d/s);u[d]={x:m.x,y:m.y,t:d/s}}for(d=0;d<c+1;d++)m=Xd(...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],S=u[d+1],E=l[h],b=l[h+1],x=$i(S.x-g.x)<.01?"y":"x",w=$i(b.x-E.x)<.01?"y":"x",A=mw(g.x,g.y,S.x,S.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 P=g.t+$i((A[x]-g[x])/(S[x]-g[x]))*(S.t-g.t),j=E.t+$i((A[w]-E[w])/(b[w]-E[w]))*(b.t-E.t);P>=0&&P<=1&&j>=0&&j<=1&&f.push({x:A.x,y:A.y,t1:P,t2:j})}}return f}function eh(e,t,n){e=rh(e),t=rh(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 S=0,E=t.length;S<E;S++){var b=t[S];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=gw(p,f);{for(var w=0,A=x.length;w<A;w++)x[w].segment1=h,x[w].segment2=S,x[w].bez1=p,x[w].bez2=f;d=d.concat(x)}}}}}return d}function vw(e){return Kd(e)&&Kd(e[0])}function yw(e){if(pw(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=zu,t}function th(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function ts(e,t,n,i){return[e,t,n,i,n,i]}function nh(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 ih(e,t,n,i,r,o,a,s,c,u){var l=Bi*120/180,p=Bi/180*(+r||0),f=[],d,h=uw(function(C,_,v){var k=C*ft.cos(v)-_*ft.sin(v),O=C*ft.sin(v)+_*ft.cos(v);return{x:k,y:O}});if(u)I=u[0],P=u[1],w=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,S=m*m/(n*n)+g*g/(i*i);S>1&&(S=ft.sqrt(S),n=S*n,i=S*i);var E=n*n,b=i*i,x=(o==a?-1:1)*ft.sqrt($i((E*b-E*g*g-b*m*m)/(E*g*g+b*m*m))),w=x*n*g/i+(e+s)/2,A=x*-i*m/n+(t+c)/2,I=ft.asin(((t-A)/i).toFixed(9)),P=ft.asin(((c-A)/i).toFixed(9));I=e<w?Bi-I:I,P=s<w?Bi-P:P,I<0&&(I=Bi*2+I),P<0&&(P=Bi*2+P),a&&I>P&&(I=I-Bi*2),!a&&P>I&&(P=P-Bi*2)}var j=P-I;if($i(j)>l){var F=P,L=s,H=c;P=I+l*(a&&P>I?1:-1),s=w+n*ft.cos(P),c=A+i*ft.sin(P),f=ih(s,c,n,i,r,0,a,L,H,[P,F,w,A])}j=P-I;var re=ft.cos(I),Pe=ft.sin(I),et=ft.cos(P),q=ft.sin(P),ie=ft.tan(j/4),ce=4/3*n*ie,oe=4/3*i*ie,se=[e,t],X=[e+ce*Pe,t-oe*re],N=[s+ce*q,c-oe*et],B=[s,c];if(X[0]=2*se[0]-X[0],X[1]=2*se[1]-X[1],u)return[X,N,B].concat(f);f=[X,N,B].concat(f).join().split(",");for(var V=[],xe=0,Ct=f.length;xe<Ct;xe++)V[xe]=xe%2?h(f[xe-1],f[xe],p).y:h(f[xe],f[xe+1],p).x;return V}function _w(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,h,m,g,S,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),$i(l)<1e-12){if($i(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}g=p*p-4*f*l,S=ft.sqrt(g),!(g<0)&&(h=(-p+S)/(2*l),0<h&&h<1&&c.push(h),m=(-p-S)/(2*l),0<m&&m<1&&c.push(m))}for(var b=c.length,x=b,w;b--;)d=c[b],w=1-d,u[0][b]=w*w*w*e+3*w*w*d*n+3*w*d*d*r+d*d*d*a,u[1][b]=w*w*w*t+3*w*w*d*i+3*w*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:Xn(...u[0]),y0:Xn(...u[1]),x1:Zn(...u[0]),y1:Zn(...u[1])}}function rh(e){if(vw(e)||(e=lw(e)),fw(e))return e;for(var t=dw(yw(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",...ih(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",...nh(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",...nh(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...ts(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...ts(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...ts(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...ts(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=qd(l[p-4])||n.x,n.by=qd(l[p-3])||n.y}return t}function Ve(e){return At(e)&&an(e,"waypoints")}function be(e){return At(e)&&an(e,"labelTarget")}function bw(e){return At(e)&&Nr(e.parent)}function oh(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function di(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 ns(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function xw(e){return di({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function Ew(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=Rw(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 Ve(e)?Ew(e):xw(e)}function Lt(e,t,n){n=n||0,At(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 Lo(e,t,n){var i=ww(e,t);return i.length===1||i.length===2&&Io(i[0],i[1])<1?di(i[0]):i.length>1?(i=Gn(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),di(i[n?0:i.length-1])):null}function ww(e,t){return eh(e,t)}function Sw(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],Io(n,r)===0||ju(i,r,n)?e.splice(t,1):t++;return e}function Rw(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function is(e,t){return Math.round(e*t)/t}function ah(e){return he(e)?e+"px":e}function Cw(e){for(;e.parent;)e=e.parent;return e}function Pw(e){e=D({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Xt(n,{position:"relative",overflow:"hidden",width:ah(e.width),height:ah(e.height)}),t.appendChild(n),n}function sh(e,t,n){const i=ae("g");Ce(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const Aw="base",ch=0,Tw=1,Mw={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=Pw(e),i=this._svg=ae("svg");te(i,{width:"100%",height:"100%"}),Gt(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")}),ve(n,i);const r=this._viewport=sh(i,"viewport");e.deferUpdate&&(this._viewboxChanged=ou(this._viewboxChanged,300)),this._restoreFocus=ou(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=Gd(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(Aw,ch)},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 sn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},de.prototype._createLayer=function(e,t){typeof t>"u"&&(t=Tw);const n=this._getChildIndex(t);return{group:sh(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&&(wt(n),t.visible=!1),n},de.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],wt(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(Cw(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 qe(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&&(M([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Ce(r).add(t)):(e.markers.delete(t),Ce(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,ch);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=Mw[e];if(!pr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},de.prototype._setParent=function(e,t,n){ct(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),at(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);Mo(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Mo(t),r=a?a.matrix:LE(),s=is(r.a,1e3),c=is(-r.e||0,1e3),u=is(-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=D({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),uh(t,n)}),{x:n.e,y:n.f}},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=pt(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),S=Math.min(0,s.top-f.top);l=h||m,p=g||S}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)}),is(i.a,1e3)};function uh(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}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=D(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/p*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),uh(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 Gr="data-element-id";function _n(e){this._elements={},this._eventBus=e}_n.$inject=["eventBus"],_n.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),te(t,Gr,i),n&&te(n,Gr,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},_n.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(te(i.gfx,Gr,""),i.secondaryGfx&&te(i.secondaryGfx,Gr,""),delete t[n])},_n.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)},_n.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&te(t,Gr,i),t},_n.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&te(e,Gr);var n=this._elements[t];return n&&n.element},_n.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},_n.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}},_n.prototype.getAll=function(){return this.filter(function(e){return e})},_n.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)})},_n.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},_n.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 kw(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 Dw(e){return e.__refs_collection===!0}function Ow(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function lh(e,t,n){var i=kw(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 Iw(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 Sn(e,t){if(!(this instanceof Sn))return new Sn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Sn.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?lh(this,t,e):Iw(this,t,e)},Sn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return Dw(n)||lh(this,t,e),n},Sn.prototype.ensureBound=function(e,t){Ow(e,t)||this.bind(e,t)},Sn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Sn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Vu=new Sn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),ph=new Sn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),fh=new Sn({name:"attachers",collection:!0},{name:"host"}),dh=new Sn({name:"outgoing",collection:!0},{name:"source"}),hh=new Sn({name:"incoming",collection:!0},{name:"target"});function Wr(){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)}}),Vu.bind(this,"parent"),ph.bind(this,"labels"),dh.bind(this,"outgoing"),hh.bind(this,"incoming")}function No(){Wr.call(this),Vu.bind(this,"children"),fh.bind(this,"host"),fh.bind(this,"attachers")}ee(No,Wr);function mh(){Wr.call(this),Vu.bind(this,"children")}ee(mh,No);function gh(){No.call(this),ph.bind(this,"labelTarget")}ee(gh,No);function vh(){Wr.call(this),dh.bind(this,"source"),hh.bind(this,"target")}ee(vh,Wr);var Lw={connection:vh,shape:No,label:gh,root:mh};function Nw(e,t){var n=Lw[e];if(!n)throw new Error("unknown type: <"+e+">");return D(new n,t)}function Bw(e){return e instanceof Wr}function hi(){this._uid=12}hi.prototype.createRoot=function(e){return this.create("root",e)},hi.prototype.createLabel=function(e){return this.create("label",e)},hi.prototype.createShape=function(e){return this.create("shape",e)},hi.prototype.createConnection=function(e){return this.create("connection",e)},hi.prototype.create=function(e,t){return t=D({},t||{}),t.id||(t.id=e+"_"+this._uid++),Nw(e,t)};var rs="__fn",yh=1e3,$w=Array.prototype.slice;function un(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}un.prototype.on=function(e,t,n,i){if(e=pe(e)?e:[e],Tt(t)&&(i=n,n=t,t=yh),!he(t))throw new Error("priority must be a number");var r=n;i&&(r=en(n,i),r[rs]=n[rs]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},un.prototype.once=function(e,t,n,i){var r=this;if(Tt(t)&&(i=n,n=t,t=yh),!he(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[rs]=n,this.on(e,t,o)},un.prototype.off=function(e,t){e=pe(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},un.prototype.createEvent=function(e){var t=new Bo;return t.init(e),t},un.prototype.fire=function(e,t){var n,i,r,o;if(o=$w.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 Bo?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}},un.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},un.prototype._destroy=function(){this._listeners={}},un.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},un.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=jw(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},un.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},un.prototype._getListeners=function(e){return this._listeners[e]},un.prototype._setListeners=function(e,t){this._listeners[e]=t},un.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[rs]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Bo(){}Bo.prototype.stopPropagation=function(){this.cancelBubble=!0},Bo.prototype.preventDefault=function(){this.defaultPrevented=!0},Bo.prototype.init=function(e){D(this,e||{})};function jw(e,t){return e.apply(null,t)}function _r(e){return e.childNodes[0]}function Fw(e){return e.parentNode.childNodes[1]}function os(e,t,n,i,r){var o=To();o.setTranslate(t,n);var a=To();a.setRotate(i||0,0,0);var s=To();s.setScale(1,1),Mo(e,[o,a,s])}function Nt(e,t,n){var i=To();i.setTranslate(t,n),Mo(e,i)}function _h(e,t){var n=To();n.setRotate(t,0,0),Mo(e,n)}function bn(e,t){this._eventBus=e,this._elementRegistry=t}bn.$inject=["eventBus","elementRegistry"],bn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=Fw(t),n||(n=ae("g"),Ce(n).add("djs-children"),ve(t.parentNode,n))):n=t,n},bn.prototype._clear=function(e){var t=_r(e);return qa(t),t},bn.prototype._createContainer=function(e,t,n,i){var r=ae("g");Ce(r).add("djs-group"),typeof n<"u"?Hw(r,t,t.childNodes[n]):ve(t,r);var o=ae("g");Ce(o).add("djs-element"),Ce(o).add("djs-"+e),i&&Ce(o).add("djs-frame"),ve(r,o);var a=ae("g");return Ce(a).add("djs-visual"),ve(o,a),o},bn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Wd(t))},bn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=sn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),M(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;M(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},bn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},bn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},bn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},bn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},bn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),Nt(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?te(n,"display","none"):te(n,"display","block")}},bn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);wt(t.parentNode)};function Hw(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const zw={__depends__:[tw],__init__:["canvas"],canvas:["type",de],elementRegistry:["type",_n],elementFactory:["type",hi],eventBus:["type",un],graphicsFactory:["type",bn]};function Vw(e){var t=new Vd(e);return t.init(),t}function Gw(e){e=e||{};var t={config:["value",e]},n=[t,zw].concat(e.modules||[]);return Vw(n)}function Fi(e,t){this._injector=t||Gw(e),this.get("eventBus").fire("diagram.init")}Fi.prototype.get=function(e,t){return this._injector.get(e,t)},Fi.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Fi.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Fi.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Wt(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function tn(e,t){return e.$instanceOf(t)}function Ww(e){return qe(e.rootElements,function(t){return tn(t,"bpmn:Process")||tn(t,"bpmn:Collaboration")})}function Uw(e){var t={},n=[],i={};function r(N,B){return function(V){N(V,B)}}function o(N){t[N.id]=N}function a(N){return t[N.id]}function s(N,B){var V=N.gfx;if(V)throw new Error(`already rendered ${Wt(N)}`);return e.element(N,i[N.id],B)}function c(N,B){return e.root(N,i[N.id],B)}function u(N,B){try{var V=i[N.id]&&s(N,B);return o(N),V}catch(xe){l(xe.message,{element:N,error:xe}),console.error(`failed to import ${Wt(N)}`,xe)}}function l(N,B){e.error(N,B)}var p=this.registerDi=function(B){var V=B.bpmnElement;V?i[V.id]?l(`multiple DI elements defined for ${Wt(V)}`,{element:V}):i[V.id]=B:l(`no bpmnElement referenced in ${Wt(B)}`,{element:B})};function f(N){d(N.plane)}function d(N){p(N),M(N.planeElement,h)}function h(N){p(N)}this.handleDefinitions=function(B,V){var xe=B.diagrams;if(V&&xe.indexOf(V)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!V&&xe&&xe.length&&(V=xe[0]),!V)throw new Error("no diagram to display");i={},f(V);var Ct=V.plane;if(!Ct)throw new Error(`no plane for ${Wt(V)}`);var C=Ct.bpmnElement;if(!C)if(C=Ww(B),C)l(`correcting missing bpmnElement on ${Wt(Ct)} to ${Wt(C)}`),Ct.bpmnElement=C,p(Ct);else throw new Error("no process or collaboration to display");var _=c(C,Ct);if(tn(C,"bpmn:Process")||tn(C,"bpmn:SubProcess"))g(C,_);else if(tn(C,"bpmn:Collaboration"))se(C,_),S(B.rootElements,_);else throw new Error(`unsupported bpmnElement for ${Wt(Ct)}: ${Wt(C)}`);m(n)};var m=this.handleDeferred=function(){for(var B;n.length;)B=n.shift(),B()};function g(N,B){ie(N,B),j(N.ioSpecification,B),P(N.artifacts,B),o(N)}function S(N,B){var V=we(N,function(xe){return!a(xe)&&tn(xe,"bpmn:Process")&&xe.laneSets});V.forEach(r(g,B))}function E(N,B){u(N,B)}function b(N,B){M(N,r(E,B))}function x(N,B){u(N,B)}function w(N,B){u(N,B)}function A(N,B){u(N,B)}function I(N,B){u(N,B)}function P(N,B){M(N,function(V){tn(V,"bpmn:Association")?n.push(function(){I(V,B)}):I(V,B)})}function j(N,B){N&&(M(N.dataInputs,r(w,B)),M(N.dataOutputs,r(A,B)))}var F=this.handleSubProcess=function(B,V){ie(B,V),P(B.artifacts,V)};function L(N,B){var V=u(N,B);tn(N,"bpmn:SubProcess")&&F(N,V||B),tn(N,"bpmn:Activity")&&j(N.ioSpecification,B),n.push(function(){M(N.dataInputAssociations,r(x,B)),M(N.dataOutputAssociations,r(x,B))})}function H(N,B){u(N,B)}function re(N,B){u(N,B)}function Pe(N,B){n.push(function(){var V=u(N,B);N.childLaneSet&&et(N.childLaneSet,V||B),X(N)})}function et(N,B){M(N.lanes,r(Pe,B))}function q(N,B){M(N,r(et,B))}function ie(N,B){ce(N.flowElements,B),N.laneSets&&q(N.laneSets,B)}function ce(N,B){M(N,function(V){tn(V,"bpmn:SequenceFlow")?n.push(function(){H(V,B)}):tn(V,"bpmn:BoundaryEvent")?n.unshift(function(){L(V,B)}):tn(V,"bpmn:FlowNode")?L(V,B):tn(V,"bpmn:DataObject")||(tn(V,"bpmn:DataStoreReference")||tn(V,"bpmn:DataObjectReference")?re(V,B):l(`unrecognized flowElement ${Wt(V)} in context ${Wt(B&&B.businessObject)}`,{element:V,context:B}))})}function oe(N,B){var V=u(N,B),xe=N.processRef;xe&&g(xe,V||B)}function se(N,B){M(N.participants,r(oe,B)),n.push(function(){b(N.messageFlows,B)}),P(N.artifacts,B)}function X(N){M(N.flowNodeRef,function(B){var V=B.get("lanes");V&&V.push(N)})}}function y(e,t){var n=U(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Ee(e,t){return Pi(t,function(n){return y(e,n)})}function U(e){return e&&e.businessObject||e}function Me(e){return e&&e.di}function qw(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,S){return i.add(m,g,S)},error:function(m,g){s.push({message:m,context:g})}},f=new Uw(p);l=l||u.diagrams&&u.diagrams[0];var d=Yw(u,l);if(!d)throw new Error("no diagram to display");M(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 Yw(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!y(n,"bpmn:Process")&&!y(n,"bpmn:Collaboration")&&(i=Kw(n));var r;y(i,"bpmn:Collaboration")?r=i:r=qe(e.rootElements,function(u){if(y(u,"bpmn:Collaboration"))return qe(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=Ht(r.participants,function(u){return u.processRef}),o.push(r));var a=bh(o),s=[t],c=[n];return M(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 bh(e){var t=[];return M(e,function(n){n&&(t.push(n),t=t.concat(bh(n.flowElements)))}),t}function Kw(e){for(var t=e;t;){if(y(t,"bpmn:Process"))return t;t=t.$parent}}var Xw='<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>',xh=Xw,Eh={verticalAlign:"middle"},wh={color:"#404040"},Zw={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},Qw={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},Jw={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"},e1='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+xh+'</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>',Qn;function t1(){Qn=Ke(e1),Xt(Qn,Zw),Xt(He("svg",Qn),Eh),Xt(He(".backdrop",Qn),Qw),Xt(He(".notice",Qn),Jw),Xt(He(".link",Qn),wh,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function n1(){Qn||(t1(),cn.bind(Qn,".backdrop","click",function(e){document.body.removeChild(Qn)})),document.body.appendChild(Qn)}const as=5,Sh="djs-outline-hidden";function tt(e){e=D({},r1,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),a1(this._container)}ee(tt,Fi),tt.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||[]),ss(s,o),s=i1(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},tt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},tt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw ss(o,[]),o}if(typeof t=="string"&&(i=o1(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw ss(o,[]),o}try{this.clear()}catch(o){throw ss(o,[]),o}const{warnings:r}=await qw(this,n,i);return{warnings:r}},tt.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},tt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=He(":scope > defs",i._svg),a=zd(r),s=o?"<defs>"+zd(o)+"</defs>":"",c=i.getContainer();Je(c).add(Sh);let u;try{u=r.getBBox()}finally{Je(c).remove(Sh)}const l=u.x-as,p=u.y-as,f=u.width+as*2,d=u.height+as*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
7
7
|
<!-- created with bpmn-js / http://bpmn.io -->
|
|
8
8
|
<!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}},tt.prototype._setDefinitions=function(e){this._definitions=e},tt.prototype.getModules=function(){return this._modules},tt.prototype.clear=function(){this.getDefinitions()&&Fi.prototype.clear.call(this)},tt.prototype.destroy=function(){Fi.prototype.destroy.call(this),Xn(this._container)},tt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},tt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},tt.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=Fe(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},tt.prototype.getDefinitions=function(){return this._definitions},tt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},tt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=D(Un(n,["additionalModules"]),{canvas:D({},n.canvas,{container:e}),modules:a});Fi.call(this,s),n&&n.container&&this.attachTo(n.container)},tt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},tt.prototype._createContainer=function(e){const t=Ke('<div class="bjs-container"></div>');return Xt(t,{width:wh(e.width),height:wh(e.height),position:e.position}),t},tt.prototype._createModdle=function(e){const t=D({},this._moddleExtensions,e.moddleExtensions);return new Vf(t)},tt.prototype._modules=[];function os(e,t){return e.warnings=t,e}function Yw(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 Kw={width:"100%",height:"100%",position:"relative"};function wh(e){return e+(de(e)?"px":"")}function Xw(e,t){return t&&qe(e.diagrams,function(n){return n.id===t})||null}function Zw(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+_h+"</a>",i=Ke(n);Xt(Fe("svg",i),bh),Xt(i,xh,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),he.bind(i,"click",function(r){qw(),r.preventDefault()})}function Ur(e){tt.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)}J(Ur,tt),Ur.prototype._createModdle=function(e){var t=tt.prototype._createModdle.call(this,e);return t.ids=new Kn([32,36,1]),t},Ur.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 Re(e,t){return y(e,"bpmn:CallActivity")?!1:y(e,"bpmn:SubProcess")?(t=t||Me(e),t&&y(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):y(e,"bpmn:Participant")?!!U(e).processRef:!0}function kt(e){if(!(!y(e,"bpmn:Participant")&&!y(e,"bpmn:Lane"))){var t=Me(e).isHorizontal;return t===void 0?!0:t}}function Qw(e){return e&&U(e).isInterrupting!==!1}function Ut(e){return e&&!!U(e).triggeredByEvent}function qr(e,t){var n=U(e).eventDefinitions;return Pi(n,function(i){return y(i,t)})}function Jw(e){return qr(e,"bpmn:ErrorEventDefinition")}function e1(e){return qr(e,"bpmn:EscalationEventDefinition")}function t1(e){return qr(e,"bpmn:CompensateEventDefinition")}var br={width:90,height:20},Sh=15;function Hi(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 as(e){return be(e.label)}function n1(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=i1(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-=Sh:a+=Sh,{x:a,y:s}}function i1(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 Vu(e){return e.waypoints?n1(e.waypoints):y(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+br.height/2}:{x:e.x+e.width/2,y:e.y+e.height+br.height/2}}function r1(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(br.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Vu(t),i=br),D({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Rh(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 o1(e){var t=e.categoryValueRef;return t&&t.value||""}function bn(e){var t=e.businessObject,n=Rh(t);if(n)return n==="categoryValueRef"?o1(t):t[n]||""}function a1(e,t){var n=e.businessObject,i=Rh(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function s1(e){return be(e)&&Hi(e.labelTarget)}var Yr=7;function Ch(e){let t=[];return T(e.incoming,n=>{y(n,"bpmn:Association")&&y(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),T(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 T(Nu(e),n=>{T(Ch(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%)",c1="white";function ei(e,t){return Pi(e.eventDefinitions,function(n){return n.$type===t})}function u1(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function l1(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Se(e,t,n){var i=Me(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||c1}function Q(e,t,n){var i=Me(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Gu}function jo(e,t,n,i){var r=Me(e),o=r.get("label");return i||o&&o.get("color:color")||t||Q(e,n)}function Ph(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 vr(r)}function Wu(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 vr(a)}function p1(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 vr(s)}function f1(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 vr(o)}function Fo(e,t={}){return{width:Rn(e,t),height:cn(e,t)}}function Rn(e,t={}){return rn(t,"width")?t.width:e.width}function cn(e,t={}){return rn(t,"height")?t.height:e.height}var d1=new Kn,h1=10,ss=3,m1=1.5,cs=10,g1=4,Kr=.95,v1=1,y1=.25;function xr(e,t,n,i,r,o,a){pi.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:k=1,element:O,parentGfx:z=r._svg}=_,ie=ae("marker",{id:R,viewBox:"0 0 20 20",refX:v.x,refY:v.y,markerWidth:20*k,markerHeight:20*k,orient:"auto"});ve(ie,O);var _e=Fe(":scope > defs",z);_e||(_e=ae("defs"),ve(z,_e)),ve(_e,ie)}function d(R,_,v,k){var O=d1.nextPrefixed("marker-");return h(R,O,_,v,k),"url(#"+O+")"}function h(R,_,v,k,O){if(v==="sequenceflow-end"){var z=ae("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 ie=ae("circle",{cx:6,cy:6,r:3.5,...l({fill:k,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:ie,ref:{x:6,y:6},parentGfx:R})}if(v==="messageflow-end"){var _e=ae("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:k,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:_e,ref:{x:8.5,y:5},parentGfx:R})}if(v==="association-start"){var Ie=ae("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 ot=ae("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:ot,ref:{x:11,y:10},scale:.5,parentGfx:R})}if(v==="conditional-flow-marker"){var He=ae("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:k,stroke:O})});f(_,{element:He,ref:{x:-1,y:10},scale:.5,parentGfx:R})}if(v==="conditional-default-flow-marker"){var ct=ae("path",{d:"M 6 4 L 10 16",...l({stroke:O,fill:"none"})});f(_,{element:ct,ref:{x:0,y:10},scale:.5,parentGfx:R})}}function m(R,_,v,k,O={}){At(k)&&(O=k,k=0),k=k||0,O=l(O);var z=_/2,ie=v/2,_e=ae("circle",{cx:z,cy:ie,r:Math.round((_+v)/4-k),...O});return ve(R,_e),_e}function g(R,_,v,k,O,z){At(O)&&(z=O,O=0),O=O||0,z=l(z);var ie=ae("rect",{x:O,y:O,width:_-O*2,height:v-O*2,rx:k,ry:k,...z});return ve(R,ie),ie}function w(R,_,v,k){var O=_/2,z=v/2,ie=[{x:O,y:0},{x:_,y:z},{x:O,y:v},{x:0,y:z}],_e=ie.map(function(ot){return ot.x+","+ot.y}).join(" ");k=l(k);var Ie=ae("polygon",{...k,points:_e});return ve(R,Ie),Ie}function E(R,_,v,k){v=p(v);var O=ko(_,v,k);return ve(R,O),O}function b(R,_,v){return E(R,_,v,5)}function x(R,_,v){v=p(v);var k=ae("path",{...v,d:_});return ve(R,k),k}function S(R,_,v,k){return x(_,v,D({"data-marker":R},k))}function A(R){return Ct[R]}function I(R){return function(_,v,k){return A(R)(_,v,k)}}var P={"bpmn:MessageEventDefinition":function(R,_,v={},k){var O=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.235,my:.315}}),z=k?Q(_,c,v.stroke):Se(_,s,v.fill),ie=k?Se(_,s,v.fill):Q(_,c,v.stroke),_e=x(R,O,{fill:z,stroke:ie,strokeWidth:1});return _e},"bpmn:TimerEventDefinition":function(R,_,v={}){var k=v.width||_.width,O=v.height||_.height,z=v.width?1:2,ie=m(R,k,O,.2*O,{fill:Se(_,s,v.fill),stroke:Q(_,c,v.stroke),strokeWidth:z}),_e=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:O,position:{mx:.5,my:.5}});x(R,_e,{stroke:Q(_,c,v.stroke),strokeWidth:z});for(var Ie=0;Ie<12;Ie++){var ot=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:O,position:{mx:.5,my:.5}}),He=k/2,ct=O/2;x(R,ot,{strokeWidth:1,stroke:Q(_,c,v.stroke),transform:"rotate("+Ie*30+","+ct+","+He+")"})}return ie},"bpmn:EscalationEventDefinition":function(R,_,v={},k){var O=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),z=k?Q(_,c,v.stroke):Se(_,s,v.fill);return x(R,O,{fill:z,stroke:Q(_,c,v.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(R,_,v={}){var k=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.222}});return x(R,k,{fill:Se(_,s,v.fill),stroke:Q(_,c,v.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(R,_,v={},k){var O=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),z=k?Q(_,c,v.stroke):Se(_,s,v.fill);return x(R,O,{fill:z,stroke:Q(_,c,v.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(R,_,v={},k){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=k?Q(_,c,v.stroke):Se(_,s,v.fill);return x(R,O,{fill:z,stroke:Q(_,c,v.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(R,_,v={},k){var O=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),z=k?Q(_,c,v.stroke):"none",ie=x(R,O,{fill:z,stroke:Q(_,c,v.stroke),strokeWidth:1});return vh(ie,45),ie},"bpmn:CompensateEventDefinition":function(R,_,v={},k){var O=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.22,my:.5}}),z=k?Q(_,c,v.stroke):Se(_,s,v.fill);return x(R,O,{fill:z,stroke:Q(_,c,v.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(R,_,v={},k){var O=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),z=k?Q(_,c,v.stroke):Se(_,s,v.fill);return x(R,O,{strokeWidth:1,fill:z,stroke:Q(_,c,v.stroke)})},"bpmn:MultipleEventDefinition":function(R,_,v={},k){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=k?Q(_,c,v.stroke):Se(_,s,v.fill);return x(R,O,{fill:z,stroke:Q(_,c,v.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(R,_,v={}){var k=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,k,{fill:Se(_,s,v.fill),stroke:Q(_,c,v.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(R,_,v={}){var k=m(R,_.width,_.height,8,{fill:Q(_,c,v.stroke),stroke:Q(_,c,v.stroke),strokeWidth:4});return k}};function $(R,_,v={},k){var O=U(R),z=u1(O),ie=k||R;return O.get("eventDefinitions")&&O.get("eventDefinitions").length>1?O.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](_,ie,v,z):P["bpmn:MultipleEventDefinition"](_,ie,v,z):ei(O,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](_,ie,v,z):ei(O,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](_,ie,v,z):ei(O,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](_,ie,v,z):ei(O,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](_,ie,v,z):ei(O,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](_,ie,v,z):ei(O,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](_,ie,v,z):ei(O,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](_,ie,v,z):ei(O,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](_,ie,v,z):ei(O,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](_,ie,v,z):ei(O,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](_,ie,v,z):null}var j={ParticipantMultiplicityMarker:function(R,_,v={}){var k=Rn(_,v),O=cn(_,v),z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2-6)/k,my:(O-15)/O}});S("participant-multiplicity",R,z,{strokeWidth:2,fill:Se(_,s,v.fill),stroke:Q(_,c,v.stroke)})},SubProcessMarker:function(R,_,v={}){var k=g(R,14,14,0,{strokeWidth:1,fill:Se(_,s,v.fill),stroke:Q(_,c,v.stroke)});Nt(k,_.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:Se(_,s,v.fill),stroke:Q(_,c,v.stroke)})},ParallelMarker:function(R,_,v){var k=Rn(_,v),O=cn(_,v),z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2+v.parallel)/k,my:(O-20)/O}});S("parallel",R,z,{fill:Se(_,s,v.fill),stroke:Q(_,c,v.stroke)})},SequentialMarker:function(R,_,v){var k=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,k,{fill:Se(_,s,v.fill),stroke:Q(_,c,v.stroke)})},CompensationMarker:function(R,_,v){var k=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,k,{strokeWidth:1,fill:Se(_,s,v.fill),stroke:Q(_,c,v.stroke)})},LoopMarker:function(R,_,v){var k=Rn(_,v),O=cn(_,v),z=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2+v.loop)/k,my:(O-7)/O}});S("loop",R,z,{strokeWidth:1.5,fill:"none",stroke:Q(_,c,v.stroke),strokeMiterlimit:.5})},AdhocMarker:function(R,_,v){var k=Rn(_,v),O=cn(_,v),z=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2+v.adhoc)/k,my:(O-15)/O}});S("adhoc",R,z,{strokeWidth:1,fill:Q(_,c,v.stroke),stroke:Q(_,c,v.stroke)})}};function L(R,_,v,k){j[R](_,v,k)}function H(R,_,v=[],k={}){k={fill:k.fill,stroke:k.stroke,width:Rn(_,k),height:cn(_,k)};var O=U(_),z=v.includes("SubProcessMarker");z?k={...k,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:k={...k,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},O.get("isForCompensation")&&v.push("CompensationMarker"),y(O,"bpmn:AdHocSubProcess")&&(v.push("AdhocMarker"),z||D(k,{compensation:k.compensation-18}));var ie=O.get("loopCharacteristics"),_e=ie&&ie.get("isSequential");ie&&(D(k,{compensation:k.compensation-18}),v.includes("AdhocMarker")&&D(k,{seq:-23,loop:-18,parallel:-24}),_e===void 0&&v.push("LoopMarker"),_e===!1&&v.push("ParallelMarker"),_e===!0&&v.push("SequentialMarker")),v.includes("CompensationMarker")&&v.length===1&&D(k,{compensation:-8}),T(v,function(Ie){L(Ie,R,_,k)})}function re(R,_,v={}){v=D({size:{width:100}},v);var k=o.createText(_||"",v);return Ce(k).add("djs-label"),ve(R,k),k}function Pe(R,_,v,k={}){var O=U(_),z=Fo({x:_.x,y:_.y,width:_.width,height:_.height},k);return re(R,O.name,{align:v,box:z,padding:7,style:{fill:jo(_,u,c,k.stroke)}})}function et(R,_,v={}){var k={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return re(R,bn(_),{box:k,style:D({},o.getExternalStyle(),{fill:jo(_,u,c,v.stroke)})})}function q(R,_,v,k={}){var O=kt(v),z=re(R,_,{box:{height:30,width:O?cn(v,k):Rn(v,k)},align:"center-middle",style:{fill:jo(v,u,c,k.stroke)}});if(O){var ie=-1*cn(v,k);is(z,0,-ie,270)}}function ne(R,_,v={}){var{width:k,height:O}=Fo(_,v);return g(R,k,O,cs,{...v,fill:Se(_,s,v.fill),fillOpacity:Kr,stroke:Q(_,c,v.stroke)})}function ce(R,_,v={}){var k=U(_),O=Se(_,s,v.fill),z=Q(_,c,v.stroke);return(k.get("associationDirection")==="One"||k.get("associationDirection")==="Both")&&(v.markerEnd=d(R,"association-end",O,z)),k.get("associationDirection")==="Both"&&(v.markerStart=d(R,"association-start",O,z)),v=ke(v,["markerStart","markerEnd"]),b(R,_.waypoints,{...v,stroke:z,strokeDasharray:"0, 5"})}function oe(R,_,v={}){var k=Se(_,s,v.fill),O=Q(_,c,v.stroke),z=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),ie=x(R,z,{fill:k,fillOpacity:Kr,stroke:O}),_e=U(_);if(l1(_e)){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:k,stroke:O})}return ie}function se(R,_,v={}){return m(R,_.width,_.height,{fillOpacity:Kr,...v,fill:Se(_,s,v.fill),stroke:Q(_,c,v.stroke)})}function K(R,_,v={}){return w(R,_.width,_.height,{fill:Se(_,s,v.fill),fillOpacity:Kr,stroke:Q(_,c,v.stroke)})}function N(R,_,v={}){var k=g(R,Rn(_,v),cn(_,v),0,{fill:Se(_,s,v.fill),fillOpacity:v.fillOpacity||Kr,stroke:Q(_,c,v.stroke),strokeWidth:1.5}),O=U(_);if(y(O,"bpmn:Lane")){var z=O.get("name");q(R,z,_,v)}return k}function B(R,_,v={}){var k=ne(R,_,v),O=Re(_);if(Ut(_)&&(ee(k,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!O)){var z=U(_).flowElements||[],ie=z.filter(_e=>y(_e,"bpmn:StartEvent"));ie.length===1&&V(ie[0],R,v,_)}return Pe(R,_,O?"center-top":"center-middle",v),O?H(R,_,void 0,v):H(R,_,["SubProcessMarker"],v),k}function V(R,_,v,k){var O=22,z={fill:Se(k,s,v.fill),stroke:Q(k,c,v.stroke),width:O,height:O},ie=U(R).isInterrupting,_e=ie?0:3,Ie=ie?1:1.2,ot=20,He=(O-ot)/2,ct="translate("+He+","+He+")";m(_,ot,ot,{fill:z.fill,stroke:z.stroke,strokeWidth:Ie,strokeDasharray:_e,transform:ct}),$(R,_,z,k)}function xe(R,_,v={}){var k=ne(R,_,v);return Pe(R,_,"center-middle",v),H(R,_,void 0,v),k}var Ct=this.handlers={"bpmn:AdHocSubProcess":function(R,_,v={}){return Re(_)?v=ke(v,["fill","stroke","width","height"]):v=ke(v,["fill","stroke"]),B(R,_,v)},"bpmn:Association":function(R,_,v={}){return v=ke(v,["fill","stroke"]),ce(R,_,v)},"bpmn:BoundaryEvent":function(R,_,v={}){var{renderIcon:k=!0}=v;v=ke(v,["fill","stroke"]);var O=U(_),z=O.get("cancelActivity");v={strokeWidth:1.5,fill:Se(_,s,v.fill),fillOpacity:v1,stroke:Q(_,c,v.stroke)},z||(v.strokeDasharray="6");var ie=se(R,_,v);return m(R,_.width,_.height,ss,{...v,fill:"none"}),k&&$(_,R,v),ie},"bpmn:BusinessRuleTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=xe(R,_,v),O=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),z=x(R,O);ee(z,{fill:Se(_,s,v.fill),stroke:Q(_,c,v.stroke),strokeWidth:1});var ie=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),_e=x(R,ie);return ee(_e,{fill:Q(_,c,v.stroke),stroke:Q(_,c,v.stroke),strokeWidth:1}),k},"bpmn:CallActivity":function(R,_,v={}){return v=ke(v,["fill","stroke"]),B(R,_,{strokeWidth:5,...v})},"bpmn:ComplexGateway":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=K(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:Q(_,c,v.stroke),stroke:Q(_,c,v.stroke),strokeWidth:1}),k},"bpmn:DataInput":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),O=oe(R,_,v);return x(R,k,{fill:"none",stroke:Q(_,c,v.stroke),strokeWidth:1}),O},"bpmn:DataInputAssociation":function(R,_,v={}){return v=ke(v,["fill","stroke"]),ce(R,_,{...v,markerEnd:d(R,"association-end",Se(_,s,v.fill),Q(_,c,v.stroke))})},"bpmn:DataObject":function(R,_,v={}){return v=ke(v,["fill","stroke"]),oe(R,_,v)},"bpmn:DataObjectReference":I("bpmn:DataObject"),"bpmn:DataOutput":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),O=oe(R,_,v);return x(R,k,{strokeWidth:1,fill:Q(_,c,v.stroke),stroke:Q(_,c,v.stroke)}),O},"bpmn:DataOutputAssociation":function(R,_,v={}){return v=ke(v,["fill","stroke"]),ce(R,_,{...v,markerEnd:d(R,"association-end",Se(_,s,v.fill),Q(_,c,v.stroke))})},"bpmn:DataStoreReference":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return x(R,k,{fill:Se(_,s,v.fill),fillOpacity:Kr,stroke:Q(_,c,v.stroke),strokeWidth:2})},"bpmn:EndEvent":function(R,_,v={}){var{renderIcon:k=!0}=v;v=ke(v,["fill","stroke"]);var O=se(R,_,{...v,strokeWidth:4});return k&&$(_,R,v),O},"bpmn:EventBasedGateway":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=U(_),O=K(R,_,v);m(R,_.width,_.height,_.height*.2,{fill:Se(_,"none",v.fill),stroke:Q(_,c,v.stroke),strokeWidth:1});var z=k.get("eventGatewayType"),ie=!!k.get("instantiate");function _e(){var ot=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});x(R,ot,{fill:"none",stroke:Q(_,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:Q(_,c,v.stroke),strokeWidth:1})}else z==="Exclusive"&&(ie||m(R,_.width,_.height,_.height*.26,{fill:"none",stroke:Q(_,c,v.stroke),strokeWidth:1}),_e());return O},"bpmn:ExclusiveGateway":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=K(R,_,v),O=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),z=Me(_);return z.get("isMarkerVisible")&&x(R,O,{fill:Q(_,c,v.stroke),stroke:Q(_,c,v.stroke),strokeWidth:1}),k},"bpmn:Gateway":function(R,_,v={}){return v=ke(v,["fill","stroke"]),K(R,_,v)},"bpmn:Group":function(R,_,v={}){return v=ke(v,["fill","stroke","width","height"]),g(R,_.width,_.height,cs,{stroke:Q(_,c,v.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Rn(_,v),height:cn(_,v)})},"bpmn:InclusiveGateway":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=K(R,_,v);return m(R,_.width,_.height,_.height*.24,{fill:Se(_,s,v.fill),stroke:Q(_,c,v.stroke),strokeWidth:2.5}),k},"bpmn:IntermediateEvent":function(R,_,v={}){var{renderIcon:k=!0}=v;v=ke(v,["fill","stroke"]);var O=se(R,_,{...v,strokeWidth:1.5});return m(R,_.width,_.height,ss,{fill:"none",stroke:Q(_,c,v.stroke),strokeWidth:1.5}),k&&$(_,R,v),O},"bpmn:IntermediateCatchEvent":I("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":I("bpmn:IntermediateEvent"),"bpmn:Lane":function(R,_,v={}){return v=ke(v,["fill","stroke","width","height"]),N(R,_,{...v,fillOpacity:y1})},"bpmn:ManualTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=xe(R,_,v),O=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(R,O,{fill:Se(_,s,v.fill),stroke:Q(_,c,v.stroke),strokeWidth:.5}),k},"bpmn:MessageFlow":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=U(_),O=Me(_),z=Se(_,s,v.fill),ie=Q(_,c,v.stroke),_e=b(R,_.waypoints,{markerEnd:d(R,"messageflow-end",z,ie),markerStart:d(R,"messageflow-start",z,ie),stroke:ie,strokeDasharray:"10, 11",strokeWidth:1.5});if(k.get("messageRef")){var Ie=_e.getPointAtLength(_e.getTotalLength()/2),ot=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ie.x,y:Ie.y}}),He={strokeWidth:1};O.get("messageVisibleKind")==="initiating"?(He.fill=z,He.stroke=ie):(He.fill=ie,He.stroke=z);var ct=x(R,ot,He),jt=k.get("messageRef"),qt=jt.get("name"),Ye=re(R,qt,{align:"center-top",fitBox:!0,style:{fill:ie}}),yt=ct.getBBox(),Ot=Ye.getBBox(),Or=Ie.x-Ot.width/2,xn=Ie.y+yt.height/2+h1;is(Ye,Or,xn,0)}return _e},"bpmn:ParallelGateway":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=K(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:Q(_,c,v.stroke),stroke:Q(_,c,v.stroke),strokeWidth:1}),k},"bpmn:Participant":function(R,_,v={}){v=ke(v,["fill","stroke","width","height"]);var k=N(R,_,v),O=Re(_),z=kt(_),ie=U(_),_e=ie.get("name");if(O){var Ie=z?[{x:30,y:0},{x:30,y:cn(_,v)}]:[{x:0,y:30},{x:Rn(_,v),y:30}];E(R,Ie,{stroke:Q(_,c,v.stroke),strokeWidth:m1}),q(R,_e,_,v)}else{var ot=Fo(_,v);z||(ot.height=Rn(_,v),ot.width=cn(_,v));var He=re(R,_e,{box:ot,align:"center-middle",style:{fill:jo(_,u,c,v.stroke)}});if(!z){var ct=-1*cn(_,v);is(He,0,-ct,270)}}return ie.get("participantMultiplicity")&&L("ParticipantMultiplicityMarker",R,_,v),k},"bpmn:ReceiveTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=U(_),O=xe(R,_,v),z;return k.get("instantiate")?(m(R,28,28,20*.22,{fill:Se(_,s,v.fill),stroke:Q(_,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:Se(_,s,v.fill),stroke:Q(_,c,v.stroke),strokeWidth:1}),O},"bpmn:ScriptTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=xe(R,_,v),O=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(R,O,{fill:Se(_,s,v.fill),stroke:Q(_,c,v.stroke),strokeWidth:1}),k},"bpmn:SendTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=xe(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:Q(_,c,v.stroke),stroke:Se(_,s,v.fill),strokeWidth:1}),k},"bpmn:SequenceFlow":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=Se(_,s,v.fill),O=Q(_,c,v.stroke),z=b(R,_.waypoints,{markerEnd:d(R,"sequenceflow-end",k,O),stroke:O}),ie=U(_),{source:_e}=_;if(_e){var Ie=U(_e);ie.get("conditionExpression")&&y(Ie,"bpmn:Activity")&&ee(z,{markerStart:d(R,"conditional-flow-marker",k,O)}),Ie.get("default")&&(y(Ie,"bpmn:Gateway")||y(Ie,"bpmn:Activity"))&&Ie.get("default")===ie&&ee(z,{markerStart:d(R,"conditional-default-flow-marker",k,O)})}return z},"bpmn:ServiceTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=xe(R,_,v);m(R,10,10,{fill:Se(_,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:Se(_,s,v.fill),stroke:Q(_,c,v.stroke),strokeWidth:1}),m(R,10,10,{fill:Se(_,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:Se(_,s,v.fill),stroke:Q(_,c,v.stroke),strokeWidth:1}),k},"bpmn:StartEvent":function(R,_,v={}){var{renderIcon:k=!0}=v;v=ke(v,["fill","stroke"]);var O=U(_);O.get("isInterrupting")||(v={...v,strokeDasharray:"6"});var z=se(R,_,v);return k&&$(_,R,v),z},"bpmn:SubProcess":function(R,_,v={}){return Re(_)?v=ke(v,["fill","stroke","width","height"]):v=ke(v,["fill","stroke"]),B(R,_,v)},"bpmn:Task":function(R,_,v={}){return v=ke(v,["fill","stroke"]),xe(R,_,v)},"bpmn:TextAnnotation":function(R,_,v={}){v=ke(v,["fill","stroke"]);var{width:k,height:O}=Fo(_,v),z=g(R,k,O,0,0,{fill:"none",stroke:"none"}),ie=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:0,my:0}});x(R,ie,{stroke:Q(_,c,v.stroke)});var _e=U(_),Ie=_e.get("text")||"";return re(R,Ie,{align:"left-top",box:Fo(_,v),padding:Yr,style:{fill:jo(_,u,c,v.stroke)}}),z},"bpmn:Transaction":function(R,_,v={}){Re(_)?v=ke(v,["fill","stroke","width","height"]):v=ke(v,["fill","stroke"]);var k=B(R,_,{strokeWidth:1.5,...v}),O=n.style(["no-fill","no-events"],{stroke:Q(_,c,v.stroke),strokeWidth:1.5}),z=Re(_);return z||(v={}),g(R,Rn(_,v),cn(_,v),cs-ss,ss,O),k},"bpmn:UserTask":function(R,_,v={}){v=ke(v,["fill","stroke"]);var k=xe(R,_,v),O=15,z=12,ie=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:O,y:z}});x(R,ie,{fill:Se(_,s,v.fill),stroke:Q(_,c,v.stroke),strokeWidth:.5});var _e=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:O,y:z}});x(R,_e,{fill:Se(_,s,v.fill),stroke:Q(_,c,v.stroke),strokeWidth:.5});var Ie=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:O,y:z}});return x(R,Ie,{fill:Q(_,c,v.stroke),stroke:Q(_,c,v.stroke),strokeWidth:.5}),k},label:function(R,_,v={}){return et(R,_,v)}};this._drawPath=x,this._renderer=A}J(xr,pi),xr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],xr.prototype.canRender=function(e){return y(e,"bpmn:BaseElement")},xr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},xr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},xr.prototype.getShapePath=function(e){return be(e)?Wu(e,g1):y(e,"bpmn:Event")?Ph(e):y(e,"bpmn:Activity")?Wu(e,cs):y(e,"bpmn:Gateway")?p1(e):f1(e)};function ke(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var _1=0,b1={width:150,height:50};function x1(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function E1(e){return At(e)?D({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Uu=null;function w1(){return Uu||(Uu=document.createElement("canvas").getContext("2d")),Uu}function S1(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(Ah(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Ah(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function R1(e,t){var n=w1();if(!n)return{width:0,height:0};n.font=S1(t),"letterSpacing"in n&&(n.letterSpacing=Ah(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 C1(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=R1(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return P1(e,r,i,o);r=T1(r,o.width,t)}}function P1(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 Th="";function A1(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===Th)&&r.pop();break}var a=r[r.length-1];return a&&a===Th&&(r[r.length-1]="-"),r.join("")}function T1(e,t,n){var i=Math.max(e.length*(n/t),1),r=A1(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function us(e){this._config=D({},{size:b1,padding:_1,style:{},align:"center-top"},e||{})}us.prototype.createText=function(e,t){return this.layoutText(e,t).element},us.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},us.prototype.layoutText=function(e,t){for(var n=D({},this._config.size,t.box),i=D({},this._config.style,t.style),r=x1(t.align||this._config.align),o=E1(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=M1(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(C1(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=on(u,function(g,w,E){return g+(s||w.height)},0)+o.top+o.bottom,f=on(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=ae("text");ee(h,i),T(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=ae("tspan");ee(E,{x:w,y:d}),E.textContent=g.text,ve(h,E)});var m={width:f,height:p};return{dimensions:m,element:h}};function M1(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var k1=12,D1=1.2,O1=40;function Mh(e){var t=D({fontFamily:"Arial, sans-serif",fontSize:k1,fontWeight:"normal",lineHeight:D1},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=D({},t,{fontSize:n},e&&e.externalStyle||{}),r=new us({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,br.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:Yr});return{x:a.x,y:a.y,width:a.width,height:Math.max(O1,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,D({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Mh.$inject=["config.textRenderer"];function I1(){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=$1(i.d,{mx:r,my:o,e:a});return p}}var L1=/\{([^{}]+)\}/g,N1=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function B1(e,t,n){var i=n;return t.replace(N1,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 $1(e,t){return String(e).replace(L1,function(n,i){return B1(n,i,t)})}const j1={__init__:["bpmnRenderer"],bpmnRenderer:["type",xr],textRenderer:["type",Mh],pathMap:["type",I1]};function F1(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Ho={translate:["value",F1]};function ls(e,t,n){return D({id:e.id,type:e.$type,businessObject:e,di:t},n)}function H1(e,t,n){var i=e.waypoint;return!i||i.length<2?[pe(t),pe(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function kh(e,t,n){return new Error(`element ${Wt(t)} referenced by ${Wt(e)}#${n} not yet drawn`)}function mi(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}mi.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],mi.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(ls(e,t,a)),this._canvas.addRootElement(i)}else if(y(t,"bpmndi:BPMNShape")){var s=!Re(e,t),c=V1(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(ls(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),y(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),y(e,"bpmn:Lane")&&(o=0),y(e,"bpmn:DataStoreReference")&&(z1(n,pe(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(ls(e,t,{hidden:r,source:l,target:p,waypoints:H1(t,l,p)})),y(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${Wt(t)} for element ${Wt(e)}`);return Hi(e)&&bn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},mi.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Wt(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw kh(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},mi.prototype.addLabel=function(e,t,n){var i,r,o;return i=r1(t,n),r=bn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(ls(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!bn(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)},mi.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?kh(e,i,t+"Ref"):new Error(`${Wt(e)}#${t} Ref not specified`)},mi.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},mi.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},mi.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function z1(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 V1(e){return y(e,"bpmn:Group")}const Dh={__depends__:[j1,{__depends__:[Ho],bpmnImporter:["type",mi]}]};function zo(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Hn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function qu(e){return Math.log(e)/Math.log(10)}var G1=1e3;function W(e){this._eventBus=e}W.$inject=["eventBus"];function W1(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((Tt(t)||de(t))&&(o=r,r=i,i=n,n=t,t=null),Tt(n)&&(o=r,r=i,i=n,n=G1),At(r)&&(o=r,r=!1),!Tt(i))throw new Error("handlerFn must be a function");le(e)||(e=[e]);var a=this._eventBus;T(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?W1(i,o):i,o)})},W.prototype.canExecute=gi("canExecute"),W.prototype.preExecute=gi("preExecute"),W.prototype.preExecuted=gi("preExecuted"),W.prototype.execute=gi("execute"),W.prototype.executed=gi("executed"),W.prototype.postExecute=gi("postExecute"),W.prototype.postExecuted=gi("postExecuted"),W.prototype.revert=gi("revert"),W.prototype.reverted=gi("reverted");function gi(e){return function(n,i,r,o,a){(Tt(n)||de(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Yu=["top","bottom","left","right"],ps=10;function Ku(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(as(r)&&!Ve(r)){var o=Y1(r);o&&i(r,o)}}function i(r,o){var a=pe(r),s=r.label,c=pe(s);if(s.parent){var u=ue(r),l;switch(o){case"top":l={x:a.x,y:u.top-ps-s.height/2};break;case"left":l={x:u.left-ps-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+ps+s.height/2};break;case"right":l={x:u.right+ps+s.width/2,y:a.y};break}var p=Hn(l,c);t.moveShape(s,p)}}}J(Ku,W),Ku.$inject=["eventBus","modeling"];function U1(e){var t=e.host,n=pe(e),i=Lt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Yu.filter(function(a){return r.indexOf(a)===-1});return o}function q1(e){var t=pe(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 Oh(t,i)});return n}function Y1(e){var t=pe(e.label),n=pe(e),i=Oh(n,t);if(K1(i)){var r=q1(e);if(e.host){var o=U1(e);r=r.concat(o)}var a=Yu.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Lt(e.label,e)!=="intersect"?void 0:i:a[0]}}function Oh(e,t){return Lt(t,e,5)}function K1(e){return Yu.indexOf(e)!==-1}function Xu(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)}J(Xu,W),Xu.$inject=["eventBus"];var X1=1500;function Zu(e,t,n){e.invoke(W,this),this.preExecute("elements.delete",X1,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=we(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 T(o,u=>{const l=new Set(Br(Vr(Array.from(s),ft(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}J(Zu,W),Zu.$inject=["injector","eventBus","canvas"];function Qu(e,t){e.invoke(W,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=we(r.incoming.concat(r.outgoing),function(a){return y(a,"bpmn:Association")});T(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}J(Qu,W),Qu.$inject=["injector","modeling"];function Xr(e,t){for(nn(t)&&(t=[t]);e=e.parent;)if(Ee(e,t))return e;return null}function Ih(e,t){var n=Xr(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Xr(e,i),n)return kt(n);if(Ee(e,i))return kt(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?kt(o):!0}var Lh=500;function fs(e,t){t.invoke(W,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Lh,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Nh(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",Lh,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Nh(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}fs.$inject=["bpmnReplace","injector"],J(fs,W),fs.prototype._replaceShape=function(e,t){var n=Z1(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function Z1(e){var t=U(e),n=t.eventDefinitions;return n&&n[0]}function Nh(e,t){return!be(e)&&Ee(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Ju(e,t){W.call(this,e);function n(i){return we(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")&&T(o.outgoing,function(a){var s=a.target,c=n(s);y(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Ju.$inject=["eventBus","modeling"],J(Ju,W);function Bh(e){return e.create("bpmn:Category")}function Q1(e){return e.create("bpmn:CategoryValue")}function $h(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=Q1(e)),n.$parent||(n.$parent=Bh(e)),n}function J1(e,t,n){return lt(t.get("categoryValue"),e),e.$parent=t,lt(n.get("rootElements"),t),t.$parent=n,e}function eS(e){var t=e.$parent;return t&&(st(t.get("categoryValue"),e),e.$parent=null),e}function tS(e){var t=e.$parent;return t&&(st(t.get("rootElements"),e),e.$parent=null),e}var nS=500;function el(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&&J1(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&tS(u),c&&!r(c,l)&&eS(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"],nS,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){jh(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){jh(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)}el.$inject=["bpmnjs","elementRegistry","injector"],J(el,W);function jh(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function tl(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;Zr(w)&&Vo(E)&&l(E)}function r(g){const w=g.connection,E=g.source,b=g.target;Zr(E)&&ds(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;Vo(b)&&l(b),Zr(x)&&ds(w)&&u(w)}}function a(g){const{element:w}=g;Vo(w)?(p(w),d(w)):ds(w)&&h(w)}function s(g){const{newData:w,oldShape:E}=g;if(Zr(g.oldShape)&&w.eventDefinitionType!=="bpmn:CompensateEventDefinition"||w.type!=="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>Vo(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!Zr(g.oldShape)&&w.eventDefinitionType==="bpmn:CompensateEventDefinition"&&w.type==="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>ds(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=>Vo(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=>Zr(E.source));t.removeElements(w)}function m(g){const w=g.outgoing.filter(E=>y(E,"bpmn:SequenceFlow"));t.removeElements(w)}}J(tl,W),tl.$inject=["eventBus","modeling","bpmnRules"];function Vo(e){const t=U(e);return t&&t.get("isForCompensation")}function Zr(e){return e&&y(e,"bpmn:BoundaryEvent")&&qr(e,"bpmn:CompensateEventDefinition")}function ds(e){return e&&y(e,"bpmn:Activity")&&!Ut(e)}function nl(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=Xr(i,"bpmn:Participant"))})}nl.$inject=["injector"],J(nl,W);function il(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}})}il.$inject=["eventBus","bpmnFactory"],J(il,W);var rl=20,ol=20,Fh=30,hs=2e3;function al(e,t,n){W.call(this,t),t.on(["create.start","shape.move.start"],hs,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")&&!be(p)&&!Ve(p)});if(c.length){var u=ft(c),l=iS(a,u);D(a,l),o.createConstraints=rS(a,u)}}}),t.on("create.start",hs,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",hs,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",hs,function(r){var o=r.elements,a=r.parent,s=oS(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)}al.$inject=["canvas","eventBus","modeling"],J(al,W);function iS(e,t){t={width:t.width+rl*2+Fh,height:t.height+ol*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 rS(e,t){return t=ue(t),{bottom:t.top+e.height/2-ol,left:t.right-e.width/2+rl,top:t.bottom-e.height/2+ol,right:t.left+e.width/2-rl-Fh}}function oS(e){return qe(e,function(t){return y(t,"bpmn:Participant")})}var Hh="__targetRef_placeholder";function sl(e,t){W.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],zh(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],zh(o));function n(a,s,c){var u=a.get("dataInputAssociations");return qe(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=qe(c,function(l){return l.name===Hh});return!u&&s&&(u=t.create("bpmn:Property",{name:Hh}),lt(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||st(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}}sl.$inject=["eventBus","bpmnFactory"],J(sl,W);function zh(e){return function(t){var n=t.context,i=n.connection;if(y(i,"bpmn:DataInputAssociation"))return e(t)}}function ms(e){this._bpmnUpdater=e}ms.$inject=["bpmnUpdater"],ms.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),[]},ms.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 cl(e,t,n,i){W.call(this,i),t.registerHandler("dataStore.updateContainment",ms);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:Me(s),newSemanticParent:l.processRef||l,newDiParent:Me(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:sS(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Ee(u,["bpmn:Participant","bpmn:SubProcess"])&&y(l,"bpmn:Collaboration")&&o(l).filter(function(p){return aS(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)})})}cl.$inject=["canvas","commandStack","elementRegistry","eventBus"],J(cl,W);function aS(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 sS(e,t){for(;e.parent;){if(y(e.parent,t))return e.parent;e=e.parent}}var gs=Math.max,vs=Math.min,cS=20;function Vh(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function uS(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 lS(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 ys(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return de(r)&&(i=(/top|left/.test(e)?vs:gs)(i,r)),de(o)&&(i=(/top|left/.test(e)?gs:vs)(i,o)),i}function pS(e,t){if(!t)return e;var n=ue(e);return es({top:ys("top",n,t),right:ys("right",n,t),bottom:ys("bottom",n,t),left:ys("left",n,t)})}function fS(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:vs(o.top,a.top),left:vs(o.left,a.left),bottom:gs(o.bottom,a.bottom),right:gs(o.right,a.right)};return es(s)}function Go(e,t){return typeof e<"u"?e:cS}function dS(e,t){var n,i,r,o;return typeof t=="object"?(n=Go(t.left),i=Go(t.right),r=Go(t.top),o=Go(t.bottom)):n=i=r=o=Go(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function hS(e){return!(e.waypoints||e.type==="label")}function Gh(e,t){var n;if(e.length===void 0?n=we(e.children,hS):n=e,n.length)return dS(ft(n),t)}var zi=Math.abs;function mS(e,t){return Vh(ue(t),ue(e))}var gS=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Cn=30;function _s(e,t){return t=t||[],e.children.filter(function(n){y(n,"bpmn:Lane")&&(_s(n,t),t.push(n))}),t}function Vi(e){return e.children.filter(function(t){return y(t,"bpmn:Lane")})}function Pn(e){return Xr(e,gS)||e}function vS(e,t){var n=Pn(e),i=y(n,"bpmn:Process")?[]:[n],r=_s(n,i),o=ue(e),a=ue(t),s=mS(e,t),c=[],u=kt(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&&(zi(m.bottom-o.top)<10&&(d=a.top-m.bottom),zi(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(zi(m.right-o.left)<10&&(f=a.left-m.right),zi(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(zi(m.top-o.bottom)<10&&(p=a.bottom-m.top),zi(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(zi(m.left-o.right)<10&&(h=a.right-m.left),zi(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:lS(l,{top:p,right:f,bottom:d,left:h})})}}),c}var yS=500;function ul(e,t){W.call(this,e);function n(i,r){var o=kt(i),a=Vi(r),s=[],c=[],u=[],l=[];if(yr(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",yS,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))})}ul.$inject=["eventBus","spaceTool"],J(ul,W);var Wh=500;function bs(e,t){t.invoke(W,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Wh,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Uh(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Wh,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Uh(a,bS(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}bs.$inject=["bpmnReplace","injector"],J(bs,W),bs.prototype._replaceShape=function(e){var t=_S(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function _S(e){var t=U(e),n=t.eventDefinitions;return n&&n[0]}function Uh(e,t){return!be(e)&&y(e,"bpmn:BoundaryEvent")&&!t}function bS(e,t){return e.indexOf(t)!==-1}var xs=Math.round,xS=Math.max;function ES(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 wS(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var qh=10;function SS(e,t){var n,i;for(n=0;i=e[n];n++)if(Io(i,t)<=qh)return{point:e[n],bendpoint:!0,index:n};return null}function RS(e,t){var n=Qd(ES(t,qh),wS(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=xS(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:xs(i.x+r.x)/2,y:xs(i.y+r.y)/2},index:i.segment2}:{point:{x:xs(i.x),y:xs(i.y)},index:i.segment2}:null}function ll(e,t){return SS(e,t)||RS(e,t)}function pl(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;de(a.width)?w=pe(a):w=a;var E=ll(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||!Yh(r,c[c.length-1]))&&c.push(Kh(l)),(u.length===1||!Yh(r,u[0]))&&u.unshift(Kh(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&&we(g,function(x){return x.source===d.source})||[],h&&we(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=pe(c),l={x:u.x+s.x,y:u.y+s.y},p=qe(o.children,function(f){var d=t.canInsert(a,f);return d&&ll(f.waypoints,l)});p&&(r.targetFlow=p,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}J(pl,W),pl.$inject=["eventBus","bpmnRules","modeling"];function Yh(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 Kh(e){return D({},e)}function fl(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)&&Qr(r)){var c=[];y(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&Qr(u)):c=a.incoming.filter(u=>u!==r&&Qr(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(Qr).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Qr).forEach(function(s){const c=a.incoming.filter(Qr).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}fl.$inject=["eventBus","modeling"],J(fl,W);function Qr(e){return y(e,"bpmn:SequenceFlow")}var Es=1500,Xh=2e3;function Zh(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")&&!Ee(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Pn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Ee(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=Pn(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=Pn(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=Pn(o)||o)}),t.on("shape.move.start",Xh,function(i){var r=i.shape;y(r,"bpmn:Lane")&&(i.shape=Pn(r)||r)}),t.on("spaceTool.move",Xh,function(i){var r=i.hover;r&&y(r,"bpmn:Lane")&&(i.hover=Pn(r))})}Zh.$inject=["elementRegistry","eventBus","canvas"];var Qh=770;function dl(e,t,n,i){n.invoke(W,this);function r(s,c){var u=U(s),l=c.categoryValue||u.categoryValueRef;l||(l=$h(e,u));var p=c.category||l.$parent||Bh(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",Qh,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",Qh,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})}dl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],J(dl,W);function hl(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 Jh(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=hl(i,r,o,a),u=hl(i,r,o,s),l;c&&u?em(c,o)>em(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],pe(i.source)),t(r[r.length-1],r[r.length-2],pe(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}Jh.$inject=["eventBus"];function em(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function ml(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=Me(i);if(Ee(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}ml.$inject=["eventBus"],J(ml,W);function tm(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function nm(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function CS(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 PS(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 gl(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=PS([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 im(e,t){var n=gl(e,t),i={x:n.x-e.x,y:n.y-e.y};return tm(i)}function Wo(e,t){return tm({x:e.x-t.x,y:e.y-t.y})}var rm=Math.sqrt,om=Math.min,AS=Math.max,am=Math.abs;function sm(e){return Math.pow(e,2)}function Uo(e,t){return rm(sm(e.x-t.x)+sm(e.y-t.y))}function TS(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],um(i,r)?u=[i]:(o=Uo(e,i),a=Uo(e,r),c=om(o,a),u=MS(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:um(i,u[0])?n:n+1}),u.length===2&&(s=DS(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:Uo(i,s)/Uo(i,r)}),p=Uo(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function MS(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=rm(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 kS(b,e,t)})}function kS(e,t,n){return cm(e.x,t.x,n.x)&&cm(e.y,t.y,n.y)}function cm(e,t,n){return e>=om(t,n)-ws&&e<=AS(t,n)+ws}function DS(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var ws=.1;function um(e,t){return am(e.x-t.x)<=ws&&am(e.y-t.y)<=ws}function OS(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=pm(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 lm(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=TS(e,n),c=s.segmentIndex,u=OS(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=fm(n,c),p=fm(t,u),f=s.position,d=LS(l,f),h=IS(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=pm(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=CS({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:di(b),delta:di({x:r,y:o})}}function pm(e,t){var n=Wo(e[t-1],e[t]),i=Wo(e[t],e[t+1]),r=n/(n+i);return r}function IS(e,t){var n=nm(e),i=nm(t);return i-n}function fm(e,t){return[e[t],e[t+1]]}function LS(e,t){var n=Wo(e[0],e[1]),i=Wo(e[0],t);return n===0?0:i/n}function NS(e,t,n,i){var r=pe(e);return lm(r,t,n,i).delta}function qo(e,t,n){var i=zo(t),r=zo(n),o=Hn(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return di({x:r.x+a.x,y:r.y+a.y})}function dm(e,t,n){var i=zo(e),r=zo(t),o=zo(n),a=Hn(e,i),s=Hn(i,r),c=BS(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 di({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function BS(e,t,n){var i=ue(t),r=ue(n);if($S(i,r))return null;var o=Lt(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=Lt(n,s),c!==o?null:a}function $S(e,t){return jS(e,t)||FS(e,t)}function jS(e,t){return e.right!==t.right&&e.left!==t.left}function FS(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var hm="name",mm="text";function vl(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(hm in u&&t.updateLabel(c,u[hm]),mm in u&&y(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[mm]||"");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;be(u)||!Hi(u)||bn(u)&&t.updateLabel(u,bn(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=D({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),NS(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&&Hi(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(!(!be(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(bn(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(as(c)){var p=c.label,f=pe(p),d=VS(l),h=zS(f,d),m=HS(h,l,u);t.moveShape(p,m)}})}J(vl,W),vl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function HS(e,t,n){var i=qo(e,t,n);return di(Hn(i,e))}function zS(e,t){if(t.length){var n=GS(e,t);return gl(e,n)}}function VS(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 GS(e,t){var n=t.map(function(r){return{line:r,distance:im(e,r)}}),i=Wn(n,"distance");return i[0].line}function WS(e,t,n,i){return lm(e,t,n,i).point}function yl(e,t){W.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=D({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),WS(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)})})}J(yl,W),yl.$inject=["eventBus","modeling"];function Ss(e,t,n){var i=Cs(e),r=vm(i,t),o=i[0];return r.length?r[r.length-1]:qo(o.original||o,n,t)}function Rs(e,t,n){var i=Cs(e),r=vm(i,t),o=i[i.length-1];return r.length?r[0]:qo(o.original||o,n,t)}function _l(e,t,n){var i=Cs(e),r=gm(t,n),o=i[0];return qo(o.original||o,r,t)}function bl(e,t,n){var i=Cs(e),r=gm(t,n),o=i[i.length-1];return qo(o.original||o,r,t)}function gm(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Cs(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function vm(e,t){var n=Ht(e,qS);return we(n,function(i){return US(i,t)})}function US(e,t){return Lt(t,e,1)==="intersect"}function qS(e){return e.original||e}function xl(e,t){W.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(YS(i,r)){var o=KS(i);o.incoming.forEach(function(a){var s=Rs(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Ss(a,r,i);t.reconnectStart(a,r,s)})}},!0)}xl.$inject=["eventBus","modeling"],J(xl,W);function YS(e,t){return y(e,"bpmn:Participant")&&Re(e)&&y(t,"bpmn:Participant")&&!Re(t)}function KS(e){var t=Do([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 XS=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function ym(e){const t=U(e);if(!y(t,"bpmn:BoundaryEvent")&&!(y(t,"bpmn:StartEvent")&&Ut(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:XS.some(i=>y(n[0],i))}function _m(e){return y(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function El(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(!ym(r))return;const a=_m(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})})}El.$inject=["injector","modeling"],J(El,W);function wl(e,t){W.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Me(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}J(wl,W),wl.$inject=["eventBus","modeling"];function Sl(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=ZS(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}J(Sl,W),Sl.$inject=["eventBus","bpmnRules","modeling"];function Jr(e){return e.original||e}function ZS(e,t){var n=hl(Jr(e[e.length-2]),Jr(e[e.length-1]),Jr(t[1]),Jr(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Jr(e[0]),Jr(t[t.length-1])]}function Rl(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)}Rl.$inject=["eventBus","modeling"],J(Rl,W);function Cl(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;T(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=qe(p.outgoing,jr({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})})}J(Cl,W),Cl.$inject=["eventBus","modeling","bpmnRules","injector"];function Ps(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=on(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=[];T(s.closure.topLevel,function(f){Ut(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})})}J(Ps,W),Ps.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;T(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)},Ps.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var QS=1500,JS={width:140,height:120},Pl={width:300,height:60},Al={width:60,height:300},As={width:300,height:150},Ts={width:150,height:300},bm={width:140,height:120},xm={width:100,height:40};function Em(e){e.on("resize.start",QS,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=rR(i,r,o)),y(i,"bpmn:SubProcess")&&Re(i)&&(n.minDimensions=bm),y(i,"bpmn:TextAnnotation")&&(n.minDimensions=xm)})}Em.$inject=["eventBus"];var Gi=Math.abs,eR=Math.min,tR=Math.max;function wm(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function eo(e,t,n){return wm(e,t,n,eR)}function to(e,t,n){return wm(e,t,n,tR)}var nR={top:20,left:50,right:20,bottom:20},iR={top:50,left:20,right:20,bottom:20};function rR(e,t,n){var i=Pn(e),r=!0,o=!0,a=_s(i,[i]),s=ue(e),c={},u={},l=kt(e),p=l?Pl:Al;/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&&Gi(s.top-m.bottom)<10&&to(c,"top",m.top+p.height),Gi(s.top-m.top)<5&&eo(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&Gi(s.right-m.left)<10&&eo(c,"right",m.right-p.width),Gi(s.right-m.right)<5&&to(u,"right",m.left+p.width)),/s/.test(t)&&(n&&Gi(s.bottom-m.top)<10&&eo(c,"bottom",m.bottom-p.height),Gi(s.bottom-m.bottom)<5&&to(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&Gi(s.left-m.right)<10&&to(c,"left",m.left+p.width),Gi(s.left-m.left)<5&&eo(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?nR:iR;return f.forEach(function(h){var m=ue(h);/n/.test(t)&&(!l||r)&&eo(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&to(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&to(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&eo(u,"left",m.left-d.left)}),{min:u,max:c}}function Sm(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function no(e){return e.originalEvent||e.srcEvent}function Tl(e){Sm(e),Sm(no(e))}function Er(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 Rm(){return/mac/i.test(navigator.platform)}function Cm(e,t){return(no(e)||e).button===t}function Wi(e){return Cm(e,0)}function oR(e){return Cm(e,1)}function Yo(e){var t=no(e)||e;return Wi(e)?Rm()?t.metaKey:t.ctrlKey:!1}function Ms(e){var t=no(e)||e;return Wi(e)&&t.shiftKey}var Pm=1001;function Am(e,t){e.on("resize.start",Pm+500,function(n){var i=n.context,r=i.shape;(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))&&(i.balanced=!Yo(n))}),e.on("resize.end",Pm,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=ih(a),t.resizeLane(r,a,i.balanced)),!1})}Am.$inject=["eventBus","modeling"];var aR=500;function Ml(e,t,n,i,r){n.invoke(W,this);function o(l){return Ee(l,["bpmn:ReceiveTask","bpmn:SendTask"])||sR(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!qe(f,jr({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(Ee(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(Ee(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"),lt(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");st(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",aR,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)})}Ml.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],J(Ml,W);function sR(e,t){return le(t)||(t=[t]),Pi(t,function(n){return qr(e,n)})}var Tm=Math.max;function Mm(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return T(n,function(a){var s=a.id;y(a,"bpmn:Participant")&&(o[s]=uR(a,i,r)),y(a,"bpmn:Lane")&&(o[s]=kt(a)?Pl:Al),y(a,"bpmn:SubProcess")&&Re(a)&&(o[s]=bm),y(a,"bpmn:TextAnnotation")&&(o[s]=xm),y(a,"bpmn:Group")&&(o[s]=JS)}),o})}Mm.$inject=["eventBus"];function cR(e){return e==="x"}function uR(e,t,n){var i=kt(e);if(!fR(e))return i?As:Ts;var r=cR(t),o={};return r?i?o=As:o={width:pR(e,n,r),height:Ts.height}:i?o={width:As.width,height:lR(e,n,r)}:o=Ts,o}function lR(e,t,n){var i;return i=dR(e,t,n),Tm(As.height,i)}function pR(e,t,n){var i;return i=hR(e,t,n),Tm(Ts.width,i)}function fR(e){return!!Vi(e).length}function dR(e,t,n){var i=Vi(e),r;return r=kl(i,t,n),e.height-r.height+Pl.height}function hR(e,t,n){var i=Vi(e),r;return r=kl(i,t,n),e.width-r.width+Al.width}function kl(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=Vi(r),o.length?kl(o,t,n):r}var km="_plane";function Dm(e){var t=e.id;return mR(t)}function ti(e){var t=e.id;return y(e,"bpmn:SubProcess")?Om(t):t}function wr(e){return Om(e)}function ks(e){var t=Me(e);return y(t,"bpmndi:BPMNPlane")}function Om(e){return e+km}function mR(e){return e.replace(new RegExp(km+"$"),"")}var Im=400,gR=600,Lm={x:180,y:160};function vi(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")&&!Re(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(ti(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;T(f,function(d){if(c(d)){var h=a.get(ti(d));if(!(!h||!d.children||!d.children.length)){var m=Nm(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")||!Re(f)||T($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(ti(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(ti(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(ti(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(ks(f)){a.updateId(f,wr(g)),a.updateId(m,g);return}var w=a.get(wr(m));w&&a.updateId(wr(m),wr(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(ks(f)){a.updateId(f,wr(m)),a.updateId(g,m);return}var w=a.get(wr(g));w&&a.updateId(w,wr(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(ks(f)){var d=f,h=a.get(Dm(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",Im,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Re(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Im,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Re(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",gR,function(p){var f=p.shape;if(y(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Re(f))s._moveChildrenToShape(d.children.slice(),f),T($o(f.children),m=>{n.moveShape(m.annotation,{x:0,y:0},f.parent),T(m.associations,g=>{n.moveConnection(g,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=Nm(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=ti(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(Me(m),"bpmndi:BPMNPlane");if(g){var w=Dm(m),E=qe(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)})}J(vi,W),vi.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=ft(i),o;if(!t.x)o={x:Lm.x-r.x,y:Lm.y-r.y};else{var a=pe(t),s=pe(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},vi.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Ch(e).map(i=>i.annotation));n.size&&T($o(e.children),i=>{n.has(i.annotation)&&T(i.associations,r=>{t.removeConnection(r)})})},vi.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},vi.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},vi.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:ti(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},vi.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=qe(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},vi.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function vR(e){var t=[];return T($o(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Nm(e){return e.children.slice().concat(vR(e.children)).concat(yR(e))}function yR(e){return Nu(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Dl(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"))||!Re(r))){var o=_R(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Dl.$inject=["injector","modeling"],J(Dl,W);function _R(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,bn(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}}})}J(Ol,W),Ol.$inject=["eventBus","textRenderer"];function Il(e,t){W.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Re(i))return;var r=Do(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();T(s,function(u){o(u,!0)}),T(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,pe(i)):t.reconnectStart(a,i,pe(i)))}},!0)}J(Il,W),Il.$inject=["eventBus","modeling"];var Ll=500;function Nl(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=bR(c).concat([a]),p=Gh(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"],Ll,function(a){var s=a.context,c=s.shape;y(c,"bpmn:SubProcess")&&(c.collapsed?Me(c).isExpanded=!1:(i(c.children),Me(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Ll,function(a){var s=a.context,c=s.shape;c.collapsed?Me(c).isExpanded=!1:Me(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Ll,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"})})}J(Nl,W),Nl.$inject=["eventBus","elementFactory","modeling"];function bR(e){return e.filter(function(t){return!t.hidden})}function Bl(e,t,n,i){t.invoke(W,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;be(a)||(y(a,"bpmn:Participant")&&Re(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)})}J(Bl,W),Bl.$inject=["canvas","injector","moddle","modeling"];function $l(e,t){W.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;xR(r,o)&&t.updateProperties(o,{default:null})})}J($l,W),$l.$inject=["eventBus","modeling"];function xR(e,t){if(!y(e,"bpmn:SequenceFlow"))return!1;var n=U(t),i=U(e);return n.get("default")===i}var ER=500,wR=5e3,Bm=["shape.create","shape.delete","shape.move","shape.resize"],$m=[...Bm,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function jl(e,t){W.call(this,e);var n;function i(){return n=n||new SR,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($m,wR,function(){i()}),this.postExecuted($m,ER,function(){o()}),this.preExecute(Bm,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))})}jl.$inject=["eventBus","modeling"],J(jl,W);function SR(){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 RR=500,CR=5e3,jm=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Fm=[...jm,"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 PR,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(Fm,CR,function(){i()}),this.postExecuted(Fm,RR,function(){o()}),this.preExecute(jm,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"],J(Fl,W);function PR(){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 Hl(e,t){W.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)AR(o)&&!MR(o)&&t.updateProperties(o,{isForCompensation:void 0})})}J(Hl,W),Hl.$inject=["eventBus","modeling"];function AR(e){const t=U(e);return t&&t.isForCompensation}function TR(e){return e&&y(e,"bpmn:BoundaryEvent")&&qr(e,"bpmn:CompensateEventDefinition")}function MR(e){return e.incoming.filter(n=>TR(n.source)).length>0}const kR={__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",Ku],appendBehavior:["type",Xu],associationBehavior:["type",Qu],attachEventBehavior:["type",fs],artifactBehavior:["type",Zu],boundaryEventBehavior:["type",Ju],categoryRootElementReferenceBehavior:["type",el],compensateBoundaryEventBehaviour:["type",tl],createBehavior:["type",nl],createDataObjectBehavior:["type",il],createParticipantBehavior:["type",al],dataInputAssociationBehavior:["type",sl],dataStoreBehavior:["type",cl],deleteLaneBehavior:["type",ul],detachEventBehavior:["type",bs],dropOnFlowBehavior:["type",pl],eventBasedGatewayBehavior:["type",fl],fixHoverBehavior:["type",Zh],groupBehavior:["type",dl],importDockingFix:["type",Jh],isHorizontalFix:["type",ml],labelBehavior:["type",vl],layoutConnectionBehavior:["type",yl],messageFlowBehavior:["type",xl],nonInterruptingBehavior:["type",El],removeElementBehavior:["type",Sl],removeEmbeddedLabelBoundsBehavior:["type",wl],removeParticipantBehavior:["type",Rl],replaceConnectionBehavior:["type",Cl],replaceElementBehaviour:["type",Ps],resizeBehavior:["type",Em],resizeLaneBehavior:["type",Am],rootElementReferenceBehavior:["type",Ml],spaceToolBehavior:["type",Mm],subProcessPlaneBehavior:["type",vi],subProcessStartEventBehavior:["type",Dl],textAnnotationBehavior:["type",Ol],toggleCollapseConnectionBehaviour:["type",Il],toggleElementCollapseBehaviour:["type",Nl],unclaimIdBehavior:["type",Bl],unsetDefaultFlowBehavior:["type",$l],updateFlowNodeRefsBehavior:["type",jl],updateCategoryValueRefsBehavior:["type",Fl],setCompensationActivityAfterPasteBehavior:["type",Hl]};function zl(e){this._commandStack=e.get("commandStack",!1)}zl.$inject=["injector"],zl.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const ni={__init__:["rules"],rules:["type",zl]};function An(e){W.call(this,e),this.init()}An.$inject=["eventBus"],J(An,W),An.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)})},An.prototype.init=function(){};function Hm(e,t){var n=Lt(e,t,-15);return n!=="intersect"?n:null}function Bt(e){An.call(this,e)}J(Bt,An),Bt.$inject=["eventBus"],Bt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return DR(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 Os(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Os(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 eg(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Ve(i)&&!Is(t,i)?!1:lr(t,function(r){return Ve(r)?Os(r.source,r.target,r):r.host?Ko(r,r.host,null,n):Ul(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 Ym(a)&&!n.includes(a.host)})?!1:Ko(n,t,null,i)||Qm(n,t,i)||Jm(n,t)||Is(n,t)}),this.addRule("shape.create",function(e){return Ul(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Ko(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return og(n,t)})},Bt.prototype.canConnectMessageFlow=ig,Bt.prototype.canConnectSequenceFlow=rg,Bt.prototype.canConnectDataAssociation=ql,Bt.prototype.canConnectAssociation=tg,Bt.prototype.canConnectCompensationAssociation=ng,Bt.prototype.canMove=Jm,Bt.prototype.canAttach=Ko,Bt.prototype.canReplace=Qm,Bt.prototype.canDrop=io,Bt.prototype.canInsert=Is,Bt.prototype.canCreate=Ul,Bt.prototype.canConnect=Os,Bt.prototype.canResize=eg,Bt.prototype.canCopy=og;function DR(e){return Vl(e)?null:Ee(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Vl(e){return!e||be(e)}function zm(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 Wl(e){return y(e,"bpmn:Group")&&!e.labelTarget}function Vm(e){return y(e,"bpmn:BoundaryEvent")&&ii(e,"bpmn:CompensateEventDefinition")}function Ds(e){return U(e).isForCompensation}function OR(e,t){var n=zm(e),i=zm(t);return n===i}function IR(e){return y(e,"bpmn:InteractionNode")&&!y(e,"bpmn:BoundaryEvent")&&(!y(e,"bpmn:Event")||y(e,"bpmn:ThrowEvent")&&Um(e,"bpmn:MessageEventDefinition"))}function LR(e){return y(e,"bpmn:InteractionNode")&&!Ds(e)&&(!y(e,"bpmn:Event")||y(e,"bpmn:CatchEvent")&&Um(e,"bpmn:MessageEventDefinition"))&&!(y(e,"bpmn:BoundaryEvent")&&!ii(e,"bpmn:MessageEventDefinition"))}function Gm(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 Wm(e,t){var n=Gm(e),i=Gm(t);return n===i}function ii(e,t){var n=U(e);return!!qe(n.eventDefinitions||[],function(i){return y(i,t)})}function Um(e,t){var n=U(e);return(n.eventDefinitions||[]).every(function(i){return y(i,t)})}function NR(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:EndEvent")&&!Ut(e)&&!(y(e,"bpmn:IntermediateThrowEvent")&&ii(e,"bpmn:LinkEventDefinition"))&&!Vm(e)&&!Ds(e)}function BR(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:StartEvent")&&!y(e,"bpmn:BoundaryEvent")&&!Ut(e)&&!(y(e,"bpmn:IntermediateCatchEvent")&&ii(e,"bpmn:LinkEventDefinition"))&&!Ds(e)}function $R(e){return y(e,"bpmn:ReceiveTask")||y(e,"bpmn:IntermediateCatchEvent")&&(ii(e,"bpmn:MessageEventDefinition")||ii(e,"bpmn:TimerEventDefinition")||ii(e,"bpmn:ConditionalEventDefinition")||ii(e,"bpmn:SignalEventDefinition"))}function jR(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function qm(e,t){var n=jR(t);return n.indexOf(e)!==-1}function Os(e,t,n){if(Vl(e)||Vl(t))return null;if(!y(n,"bpmn:DataAssociation")){if(ig(e,t))return{type:"bpmn:MessageFlow"};if(rg(e,t))return{type:"bpmn:SequenceFlow"}}var i=ql(e,t);return i||(ng(e,t)?{type:"bpmn:Association",associationDirection:"One"}:tg(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function io(e,t){return be(e)||Wl(e)?!0:y(t,"bpmn:Participant")&&!Re(t)?!1:y(e,"bpmn:Participant")?y(t,"bpmn:Process")||y(t,"bpmn:Collaboration"):Ee(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")&&!FR(e)?!1:y(e,"bpmn:FlowElement")&&!y(e,"bpmn:DataStoreReference")?y(t,"bpmn:FlowElementsContainer")?Re(t):Ee(t,["bpmn:Participant","bpmn:Lane"]):y(e,"bpmn:DataStoreReference")&&y(t,"bpmn:Collaboration")?Pi(U(t).get("participants"),function(n){return!!n.get("processRef")}):Ee(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ee(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 FR(e){return U(e).cancelActivity&&(Km(e)||Xm(e))}function Ym(e){return!be(e)&&y(e,"bpmn:BoundaryEvent")}function HR(e){return y(e,"bpmn:Lane")}function zR(e){return Ym(e)||y(e,"bpmn:IntermediateThrowEvent")&&Km(e)?!0:y(e,"bpmn:IntermediateCatchEvent")&&Xm(e)}function Km(e){var t=U(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Xm(e){return Zm(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Zm(e,t){return t.some(function(n){return ii(e,n)})}function VR(e){return y(e,"bpmn:ReceiveTask")&&qe(e.incoming,function(t){return y(t.source,"bpmn:EventBasedGateway")})}function Ko(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return be(r)||!zR(r)||Ut(t)||!y(t,"bpmn:Activity")||Ds(t)||i&&!Hm(i,t)||VR(t)?!1:"attach"}function Qm(e,t,n){if(!t)return!1;var i={replacements:[]};return T(e,function(r){Ut(t)||y(r,"bpmn:StartEvent")&&r.type!=="label"&&io(r,t)&&(Qw(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(Jw(r)||e1(r)||t1(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Zm(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")||ii(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(y(r,"bpmn:EndEvent")&&io(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),y(r,"bpmn:BoundaryEvent")&&Ko(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Jm(e,t){return Pi(e,HR)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return io(n,t)})}function Ul(e,t,n,i){return t?be(e)||Wl(e)?!0:io(e,t)||Is(e,t):!1}function eg(e,t,n){return y(e,"bpmn:SubProcess")?Re(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:Wl(e)?!0:be(e)?n?n==="e"||n==="w":!0:!1}function GR(e,t){var n=Gl(e),i=Gl(t);return(n||i)&&n!==i}function tg(e,t){return qm(t,e)||qm(e,t)?!1:GR(e,t)?!0:!!ql(e,t)}function ng(e,t){return Wm(e,t)&&Vm(e)&&y(t,"bpmn:Activity")&&!UR(t,e)&&!Ut(t)}function ig(e,t){return sg(e)&&!sg(t)?!1:IR(e)&&LR(t)&&!OR(e,t)}function rg(e,t){return NR(e)&&BR(t)&&Wm(e,t)&&!(y(e,"bpmn:EventBasedGateway")&&!$R(t))}function ql(e,t){return Ee(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ee(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Ee(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ee(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Is(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:Ee(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!be(t)&&y(e,"bpmn:FlowNode")&&!y(e,"bpmn:BoundaryEvent")&&io(e,t.parent)}function Yl(e,t){return e&&t&&e.indexOf(t)!==-1}function og(e,t){return be(t)?!0:!(y(t,"bpmn:Lane")&&!Yl(e,t.parent)||y(t,"bpmn:MessageFlow")&&!WR(e,t))}function WR(e,t){var n=ag(t.source),i=ag(t.target);return Yl(e,n)&&Yl(e,i)}function ag(e){for(;e;e=e.parent)if(y(e,"bpmn:Participant"))return e;return null}function sg(e){return Xr(e,"bpmn:Process")||Xr(e,"bpmn:Collaboration")}function UR(e,t){return e.attachers.includes(t)}const qR={__depends__:[ni],__init__:["bpmnRules"],bpmnRules:["type",Bt]};var YR=2e3;function cg(e,t){e.on("saveXML.start",YR,n);function n(){var i=t.getRootElements();T(i,function(r){var o=Me(r),a,s;a=Do([r]),a=we(a,function(c){return c!==r&&!c.labelTarget}),s=Ht(a,Me),o.set("planeElement",s)})}}cg.$inject=["eventBus","canvas"];const KR={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",cg]};function Ls(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)})}Ls.prototype.getOrdering=function(e,t){return null},J(Ls,W);function Kl(e,t){Ls.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=qe(n,function(c){return Ee(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&&!Ee(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=Sf(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}}}Kl.$inject=["eventBus","canvas"],J(Kl,Ls);const XR={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Kl]};function Xo(){}Xo.prototype.get=function(){return this._data},Xo.prototype.set=function(e){this._data=e},Xo.prototype.clear=function(){var e=this._data;return delete this._data,e},Xo.prototype.isEmpty=function(){return!this._data};const ZR={clipboard:["type",Xo]};var ug=1500;function lg(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",ug,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",ug,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=Er(a),c=document.elementFromPoint(s.x,s.y),QR(c)}}lg.$inject=["elementRegistry","eventBus","injector"];function QR(e){return gr(e,"svg, .djs-element",!0)}const JR={__init__:["hoverFix"],hoverFix:["type",lg]};function eC(e){return!0}function Ns(e){return Wi(e)||oR(e)}var pg=500;function fg(e,t,n){var i=this;function r(P,$,j){if(!s(P,$)){var L,H,re;j?H=t.getGraphics(j):(L=$.delegateTarget||$.target,L&&(H=L,j=t.get(H))),!(!H||!j)&&(re=e.fire(P,{element:j,gfx:H,originalEvent:$}),re===!1&&($.stopPropagation(),$.preventDefault()))}}var o={};function a(P){return o[P]}function s(P,$){var j=u[P]||Wi;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":eC,"element.mousedown":Ns,"element.mouseup":Ns,"element.click":Ns,"element.dblclick":Ns};function l(P,$,j){var L=c[P];if(!L)throw new Error("unmapped DOM event name <"+P+">");return r(L,$,j)}var p="svg, .djs-element";function f(P,$,j,L){var H=o[j]=function(re){r(j,re)};L&&(u[j]=L),H.$delegate=an.bind(P,p,$,H)}function d(P,$,j){var L=a(j);L&&an.unbind(P,$,L.$delegate)}function h(P){T(c,function($,j){f(P,j,$)})}function m(P){T(c,function($,j){d(P,j,$)})}e.on("canvas.destroy",function(P){m(P.svg)}),e.on("canvas.init",function(P){h(P.svg)}),e.on(["shape.added","connection.added"],function(P){var $=P.element,j=P.gfx;e.fire("interactionEvents.createHit",{element:$,gfx:j})}),e.on(["shape.changed","connection.changed"],pg,function(P){var $=P.element,j=P.gfx;e.fire("interactionEvents.updateHit",{element:$,gfx:j})}),e.on("interactionEvents.createHit",pg,function(P){var $=P.element,j=P.gfx;i.createDefaultHit($,j)}),e.on("interactionEvents.updateHit",function(P){var $=P.element,j=P.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(P,$){return $=D({stroke:"white",strokeWidth:15},$||{}),n.cls(P,["no-fill","no-border"],$)}function A(P,$){var j=x[$];if(!j)throw new Error("invalid hit type <"+$+">");return ee(P,j),P}function I(P,$){ve(P,$)}this.removeHits=function(P){var $=qa(".djs-hit",P);T($,wt)},this.createDefaultHit=function(P,$){var j=P.waypoints,L=P.isFrame,H;return j?this.createWaypointsHit($,j):(H=L?"stroke":"all",this.createBoxHit($,H,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,$){var j=ko($);return A(j,"stroke"),I(P,j),j},this.createBoxHit=function(P,$,j){j=D({x:0,y:0},j);var L=ae("rect");return A(L,$),ee(L,j),I(P,L),L},this.updateDefaultHit=function(P,$){var j=Fe(".djs-hit",$);if(j)return P.waypoints?Lu(j,P.waypoints):ee(j,{width:P.width,height:P.height}),j},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}fg.$inject=["eventBus","elementRegistry","styles"];const Bs={__init__:["interactionEvents"],interactionEvents:["type",fg]};function ro(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)})}ro.$inject=["eventBus","canvas"],ro.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()})}},ro.prototype.get=function(){return Array.from(this._selectedElements)},ro.prototype.isSelected=function(e){return this._selectedElements.has(e)},ro.prototype.select=function(e,t){var n=this.get();le(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?T(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var dg="hover",hg="selected";function mg(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,dg)}),t.on("element.out",function(r){i(r.element,dg)}),t.on("selection.changed",function(r){function o(u){i(u,hg)}function a(u){n(u,hg)}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)})}mg.$inject=["canvas","eventBus"];function gg(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;le(u)?t.select(u):t.select(s.filter(tC))}}),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=qe(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Wi(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Ms(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}gg.$inject=["eventBus","selection","canvas","elementRegistry"];function tC(e){return!e.hidden}const Tn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Bs],selection:["type",ro],selectionVisuals:["type",mg],selectionBehavior:["type",gg]};var nC=/^djs-cursor-.*$/;function $s(e){var t=Je(document.body);t.removeMatching(nC),e&&t.add("djs-cursor-"+e)}function vg(){$s(null)}var iC=5e3;function yg(e,t){t=t||"element.click";function n(){return!1}return e.once(t,iC,n),function(){e.off(t,n)}}var rC=["c","C"],oC=["v","V"],aC=["d","D"],sC=["x","X"],cC=["y","Y"],_g=["z","Z"];function uC(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function un(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function St(e,t){return e=le(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Xl(e){return e.shiftKey}function lC(e){return un(e)&&St(rC,e)}function pC(e){return un(e)&&St(oC,e)}function fC(e){return un(e)&&St(aC,e)}function dC(e){return un(e)&&St(sC,e)}function hC(e){return un(e)&&!Xl(e)&&St(_g,e)}function mC(e){return un(e)&&(St(cC,e)||St(_g,e)&&Xl(e))}var oo=Math.round,bg="djs-drag-active";function Sr(e){e.preventDefault()}function gC(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function vC(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function xg(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(D({},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,P=Er(b),$=Hn(P,I),j=o.localStart,L=a(P),H=Hn(L,j);if(!o.active&&(x||vC($)>o.threshold)){if(D(S,{x:oo(j.x+A.x),y:oo(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&&$s(o.cursor),t.addMarker(t.getRootElement(),bg)}Tl(b),o.active&&(D(S,{x:oo(L.x+A.x),y:oo(L.y+A.y),dx:oo(H.x),dy:oo(H.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){St("Escape",b)&&(Sr(b),g())}function f(b){var x;o.active&&(x=yg(e),setTimeout(x,400),Sr(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"),vg(),o.trapClick?S=f:S=l,he.unbind(document,"mousemove",u),he.unbind(document,"dragstart",Sr),he.unbind(document,"selectstart",Sr),he.unbind(document,"mousedown",S,!0),he.unbind(document,"mouseup",S,!0),he.unbind(document,"keyup",p),he.unbind(document,"touchstart",d,!0),he.unbind(document,"touchcancel",g,!0),he.unbind(document,"touchmove",u,!0),he.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),bg);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=D({},r,A||{});var I=A.data||{},P,$,j,L,H;if(A.trapClick?L=f:L=l,b?(P=no(b)||b,$=Er(b),Tl(b),P.type==="dragstart"&&Sr(P)):(P=null,$={x:0,y:0}),j=a($),x||(x=j),H=gC(P),o=D({prefix:S,data:I,payload:{},globalStart:$,displacement:Hn(x,j),localStart:j,isTouch:H},A),A.manual||(H?(he.bind(document,"touchstart",d,!0),he.bind(document,"touchcancel",g,!0),he.bind(document,"touchmove",u,!0),he.bind(document,"touchend",l,!0)):(he.bind(document,"mousemove",u),he.bind(document,"dragstart",Sr),he.bind(document,"selectstart",Sr),he.bind(document,"mousedown",L,!0),he.bind(document,"mouseup",L,!0)),he.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){D(r,b)}}xg.$inject=["eventBus","canvas","selection","elementRegistry"];const yi={__depends__:[JR,Tn],dragging:["type",xg]};function ao(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}ao.prototype.next=function(){return this._prefix+ ++this._counter};const yC=new ao("ps");var _C=["marker-start","marker-mid","marker-end"],bC=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Ui(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Ui.$inject=["elementRegistry","eventBus","canvas","styles"],Ui.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},Ui.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Ui.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Id(n);return this._cloneMarkers(_r(r),i),ee(r,this._styles.cls(i,[])),ve(t,r),ee(r,"data-preview-support-element-id",e.id),r},Ui.prototype.addFrame=function(e,t){var n=ae("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ve(t,n),ee(n,"data-preview-support-element-id",e.id),n},Ui.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),SC(e)&&_C.forEach(function(r){if(ee(e,r)){var o=xC(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},Ui.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,yC.next()].join("-"),a=Fe("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Id(n);s.id=o,Ce(s).add(r);var c=Fe(":scope > defs",e);c||(c=ae("defs"),ve(e,c)),ve(c,s);var u=wC(s.id);ee(t,i,u)};function xC(e,t,n){var i=EC(ee(e,t));return Fe("marker#"+i,n||document)}function EC(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function wC(e){return"url(#"+e+")"}function SC(e){return bC.indexOf(e.nodeName)!==-1}const so={__init__:["previewSupport"],previewSupport:["type",Ui]};var RC="drop-ok",Eg="drop-not-ok",wg="attach-ok",Sg="new-parent",Rg="create",CC=2e3;function Cg(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=we(c,function(E){var b=E.labelTarget;return!E.parent&&!(be(E)&&c.indexOf(b)!==-1)});var d=qe(c,function(E){return!Ve(E)}),h=!1,m=!1,g=!1;Ag(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(Ag(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){[wg,RC,Eg,Sg].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}Pg(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,wg):a(p,m?Sg:Eg))}),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;Pg(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,D({},w,{attach:m})),p=qe(f,function(b){return!Ve(b)})),D(u,{elements:f,shape:p}),D(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Rg&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],CC,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){le(u)||(u=[u]);var p=qe(u,function(h){return!Ve(h)});if(p){l=D({elements:u,hints:{},shape:p},l||{}),T(u,function(h){de(h.x)||(h.x=0),de(h.y)||(h.y=0)});var f=we(u,function(h){return!h.hidden}),d=ft(f);T(u,function(h){Ve(h)&&(h.waypoints=Ht(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),D(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,Rg,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}Cg.$inject=["canvas","dragging","eventBus","modeling","rules"];function Pg(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 Ag(e){return e&&e.length===1&&!Ve(e[0])}var PC=750;function Tg(e,t,n,i,r){function o(a){var s=ae("g");ee(s,r.cls("djs-drag-group",["no-events"]));var c=ae("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(_r(l),u)):(l=n._createContainer("shape",c),n.drawShape(_r(l),u),Nt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",PC,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(),ve(p,l)),Nt(l,a.x,a.y)):wt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&wt(c)})}Tg.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const js={__depends__:[yi,so,ni,Tn],__init__:["create","createPreview"],create:["type",Cg],createPreview:["type",Tg]};function Zl(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)})}Zl.$inject=["eventBus"],Zl.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||AC(0,0)};function AC(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 Zo={__init__:["mouse"],mouse:["type",Zl]};var Mg=2e3;function ln(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),TC(l)&&(u.priority=2,u.host=l.host.id),Ve(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=MC(l)),be(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),T(["x","y","width","height"],function(f){de(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",Mg,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Mg,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;D(u,{createElementsBehavior:!1})})}ln.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],ln.prototype.copy=function(e,t={}){var n,i;return le(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(le(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},ln.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})}}},ln.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},ln.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},ln.prototype._getElementIdsFromTree=function(e){var t={};return T(e,function(n){T(n,function(i){i.id&&(t[i.id]=!0)})}),t},ln.prototype._paste=function(e,t,n,i){T(e,function(o){de(o.x)||(o.x=0),de(o.y)||(o.y=0)});var r=ft(e);return T(e,function(o){Ve(o)&&(o.waypoints=Ht(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),D(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,D({},i))},ln.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return T(e,function(o,a){o=Wn(o,"priority"),T(o,function(s){var c=D({},Un(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(Ve(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(be(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},ln.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Un(e,["id"]));return t},ln.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Un(e,["id"]));return t},ln.prototype.createShape=function(e){var t=this._elementFactory.createShape(Un(e,["id"]));return t},ln.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Ve(e)&&(!n.has(e.source)||!n.has(e.target))||be(e)&&!n.has(e.labelTarget))},ln.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Za(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}yr(a,function(p,f,d){if(be(p))return;T(p.labels,function(g){c(g,d)});function h(g){g&&g.length&&T(g,function(w){T(w.labels,function(E){c(E,d)}),c(w,d)})}T([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=Ht(r,function(p){return p.element});var l=new Set(e);return r=Ht(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=Wn(r,function(p){return p.descriptor.priority}),e=Ht(r,function(p){return p.element}),T(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){Dg(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){Dg(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function TC(e){return!!e.host}function MC(e){return Ht(e.waypoints,function(t){return t=kg(t),t.original&&(t.original=kg(t.original)),t})}function kg(e){return D({},e)}function Dg(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const kC={__depends__:[ZR,js,Zo,ni],__init__:["copyPaste"],copyPaste:["type",ln]};function Ql(e,t,n){le(n)||(n=[n]),T(n,function(i){ur(e[i])||(t[i]=e[i])})}var Jl=750;function Og(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Jl,function(c){var u=c.descriptor,l=c.element,p=U(l);if(be(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Me(l),!0);d.bpmnElement=f,Ql(f,u,"name"),Ql(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])),Un(l,on(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(be(l)){l.businessObject=U(u[l.labelTarget]),l.di=Me(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,Ql(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",Jl,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")&&T($o(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",Jl,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Og.$inject=["bpmnFactory","eventBus","moddleCopy"];const DC=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],OC=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Qo(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 Wn(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=At(r)&&r.$descriptor;if(a&&OC.includes(a))return o;if(a&&DC.includes(a)||a&&s&&!qe(s.properties,jr({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})}Qo.$inject=["eventBus","bpmnFactory","moddle"],Qo.prototype.copyElement=function(e,t,n,i=!1){n&&!le(n)&&(n=[n]),n=n||ep(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(le(r)&&(n=r),T(n,o=>{let a;rn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!xt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Qo.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 At(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):le(e)?on(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):At(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},Qo.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 ep(e,t){return on(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Ig={__depends__:[kC],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Og],moddleCopy:["type",Qo]};var Lg=Math.round;function tp(e,t){this._modeling=e,this._eventBus=t}tp.$inject=["modeling","eventBus"],tp.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=Lg(s+o/2),l=Lg(c+a/2),p=i.replaceShape(e,D({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function Ng(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Ng.$inject=["selection","eventBus"];const IC={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Ng],replace:["type",tp]};function LC(e,t,n){le(n)||(n=[n]),T(n,function(i){ur(e[i])||(t[i]=e[i])})}var NC=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function BC(e,t){var n=e&&rn(e,"collapsed")?e.collapsed:!Re(e),i;return t&&(rn(t,"collapsed")||rn(t,"isExpanded"))?i=rn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Bg(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(Fs(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&BC(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),LC(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=ep(p.$descriptor),m=ep(f.$descriptor,!0),g=$C(h,m);D(f,jn(c,NC));var w=we(g,function(x){return x==="eventDefinitions"?$g(s,c.eventDefinitionType):x==="loopCharacteristics"?!Ut(f):rn(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!Ut(f):!0});if(f=n.copyElement(p,f,w),c.eventDefinitionType&&($g(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),y(p,"bpmn:Activity")){if(Fs(p))d.isExpanded=Re(s);else if(c&&rn(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}Re(s)&&!y(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Fs(p)&&!Fs(f)&&(u.moveChildren=!1),y(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=kt(s);Me(s).isHorizontal||(Me(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,Ee(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Ee(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}Bg.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Fs(e){return y(e,"bpmn:SubProcess")}function $g(e,t){var n=U(e);return t&&n.get("eventDefinitions").some(function(i){return y(i,t)})}function $C(e,t){return e.filter(function(n){return t.includes(n)})}const jg={__depends__:[Ig,IC,Tn],bpmnReplace:["type",Bg]};var jC=250;function Rr(e){this._eventBus=e,this._tools=[],this._active=null}Rr.$inject=["eventBus"],Rr.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)},Rr.prototype.isActive=function(e){return e&&this._active===e},Rr.prototype.length=function(e){return this._tools.length},Rr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Rr.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(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,jC,function(r){this._active&&(FC(r)||this.setActive(null))},this)};function FC(e){var t=e.originalEvent&&e.originalEvent.target;return t&&gr(t,'.group[data-group="tools"]')}const Hs={__depends__:[yi],__init__:["toolManager"],toolManager:["type",Rr]};function HC(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 zC(e,t){var n=[],i=new Set(e);T(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;T(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 VC(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 np=Math.abs,GC=Math.round,_i={x:"width",y:"height"},Fg="crosshair",qi={n:"top",w:"left",s:"bottom",e:"right"},WC=1500,zs={n:"s",w:"e",s:"n",e:"w"},Vs=20;function Mn(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",WC,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&zg(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){zg(c);var m={x:0,y:0};m[l]=GC(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Mn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Mn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Fg,data:{context:{reactivate:n}},trapClick:!1})},Mn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Fg,data:{context:{}}})},Mn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Mn.prototype.init=function(e,t){var n=np(e.dx)>np(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(np(i)<5)return!1;i<0&&(i*=-1),Yo(e)&&(i*=-1);var o=HC(n,i),a=this._canvas.getRootElement();!Ms(e)&&e.hover&&(a=e.hover);var s=[...Do(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=UC(c,n,o,r,u);return D(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),$s("resize-"+(n==="x"?"ew":"ns")),!0},Mn.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 T(e,function(d){if(!(!d.parent||be(d))){if(Ve(d)){l.push(d);return}var h=d[t],m=h+d[_i[t]];if(qC(d)&&(n>0&&pe(d)[t]>i||n<0&&pe(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}}}),T(o,function(d){var h=d.attachers;h&&T(h,function(m){p(m)})}),T(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&p(d)}),T(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}},Mn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Mn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Hg(e){return{top:e.top-Vs,right:e.right+Vs,bottom:e.bottom+Vs,left:e.left-Vs}}function zg(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;de(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),de(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),de(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),de(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function UC(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 T(a,function(f){var d=f.attachers,h=f.children,m=ue(f),g=we(h,function(H){return!Ve(H)&&!be(H)&&!l.has(H)&&!p.has(H)}),w=we(h,function(H){return!Ve(H)&&!be(H)&&l.has(H)}),E,b,x,S=[],A=[],I,P,$,j;g.length&&(b=Hg(ue(ft(g))),E=i-m[qi[n]]+b[qi[n]],n==="n"?s.bottom=u=de(u)?Math.min(u,E):E:n==="w"?s.right=u=de(u)?Math.min(u,E):E:n==="s"?s.top=c=de(c)?Math.max(c,E):E:n==="e"&&(s.left=c=de(c)?Math.max(c,E):E)),w.length&&(x=Hg(ue(ft(w))),E=i-x[qi[zs[n]]]+m[qi[zs[n]]],n==="n"?s.bottom=u=de(u)?Math.min(u,E):E:n==="w"?s.right=u=de(u)?Math.min(u,E):E:n==="s"?s.top=c=de(c)?Math.max(c,E):E:n==="e"&&(s.left=c=de(c)?Math.max(c,E):E)),d&&d.length&&(d.forEach(function(H){l.has(H)?S.push(H):A.push(H)}),S.length&&(I=ue(ft(S.map(pe))),P=m[qi[zs[n]]]-(I[qi[zs[n]]]-i)),A.length&&($=ue(ft(A.map(pe))),j=$[qi[n]]-(m[qi[n]]-i)),n==="n"?(E=Math.min(P||1/0,j||1/0),s.bottom=u=de(u)?Math.min(u,E):E):n==="w"?(E=Math.min(P||1/0,j||1/0),s.right=u=de(u)?Math.min(u,E):E):n==="s"?(E=Math.max(P||-1/0,j||-1/0),s.top=c=de(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(P||-1/0,j||-1/0),s.left=c=de(c)?Math.max(c,E):E));var L=r&&r[f.id];L&&(n==="n"?(E=i+f[_i[t]]-L[_i[t]],s.bottom=u=de(u)?Math.min(u,E):E):n==="w"?(E=i+f[_i[t]]-L[_i[t]],s.right=u=de(u)?Math.min(u,E):E):n==="s"?(E=i-f[_i[t]]+L[_i[t]],s.top=c=de(c)?Math.max(c,E):E):n==="e"&&(E=i-f[_i[t]]+L[_i[t]],s.left=c=de(c)?Math.max(c,E):E))}),s}}function qC(e){return!!e.host}var ip="djs-dragging",Vg="djs-resizing",YC=250,Gs=Math.max;function Gg(e,t,n,i,r){function o(a,s){T(a,function(c){r.addDragger(c,s),n.addMarker(c,ip)})}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=ae("g");ee(l,i.cls("djs-crosshair-group",["no-events"])),ve(s,l);var p=ae("path");ee(p,"d",u.x),Ce(p).add("djs-crosshair"),ve(l,p);var f=ae("path");ee(f,"d",u.y),Ce(f).add("djs-crosshair"),ve(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Nt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&wt(c)}),e.on("spaceTool.move",YC,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=ae("path"),ee(c,"d","M0,0 L0,0"),Ce(c).add("djs-crosshair"),ve(f,c),s.line=c;var d=ae("g");ee(d,i.cls("djs-drag-group",["no-events"])),ve(n.getActiveLayer(),d),o(l,d);var h=new Set(l);T(p,function(A){h.add(A)});var m=new Set,g=s.movingConnections=[];h.forEach(function(A){T(A.outgoing,function(I){m.has(I)||!Ve(I)||!h.has(I.target)||(m.add(I),g.push(I))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var w=ae("g");ee(w,i.cls("djs-frame-group",["no-events"])),ve(n.getActiveLayer(),w);var E=[];T(p,function(A){var I=r.addFrame(A,w),P=I.getBBox();E.push({element:I,initialBounds:P}),n.addMarker(A,Vg)}),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};ee(c,{d:b[u]});var x={x:"y",y:"x"},S={x:a.dx,y:a.dy};S[x[s.axis]]=0,Nt(s.dragGroup,S.x,S.y),T(s.frames,function(A){var I=A.element,P=A.initialBounds,$,j;s.direction==="e"?ee(I,{width:Gs(P.width+S.x,5)}):($=Gs(P.width-S.x,5),ee(I,{width:$,x:P.x+P.width-$})),s.direction==="s"?ee(I,{height:Gs(P.height+S.y,5)}):(j=Gs(P.height-S.y,5),ee(I,{height:j,y:P.y+P.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;T(c,function(h){n.removeMarker(h,ip)}),T(u,function(h){n.removeMarker(h,ip)}),f&&(wt(p),wt(f)),T(l,function(h){n.removeMarker(h,Vg)}),d&&wt(d)})}Gg.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const KC={__init__:["spaceToolPreview"],__depends__:[yi,ni,Hs,so,Zo],spaceTool:["type",Mn],spaceToolPreview:["type",Gg]};function Ws(e,t){e.invoke(Mn,this),this._canvas=t}Ws.$inject=["injector","canvas"],J(Ws,Mn),Ws.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Br(Vr(r.children.filter(u=>y(u,"bpmn:Artifact")),ft(o))));const s=[...e,...a];var c=Mn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(y(u,"bpmn:TextAnnotation")||XC(u)&&(t==="y"&&kt(u)||t==="x"&&!kt(u)))}),c};function XC(e){return y(e,"bpmn:Participant")&&!U(e).processRef}const Wg={__depends__:[KC],spaceTool:["type",Ws]};function nt(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)}nt.$inject=["eventBus","injector"],nt.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()},nt.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},nt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},nt.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()}},nt.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()}},nt.prototype.register=function(e,t){this._setHandler(e,t)},nt.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)},nt.prototype.canUndo=function(){return!!this._getUndoAction()},nt.prototype.canRedo=function(){return!!this._getRedoAction()},nt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},nt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},nt.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)})},nt.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},nt.prototype._createId=function(){return this._uid++},nt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},nt.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()},nt.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)},nt.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:Rf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},nt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=le(e)?e:[e],t.dirty=t.dirty.concat(e))},nt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},nt.prototype._revertedAction=function(e){this._stackIdx--},nt.prototype._getHandler=function(e){return this._handlerMap[e]},nt.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 ZC={commandStack:["type",nt]};function Yi(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 QC=250,Ug=1400;function rp(e,t,n){W.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Ug,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=qg(a),o.validatedShapes=qg(s)}),i&&t.on("shape.move.start",QC,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",Ug,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];T(s,function(u){T(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;Yi(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=Bu(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&&(lt(s.labels,a,c),a.labelTarget=s)})}J(rp,W),rp.$inject=["injector","eventBus","modeling"];function qg(e){var t=new Set(e);return we(e,function(n){return!t.has(n.labelTarget)})}const JC={__init__:["labelSupport"],labelSupport:["type",rp]};var eP=251,Yg=1401,Kg="attach-ok";function op(e,t,n,i,r){W.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Yg,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=tP(c),s.validatedShapes=nP(u)}),o&&t.on("shape.move.start",eP,function(a){var s=a.context,c=s.shapes,u=ap(c);T(u,function(l){o.makeDraggable(s,l,!0),T(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,Kg),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Kg)}))}}),this.preExecuted("elements.move",Yg,function(a){var s=a.context,c=s.closure,u=s.shapes,l=ap(u);T(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=we(c,function(p){var f=p.host;return iP(p)&&!rP(c,f)}),T(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;T(s,function(c){T(c.attachers,function(u){T(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),T(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;Yi(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&&T(u.attachers,function(l){var p=dm(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&&T(p,function(d){var h=dm(d,u,l);r.moveShape(d,h,d.parent),T(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Yi(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}J(op,W),op.$inject=["injector","eventBus","canvas","rules","modeling"];function ap(e){return eu(Ht(e,function(t){return t.attachers||[]}))}function tP(e){var t=ap(e);return n0("id",e,t)}function nP(e){var t=$r(e,"id");return we(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function iP(e){return!!e.host}function rP(e,t){return e.indexOf(t)!==-1}const oP={__depends__:[ni],__init__:["attachSupport"],attachSupport:["type",op]};function Xg(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(zd(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)})}Xg.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const sp={__init__:["changeSupport"],changeSupport:["type",Xg]};function kn(e){this._model=e}kn.$inject=["moddle"],kn.prototype._needsId=function(e){return Ee(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"])},kn.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":Ee(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))},kn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},kn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},kn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",D({bpmnElement:e,bounds:this.createDiBounds()},t))},kn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},kn.prototype.createDiWaypoints=function(e){var t=this;return Ht(e,function(n){return t.createDiWaypoint(n)})},kn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",jn(e,["x","y"]))},kn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",D({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},kn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",D({bpmnElement:e},t))};function pn(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"],fn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],fn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;T(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"],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 h=d.context,m=h.connection,g=h.oldSource,w=h.newSource,E=U(m),b=U(g),x=U(w);E.conditionExpression&&!Ee(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",fn(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"],fn(p)),this.reverted(["element.updateAttachment"],fn(p)),this.executed("element.updateLabel",fn(f)),this.reverted("element.updateLabel",fn(f));function f(d){const{element:h}=d.context,m=bn(h),g=Me(h),w=g&&g.get("label");Hi(h)||ks(h)||(m&&!w?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&w&&g.set("label",void 0))}}J(pn,W),pn.$inject=["eventBus","bpmnFactory","connectionDocking"],pn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},pn.prototype.updateParent=function(e,t){if(!be(e)&&!(y(e,"bpmn:DataStoreReference")&&e.parent&&y(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Me(e),o=n&&n.businessObject,a=Me(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)}},pn.prototype.updateBounds=function(e){var t=Me(e),n=sP(e);if(n){var i=Hn(n,t.get("bounds"));D(n,{x:e.x+i.x,y:e.y+i.y})}var r=be(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),D(o,{x:e.x,y:e.y,width:e.width,height:e.height})},pn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;y(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),st(i,e)),y(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),lt(r,e))}},pn.prototype.updateDiConnection=function(e,t,n){var i=Me(e),r=Me(t),o=Me(n);i.sourceElement&&i.sourceElement.bpmnElement!==U(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==U(n)&&(i.targetElement=n&&o)},pn.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):(st(n,e),e.$parent=null)}};function aP(e){for(;e&&!y(e,"bpmn:Definitions");)e=e.$parent;return e}pn.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)},pn.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=aP(e.$parent||t),e.$parent&&(st(o.get("rootElements"),r),r.$parent=null),t&&(lt(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),st(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);st(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},pn.prototype.updateConnectionWaypoints=function(e){var t=Me(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},pn.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&&(st(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(st(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)},pn.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;y(i,"bpmn:BaseElement")&&e(t)}}function sP(e){if(y(e,"bpmn:Activity")){var t=Me(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Ki(e,t){hi.call(this),this._bpmnFactory=e,this._moddle=t}J(Ki,hi),Ki.$inject=["bpmnFactory","moddle"],Ki.prototype._baseCreate=hi.prototype.create,Ki.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,D({type:"label",di:n},br,t))}return this.createElement(e,t)},Ki.prototype.createElement=function(e,t){t=D({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!uP(r)){var o=D({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}y(i,"bpmn:Group")&&(t=D({isFrame:!0},t)),t=cP(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=cp(r,t,"isExpanded")),Ee(i,["bpmn:Lane","bpmn:Participant"])&&(t=cp(r,t,"isHorizontal")),y(i,"bpmn:SubProcess")&&(t.collapsed=!Re(i,r)),y(i,"bpmn:ExclusiveGateway")&&(rn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),xt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),xt(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=D({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},Ki.prototype.getDefaultSize=function(e,t){var n=U(e);if(t=t||Me(e),y(n,"bpmn:SubProcess"))return Re(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 Re(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}},Ki.prototype.createParticipantShape=function(e){return At(e)||(e={isExpanded:e}),e=D({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function cP(e,t,n){return T(n,function(i){t=cp(e,t,i)}),t}function cp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Un(t,[n]))}function uP(e){return Ee(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Us(e,t){this._modeling=e,this._canvas=t}Us.$inject=["modeling","canvas"],Us.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;T(n,function(r){var o={x:0,y:0};xt(i.left)?o.x=i.left-r.x:xt(i.right)?o.x=i.right-r.width-r.x:xt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:xt(i.top)?o.y=i.top-r.y:xt(i.bottom)?o.y=i.bottom-r.height-r.y:xt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Us.prototype.postExecute=function(e){};function qs(e){this._modeling=e}qs.$inject=["modeling"],qs.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},qs.prototype.postExecute=function(e){var t=e.hints||{};lP(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 lP(e,t){return Pi(e.outgoing,function(n){return n.target===t})}function Ys(e,t){this._canvas=e,this._layouter=t}Ys.$inject=["canvas","layouter"],Ys.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},Ys.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Ks=Math.round;function up(e){this._modeling=e}up.$inject=["modeling"],up.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;T(t,function(p){de(p.x)||(p.x=0),de(p.y)||(p.y=0)});var s=we(t,function(p){return!p.hidden}),c=ft(s);T(t,function(p){Ve(p)&&(p.waypoints=Ht(p.waypoints,function(f){return{x:Ks(f.x-c.x-c.width/2+r.x),y:Ks(f.y-c.y-c.height/2+r.y)}})),D(p,{x:Ks(p.x-c.x-c.width/2+r.x),y:Ks(p.y-c.y-c.height/2+r.y)})});var u=new Set(Za(t)),l={};T(t,function(p){if(Ve(p)){l[p.id]=de(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=D({},o);u.has(p)||(f.autoResize=!1),be(p)&&(f=Un(f,["attach"])),l[p.id]=de(i)?a.createShape(p,jn(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,jn(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Br(l)};var Zg=Math.round;function Xi(e){this._canvas=e}Xi.$inject=["canvas"],Xi.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?D(t,n):D(t,{x:n.x-Zg(t.width/2),y:n.y-Zg(t.height/2)}),this._canvas.addShape(t,i,r),t},Xi.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Jo(e){Xi.call(this,e)}J(Jo,Xi),Jo.$inject=["canvas"];var pP=Xi.prototype.execute;Jo.prototype.execute=function(e){var t=e.shape;return dP(t),t.labelTarget=e.labelTarget,pP.call(this,e)};var fP=Xi.prototype.revert;Jo.prototype.revert=function(e){return e.shape.labelTarget=null,fP.call(this,e)};function dP(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function ea(e,t){this._canvas=e,this._modeling=t}ea.$inject=["canvas","modeling"],ea.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Yi(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Yi(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},ea.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Bu(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},ea.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,lt(n.children,t,i),this._canvas.addConnection(t,n),t};function lp(e,t){this._modeling=e,this._elementRegistry=t}lp.$inject=["modeling","elementRegistry"],lp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;T(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};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.shape;Yi(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Yi(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Yi(n.children,function(i){Ve(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},ta.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Bu(i.children,n),t.removeShape(n),n},ta.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return lt(i.children,n,r),t.addShape(n,i),n};function Xs(e){this._modeling=e}Xs.$inject=["modeling"];var Qg={x:"y",y:"x"};Xs.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[Qg[i]]=0,t.moveElements([w],E,w.parent))}var l=n[0],p=s(n),f=n[p],d,h,m=0;T(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=Wn(g.elements,i),b=E[0],w===p&&(b=E[s(E)]),x=a(b),g.range=null,T(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)&&T(n,function(g,w){var E={},b;g===l||g===f||(b=n[w-1],g.range.max=0,T(g.elements,function(x,S){E[Qg[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)}))})},Xs.prototype.postExecute=function(e){};function Zs(e,t){this._layouter=e,this._canvas=t}Zs.$inject=["layouter","canvas"],Zs.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return D(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Zs.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function pp(){}pp.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=st(o.children,t),lt(i.children,t,r),t.parent=i,T(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},pp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return st(n.children,t),lt(i.children,t,r),t.parent=i,T(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 fp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}fp.prototype.add=function(e,t){return this.addAll([e],t)},fp.prototype.addAll=function(e,t){var n=VE(e,!!t,this);return D(this,n),this};function na(e){this._modeling=e}na.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},na.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),T(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),T(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&&_l(p,p.source,t),connectionEnd:d&&bl(p,p.target,t)})})},na.prototype.getClosure=function(e){return new fp().addAll(e,!0)};function Qs(e){this._helper=new na(e)}Qs.$inject=["modeling"],Qs.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Qs.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 Cr(e){this._modeling=e,this._helper=new na(e)}Cr.$inject=["modeling"],Cr.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=jn(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=st(o.children,t),lt(i.children,t,r),D(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Cr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(T(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:bl(o,t,n)})}),T(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:_l(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Cr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return lt(n.children,t,i),D(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Cr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Cr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function ia(e){this._modeling=e}ia.$inject=["modeling"],ia.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 le(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},ia.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||Jg(le(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Jg(le(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},ia.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 Jg(e){return e.original||e}function bi(e,t){this._modeling=e,this._rules=t}bi.$inject=["modeling","rules"],bi.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(h,m,g){return i.allowed("connection.reconnect",{connection:g,source:h,target:m})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();T(f,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,Rs(h,s,l),a)}),T(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,Ss(h,s,l),a)})},bi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},bi.prototype.execute=function(e){},bi.prototype.revert=function(e){},bi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},bi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},bi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function ra(e){this._modeling=e}ra.$inject=["modeling"],ra.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ra.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(T(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Rs(o,n,i)})}),T(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Ss(o,n,i)})}))},ra.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Zi(e){this._modeling=e}Zi.$inject=["modeling"],Zi.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),T(r,function(s){a[s.id]=mP(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(zC(i,r),t,n,o,i,r,a)},Zi.prototype.execute=function(){},Zi.prototype.revert=function(){},Zi.prototype.moveShapes=function(e,t){var n=this;T(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Zi.prototype.resizeShapes=function(e,t,n){var i=this;T(e,function(r){var o=VC(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Zi.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);T(e,function(l){var p=l.source,f=l.target,d=hP(l),h=tv(n),m={},g=c.has(p)||u.has(p),w=c.has(f)||u.has(f);g&&w?(d=Ht(d,function(E){return nv(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&nv(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=_l(l,p,t):c.has(f)?m.connectionEnd=bl(l,f,t):u.has(p)?m.connectionStart=Ss(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=Rs(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function ev(e){return D({},e)}function hP(e){return Ht(e.waypoints,function(t){return t=ev(t),t.original&&(t.original=ev(t.original)),t})}function tv(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function nv(e,t,n){var i=tv(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function mP(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Js(e){this._modeling=e}Js.$inject=["modeling"],Js.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=iv(n),t.collapsed=!t.collapsed;var i=rv(n,t.collapsed);return[t].concat(i)},Js.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=ov(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function iv(e){var t={};return T(e,function(n){t[n.id]=n.hidden,n.children&&(t=D({},t,iv(n.children)))}),t}function rv(e,t){var n=[];return T(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(rv(i.children,i.collapsed||t)))}),n}function ov(e,t){var n=[];return T(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(ov(i.children,t)))}),n}function ec(e){this._modeling=e}ec.$inject=["modeling"],ec.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=av(i,t),sv(n,t),t.host=n,t},ec.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,av(n,t),sv(i,t,r),t};function av(e,t){return st(e&&e.attachers,t)}function sv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),lt(i,t,n)}}function dp(){}dp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},dp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Ge(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Ge.$inject=["eventBus","elementFactory","commandStack"],Ge.prototype.getHandlers=function(){return{"shape.append":qs,"shape.create":Xi,"shape.delete":ta,"shape.move":Cr,"shape.resize":ra,"shape.replace":bi,"shape.toggleCollapse":Js,spaceTool:Zi,"label.create":Jo,"connection.create":Ys,"connection.delete":ea,"connection.move":pp,"connection.layout":Zs,"connection.updateWaypoints":dp,"connection.reconnect":ia,"elements.create":up,"elements.move":Qs,"elements.delete":lp,"elements.distribute":Xs,"elements.align":Us,"element.updateAttachment":ec}},Ge.prototype.registerHandlers=function(e){T(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Ge.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)},Ge.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Ge.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)},Ge.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)},Ge.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Ge.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},Ge.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},Ge.prototype.createElements=function(e,t,n,i,r){le(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},Ge.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},Ge.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},Ge.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ge.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Ge.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Ge.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Ge.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Ge.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Ge.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Ge.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)},Ge.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Ge.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)},Ge.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,D(i,{docking:"source"}))},Ge.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,D(i,{docking:"target"}))},Ge.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Ge.prototype._create=function(e,t){return Aw(t)?t:this._elementFactory.create(e,t)},Ge.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function oa(e){this._elementRegistry=e}oa.$inject=["elementRegistry"],oa.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||gP(n,ka(i));return cv(n,i),e.oldProperties=o,e.changed=r,r},oa.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return cv(n,t),i},oa.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return y(e,"bpmn:DataObject")?vP(e,t):[]};function gP(e,t){return on(t,function(n,i){return n[i]=e.get(i),n},{})}function cv(e,t){T(t,function(n,i){e.set(i,n)})}function vP(e,t){return t.filter(function(n){return y(n,"bpmn:DataObjectReference")&&U(n).dataObjectRef===e})}var aa="default",xi="id",uv="di",yP={width:0,height:0};function sa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}sa.$inject=["elementRegistry","moddle","modeling","textRenderer"],sa.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=wP(e.properties),s=e.oldProperties||_P(t,a);return lv(a,o)&&(r.unclaim(o[xi]),i.updateId(t,a[xi]),r.claim(a[xi],o)),aa in a&&(a[aa]&&n.push(i.get(a[aa].id)),o[aa]&&n.push(i.get(o[aa].id))),pv(t,a),e.oldProperties=s,e.changed=n,n},sa.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,yP)}},sa.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 pv(t,i),lv(n,r)&&(a.unclaim(n[xi]),o.updateId(t,i[xi]),a.claim(i[xi],r)),e.changed};function lv(e,t){return xi in e&&e[xi]!==t[xi]}function _P(e,t){var n=ka(t),i=e.businessObject,r=Me(e);return on(n,function(o,a){return a!==uv?o[a]=i.get(a):o[a]=bP(r,ka(t.di)),o},{})}function bP(e,t){return on(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function pv(e,t){var n=e.businessObject,i=Me(e);T(t,function(r,o){o!==uv?n.set(o,r):i&&xP(i,r)})}function xP(e,t){T(t,function(n,i){e.set(i,n)})}var EP=["default"];function wP(e){var t=D({},e);return EP.forEach(function(n){n in e&&(t[n]=U(t[n]))}),t}function tc(e,t){this._canvas=e,this._modeling=t}tc.$inject=["canvas","modeling"],tc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Me(r);return t.setRootElement(n),t.removeRootElement(r),lt(a.rootElements,i),i.$parent=a,st(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},tc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Me(n);return t.setRootElement(r),t.removeRootElement(n),st(a.rootElements,i),i.$parent=null,lt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function hp(e,t){this._modeling=e,this._spaceTool=t}hp.$inject=["modeling","spaceTool"],hp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Pn(i),a=o===i,s=a?i:i.parent,c=Vi(s),u=kt(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+Cn,y:i.y,width:i.width-Cn,height:i.height}:{x:i.x,y:i.y+Cn,width:i.width,height:i.height-Cn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];yr(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:we(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?Cn:0),y:d-(r==="top"?120:0),width:i.width-(a?Cn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Cn:0),width:120,height:i.height-(a?Cn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function mp(e){this._modeling=e}mp.$inject=["modeling"],mp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Vi(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=kt(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+Cn,y:n.y+f*c,width:n.width-Cn,height:u}:{x:n.x+f*c,y:n.y+Cn,width:u,height:n.height-Cn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function ca(e,t){this._modeling=e,this._spaceTool=t}ca.$inject=["modeling","spaceTool"],ca.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},ca.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=vS(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},ca.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ue(e),r=ue(t),o=Vh(r,i),a=Pn(e),s=[],c=[];yr(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 ua="flowNodeRef",gp="lanes";function nc(){}nc.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=Pn(l);return r[p.id]||(r[p.id]=_s(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=Pn(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(gp),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(ua).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},nc.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(gp);n.remove.forEach(function(o){st(r,o),st(o.get(ua),i)}),n.add.forEach(function(o){lt(r,o),lt(o.get(ua),i)})}),[]},nc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(gp);n.add.forEach(function(o){st(r,o),st(o.get(ua),i)}),n.remove.forEach(function(o){lt(r,o),lt(o.get(ua),i)})}),[]};var vp="categoryValueRef";function la(e,t){this._bpmnFactory=e,this._elementRegistry=t}la.$inject=["bpmnFactory","elementRegistry"],la.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:yp(E)}:S.past={categoryValue:b}))}}function c(E){r.set(E,U(E))}function u(){n.filter(function(E){return y(E,"bpmn:FlowElement")&&!be(E)&&E.parent}).forEach(c)}function l(E){var b=U(E),x=b.get("categoryValueRef");return x||(x=$h(i,b),o.push(SP(E,x))),x}function p(E){return E.reduce(function(b,x){var S=yp(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")&&!be(E)&&E.parent}).forEach(function(E){var b=U(E).get("categoryValueRef");if(!b){var x=yp(E),S=f.get(x)||[],A=Vr(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=Vr(S,b);S.forEach(function(I){if(A[I.id]){var P=m.get(I);P||(P=new Set,m.set(I,P)),P.add(x.categoryValue)}})}});var w=d.reduce(function(E,b){var x=r.get(b),S=x.get(vp),A=new Set(S),I=m.get(b)||new Set,P=Array.from(I).filter(function(j){return!A.has(j)}),$=S.filter(function(j){return h.has(j)&&!I.has(j)});return(P.length||$.length)&&E.push({businessObject:x,categoryValuesToAdd:P,categoryValuesToRemove:$}),E},[]);return{flowElements:w,groups:o}},la.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),RP(t.groups),PP(t.flowElements),[]},la.prototype.revert=function(e){var t=e.updates;return AP(t.flowElements),CP(t.groups),[]};function SP(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function RP(e){e.forEach(function(t){U(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function CP(e){e.forEach(function(t){U(t.groupShape).categoryValueRef=null})}function PP(e){e.forEach(function(t){var n=t.businessObject,i=n.get(vp);t.categoryValuesToRemove.forEach(function(r){st(i,r)}),t.categoryValuesToAdd.forEach(function(r){lt(i,r,!0)})})}function AP(e){e.forEach(function(t){var n=t.businessObject,i=n.get(vp);t.categoryValuesToAdd.forEach(function(r){st(i,r)}),t.categoryValuesToRemove.forEach(function(r){lt(i,r,!0)})})}function yp(e){for(;e.parent;)e=e.parent;return e}function ic(e){this._moddle=e}ic.$inject=["moddle"],ic.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),[]},ic.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 TP={fill:void 0,stroke:void 0};function _p(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(nn(t)){var n=MP(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}_p.$inject=["commandStack"],_p.prototype.postExecute=function(e){var t=e.elements,n=e.colors||TP,i=this,r={};"fill"in n&&D(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&D(r,{"border-color":this._normalizeColor(n.stroke)}),T(t,function(o){var a=Ve(o)?jn(r,["border-color"]):r,s=Me(o);if(kP(a),be(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(!Ee(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function MP(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 kP(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var DP={width:0,height:0};function fv(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return a1(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!be(u)&&Hi(u)&&!as(u)&&!dv(p)){var f=7,d=Vu(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=bn(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(!(!be(l)&&!y(l,"bpmn:TextAnnotation"))){if(be(l)&&dv(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=bn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,DP)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}fv.$inject=["modeling","textRenderer","bpmnFactory"];function dv(e){return!e||!e.trim()}function $t(e,t,n,i){Ge.call(this,e,t,n),this._bpmnRules=i}J($t,Ge),$t.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],$t.prototype.getHandlers=function(){var e=Ge.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=oa,e["element.updateProperties"]=sa,e["canvas.updateRoot"]=tc,e["lane.add"]=hp,e["lane.resize"]=ca,e["lane.split"]=mp,e["lane.updateRefs"]=nc,e["group.updateRefs"]=la,e["id.updateClaim"]=ic,e["element.setColor"]=_p,e["element.updateLabel"]=fv,e},$t.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},$t.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)},$t.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},$t.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},$t.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},$t.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},$t.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},$t.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},$t.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},$t.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},$t.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},$t.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},$t.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},$t.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function hv(){}hv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||pe(t.source||e.source),t.connectionEnd||pe(t.target||e.target)]};var rc=20,OP=5,oc=Math.round,mv=20,IP={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function LP(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function NP(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function gv(e,t,n){var i=Lt(t,e,OP),r=n.split(":")[0],o=oc((t.x-e.x)/2+e.x),a=oc((t.y-e.y)/2+e.y),s,c,u=NP(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=LP(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+rc*(/l/.test(r)?-1:1),y:f?a+rc:a}):(f=o===e.x,s={x:f?o+rc:o,y:e.y+rc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:bp(e,s,c).concat(s),directions:c,turnNextDirections:f}}function BP(e,t,n){return gv(e,t,n)}function $P(e,t,n){var i=gv(t,e,vv(n));return{waypoints:i.waypoints.slice().reverse(),directions:vv(i.directions),turnNextDirections:i.turnNextDirections}}function jP(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=bp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function vv(e){return e.split(":").reverse().join(":")}function FP(e,t,n){var i=oc((t.x-e.x)/2+e.x),r=oc((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 bp(e,t,n){if(n=n||"h:h",!KP(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(_v(n)){var i=BP(e,t,n),r=$P(e,t,n),o=jP(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return FP(e,t,n)}function HP(e,t,n){var i=bp(e,t,n);return i.unshift(e),i.push(t),xv(i)}function zP(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=e0(o,"straight")[0]||"h:h",s=IP[a]||0,c=Lt(e,t,s),u=YP(c,a);n=n||pe(e),i=i||pe(t);var l=u.split(":"),p=bv(n,e,l[0],XP(c)),f=bv(i,t,l[1],c);return HP(p,f,u)}function VP(e,t,n,i,r,o){le(n)&&(r=n,o=i,n=pe(e),i=pe(t)),o=D({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&WP(e,t,n,i,o),c||(c=o.connectionEnd&&qP(t,e,i,r),c)||(c=o.connectionStart&&UP(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:zP(e,t,n,i,o)}function GP(e,t,n){return e>=t&&e<=n}function yv(e,t,n){var i={x:"width",y:"height"};return GP(t[e],n[e],n[e]+n[i[e]])}function WP(e,t,n,i,r){var o={},a,s;return s=Lt(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?yv(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:yv(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 UP(e,t,n,i){return xp(e,t,n,i)}function qP(e,t,n,i){var r=i.slice().reverse();return r=xp(e,t,n,r),r?r.reverse():null}function xp(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!qe(l,function(p,f){var d=l[f-1];return d&&Io(p,d)<3})}function o(l,p,f){var d=fi(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(Gd(l[d],p,mv)||Gd(l[d],f,mv))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=xp(e,t,n,u)),c&&fi(c)?null:c}function YP(e,t){if(_v(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 KP(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function _v(e){return e&&/t|r|b|l/.test(e)}function XP(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 bv(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 xv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return $u(r,o,n,0)||t.push(n),t},[])}var ZP=-10,QP=40,JP={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},eA={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},Ep={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},pa={top:"t",right:"r",bottom:"b",left:"l"};function ac(e){this._elementRegistry=e}J(ac,hv),ac.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=Ev(r&&r[0],n)),a||(a=Ev(r&&r[r.length-1],i)),(y(e,"bpmn:Association")||y(e,"bpmn:DataAssociation"))&&r&&!wv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Ih(n,s)?JP:eA;return y(e,"bpmn:MessageFlow")?c=nA(n,i,l):(y(e,"bpmn:SequenceFlow")||wv(n,i))&&(n===i?c={preferredLayouts:cA(n,e,l)}:y(n,"bpmn:BoundaryEvent")?c={preferredLayouts:uA(n,i,a,l)}:fa(n)||fa(i)?c={preferredLayouts:l.subProcess,preserveDocking:rA(n)}:y(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:y(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=D(c,t),u=xv(VP(n,i,o,a,r,c))),u||[o,a]};function tA(e){var t=e.host;return Lt(pe(e),t,ZP)}function nA(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:iA(e,t)}}function iA(e,t){return y(t,"bpmn:Participant")?"source":y(e,"bpmn:Participant")?"target":fa(t)?"source":fa(e)||y(t,"bpmn:Event")?"target":y(e,"bpmn:Event")?"source":null}function rA(e){return fa(e)?"target":"source"}function Ev(e,t){return e?e.original||e:pe(t)}function wv(e,t){return y(t,"bpmn:Activity")&&y(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function fa(e){return y(e,"bpmn:SubProcess")&&Re(e)}function Pr(e,t){return e===t}function oA(e,t){return t.indexOf(e)!==-1}function co(e){var t=/right|left/.exec(e);return t&&t[0]}function uo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Sv(e,t){return Ep[e]===t}function aA(e,t){var n=co(e),i=Ep[n];return t.indexOf(i)!==-1}function sA(e,t){var n=uo(e),i=Ep[n];return t.indexOf(i)!==-1}function Rv(e){return e==="right"||e==="left"}function cA(e,t,n){var i=t.waypoints,r=i&&i.length&&Lt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function uA(e,t,n,i){var r=pe(e),o=pe(t),a=tA(e),s,c,u=Pr(e.host,t),l=oA(a,["top","right","bottom","left"]),p=Lt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?lA(a,l,e,t,n,i):(s=pA(a,p,l,i.isHorizontal),c=fA(a,p,l,i.isHorizontal),[s+":"+c])}function lA(e,t,n,i,r,o){var a=t?e:o.isHorizontal?uo(e):co(e),s=pa[a],c;return t?Rv(e)?c=Cv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Cv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Cv(e,t,n,i){var r=QP;return!(wp(e,i,n,r)||wp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||wp(e,i,pe(t),r))}function wp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function pA(e,t,n,i){if(n)return pa[e];var r=uo(e),o=co(e),a=uo(t),s=co(t);if(i){if(Pr(r,a)||Sv(o,s))return pa[r]}else if(Pr(o,s)||Sv(r,a))return pa[o];return pa[i?o:r]}function fA(e,t,n,i){if(n)return Rv(e)?aA(e,t)||Pr(e,t)?"h":"v":sA(e,t)||Pr(e,t)?"v":"h";var r=uo(e),o=co(e),a=uo(t),s=co(t);return a&&!s?"v":s&&!a?"h":i?Pr(r,a)?"h":"v":Pr(o,s)?"v":"h"}ac.$inject=["elementRegistry"];function Pv(e){return D({original:e.point.original||e.point},e.actual)}function Qi(e,t){this._elementRegistry=e,this._graphicsFactory=t}Qi.$inject=["elementRegistry","graphicsFactory"],Qi.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(Pv(i)),o.push(Pv(r)),o},Qi.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}},Qi.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Lo(i,r,n)},Qi.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Qi.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Qi.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Sp={__init__:["modeling","bpmnUpdater"],__depends__:[kR,qR,KR,XR,jg,ZC,JC,oP,Tn,sp,Wg],bpmnFactory:["type",kn],bpmnUpdater:["type",pn],elementFactory:["type",Ki],modeling:["type",$t],layouter:["type",ac],connectionDocking:["type",Qi]};var dA=10,Av=50,hA=250;function Rp(e,t,n,i){for(var r;r=mA(e,n,t);)n=i(t,n,r);return n}function Cp(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 mA(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=vA(e);return qe(r,function(o){if(o===n)return!1;var a=Lt(o,i,dA);return a==="intersect"})}function gA(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||Av,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||hA,c=t.reference||"start";o||(o=bA);function u(h,m){return r==="n"?c==="start"?ue(h).top-ue(m).bottom:c==="center"?ue(h).top-pe(m).y:ue(h).top-ue(m).top:r==="w"?c==="start"?ue(h).left-ue(m).right:c==="center"?ue(h).left-pe(m).x:ue(h).left-ue(m).left:r==="s"?c==="start"?ue(m).top-ue(h).bottom:c==="center"?pe(m).y-ue(h).bottom:ue(m).bottom-ue(h).bottom:c==="start"?ue(m).left-ue(h).right:c==="center"?pe(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=on(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 vA(e){var t=Pp(e);return e.host&&(t=t.concat(Pp(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Pp(i))},[]))),t}function Pp(e){return _A(e).concat(yA(e))}function yA(e){return e.incoming.map(function(t){return t.source})}function _A(e){return e.outgoing.map(function(t){return t.target})}function bA(){return!0}var xA=100;function Tv(e,t,n){e.on("autoPlace",xA,function(i){var r=i.shape,o=i.source;return EA(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}}Tv.$inject=["eventBus","modeling","canvas"];function EA(e,t,n){n||(n={});var i=n.defaultDistance||Av,r=pe(e),o=ue(e);return{x:o.right+i+t.width/2,y:r.y}}function Mv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Mv.$inject=["eventBus","selection"];const wA={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Tv],autoPlaceSelectionBehavior:["type",Mv]};function kv(e,t,n){var i=Ih(e,n);if(y(t,"bpmn:TextAnnotation"))return RA(e,t,i);if(Ee(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return CA(e,t,i);if(y(t,"bpmn:FlowNode"))return SA(e,t,i)}function SA(e,t,n){var i=ue(e),r=pe(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=gA(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=Lt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+Dv(u,c,o)}:{x:r.x+Dv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Rp(e,t,l,Cp(f))}function Dv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function RA(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};Ve(e)&&(r=pe(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 Rp(e,t,r,Cp(a))}function CA(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 Rp(e,t,r,Cp(a))}function Ov(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return kv(r,i,t)})}Ov.$inject=["eventBus","elementRegistry"];const sc={__depends__:[wA],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Ov]},lo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},PA=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function AA(e){const t=lo;return PA.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 Ap(e,t){let n=0;for(const i of e)n+=t*AA(i);return n}function Iv(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&TA(e),MA(e),kA(e),DA(e)}function TA(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:Ap(r,o),fontBoundingBoxAscent:o*lo.ascentEm,fontBoundingBoxDescent:o*lo.descentEm,actualBoundingBoxAscent:o*lo.ascentEm,actualBoundingBoxDescent:o*lo.descentEm}}};t.getContext=()=>n}function MA(e){if(e.SVGMatrix)return;class t{constructor(){Lr(this,"a",1);Lr(this,"b",0);Lr(this,"c",0);Lr(this,"d",1);Lr(this,"e",0);Lr(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 kA(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 DA(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:Ap(n,12),height:14}})}const Lv=[Dh,Ho,Sp,sc];function OA(e={}){Iv(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Ur({container:t,moddleExtensions:e.moddleExtensions??$a,additionalModules:[...Lv,...e.additionalModules??[]]})}var IA=new ao("ov"),LA=500;function Dt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=IA,this._overlayDefaults=D({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=NA(n.getContainer()),this._init()}Dt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Dt.prototype.get=function(e){if(nn(e)&&(e={id:e}),nn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?we(t.overlays,jr({type:e.type})):t.overlays.slice():[]}else return e.type?we(this._overlays,jr({type:e.type})):e.id?this._overlays[e.id]:null},Dt.prototype.add=function(e,t,n){if(At(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=D({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Dt.prototype.remove=function(e){var t=this.get(e)||[];le(t)||(t=[t]);var n=this;T(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(Xn(i.html),Xn(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)}})},Dt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Dt.prototype.show=function(){cc(this._overlayRoot)},Dt.prototype.hide=function(){cc(this._overlayRoot,!1)},Dt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Wa(this._overlayRoot)},Dt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=ft(t);i=o.x,r=o.y}Nv(n,i,r),Gt(e.html,"data-container-id",t.id)},Dt.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=ft(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=ft(i).height:s=i.height,o=t.bottom*-1+s}Nv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Dt.prototype._createOverlayContainer=function(e){var t=Ke('<div class="djs-overlays" />');Xt(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Dt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Bv(this._overlayRoot,n)},Dt.prototype._getOverlayContainer=function(e,t){var n=qe(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Dt.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)),nn(i)&&(i=Ke(i)),o=this._getOverlayContainer(n),r=Ke('<div class="djs-overlay" data-overlay-id="'+t+'">'),Xt(r,{position:"absolute"}),r.appendChild(i),e.type&&Je(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();cc(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())},Dt.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&&(xt(r)&&r>t.scale||xt(o)&&o<t.scale))&&(c=!1),cc(a,c),this._updateOverlayScale(e,t)},Dt.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),xt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),xt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),xt(a)&&(s="scale("+a+","+a+")"),Bv(o,s)},Dt.prototype._updateOverlaysVisibilty=function(e){var t=this;T(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Dt.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});T(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){Xn(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",LA,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(T(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&&Je(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 NA(e){var t=Ke('<div class="djs-overlay-container" />');return Xt(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Nv(e,t,n){Xt(e,{left:t+"px",top:n+"px"})}function cc(e,t){e.style.display=t===!1?"none":""}function Bv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const uc={__init__:["overlays"],overlays:["type",Dt]};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)})}J(Tp,W),Tp.$inject=["canvas","injector"];const BA={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Tp]};function da(e){return CSS.escape(e)}var $A={"&":"&","<":"<",">":">",'"':""","'":"'"};function $v(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return $A[t]})}var jA="bjs-breadcrumbs-shown";function jv(e,t,n){var i=Ke('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Je(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=U(u),p=qe(a,function(f){return f===l});p&&s()});function s(c){c&&(a=FA(c));var u=a.flatMap(function(p){var f=n.findRoot(ti(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=$v(p.name||p.id),m=Ke('<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(jA,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}jv.$inject=["eventBus","elementRegistry","canvas"];function FA(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 Fv(e,t){var n=null,i=new HA;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})}Fv.$inject=["eventBus","canvas"];function HA(){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 Hv={x:180,y:160};function Ar(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Ar.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)})}},Ar.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),VA(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},Ar.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=zA(e),i={x:n.x-Hv.x,y:n.y-Hv.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)})},Ar.prototype._moveToDiPlane=function(e,t){var n=zv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Ar.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},Ar.$inject=["eventBus","moddle"];function zv(e){return y(e,"bpmndi:BPMNDiagram")?e:zv(e.$parent)}function zA(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)}}),es(t)}function VA(e,t){var n=e.$parent;return!(!y(n,"bpmn:SubProcess")||n===t.bpmnElement||Ee(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var lc=250,GA='<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>',WA="bjs-drilldown-empty";function Ji(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",lc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",lc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],lc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],lc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}J(Ji,W),Ji.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Ji.prototype._canDrillDown=function(e){var t=this._canvas;return y(e,"bpmn:SubProcess")&&t.findRoot(ti(e))},Ji.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;Je(i.html).toggle(WA,!r)}},Ji.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=Ke('<button type="button" class="bjs-drilldown">'+GA+"</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(ti(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},Ji.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Ji.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const UA={__depends__:[uc,sp,BA],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",jv],drilldownCentering:["type",Fv],drilldownOverlayBehavior:["type",Ji],subprocessCompatibility:["type",Ar]};function er(e){tt.call(this,e)}J(er,tt),er.prototype._modules=[Dh,UA,uc,Tn,Ho],er.prototype._moddleExtensions={};var pc="keyboard.keydown",qA="keyboard.keyup",YA=1e3,Vv="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 Zt(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(Vv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Zt.$inject=["config.keyboard","eventBus"],Zt.prototype._keydownHandler=function(e){this._keyHandler(e,pc)},Zt.prototype._keyupHandler=function(e){this._keyHandler(e,qA)},Zt.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||pc,i),n&&e.preventDefault()}},Zt.prototype._isEventIgnored=function(e){return!1},Zt.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Vv)),this.unbind(),e=this._node=this._target,he.bind(e,"keydown",this._keydownHandler),he.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Zt.prototype.getBinding=function(){return this._node},Zt.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),he.unbind(e,"keydown",this._keydownHandler),he.unbind(e,"keyup",this._keyupHandler)),this._node=null},Zt.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Zt.prototype.addListener=function(e,t,n){Tt(e)&&(n=t,t=e,e=YA),this._eventBus.on(n||pc,e,t)},Zt.prototype.removeListener=function(e,t){this._eventBus.off(t||pc,e)},Zt.prototype.hasModifier=uC,Zt.prototype.isCmd=un,Zt.prototype.isShift=Xl,Zt.prototype.isKey=St;var KA=500;function po(e,t){var n=this;e.on("editorActions.init",KA,function(i){var r=i.editorActions;n.registerBindings(t,r)})}po.$inject=["eventBus","keyboard"],po.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(hC(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(mC(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(lC(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(pC(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(fC(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(dC(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(St(["+","Add","="],r)&&un(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(St(["-","Subtract"],r)&&un(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(St("0",r)&&un(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(St(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Mp={__init__:["keyboard","keyboardBindings"],keyboard:["type",Zt],keyboardBindings:["type",po]};var XA={moveSpeed:50,moveSpeedAccelerated:200};function Gv(e,t,n){var i=this;this._config=D({},XA,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})}}Gv.$inject=["config.keyboardMove","keyboard","canvas"];const Wv={__depends__:[Mp],__init__:["keyboardMove"],keyboardMove:["type",Gv]};var ZA=15;function Uv(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=Er(s),p=Hn(l,c);if(!n.dragging&&QA(p)>ZA&&(n.dragging=!0,u===0&&yg(e),$s("grab")),n.dragging){var f=n.last||n.start;p=Hn(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){he.unbind(document,"mousemove",r),he.unbind(document,"mouseup",o),n=null,vg()}function a(s){if(!gr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Er(s)},he.bind(document,"mousemove",r),he.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Uv.$inject=["eventBus","canvas"];function QA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const qv={__init__:["moveCanvas"],moveCanvas:["type",Uv]};function Yv(e,t){var n=qu(e.min),i=qu(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function JA(e,t){return Math.max(e.min,Math.min(e.max,t))}var eT=Math.sign||function(e){return e>=0?1:-1},kp={min:.2,max:4},Kv=10,tT=.1,nT=.75;function ri(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Jt(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||nT;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}ri.$inject=["config.zoomScroll","eventBus","canvas"],ri.prototype.scroll=function(t){this._canvas.scroll(t)},ri.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ri.prototype.zoom=function(t,n){var i=Yv(kp,Kv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>tT&&(this._zoom(t,n,i),this._totalDelta=0)},ri.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Rm()&&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))*eT(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)}},ri.prototype.stepZoom=function(t,n){var i=Yv(kp,Kv);this._zoom(t,n,i)},ri.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=qu(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(JA(kp,s),t)},ri.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&he[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},ri.prototype._init=function(e){this.toggle(e)};const Xv={__init__:["zoomScroll"],zoomScroll:["type",ri]};function ha(e){er.call(this,e)}J(ha,er),ha.prototype._navigationModules=[Wv,qv,Xv],ha.prototype._modules=[].concat(er.prototype._modules,ha.prototype._navigationModules);function Dp(e){return e&&e[e.length-1]}function Zv(e){return e.y}function Qv(e){return e.x}var iT={left:Qv,center:Qv,right:function(e){return e.x+e.width},top:Zv,middle:Zv,bottom:function(e){return e.y+e.height}};function fo(e,t){this._modeling=e,this._rules=t}fo.$inject=["modeling","rules"],fo.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}},fo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},fo.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=Dp(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(T(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=Wn(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Dp(c).center,o;u=t[0],t=Wn(t,function(f){return f[i]+f[r]}),l=Dp(t),o[e]=p(u,l)}return o},fo.prototype.trigger=function(e,t){var n=this._modeling,i,r=we(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),le(i)&&(r=i),!(r.length<2||!i)){var o=iT[t],a=Wn(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const rT={__init__:["alignElements"],alignElements:["type",fo]},oT=new ao;function ho(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}ho.$inject=["eventBus"],ho.prototype.schedule=function(e,t=oT.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},ho.prototype._schedule=function(e,t){const n=aT();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}},ho.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},ho.prototype._cancel=function(e){clearTimeout(e.executionId)};function aT(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const sT={scheduler:["type",ho]};var cT="djs-element-hidden",fc=".entry",uT=1e3,Jv=8,lT=300;function ht(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}ht.$inject=["canvas","elementRegistry","eventBus","scheduler"],ht.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=le(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=le(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},ht.prototype._createContainer=function(){var e=Ke('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},ht.prototype.registerProvider=function(e,t){t||(t=e,e=uT),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},ht.prototype.getEntries=function(e){var t=this._getProviders(),n=le(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return T(t,function(r){if(Tt(r[n])){var o=r[n](e);Tt(o)?i=o(i):T(o,function(a,s){i[s]=a})}}),i},ht.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=Gt(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},lT);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},ht.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(Tt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},ht.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))}},ht.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ht.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;T(t,function(r,o){var a=r.group||"default",s=Ke(r.html||'<div class="entry" draggable="true"></div>'),c;Gt(s,"data-action",o),c=Fe("[data-group="+da(a)+"]",n),c||(c=Ke('<div class="group"></div>'),Gt(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&pT(s,r.className),r.title&&Gt(s,"title",r.title),r.imageUrl&&(i=Ke("<img>"),Gt(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Je(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},ht.prototype._createHtml=function(e){var t=this,n=Ke('<div class="djs-context-pad"></div>');return an.bind(n,fc,"click",function(i){t.trigger("click",i)}),an.bind(n,fc,"dragstart",function(i){t.trigger("dragstart",i)}),an.bind(n,fc,"mouseover",function(i){t.trigger("mouseover",i)}),an.bind(n,fc,"mouseout",function(i){t.trigger("mouseout",i)}),he.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},ht.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()&&dT(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},ht.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},ht.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return le(e)!==le(n)?!1:le(e)?e.length===n.length&&lr(e,function(i){return n.includes(i)}):n===e},ht.prototype.isShown=function(){return this.isOpen()&&Je(this._current.html).has("open")},ht.prototype.show=function(){this.isOpen()&&(Je(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},ht.prototype.hide=function(){this.isOpen()&&(Je(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},ht.prototype._getPosition=function(e){if(!le(e)&&Ve(e)){var t=this._canvas.viewbox(),n=fT(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Jv*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Jv*this._canvas.zoom(),top:s.top-a.top}},ht.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")},ht.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=le(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,cT)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},ht.prototype._getTargetBounds=function(e){var t=this,n=le(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 pT(e,t){var n=Je(e);t=le(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function fT(e){return e.waypoints[e.waypoints.length-1]}function dT(e,t){return e=le(e)?e:[e],t=le(t)?t:[t],e.length===t.length&&lr(e,function(n){return t.includes(n)})}const ey={__depends__:[Bs,sT,uc],contextPad:["type",ht]};var dc,it,ty,tr,ny,iy,ry,Op,hc,ma,oy,Ip,Lp,Np,mc={},gc=[],hT=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,vc=Array.isArray;function Ei(e,t){for(var n in t)e[n]=t[n];return e}function Bp(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ay(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?dc.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 yc(e,a,i,r,null)}function yc(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??++ty,__i:-1,__u:0};return r==null&&it.vnode!=null&&it.vnode(o),o}function _c(e){return e.children}function bc(e,t){this.props=e,this.context=t}function Tr(e,t){if(t==null)return e.__?Tr(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"?Tr(e):null}function mT(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Ei({},t);o.__v=t.__v+1,it.vnode&&it.vnode(o),$p(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Tr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,hy(i,o,r),t.__e=t.__=null,o.__e!=n&&sy(o)}}function sy(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}),sy(e)}function cy(e){(!e.__d&&(e.__d=!0)&&tr.push(e)&&!xc.__r++||ny!=it.debounceRendering)&&((ny=it.debounceRendering)||iy)(xc)}function xc(){try{for(var e,t=1;tr.length;)tr.length>t&&tr.sort(ry),e=tr.shift(),t=tr.length,mT(e)}finally{tr.length=xc.__r=0}}function uy(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,w=i&&i.__k||gc,E=t.length;for(c=gT(n,t,w,c,E),p=0;p<E;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&w[d.__i]||mc,d.__i=p,g=$p(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&jp(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=ly(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 gT(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]=yc(null,a,null,null,null):vc(a)?a=e.__k[o]=yc(_c,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=yc(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=vT(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=Tr(s)),gy(s,s));return i}function ly(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=ly(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Tr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function vT(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 py(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||hT.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||py(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||py(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(oy,"$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[ma]=i[ma]:(n[ma]=Ip,e.addEventListener(t,o?Np:Lp,o)):e.removeEventListener(t,o?Np:Lp,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 fy(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[hc]==null)t[hc]=Ip++;else if(t[hc]<n[ma])return;return n(it.event?it.event(t):t)}}}function $p(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,P,$,j=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=it.__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 bc(E,S),f.constructor=j,f.render=_T),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=Ei({},f.__s)),Ei(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)}),gc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Tr(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=it.__r,I=0,b)f.state=f.__s,f.__d=!1,A&&A(t),l=f.render(f.props,f.state,f.context),gc.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=Ei(Ei({},i),f.getChildContext())),b&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),P=l!=null&&l.type===_c&&l.key==null?my(l.props.children):l,s=uy(e,vc(P)?P:[P],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;$--;)Bp(o[$])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),L.then||dy(t),it.__e(L,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=yT(n.__e,t,n,i,r,o,a,c,u);return(l=it.diffed)&&l(t),128&t.__u?void 0:s}function dy(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(dy))}function hy(e,t,n){for(var i=0;i<n.length;i++)jp(n[i],n[++i],n[++i]);it.__c&&it.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){it.__e(o,r.__v)}})}function my(e){return typeof e!="object"||e==null||e.__b>0?e:vc(e)?e.map(my):e.constructor!==void 0?null:Ei({},e)}function yT(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||mc,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&&(it.__m&&it.__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&&dc.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=""),uy(t.type=="template"?e.content:e,vc(f)?f:[f],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Tr(n,0),s,c),o!=null)for(u=o.length;u--;)Bp(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 jp(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){it.__e(r,n)}}function gy(e,t,n){var i,r;if(it.unmount&&it.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||jp(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){it.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&gy(i[r],t,n||typeof e.type!="function");n||Bp(e.__e),e.__c=e.__=e.__e=void 0}function _T(e,t,n){return this.constructor(e,n)}function vy(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),it.__&&it.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],$p(t,e=t.__k=ay(_c,null,[e]),r||mc,mc,t.namespaceURI,r?null:t.firstChild?dc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),hy(o,e,a),e.props.children=null}dc=gc.slice,it={__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}},ty=0,bc.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ei({},this.state),typeof e=="function"&&(e=e(Ei({},n),this.props)),e&&Ei(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),cy(this))},bc.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),cy(this))},bc.prototype.render=_c,tr=[],iy=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ry=function(e,t){return e.__v.__b-t.__v.__b},xc.__r=0,Op=Math.random().toString(8),hc="__d"+Op,ma="__a"+Op,oy=/(PointerCapture)$|Capture$/i,Ip=0,Lp=fy(!1),Np=fy(!0);var yy=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,yy(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},_y=new Map;function bT(e){var t=_y.get(this);return t||(t=new Map,_y.set(this,t)),(t=yy(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 We=
|
|
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}},tt.prototype._setDefinitions=function(e){this._definitions=e},tt.prototype.getModules=function(){return this._modules},tt.prototype.clear=function(){this.getDefinitions()&&Fi.prototype.clear.call(this)},tt.prototype.destroy=function(){Fi.prototype.destroy.call(this),Kn(this._container)},tt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},tt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},tt.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=He(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},tt.prototype.getDefinitions=function(){return this._definitions},tt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},tt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=D(Wn(n,["additionalModules"]),{canvas:D({},n.canvas,{container:e}),modules:a});Fi.call(this,s),n&&n.container&&this.attachTo(n.container)},tt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},tt.prototype._createContainer=function(e){const t=Ke('<div class="bjs-container"></div>');return Xt(t,{width:Rh(e.width),height:Rh(e.height),position:e.position}),t},tt.prototype._createModdle=function(e){const t=D({},this._moddleExtensions,e.moddleExtensions);return new Gf(t)},tt.prototype._modules=[];function ss(e,t){return e.warnings=t,e}function i1(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 r1={width:"100%",height:"100%",position:"relative"};function Rh(e){return e+(he(e)?"px":"")}function o1(e,t){return t&&qe(e.diagrams,function(n){return n.id===t})||null}function a1(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+xh+"</a>",i=Ke(n);Xt(He("svg",i),Eh),Xt(i,wh,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),me.bind(i,"click",function(r){n1(),r.preventDefault()})}function Ur(e){tt.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)}ee(Ur,tt),Ur.prototype._createModdle=function(e){var t=tt.prototype._createModdle.call(this,e);return t.ids=new Yn([32,36,1]),t},Ur.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 Re(e,t){return y(e,"bpmn:CallActivity")?!1:y(e,"bpmn:SubProcess")?(t=t||Me(e),t&&y(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):y(e,"bpmn:Participant")?!!U(e).processRef:!0}function kt(e){if(!(!y(e,"bpmn:Participant")&&!y(e,"bpmn:Lane"))){var t=Me(e).isHorizontal;return t===void 0?!0:t}}function s1(e){return e&&U(e).isInterrupting!==!1}function Ut(e){return e&&!!U(e).triggeredByEvent}function qr(e,t){var n=U(e).eventDefinitions;return Pi(n,function(i){return y(i,t)})}function c1(e){return qr(e,"bpmn:ErrorEventDefinition")}function u1(e){return qr(e,"bpmn:EscalationEventDefinition")}function l1(e){return qr(e,"bpmn:CompensateEventDefinition")}var br={width:90,height:20},Ch=15;function Hi(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 cs(e){return be(e.label)}function p1(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=f1(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-=Ch:a+=Ch,{x:a,y:s}}function f1(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 Gu(e){return e.waypoints?p1(e.waypoints):y(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+br.height/2}:{x:e.x+e.width/2,y:e.y+e.height+br.height/2}}function d1(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(br.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Gu(t),i=br),D({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Ph(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 h1(e){var t=e.categoryValueRef;return t&&t.value||""}function xn(e){var t=e.businessObject,n=Ph(t);if(n)return n==="categoryValueRef"?h1(t):t[n]||""}function m1(e,t){var n=e.businessObject,i=Ph(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function g1(e){return be(e)&&Hi(e.labelTarget)}var Yr=7;function Ah(e){let t=[];return M(e.incoming,n=>{y(n,"bpmn:Association")&&y(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),M(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 M(Bu(e),n=>{M(Ah(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 Wu="hsl(225, 10%, 15%)",v1="white";function Jn(e,t){return Pi(e.eventDefinitions,function(n){return n.$type===t})}function y1(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function _1(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Se(e,t,n){var i=Me(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||v1}function J(e,t,n){var i=Me(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Wu}function jo(e,t,n,i){var r=Me(e),o=r.get("label");return i||o&&o.get("color:color")||t||J(e,n)}function Th(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 vr(r)}function Uu(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 vr(a)}function b1(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 vr(s)}function x1(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 vr(o)}function Fo(e,t={}){return{width:Rn(e,t),height:ln(e,t)}}function Rn(e,t={}){return an(t,"width")?t.width:e.width}function ln(e,t={}){return an(t,"height")?t.height:e.height}var E1=new Yn,w1=10,us=3,S1=1.5,ls=10,R1=4,Kr=.95,C1=1,P1=.25;function xr(e,t,n,i,r,o,a){pi.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(C){return n.computeStyle(C,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Wu,strokeWidth:2,fill:"white"})}function p(C){return n.computeStyle(C,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Wu,strokeWidth:2})}function f(C,_){var{ref:v={x:0,y:0},scale:k=1,element:O,parentGfx:z=r._svg}=_,ne=ae("marker",{id:C,viewBox:"0 0 20 20",refX:v.x,refY:v.y,markerWidth:20*k,markerHeight:20*k,orient:"auto"});ve(ne,O);var _e=He(":scope > defs",z);_e||(_e=ae("defs"),ve(z,_e)),ve(_e,ne)}function d(C,_,v,k){var O=E1.nextPrefixed("marker-");return h(C,O,_,v,k),"url(#"+O+")"}function h(C,_,v,k,O){if(v==="sequenceflow-end"){var z=ae("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:C})}if(v==="messageflow-start"){var ne=ae("circle",{cx:6,cy:6,r:3.5,...l({fill:k,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:ne,ref:{x:6,y:6},parentGfx:C})}if(v==="messageflow-end"){var _e=ae("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:k,stroke:O,strokeWidth:1,strokeDasharray:[1e4,1]})});f(_,{element:_e,ref:{x:8.5,y:5},parentGfx:C})}if(v==="association-start"){var Ie=ae("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:C})}if(v==="association-end"){var ut=ae("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:O,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(_,{element:ut,ref:{x:11,y:10},scale:.5,parentGfx:C})}if(v==="conditional-flow-marker"){var $e=ae("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:k,stroke:O})});f(_,{element:$e,ref:{x:-1,y:10},scale:.5,parentGfx:C})}if(v==="conditional-default-flow-marker"){var vt=ae("path",{d:"M 6 4 L 10 16",...l({stroke:O,fill:"none"})});f(_,{element:vt,ref:{x:0,y:10},scale:.5,parentGfx:C})}}function m(C,_,v,k,O={}){At(k)&&(O=k,k=0),k=k||0,O=l(O);var z=_/2,ne=v/2,_e=ae("circle",{cx:z,cy:ne,r:Math.round((_+v)/4-k),...O});return ve(C,_e),_e}function g(C,_,v,k,O,z){At(O)&&(z=O,O=0),O=O||0,z=l(z);var ne=ae("rect",{x:O,y:O,width:_-O*2,height:v-O*2,rx:k,ry:k,...z});return ve(C,ne),ne}function S(C,_,v,k){var O=_/2,z=v/2,ne=[{x:O,y:0},{x:_,y:z},{x:O,y:v},{x:0,y:z}],_e=ne.map(function(ut){return ut.x+","+ut.y}).join(" ");k=l(k);var Ie=ae("polygon",{...k,points:_e});return ve(C,Ie),Ie}function E(C,_,v,k){v=p(v);var O=ko(_,v,k);return ve(C,O),O}function b(C,_,v){return E(C,_,v,5)}function x(C,_,v){v=p(v);var k=ae("path",{...v,d:_});return ve(C,k),k}function w(C,_,v,k){return x(_,v,D({"data-marker":C},k))}function A(C){return Ct[C]}function I(C){return function(_,v,k){return A(C)(_,v,k)}}var P={"bpmn:MessageEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.235,my:.315}}),z=k?J(_,c,v.stroke):Se(_,s,v.fill),ne=k?Se(_,s,v.fill):J(_,c,v.stroke),_e=x(C,O,{fill:z,stroke:ne,strokeWidth:1});return _e},"bpmn:TimerEventDefinition":function(C,_,v={}){var k=v.width||_.width,O=v.height||_.height,z=v.width?1:2,ne=m(C,k,O,.2*O,{fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:z}),_e=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:O,position:{mx:.5,my:.5}});x(C,_e,{stroke:J(_,c,v.stroke),strokeWidth:z});for(var Ie=0;Ie<12;Ie++){var ut=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:k,containerHeight:O,position:{mx:.5,my:.5}}),$e=k/2,vt=O/2;x(C,ut,{strokeWidth:1,stroke:J(_,c,v.stroke),transform:"rotate("+Ie*30+","+vt+","+$e+")"})}return ne},"bpmn:EscalationEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),z=k?J(_,c,v.stroke):Se(_,s,v.fill);return x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(C,_,v={}){var k=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.222}});return x(C,k,{fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.57,my:.263}}),z=k?J(_,c,v.stroke):Se(_,s,v.fill);return x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(C,_,v={},k){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=k?J(_,c,v.stroke):Se(_,s,v.fill);return x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.638,my:-.055}}),z=k?J(_,c,v.stroke):"none",ne=x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1});return _h(ne,45),ne},"bpmn:CompensateEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.22,my:.5}}),z=k?J(_,c,v.stroke):Se(_,s,v.fill);return x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(C,_,v={},k){var O=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:v.width||_.width,containerHeight:v.height||_.height,position:{mx:.5,my:.2}}),z=k?J(_,c,v.stroke):Se(_,s,v.fill);return x(C,O,{strokeWidth:1,fill:z,stroke:J(_,c,v.stroke)})},"bpmn:MultipleEventDefinition":function(C,_,v={},k){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=k?J(_,c,v.stroke):Se(_,s,v.fill);return x(C,O,{fill:z,stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(C,_,v={}){var k=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(C,k,{fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(C,_,v={}){var k=m(C,_.width,_.height,8,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:4});return k}};function j(C,_,v={},k){var O=U(C),z=y1(O),ne=k||C;return O.get("eventDefinitions")&&O.get("eventDefinitions").length>1?O.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](_,ne,v,z):P["bpmn:MultipleEventDefinition"](_,ne,v,z):Jn(O,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](_,ne,v,z):Jn(O,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](_,ne,v,z):Jn(O,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](_,ne,v,z):Jn(O,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](_,ne,v,z):Jn(O,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](_,ne,v,z):Jn(O,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](_,ne,v,z):Jn(O,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](_,ne,v,z):Jn(O,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](_,ne,v,z):Jn(O,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](_,ne,v,z):Jn(O,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](_,ne,v,z):null}var F={ParticipantMultiplicityMarker:function(C,_,v={}){var k=Rn(_,v),O=ln(_,v),z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2-6)/k,my:(O-15)/O}});w("participant-multiplicity",C,z,{strokeWidth:2,fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke)})},SubProcessMarker:function(C,_,v={}){var k=g(C,14,14,0,{strokeWidth:1,fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke)});Nt(k,_.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}});w("sub-process",C,O,{fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke)})},ParallelMarker:function(C,_,v){var k=Rn(_,v),O=ln(_,v),z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2+v.parallel)/k,my:(O-20)/O}});w("parallel",C,z,{fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke)})},SequentialMarker:function(C,_,v){var k=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+v.seq)/_.width,my:(_.height-19)/_.height}});w("sequential",C,k,{fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke)})},CompensationMarker:function(C,_,v){var k=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:(_.width/2+v.compensation)/_.width,my:(_.height-13)/_.height}});w("compensation",C,k,{strokeWidth:1,fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke)})},LoopMarker:function(C,_,v){var k=Rn(_,v),O=ln(_,v),z=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2+v.loop)/k,my:(O-7)/O}});w("loop",C,z,{strokeWidth:1.5,fill:"none",stroke:J(_,c,v.stroke),strokeMiterlimit:.5})},AdhocMarker:function(C,_,v){var k=Rn(_,v),O=ln(_,v),z=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:(k/2+v.adhoc)/k,my:(O-15)/O}});w("adhoc",C,z,{strokeWidth:1,fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke)})}};function L(C,_,v,k){F[C](_,v,k)}function H(C,_,v=[],k={}){k={fill:k.fill,stroke:k.stroke,width:Rn(_,k),height:ln(_,k)};var O=U(_),z=v.includes("SubProcessMarker");z?k={...k,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:k={...k,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},O.get("isForCompensation")&&v.push("CompensationMarker"),y(O,"bpmn:AdHocSubProcess")&&(v.push("AdhocMarker"),z||D(k,{compensation:k.compensation-18}));var ne=O.get("loopCharacteristics"),_e=ne&&ne.get("isSequential");ne&&(D(k,{compensation:k.compensation-18}),v.includes("AdhocMarker")&&D(k,{seq:-23,loop:-18,parallel:-24}),_e===void 0&&v.push("LoopMarker"),_e===!1&&v.push("ParallelMarker"),_e===!0&&v.push("SequentialMarker")),v.includes("CompensationMarker")&&v.length===1&&D(k,{compensation:-8}),M(v,function(Ie){L(Ie,C,_,k)})}function re(C,_,v={}){v=D({size:{width:100}},v);var k=o.createText(_||"",v);return Ce(k).add("djs-label"),ve(C,k),k}function Pe(C,_,v,k={}){var O=U(_),z=Fo({x:_.x,y:_.y,width:_.width,height:_.height},k);return re(C,O.name,{align:v,box:z,padding:7,style:{fill:jo(_,u,c,k.stroke)}})}function et(C,_,v={}){var k={width:_.width,height:_.height,x:_.width/2+_.x,y:_.height/2+_.y};return re(C,xn(_),{box:k,style:D({},o.getExternalStyle(),{fill:jo(_,u,c,v.stroke)})})}function q(C,_,v,k={}){var O=kt(v),z=re(C,_,{box:{height:30,width:O?ln(v,k):Rn(v,k)},align:"center-middle",style:{fill:jo(v,u,c,k.stroke)}});if(O){var ne=-1*ln(v,k);os(z,0,-ne,270)}}function ie(C,_,v={}){var{width:k,height:O}=Fo(_,v);return g(C,k,O,ls,{...v,fill:Se(_,s,v.fill),fillOpacity:Kr,stroke:J(_,c,v.stroke)})}function ce(C,_,v={}){var k=U(_),O=Se(_,s,v.fill),z=J(_,c,v.stroke);return(k.get("associationDirection")==="One"||k.get("associationDirection")==="Both")&&(v.markerEnd=d(C,"association-end",O,z)),k.get("associationDirection")==="Both"&&(v.markerStart=d(C,"association-start",O,z)),v=ke(v,["markerStart","markerEnd"]),b(C,_.waypoints,{...v,stroke:z,strokeDasharray:"0, 5"})}function oe(C,_,v={}){var k=Se(_,s,v.fill),O=J(_,c,v.stroke),z=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.474,my:.296}}),ne=x(C,z,{fill:k,fillOpacity:Kr,stroke:O}),_e=U(_);if(_1(_e)){var Ie=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:.33,my:(_.height-18)/_.height}});x(C,Ie,{strokeWidth:2,fill:k,stroke:O})}return ne}function se(C,_,v={}){return m(C,_.width,_.height,{fillOpacity:Kr,...v,fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke)})}function X(C,_,v={}){return S(C,_.width,_.height,{fill:Se(_,s,v.fill),fillOpacity:Kr,stroke:J(_,c,v.stroke)})}function N(C,_,v={}){var k=g(C,Rn(_,v),ln(_,v),0,{fill:Se(_,s,v.fill),fillOpacity:v.fillOpacity||Kr,stroke:J(_,c,v.stroke),strokeWidth:1.5}),O=U(_);if(y(O,"bpmn:Lane")){var z=O.get("name");q(C,z,_,v)}return k}function B(C,_,v={}){var k=ie(C,_,v),O=Re(_);if(Ut(_)&&(te(k,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!O)){var z=U(_).flowElements||[],ne=z.filter(_e=>y(_e,"bpmn:StartEvent"));ne.length===1&&V(ne[0],C,v,_)}return Pe(C,_,O?"center-top":"center-middle",v),O?H(C,_,void 0,v):H(C,_,["SubProcessMarker"],v),k}function V(C,_,v,k){var O=22,z={fill:Se(k,s,v.fill),stroke:J(k,c,v.stroke),width:O,height:O},ne=U(C).isInterrupting,_e=ne?0:3,Ie=ne?1:1.2,ut=20,$e=(O-ut)/2,vt="translate("+$e+","+$e+")";m(_,ut,ut,{fill:z.fill,stroke:z.stroke,strokeWidth:Ie,strokeDasharray:_e,transform:vt}),j(C,_,z,k)}function xe(C,_,v={}){var k=ie(C,_,v);return Pe(C,_,"center-middle",v),H(C,_,void 0,v),k}var Ct=this.handlers={"bpmn:AdHocSubProcess":function(C,_,v={}){return Re(_)?v=ke(v,["fill","stroke","width","height"]):v=ke(v,["fill","stroke"]),B(C,_,v)},"bpmn:Association":function(C,_,v={}){return v=ke(v,["fill","stroke"]),ce(C,_,v)},"bpmn:BoundaryEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=ke(v,["fill","stroke"]);var O=U(_),z=O.get("cancelActivity");v={strokeWidth:1.5,fill:Se(_,s,v.fill),fillOpacity:C1,stroke:J(_,c,v.stroke)},z||(v.strokeDasharray="6");var ne=se(C,_,v);return m(C,_.width,_.height,us,{...v,fill:"none"}),k&&j(_,C,v),ne},"bpmn:BusinessRuleTask":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=xe(C,_,v),O=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),z=x(C,O);te(z,{fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1});var ne=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),_e=x(C,ne);return te(_e,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:CallActivity":function(C,_,v={}){return v=ke(v,["fill","stroke"]),B(C,_,{strokeWidth:5,...v})},"bpmn:ComplexGateway":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=X(C,_,v),O=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.26}});return x(C,O,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:DataInput":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),O=oe(C,_,v);return x(C,k,{fill:"none",stroke:J(_,c,v.stroke),strokeWidth:1}),O},"bpmn:DataInputAssociation":function(C,_,v={}){return v=ke(v,["fill","stroke"]),ce(C,_,{...v,markerEnd:d(C,"association-end",Se(_,s,v.fill),J(_,c,v.stroke))})},"bpmn:DataObject":function(C,_,v={}){return v=ke(v,["fill","stroke"]),oe(C,_,v)},"bpmn:DataObjectReference":I("bpmn:DataObject"),"bpmn:DataOutput":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=i.getRawPath("DATA_ARROW"),O=oe(C,_,v);return x(C,k,{strokeWidth:1,fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke)}),O},"bpmn:DataOutputAssociation":function(C,_,v={}){return v=ke(v,["fill","stroke"]),ce(C,_,{...v,markerEnd:d(C,"association-end",Se(_,s,v.fill),J(_,c,v.stroke))})},"bpmn:DataStoreReference":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:_.width,containerHeight:_.height,position:{mx:0,my:.133}});return x(C,k,{fill:Se(_,s,v.fill),fillOpacity:Kr,stroke:J(_,c,v.stroke),strokeWidth:2})},"bpmn:EndEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=ke(v,["fill","stroke"]);var O=se(C,_,{...v,strokeWidth:4});return k&&j(_,C,v),O},"bpmn:EventBasedGateway":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=U(_),O=X(C,_,v);m(C,_.width,_.height,_.height*.2,{fill:Se(_,"none",v.fill),stroke:J(_,c,v.stroke),strokeWidth:1});var z=k.get("eventGatewayType"),ne=!!k.get("instantiate");function _e(){var ut=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:_.width,containerHeight:_.height,position:{mx:.36,my:.44}});x(C,ut,{fill:"none",stroke:J(_,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(C,Ie,{fill:"none",stroke:J(_,c,v.stroke),strokeWidth:1})}else z==="Exclusive"&&(ne||m(C,_.width,_.height,_.height*.26,{fill:"none",stroke:J(_,c,v.stroke),strokeWidth:1}),_e());return O},"bpmn:ExclusiveGateway":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=X(C,_,v),O=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:_.width,containerHeight:_.height,position:{mx:.32,my:.3}}),z=Me(_);return z.get("isMarkerVisible")&&x(C,O,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:Gateway":function(C,_,v={}){return v=ke(v,["fill","stroke"]),X(C,_,v)},"bpmn:Group":function(C,_,v={}){return v=ke(v,["fill","stroke","width","height"]),g(C,_.width,_.height,ls,{stroke:J(_,c,v.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Rn(_,v),height:ln(_,v)})},"bpmn:InclusiveGateway":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=X(C,_,v);return m(C,_.width,_.height,_.height*.24,{fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:2.5}),k},"bpmn:IntermediateEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=ke(v,["fill","stroke"]);var O=se(C,_,{...v,strokeWidth:1.5});return m(C,_.width,_.height,us,{fill:"none",stroke:J(_,c,v.stroke),strokeWidth:1.5}),k&&j(_,C,v),O},"bpmn:IntermediateCatchEvent":I("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":I("bpmn:IntermediateEvent"),"bpmn:Lane":function(C,_,v={}){return v=ke(v,["fill","stroke","width","height"]),N(C,_,{...v,fillOpacity:P1})},"bpmn:ManualTask":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=xe(C,_,v),O=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(C,O,{fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:.5}),k},"bpmn:MessageFlow":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=U(_),O=Me(_),z=Se(_,s,v.fill),ne=J(_,c,v.stroke),_e=b(C,_.waypoints,{markerEnd:d(C,"messageflow-end",z,ne),markerStart:d(C,"messageflow-start",z,ne),stroke:ne,strokeDasharray:"10, 11",strokeWidth:1.5});if(k.get("messageRef")){var Ie=_e.getPointAtLength(_e.getTotalLength()/2),ut=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:Ie.x,y:Ie.y}}),$e={strokeWidth:1};O.get("messageVisibleKind")==="initiating"?($e.fill=z,$e.stroke=ne):($e.fill=ne,$e.stroke=z);var vt=x(C,ut,$e),jt=k.get("messageRef"),qt=jt.get("name"),Ye=re(C,qt,{align:"center-top",fitBox:!0,style:{fill:ne}}),yt=vt.getBBox(),Dt=Ye.getBBox(),cr=Ie.x-Dt.width/2,En=Ie.y+yt.height/2+w1;os(Ye,cr,En,0)}return _e},"bpmn:ParallelGateway":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=X(C,_,v),O=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:_.width,containerHeight:_.height,position:{mx:.46,my:.2}});return x(C,O,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:Participant":function(C,_,v={}){v=ke(v,["fill","stroke","width","height"]);var k=N(C,_,v),O=Re(_),z=kt(_),ne=U(_),_e=ne.get("name");if(O){var Ie=z?[{x:30,y:0},{x:30,y:ln(_,v)}]:[{x:0,y:30},{x:Rn(_,v),y:30}];E(C,Ie,{stroke:J(_,c,v.stroke),strokeWidth:S1}),q(C,_e,_,v)}else{var ut=Fo(_,v);z||(ut.height=Rn(_,v),ut.width=ln(_,v));var $e=re(C,_e,{box:ut,align:"center-middle",style:{fill:jo(_,u,c,v.stroke)}});if(!z){var vt=-1*ln(_,v);os($e,0,-vt,270)}}return ne.get("participantMultiplicity")&&L("ParticipantMultiplicityMarker",C,_,v),k},"bpmn:ReceiveTask":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=U(_),O=xe(C,_,v),z;return k.get("instantiate")?(m(C,28,28,20*.22,{fill:Se(_,s,v.fill),stroke:J(_,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(C,z,{fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1}),O},"bpmn:ScriptTask":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=xe(C,_,v),O=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(C,O,{fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:SendTask":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=xe(C,_,v),O=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(C,O,{fill:J(_,c,v.stroke),stroke:Se(_,s,v.fill),strokeWidth:1}),k},"bpmn:SequenceFlow":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=Se(_,s,v.fill),O=J(_,c,v.stroke),z=b(C,_.waypoints,{markerEnd:d(C,"sequenceflow-end",k,O),stroke:O}),ne=U(_),{source:_e}=_;if(_e){var Ie=U(_e);ne.get("conditionExpression")&&y(Ie,"bpmn:Activity")&&te(z,{markerStart:d(C,"conditional-flow-marker",k,O)}),Ie.get("default")&&(y(Ie,"bpmn:Gateway")||y(Ie,"bpmn:Activity"))&&Ie.get("default")===ne&&te(z,{markerStart:d(C,"conditional-default-flow-marker",k,O)})}return z},"bpmn:ServiceTask":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=xe(C,_,v);m(C,10,10,{fill:Se(_,s,v.fill),stroke:"none",transform:"translate(6, 6)"});var O=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(C,O,{fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1}),m(C,10,10,{fill:Se(_,s,v.fill),stroke:"none",transform:"translate(11, 10)"});var z=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(C,z,{fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:1}),k},"bpmn:StartEvent":function(C,_,v={}){var{renderIcon:k=!0}=v;v=ke(v,["fill","stroke"]);var O=U(_);O.get("isInterrupting")||(v={...v,strokeDasharray:"6"});var z=se(C,_,v);return k&&j(_,C,v),z},"bpmn:SubProcess":function(C,_,v={}){return Re(_)?v=ke(v,["fill","stroke","width","height"]):v=ke(v,["fill","stroke"]),B(C,_,v)},"bpmn:Task":function(C,_,v={}){return v=ke(v,["fill","stroke"]),xe(C,_,v)},"bpmn:TextAnnotation":function(C,_,v={}){v=ke(v,["fill","stroke"]);var{width:k,height:O}=Fo(_,v),z=g(C,k,O,0,0,{fill:"none",stroke:"none"}),ne=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:k,containerHeight:O,position:{mx:0,my:0}});x(C,ne,{stroke:J(_,c,v.stroke)});var _e=U(_),Ie=_e.get("text")||"";return re(C,Ie,{align:"left-top",box:Fo(_,v),padding:Yr,style:{fill:jo(_,u,c,v.stroke)}}),z},"bpmn:Transaction":function(C,_,v={}){Re(_)?v=ke(v,["fill","stroke","width","height"]):v=ke(v,["fill","stroke"]);var k=B(C,_,{strokeWidth:1.5,...v}),O=n.style(["no-fill","no-events"],{stroke:J(_,c,v.stroke),strokeWidth:1.5}),z=Re(_);return z||(v={}),g(C,Rn(_,v),ln(_,v),ls-us,us,O),k},"bpmn:UserTask":function(C,_,v={}){v=ke(v,["fill","stroke"]);var k=xe(C,_,v),O=15,z=12,ne=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:O,y:z}});x(C,ne,{fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:.5});var _e=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:O,y:z}});x(C,_e,{fill:Se(_,s,v.fill),stroke:J(_,c,v.stroke),strokeWidth:.5});var Ie=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:O,y:z}});return x(C,Ie,{fill:J(_,c,v.stroke),stroke:J(_,c,v.stroke),strokeWidth:.5}),k},label:function(C,_,v={}){return et(C,_,v)}};this._drawPath=x,this._renderer=A}ee(xr,pi),xr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],xr.prototype.canRender=function(e){return y(e,"bpmn:BaseElement")},xr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},xr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},xr.prototype.getShapePath=function(e){return be(e)?Uu(e,R1):y(e,"bpmn:Event")?Th(e):y(e,"bpmn:Activity")?Uu(e,ls):y(e,"bpmn:Gateway")?b1(e):x1(e)};function ke(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var A1=0,T1={width:150,height:50};function M1(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function k1(e){return At(e)?D({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var qu=null;function D1(){return qu||(qu=document.createElement("canvas").getContext("2d")),qu}function O1(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(Mh(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Mh(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function I1(e,t){var n=D1();if(!n)return{width:0,height:0};n.font=O1(t),"letterSpacing"in n&&(n.letterSpacing=Mh(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 L1(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=I1(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return N1(e,r,i,o);r=$1(r,o.width,t)}}function N1(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 kh="";function B1(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===kh)&&r.pop();break}var a=r[r.length-1];return a&&a===kh&&(r[r.length-1]="-"),r.join("")}function $1(e,t,n){var i=Math.max(e.length*(n/t),1),r=B1(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function ps(e){this._config=D({},{size:T1,padding:A1,style:{},align:"center-top"},e||{})}ps.prototype.createText=function(e,t){return this.layoutText(e,t).element},ps.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},ps.prototype.layoutText=function(e,t){for(var n=D({},this._config.size,t.box),i=D({},this._config.style,t.style),r=M1(t.align||this._config.align),o=k1(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=j1(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(L1(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=sn(u,function(g,S,E){return g+(s||S.height)},0)+o.top+o.bottom,f=sn(u,function(g,S,E){return S.width>g?S.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var h=ae("text");te(h,i),M(u,function(g){var S;switch(d+=s||g.height,r.horizontal){case"left":S=o.left;break;case"right":S=(a?f:l)-o.right-g.width;break;default:S=Math.max(((a?f:l)-g.width)/2+o.left,0)}var E=ae("tspan");te(E,{x:S,y:d}),E.textContent=g.text,ve(h,E)});var m={width:f,height:p};return{dimensions:m,element:h}};function j1(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var F1=12,H1=1.2,z1=40;function Dh(e){var t=D({fontFamily:"Arial, sans-serif",fontSize:F1,fontWeight:"normal",lineHeight:H1},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=D({},t,{fontSize:n},e&&e.externalStyle||{}),r=new ps({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,br.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:Yr});return{x:a.x,y:a.y,width:a.width,height:Math.max(z1,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,D({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Dh.$inject=["config.textRenderer"];function V1(){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=q1(i.d,{mx:r,my:o,e:a});return p}}var G1=/\{([^{}]+)\}/g,W1=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function U1(e,t,n){var i=n;return t.replace(W1,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 q1(e,t){return String(e).replace(G1,function(n,i){return U1(n,i,t)})}const Y1={__init__:["bpmnRenderer"],bpmnRenderer:["type",xr],textRenderer:["type",Dh],pathMap:["type",V1]};function K1(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Ho={translate:["value",K1]};function fs(e,t,n){return D({id:e.id,type:e.$type,businessObject:e,di:t},n)}function X1(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 Oh(e,t,n){return new Error(`element ${Wt(t)} referenced by ${Wt(e)}#${n} not yet drawn`)}function mi(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}mi.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],mi.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(fs(e,t,a)),this._canvas.addRootElement(i)}else if(y(t,"bpmndi:BPMNShape")){var s=!Re(e,t),c=Q1(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(fs(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")&&(Z1(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(fs(e,t,{hidden:r,source:l,target:p,waypoints:X1(t,l,p)})),y(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${Wt(t)} for element ${Wt(e)}`);return Hi(e)&&xn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},mi.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Wt(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Oh(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},mi.prototype.addLabel=function(e,t,n){var i,r,o;return i=d1(t,n),r=xn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(fs(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!xn(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)},mi.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?Oh(e,i,t+"Ref"):new Error(`${Wt(e)}#${t} Ref not specified`)},mi.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},mi.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},mi.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function Z1(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 Q1(e){return y(e,"bpmn:Group")}const Ih={__depends__:[Y1,{__depends__:[Ho],bpmnImporter:["type",mi]}]};function zo(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Hn(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Yu(e){return Math.log(e)/Math.log(10)}var J1=1e3;function W(e){this._eventBus=e}W.$inject=["eventBus"];function eS(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((Tt(t)||he(t))&&(o=r,r=i,i=n,n=t,t=null),Tt(n)&&(o=r,r=i,i=n,n=J1),At(r)&&(o=r,r=!1),!Tt(i))throw new Error("handlerFn must be a function");pe(e)||(e=[e]);var a=this._eventBus;M(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?eS(i,o):i,o)})},W.prototype.canExecute=gi("canExecute"),W.prototype.preExecute=gi("preExecute"),W.prototype.preExecuted=gi("preExecuted"),W.prototype.execute=gi("execute"),W.prototype.executed=gi("executed"),W.prototype.postExecute=gi("postExecute"),W.prototype.postExecuted=gi("postExecuted"),W.prototype.revert=gi("revert"),W.prototype.reverted=gi("reverted");function gi(e){return function(n,i,r,o,a){(Tt(n)||he(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Ku=["top","bottom","left","right"],ds=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(cs(r)&&!Ve(r)){var o=iS(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-ds-s.height/2};break;case"left":l={x:u.left-ds-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+ds+s.height/2};break;case"right":l={x:u.right+ds+s.width/2,y:a.y};break}var p=Hn(l,c);t.moveShape(s,p)}}}ee(Xu,W),Xu.$inject=["eventBus","modeling"];function tS(e){var t=e.host,n=fe(e),i=Lt(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Ku.filter(function(a){return r.indexOf(a)===-1});return o}function nS(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 Lh(t,i)});return n}function iS(e){var t=fe(e.label),n=fe(e),i=Lh(n,t);if(rS(i)){var r=nS(e);if(e.host){var o=tS(e);r=r.concat(o)}var a=Ku.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?Lt(e.label,e)!=="intersect"?void 0:i:a[0]}}function Lh(e,t){return Lt(t,e,5)}function rS(e){return Ku.indexOf(e)!==-1}function Zu(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)}ee(Zu,W),Zu.$inject=["eventBus"];var oS=1500;function Qu(e,t,n){e.invoke(W,this),this.preExecute("elements.delete",oS,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=we(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 M(o,u=>{const l=new Set(Br(Vr(Array.from(s),pt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}ee(Qu,W),Qu.$inject=["injector","eventBus","canvas"];function Ju(e,t){e.invoke(W,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=we(r.incoming.concat(r.outgoing),function(a){return y(a,"bpmn:Association")});M(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}ee(Ju,W),Ju.$inject=["injector","modeling"];function Xr(e,t){for(on(t)&&(t=[t]);e=e.parent;)if(Ee(e,t))return e;return null}function Nh(e,t){var n=Xr(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Xr(e,i),n)return kt(n);if(Ee(e,i))return kt(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?kt(o):!0}var Bh=500;function hs(e,t){t.invoke(W,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Bh,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return $h(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",Bh,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];$h(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}hs.$inject=["bpmnReplace","injector"],ee(hs,W),hs.prototype._replaceShape=function(e,t){var n=aS(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function aS(e){var t=U(e),n=t.eventDefinitions;return n&&n[0]}function $h(e,t){return!be(e)&&Ee(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function el(e,t){W.call(this,e);function n(i){return we(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")&&M(o.outgoing,function(a){var s=a.target,c=n(s);y(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}el.$inject=["eventBus","modeling"],ee(el,W);function jh(e){return e.create("bpmn:Category")}function sS(e){return e.create("bpmn:CategoryValue")}function Fh(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=sS(e)),n.$parent||(n.$parent=jh(e)),n}function cS(e,t,n){return ct(t.get("categoryValue"),e),e.$parent=t,ct(n.get("rootElements"),t),t.$parent=n,e}function uS(e){var t=e.$parent;return t&&(at(t.get("categoryValue"),e),e.$parent=null),e}function lS(e){var t=e.$parent;return t&&(at(t.get("rootElements"),e),e.$parent=null),e}var pS=500;function tl(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&&cS(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&lS(u),c&&!r(c,l)&&uS(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"],pS,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){Hh(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Hh(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)}tl.$inject=["bpmnjs","elementRegistry","injector"],ee(tl,W);function Hh(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function nl(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 S=g.source,E=g.target;Zr(S)&&Vo(E)&&l(E)}function r(g){const S=g.connection,E=g.source,b=g.target;Zr(E)&&ms(b)&&(u(b),f(E,[S]))}function o(g){const S=g.newTarget,E=g.oldSource,b=g.oldTarget;if(b!==S){const x=E;Vo(b)&&l(b),Zr(x)&&ms(S)&&u(S)}}function a(g){const{element:S}=g;Vo(S)?(p(S),d(S)):ms(S)&&h(S)}function s(g){const{newData:S,oldShape:E}=g;if(Zr(g.oldShape)&&S.eventDefinitionType!=="bpmn:CompensateEventDefinition"||S.type!=="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>Vo(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!Zr(g.oldShape)&&S.eventDefinitionType==="bpmn:CompensateEventDefinition"&&S.type==="bpmn:BoundaryEvent"){const b=E.outgoing.find(({target:x})=>ms(x));b&&b.target&&(g._connectionTarget=b.target),m(E)}}function c(g){const{_connectionTarget:S,newShape:E}=g;S&&t.connect(E,S)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function p(g){for(const S of g.incoming)n.canConnect(S.source,g)||t.removeConnection(S);for(const S of g.outgoing)n.canConnect(g,S.target)||t.removeConnection(S)}function f(g,S){g.outgoing.filter(x=>y(x,"bpmn:Association")).filter(x=>Vo(x.target)&&!S.includes(x)).forEach(x=>t.removeConnection(x))}function d(g){const S=g.attachers.slice();S.length&&t.removeElements(S)}function h(g){const S=g.incoming.filter(E=>Zr(E.source));t.removeElements(S)}function m(g){const S=g.outgoing.filter(E=>y(E,"bpmn:SequenceFlow"));t.removeElements(S)}}ee(nl,W),nl.$inject=["eventBus","modeling","bpmnRules"];function Vo(e){const t=U(e);return t&&t.get("isForCompensation")}function Zr(e){return e&&y(e,"bpmn:BoundaryEvent")&&qr(e,"bpmn:CompensateEventDefinition")}function ms(e){return e&&y(e,"bpmn:Activity")&&!Ut(e)}function il(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=Xr(i,"bpmn:Participant"))})}il.$inject=["injector"],ee(il,W);function rl(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}})}rl.$inject=["eventBus","bpmnFactory"],ee(rl,W);var ol=20,al=20,zh=30,gs=2e3;function sl(e,t,n){W.call(this,t),t.on(["create.start","shape.move.start"],gs,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")&&!be(p)&&!Ve(p)});if(c.length){var u=pt(c),l=fS(a,u);D(a,l),o.createConstraints=dS(a,u)}}}),t.on("create.start",gs,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",gs,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",gs,function(r){var o=r.elements,a=r.parent,s=hS(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)}sl.$inject=["canvas","eventBus","modeling"],ee(sl,W);function fS(e,t){t={width:t.width+ol*2+zh,height:t.height+al*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 dS(e,t){return t=ue(t),{bottom:t.top+e.height/2-al,left:t.right-e.width/2+ol,top:t.bottom-e.height/2+al,right:t.left+e.width/2-ol-zh}}function hS(e){return qe(e,function(t){return y(t,"bpmn:Participant")})}var Vh="__targetRef_placeholder";function cl(e,t){W.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Gh(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Gh(o));function n(a,s,c){var u=a.get("dataInputAssociations");return qe(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=qe(c,function(l){return l.name===Vh});return!u&&s&&(u=t.create("bpmn:Property",{name:Vh}),ct(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||at(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,S;m&&m!==p&&r(m,u),d&&d!==p&&r(d,u),p?(S=i(p,!0),g.targetRef=S):g.targetRef=null}}cl.$inject=["eventBus","bpmnFactory"],ee(cl,W);function Gh(e){return function(t){var n=t.context,i=n.connection;if(y(i,"bpmn:DataInputAssociation"))return e(t)}}function vs(e){this._bpmnUpdater=e}vs.$inject=["bpmnUpdater"],vs.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),[]},vs.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 ul(e,t,n,i){W.call(this,i),t.registerHandler("dataStore.updateContainment",vs);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:Me(s),newSemanticParent:l.processRef||l,newDiParent:Me(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:gS(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Ee(u,["bpmn:Participant","bpmn:SubProcess"])&&y(l,"bpmn:Collaboration")&&o(l).filter(function(p){return mS(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)})})}ul.$inject=["canvas","commandStack","elementRegistry","eventBus"],ee(ul,W);function mS(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 gS(e,t){for(;e.parent;){if(y(e.parent,t))return e.parent;e=e.parent}}var ys=Math.max,_s=Math.min,vS=20;function Wh(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function yS(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 _S(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 bs(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return he(r)&&(i=(/top|left/.test(e)?_s:ys)(i,r)),he(o)&&(i=(/top|left/.test(e)?ys:_s)(i,o)),i}function bS(e,t){if(!t)return e;var n=ue(e);return ns({top:bs("top",n,t),right:bs("right",n,t),bottom:bs("bottom",n,t),left:bs("left",n,t)})}function xS(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:_s(o.top,a.top),left:_s(o.left,a.left),bottom:ys(o.bottom,a.bottom),right:ys(o.right,a.right)};return ns(s)}function Go(e,t){return typeof e<"u"?e:vS}function ES(e,t){var n,i,r,o;return typeof t=="object"?(n=Go(t.left),i=Go(t.right),r=Go(t.top),o=Go(t.bottom)):n=i=r=o=Go(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function wS(e){return!(e.waypoints||e.type==="label")}function Uh(e,t){var n;if(e.length===void 0?n=we(e.children,wS):n=e,n.length)return ES(pt(n),t)}var zi=Math.abs;function SS(e,t){return Wh(ue(t),ue(e))}var RS=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Cn=30;function xs(e,t){return t=t||[],e.children.filter(function(n){y(n,"bpmn:Lane")&&(xs(n,t),t.push(n))}),t}function Vi(e){return e.children.filter(function(t){return y(t,"bpmn:Lane")})}function Pn(e){return Xr(e,RS)||e}function CS(e,t){var n=Pn(e),i=y(n,"bpmn:Process")?[]:[n],r=xs(n,i),o=ue(e),a=ue(t),s=SS(e,t),c=[],u=kt(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&&(zi(m.bottom-o.top)<10&&(d=a.top-m.bottom),zi(m.top-o.top)<5&&(p=a.top-m.top)),s.left&&(zi(m.right-o.left)<10&&(f=a.left-m.right),zi(m.left-o.left)<5&&(h=a.left-m.left)),s.bottom&&(zi(m.top-o.bottom)<10&&(p=a.bottom-m.top),zi(m.bottom-o.bottom)<5&&(d=a.bottom-m.bottom)),s.right&&(zi(m.left-o.right)<10&&(h=a.right-m.left),zi(m.right-o.right)<5&&(f=a.right-m.right)),(p||f||d||h)&&c.push({shape:l,newBounds:_S(l,{top:p,right:f,bottom:d,left:h})})}}),c}var PS=500;function ll(e,t){W.call(this,e);function n(i,r){var o=kt(i),a=Vi(r),s=[],c=[],u=[],l=[];if(yr(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",PS,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))})}ll.$inject=["eventBus","spaceTool"],ee(ll,W);var qh=500;function Es(e,t){t.invoke(W,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",qh,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return Yh(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",qh,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;Yh(a,TS(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Es.$inject=["bpmnReplace","injector"],ee(Es,W),Es.prototype._replaceShape=function(e){var t=AS(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function AS(e){var t=U(e),n=t.eventDefinitions;return n&&n[0]}function Yh(e,t){return!be(e)&&y(e,"bpmn:BoundaryEvent")&&!t}function TS(e,t){return e.indexOf(t)!==-1}var ws=Math.round,MS=Math.max;function kS(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 DS(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var Kh=10;function OS(e,t){var n,i;for(n=0;i=e[n];n++)if(Io(i,t)<=Kh)return{point:e[n],bendpoint:!0,index:n};return null}function IS(e,t){var n=eh(kS(t,Kh),DS(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=MS(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:ws(i.x+r.x)/2,y:ws(i.y+r.y)/2},index:i.segment2}:{point:{x:ws(i.x),y:ws(i.y)},index:i.segment2}:null}function pl(e,t){return OS(e,t)||IS(e,t)}function fl(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(),S;he(a.width)?S=fe(a):S=a;var E=pl(s,S);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]:S,(c.length===1||!Xh(r,c[c.length-1]))&&c.push(Zh(l)),(u.length===1||!Xh(r,u[0]))&&u.unshift(Zh(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||S),d=o),t.canConnect(r,f,o)&&(d?h=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||S),h=o));var b=[].concat(d&&we(g,function(x){return x.source===d.source})||[],h&&we(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=qe(o.children,function(f){var d=t.canInsert(a,f);return d&&pl(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)}ee(fl,W),fl.$inject=["eventBus","bpmnRules","modeling"];function Xh(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 Zh(e){return D({},e)}function dl(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)&&Qr(r)){var c=[];y(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&Qr(u)):c=a.incoming.filter(u=>u!==r&&Qr(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(Qr).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Qr).forEach(function(s){const c=a.incoming.filter(Qr).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}dl.$inject=["eventBus","modeling"],ee(dl,W);function Qr(e){return y(e,"bpmn:SequenceFlow")}var Ss=1500,Qh=2e3;function Jh(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"],Ss,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;y(a,"bpmn:Lane")&&!Ee(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Pn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Ee(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"],Ss,function(i){var r=i.hover;y(r,"bpmn:Lane")&&(i.hover=Pn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Ss,function(i){var r=i.context,o=i.hover,a=r.type;y(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Pn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Ss,function(i){var r=i.context,o=r.start;y(o,"bpmn:Lane")&&(r.start=Pn(o)||o)}),t.on("shape.move.start",Qh,function(i){var r=i.shape;y(r,"bpmn:Lane")&&(i.shape=Pn(r)||r)}),t.on("spaceTool.move",Qh,function(i){var r=i.hover;r&&y(r,"bpmn:Lane")&&(i.hover=Pn(r))})}Jh.$inject=["elementRegistry","eventBus","canvas"];var em=770;function hl(e,t,n,i){n.invoke(W,this);function r(s,c){var u=U(s),l=c.categoryValue||u.categoryValueRef;l||(l=Fh(e,u));var p=c.category||l.$parent||jh(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",em,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",em,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})}hl.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],ee(hl,W);function ml(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 tm(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=ml(i,r,o,a),u=ml(i,r,o,s),l;c&&u?nm(c,o)>nm(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)})}tm.$inject=["eventBus"];function nm(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function gl(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=Me(i);if(Ee(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}gl.$inject=["eventBus"],ee(gl,W);function im(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function rm(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function LS(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 NS(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 vl(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=NS([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 om(e,t){var n=vl(e,t),i={x:n.x-e.x,y:n.y-e.y};return im(i)}function Wo(e,t){return im({x:e.x-t.x,y:e.y-t.y})}var am=Math.sqrt,sm=Math.min,BS=Math.max,cm=Math.abs;function um(e){return Math.pow(e,2)}function Uo(e,t){return am(um(e.x-t.x)+um(e.y-t.y))}function $S(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],pm(i,r)?u=[i]:(o=Uo(e,i),a=Uo(e,r),c=sm(o,a),u=jS(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:pm(i,u[0])?n:n+1}),u.length===2&&(s=HS(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:Uo(i,s)/Uo(i,r)}),p=Uo(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function jS(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=am(d),m=-p+h,g=-p-h,S={x:e.x-r*m,y:e.y-o*m};if(d===0)return[S];var E={x:e.x-r*g,y:e.y-o*g};return[S,E].filter(function(b){return FS(b,e,t)})}function FS(e,t,n){return lm(e.x,t.x,n.x)&&lm(e.y,t.y,n.y)}function lm(e,t,n){return e>=sm(t,n)-Rs&&e<=BS(t,n)+Rs}function HS(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Rs=.1;function pm(e,t){return cm(e.x-t.x)<=Rs&&cm(e.y-t.y)<=Rs}function zS(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=dm(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 fm(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=$S(e,n),c=s.segmentIndex,u=zS(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=hm(n,c),p=hm(t,u),f=s.position,d=GS(l,f),h=VS(l,p);if(s.type==="bendpoint"){var m=t.length-n.length,g=s.bendpointIndex,S=n[g];if(t.indexOf(S)!==-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=dm(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=LS({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:di(b),delta:di({x:r,y:o})}}function dm(e,t){var n=Wo(e[t-1],e[t]),i=Wo(e[t],e[t+1]),r=n/(n+i);return r}function VS(e,t){var n=rm(e),i=rm(t);return i-n}function hm(e,t){return[e[t],e[t+1]]}function GS(e,t){var n=Wo(e[0],e[1]),i=Wo(e[0],t);return n===0?0:i/n}function WS(e,t,n,i){var r=fe(e);return fm(r,t,n,i).delta}function qo(e,t,n){var i=zo(t),r=zo(n),o=Hn(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return di({x:r.x+a.x,y:r.y+a.y})}function mm(e,t,n){var i=zo(e),r=zo(t),o=zo(n),a=Hn(e,i),s=Hn(i,r),c=US(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 di({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function US(e,t,n){var i=ue(t),r=ue(n);if(qS(i,r))return null;var o=Lt(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=Lt(n,s),c!==o?null:a}function qS(e,t){return YS(e,t)||KS(e,t)}function YS(e,t){return e.right!==t.right&&e.left!==t.left}function KS(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var gm="name",vm="text";function yl(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(gm in u&&t.updateLabel(c,u[gm]),vm in u&&y(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[vm]||"");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;be(u)||!Hi(u)||xn(u)&&t.updateLabel(u,xn(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=D({},s.hints),p=s.newWaypoints||c.waypoints,f=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),WS(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&&Hi(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(!(!be(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(xn(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(cs(c)){var p=c.label,f=fe(p),d=QS(l),h=ZS(f,d),m=XS(h,l,u);t.moveShape(p,m)}})}ee(yl,W),yl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function XS(e,t,n){var i=qo(e,t,n);return di(Hn(i,e))}function ZS(e,t){if(t.length){var n=JS(e,t);return vl(e,n)}}function QS(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 JS(e,t){var n=t.map(function(r){return{line:r,distance:om(e,r)}}),i=Gn(n,"distance");return i[0].line}function eR(e,t,n,i){return fm(e,t,n,i).point}function _l(e,t){W.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=D({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),eR(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)})})}ee(_l,W),_l.$inject=["eventBus","modeling"];function Cs(e,t,n){var i=As(e),r=_m(i,t),o=i[0];return r.length?r[r.length-1]:qo(o.original||o,n,t)}function Ps(e,t,n){var i=As(e),r=_m(i,t),o=i[i.length-1];return r.length?r[0]:qo(o.original||o,n,t)}function bl(e,t,n){var i=As(e),r=ym(t,n),o=i[0];return qo(o.original||o,r,t)}function xl(e,t,n){var i=As(e),r=ym(t,n),o=i[i.length-1];return qo(o.original||o,r,t)}function ym(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function As(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function _m(e,t){var n=Ht(e,nR);return we(n,function(i){return tR(i,t)})}function tR(e,t){return Lt(t,e,1)==="intersect"}function nR(e){return e.original||e}function El(e,t){W.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(iR(i,r)){var o=rR(i);o.incoming.forEach(function(a){var s=Ps(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Cs(a,r,i);t.reconnectStart(a,r,s)})}},!0)}El.$inject=["eventBus","modeling"],ee(El,W);function iR(e,t){return y(e,"bpmn:Participant")&&Re(e)&&y(t,"bpmn:Participant")&&!Re(t)}function rR(e){var t=Do([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 oR=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function bm(e){const t=U(e);if(!y(t,"bpmn:BoundaryEvent")&&!(y(t,"bpmn:StartEvent")&&Ut(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:oR.some(i=>y(n[0],i))}function xm(e){return y(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function wl(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(!bm(r))return;const a=xm(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})})}wl.$inject=["injector","modeling"],ee(wl,W);function Sl(e,t){W.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Me(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}ee(Sl,W),Sl.$inject=["eventBus","modeling"];function Rl(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=aR(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}ee(Rl,W),Rl.$inject=["eventBus","bpmnRules","modeling"];function Jr(e){return e.original||e}function aR(e,t){var n=ml(Jr(e[e.length-2]),Jr(e[e.length-1]),Jr(t[1]),Jr(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Jr(e[0]),Jr(t[t.length-1])]}function Cl(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)}Cl.$inject=["eventBus","modeling"],ee(Cl,W);function Pl(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;M(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=qe(p.outgoing,jr({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})})}ee(Pl,W),Pl.$inject=["eventBus","modeling","bpmnRules","injector"];function Ts(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=sn(u,function(p,f){var d=t.canReplace([f],f.host||f.parent||c);return d?p.concat(d.replacements):p},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];M(s.closure.topLevel,function(f){Ut(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})})}ee(Ts,W),Ts.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;M(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)},Ts.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var sR=1500,cR={width:140,height:120},Al={width:300,height:60},Tl={width:60,height:300},Ms={width:300,height:150},ks={width:150,height:300},Em={width:140,height:120},wm={width:100,height:40};function Sm(e){e.on("resize.start",sR,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=dR(i,r,o)),y(i,"bpmn:SubProcess")&&Re(i)&&(n.minDimensions=Em),y(i,"bpmn:TextAnnotation")&&(n.minDimensions=wm)})}Sm.$inject=["eventBus"];var Gi=Math.abs,uR=Math.min,lR=Math.max;function Rm(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function eo(e,t,n){return Rm(e,t,n,uR)}function to(e,t,n){return Rm(e,t,n,lR)}var pR={top:20,left:50,right:20,bottom:20},fR={top:50,left:20,right:20,bottom:20};function dR(e,t,n){var i=Pn(e),r=!0,o=!0,a=xs(i,[i]),s=ue(e),c={},u={},l=kt(e),p=l?Al:Tl;/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&&Gi(s.top-m.bottom)<10&&to(c,"top",m.top+p.height),Gi(s.top-m.top)<5&&eo(u,"top",m.bottom-p.height)),/e/.test(t)&&(n&&Gi(s.right-m.left)<10&&eo(c,"right",m.right-p.width),Gi(s.right-m.right)<5&&to(u,"right",m.left+p.width)),/s/.test(t)&&(n&&Gi(s.bottom-m.top)<10&&eo(c,"bottom",m.bottom-p.height),Gi(s.bottom-m.bottom)<5&&to(u,"bottom",m.top+p.height)),/w/.test(t)&&(n&&Gi(s.left-m.right)<10&&to(c,"left",m.left+p.width),Gi(s.left-m.left)<5&&eo(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?pR:fR;return f.forEach(function(h){var m=ue(h);/n/.test(t)&&(!l||r)&&eo(u,"top",m.top-d.top),/e/.test(t)&&(l||o)&&to(u,"right",m.right+d.right),/s/.test(t)&&(!l||o)&&to(u,"bottom",m.bottom+d.bottom),/w/.test(t)&&(l||r)&&eo(u,"left",m.left-d.left)}),{min:u,max:c}}function Cm(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function no(e){return e.originalEvent||e.srcEvent}function Ml(e){Cm(e),Cm(no(e))}function Er(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 Pm(){return/mac/i.test(navigator.platform)}function Am(e,t){return(no(e)||e).button===t}function Wi(e){return Am(e,0)}function hR(e){return Am(e,1)}function Yo(e){var t=no(e)||e;return Wi(e)?Pm()?t.metaKey:t.ctrlKey:!1}function Ds(e){var t=no(e)||e;return Wi(e)&&t.shiftKey}var Tm=1001;function Mm(e,t){e.on("resize.start",Tm+500,function(n){var i=n.context,r=i.shape;(y(r,"bpmn:Lane")||y(r,"bpmn:Participant"))&&(i.balanced=!Yo(n))}),e.on("resize.end",Tm,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=oh(a),t.resizeLane(r,a,i.balanced)),!1})}Mm.$inject=["eventBus","modeling"];var mR=500;function kl(e,t,n,i,r){n.invoke(W,this);function o(l){return Ee(l,["bpmn:ReceiveTask","bpmn:SendTask"])||gR(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!qe(f,jr({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(Ee(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(Ee(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"),ct(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");at(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",mR,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)})}kl.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],ee(kl,W);function gR(e,t){return pe(t)||(t=[t]),Pi(t,function(n){return qr(e,n)})}var km=Math.max;function Dm(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return M(n,function(a){var s=a.id;y(a,"bpmn:Participant")&&(o[s]=yR(a,i,r)),y(a,"bpmn:Lane")&&(o[s]=kt(a)?Al:Tl),y(a,"bpmn:SubProcess")&&Re(a)&&(o[s]=Em),y(a,"bpmn:TextAnnotation")&&(o[s]=wm),y(a,"bpmn:Group")&&(o[s]=cR)}),o})}Dm.$inject=["eventBus"];function vR(e){return e==="x"}function yR(e,t,n){var i=kt(e);if(!xR(e))return i?Ms:ks;var r=vR(t),o={};return r?i?o=Ms:o={width:bR(e,n,r),height:ks.height}:i?o={width:Ms.width,height:_R(e,n,r)}:o=ks,o}function _R(e,t,n){var i;return i=ER(e,t,n),km(Ms.height,i)}function bR(e,t,n){var i;return i=wR(e,t,n),km(ks.width,i)}function xR(e){return!!Vi(e).length}function ER(e,t,n){var i=Vi(e),r;return r=Dl(i,t,n),e.height-r.height+Al.height}function wR(e,t,n){var i=Vi(e),r;return r=Dl(i,t,n),e.width-r.width+Tl.width}function Dl(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=Vi(r),o.length?Dl(o,t,n):r}var Om="_plane";function Im(e){var t=e.id;return SR(t)}function ei(e){var t=e.id;return y(e,"bpmn:SubProcess")?Lm(t):t}function wr(e){return Lm(e)}function Os(e){var t=Me(e);return y(t,"bpmndi:BPMNPlane")}function Lm(e){return e+Om}function SR(e){return e.replace(new RegExp(Om+"$"),"")}var Nm=400,RR=600,Bm={x:180,y:160};function vi(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")&&!Re(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(ei(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;M(f,function(d){if(c(d)){var h=a.get(ei(d));if(!(!h||!d.children||!d.children.length)){var m=$m(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")||!Re(f)||M($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(ei(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(ei(f)))},!0),this.postExecuted("shape.replace",function(p){var f=p.newShape,d=p.oldRoot,h=e.findRoot(ei(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(Os(f)){a.updateId(f,wr(g)),a.updateId(m,g);return}var S=a.get(wr(m));S&&a.updateId(wr(m),wr(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(Os(f)){a.updateId(f,wr(m)),a.updateId(g,m);return}var S=a.get(wr(g));S&&a.updateId(S,wr(m))}}},!0),t.on("element.changed",function(p){var f=p.element;if(Os(f)){var d=f,h=a.get(Im(d));!h||h===d||t.fire("element.changed",{element:h})}}),this.executed("shape.toggleCollapse",Nm,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Re(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",Nm,function(p){var f=p.shape;y(f,"bpmn:SubProcess")&&(Re(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",RR,function(p){var f=p.shape;if(y(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Re(f))s._moveChildrenToShape(d.children.slice(),f),M($o(f.children),m=>{n.moveShape(m.annotation,{x:0,y:0},f.parent),M(m.associations,g=>{n.moveConnection(g,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var h=$m(f);s._moveChildrenToShape(h,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var h=ei(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(Me(m),"bpmndi:BPMNPlane");if(g){var S=Im(m),E=qe(h,function(b){return b.id===S});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)})}ee(vi,W),vi.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=pt(i),o;if(!t.x)o={x:Bm.x-r.x,y:Bm.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})}},vi.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Ah(e).map(i=>i.annotation));n.size&&M($o(e.children),i=>{n.has(i.annotation)&&M(i.associations,r=>{t.removeConnection(r)})})},vi.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},vi.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},vi.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},vi.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=qe(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},vi.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function CR(e){var t=[];return M($o(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function $m(e){return e.children.slice().concat(CR(e.children)).concat(PR(e))}function PR(e){return Bu(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Ol(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"))||!Re(r))){var o=AR(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Ol.$inject=["injector","modeling"],ee(Ol,W);function AR(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Il(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,xn(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}}})}ee(Il,W),Il.$inject=["eventBus","textRenderer"];function Ll(e,t){W.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Re(i))return;var r=Do(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();M(s,function(u){o(u,!0)}),M(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)}ee(Ll,W),Ll.$inject=["eventBus","modeling"];var Nl=500;function Bl(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=TR(c).concat([a]),p=Uh(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"],Nl,function(a){var s=a.context,c=s.shape;y(c,"bpmn:SubProcess")&&(c.collapsed?Me(c).isExpanded=!1:(i(c.children),Me(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Nl,function(a){var s=a.context,c=s.shape;c.collapsed?Me(c).isExpanded=!1:Me(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Nl,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"})})}ee(Bl,W),Bl.$inject=["eventBus","elementFactory","modeling"];function TR(e){return e.filter(function(t){return!t.hidden})}function $l(e,t,n,i){t.invoke(W,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;be(a)||(y(a,"bpmn:Participant")&&Re(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)})}ee($l,W),$l.$inject=["canvas","injector","moddle","modeling"];function jl(e,t){W.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;MR(r,o)&&t.updateProperties(o,{default:null})})}ee(jl,W),jl.$inject=["eventBus","modeling"];function MR(e,t){if(!y(e,"bpmn:SequenceFlow"))return!1;var n=U(t),i=U(e);return n.get("default")===i}var kR=500,DR=5e3,jm=["shape.create","shape.delete","shape.move","shape.resize"],Fm=[...jm,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Fl(e,t){W.call(this,e);var n;function i(){return n=n||new OR,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(Fm,DR,function(){i()}),this.postExecuted(Fm,kR,function(){o()}),this.preExecute(jm,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))})}Fl.$inject=["eventBus","modeling"],ee(Fl,W);function OR(){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 IR=500,LR=5e3,Hm=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],zm=[...Hm,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Hl(e,t){W.call(this,e);var n;function i(){return n=n||new NR,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(zm,LR,function(){i()}),this.postExecuted(zm,IR,function(){o()}),this.preExecute(Hm,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)})}Hl.$inject=["eventBus","modeling"],ee(Hl,W);function NR(){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 zl(e,t){W.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)BR(o)&&!jR(o)&&t.updateProperties(o,{isForCompensation:void 0})})}ee(zl,W),zl.$inject=["eventBus","modeling"];function BR(e){const t=U(e);return t&&t.isForCompensation}function $R(e){return e&&y(e,"bpmn:BoundaryEvent")&&qr(e,"bpmn:CompensateEventDefinition")}function jR(e){return e.incoming.filter(n=>$R(n.source)).length>0}const FR={__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",Zu],associationBehavior:["type",Ju],attachEventBehavior:["type",hs],artifactBehavior:["type",Qu],boundaryEventBehavior:["type",el],categoryRootElementReferenceBehavior:["type",tl],compensateBoundaryEventBehaviour:["type",nl],createBehavior:["type",il],createDataObjectBehavior:["type",rl],createParticipantBehavior:["type",sl],dataInputAssociationBehavior:["type",cl],dataStoreBehavior:["type",ul],deleteLaneBehavior:["type",ll],detachEventBehavior:["type",Es],dropOnFlowBehavior:["type",fl],eventBasedGatewayBehavior:["type",dl],fixHoverBehavior:["type",Jh],groupBehavior:["type",hl],importDockingFix:["type",tm],isHorizontalFix:["type",gl],labelBehavior:["type",yl],layoutConnectionBehavior:["type",_l],messageFlowBehavior:["type",El],nonInterruptingBehavior:["type",wl],removeElementBehavior:["type",Rl],removeEmbeddedLabelBoundsBehavior:["type",Sl],removeParticipantBehavior:["type",Cl],replaceConnectionBehavior:["type",Pl],replaceElementBehaviour:["type",Ts],resizeBehavior:["type",Sm],resizeLaneBehavior:["type",Mm],rootElementReferenceBehavior:["type",kl],spaceToolBehavior:["type",Dm],subProcessPlaneBehavior:["type",vi],subProcessStartEventBehavior:["type",Ol],textAnnotationBehavior:["type",Il],toggleCollapseConnectionBehaviour:["type",Ll],toggleElementCollapseBehaviour:["type",Bl],unclaimIdBehavior:["type",$l],unsetDefaultFlowBehavior:["type",jl],updateFlowNodeRefsBehavior:["type",Fl],updateCategoryValueRefsBehavior:["type",Hl],setCompensationActivityAfterPasteBehavior:["type",zl]};function Vl(e){this._commandStack=e.get("commandStack",!1)}Vl.$inject=["injector"],Vl.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const ti={__init__:["rules"],rules:["type",Vl]};function An(e){W.call(this,e),this.init()}An.$inject=["eventBus"],ee(An,W),An.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)})},An.prototype.init=function(){};function Vm(e,t){var n=Lt(e,t,-15);return n!=="intersect"?n:null}function Bt(e){An.call(this,e)}ee(Bt,An),Bt.$inject=["eventBus"],Bt.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return HR(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 Ls(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Ls(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 ng(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Ve(i)&&!Ns(t,i)?!1:pr(t,function(r){return Ve(r)?Ls(r.source,r.target,r):r.host?Ko(r,r.host,null,n):ql(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 Xm(a)&&!n.includes(a.host)})?!1:Ko(n,t,null,i)||eg(n,t,i)||tg(n,t)||Ns(n,t)}),this.addRule("shape.create",function(e){return ql(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Ko(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return sg(n,t)})},Bt.prototype.canConnectMessageFlow=og,Bt.prototype.canConnectSequenceFlow=ag,Bt.prototype.canConnectDataAssociation=Yl,Bt.prototype.canConnectAssociation=ig,Bt.prototype.canConnectCompensationAssociation=rg,Bt.prototype.canMove=tg,Bt.prototype.canAttach=Ko,Bt.prototype.canReplace=eg,Bt.prototype.canDrop=io,Bt.prototype.canInsert=Ns,Bt.prototype.canCreate=ql,Bt.prototype.canConnect=Ls,Bt.prototype.canResize=ng,Bt.prototype.canCopy=sg;function HR(e){return Gl(e)?null:Ee(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Gl(e){return!e||be(e)}function Gm(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 Wl(e){return y(e,"bpmn:TextAnnotation")}function Ul(e){return y(e,"bpmn:Group")&&!e.labelTarget}function Wm(e){return y(e,"bpmn:BoundaryEvent")&&ni(e,"bpmn:CompensateEventDefinition")}function Is(e){return U(e).isForCompensation}function zR(e,t){var n=Gm(e),i=Gm(t);return n===i}function VR(e){return y(e,"bpmn:InteractionNode")&&!y(e,"bpmn:BoundaryEvent")&&(!y(e,"bpmn:Event")||y(e,"bpmn:ThrowEvent")&&Ym(e,"bpmn:MessageEventDefinition"))}function GR(e){return y(e,"bpmn:InteractionNode")&&!Is(e)&&(!y(e,"bpmn:Event")||y(e,"bpmn:CatchEvent")&&Ym(e,"bpmn:MessageEventDefinition"))&&!(y(e,"bpmn:BoundaryEvent")&&!ni(e,"bpmn:MessageEventDefinition"))}function Um(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 qm(e,t){var n=Um(e),i=Um(t);return n===i}function ni(e,t){var n=U(e);return!!qe(n.eventDefinitions||[],function(i){return y(i,t)})}function Ym(e,t){var n=U(e);return(n.eventDefinitions||[]).every(function(i){return y(i,t)})}function WR(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:EndEvent")&&!Ut(e)&&!(y(e,"bpmn:IntermediateThrowEvent")&&ni(e,"bpmn:LinkEventDefinition"))&&!Wm(e)&&!Is(e)}function UR(e){return y(e,"bpmn:FlowNode")&&!y(e,"bpmn:StartEvent")&&!y(e,"bpmn:BoundaryEvent")&&!Ut(e)&&!(y(e,"bpmn:IntermediateCatchEvent")&&ni(e,"bpmn:LinkEventDefinition"))&&!Is(e)}function qR(e){return y(e,"bpmn:ReceiveTask")||y(e,"bpmn:IntermediateCatchEvent")&&(ni(e,"bpmn:MessageEventDefinition")||ni(e,"bpmn:TimerEventDefinition")||ni(e,"bpmn:ConditionalEventDefinition")||ni(e,"bpmn:SignalEventDefinition"))}function YR(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function Km(e,t){var n=YR(t);return n.indexOf(e)!==-1}function Ls(e,t,n){if(Gl(e)||Gl(t))return null;if(!y(n,"bpmn:DataAssociation")){if(og(e,t))return{type:"bpmn:MessageFlow"};if(ag(e,t))return{type:"bpmn:SequenceFlow"}}var i=Yl(e,t);return i||(rg(e,t)?{type:"bpmn:Association",associationDirection:"One"}:ig(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function io(e,t){return be(e)||Ul(e)?!0:y(t,"bpmn:Participant")&&!Re(t)?!1:y(e,"bpmn:Participant")?y(t,"bpmn:Process")||y(t,"bpmn:Collaboration"):Ee(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")&&!KR(e)?!1:y(e,"bpmn:FlowElement")&&!y(e,"bpmn:DataStoreReference")?y(t,"bpmn:FlowElementsContainer")?Re(t):Ee(t,["bpmn:Participant","bpmn:Lane"]):y(e,"bpmn:DataStoreReference")&&y(t,"bpmn:Collaboration")?Pi(U(t).get("participants"),function(n){return!!n.get("processRef")}):Ee(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ee(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 KR(e){return U(e).cancelActivity&&(Zm(e)||Qm(e))}function Xm(e){return!be(e)&&y(e,"bpmn:BoundaryEvent")}function XR(e){return y(e,"bpmn:Lane")}function ZR(e){return Xm(e)||y(e,"bpmn:IntermediateThrowEvent")&&Zm(e)?!0:y(e,"bpmn:IntermediateCatchEvent")&&Qm(e)}function Zm(e){var t=U(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Qm(e){return Jm(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Jm(e,t){return t.some(function(n){return ni(e,n)})}function QR(e){return y(e,"bpmn:ReceiveTask")&&qe(e.incoming,function(t){return y(t.source,"bpmn:EventBasedGateway")})}function Ko(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return be(r)||!ZR(r)||Ut(t)||!y(t,"bpmn:Activity")||Is(t)||i&&!Vm(i,t)||QR(t)?!1:"attach"}function eg(e,t,n){if(!t)return!1;var i={replacements:[]};return M(e,function(r){Ut(t)||y(r,"bpmn:StartEvent")&&r.type!=="label"&&io(r,t)&&(s1(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(c1(r)||u1(r)||l1(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Jm(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")||ni(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(y(r,"bpmn:EndEvent")&&io(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),y(r,"bpmn:BoundaryEvent")&&Ko(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function tg(e,t){return Pi(e,XR)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return io(n,t)})}function ql(e,t,n,i){return t?be(e)||Ul(e)?!0:io(e,t)||Ns(e,t):!1}function ng(e,t,n){return y(e,"bpmn:SubProcess")?Re(e)&&(!t||t.width>=100&&t.height>=80):y(e,"bpmn:Lane")||y(e,"bpmn:Participant")?!0:Wl(e)?n?n==="e"||n==="w":!0:Ul(e)?!0:be(e)?n?n==="e"||n==="w":!0:!1}function JR(e,t){var n=Wl(e),i=Wl(t);return(n||i)&&n!==i}function ig(e,t){return Km(t,e)||Km(e,t)?!1:JR(e,t)?!0:!!Yl(e,t)}function rg(e,t){return qm(e,t)&&Wm(e)&&y(t,"bpmn:Activity")&&!tC(t,e)&&!Ut(t)}function og(e,t){return ug(e)&&!ug(t)?!1:VR(e)&&GR(t)&&!zR(e,t)}function ag(e,t){return WR(e)&&UR(t)&&qm(e,t)&&!(y(e,"bpmn:EventBasedGateway")&&!qR(t))}function Yl(e,t){return Ee(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ee(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Ee(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ee(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function Ns(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:Ee(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!be(t)&&y(e,"bpmn:FlowNode")&&!y(e,"bpmn:BoundaryEvent")&&io(e,t.parent)}function Kl(e,t){return e&&t&&e.indexOf(t)!==-1}function sg(e,t){return be(t)?!0:!(y(t,"bpmn:Lane")&&!Kl(e,t.parent)||y(t,"bpmn:MessageFlow")&&!eC(e,t))}function eC(e,t){var n=cg(t.source),i=cg(t.target);return Kl(e,n)&&Kl(e,i)}function cg(e){for(;e;e=e.parent)if(y(e,"bpmn:Participant"))return e;return null}function ug(e){return Xr(e,"bpmn:Process")||Xr(e,"bpmn:Collaboration")}function tC(e,t){return e.attachers.includes(t)}const nC={__depends__:[ti],__init__:["bpmnRules"],bpmnRules:["type",Bt]};var iC=2e3;function lg(e,t){e.on("saveXML.start",iC,n);function n(){var i=t.getRootElements();M(i,function(r){var o=Me(r),a,s;a=Do([r]),a=we(a,function(c){return c!==r&&!c.labelTarget}),s=Ht(a,Me),o.set("planeElement",s)})}}lg.$inject=["eventBus","canvas"];const rC={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",lg]};function Bs(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)})}Bs.prototype.getOrdering=function(e,t){return null},ee(Bs,W);function Xl(e,t){Bs.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=qe(n,function(c){return Ee(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&&!Ee(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=Rf(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"],ee(Xl,Bs);const oC={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Xl]};function Xo(){}Xo.prototype.get=function(){return this._data},Xo.prototype.set=function(e){this._data=e},Xo.prototype.clear=function(){var e=this._data;return delete this._data,e},Xo.prototype.isEmpty=function(){return!this._data};const aC={clipboard:["type",Xo]};var pg=1500;function fg(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",pg,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",pg,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=Er(a),c=document.elementFromPoint(s.x,s.y),sC(c)}}fg.$inject=["elementRegistry","eventBus","injector"];function sC(e){return gr(e,"svg, .djs-element",!0)}const cC={__init__:["hoverFix"],hoverFix:["type",fg]};function uC(e){return!0}function $s(e){return Wi(e)||hR(e)}var dg=500;function hg(e,t,n){var i=this;function r(P,j,F){if(!s(P,j)){var L,H,re;F?H=t.getGraphics(F):(L=j.delegateTarget||j.target,L&&(H=L,F=t.get(H))),!(!H||!F)&&(re=e.fire(P,{element:F,gfx:H,originalEvent:j}),re===!1&&(j.stopPropagation(),j.preventDefault()))}}var o={};function a(P){return o[P]}function s(P,j){var F=u[P]||Wi;return!F(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":uC,"element.mousedown":$s,"element.mouseup":$s,"element.click":$s,"element.dblclick":$s};function l(P,j,F){var L=c[P];if(!L)throw new Error("unmapped DOM event name <"+P+">");return r(L,j,F)}var p="svg, .djs-element";function f(P,j,F,L){var H=o[F]=function(re){r(F,re)};L&&(u[F]=L),H.$delegate=cn.bind(P,p,j,H)}function d(P,j,F){var L=a(F);L&&cn.unbind(P,j,L.$delegate)}function h(P){M(c,function(j,F){f(P,F,j)})}function m(P){M(c,function(j,F){d(P,F,j)})}e.on("canvas.destroy",function(P){m(P.svg)}),e.on("canvas.init",function(P){h(P.svg)}),e.on(["shape.added","connection.added"],function(P){var j=P.element,F=P.gfx;e.fire("interactionEvents.createHit",{element:j,gfx:F})}),e.on(["shape.changed","connection.changed"],dg,function(P){var j=P.element,F=P.gfx;e.fire("interactionEvents.updateHit",{element:j,gfx:F})}),e.on("interactionEvents.createHit",dg,function(P){var j=P.element,F=P.gfx;i.createDefaultHit(j,F)}),e.on("interactionEvents.updateHit",function(P){var j=P.element,F=P.gfx;i.updateDefaultHit(j,F)});var g=w("djs-hit djs-hit-stroke"),S=w("djs-hit djs-hit-click-stroke"),E=w("djs-hit djs-hit-all"),b=w("djs-hit djs-hit-no-move"),x={all:E,"click-stroke":S,stroke:g,"no-move":b};function w(P,j){return j=D({stroke:"white",strokeWidth:15},j||{}),n.cls(P,["no-fill","no-border"],j)}function A(P,j){var F=x[j];if(!F)throw new Error("invalid hit type <"+j+">");return te(P,F),P}function I(P,j){ve(P,j)}this.removeHits=function(P){var j=Ka(".djs-hit",P);M(j,wt)},this.createDefaultHit=function(P,j){var F=P.waypoints,L=P.isFrame,H;return F?this.createWaypointsHit(j,F):(H=L?"stroke":"all",this.createBoxHit(j,H,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,j){var F=ko(j);return A(F,"stroke"),I(P,F),F},this.createBoxHit=function(P,j,F){F=D({x:0,y:0},F);var L=ae("rect");return A(L,j),te(L,F),I(P,L),L},this.updateDefaultHit=function(P,j){var F=He(".djs-hit",j);if(F)return P.waypoints?Nu(F,P.waypoints):te(F,{width:P.width,height:P.height}),F},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}hg.$inject=["eventBus","elementRegistry","styles"];const js={__init__:["interactionEvents"],interactionEvents:["type",hg]};function ro(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)})}ro.$inject=["eventBus","canvas"],ro.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()})}},ro.prototype.get=function(){return Array.from(this._selectedElements)},ro.prototype.isSelected=function(e){return this._selectedElements.has(e)},ro.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?M(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var mg="hover",gg="selected";function vg(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,mg)}),t.on("element.out",function(r){i(r.element,mg)}),t.on("selection.changed",function(r){function o(u){i(u,gg)}function a(u){n(u,gg)}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)})}vg.$inject=["canvas","eventBus"];function yg(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(lC))}}),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=qe(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Wi(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Ds(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}yg.$inject=["eventBus","selection","canvas","elementRegistry"];function lC(e){return!e.hidden}const Tn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[js],selection:["type",ro],selectionVisuals:["type",vg],selectionBehavior:["type",yg]};var pC=/^djs-cursor-.*$/;function Fs(e){var t=Je(document.body);t.removeMatching(pC),e&&t.add("djs-cursor-"+e)}function _g(){Fs(null)}var fC=5e3;function bg(e,t){t=t||"element.click";function n(){return!1}return e.once(t,fC,n),function(){e.off(t,n)}}var dC=["c","C"],hC=["v","V"],mC=["d","D"],gC=["x","X"],vC=["y","Y"],xg=["z","Z"];function yC(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function pn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function St(e,t){return e=pe(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Zl(e){return e.shiftKey}function _C(e){return pn(e)&&St(dC,e)}function bC(e){return pn(e)&&St(hC,e)}function xC(e){return pn(e)&&St(mC,e)}function EC(e){return pn(e)&&St(gC,e)}function wC(e){return pn(e)&&!Zl(e)&&St(xg,e)}function SC(e){return pn(e)&&(St(vC,e)||St(xg,e)&&Zl(e))}var oo=Math.round,Eg="djs-drag-active";function Sr(e){e.preventDefault()}function RC(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function CC(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function wg(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),w=t._container.getBoundingClientRect();return{x:x.x+(b.x-w.left)/x.scale,y:x.y+(b.y-w.top)/x.scale}}function s(b,x){x=x||o;var w=e.createEvent(D({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,w)===!1?!1:e.fire(x.prefix+"."+b,w)}function c(b){var x=b.filter(function(w){return i.get(w.id)});x.length&&n.select(x)}function u(b,x){var w=o.payload,A=o.displacement,I=o.globalStart,P=Er(b),j=Hn(P,I),F=o.localStart,L=a(P),H=Hn(L,F);if(!o.active&&(x||CC(j)>o.threshold)){if(D(w,{x:oo(F.x+A.x),y:oo(F.y+A.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return g();o.active=!0,o.keepSelection||(w.previousSelection=n.get(),n.select(null)),o.cursor&&Fs(o.cursor),t.addMarker(t.getRootElement(),Eg)}Ml(b),o.active&&(D(w,{x:oo(L.x+A.x),y:oo(L.y+A.y),dx:oo(H.x),dy:oo(H.y)},{originalEvent:b}),s("move"))}function l(b){var x,w=!0;o.active&&(b&&(o.payload.originalEvent=b,Ml(b)),w=s("end")),w===!1&&s("rejected"),x=S(w!==!0),s("ended",x)}function p(b){St("Escape",b)&&(Sr(b),g())}function f(b){var x;o.active&&(x=bg(e),setTimeout(x,400),Sr(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 w=o.active;w&&s("cancel"),x=S(b),w&&s("canceled",x)}}function S(b){var x,w;s("cleanup"),_g(),o.trapClick?w=f:w=l,me.unbind(document,"mousemove",u),me.unbind(document,"dragstart",Sr),me.unbind(document,"selectstart",Sr),me.unbind(document,"mousedown",w,!0),me.unbind(document,"mouseup",w,!0),me.unbind(document,"keyup",p),me.unbind(document,"touchstart",d,!0),me.unbind(document,"touchcancel",g,!0),me.unbind(document,"touchmove",u,!0),me.unbind(document,"touchend",l,!0),e.off("element.hover",h),e.off("element.out",m),t.removeMarker(t.getRootElement(),Eg);var A=o.payload.previousSelection;return b!==!1&&A&&!n.get().length&&c(A),x=o,o=null,x}function E(b,x,w,A){o&&g(!1),typeof x=="string"&&(A=w,w=x,x=null),A=D({},r,A||{});var I=A.data||{},P,j,F,L,H;if(A.trapClick?L=f:L=l,b?(P=no(b)||b,j=Er(b),Ml(b),P.type==="dragstart"&&Sr(P)):(P=null,j={x:0,y:0}),F=a(j),x||(x=F),H=RC(P),o=D({prefix:w,data:I,payload:{},globalStart:j,displacement:Hn(x,F),localStart:F,isTouch:H},A),A.manual||(H?(me.bind(document,"touchstart",d,!0),me.bind(document,"touchcancel",g,!0),me.bind(document,"touchmove",u,!0),me.bind(document,"touchend",l,!0)):(me.bind(document,"mousemove",u),me.bind(document,"dragstart",Sr),me.bind(document,"selectstart",Sr),me.bind(document,"mousedown",L,!0),me.bind(document,"mouseup",L,!0)),me.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){D(r,b)}}wg.$inject=["eventBus","canvas","selection","elementRegistry"];const yi={__depends__:[cC,Tn],dragging:["type",wg]};function ao(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}ao.prototype.next=function(){return this._prefix+ ++this._counter};const PC=new ao("ps");var AC=["marker-start","marker-mid","marker-end"],TC=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Ui(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Ui.$inject=["elementRegistry","eventBus","canvas","styles"],Ui.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},Ui.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Ui.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Nd(n);return this._cloneMarkers(_r(r),i),te(r,this._styles.cls(i,[])),ve(t,r),te(r,"data-preview-support-element-id",e.id),r},Ui.prototype.addFrame=function(e,t){var n=ae("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ve(t,n),te(n,"data-preview-support-element-id",e.id),n},Ui.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),OC(e)&&AC.forEach(function(r){if(te(e,r)){var o=MC(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},Ui.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,PC.next()].join("-"),a=He("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Nd(n);s.id=o,Ce(s).add(r);var c=He(":scope > defs",e);c||(c=ae("defs"),ve(e,c)),ve(c,s);var u=DC(s.id);te(t,i,u)};function MC(e,t,n){var i=kC(te(e,t));return He("marker#"+i,n||document)}function kC(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function DC(e){return"url(#"+e+")"}function OC(e){return TC.indexOf(e.nodeName)!==-1}const so={__init__:["previewSupport"],previewSupport:["type",Ui]};var IC="drop-ok",Sg="drop-not-ok",Rg="attach-ok",Cg="new-parent",Pg="create",LC=2e3;function Ag(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=we(c,function(E){var b=E.labelTarget;return!E.parent&&!(be(E)&&c.indexOf(b)!==-1)});var d=qe(c,function(E){return!Ve(E)}),h=!1,m=!1,g=!1;Mg(c)&&(h=r.allowed("shape.attach",{position:l,shape:d,target:u})),h||(Mg(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 S=f.connectionTarget;return g||h?(d&&p&&(m=r.allowed("connection.create",{source:S===p?d:p,target:S===p?p:d,hints:{targetParent:u,targetAttach:h}})),{attach:h,connect:m}):g===null||h===null?null:!1}function a(c,u){[Rg,IC,Sg,Cg].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}Tg(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,Rg):a(p,m?Cg:Sg))}),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,S=u.hints||{};if(h===!1||!d)return!1;Tg(c);var E={x:c.x,y:c.y};g?p=i.appendShape(l,p,E,d,{attach:m,connection:g===!0?{}:g,connectionTarget:S.connectionTarget}):(f=i.createElements(f,E,d,D({},S,{attach:m})),p=qe(f,function(b){return!Ve(b)})),D(u,{elements:f,shape:p}),D(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Pg&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],LC,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){pe(u)||(u=[u]);var p=qe(u,function(h){return!Ve(h)});if(p){l=D({elements:u,hints:{},shape:p},l||{}),M(u,function(h){he(h.x)||(h.x=0),he(h.y)||(h.y=0)});var f=we(u,function(h){return!h.hidden}),d=pt(f);M(u,function(h){Ve(h)&&(h.waypoints=Ht(h.waypoints,function(m){return{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2}})),D(h,{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2})}),t.init(c,Pg,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}Ag.$inject=["canvas","dragging","eventBus","modeling","rules"];function Tg(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 Mg(e){return e&&e.length===1&&!Ve(e[0])}var NC=750;function kg(e,t,n,i,r){function o(a){var s=ae("g");te(s,r.cls("djs-drag-group",["no-events"]));var c=ae("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(_r(l),u)):(l=n._createContainer("shape",c),n.drawShape(_r(l),u),Nt(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",NC,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(),ve(p,l)),Nt(l,a.x,a.y)):wt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&wt(c)})}kg.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Hs={__depends__:[yi,so,ti,Tn],__init__:["create","createPreview"],create:["type",Ag],createPreview:["type",kg]};function Ql(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)})}Ql.$inject=["eventBus"],Ql.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||BC(0,0)};function BC(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 Zo={__init__:["mouse"],mouse:["type",Ql]};var Dg=2e3;function fn(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),$C(l)&&(u.priority=2,u.host=l.host.id),Ve(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=jC(l)),be(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),M(["x","y","width","height"],function(f){he(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",Dg,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Dg,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;D(u,{createElementsBehavior:!1})})}fn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],fn.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},fn.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})}}},fn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},fn.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},fn.prototype._getElementIdsFromTree=function(e){var t={};return M(e,function(n){M(n,function(i){i.id&&(t[i.id]=!0)})}),t},fn.prototype._paste=function(e,t,n,i){M(e,function(o){he(o.x)||(o.x=0),he(o.y)||(o.y=0)});var r=pt(e);return M(e,function(o){Ve(o)&&(o.waypoints=Ht(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),D(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,D({},i))},fn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return M(e,function(o,a){o=Gn(o,"priority"),M(o,function(s){var c=D({},Wn(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(Ve(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(be(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},fn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Wn(e,["id"]));return t},fn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Wn(e,["id"]));return t},fn.prototype.createShape=function(e){var t=this._elementFactory.createShape(Wn(e,["id"]));return t},fn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Ve(e)&&(!n.has(e.source)||!n.has(e.target))||be(e)&&!n.has(e.labelTarget))},fn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Ja(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}yr(a,function(p,f,d){if(be(p))return;M(p.labels,function(g){c(g,d)});function h(g){g&&g.length&&M(g,function(S){M(S.labels,function(E){c(E,d)}),c(S,d)})}M([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=Ht(r,function(p){return p.element});var l=new Set(e);return r=Ht(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=Gn(r,function(p){return p.descriptor.priority}),e=Ht(r,function(p){return p.element}),M(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){Ig(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){Ig(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function $C(e){return!!e.host}function jC(e){return Ht(e.waypoints,function(t){return t=Og(t),t.original&&(t.original=Og(t.original)),t})}function Og(e){return D({},e)}function Ig(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const FC={__depends__:[aC,Hs,Zo,ti],__init__:["copyPaste"],copyPaste:["type",fn]};function Jl(e,t,n){pe(n)||(n=[n]),M(n,function(i){lr(e[i])||(t[i]=e[i])})}var ep=750;function Lg(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",ep,function(c){var u=c.descriptor,l=c.element,p=U(l);if(be(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(Me(l),!0);d.bpmnElement=f,Jl(f,u,"name"),Jl(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])),Wn(l,sn(l,function(f,d,h){var m=d.element,g=d.property;return h===c.id&&(m.set(g,p),f.push(c.id)),f},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,p=l.businessObject,f=l.di;if(be(l)){l.businessObject=U(u[l.labelTarget]),l.di=Me(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,Jl(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",ep,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")&&M($o(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",ep,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Lg.$inject=["bpmnFactory","eventBus","moddleCopy"];const HC=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],zC=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Qo(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 Gn(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=At(r)&&r.$descriptor;if(a&&zC.includes(a))return o;if(a&&HC.includes(a)||a&&s&&!qe(s.properties,jr({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})}Qo.$inject=["eventBus","bpmnFactory","moddle"],Qo.prototype.copyElement=function(e,t,n,i=!1){n&&!pe(n)&&(n=[n]),n=n||tp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(pe(r)&&(n=r),M(n,o=>{let a;an(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!xt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Qo.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 At(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)?sn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):At(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},Qo.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 tp(e,t){return sn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Ng={__depends__:[FC],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Lg],moddleCopy:["type",Qo]};var Bg=Math.round;function np(e,t){this._modeling=e,this._eventBus=t}np.$inject=["modeling","eventBus"],np.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=Bg(s+o/2),l=Bg(c+a/2),p=i.replaceShape(e,D({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function $g(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}$g.$inject=["selection","eventBus"];const VC={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",$g],replace:["type",np]};function GC(e,t,n){pe(n)||(n=[n]),M(n,function(i){lr(e[i])||(t[i]=e[i])})}var WC=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function UC(e,t){var n=e&&an(e,"collapsed")?e.collapsed:!Re(e),i;return t&&(an(t,"collapsed")||an(t,"isExpanded"))?i=an(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function jg(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(zs(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&UC(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),GC(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var h=tp(p.$descriptor),m=tp(f.$descriptor,!0),g=qC(h,m);D(f,jn(c,WC));var S=we(g,function(x){return x==="eventDefinitions"?Fg(s,c.eventDefinitionType):x==="loopCharacteristics"?!Ut(f):an(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!Ut(f):!0});if(f=n.copyElement(p,f,S),c.eventDefinitionType&&(Fg(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),y(p,"bpmn:Activity")){if(zs(p))d.isExpanded=Re(s);else if(c&&an(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}Re(s)&&!y(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(zs(p)&&!zs(f)&&(u.moveChildren=!1),y(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=kt(s);Me(s).isHorizontal||(Me(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,Ee(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Ee(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}jg.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function zs(e){return y(e,"bpmn:SubProcess")}function Fg(e,t){var n=U(e);return t&&n.get("eventDefinitions").some(function(i){return y(i,t)})}function qC(e,t){return e.filter(function(n){return t.includes(n)})}const Hg={__depends__:[Ng,VC,Tn],bpmnReplace:["type",jg]};var YC=250;function Rr(e){this._eventBus=e,this._tools=[],this._active=null}Rr.$inject=["eventBus"],Rr.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)},Rr.prototype.isActive=function(e){return e&&this._active===e},Rr.prototype.length=function(e){return this._tools.length},Rr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Rr.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),M(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,YC,function(r){this._active&&(KC(r)||this.setActive(null))},this)};function KC(e){var t=e.originalEvent&&e.originalEvent.target;return t&&gr(t,'.group[data-group="tools"]')}const Vs={__depends__:[yi],__init__:["toolManager"],toolManager:["type",Rr]};function XC(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 ZC(e,t){var n=[],i=new Set(e);M(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;M(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 QC(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 ip=Math.abs,JC=Math.round,_i={x:"width",y:"height"},zg="crosshair",qi={n:"top",w:"left",s:"bottom",e:"right"},eP=1500,Gs={n:"s",w:"e",s:"n",e:"w"},Ws=20;function Mn(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",eP,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&Gg(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){Gg(c);var m={x:0,y:0};m[l]=JC(c["d"+l]),s.makeSpace(f,d,m,p,h),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Mn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Mn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:zg,data:{context:{reactivate:n}},trapClick:!1})},Mn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:zg,data:{context:{}}})},Mn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Mn.prototype.init=function(e,t){var n=ip(e.dx)>ip(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(ip(i)<5)return!1;i<0&&(i*=-1),Yo(e)&&(i*=-1);var o=XC(n,i),a=this._canvas.getRootElement();!Ds(e)&&e.hover&&(a=e.hover);var s=[...Do(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=tP(c,n,o,r,u);return D(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),Fs("resize-"+(n==="x"?"ew":"ns")),!0},Mn.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 M(e,function(d){if(!(!d.parent||be(d))){if(Ve(d)){l.push(d);return}var h=d[t],m=h+d[_i[t]];if(nP(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}}}),M(o,function(d){var h=d.attachers;h&&M(h,function(m){p(m)})}),M(u,function(d){var h=d.host;(s.has(h)||c.has(h))&&p(d)}),M(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}},Mn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Mn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Vg(e){return{top:e.top-Ws,right:e.right+Ws,bottom:e.bottom+Ws,left:e.left-Ws}}function Gg(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;he(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),he(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),he(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),he(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function tP(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 M(a,function(f){var d=f.attachers,h=f.children,m=ue(f),g=we(h,function(H){return!Ve(H)&&!be(H)&&!l.has(H)&&!p.has(H)}),S=we(h,function(H){return!Ve(H)&&!be(H)&&l.has(H)}),E,b,x,w=[],A=[],I,P,j,F;g.length&&(b=Vg(ue(pt(g))),E=i-m[qi[n]]+b[qi[n]],n==="n"?s.bottom=u=he(u)?Math.min(u,E):E:n==="w"?s.right=u=he(u)?Math.min(u,E):E:n==="s"?s.top=c=he(c)?Math.max(c,E):E:n==="e"&&(s.left=c=he(c)?Math.max(c,E):E)),S.length&&(x=Vg(ue(pt(S))),E=i-x[qi[Gs[n]]]+m[qi[Gs[n]]],n==="n"?s.bottom=u=he(u)?Math.min(u,E):E:n==="w"?s.right=u=he(u)?Math.min(u,E):E:n==="s"?s.top=c=he(c)?Math.max(c,E):E:n==="e"&&(s.left=c=he(c)?Math.max(c,E):E)),d&&d.length&&(d.forEach(function(H){l.has(H)?w.push(H):A.push(H)}),w.length&&(I=ue(pt(w.map(fe))),P=m[qi[Gs[n]]]-(I[qi[Gs[n]]]-i)),A.length&&(j=ue(pt(A.map(fe))),F=j[qi[n]]-(m[qi[n]]-i)),n==="n"?(E=Math.min(P||1/0,F||1/0),s.bottom=u=he(u)?Math.min(u,E):E):n==="w"?(E=Math.min(P||1/0,F||1/0),s.right=u=he(u)?Math.min(u,E):E):n==="s"?(E=Math.max(P||-1/0,F||-1/0),s.top=c=he(c)?Math.max(c,E):E):n==="e"&&(E=Math.max(P||-1/0,F||-1/0),s.left=c=he(c)?Math.max(c,E):E));var L=r&&r[f.id];L&&(n==="n"?(E=i+f[_i[t]]-L[_i[t]],s.bottom=u=he(u)?Math.min(u,E):E):n==="w"?(E=i+f[_i[t]]-L[_i[t]],s.right=u=he(u)?Math.min(u,E):E):n==="s"?(E=i-f[_i[t]]+L[_i[t]],s.top=c=he(c)?Math.max(c,E):E):n==="e"&&(E=i-f[_i[t]]+L[_i[t]],s.left=c=he(c)?Math.max(c,E):E))}),s}}function nP(e){return!!e.host}var rp="djs-dragging",Wg="djs-resizing",iP=250,Us=Math.max;function Ug(e,t,n,i,r){function o(a,s){M(a,function(c){r.addDragger(c,s),n.addMarker(c,rp)})}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=ae("g");te(l,i.cls("djs-crosshair-group",["no-events"])),ve(s,l);var p=ae("path");te(p,"d",u.x),Ce(p).add("djs-crosshair"),ve(l,p);var f=ae("path");te(f,"d",u.y),Ce(f).add("djs-crosshair"),ve(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;Nt(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&wt(c)}),e.on("spaceTool.move",iP,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=ae("path"),te(c,"d","M0,0 L0,0"),Ce(c).add("djs-crosshair"),ve(f,c),s.line=c;var d=ae("g");te(d,i.cls("djs-drag-group",["no-events"])),ve(n.getActiveLayer(),d),o(l,d);var h=new Set(l);M(p,function(A){h.add(A)});var m=new Set,g=s.movingConnections=[];h.forEach(function(A){M(A.outgoing,function(I){m.has(I)||!Ve(I)||!h.has(I.target)||(m.add(I),g.push(I))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var S=ae("g");te(S,i.cls("djs-frame-group",["no-events"])),ve(n.getActiveLayer(),S);var E=[];M(p,function(A){var I=r.addFrame(A,S),P=I.getBBox();E.push({element:I,initialBounds:P}),n.addMarker(A,Wg)}),s.frameGroup=S,s.frames=E}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};te(c,{d:b[u]});var x={x:"y",y:"x"},w={x:a.dx,y:a.dy};w[x[s.axis]]=0,Nt(s.dragGroup,w.x,w.y),M(s.frames,function(A){var I=A.element,P=A.initialBounds,j,F;s.direction==="e"?te(I,{width:Us(P.width+w.x,5)}):(j=Us(P.width-w.x,5),te(I,{width:j,x:P.x+P.width-j})),s.direction==="s"?te(I,{height:Us(P.height+w.y,5)}):(F=Us(P.height-w.y,5),te(I,{height:F,y:P.y+P.height-F}))})}}),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;M(c,function(h){n.removeMarker(h,rp)}),M(u,function(h){n.removeMarker(h,rp)}),f&&(wt(p),wt(f)),M(l,function(h){n.removeMarker(h,Wg)}),d&&wt(d)})}Ug.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const rP={__init__:["spaceToolPreview"],__depends__:[yi,ti,Vs,so,Zo],spaceTool:["type",Mn],spaceToolPreview:["type",Ug]};function qs(e,t){e.invoke(Mn,this),this._canvas=t}qs.$inject=["injector","canvas"],ee(qs,Mn),qs.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Br(Vr(r.children.filter(u=>y(u,"bpmn:Artifact")),pt(o))));const s=[...e,...a];var c=Mn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(y(u,"bpmn:TextAnnotation")||oP(u)&&(t==="y"&&kt(u)||t==="x"&&!kt(u)))}),c};function oP(e){return y(e,"bpmn:Participant")&&!U(e).processRef}const qg={__depends__:[rP],spaceTool:["type",qs]};function nt(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)}nt.$inject=["eventBus","injector"],nt.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()},nt.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},nt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},nt.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()}},nt.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()}},nt.prototype.register=function(e,t){this._setHandler(e,t)},nt.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)},nt.prototype.canUndo=function(){return!!this._getUndoAction()},nt.prototype.canRedo=function(){return!!this._getRedoAction()},nt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},nt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},nt.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)})},nt.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},nt.prototype._createId=function(){return this._uid++},nt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},nt.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()},nt.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)},nt.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:Cf("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},nt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=pe(e)?e:[e],t.dirty=t.dirty.concat(e))},nt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},nt.prototype._revertedAction=function(e){this._stackIdx--},nt.prototype._getHandler=function(e){return this._handlerMap[e]},nt.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 aP={commandStack:["type",nt]};function Yi(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 sP=250,Yg=1400;function op(e,t,n){W.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Yg,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=Kg(a),o.validatedShapes=Kg(s)}),i&&t.on("shape.move.start",sP,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",Yg,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];M(s,function(u){M(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;Yi(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=$u(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&&(ct(s.labels,a,c),a.labelTarget=s)})}ee(op,W),op.$inject=["injector","eventBus","modeling"];function Kg(e){var t=new Set(e);return we(e,function(n){return!t.has(n.labelTarget)})}const cP={__init__:["labelSupport"],labelSupport:["type",op]};var uP=251,Xg=1401,Zg="attach-ok";function ap(e,t,n,i,r){W.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Xg,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=lP(c),s.validatedShapes=pP(u)}),o&&t.on("shape.move.start",uP,function(a){var s=a.context,c=s.shapes,u=sp(c);M(u,function(l){o.makeDraggable(s,l,!0),M(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,Zg),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,Zg)}))}}),this.preExecuted("elements.move",Xg,function(a){var s=a.context,c=s.closure,u=s.shapes,l=sp(u);M(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=we(c,function(p){var f=p.host;return fP(p)&&!dP(c,f)}),M(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;M(s,function(c){M(c.attachers,function(u){M(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),M(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;Yi(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&&M(u.attachers,function(l){var p=mm(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&&M(p,function(d){var h=mm(d,u,l);r.moveShape(d,h,d.parent),M(d.labels,function(m){r.moveShape(m,h,m.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Yi(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}ee(ap,W),ap.$inject=["injector","eventBus","canvas","rules","modeling"];function sp(e){return iu(Ht(e,function(t){return t.attachers||[]}))}function lP(e){var t=sp(e);return u0("id",e,t)}function pP(e){var t=$r(e,"id");return we(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function fP(e){return!!e.host}function dP(e,t){return e.indexOf(t)!==-1}const hP={__depends__:[ti],__init__:["attachSupport"],attachSupport:["type",ap]};function Qg(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(Gd(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)})}Qg.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const cp={__init__:["changeSupport"],changeSupport:["type",Qg]};function kn(e){this._model=e}kn.$inject=["moddle"],kn.prototype._needsId=function(e){return Ee(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"])},kn.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":Ee(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))},kn.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},kn.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},kn.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",D({bpmnElement:e,bounds:this.createDiBounds()},t))},kn.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},kn.prototype.createDiWaypoints=function(e){var t=this;return Ht(e,function(n){return t.createDiWaypoint(n)})},kn.prototype.createDiWaypoint=function(e){return this.create("dc:Point",jn(e,["x","y"]))},kn.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",D({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},kn.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",D({bpmnElement:e},t))};function dn(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"],hn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],hn(a));function s(d){var h=d.context,m=h.oldRoot,g=m.children;M(g,function(S){y(S,"bpmn:BaseElement")&&i.updateParent(S)})}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"],hn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],hn(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"],hn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],hn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],hn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],hn(l)),this.executed("connection.reconnect",hn(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=U(m),b=U(g),x=U(S);E.conditionExpression&&!Ee(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(h.oldConditionExpression=E.conditionExpression,delete E.conditionExpression),g!==S&&b.default===E&&(h.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",hn(function(d){var h=d.context,m=h.connection,g=h.oldSource,S=h.newSource,E=U(m),b=U(g),x=U(S);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"],hn(p)),this.reverted(["element.updateAttachment"],hn(p)),this.executed("element.updateLabel",hn(f)),this.reverted("element.updateLabel",hn(f));function f(d){const{element:h}=d.context,m=xn(h),g=Me(h),S=g&&g.get("label");Hi(h)||Os(h)||(m&&!S?g.set("label",t.create("bpmndi:BPMNLabel")):!m&&S&&g.set("label",void 0))}}ee(dn,W),dn.$inject=["eventBus","bpmnFactory","connectionDocking"],dn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},dn.prototype.updateParent=function(e,t){if(!be(e)&&!(y(e,"bpmn:DataStoreReference")&&e.parent&&y(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Me(e),o=n&&n.businessObject,a=Me(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)}},dn.prototype.updateBounds=function(e){var t=Me(e),n=gP(e);if(n){var i=Hn(n,t.get("bounds"));D(n,{x:e.x+i.x,y:e.y+i.y})}var r=be(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),D(o,{x:e.x,y:e.y,width:e.width,height:e.height})},dn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;y(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),at(i,e)),y(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),ct(r,e))}},dn.prototype.updateDiConnection=function(e,t,n){var i=Me(e),r=Me(t),o=Me(n);i.sourceElement&&i.sourceElement.bpmnElement!==U(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==U(n)&&(i.targetElement=n&&o)},dn.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):(at(n,e),e.$parent=null)}};function mP(e){for(;e&&!y(e,"bpmn:Definitions");)e=e.$parent;return e}dn.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)},dn.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=mP(e.$parent||t),e.$parent&&(at(o.get("rootElements"),r),r.$parent=null),t&&(ct(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),at(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);at(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},dn.prototype.updateConnectionWaypoints=function(e){var t=Me(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},dn.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&&(at(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(at(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)},dn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function hn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;y(i,"bpmn:BaseElement")&&e(t)}}function gP(e){if(y(e,"bpmn:Activity")){var t=Me(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Ki(e,t){hi.call(this),this._bpmnFactory=e,this._moddle=t}ee(Ki,hi),Ki.$inject=["bpmnFactory","moddle"],Ki.prototype._baseCreate=hi.prototype.create,Ki.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,D({type:"label",di:n},br,t))}return this.createElement(e,t)},Ki.prototype.createElement=function(e,t){t=D({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!yP(r)){var o=D({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}y(i,"bpmn:Group")&&(t=D({isFrame:!0},t)),t=vP(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=up(r,t,"isExpanded")),Ee(i,["bpmn:Lane","bpmn:Participant"])&&(t=up(r,t,"isHorizontal")),y(i,"bpmn:SubProcess")&&(t.collapsed=!Re(i,r)),y(i,"bpmn:ExclusiveGateway")&&(an(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),xt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),xt(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=D({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},Ki.prototype.getDefaultSize=function(e,t){var n=U(e);if(t=t||Me(e),y(n,"bpmn:SubProcess"))return Re(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 Re(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}},Ki.prototype.createParticipantShape=function(e){return At(e)||(e={isExpanded:e}),e=D({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function vP(e,t,n){return M(n,function(i){t=up(e,t,i)}),t}function up(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Wn(t,[n]))}function yP(e){return Ee(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Ys(e,t){this._modeling=e,this._canvas=t}Ys.$inject=["modeling","canvas"],Ys.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;M(n,function(r){var o={x:0,y:0};xt(i.left)?o.x=i.left-r.x:xt(i.right)?o.x=i.right-r.width-r.x:xt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:xt(i.top)?o.y=i.top-r.y:xt(i.bottom)?o.y=i.bottom-r.height-r.y:xt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Ys.prototype.postExecute=function(e){};function Ks(e){this._modeling=e}Ks.$inject=["modeling"],Ks.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},Ks.prototype.postExecute=function(e){var t=e.hints||{};_P(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 _P(e,t){return Pi(e.outgoing,function(n){return n.target===t})}function Xs(e,t){this._canvas=e,this._layouter=t}Xs.$inject=["canvas","layouter"],Xs.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},Xs.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Zs=Math.round;function lp(e){this._modeling=e}lp.$inject=["modeling"],lp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;M(t,function(p){he(p.x)||(p.x=0),he(p.y)||(p.y=0)});var s=we(t,function(p){return!p.hidden}),c=pt(s);M(t,function(p){Ve(p)&&(p.waypoints=Ht(p.waypoints,function(f){return{x:Zs(f.x-c.x-c.width/2+r.x),y:Zs(f.y-c.y-c.height/2+r.y)}})),D(p,{x:Zs(p.x-c.x-c.width/2+r.x),y:Zs(p.y-c.y-c.height/2+r.y)})});var u=new Set(Ja(t)),l={};M(t,function(p){if(Ve(p)){l[p.id]=he(i)?a.createConnection(l[p.source.id],l[p.target.id],i,p,p.parent||n,o):a.createConnection(l[p.source.id],l[p.target.id],p,p.parent||n,o);return}var f=D({},o);u.has(p)||(f.autoResize=!1),be(p)&&(f=Wn(f,["attach"])),l[p.id]=he(i)?a.createShape(p,jn(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,jn(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=Br(l)};var Jg=Math.round;function Xi(e){this._canvas=e}Xi.$inject=["canvas"],Xi.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?D(t,n):D(t,{x:n.x-Jg(t.width/2),y:n.y-Jg(t.height/2)}),this._canvas.addShape(t,i,r),t},Xi.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Jo(e){Xi.call(this,e)}ee(Jo,Xi),Jo.$inject=["canvas"];var bP=Xi.prototype.execute;Jo.prototype.execute=function(e){var t=e.shape;return EP(t),t.labelTarget=e.labelTarget,bP.call(this,e)};var xP=Xi.prototype.revert;Jo.prototype.revert=function(e){return e.shape.labelTarget=null,xP.call(this,e)};function EP(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function ea(e,t){this._canvas=e,this._modeling=t}ea.$inject=["canvas","modeling"],ea.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Yi(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Yi(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},ea.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=$u(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},ea.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,ct(n.children,t,i),this._canvas.addConnection(t,n),t};function pp(e,t){this._modeling=e,this._elementRegistry=t}pp.$inject=["modeling","elementRegistry"],pp.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;M(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};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.shape;Yi(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Yi(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Yi(n.children,function(i){Ve(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},ta.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=$u(i.children,n),t.removeShape(n),n},ta.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return ct(i.children,n,r),t.addShape(n,i),n};function Qs(e){this._modeling=e}Qs.$inject=["modeling"];var ev={x:"y",y:"x"};Qs.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,S){g.range.min=Math.min(S[i],g.range.min),g.range.max=Math.max(S[i]+S[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,S){var E={y:0};E[i]=g-a(S),E[i]&&(E[ev[i]]=0,t.moveElements([S],E,S.parent))}var l=n[0],p=s(n),f=n[p],d,h,m=0;M(n,function(g,S){var E,b,x;if(g.elements.length<2){S&&S!==n.length-1&&(o(g,g.elements[0]),m+=c(g.range));return}E=Gn(g.elements,i),b=E[0],S===p&&(b=E[s(E)]),x=a(b),g.range=null,M(E,function(w){if(u(x,w),g.range===null){g.range={min:w[i],max:w[i]+w[r]};return}o(g,w)}),S&&S!==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)&&M(n,function(g,S){var E={},b;g===l||g===f||(b=n[S-1],g.range.max=0,M(g.elements,function(x,w){E[ev[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],w?g.range.max:0)}))})},Qs.prototype.postExecute=function(e){};function Js(e,t){this._layouter=e,this._canvas=t}Js.$inject=["layouter","canvas"],Js.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return D(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Js.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function fp(){}fp.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=at(o.children,t),ct(i.children,t,r),t.parent=i,M(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},fp.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return at(n.children,t),ct(i.children,t,r),t.parent=i,M(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 dp(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}dp.prototype.add=function(e,t){return this.addAll([e],t)},dp.prototype.addAll=function(e,t){var n=QE(e,!!t,this);return D(this,n),this};function na(e){this._modeling=e}na.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},na.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),M(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),M(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&&bl(p,p.source,t),connectionEnd:d&&xl(p,p.target,t)})})},na.prototype.getClosure=function(e){return new dp().addAll(e,!0)};function ec(e){this._helper=new na(e)}ec.$inject=["modeling"],ec.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},ec.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 Cr(e){this._modeling=e,this._helper=new na(e)}Cr.$inject=["modeling"],Cr.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=jn(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=at(o.children,t),ct(i.children,t,r),D(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Cr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(M(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:xl(o,t,n)})}),M(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:bl(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Cr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return ct(n.children,t,i),D(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Cr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Cr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function ia(e){this._modeling=e}ia.$inject=["modeling"],ia.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},ia.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||tv(pe(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||tv(pe(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},ia.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 tv(e){return e.original||e}function bi(e,t){this._modeling=e,this._rules=t}bi.$inject=["modeling","rules"],bi.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(h,m,g){return i.allowed("connection.reconnect",{connection:g,source:h,target:m})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var p;a.moveChildren!==!1&&(p=r.children.slice(),n.moveElements(p,{x:0,y:0},s,a));var f=r.incoming.slice(),d=r.outgoing.slice();M(f,function(h){var m=h.source,g=c(m,s,h);g&&t.reconnectEnd(h,s,Ps(h,s,l),a)}),M(d,function(h){var m=h.target,g=c(s,m,h);g&&t.reconnectStart(h,s,Cs(h,s,l),a)})},bi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},bi.prototype.execute=function(e){},bi.prototype.revert=function(e){},bi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},bi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},bi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function ra(e){this._modeling=e}ra.$inject=["modeling"],ra.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ra.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(M(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Ps(o,n,i)})}),M(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Cs(o,n,i)})}))},ra.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return D(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Zi(e){this._modeling=e}Zi.$inject=["modeling"],Zi.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),M(r,function(s){a[s.id]=SP(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(ZC(i,r),t,n,o,i,r,a)},Zi.prototype.execute=function(){},Zi.prototype.revert=function(){},Zi.prototype.moveShapes=function(e,t){var n=this;M(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Zi.prototype.resizeShapes=function(e,t,n){var i=this;M(e,function(r){var o=QC(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Zi.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);M(e,function(l){var p=l.source,f=l.target,d=wP(l),h=iv(n),m={},g=c.has(p)||u.has(p),S=c.has(f)||u.has(f);g&&S?(d=Ht(d,function(E){return rv(E,i,n)&&(E[h]=E[h]+t[h]),E.original&&rv(E.original,i,n)&&(E.original[h]=E.original[h]+t[h]),E}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||S)&&(c.has(p)?m.connectionStart=bl(l,p,t):c.has(f)?m.connectionEnd=xl(l,f,t):u.has(p)?m.connectionStart=Cs(l,p,a[p.id]):u.has(f)&&(m.connectionEnd=Ps(l,f,a[f.id])),s._modeling.layoutConnection(l,m))})};function nv(e){return D({},e)}function wP(e){return Ht(e.waypoints,function(t){return t=nv(t),t.original&&(t.original=nv(t.original)),t})}function iv(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function rv(e,t,n){var i=iv(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function SP(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function tc(e){this._modeling=e}tc.$inject=["modeling"],tc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=ov(n),t.collapsed=!t.collapsed;var i=av(n,t.collapsed);return[t].concat(i)},tc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=sv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function ov(e){var t={};return M(e,function(n){t[n.id]=n.hidden,n.children&&(t=D({},t,ov(n.children)))}),t}function av(e,t){var n=[];return M(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(av(i.children,i.collapsed||t)))}),n}function sv(e,t){var n=[];return M(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(sv(i.children,t)))}),n}function nc(e){this._modeling=e}nc.$inject=["modeling"],nc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=cv(i,t),uv(n,t),t.host=n,t},nc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,cv(n,t),uv(i,t,r),t};function cv(e,t){return at(e&&e.attachers,t)}function uv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),ct(i,t,n)}}function hp(){}hp.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},hp.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Ge(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Ge.$inject=["eventBus","elementFactory","commandStack"],Ge.prototype.getHandlers=function(){return{"shape.append":Ks,"shape.create":Xi,"shape.delete":ta,"shape.move":Cr,"shape.resize":ra,"shape.replace":bi,"shape.toggleCollapse":tc,spaceTool:Zi,"label.create":Jo,"connection.create":Xs,"connection.delete":ea,"connection.move":fp,"connection.layout":Js,"connection.updateWaypoints":hp,"connection.reconnect":ia,"elements.create":lp,"elements.move":ec,"elements.delete":pp,"elements.distribute":Qs,"elements.align":Ys,"element.updateAttachment":nc}},Ge.prototype.registerHandlers=function(e){M(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Ge.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)},Ge.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Ge.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)},Ge.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)},Ge.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Ge.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},Ge.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},Ge.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},Ge.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},Ge.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},Ge.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Ge.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Ge.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Ge.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Ge.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Ge.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Ge.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Ge.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)},Ge.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Ge.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)},Ge.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,D(i,{docking:"source"}))},Ge.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,D(i,{docking:"target"}))},Ge.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Ge.prototype._create=function(e,t){return Bw(t)?t:this._elementFactory.create(e,t)},Ge.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function oa(e){this._elementRegistry=e}oa.$inject=["elementRegistry"],oa.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||RP(n,ka(i));return lv(n,i),e.oldProperties=o,e.changed=r,r},oa.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return lv(n,t),i},oa.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return y(e,"bpmn:DataObject")?CP(e,t):[]};function RP(e,t){return sn(t,function(n,i){return n[i]=e.get(i),n},{})}function lv(e,t){M(t,function(n,i){e.set(i,n)})}function CP(e,t){return t.filter(function(n){return y(n,"bpmn:DataObjectReference")&&U(n).dataObjectRef===e})}var aa="default",xi="id",pv="di",PP={width:0,height:0};function sa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}sa.$inject=["elementRegistry","moddle","modeling","textRenderer"],sa.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=DP(e.properties),s=e.oldProperties||AP(t,a);return fv(a,o)&&(r.unclaim(o[xi]),i.updateId(t,a[xi]),r.claim(a[xi],o)),aa in a&&(a[aa]&&n.push(i.get(a[aa].id)),o[aa]&&n.push(i.get(o[aa].id))),dv(t,a),e.oldProperties=s,e.changed=n,n},sa.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,PP)}},sa.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 dv(t,i),fv(n,r)&&(a.unclaim(n[xi]),o.updateId(t,i[xi]),a.claim(i[xi],r)),e.changed};function fv(e,t){return xi in e&&e[xi]!==t[xi]}function AP(e,t){var n=ka(t),i=e.businessObject,r=Me(e);return sn(n,function(o,a){return a!==pv?o[a]=i.get(a):o[a]=TP(r,ka(t.di)),o},{})}function TP(e,t){return sn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function dv(e,t){var n=e.businessObject,i=Me(e);M(t,function(r,o){o!==pv?n.set(o,r):i&&MP(i,r)})}function MP(e,t){M(t,function(n,i){e.set(i,n)})}var kP=["default"];function DP(e){var t=D({},e);return kP.forEach(function(n){n in e&&(t[n]=U(t[n]))}),t}function ic(e,t){this._canvas=e,this._modeling=t}ic.$inject=["canvas","modeling"],ic.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Me(r);return t.setRootElement(n),t.removeRootElement(r),ct(a.rootElements,i),i.$parent=a,at(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},ic.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Me(n);return t.setRootElement(r),t.removeRootElement(n),at(a.rootElements,i),i.$parent=null,ct(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function mp(e,t){this._modeling=e,this._spaceTool=t}mp.$inject=["modeling","spaceTool"],mp.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Pn(i),a=o===i,s=a?i:i.parent,c=Vi(s),u=kt(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+Cn,y:i.y,width:i.width-Cn,height:i.height}:{x:i.x,y:i.y+Cn,width:i.width,height:i.height-Cn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];yr(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:we(x.children,function(w){return w!==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 S=t.calculateAdjustments(p,g,f,h),E=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(S.movingShapes,S.resizingShapes,E,m,h);var b=u?{x:i.x+(a?Cn:0),y:d-(r==="top"?120:0),width:i.width-(a?Cn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Cn:0),width:120,height:i.height-(a?Cn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function gp(e){this._modeling=e}gp.$inject=["modeling"],gp.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Vi(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=kt(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+Cn,y:n.y+f*c,width:n.width-Cn,height:u}:{x:n.x+f*c,y:n.y+Cn,width:u,height:n.height-Cn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function ca(e,t){this._modeling=e,this._spaceTool=t}ca.$inject=["modeling","spaceTool"],ca.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},ca.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=CS(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},ca.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=ue(e),r=ue(t),o=Wh(r,i),a=Pn(e),s=[],c=[];yr(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 ua="flowNodeRef",vp="lanes";function rc(){}rc.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=Pn(l);return r[p.id]||(r[p.id]=xs(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=Pn(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(vp),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(ua).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},rc.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(vp);n.remove.forEach(function(o){at(r,o),at(o.get(ua),i)}),n.add.forEach(function(o){ct(r,o),ct(o.get(ua),i)})}),[]},rc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(vp);n.add.forEach(function(o){at(r,o),at(o.get(ua),i)}),n.remove.forEach(function(o){ct(r,o),ct(o.get(ua),i)})}),[]};var yp="categoryValueRef";function la(e,t){this._bpmnFactory=e,this._elementRegistry=t}la.$inject=["bpmnFactory","elementRegistry"],la.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 w=a.get(E);w||(w={},a.set(E,w)),!(x&&w.present)&&(!x&&w.past||(x?w.present={categoryValue:b,root:_p(E)}:w.past={categoryValue:b}))}}function c(E){r.set(E,U(E))}function u(){n.filter(function(E){return y(E,"bpmn:FlowElement")&&!be(E)&&E.parent}).forEach(c)}function l(E){var b=U(E),x=b.get("categoryValueRef");return x||(x=Fh(i,b),o.push(OP(E,x))),x}function p(E){return E.reduce(function(b,x){var w=_p(x),A=b.get(w);return A||(A=[],b.set(w,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")&&!be(E)&&E.parent}).forEach(function(E){var b=U(E).get("categoryValueRef");if(!b){var x=_p(E),w=f.get(x)||[],A=Vr(w,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 w=g.get(x.root)||[],A=Vr(w,b);w.forEach(function(I){if(A[I.id]){var P=m.get(I);P||(P=new Set,m.set(I,P)),P.add(x.categoryValue)}})}});var S=d.reduce(function(E,b){var x=r.get(b),w=x.get(yp),A=new Set(w),I=m.get(b)||new Set,P=Array.from(I).filter(function(F){return!A.has(F)}),j=w.filter(function(F){return h.has(F)&&!I.has(F)});return(P.length||j.length)&&E.push({businessObject:x,categoryValuesToAdd:P,categoryValuesToRemove:j}),E},[]);return{flowElements:S,groups:o}},la.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),IP(t.groups),NP(t.flowElements),[]},la.prototype.revert=function(e){var t=e.updates;return BP(t.flowElements),LP(t.groups),[]};function OP(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function IP(e){e.forEach(function(t){U(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function LP(e){e.forEach(function(t){U(t.groupShape).categoryValueRef=null})}function NP(e){e.forEach(function(t){var n=t.businessObject,i=n.get(yp);t.categoryValuesToRemove.forEach(function(r){at(i,r)}),t.categoryValuesToAdd.forEach(function(r){ct(i,r,!0)})})}function BP(e){e.forEach(function(t){var n=t.businessObject,i=n.get(yp);t.categoryValuesToAdd.forEach(function(r){at(i,r)}),t.categoryValuesToRemove.forEach(function(r){ct(i,r,!0)})})}function _p(e){for(;e.parent;)e=e.parent;return e}function oc(e){this._moddle=e}oc.$inject=["moddle"],oc.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),[]},oc.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 $P={fill:void 0,stroke:void 0};function bp(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(on(t)){var n=jP(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}bp.$inject=["commandStack"],bp.prototype.postExecute=function(e){var t=e.elements,n=e.colors||$P,i=this,r={};"fill"in n&&D(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&D(r,{"border-color":this._normalizeColor(n.stroke)}),M(t,function(o){var a=Ve(o)?jn(r,["border-color"]):r,s=Me(o);if(FP(a),be(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(!Ee(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function jP(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 FP(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var HP={width:0,height:0};function hv(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return m1(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!be(u)&&Hi(u)&&!cs(u)&&!mv(p)){var f=7,d=Gu(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=xn(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(!(!be(l)&&!y(l,"bpmn:TextAnnotation"))){if(be(l)&&mv(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var h=xn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,h)),f&&e.resizeShape(l,f,HP)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}hv.$inject=["modeling","textRenderer","bpmnFactory"];function mv(e){return!e||!e.trim()}function $t(e,t,n,i){Ge.call(this,e,t,n),this._bpmnRules=i}ee($t,Ge),$t.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],$t.prototype.getHandlers=function(){var e=Ge.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=oa,e["element.updateProperties"]=sa,e["canvas.updateRoot"]=ic,e["lane.add"]=mp,e["lane.resize"]=ca,e["lane.split"]=gp,e["lane.updateRefs"]=rc,e["group.updateRefs"]=la,e["id.updateClaim"]=oc,e["element.setColor"]=bp,e["element.updateLabel"]=hv,e},$t.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},$t.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)},$t.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},$t.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},$t.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},$t.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},$t.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},$t.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},$t.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},$t.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},$t.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},$t.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},$t.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},$t.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function gv(){}gv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||fe(t.source||e.source),t.connectionEnd||fe(t.target||e.target)]};var ac=20,zP=5,sc=Math.round,vv=20,VP={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function GP(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function WP(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function yv(e,t,n){var i=Lt(t,e,zP),r=n.split(":")[0],o=sc((t.x-e.x)/2+e.x),a=sc((t.y-e.y)/2+e.y),s,c,u=WP(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=GP(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+ac*(/l/.test(r)?-1:1),y:f?a+ac:a}):(f=o===e.x,s={x:f?o+ac:o,y:e.y+ac*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:xp(e,s,c).concat(s),directions:c,turnNextDirections:f}}function UP(e,t,n){return yv(e,t,n)}function qP(e,t,n){var i=yv(t,e,_v(n));return{waypoints:i.waypoints.slice().reverse(),directions:_v(i.directions),turnNextDirections:i.turnNextDirections}}function YP(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=xp(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function _v(e){return e.split(":").reverse().join(":")}function KP(e,t,n){var i=sc((t.x-e.x)/2+e.x),r=sc((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 xp(e,t,n){if(n=n||"h:h",!rA(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(xv(n)){var i=UP(e,t,n),r=qP(e,t,n),o=YP(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return KP(e,t,n)}function XP(e,t,n){var i=xp(e,t,n);return i.unshift(e),i.push(t),wv(i)}function ZP(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=s0(o,"straight")[0]||"h:h",s=VP[a]||0,c=Lt(e,t,s),u=iA(c,a);n=n||fe(e),i=i||fe(t);var l=u.split(":"),p=Ev(n,e,l[0],oA(c)),f=Ev(i,t,l[1],c);return XP(p,f,u)}function QP(e,t,n,i,r,o){pe(n)&&(r=n,o=i,n=fe(e),i=fe(t)),o=D({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&eA(e,t,n,i,o),c||(c=o.connectionEnd&&nA(t,e,i,r),c)||(c=o.connectionStart&&tA(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:ZP(e,t,n,i,o)}function JP(e,t,n){return e>=t&&e<=n}function bv(e,t,n){var i={x:"width",y:"height"};return JP(t[e],n[e],n[e]+n[i[e]])}function eA(e,t,n,i,r){var o={},a,s;return s=Lt(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 tA(e,t,n,i){return Ep(e,t,n,i)}function nA(e,t,n,i){var r=i.slice().reverse();return r=Ep(e,t,n,r),r?r.reverse():null}function Ep(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!qe(l,function(p,f){var d=l[f-1];return d&&Io(p,d)<3})}function o(l,p,f){var d=fi(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(Ud(l[d],p,vv)||Ud(l[d],f,vv))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=Ep(e,t,n,u)),c&&fi(c)?null:c}function iA(e,t){if(xv(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 rA(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function xv(e){return e&&/t|r|b|l/.test(e)}function oA(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 Ev(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 wv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return ju(r,o,n,0)||t.push(n),t},[])}var aA=-10,sA=40,cA={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},uA={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},wp={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},pa={top:"t",right:"r",bottom:"b",left:"l"};function cc(e){this._elementRegistry=e}ee(cc,gv),cc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=Sv(r&&r[0],n)),a||(a=Sv(r&&r[r.length-1],i)),(y(e,"bpmn:Association")||y(e,"bpmn:DataAssociation"))&&r&&!Rv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Nh(n,s)?cA:uA;return y(e,"bpmn:MessageFlow")?c=pA(n,i,l):(y(e,"bpmn:SequenceFlow")||Rv(n,i))&&(n===i?c={preferredLayouts:vA(n,e,l)}:y(n,"bpmn:BoundaryEvent")?c={preferredLayouts:yA(n,i,a,l)}:fa(n)||fa(i)?c={preferredLayouts:l.subProcess,preserveDocking:dA(n)}:y(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:y(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=D(c,t),u=wv(QP(n,i,o,a,r,c))),u||[o,a]};function lA(e){var t=e.host;return Lt(fe(e),t,aA)}function pA(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:fA(e,t)}}function fA(e,t){return y(t,"bpmn:Participant")?"source":y(e,"bpmn:Participant")?"target":fa(t)?"source":fa(e)||y(t,"bpmn:Event")?"target":y(e,"bpmn:Event")?"source":null}function dA(e){return fa(e)?"target":"source"}function Sv(e,t){return e?e.original||e:fe(t)}function Rv(e,t){return y(t,"bpmn:Activity")&&y(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function fa(e){return y(e,"bpmn:SubProcess")&&Re(e)}function Pr(e,t){return e===t}function hA(e,t){return t.indexOf(e)!==-1}function co(e){var t=/right|left/.exec(e);return t&&t[0]}function uo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Cv(e,t){return wp[e]===t}function mA(e,t){var n=co(e),i=wp[n];return t.indexOf(i)!==-1}function gA(e,t){var n=uo(e),i=wp[n];return t.indexOf(i)!==-1}function Pv(e){return e==="right"||e==="left"}function vA(e,t,n){var i=t.waypoints,r=i&&i.length&&Lt(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function yA(e,t,n,i){var r=fe(e),o=fe(t),a=lA(e),s,c,u=Pr(e.host,t),l=hA(a,["top","right","bottom","left"]),p=Lt(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?_A(a,l,e,t,n,i):(s=bA(a,p,l,i.isHorizontal),c=xA(a,p,l,i.isHorizontal),[s+":"+c])}function _A(e,t,n,i,r,o){var a=t?e:o.isHorizontal?uo(e):co(e),s=pa[a],c;return t?Pv(e)?c=Av("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Av("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Av(e,t,n,i){var r=sA;return!(Sp(e,i,n,r)||Sp(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Sp(e,i,fe(t),r))}function Sp(e,t,n,i){return Math.abs(t[e]-n[e])<i}function bA(e,t,n,i){if(n)return pa[e];var r=uo(e),o=co(e),a=uo(t),s=co(t);if(i){if(Pr(r,a)||Cv(o,s))return pa[r]}else if(Pr(o,s)||Cv(r,a))return pa[o];return pa[i?o:r]}function xA(e,t,n,i){if(n)return Pv(e)?mA(e,t)||Pr(e,t)?"h":"v":gA(e,t)||Pr(e,t)?"v":"h";var r=uo(e),o=co(e),a=uo(t),s=co(t);return a&&!s?"v":s&&!a?"h":i?Pr(r,a)?"h":"v":Pr(o,s)?"v":"h"}cc.$inject=["elementRegistry"];function Tv(e){return D({original:e.point.original||e.point},e.actual)}function Qi(e,t){this._elementRegistry=e,this._graphicsFactory=t}Qi.$inject=["elementRegistry","graphicsFactory"],Qi.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(Tv(i)),o.push(Tv(r)),o},Qi.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}},Qi.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Lo(i,r,n)},Qi.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Qi.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Qi.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Rp={__init__:["modeling","bpmnUpdater"],__depends__:[FR,nC,rC,oC,Hg,aP,cP,hP,Tn,cp,qg],bpmnFactory:["type",kn],bpmnUpdater:["type",dn],elementFactory:["type",Ki],modeling:["type",$t],layouter:["type",cc],connectionDocking:["type",Qi]};var EA=10,Mv=50,wA=250;function Cp(e,t,n,i){for(var r;r=SA(e,n,t);)n=i(t,n,r);return n}function Pp(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 SA(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=CA(e);return qe(r,function(o){if(o===n)return!1;var a=Lt(o,i,EA);return a==="intersect"})}function RA(e,t){t||(t={});function n(h){return h.source===e?1:-1}var i=t.defaultDistance||Mv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||wA,c=t.reference||"start";o||(o=TA);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=sn(f,function(h,m){var g=m.distance,S=m.weight;return g<0||g>s||(h[String(g)]||(h[String(g)]=0),h[String(g)]+=1*S,(!h.distance||h[h.distance]<h[String(g)])&&(h.distance=g)),h},{});return d.distance||i}function CA(e){var t=Ap(e);return e.host&&(t=t.concat(Ap(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Ap(i))},[]))),t}function Ap(e){return AA(e).concat(PA(e))}function PA(e){return e.incoming.map(function(t){return t.source})}function AA(e){return e.outgoing.map(function(t){return t.target})}function TA(){return!0}var MA=100;function kv(e,t,n){e.on("autoPlace",MA,function(i){var r=i.shape,o=i.source;return kA(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}}kv.$inject=["eventBus","modeling","canvas"];function kA(e,t,n){n||(n={});var i=n.defaultDistance||Mv,r=fe(e),o=ue(e);return{x:o.right+i+t.width/2,y:r.y}}function Dv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Dv.$inject=["eventBus","selection"];const DA={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",kv],autoPlaceSelectionBehavior:["type",Dv]};function Ov(e,t,n){var i=Nh(e,n);if(y(t,"bpmn:TextAnnotation"))return IA(e,t,i);if(Ee(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return LA(e,t,i);if(y(t,"bpmn:FlowNode"))return OA(e,t,i)}function OA(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=RA(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=Lt(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+Iv(u,c,o)}:{x:r.x+Iv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Cp(e,t,l,Pp(f))}function Iv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function IA(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};Ve(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 Cp(e,t,r,Pp(a))}function LA(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 Cp(e,t,r,Pp(a))}function Lv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Ov(r,i,t)})}Lv.$inject=["eventBus","elementRegistry"];const uc={__depends__:[DA],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Lv]},lo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},NA=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function BA(e){const t=lo;return NA.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 Tp(e,t){let n=0;for(const i of e)n+=t*BA(i);return n}function Nv(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&$A(e),jA(e),FA(e),HA(e)}function $A(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:Tp(r,o),fontBoundingBoxAscent:o*lo.ascentEm,fontBoundingBoxDescent:o*lo.descentEm,actualBoundingBoxAscent:o*lo.ascentEm,actualBoundingBoxDescent:o*lo.descentEm}}};t.getContext=()=>n}function jA(e){if(e.SVGMatrix)return;class t{constructor(){Lr(this,"a",1);Lr(this,"b",0);Lr(this,"c",0);Lr(this,"d",1);Lr(this,"e",0);Lr(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 FA(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 HA(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:Tp(n,12),height:14}})}const Bv=[Ih,Ho,Rp,uc];function zA(e={}){Nv(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Ur({container:t,moddleExtensions:e.moddleExtensions??$a,additionalModules:[...Bv,...e.additionalModules??[]]})}var VA=new ao("ov"),GA=500;function Ot(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=VA,this._overlayDefaults=D({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=WA(n.getContainer()),this._init()}Ot.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Ot.prototype.get=function(e){if(on(e)&&(e={id:e}),on(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?we(t.overlays,jr({type:e.type})):t.overlays.slice():[]}else return e.type?we(this._overlays,jr({type:e.type})):e.id?this._overlays[e.id]:null},Ot.prototype.add=function(e,t,n){if(At(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=D({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Ot.prototype.remove=function(e){var t=this.get(e)||[];pe(t)||(t=[t]);var n=this;M(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(Kn(i.html),Kn(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)}})},Ot.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Ot.prototype.show=function(){lc(this._overlayRoot)},Ot.prototype.hide=function(){lc(this._overlayRoot,!1)},Ot.prototype.clear=function(){this._overlays={},this._overlayContainers=[],qa(this._overlayRoot)},Ot.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=pt(t);i=o.x,r=o.y}$v(n,i,r),Gt(e.html,"data-container-id",t.id)},Ot.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=pt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=pt(i).height:s=i.height,o=t.bottom*-1+s}$v(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Ot.prototype._createOverlayContainer=function(e){var t=Ke('<div class="djs-overlays" />');Xt(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Ot.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";jv(this._overlayRoot,n)},Ot.prototype._getOverlayContainer=function(e,t){var n=qe(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Ot.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)),on(i)&&(i=Ke(i)),o=this._getOverlayContainer(n),r=Ke('<div class="djs-overlay" data-overlay-id="'+t+'">'),Xt(r,{position:"absolute"}),r.appendChild(i),e.type&&Je(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();lc(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())},Ot.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&&(xt(r)&&r>t.scale||xt(o)&&o<t.scale))&&(c=!1),lc(a,c),this._updateOverlayScale(e,t)},Ot.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),xt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),xt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),xt(a)&&(s="scale("+a+","+a+")"),jv(o,s)},Ot.prototype._updateOverlaysVisibilty=function(e){var t=this;M(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Ot.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});M(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){Kn(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",GA,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(M(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&&Je(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 WA(e){var t=Ke('<div class="djs-overlay-container" />');return Xt(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function $v(e,t,n){Xt(e,{left:t+"px",top:n+"px"})}function lc(e,t){e.style.display=t===!1?"none":""}function jv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const pc={__init__:["overlays"],overlays:["type",Ot]};function Mp(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)})}ee(Mp,W),Mp.$inject=["canvas","injector"];const UA={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Mp]};function da(e){return CSS.escape(e)}var qA={"&":"&","<":"<",">":">",'"':""","'":"'"};function Fv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return qA[t]})}var YA="bjs-breadcrumbs-shown";function Hv(e,t,n){var i=Ke('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Je(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=U(u),p=qe(a,function(f){return f===l});p&&s()});function s(c){c&&(a=KA(c));var u=a.flatMap(function(p){var f=n.findRoot(ei(p))||n.findRoot(p.id);if(!f&&y(p,"bpmn:Process")){var d=t.find(function(g){var S=U(g);return S&&S.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var h=Fv(p.name||p.id),m=Ke('<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(YA,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}Hv.$inject=["eventBus","elementRegistry","canvas"];function KA(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 zv(e,t){var n=null,i=new XA;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})}zv.$inject=["eventBus","canvas"];function XA(){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 Vv={x:180,y:160};function Ar(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Ar.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)})}},Ar.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),QA(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},Ar.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=ZA(e),i={x:n.x-Vv.x,y:n.y-Vv.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)})},Ar.prototype._moveToDiPlane=function(e,t){var n=Gv(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Ar.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},Ar.$inject=["eventBus","moddle"];function Gv(e){return y(e,"bpmndi:BPMNDiagram")?e:Gv(e.$parent)}function ZA(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)}}),ns(t)}function QA(e,t){var n=e.$parent;return!(!y(n,"bpmn:SubProcess")||n===t.bpmnElement||Ee(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var fc=250,JA='<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>',eT="bjs-drilldown-empty";function Ji(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",fc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",fc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],fc,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"],fc,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)})})}ee(Ji,W),Ji.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Ji.prototype._canDrillDown=function(e){var t=this._canvas;return y(e,"bpmn:SubProcess")&&t.findRoot(ei(e))},Ji.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;Je(i.html).toggle(eT,!r)}},Ji.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=Ke('<button type="button" class="bjs-drilldown">'+JA+"</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)},Ji.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Ji.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const tT={__depends__:[pc,cp,UA],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Hv],drilldownCentering:["type",zv],drilldownOverlayBehavior:["type",Ji],subprocessCompatibility:["type",Ar]};function er(e){tt.call(this,e)}ee(er,tt),er.prototype._modules=[Ih,tT,pc,Tn,Ho],er.prototype._moddleExtensions={};var dc="keyboard.keydown",nT="keyboard.keyup",iT=1e3,Wv="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 Zt(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(Wv));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Zt.$inject=["config.keyboard","eventBus"],Zt.prototype._keydownHandler=function(e){this._keyHandler(e,dc)},Zt.prototype._keyupHandler=function(e){this._keyHandler(e,nT)},Zt.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||dc,i),n&&e.preventDefault()}},Zt.prototype._isEventIgnored=function(e){return!1},Zt.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(Wv)),this.unbind(),e=this._node=this._target,me.bind(e,"keydown",this._keydownHandler),me.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Zt.prototype.getBinding=function(){return this._node},Zt.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),me.unbind(e,"keydown",this._keydownHandler),me.unbind(e,"keyup",this._keyupHandler)),this._node=null},Zt.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Zt.prototype.addListener=function(e,t,n){Tt(e)&&(n=t,t=e,e=iT),this._eventBus.on(n||dc,e,t)},Zt.prototype.removeListener=function(e,t){this._eventBus.off(t||dc,e)},Zt.prototype.hasModifier=yC,Zt.prototype.isCmd=pn,Zt.prototype.isShift=Zl,Zt.prototype.isKey=St;var rT=500;function po(e,t){var n=this;e.on("editorActions.init",rT,function(i){var r=i.editorActions;n.registerBindings(t,r)})}po.$inject=["eventBus","keyboard"],po.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(wC(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(SC(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(_C(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(bC(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(xC(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(EC(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(St(["+","Add","="],r)&&pn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(St(["-","Subtract"],r)&&pn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(St("0",r)&&pn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(St(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const kp={__init__:["keyboard","keyboardBindings"],keyboard:["type",Zt],keyboardBindings:["type",po]};var oT={moveSpeed:50,moveSpeedAccelerated:200};function Uv(e,t,n){var i=this;this._config=D({},oT,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})}}Uv.$inject=["config.keyboardMove","keyboard","canvas"];const qv={__depends__:[kp],__init__:["keyboardMove"],keyboardMove:["type",Uv]};var aT=15;function Yv(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=Er(s),p=Hn(l,c);if(!n.dragging&&sT(p)>aT&&(n.dragging=!0,u===0&&bg(e),Fs("grab")),n.dragging){var f=n.last||n.start;p=Hn(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){me.unbind(document,"mousemove",r),me.unbind(document,"mouseup",o),n=null,_g()}function a(s){if(!gr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Er(s)},me.bind(document,"mousemove",r),me.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Yv.$inject=["eventBus","canvas"];function sT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Kv={__init__:["moveCanvas"],moveCanvas:["type",Yv]};function Xv(e,t){var n=Yu(e.min),i=Yu(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function cT(e,t){return Math.max(e.min,Math.min(e.max,t))}var uT=Math.sign||function(e){return e>=0?1:-1},Dp={min:.2,max:4},Zv=10,lT=.1,pT=.75;function ii(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=en(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||pT;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}ii.$inject=["config.zoomScroll","eventBus","canvas"],ii.prototype.scroll=function(t){this._canvas.scroll(t)},ii.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ii.prototype.zoom=function(t,n){var i=Xv(Dp,Zv*2);this._totalDelta+=t,Math.abs(this._totalDelta)>lT&&(this._zoom(t,n,i),this._totalDelta=0)},ii.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Pm()&&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))*uT(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)}},ii.prototype.stepZoom=function(t,n){var i=Xv(Dp,Zv);this._zoom(t,n,i)},ii.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Yu(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(cT(Dp,s),t)},ii.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&me[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},ii.prototype._init=function(e){this.toggle(e)};const Qv={__init__:["zoomScroll"],zoomScroll:["type",ii]};function ha(e){er.call(this,e)}ee(ha,er),ha.prototype._navigationModules=[qv,Kv,Qv],ha.prototype._modules=[].concat(er.prototype._modules,ha.prototype._navigationModules);function Op(e){return e&&e[e.length-1]}function Jv(e){return e.y}function ey(e){return e.x}var fT={left:ey,center:ey,right:function(e){return e.x+e.width},top:Jv,middle:Jv,bottom:function(e){return e.y+e.height}};function fo(e,t){this._modeling=e,this._rules=t}fo.$inject=["modeling","rules"],fo.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}},fo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},fo.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=Op(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(M(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=Gn(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Op(c).center,o;u=t[0],t=Gn(t,function(f){return f[i]+f[r]}),l=Op(t),o[e]=p(u,l)}return o},fo.prototype.trigger=function(e,t){var n=this._modeling,i,r=we(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=fT[t],a=Gn(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const dT={__init__:["alignElements"],alignElements:["type",fo]},hT=new ao;function ho(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}ho.$inject=["eventBus"],ho.prototype.schedule=function(e,t=hT.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},ho.prototype._schedule=function(e,t){const n=mT();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}},ho.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},ho.prototype._cancel=function(e){clearTimeout(e.executionId)};function mT(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const gT={scheduler:["type",ho]};var vT="djs-element-hidden",hc=".entry",yT=1e3,ty=8,_T=300;function dt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}dt.$inject=["canvas","elementRegistry","eventBus","scheduler"],dt.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()},dt.prototype._createContainer=function(){var e=Ke('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},dt.prototype.registerProvider=function(e,t){t||(t=e,e=yT),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},dt.prototype.getEntries=function(e){var t=this._getProviders(),n=pe(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return M(t,function(r){if(Tt(r[n])){var o=r[n](e);Tt(o)?i=o(i):M(o,function(a,s){i[s]=a})}}),i},dt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=Gt(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},_T);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},dt.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(Tt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},dt.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))}},dt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},dt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;M(t,function(r,o){var a=r.group||"default",s=Ke(r.html||'<div class="entry" draggable="true"></div>'),c;Gt(s,"data-action",o),c=He("[data-group="+da(a)+"]",n),c||(c=Ke('<div class="group"></div>'),Gt(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&bT(s,r.className),r.title&&Gt(s,"title",r.title),r.imageUrl&&(i=Ke("<img>"),Gt(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Je(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},dt.prototype._createHtml=function(e){var t=this,n=Ke('<div class="djs-context-pad"></div>');return cn.bind(n,hc,"click",function(i){t.trigger("click",i)}),cn.bind(n,hc,"dragstart",function(i){t.trigger("dragstart",i)}),cn.bind(n,hc,"mouseover",function(i){t.trigger("mouseover",i)}),cn.bind(n,hc,"mouseout",function(i){t.trigger("mouseout",i)}),me.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},dt.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()&&ET(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},dt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},dt.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&&pr(e,function(i){return n.includes(i)}):n===e},dt.prototype.isShown=function(){return this.isOpen()&&Je(this._current.html).has("open")},dt.prototype.show=function(){this.isOpen()&&(Je(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},dt.prototype.hide=function(){this.isOpen()&&(Je(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},dt.prototype._getPosition=function(e){if(!pe(e)&&Ve(e)){var t=this._canvas.viewbox(),n=xT(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+ty*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+ty*this._canvas.zoom(),top:s.top-a.top}},dt.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")},dt.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,vT)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},dt.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 bT(e,t){var n=Je(e);t=pe(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function xT(e){return e.waypoints[e.waypoints.length-1]}function ET(e,t){return e=pe(e)?e:[e],t=pe(t)?t:[t],e.length===t.length&&pr(e,function(n){return t.includes(n)})}const ny={__depends__:[js,gT,pc],contextPad:["type",dt]};var mc,it,iy,tr,ry,oy,ay,Ip,gc,ma,sy,Lp,Np,Bp,vc={},yc=[],wT=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,_c=Array.isArray;function Ei(e,t){for(var n in t)e[n]=t[n];return e}function $p(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function cy(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?mc.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 bc(e,a,i,r,null)}function bc(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??++iy,__i:-1,__u:0};return r==null&&it.vnode!=null&&it.vnode(o),o}function xc(e){return e.children}function Ec(e,t){this.props=e,this.context=t}function Tr(e,t){if(t==null)return e.__?Tr(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"?Tr(e):null}function ST(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Ei({},t);o.__v=t.__v+1,it.vnode&&it.vnode(o),jp(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Tr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,gy(i,o,r),t.__e=t.__=null,o.__e!=n&&uy(o)}}function uy(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}),uy(e)}function ly(e){(!e.__d&&(e.__d=!0)&&tr.push(e)&&!wc.__r++||ry!=it.debounceRendering)&&((ry=it.debounceRendering)||oy)(wc)}function wc(){try{for(var e,t=1;tr.length;)tr.length>t&&tr.sort(ay),e=tr.shift(),t=tr.length,ST(e)}finally{tr.length=wc.__r=0}}function py(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,h,m,g,S=i&&i.__k||yc,E=t.length;for(c=RT(n,t,S,c,E),p=0;p<E;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&S[d.__i]||vc,d.__i=p,g=jp(e,d,f,r,o,a,s,c,u,l),h=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Fp(f.ref,null,d),l.push(d.ref,d.__c||h,d)),m==null&&h!=null&&(m=h),4&d.__u?(c=fy(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 RT(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]=bc(null,a,null,null,null):_c(a)?a=e.__k[o]=bc(xc,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=bc(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=CT(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=Tr(s)),yy(s,s));return i}function fy(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=fy(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Tr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function CT(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 dy(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||wT.test(t)?n:n+"px"}function Sc(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||dy(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||dy(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(sy,"$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[ma]=i[ma]:(n[ma]=Lp,e.addEventListener(t,o?Bp:Np,o)):e.removeEventListener(t,o?Bp:Np,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 hy(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[gc]==null)t[gc]=Lp++;else if(t[gc]<n[ma])return;return n(it.event?it.event(t):t)}}}function jp(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,h,m,g,S,E,b,x,w,A,I,P,j,F=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=it.__b)&&l(t);e:if(typeof F=="function"){p=a.length;try{if(E=t.props,b=F.prototype&&F.prototype.render,x=(l=F.contextType)&&i[l.__c],w=l?x?x.props.value:l.__:i,n.__c?S=(f=t.__c=n.__c).__=f.__E:(b?t.__c=f=new F(E,w):(t.__c=f=new Ec(E,w),f.constructor=F,f.render=AT),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&&F.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Ei({},f.__s)),Ei(f.__s,F.getDerivedStateFromProps(E,f.__s))),h=f.props,m=f.state,f.__v=t,d)b&&F.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),b&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(b&&F.getDerivedStateFromProps==null&&E!==h&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(E,w),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(E,f.__s,w)===!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)}),yc.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=Tr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(E,f.__s,w),b&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(h,m,g)})}if(f.context=w,f.props=E,f.__P=e,f.__e=!1,A=it.__r,I=0,b)f.state=f.__s,f.__d=!1,A&&A(t),l=f.render(f.props,f.state,f.context),yc.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=Ei(Ei({},i),f.getChildContext())),b&&!d&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(h,m)),P=l!=null&&l.type===xc&&l.key==null?vy(l.props.children):l,s=py(e,_c(P)?P:[P],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),S&&(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(j=o.length;j--;)$p(o[j])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),L.then||my(t),it.__e(L,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=PT(n.__e,t,n,i,r,o,a,c,u);return(l=it.diffed)&&l(t),128&t.__u?void 0:s}function my(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(my))}function gy(e,t,n){for(var i=0;i<n.length;i++)Fp(n[i],n[++i],n[++i]);it.__c&&it.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){it.__e(o,r.__v)}})}function vy(e){return typeof e!="object"||e==null||e.__b>0?e:_c(e)?e.map(vy):e.constructor!==void 0?null:Ei({},e)}function PT(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,h,m,g=n.props||vc,S=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(S);e=document.createElementNS(r,E,S.is&&S),s&&(it.__m&&it.__m(t,o),s=!1),o=null}if(E==null)g===S||s&&e.data==S||(e.data=S);else{if(o=E=="textarea"&&S.defaultValue!=null?null:o&&mc.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 S||u=="value"&&"defaultValue"in S||u=="checked"&&"defaultChecked"in S||Sc(e,u,null,d,r);for(u in S)d=S[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?h=d:u=="checked"?m=d:s&&typeof d!="function"||g[u]===d||Sc(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=""),py(t.type=="template"?e.content:e,_c(f)?f:[f],t,n,i,E=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Tr(n,0),s,c),o!=null)for(u=o.length;u--;)$p(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])&&Sc(e,u,h,g[u],r),u="checked",m!=null&&m!=e[u]&&Sc(e,u,m,g[u],r))}return e}function Fp(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){it.__e(r,n)}}function yy(e,t,n){var i,r;if(it.unmount&&it.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Fp(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){it.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&yy(i[r],t,n||typeof e.type!="function");n||$p(e.__e),e.__c=e.__=e.__e=void 0}function AT(e,t,n){return this.constructor(e,n)}function _y(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),it.__&&it.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],jp(t,e=t.__k=cy(xc,null,[e]),r||vc,vc,t.namespaceURI,r?null:t.firstChild?mc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),gy(o,e,a),e.props.children=null}mc=yc.slice,it={__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}},iy=0,Ec.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ei({},this.state),typeof e=="function"&&(e=e(Ei({},n),this.props)),e&&Ei(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ly(this))},Ec.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ly(this))},Ec.prototype.render=xc,tr=[],oy=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ay=function(e,t){return e.__v.__b-t.__v.__b},wc.__r=0,Ip=Math.random().toString(8),gc="__d"+Ip,ma="__a"+Ip,sy=/(PointerCapture)$|Capture$/i,Lp=0,Np=hy(!1),Bp=hy(!0);var by=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,by(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},xy=new Map;function TT(e){var t=xy.get(this);return t||(t=new Map,xy.set(this,t)),(t=by(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 We=TT.bind(cy),mo,ht,Hp,Ey,ga=0,wy=[],Rt=it,Sy=Rt.__b,Ry=Rt.__r,Cy=Rt.diffed,Py=Rt.__c,Ay=Rt.unmount,Ty=Rt.__;function Rc(e,t){Rt.__h&&Rt.__h(ht,e,ga||t),ga=0;var n=ht.__H||(ht.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function zp(e){return ga=1,MT(ky,e)}function MT(e,t,n){var i=Rc(mo++,2);if(i.t=e,!i.__c&&(i.__=[ky(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=ht,!ht.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,p=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var h=d.__[0];d.__=d.__N,d.__N=void 0,h!==d.__[0]&&(p=!0)}}),o){var f=o.call(this,s,c,u);return l?f||p:f}return!l||p};ht.__f=!0;var o=ht.shouldComponentUpdate,a=ht.componentWillUpdate;ht.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)},ht.shouldComponentUpdate=r}return i.__N||i.__}function Cc(e,t){var n=Rc(mo++,3);!Rt.__s&&Wp(n.__H,t)&&(n.__=e,n.u=t,ht.__H.__h.push(n))}function Vp(e,t){var n=Rc(mo++,4);!Rt.__s&&Wp(n.__H,t)&&(n.__=e,n.u=t,ht.__h.push(n))}function Pc(e){return ga=5,wi(function(){return{current:e}},[])}function wi(e,t){var n=Rc(mo++,7);return Wp(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function va(e,t){return ga=8,wi(function(){return e},t)}function kT(){for(var e;e=wy.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ac),t.__h.some(Gp),t.__h=[]}catch(n){t.__h=[],Rt.__e(n,e.__v)}}}Rt.__b=function(e){ht=null,Sy&&Sy(e)},Rt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ty&&Ty(e,t)},Rt.__r=function(e){Ry&&Ry(e),mo=0;var t=(ht=e.__c).__H;t&&(Hp===ht?(t.__h=[],ht.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Ac),t.__h.some(Gp),t.__h=[],mo=0)),Hp=ht},Rt.diffed=function(e){Cy&&Cy(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(wy.push(t)!==1&&Ey===Rt.requestAnimationFrame||((Ey=Rt.requestAnimationFrame)||DT)(kT)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Hp=ht=null},Rt.__c=function(e,t){t.some(function(n){try{n.__h.some(Ac),n.__h=n.__h.filter(function(i){return!i.__||Gp(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Rt.__e(i,n.__v)}}),Py&&Py(e,t)},Rt.unmount=function(e){Ay&&Ay(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Ac(i)}catch(r){t=r}}),n.__H=void 0,t&&Rt.__e(t,n.__v))};var My=typeof requestAnimationFrame=="function";function DT(e){var t,n=function(){clearTimeout(i),My&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);My&&(t=requestAnimationFrame(n))}function Ac(e){var t=ht,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ht=t}function Gp(e){var t=ht;e.__c=e.__(),ht=t}function Wp(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function ky(e,t){return typeof t=="function"?t(e):t}function OT(e){const{navigationStack:t,setNavigationStack:n}=e,i=wi(()=>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 We`
|
|
11
11
|
<div class="djs-popup-breadcrumbs">
|
|
12
12
|
${r&&We`
|
|
13
13
|
<button
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
</span>
|
|
41
41
|
`}
|
|
42
42
|
</div>
|
|
43
|
-
`}function
|
|
43
|
+
`}function Dy(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=Dy(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function Tc(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Dy(e))&&(i&&(i+=" "),i+=t);return i}function IT(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=wi(()=>LT(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return We`
|
|
44
44
|
<div class="djs-popup-header">
|
|
45
45
|
<h3 class="djs-popup-title" title=${o}>${o}</h3>
|
|
46
46
|
${a.map(u=>We`
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
${u.entries.map(l=>We`
|
|
50
50
|
<li key=${l.id}>
|
|
51
51
|
<${s(l)?"button":"span"}
|
|
52
|
-
class=${
|
|
52
|
+
class=${NT(l,l===i)}
|
|
53
53
|
onClick=${p=>c(p,l)}
|
|
54
54
|
title=${l.title||l.label}
|
|
55
55
|
data-id=${l.id}
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
</ul>
|
|
70
70
|
`)}
|
|
71
71
|
</div>
|
|
72
|
-
`}function
|
|
72
|
+
`}function LT(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 NT(e,t){return Tc("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Oy(e,t){return`${e}-entry-${t.id}`}function BT(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 We`
|
|
73
73
|
<li
|
|
74
|
-
class=${
|
|
74
|
+
class=${Tc("entry",{selected:i,disabled:n.disabled})}
|
|
75
75
|
data-id=${n.id}
|
|
76
|
-
id=${
|
|
76
|
+
id=${Oy(t,n)}
|
|
77
77
|
role="option"
|
|
78
78
|
aria-selected=${i||void 0}
|
|
79
79
|
aria-haspopup=${n.entries?"true":void 0}
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
>
|
|
88
88
|
<div class="djs-popup-entry-content">
|
|
89
89
|
<span
|
|
90
|
-
class=${
|
|
90
|
+
class=${Tc("djs-popup-entry-name",n.className)}
|
|
91
91
|
>
|
|
92
92
|
${n.imageUrl&&We`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&We`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
|
|
93
93
|
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
</div>
|
|
131
131
|
`}
|
|
132
132
|
</li>
|
|
133
|
-
`}function
|
|
133
|
+
`}function $T(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=Pc();Vp(()=>{if(!r||!r.current)return;const m=p.current;if(!m)return;const g=m.querySelector(".selected");g&&jT(g)},[t]);const f=()=>{r.current=!1},d=m=>{r.current||n(m)},h=()=>{r.current||n(null)};return We`
|
|
134
134
|
<div
|
|
135
135
|
class="djs-popup-results"
|
|
136
136
|
ref=${p}
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
>
|
|
144
144
|
${i.map(m=>We`
|
|
145
145
|
${m.name&&We`
|
|
146
|
-
<div key=${m.id} id=${
|
|
146
|
+
<div key=${m.id} id=${Iy(o,m)} class="entry-header" title=${m.name}>
|
|
147
147
|
${m.name}
|
|
148
148
|
</div>
|
|
149
149
|
`}
|
|
@@ -151,10 +151,10 @@
|
|
|
151
151
|
class="djs-popup-group"
|
|
152
152
|
data-group=${m.id}
|
|
153
153
|
role="group"
|
|
154
|
-
aria-labelledby=${m.name?
|
|
154
|
+
aria-labelledby=${m.name?Iy(o,m):void 0}
|
|
155
155
|
>
|
|
156
156
|
${m.entries.map(g=>We`
|
|
157
|
-
<${
|
|
157
|
+
<${BT}
|
|
158
158
|
key=${g.id}
|
|
159
159
|
idPrefix=${o}
|
|
160
160
|
entry=${g}
|
|
@@ -167,8 +167,8 @@
|
|
|
167
167
|
</ul>
|
|
168
168
|
`)}
|
|
169
169
|
</div>
|
|
170
|
-
`}function
|
|
171
|
-
<${
|
|
170
|
+
`}function Iy(e,t){return`${e}-group-${t.id}`}function jT(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const FT=new ao("djs-popup");function HT(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:p,entries:f,onOpened:d,onClosed:h}=e,[m,g]=zp([]);Cc(()=>{g([])},[f]);const[S,E]=zp(""),b=S.trim().length>0,x=wi(()=>GT(f),[f]),w=wi(()=>xt(u)?x.length>5:!1,[u,x]),A=wi(()=>{const N=m.length?m[m.length-1].entries:f;return w?b?p(x.filter(({searchable:B})=>B!==!1),S,{keys:["label","search","description"]}).map(({item:B})=>B):N.filter(({rank:B=0})=>B>=0):N},[w,b,x,S,p,m,f]),I=wi(()=>b?A.length?[{id:"default",entries:A}]:[]:WT(A),[A,b]),[P,j]=zp(A[0]),F=Pc(null),L=Pc(!1),H=wi(()=>FT.next(),[]),re=`${H}-results`,Pe=P&&Oy(H,P);Cc(()=>{const N=F.current;N&&A.includes(N)?j(N):j(A[0]),F.current=null},[A]);const et=va(N=>{const B=VT(I);let xe=B.indexOf(P)+N;xe<0&&(xe=B.length-1),xe>=B.length&&(xe=0),L.current=!0,j(B[xe])},[I,P]),q=va(N=>{N>0&&P&&P.entries&&(L.current=!0,g(B=>[...B,P])),N<0&&m.length>0&&(L.current=!0,F.current=m[m.length+N],g(B=>B.slice(0,N)))},[P,m]),ie=va((N,B,V)=>{if(!(!B||B.disabled))return B.entries?(N.preventDefault(),q(1)):n(N,B,V)},[n,q]),ce=va(N=>{if(N.key==="Enter"&&P){const B=N.target;return!!gr(B,"a, button",!0)||P.disabled?void 0:ie(N,P)}if(N.key==="Backspace"){const B=N.target;if(!(Pu(B,"input")&&B.value!==""))return q(-1),N.preventDefault()}if(N.key==="ArrowUp")return et(-1),N.preventDefault();if(N.key==="ArrowDown")return et(1),N.preventDefault();if(N.key==="ArrowRight")return q(1),N.preventDefault();if(N.key==="ArrowLeft")return q(-1),N.preventDefault()},[P,et,q,ie]),oe=va(N=>{Pu(N.target,"input")&&E(()=>N.target.value)},[E]);Cc(()=>(d(),()=>{h()}),[]);const se=!b&&m.length>0,X=(a||r.length>0)&&!se;return We`
|
|
171
|
+
<${Ly}
|
|
172
172
|
onClose=${t}
|
|
173
173
|
onKeyup=${oe}
|
|
174
174
|
onKeydown=${ce}
|
|
@@ -178,17 +178,17 @@
|
|
|
178
178
|
scale=${c}
|
|
179
179
|
navigationStack=${m}
|
|
180
180
|
>
|
|
181
|
-
${
|
|
182
|
-
<${
|
|
181
|
+
${X&&We`
|
|
182
|
+
<${IT}
|
|
183
183
|
headerEntries=${r}
|
|
184
184
|
onSelect=${n}
|
|
185
185
|
selectedEntry=${P}
|
|
186
|
-
setSelectedEntry=${
|
|
186
|
+
setSelectedEntry=${j}
|
|
187
187
|
title=${a}
|
|
188
188
|
/>
|
|
189
189
|
`}
|
|
190
190
|
${se&&We`
|
|
191
|
-
<${
|
|
191
|
+
<${OT}
|
|
192
192
|
navigationStack=${m}
|
|
193
193
|
setNavigationStack=${g}
|
|
194
194
|
/>
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
${f.length>0&&We`
|
|
197
197
|
<div class="djs-popup-body">
|
|
198
198
|
|
|
199
|
-
${
|
|
199
|
+
${w&&We`
|
|
200
200
|
<div class="djs-popup-search">
|
|
201
201
|
<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
202
|
<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"/>
|
|
@@ -220,17 +220,17 @@
|
|
|
220
220
|
</div>
|
|
221
221
|
`}
|
|
222
222
|
|
|
223
|
-
<${
|
|
223
|
+
<${$T}
|
|
224
224
|
groupedEntries=${I}
|
|
225
225
|
selectedEntry=${P}
|
|
226
|
-
setSelectedEntry=${
|
|
226
|
+
setSelectedEntry=${j}
|
|
227
227
|
keyboardSelection=${L}
|
|
228
|
-
onAction=${
|
|
228
|
+
onAction=${ie}
|
|
229
229
|
idPrefix=${H}
|
|
230
230
|
id=${re}
|
|
231
231
|
ariaLabel=${a||"Results"}
|
|
232
|
-
tabIndex=${
|
|
233
|
-
ariaActivedescendant=${
|
|
232
|
+
tabIndex=${w?-1:0}
|
|
233
|
+
ariaActivedescendant=${w?void 0:Pe||void 0}
|
|
234
234
|
/>
|
|
235
235
|
|
|
236
236
|
${P&&P.documentationRef&&We`
|
|
@@ -254,13 +254,13 @@
|
|
|
254
254
|
</div>
|
|
255
255
|
`}
|
|
256
256
|
${l&&A.length===0&&We`
|
|
257
|
-
<div class="djs-popup-no-results">${Tt(l)?l(
|
|
257
|
+
<div class="djs-popup-no-results">${Tt(l)?l(S):l}</div>
|
|
258
258
|
`}
|
|
259
|
-
</${
|
|
260
|
-
`}function
|
|
259
|
+
</${Ly}>
|
|
260
|
+
`}function Ly(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Pc();return Vp(()=>{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]),Vp(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),Cc(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!gr(p.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),We`
|
|
261
261
|
<div
|
|
262
|
-
class=${
|
|
263
|
-
style=${
|
|
262
|
+
class=${Tc("djs-popup",r)}
|
|
263
|
+
style=${zT(e)}
|
|
264
264
|
onKeydown=${n}
|
|
265
265
|
onKeyup=${i}
|
|
266
266
|
ref=${c}
|
|
@@ -268,8 +268,8 @@
|
|
|
268
268
|
>
|
|
269
269
|
${o}
|
|
270
270
|
</div>
|
|
271
|
-
`}function
|
|
272
|
-
<${
|
|
271
|
+
`}function zT(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:xt(t)?n:void 0,maxWidth:xt(t)?"unset":void 0,"transform-origin":"top left"}}function VT(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function GT(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function WT(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 UT="data-id",Ny=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],qT=1e3;function rt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=xt(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()})}rt.$inject=["config.popupMenu","eventBus","canvas","search"],rt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=By(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);_y(We`
|
|
272
|
+
<${HT}
|
|
273
273
|
onClose=${f=>this.close(f)}
|
|
274
274
|
onSelect=${(f,d,h)=>this.trigger(f,d,h)}
|
|
275
275
|
position=${c}
|
|
@@ -283,7 +283,7 @@
|
|
|
283
283
|
searchFn=${this._search}
|
|
284
284
|
...${{...o}}
|
|
285
285
|
/>
|
|
286
|
-
`,this._current.container)},rt.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()},rt.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()},rt.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)}},rt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},rt.prototype.reset=function(){const e=this._current.container;
|
|
286
|
+
`,this._current.container)},rt.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()},rt.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()},rt.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)}},rt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},rt.prototype.reset=function(){const e=this._current.container;_y(null,e),Kn(e)},rt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},rt.prototype._onOpened=function(){this._emit("opened")},rt.prototype._onClosed=function(){this._emit("closed")},rt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Ke(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},rt.prototype._bindAutoClose=function(){this._eventBus.once(Ny,this.close,this)},rt.prototype._unbindAutoClose=function(){this._eventBus.off(Ny,this.close,this)},rt.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),xt(n)&&e<n&&(r=n),xt(i)&&e>i&&(r=i)),r},rt.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}},rt.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},rt.prototype.registerProvider=function(e,t,n){n||(n=t,t=qT),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},rt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},rt.prototype._getEntries=function(e,t){var n={};return M(t,function(i){if(!i.getPopupMenuEntries){M(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Wn(o,["id"])});return}var r=i.getPopupMenuEntries(e);Tt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},rt.prototype._getHeaderEntries=function(e,t){var n={};return M(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;M(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Wn(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Tt(r)?n=r(n):M(r,function(o,a){n[a]=o})}),n},rt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Tt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},rt.prototype.isOpen=function(){return!!this._current},rt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=gr(e.delegateTarget||e.target,".entry",!0),o=Gt(r,UT);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Tt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},rt.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 By(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=By(r.entries,[...t,...$y(r.search)]):t.length&&(r.search=[...t,...$y(r.search)]),r})}function $y(e){return e?pe(e)?e:[e]:[]}function YT(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=KT(o,r,i);return a?{item:o,tokens:a}:[]}).sort(XT(i))}function KT(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=pe(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=Vy(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Vy(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function XT(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=ZT(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=jy;continue}const s=QT(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=jy;continue}}return i}}function ZT(e,t){return Fy(t)-Fy(e)}const jy=.5,go={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Fy(e){const t=e.reduce((s,c)=>s+Hy(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 Hy(e){if(pe(e))return Math.max(...e.map(Hy));const t=Math.log(e.value.length);return e.match?(e.start?e.end?go.FULL:e.wordEnd?go.START_FULL_WORD:go.START_WORD_PART:e.wordStart?go.WORD_START:go.WORD_PART)*t:go.NO_MATCH*t}function zy(e=""){return pe(e)?e.join(", "):e}function QT(e,t){return zy(e).localeCompare(zy(t))}function Vy(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(JT),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,p=s.index,f=s.index+l.length,d=p===0,h=f===e.length,m=!!((u=s.groups)!=null&&u.all),g=d||/\s/.test(e.charAt(p-1)),S=h||/\s/.test(e.charAt(f));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:g,wordEnd:S,start:d,end:h,all:m});const E=m?t:[l];for(const b of E)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 JT(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const Gy={search:["value",YT]},Up={__depends__:[Gy],__init__:["popupMenu"],popupMenu:["type",rt]};var Wy={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
|
|
287
287
|
<line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
|
|
288
288
|
<rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
289
289
|
<rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
@@ -311,8 +311,8 @@
|
|
|
311
311
|
<line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
|
|
312
312
|
<rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
313
313
|
<rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
314
|
-
</svg>`},WT=900;function vo(e,t,n,i){e.registerProvider(WT,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}vo.$inject=["contextPad","popupMenu","translate","canvas"],vo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},vo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},vo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Vy.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);D(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},vo.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 UT=["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)&&D(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 T(UT,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Vy[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Ac(e){An.call(this,e)}Ac.$inject=["eventBus"],J(Ac,An),Ac.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=we(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Za(n),n.length<2?!1:n})};const qT={__depends__:[rT,ey,Wp],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",vo],alignElementsMenuProvider:["type",ya],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=eu(Br(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=$r(s,function(p){return p.parent.id});T(l,function(p,f){le(u)&&(p=p.filter(function(d){return qe(u,jr({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"],J(Si,W),Si.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ue(ft(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),es(D({},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(YT(i,t)){var r=KT(jn(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 YT(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function KT(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 Tc(e){e.invoke(Si,this)}Tc.$inject=["injector"],J(Tc,Si),Tc.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 _a(e){An.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}_a.$inject=["eventBus"],J(_a,An),_a.prototype.canResize=function(e,t){return!1};function Mc(e,t){_a.call(this,e),this._modeling=t}J(Mc,_a),Mc.$inject=["eventBus","modeling"],Mc.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 T(e,function(i){if(y(i,"bpmn:Lane")||be(i)){n=!1;return}}),n};const XT={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Tc],bpmnAutoResizeProvider:["type",Mc]};function yo(e,t,n){this._canvas=n,this._opts=D({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}yo.$inject=["config.autoScroll","eventBus","canvas"],yo.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++)ZT(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 ZT(e,t,n){return t<e&&e<n}yo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},yo.prototype.setOptions=function(e){this._opts=D({},this._opts,e)},yo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Er(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const QT={__depends__:[yi],__init__:["autoScroll"],autoScroll:["type",yo]};var Gy="djs-bendpoint",Wy="djs-segment-dragger";function JT(e,t){var n=Er(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 Up(e,t,n){var i=JT(e,n),r=ll(t,i);return r}function qp(e,t){var n=ae("g");Ce(n).add(Gy),ve(e,n);var i=ae("circle");ee(i,{cx:0,cy:0,r:4}),Ce(i).add("djs-visual"),ve(n,i);var r=ae("circle");return ee(r,{cx:0,cy:0,r:10}),Ce(r).add("djs-hit"),ve(n,r),t&&Ce(n).add(t),n}function eM(e,t,n,i){var r=ae("g");ve(e,r);var o=18,a=6,s=11,c=nM(t,n,i),u=a+s,l=ae("rect");ee(l,{x:-o/2,y:-a/2,width:o,height:a}),Ce(l).add("djs-visual"),ve(r,l);var p=ae("rect");return ee(p,{x:-c/2,y:-u/2,width:c,height:u}),Ce(p).add("djs-hit"),ve(r,p),vh(r,i==="v"?90:0),r}function Uy(e,t,n){var i=ae("g"),r=ju(t,n),o=fi(t,n);return ve(e,i),eM(i,t,n,o),Ce(i).add(Wy),Ce(i).add(o==="h"?"horizontal":"vertical"),Nt(i,r.x,r.y),i}function Yp(e){return Math.abs(Math.round(e*2/3))}function tM(e,t){var n=iM(e,t);return gl(e,n)}function nM(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Yp(n==="h"?i:r)}function iM(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=im(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function qy(e,t,n,i,r){function o(b,x,S){var A=b.index,I=b.point,P,$,j,L,H,re;return A<=0||b.bendpoint?!1:(P=x[A-1],$=x[A],j=ju(P,$),L=fi(P,$),H=Math.abs(I.x-j.x),re=Math.abs(I.y-j.y),L&&H<=S&&re<=S)}function a(b,x){var S=b.waypoints,A,I,P,$;return x.index<=0||x.bendpoint||(A={start:S[x.index-1],end:S[x.index]},I=fi(A.start,A.end),!I)?null:(I==="h"?P=A.end.x-A.start.x:P=A.end.y-A.start.y,$=Yp(P)/2,$)}function s(b,x){var S=x.waypoints,A=Up(t,S,b),I;if(A){I=a(x,A);var P;if(o(A,S,I)?P=r.start(b,x,A.index):P=i.start(b,x,A.index,!A.bendpoint),P!==!1)return!0}}function c(b,x,S){he.bind(b,x,function(A){n.triggerMouseEvent(x,A,S),A.stopPropagation()})}function u(b,x){var S=t.getLayer("overlays"),A=Fe('.djs-bendpoints[data-element-id="'+da(b.id)+'"]',S);return!A&&x&&(A=ae("g"),ee(A,{"data-element-id":b.id}),Ce(A).add("djs-bendpoints"),ve(S,A),c(A,"mousedown",b),c(A,"click",b),c(A,"dblclick",b)),A}function l(b,x){return Fe('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function p(b,x){x.waypoints.forEach(function(S,A){var I=qp(b);ve(b,I),Nt(I,S.x,S.y)}),qp(b,"floating")}function f(b,x){for(var S=x.waypoints,A,I,P,$=1;$<S.length;$++)A=S[$-1],I=S[$],fi(A,I)&&(P=Uy(b,A,I),ee(P,{"data-segment-idx":$}),c(P,"mousemove",x))}function d(b){T(qa("."+Gy,b),function(x){wt(x)})}function h(b){T(qa("."+Wy,b),function(x){wt(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=Fe(".floating",b),A=x.point;S&&(Nt(S,A.x,A.y),Ce(S).add("positioned"))}function E(b,x,S){var A=l(x.index,b),I=S[x.index-1],P=S[x.index],$=x.point,j=ju(I,P),L=fi(I,P),H,re;A&&(H=rM(A),re={x:$.x-j.x,y:$.y-j.y},L==="v"&&(re={x:re.y,y:re.x}),Nt(H,re.x,re.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&wt(x)}),e.on("element.marker.update",function(b){var x=b.element,S;x.waypoints&&(S=m(x),b.add?Ce(S).add(b.marker):Ce(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=Up(t,S,b.originalEvent),!I)return;w(A,I),I.bendpoint||E(A,I,S)}}),e.on("element.mousedown",function(b){if(Wi(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=Fe(".floating",S);A&&Ce(A).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,S=b.newId;if(x.waypoints){var A=u(x);A&&ee(A,{"data-element-id":S})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}qy.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function rM(e){return Fe(".djs-visual",e)}var Yy=Math.round,Mr="reconnectStart",kr="reconnectEnd",ba="updateWaypoints";function Kp(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=Mr:!u&&c===d.length-1?h=kr:h=ba;var m=h===ba?"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===ba?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Mr?p:u,target:f===kr?p:l}),d){s.source=f===Mr?p:u,s.target=f===kr?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===kr?p:l,target:f===Mr?p:u})),d&&(s.source=f===kr?p:l,s.target=f===Mr?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!==ba&&(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:Yy(a.x),y:Yy(a.y)};if(!c)return!1;m===ba?(p?f.splice(u,0,w):f[u]=w,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,mw(f),g)):(m===Mr?(g.docking="source",kc(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===kr&&(g.docking="target",kc(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,w,g))},this)}Kp.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Kp.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 kc(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Mr)return t&&i&&t===i&&n!==i;if(r===kr)return t&&n&&t===n&&n!==i}var oM="reconnectStart",aM="reconnectEnd",Ky="updateWaypoints",xa="connect-ok",Dc="connect-not-ok",Xy="connect-hover",Zy="djs-updating",Qy="djs-dragging",Jy=1100;function e_(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=qp(i.getLayer("overlays"));Ce(f).add("djs-dragging"),i.addMarker(c,Qy),i.addMarker(c,Zy)}),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,Xy),u===Ky)return;s?(i.removeMarker(c,Dc),i.addMarker(c,xa)):s===!1&&(i.removeMarker(c,xa),i.addMarker(c,Dc))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],Jy,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,Xy),i.removeMarker(s,c?xa:Dc))}),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===oM?kc(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===aM?kc(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===Ky&&(m=e.cropWaypoints(f,m)),E.waypoints=m,r.drawPreview(a,s,E)),Nt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],Jy,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,wt(c),i.removeMarker(s,Zy),i.removeMarker(s,Qy),u&&(i.removeMarker(u,xa),i.removeMarker(u,l?xa:Dc)),r&&r.cleanUp(a)})}e_.$inject=["bendpointMove","injector","eventBus","canvas"];var t_="connect-hover",n_="djs-updating";function i_(e,t,n){return Xp(e,t,e[t]+n)}function Xp(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function sM(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 Xp(t,i,s)}function r_(e){return e==="x"?"y":"x"}function o_(e,t,n){var i,r;return e.original?e.original:(i=pe(t),r=r_(n),Xp(e,r,i[r]))}function a_(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=Up(n,E,p),A,I,P;if(A=fi(b,x),!!A)return I=A==="v"?"x":"y",g===0&&(b=o_(b,f.source,I)),w===E.length-1&&(x=o_(x,f.target,I)),S?P=S.point:P={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:P},i.init(p,P,"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=r_(p.axis),x=sM(d,g,E,b);Nt(p.draggerGfx,x.x,x.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return $u(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=Uy(h,f.segmentStart,f.segmentEnd),Ce(f.draggerGfx).add("djs-dragging"),n.addMarker(d,n_)}),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=i_(g,E,p["d"+E]),S=i_(w,E,p["d"+E]),A=b.length,I=0;b[h]=x,b[m]=S;var P,$;h<2&&(P=Lt(d.source,x),h===1?P==="intersect"&&(b.shift(),b[0]=x,I--):P!=="intersect"&&(b.unshift(g),I++)),m>A-3&&($=Lt(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,t_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,t_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&wt(f.draggerGfx),n.removeMarker(d,n_)}),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)})}a_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var cM=Math.abs,s_=Math.round;function uM(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],cM(r-e)<=n)return r}function c_(e){return{x:e.x,y:e.y}}function u_(e){return{x:e.x+e.width,y:e.y+e.height}}function Dn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:s_(e.x+e.width/2),y:s_(e.y+e.height/2)}}function _o(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function gt(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 l_(e){return e.children||[]}var lM=Math.abs,p_=Math.round,Zp=10;function f_(e){function t(o,a){if(le(o)){for(var s=o.length;s--;)if(lM(o[s]-a)<=Zp)return o[s]}else{o=+o;var c=a%o;if(c<Zp)return a-c;if(c>o-Zp)return a-c+o}return a}function n(o,a){if(o.waypoints)return tM(a,o);if(o.width)return{x:p_(o.width/2+o.x),y:p_(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:[]},T(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;D(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:[]},T(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);!Ve(s)||!c||!c.x||!c.y||(gt(o,"x",c.x),gt(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;D(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)}})}f_.$inject=["eventBus"];const pM={__depends__:[yi,ni],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",qy],bendpointMove:["type",Kp],bendpointMovePreview:["type",e_],connectionSegmentMove:["type",a_],bendpointSnapping:["type",f_]};function d_(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),!Nr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Nr(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:Qp(s)?l:u,connectionEnd:Qp(s)?u:l};At(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){At(c)||(u=c,c=pe(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}d_.$inject=["eventBus","dragging","modeling","rules"];function Qp(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var fM=1100,dM=900,h_="connect-ok",m_="connect-not-ok";function g_(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;Qp(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",dM,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?h_:m_)}),t.on(["connect.out","connect.cleanup"],fM,function(r){var o=r.hover;o&&(n.removeMarker(o,h_),n.removeMarker(o,m_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}g_.$inject=["injector","eventBus","canvas"];const Jp={__depends__:[Tn,ni,yi],__init__:["connectPreview"],connect:["type",d_],connectPreview:["type",g_]};var hM="djs-dragger";function Ri(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)}Ri.$inject=["injector","canvas","graphicsFactory","elementFactory"],Ri.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()),Ya(i),r||(r=e.getConnection=mM(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?pe(o):c,a?pe(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)"})},Ri.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||pe(n),o=t.connectionEnd||pe(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);ve(e,s)},Ri.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&&Lo(o,s,!0)||e,t=i&&Lo(a,s,!1)||t,[e,t]},Ri.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&wt(e.connectionPreviewGfx)},Ri.prototype.getConnection=function(e){var t=gM(e);return this._elementFactory.createConnection(t)},Ri.prototype.createConnectionPreviewGfx=function(){var e=ae("g");return ee(e,{pointerEvents:"none"}),Ce(e).add(hM),ve(this._canvas.getActiveLayer(),e),e},Ri.prototype.createNoopConnection=function(e,t){return ko([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function mM(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 gM(e){return At(e)?e:{}}const vM={__init__:["connectionPreview"],connectionPreview:["type",Ri]},Oc="complex-preview";class v_{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(Oc);n.filter(s=>!yM(s)).forEach(s=>{let c;Ve(s)?(c=this._graphicsFactory._createContainer("connection",ae("g")),this._graphicsFactory.drawConnection(_r(c),s)):(c=this._graphicsFactory._createContainer("shape",ae("g")),this._graphicsFactory.drawShape(_r(c),s),Nt(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);Ve(s)?Nt(u,c.x,c.y):Nt(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",ae("g"));this._graphicsFactory.drawShape(_r(u),s,{width:c.width,height:c.height}),Nt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Ya(this._canvas.getLayer(Oc)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Oc)}hide(){this._canvas.hideLayer(Oc)}}v_.$inject=["canvas","graphicsFactory","previewSupport"];function yM(e){return e.hidden}const _M={__depends__:[so],__init__:["complexPreview"],complexPreview:["type",v_]},y_=Math.round;function Ic(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}Ic.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(D({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;D(u,{x:l.x-y_(u.width/2),y:l.y-y_(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=>!Nr(d))})},Ic.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Ic.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const bM={__depends__:[sc,_M,Sp],__init__:["appendPreview"],appendPreview:["type",Ic]};var __=Math.min,b_=Math.max;function ef(e){e.preventDefault()}function Ea(e){e.stopPropagation()}function xM(e){return e.nodeType===Node.TEXT_NODE}function EM(e){return[].slice.call(e)}function zn(e){this.container=e.container,this.parent=Ke('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Fe("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Jt(this.autoResize,this),this.handlePaste=Jt(this.handlePaste,this)}zn.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=jn(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);D(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=jn(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return D(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&D(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,he.bind(a,"keydown",this.keyHandler),he.bind(a,"mousedown",Ea),he.bind(a,"paste",r.handlePaste),he.bind(a,"focusout",this.focusoutHandler),i.autoResize&&he.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},zn.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)}},zn.prototype.insertText=function(e){e=wM(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},zn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=EM(a.childNodes),c,u;if(xM(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&&Xn(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},zn.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})}},zn.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=Ke('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){ef(h),Ea(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,he.bind(document,"mousemove",f),he.bind(document,"mouseup",d)},f=function(h){ef(h),Ea(h);var m=__(b_(u+h.clientX-s,i),o),g=__(b_(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){ef(h),Ea(h),he.unbind(document,"mousemove",f,!1),he.unbind(document,"mouseup",d,!1)};he.bind(n,"mousedown",p)}D(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},zn.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),he.unbind(t,"keydown",this.keyHandler),he.unbind(t,"mousedown",Ea),he.unbind(t,"input",this.autoResize),he.unbind(t,"paste",this.handlePaste),he.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Xn(n)),Xn(e)},zn.prototype.getValue=function(){return this.content.innerText.trim()},zn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},zn.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 wM(e){return e.replace(/\r\n|\r|\n/g,`
|
|
315
|
-
`)}function dn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new zn({container:t.getContainer(),keyHandler:Jt(this._handleKey,this),resizeHandler:Jt(this._handleResize,this),focusoutHandler:Jt(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}dn.$inject=["eventBus","canvas"],dn.prototype.registerProvider=function(e){this._providers.push(e)},dn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},dn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},dn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},dn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},dn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},dn.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()}},dn.prototype.getValue=function(){return this._textbox.getValue()},dn.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()},dn.prototype._handleResize=function(e){this._fire("resize",e)},dn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},dn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=qe(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__:[Bs],__init__:["directEditing"],directEditing:["type",dn]};function SM(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===Re(e);return!o||!a||!s||!c}}const RM={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=RM[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var CM=[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")],PM=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing"),G("none-end-event",{actionName:"replace-with-none-end"})],AM=[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")],TM=[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")],MM=[G("exclusive-gateway"),G("parallel-gateway"),G("inclusive-gateway"),G("complex-gateway"),G("event-based-gateway")],kM=[G("transaction"),G("event-subprocess"),G("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),G("collapsed-subprocess")],DM=[G("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),G("transaction"),G("event-subprocess"),G("collapsed-ad-hoc-subprocess")],E_=[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")],OM=E_,w_=[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"})],IM=[G("data-store-reference")],LM=[G("data-object-reference")],NM=[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")],BM=[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")],$M=[{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"}],jM=[G("expanded-pool"),G("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],FM={"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 S_={"start-event-non-interrupting":`
|
|
314
|
+
</svg>`},eM=900;function vo(e,t,n,i){e.registerProvider(eM,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}vo.$inject=["contextPad","popupMenu","translate","canvas"],vo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},vo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},vo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Wy.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);D(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},vo.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 tM=["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)&&D(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 M(tM,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Wy[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Mc(e){An.call(this,e)}Mc.$inject=["eventBus"],ee(Mc,An),Mc.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=we(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Ja(n),n.length<2?!1:n})};const nM={__depends__:[dT,ny,Up],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",vo],alignElementsMenuProvider:["type",ya],bpmnAlignElements:["type",Mc]};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=iu(Br(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=$r(s,function(p){return p.parent.id});M(l,function(p,f){pe(u)&&(p=p.filter(function(d){return qe(u,jr({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"],ee(Si,W),Si.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=ue(pt(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),ns(D({},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(iM(i,t)){var r=rM(jn(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 iM(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function rM(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 kc(e){e.invoke(Si,this)}kc.$inject=["injector"],ee(kc,Si),kc.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 _a(e){An.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}_a.$inject=["eventBus"],ee(_a,An),_a.prototype.canResize=function(e,t){return!1};function Dc(e,t){_a.call(this,e),this._modeling=t}ee(Dc,_a),Dc.$inject=["eventBus","modeling"],Dc.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 M(e,function(i){if(y(i,"bpmn:Lane")||be(i)){n=!1;return}}),n};const oM={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",kc],bpmnAutoResizeProvider:["type",Dc]};function yo(e,t,n){this._canvas=n,this._opts=D({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}yo.$inject=["config.autoScroll","eventBus","canvas"],yo.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++)aM(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 aM(e,t,n){return t<e&&e<n}yo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},yo.prototype.setOptions=function(e){this._opts=D({},this._opts,e)},yo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Er(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const sM={__depends__:[yi],__init__:["autoScroll"],autoScroll:["type",yo]};var Uy="djs-bendpoint",qy="djs-segment-dragger";function cM(e,t){var n=Er(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 qp(e,t,n){var i=cM(e,n),r=pl(t,i);return r}function Yp(e,t){var n=ae("g");Ce(n).add(Uy),ve(e,n);var i=ae("circle");te(i,{cx:0,cy:0,r:4}),Ce(i).add("djs-visual"),ve(n,i);var r=ae("circle");return te(r,{cx:0,cy:0,r:10}),Ce(r).add("djs-hit"),ve(n,r),t&&Ce(n).add(t),n}function uM(e,t,n,i){var r=ae("g");ve(e,r);var o=18,a=6,s=11,c=pM(t,n,i),u=a+s,l=ae("rect");te(l,{x:-o/2,y:-a/2,width:o,height:a}),Ce(l).add("djs-visual"),ve(r,l);var p=ae("rect");return te(p,{x:-c/2,y:-u/2,width:c,height:u}),Ce(p).add("djs-hit"),ve(r,p),_h(r,i==="v"?90:0),r}function Yy(e,t,n){var i=ae("g"),r=Fu(t,n),o=fi(t,n);return ve(e,i),uM(i,t,n,o),Ce(i).add(qy),Ce(i).add(o==="h"?"horizontal":"vertical"),Nt(i,r.x,r.y),i}function Kp(e){return Math.abs(Math.round(e*2/3))}function lM(e,t){var n=fM(e,t);return vl(e,n)}function pM(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Kp(n==="h"?i:r)}function fM(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=om(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function Ky(e,t,n,i,r){function o(b,x,w){var A=b.index,I=b.point,P,j,F,L,H,re;return A<=0||b.bendpoint?!1:(P=x[A-1],j=x[A],F=Fu(P,j),L=fi(P,j),H=Math.abs(I.x-F.x),re=Math.abs(I.y-F.y),L&&H<=w&&re<=w)}function a(b,x){var w=b.waypoints,A,I,P,j;return x.index<=0||x.bendpoint||(A={start:w[x.index-1],end:w[x.index]},I=fi(A.start,A.end),!I)?null:(I==="h"?P=A.end.x-A.start.x:P=A.end.y-A.start.y,j=Kp(P)/2,j)}function s(b,x){var w=x.waypoints,A=qp(t,w,b),I;if(A){I=a(x,A);var P;if(o(A,w,I)?P=r.start(b,x,A.index):P=i.start(b,x,A.index,!A.bendpoint),P!==!1)return!0}}function c(b,x,w){me.bind(b,x,function(A){n.triggerMouseEvent(x,A,w),A.stopPropagation()})}function u(b,x){var w=t.getLayer("overlays"),A=He('.djs-bendpoints[data-element-id="'+da(b.id)+'"]',w);return!A&&x&&(A=ae("g"),te(A,{"data-element-id":b.id}),Ce(A).add("djs-bendpoints"),ve(w,A),c(A,"mousedown",b),c(A,"click",b),c(A,"dblclick",b)),A}function l(b,x){return He('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function p(b,x){x.waypoints.forEach(function(w,A){var I=Yp(b);ve(b,I),Nt(I,w.x,w.y)}),Yp(b,"floating")}function f(b,x){for(var w=x.waypoints,A,I,P,j=1;j<w.length;j++)A=w[j-1],I=w[j],fi(A,I)&&(P=Yy(b,A,I),te(P,{"data-segment-idx":j}),c(P,"mousemove",x))}function d(b){M(Ka("."+Uy,b),function(x){wt(x)})}function h(b){M(Ka("."+qy,b),function(x){wt(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 S(b,x){var w=He(".floating",b),A=x.point;w&&(Nt(w,A.x,A.y),Ce(w).add("positioned"))}function E(b,x,w){var A=l(x.index,b),I=w[x.index-1],P=w[x.index],j=x.point,F=Fu(I,P),L=fi(I,P),H,re;A&&(H=dM(A),re={x:j.x-F.x,y:j.y-F.y},L==="v"&&(re={x:re.y,y:re.x}),Nt(H,re.x,re.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&wt(x)}),e.on("element.marker.update",function(b){var x=b.element,w;x.waypoints&&(w=m(x),b.add?Ce(w).add(b.marker):Ce(w).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,w=x.waypoints,A,I;if(w){if(A=u(x,!0),I=qp(t,w,b.originalEvent),!I)return;S(A,I),I.bendpoint||E(A,I,w)}}),e.on("element.mousedown",function(b){if(Wi(b)){var x=b.originalEvent,w=b.element;if(w.waypoints)return s(x,w)}}),e.on("selection.changed",function(b){var x=b.newSelection,w=x[0];w&&w.waypoints&&m(w)}),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 w=u(x);if(w){var A=He(".floating",w);A&&Ce(A).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,w=b.newId;if(x.waypoints){var A=u(x);A&&te(A,{"data-element-id":w})}}),this.addHandles=m,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}Ky.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function dM(e){return He(".djs-visual",e)}var Xy=Math.round,Mr="reconnectStart",kr="reconnectEnd",ba="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=Mr:!u&&c===d.length-1?h=kr:h=ba;var m=h===ba?"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===ba?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(h,{connection:c,source:f===Mr?p:u,target:f===kr?p:l}),d){s.source=f===Mr?p:u,s.target=f===kr?p:l;return}d===!1&&(d=s.allowed=r.allowed(h,{connection:c,source:f===kr?p:l,target:f===Mr?p:u})),d&&(s.source=f===kr?p:l,s.target=f===Mr?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!==ba&&(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||{},S={x:Xy(a.x),y:Xy(a.y)};if(!c)return!1;m===ba?(p?f.splice(u,0,S):f[u]=S,g.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,Sw(f),g)):(m===Mr?(g.docking="source",Oc(s)&&(g.docking="target",g.newWaypoints=f.reverse())):m===kr&&(g.docking="target",Oc(s)&&(g.docking="source",g.newWaypoints=f.reverse())),o.reconnect(l,d,h,S,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 Oc(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Mr)return t&&i&&t===i&&n!==i;if(r===kr)return t&&n&&t===n&&n!==i}var hM="reconnectStart",mM="reconnectEnd",Zy="updateWaypoints",xa="connect-ok",Ic="connect-not-ok",Qy="connect-hover",Jy="djs-updating",e_="djs-dragging",t_=1100;function n_(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=Yp(i.getLayer("overlays"));Ce(f).add("djs-dragging"),i.addMarker(c,e_),i.addMarker(c,Jy)}),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,Qy),u===Zy)return;s?(i.removeMarker(c,Ic),i.addMarker(c,xa)):s===!1&&(i.removeMarker(c,xa),i.addMarker(c,Ic))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],t_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,Qy),i.removeMarker(s,c?xa:Ic))}),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},S=a.hints||{},E={};r&&(S.connectionStart&&(E.connectionStart=S.connectionStart),S.connectionEnd&&(E.connectionEnd=S.connectionEnd),p===hM?Oc(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===mM?Oc(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===Zy&&(m=e.cropWaypoints(f,m)),E.waypoints=m,r.drawPreview(a,s,E)),Nt(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],t_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,wt(c),i.removeMarker(s,Jy),i.removeMarker(s,e_),u&&(i.removeMarker(u,xa),i.removeMarker(u,l?xa:Ic)),r&&r.cleanUp(a)})}n_.$inject=["bendpointMove","injector","eventBus","canvas"];var i_="connect-hover",r_="djs-updating";function o_(e,t,n){return Zp(e,t,e[t]+n)}function Zp(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function gM(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 Zp(t,i,s)}function a_(e){return e==="x"?"y":"x"}function s_(e,t,n){var i,r;return e.original?e.original:(i=fe(t),r=a_(n),Zp(e,r,i[r]))}function c_(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,S=d,E=f.waypoints,b=E[g],x=E[S],w=qp(n,E,p),A,I,P;if(A=fi(b,x),!!A)return I=A==="v"?"x":"y",g===0&&(b=s_(b,f.source,I)),S===E.length-1&&(x=s_(x,f.target,I)),w?P=w.point:P={x:(b.x+x.x)/2,y:(b.y+x.y)/2},h={connection:f,segmentStartIndex:g,segmentEndIndex:S,segmentStart:b,segmentEnd:x,axis:I,dragPosition:P},i.init(p,P,"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],S=p.segmentEndIndex+f,E=h[S],b=a_(p.axis),x=gM(d,g,E,b);Nt(p.draggerGfx,x.x,x.y)}function l(p,f){var d=0,h=p.filter(function(m,g){return ju(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=Yy(h,f.segmentStart,f.segmentEnd),Ce(f.draggerGfx).add("djs-dragging"),n.addMarker(d,r_)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,h=f.segmentStartIndex,m=f.segmentEndIndex,g=f.segmentStart,S=f.segmentEnd,E=f.axis,b=f.originalWaypoints.slice(),x=o_(g,E,p["d"+E]),w=o_(S,E,p["d"+E]),A=b.length,I=0;b[h]=x,b[m]=w;var P,j;h<2&&(P=Lt(d.source,x),h===1?P==="intersect"&&(b.shift(),b[0]=x,I--):P!=="intersect"&&(b.unshift(g),I++)),m>A-3&&(j=Lt(d.target,w),m===A-2?j==="intersect"&&(b.pop(),b[b.length-1]=w):j!=="intersect"&&b.push(S)),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,i_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,i_)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&wt(f.draggerGfx),n.removeMarker(d,r_)}),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(w){return{original:w.original,x:Math.round(w.x),y:Math.round(w.y)}});var g=l(h,m),S=g.waypoints,E=s(d,S),b=g.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:m+b}};o.updateWaypoints(d,E,x)})}c_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var vM=Math.abs,u_=Math.round;function yM(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],vM(r-e)<=n)return r}function l_(e){return{x:e.x,y:e.y}}function p_(e){return{x:e.x+e.width,y:e.y+e.height}}function Dn(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:u_(e.x+e.width/2),y:u_(e.y+e.height/2)}}function _o(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function mt(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 f_(e){return e.children||[]}var _M=Math.abs,d_=Math.round,Qp=10;function h_(e){function t(o,a){if(pe(o)){for(var s=o.length;s--;)if(_M(o[s]-a)<=Qp)return o[s]}else{o=+o;var c=a%o;if(c<Qp)return a-c;if(c>o-Qp)return a-c+o}return a}function n(o,a){if(o.waypoints)return lM(a,o);if(o.width)return{x:d_(o.width/2+o.x),y:d_(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:[]},M(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;D(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&mt(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&mt(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:[]},M(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);!Ve(s)||!c||!c.x||!c.y||(mt(o,"x",c.x),mt(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;D(o,{dx:o.dx-h,dy:o.dy-m,x:o.x-h,y:o.y-m}),(h||s.vertical.indexOf(l)!==-1)&&mt(o,"x",f),(m||s.horizontal.indexOf(p)!==-1)&&mt(o,"y",d)}})}h_.$inject=["eventBus"];const bM={__depends__:[yi,ti],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Ky],bendpointMove:["type",Xp],bendpointMovePreview:["type",n_],connectionSegmentMove:["type",c_],bendpointSnapping:["type",h_]};function m_(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),!Nr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Nr(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:Jp(s)?l:u,connectionEnd:Jp(s)?u:l};At(c)&&(d=c),s.connection=n.connect(p,f,d,h)}),this.start=function(a,s,c,u){At(c)||(u=c,c=fe(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}m_.$inject=["eventBus","dragging","modeling","rules"];function Jp(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var xM=1100,EM=900,g_="connect-ok",v_="connect-not-ok";function y_(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;Jp(o)&&(h=d,m=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:h,connectionEnd:m})}),t.on("connect.hover",EM,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?g_:v_)}),t.on(["connect.out","connect.cleanup"],xM,function(r){var o=r.hover;o&&(n.removeMarker(o,g_),n.removeMarker(o,v_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}y_.$inject=["injector","eventBus","canvas"];const ef={__depends__:[Tn,ti,yi],__init__:["connectPreview"],connect:["type",m_],connectPreview:["type",y_]};var wM="djs-dragger";function Ri(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)}Ri.$inject=["injector","canvas","graphicsFactory","elementFactory"],Ri.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()),Xa(i),r||(r=e.getConnection=SM(function(m,g,S){return h.getConnection(m,g,S)})),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)"})},Ri.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]);ve(e,s)},Ri.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&&Lo(o,s,!0)||e,t=i&&Lo(a,s,!1)||t,[e,t]},Ri.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&wt(e.connectionPreviewGfx)},Ri.prototype.getConnection=function(e){var t=RM(e);return this._elementFactory.createConnection(t)},Ri.prototype.createConnectionPreviewGfx=function(){var e=ae("g");return te(e,{pointerEvents:"none"}),Ce(e).add(wM),ve(this._canvas.getActiveLayer(),e),e},Ri.prototype.createNoopConnection=function(e,t){return ko([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function SM(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 RM(e){return At(e)?e:{}}const CM={__init__:["connectionPreview"],connectionPreview:["type",Ri]},Lc="complex-preview";class __{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(Lc);n.filter(s=>!PM(s)).forEach(s=>{let c;Ve(s)?(c=this._graphicsFactory._createContainer("connection",ae("g")),this._graphicsFactory.drawConnection(_r(c),s)):(c=this._graphicsFactory._createContainer("shape",ae("g")),this._graphicsFactory.drawShape(_r(c),s),Nt(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);Ve(s)?Nt(u,c.x,c.y):Nt(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",ae("g"));this._graphicsFactory.drawShape(_r(u),s,{width:c.width,height:c.height}),Nt(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Xa(this._canvas.getLayer(Lc)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(Lc)}hide(){this._canvas.hideLayer(Lc)}}__.$inject=["canvas","graphicsFactory","previewSupport"];function PM(e){return e.hidden}const AM={__depends__:[so],__init__:["complexPreview"],complexPreview:["type",__]},b_=Math.round;function Nc(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}Nc.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(D({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;D(u,{x:l.x-b_(u.width/2),y:l.y-b_(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=>!Nr(d))})},Nc.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Nc.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const TM={__depends__:[uc,AM,Rp],__init__:["appendPreview"],appendPreview:["type",Nc]};var x_=Math.min,E_=Math.max;function tf(e){e.preventDefault()}function Ea(e){e.stopPropagation()}function MM(e){return e.nodeType===Node.TEXT_NODE}function kM(e){return[].slice.call(e)}function zn(e){this.container=e.container,this.parent=Ke('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=He("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=en(this.autoResize,this),this.handlePaste=en(this.handlePaste,this)}zn.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=jn(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);D(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=jn(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return D(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&D(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,me.bind(a,"keydown",this.keyHandler),me.bind(a,"mousedown",Ea),me.bind(a,"paste",r.handlePaste),me.bind(a,"focusout",this.focusoutHandler),i.autoResize&&me.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},zn.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)}},zn.prototype.insertText=function(e){e=DM(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},zn.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=kM(a.childNodes),c,u;if(MM(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&&Kn(h)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},zn.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})}},zn.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=Ke('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(h){tf(h),Ea(h),s=h.clientX,c=h.clientY;var m=t.getBoundingClientRect();u=m.width,l=m.height,me.bind(document,"mousemove",f),me.bind(document,"mouseup",d)},f=function(h){tf(h),Ea(h);var m=x_(E_(u+h.clientX-s,i),o),g=x_(E_(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){tf(h),Ea(h),me.unbind(document,"mousemove",f,!1),me.unbind(document,"mouseup",d,!1)};me.bind(n,"mousedown",p)}D(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},zn.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),me.unbind(t,"keydown",this.keyHandler),me.unbind(t,"mousedown",Ea),me.unbind(t,"input",this.autoResize),me.unbind(t,"paste",this.handlePaste),me.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Kn(n)),Kn(e)},zn.prototype.getValue=function(){return this.content.innerText.trim()},zn.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},zn.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 DM(e){return e.replace(/\r\n|\r|\n/g,`
|
|
315
|
+
`)}function mn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new zn({container:t.getContainer(),keyHandler:en(this._handleKey,this),resizeHandler:en(this._handleResize,this),focusoutHandler:en(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}mn.$inject=["eventBus","canvas"],mn.prototype.registerProvider=function(e){this._providers.push(e)},mn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},mn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},mn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},mn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},mn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},mn.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()}},mn.prototype.getValue=function(){return this._textbox.getValue()},mn.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()},mn.prototype._handleResize=function(e){this._fire("resize",e)},mn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},mn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=qe(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 w_={__depends__:[js],__init__:["directEditing"],directEditing:["type",mn]};function OM(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===Re(e);return!o||!a||!s||!c}}const IM={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=IM[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var LM=[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")],NM=[G("none-start-event",{actionName:"replace-with-none-start"}),G("none-intermediate-throwing"),G("none-end-event",{actionName:"replace-with-none-end"})],BM=[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")],$M=[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")],jM=[G("exclusive-gateway"),G("parallel-gateway"),G("inclusive-gateway"),G("complex-gateway"),G("event-based-gateway")],FM=[G("transaction"),G("event-subprocess"),G("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),G("collapsed-subprocess")],HM=[G("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),G("transaction"),G("event-subprocess"),G("collapsed-ad-hoc-subprocess")],S_=[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")],zM=S_,R_=[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"})],VM=[G("data-store-reference")],GM=[G("data-object-reference")],WM=[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")],UM=[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")],qM=[{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"}],YM=[G("expanded-pool"),G("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],KM={"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 C_={"start-event-non-interrupting":`
|
|
316
316
|
<svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
|
|
317
317
|
<g transform="translate(0 995.64)">
|
|
318
318
|
<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 +323,7 @@
|
|
|
323
323
|
<circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
|
|
324
324
|
<circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
|
|
325
325
|
</g>
|
|
326
|
-
</svg>`};function On(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()}On.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],On.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},On.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(le(e)||!n.allowed("shape.replace",{element:e}))return{};var a=SM(e);return y(t,"bpmn:DataObjectReference")?this._createEntries(e,IM):y(t,"bpmn:DataStoreReference")&&!y(e.parent,"bpmn:Collaboration")?this._createEntries(e,LM):(y(t,"bpmn:Event")&&!y(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=FM[r]||[],!Ut(t.$parent)&&y(t.$parent,"bpmn:SubProcess")&&(i=we(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),y(t,"bpmn:StartEvent")&&!y(t.$parent,"bpmn:SubProcess")?(o=we(CM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Participant")?(o=we(jM,function(c){return Re(e)!==c.target.isExpanded}),this._createEntries(e,o)):y(t,"bpmn:StartEvent")&&Ut(t.$parent)?(o=we(BM.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")&&!Ut(t.$parent)&&y(t.$parent,"bpmn:SubProcess")?(o=we(PM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:EndEvent")?(o=we(TM.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=we(NM,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=we(AM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Gateway")?(o=we(MM,a),this._createEntries(e,o)):y(t,"bpmn:Transaction")?(o=we(E_,a),this._createEntries(e,o)):Ut(t)&&Re(e)?(o=we(OM,a),this._createEntries(e,o)):y(t,"bpmn:AdHocSubProcess")&&Re(e)?(o=we(DM,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&Re(e)?(o=we(kM,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&!Re(e)?(o=we(w_,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,$M):y(t,"bpmn:FlowNode")?(o=we(w_,a),this._createEntries(e,o)):{})},On.prototype.getPopupMenuHeaderEntries=function(e){var t={};return y(e,"bpmn:Activity")&&!Ut(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),y(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),y(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),ym(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},On.prototype._createEntries=function(e,t){var n={},i=this;return T(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},On.prototype._createSequenceFlowEntries=function(e,t){var n=U(e),i={},r=this._modeling,o=this._moddle,a=this;return T(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},On.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}},On.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"}}}},On.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}}},On.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}}},On.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=U(e),i=this,r=_m(e),o=y(e,"bpmn:BoundaryEvent")?S_["intermediate-event-non-interrupting"]:S_["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 HM={__depends__:[Wp,jg,sc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",On]};function wa(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(!(!Yo(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}wa.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],wa.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&D(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},wa.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return le(t)?lr(e,n=>t.includes(n)):t},wa.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&D(l,h()),l;var p=e.businessObject;function f(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 H=i.createShape(D({type:b},A));o.start(j,H,{source:L})}var P=s?function(j,L){var H=i.createShape(D({type:b},A));s.append(L,H)}: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:P,hover:$}}}function w(b){return function(x,S){n.splitLane(S,b),t.open(S,!0)}}if(Ee(p,["bpmn:Lane","bpmn:Participant"])&&Re(e)){var E=Vi(e);D(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&&((kt(e)?e.height>=120:e.width>=120)&&D(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:w(2)}}}),(kt(e)?e.height>=180:e.width>=180)&&D(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:w(3)}}})),D(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")?D(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"})}):R_(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?D(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!y(p,"bpmn:EndEvent")&&!p.isForCompensation&&!R_(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Ut(p)&&D(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")||D(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var S=D(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")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),y(p,"bpmn:MessageFlow")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Ee(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(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")&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),Ee(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),y(p,"bpmn:Group")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&D(l,h()),l};function R_(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return T(o,function(a){a.$type===n&&(r=!0)}),i&&r}const zM={__depends__:[bM,x_,ey,Tn,Jp,js,HM],__init__:["contextPadProvider"],contextPadProvider:["type",wa]};var VM={horizontal:["x","width"],vertical:["y","height"]},C_=5;function Ci(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return le(i)?i:i?n:[]})}Ci.$inject=["modeling","rules"],Ci.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Ci.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},Ci.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(T(t,function(o){r=o(r,n,i)}),r):e},Ci.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=Wn(e,i);return T(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},Ci.prototype._setOrientation=function(e){var t=VM[e];this._axis=t[0],this._dimension=t[1]},Ci.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)},Ci.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+C_,max:t+n-C_}};const GM={__init__:["distributeElements"],distributeElements:["type",Ci]};function Lc(e){An.call(this,e)}Lc.$inject=["eventBus"],J(Lc,An),Lc.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=we(t,function(n){var i=Ee(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Za(t),t.length<3?!1:t})};var P_={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
326
|
+
</svg>`};function On(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()}On.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],On.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},On.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=OM(e);return y(t,"bpmn:DataObjectReference")?this._createEntries(e,VM):y(t,"bpmn:DataStoreReference")&&!y(e.parent,"bpmn:Collaboration")?this._createEntries(e,GM):(y(t,"bpmn:Event")&&!y(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=KM[r]||[],!Ut(t.$parent)&&y(t.$parent,"bpmn:SubProcess")&&(i=we(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),y(t,"bpmn:StartEvent")&&!y(t.$parent,"bpmn:SubProcess")?(o=we(LM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Participant")?(o=we(YM,function(c){return Re(e)!==c.target.isExpanded}),this._createEntries(e,o)):y(t,"bpmn:StartEvent")&&Ut(t.$parent)?(o=we(UM.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")&&!Ut(t.$parent)&&y(t.$parent,"bpmn:SubProcess")?(o=we(NM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:EndEvent")?(o=we($M.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=we(WM,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=we(BM.concat(i),a),this._createEntries(e,o)):y(t,"bpmn:Gateway")?(o=we(jM,a),this._createEntries(e,o)):y(t,"bpmn:Transaction")?(o=we(S_,a),this._createEntries(e,o)):Ut(t)&&Re(e)?(o=we(zM,a),this._createEntries(e,o)):y(t,"bpmn:AdHocSubProcess")&&Re(e)?(o=we(HM,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&Re(e)?(o=we(FM,a),this._createEntries(e,o)):y(t,"bpmn:SubProcess")&&!Re(e)?(o=we(R_,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,qM):y(t,"bpmn:FlowNode")?(o=we(R_,a),this._createEntries(e,o)):{})},On.prototype.getPopupMenuHeaderEntries=function(e){var t={};return y(e,"bpmn:Activity")&&!Ut(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),y(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),y(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),bm(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},On.prototype._createEntries=function(e,t){var n={},i=this;return M(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},On.prototype._createSequenceFlowEntries=function(e,t){var n=U(e),i={},r=this._modeling,o=this._moddle,a=this;return M(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},On.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}},On.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"}}}},On.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}}},On.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}}},On.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=U(e),i=this,r=xm(e),o=y(e,"bpmn:BoundaryEvent")?C_["intermediate-event-non-interrupting"]:C_["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 XM={__depends__:[Up,Hg,uc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",On]};function wa(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(!(!Yo(d)||!i.isOpen(m))){var g=i.getEntries(m);g.replace&&g.replace.action.click(d,m)}}),n.on("contextPad.close",function(){f.cleanUp()})}wa.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],wa.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&D(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},wa.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return pe(t)?pr(e,n=>t.includes(n)):t},wa.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&D(l,h()),l;var p=e.businessObject;function f(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,w=t.getPad(b).html,A=w.getBoundingClientRect(),I={x:A.left,y:A.bottom+x};return I}function g(b,x,w,A){function I(F,L){var H=i.createShape(D({type:b},A));o.start(F,H,{source:L})}var P=s?function(F,L){var H=i.createShape(D({type:b},A));s.append(L,H)}:I,j=s?function(F,L){return u.create(L,b,A),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:w,action:{dragstart:I,click:P,hover:j}}}function S(b){return function(x,w){n.splitLane(w,b),t.open(w,!0)}}if(Ee(p,["bpmn:Lane","bpmn:Participant"])&&Re(e)){var E=Vi(e);D(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&&((kt(e)?e.height>=120:e.width>=120)&&D(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:S(2)}}}),(kt(e)?e.height>=180:e.width>=180)&&D(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:S(3)}}})),D(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")?D(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"})}):P_(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?D(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!y(p,"bpmn:EndEvent")&&!p.isForCompensation&&!P_(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Ut(p)&&D(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")||D(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var w=D(m(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",w,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),y(p,"bpmn:SequenceFlow")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),y(p,"bpmn:MessageFlow")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Ee(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(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")&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),Ee(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&D(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),y(p,"bpmn:Group")&&D(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&D(l,h()),l};function P_(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return M(o,function(a){a.$type===n&&(r=!0)}),i&&r}const ZM={__depends__:[TM,w_,ny,Tn,ef,Hs,XM],__init__:["contextPadProvider"],contextPadProvider:["type",wa]};var QM={horizontal:["x","width"],vertical:["y","height"]},A_=5;function Ci(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:[]})}Ci.$inject=["modeling","rules"],Ci.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Ci.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},Ci.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(M(t,function(o){r=o(r,n,i)}),r):e},Ci.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=Gn(e,i);return M(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},Ci.prototype._setOrientation=function(e){var t=QM[e];this._axis=t[0],this._dimension=t[1]},Ci.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)},Ci.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+A_,max:t+n-A_}};const JM={__init__:["distributeElements"],distributeElements:["type",Ci]};function Bc(e){An.call(this,e)}Bc.$inject=["eventBus"],ee(Bc,An),Bc.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=we(t,function(n){var i=Ee(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Ja(t),t.length<3?!1:t})};var T_={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
327
327
|
<polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
|
|
328
328
|
<rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
329
329
|
<rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
@@ -331,7 +331,7 @@
|
|
|
331
331
|
<polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
|
|
332
332
|
<rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
333
333
|
<rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
334
|
-
</svg>`},WM=900;function Sa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",WM,this)}Sa.$inject=["popupMenu","distributeElements","translate","rules"],Sa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Sa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Sa.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:P_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:P_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const UM={__depends__:[Wp,GM],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Lc],distributeElementsMenuProvider:["type",Sa]};var A_="is not a registered action",qM="is already registered";function In(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}In.$inject=["eventBus","injector"],In.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=le(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&&(le(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)})},In.prototype.trigger=function(e,t){if(!this._actions[e])throw tf(e,A_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},In.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);T(e,function(i,r){n._registerAction(r,i)})},In.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw tf(e,qM);this._actions[e]=t},In.prototype.unregister=function(e){if(!this.isRegistered(e))throw tf(e,A_);this._actions[e]=void 0},In.prototype.getActions=function(){return Object.keys(this._actions)},In.prototype.isRegistered=function(e){return!!this._actions[e]};function tf(e,t){return new Error(e+" "+t)}const YM={__init__:["editorActions"],editorActions:["type",In]};function Nc(e){e.invoke(In,this)}J(Nc,In),Nc.$inject=["injector"],Nc.prototype._registerDefaultActions=function(e){In.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=we(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=ft(g),f.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const KM={__depends__:[YM],editorActions:["type",Nc]};function T_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Ee(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}T_.$inject=["eventBus"];function Dr(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;nn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Dr.$inject=["eventBus","gridSnapping","modeling"],J(Dr,W),Dr.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},Dr.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},Dr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),D(e,o),e},Dr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),D(e,o),e};var XM=2e3;function M_(e,t){e.on(["spaceTool.move","spaceTool.end"],XM,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)}})}M_.$inject=["eventBus","gridSnapping"];const ZM={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Dr],gridSnappingSpaceToolBehavior:["type",M_]};var Bc=10;function nf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var QM=1200,JM=800;function nr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",JM,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"],QM,function(o){var a=o.originalEvent;if(!(!r.active||a&&un(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=t2(o,u,e);p&&(l.offset=p);var f=e2(o,u);f&&D(l,f),_o(o,u)||r.snapEvent(o,u,l)})}})}nr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);gt(e,t,i)},nr.prototype.getGridSpacing=function(){return Bc},nr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=nf(e,Bc);var i,r;return t&&t.min&&(i=t.min,de(i)&&(i=nf(i+n,Bc,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,de(r)&&(r=nf(r+n,Bc,"floor"),e=Math.min(e,r))),e-=n,e},nr.prototype.isActive=function(){return this.active},nr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},nr.prototype.toggleActive=function(){this.setActive(!this.active)},nr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function e2(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&&($c(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&&($c(t)?D_(s)?a.x.max=c.left:a.x.min=c.right:k_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&($c(t)?D_(s)?a.x.min=u.left:a.x.max=u.right:k_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function t2(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&de(s[t])||(s||(s=o.snapOffset={}),de(s[t])||(s[t]=0),!r)||(n.get(r.id)||($c(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 $c(e){return e==="x"}function k_(e){return e.indexOf("n")!==-1}function D_(e){return e.indexOf("w")!==-1}const n2={__depends__:[ZM],__init__:["gridSnapping"],gridSnapping:["type",nr]};var i2=2e3;function O_(e,t,n){e.on("autoPlace",i2,function(i){var r=i.source,o=pe(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],y(a,"bpmn:TextAnnotation")&&(r2(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}O_.$inject=["eventBus","gridSnapping","elementRegistry"];function r2(e){return e==="x"}var o2=1750;function I_(e,t,n){t.on(["create.start","shape.move.start"],o2,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}))}})}I_.$inject=["canvas","eventBus","gridSnapping"];var a2=3e3;function jc(e,t,n){W.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],a2,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||s2(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}jc.$inject=["eventBus","gridSnapping","modeling"],J(jc,W),jc.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=l2(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function s2(e){return e.length>3}function c2(e){return e==="h"}function u2(e){return e==="v"}function l2(e,t,n){var i=fi(t,n),r={};return c2(i)&&(r.y=e.snapValue(t.y)),u2(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=D({},t,r),n=D({},n,r)),[t,n]}const p2={__depends__:[n2,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",O_],gridSnappingParticipantBehavior:["type",I_],gridSnappingLayoutConnectionBehavior:["type",jc]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",T_]};var f2=30,L_=30;function Ra(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 Re(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(y(r,"bpmn:SubProcess"))return Re(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ra.$inject=["eventBus","interactionEvents"],Ra.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ra.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=kt(e)?{width:f2,height:e.height}:{width:e.width,height:L_};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ra.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:L_}),!0};const d2={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ra]};function Fc(e){e.invoke(po,this)}J(Fc,po),Fc.$inject=["injector"],Fc.prototype.registerBindings=function(e,t){po.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 h2={__depends__:[Mp],__init__:["keyboardBindings"],keyboardBindings:["type",Fc]};var m2={moveSpeed:1,moveSpeedAccelerated:10},g2=1500,N_="left",B_="up",$_="right",j_="down",v2={ArrowLeft:N_,Left:N_,ArrowUp:B_,Up:B_,ArrowRight:$_,Right:$_,ArrowDown:j_,Down:j_},y2={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 F_(e,t,n,i,r){var o=this;this._config=D({},m2,e||{}),t.addListener(g2,function(a){var s=a.keyEvent,c=v2[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=y2[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}F_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const _2={__depends__:[Mp,Tn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",F_]};var H_=10;function Ca(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=uS(l,p,u),c.newBounds=pS(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=ih(p),!b2(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)})}Ca.prototype.canResize=function(e){var t=this._rules,n=jn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ca.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=D({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,z_(t,o),"resize",{autoActivate:!0,cursor:x2(o),data:{shape:t,context:r}})},Ca.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:H_,height:H_},r=Gh(t,e.childrenBoxPadding),fS(n,t,i,r)},Ca.$inject=["eventBus","rules","modeling","dragging"];function b2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function z_(e,t){var n=pe(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 x2(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 V_="djs-resizing",G_="resize-not-ok",E2=500;function W_(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,V_)),s.width>5&&ee(c,{x:s.x,width:s.width}),s.height>5&&ee(c,{y:s.y,height:s.height}),o.canExecute?Ce(c).remove(G_):Ce(c).add(G_)}function r(o){var a=o.shape,s=o.frame;s&&wt(o.frame),t.removeMarker(a,V_)}e.on("resize.move",E2,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}W_.$inject=["eventBus","canvas","previewSupport"];var Hc=-6,zc=8,Vc=20,Pa="djs-resizer",w2=["n","w","s","e","nw","ne","se","sw"];function ir(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&&T(a,Jt(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}ir.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Wi(o)&&i.activate(o,e,n)}he.bind(t,"mousedown",r),he.bind(t,"touchstart",r)},ir.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=S2(i),a=ae("g");Ce(a).add(Pa),Ce(a).add(Pa+"-"+e.id),Ce(a).add(Pa+"-"+i),ve(r,a);var s=ae("rect");ee(s,{x:-zc/2+o.x,y:-zc/2+o.y,width:zc,height:zc}),Ce(s).add(Pa+"-visual"),ve(a,s);var c=ae("rect");return ee(c,{x:-Vc/2+o.x,y:-Vc/2+o.y,width:Vc,height:Vc}),Ce(c).add(Pa+"-hit"),ve(a,c),is(a,t,n),a},ir.prototype.createResizer=function(e,t){var n=z_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},ir.prototype.addResizer=function(e){var t=this;Ve(e)||T(w2,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},ir.prototype.removeResizers=function(){var e=this._getResizersParent();Ya(e)},ir.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},ir.$inject=["eventBus","canvas","selection","resize"];function S2(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Hc:e.indexOf("w")!==-1&&(t.x=Hc),e.indexOf("s")!==-1?t.y=-Hc:e.indexOf("n")!==-1&&(t.y=Hc),t}const U_={__depends__:[ni,yi,so],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ca],resizePreview:["type",W_],resizeHandles:["type",ir]};var R2=2e3;function Aa(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"],R2,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||Ee(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Aa.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Aa.prototype.activate=function(e){var t=bn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);D(n,i);var r={},o=n.style||{};return D(o,{backgroundColor:null,border:null}),(Ee(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||q_(e))&&D(r,{centerVertically:!0}),Hi(e)&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),y(e,"bpmn:TextAnnotation")&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),D(n,{options:r,style:o}),n}},Aa.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")||A2(e)){var h=kt(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};D(o,m),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(P2(e)){var g=kt(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};D(o,w),D(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)"})}(Ee(e,["bpmn:Task","bpmn:CallActivity"])||q_(e))&&(D(o,{width:i.width,height:i.height}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),C2(e)&&(D(o,{width:i.width,x:i.x}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var E=1,b=i.width+2*E;if(n.labelTarget&&(D(o,{width:b,height:i.height+2*E,x:i.x-E,y:i.y-E}),D(d,{fontSize:u+"px",lineHeight:l})),Hi(n)&&!as(n)&&!be(n)){var x=Vu(e),S=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),A=u,I=br.width*a+2*E;D(o,{width:I,height:A+2*E,x:S.x-I/2,y:S.y-A/2-E}),D(d,{fontSize:u+"px",lineHeight:l})}return y(e,"bpmn:TextAnnotation")&&(D(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}),D(d,{textAlign:"left",paddingTop:Yr*a+"px",paddingBottom:Yr*a+"px",paddingLeft:Yr*a+"px",paddingRight:Yr*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Aa.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}),T2(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function q_(e){return y(e,"bpmn:SubProcess")&&!Re(e)}function C2(e){return y(e,"bpmn:SubProcess")&&Re(e)}function P2(e){return y(e,"bpmn:Participant")&&!Re(e)}function A2(e){return y(e,"bpmn:Participant")&&Re(e)}function T2(e){return!e||!e.trim()}var Y_="djs-element-hidden",K_="djs-label-hidden";function X_(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=ae("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=ae("path");ee(p,{d:l,strokeWidth:2,stroke:M2(o)}),ve(s,p),ve(r,s),Nt(s,o.x,o.y)}y(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Y_):(y(o,"bpmn:Task")||y(o,"bpmn:CallActivity")||y(o,"bpmn:SubProcess")||y(o,"bpmn:Participant")||y(o,"bpmn:Lane"))&&t.addMarker(o,K_)}),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}});ee(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,Y_),t.removeMarker(o,K_)),o=void 0,a=void 0,s&&(wt(s),s=void 0)})}X_.$inject=["eventBus","canvas","pathMap"];function M2(e,t){var n=Me(e);return n.get("stroke")||t||"black"}const k2={__depends__:[sp,U_,x_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Aa],labelEditingPreview:["type",X_]};var D2=500,O2=1e3;function oi(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){pw(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){T(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],D2,function(o){var a=o.element,s=o.gfx,c=Fe(".djs-outline",s);c&&i.updateOutline(a,c)})}oi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Fe(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ve(t,n),this.updateOutline(e,n)),n},oi.prototype._createOutlineGfx=function(){var e=ae("rect");return ee(e,D({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},oi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},oi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&T(i,function(r){n=n||r.updateOutline(t,e)}),n||ee(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},oi.prototype.updateConnectionOutline=function(e,t){var n=ft(t);ee(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},oi.prototype.registerProvider=function(e,t){t||(t=e,e=O2),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},oi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},oi.prototype.getOutline=function(e){var t,n=this._getProviders();return T(n,function(i){Tt(i.getOutline)&&(t=t||i.getOutline(e))}),t},oi.$inject=["eventBus","styles","elementRegistry"];var Gc=6;function rf(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)})}rf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ya(t);var n=e.length>1,i=this._canvas.getContainer();if(Ce(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=I2(ft(e)),o=ae("rect");ee(o,D({rx:3},r)),Ce(o).add("djs-selection-outline"),ve(t,o)}},rf.$inject=["eventBus","canvas","selection"];function I2(e){return{x:e.x-Gc,y:e.y-Gc,width:e.width+Gc*2,height:e.height+Gc*2}}const of={__depends__:[Tn],__init__:["outline","multiSelectionOutline"],outline:["type",oi],multiSelectionOutline:["type",rf]},Z_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],Q_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},L2=15,Wc=2;function J_(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=>Ee(h,Z_));if(f.length===1){const h=f[0];be(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(be),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;!Ee(p,Z_)||!l(p)||(be(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=ko([pe(f),pe(p)],Q_),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),w=Lo(g,h);if(!w)return;const b=r.isSelected(f)?c(f):u(f),x=Lo(b,h)||pe(f);Wo(x,w)<L2||(Lu(d,[x,w]),ve(o,d))}function s(){qa(`.${Q_.class}`,o).forEach(wt)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+rr(f,"x")-Wc,y:p.y+rr(f,"y")-Wc,width:rr(f,"width")+Wc*2,height:rr(f,"height")+Wc*2};return Wu(d,rr(f,"rx"))}if(f.cx){const d=rr(f,"r"),h={x:p.x+rr(f,"cx")-d,y:p.y+rr(f,"cy")-d,width:d*2,height:d*2};return Ph(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}J_.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function rr(e,t){return parseFloat(ee(e,t)||0)}const N2={__depends__:[Tn,of],__init__:["labelLink"],labelLink:["type",J_]};var B2=new ao("tt");function $2(e){var t=Ke('<div class="djs-tooltip-container" />');return Xt(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function j2(e,t,n){Xt(e,{left:t+"px",top:n+"px"})}function af(e,t){e.style.display=t===!1?"none":""}var eb="djs-tooltip",sf="."+eb;function tn(e,t){this._eventBus=e,this._canvas=t,this._ids=B2,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=$2(t.getContainer());var n=this;an.bind(this._tooltipRoot,sf,"mousedown",function(i){i.stopPropagation()}),an.bind(this._tooltipRoot,sf,"mouseover",function(i){n.trigger("mouseover",i)}),an.bind(this._tooltipRoot,sf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}tn.$inject=["eventBus","canvas"],tn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=D({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},tn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Gt(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},tn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},tn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},tn.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)}},tn.prototype.remove=function(e){var t=this.get(e);t&&(Xn(t.html),Xn(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},tn.prototype.show=function(){af(this._tooltipRoot)},tn.prototype.hide=function(){af(this._tooltipRoot,!1)},tn.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},tn.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)),nn(n)&&(n=Ke(n)),i=Ke('<div data-tooltip-id="'+t+'" class="'+eb+'">'),Xt(i,{position:"absolute"}),i.appendChild(n),e.type&&Je(i).add("djs-tooltip-"+e.type),e.className&&Je(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},tn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;j2(n,t.x,t.y)},tn.prototype._updateTooltipVisibilty=function(e){T(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),af(i,r))})},tn.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 F2={__init__:["tooltips"],tooltips:["type",tn]};var H2="flow elements must be children of pools/participants",z2="Data object must be placed within a pool/participant.";function tb(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(H2)):y(a,"bpmn:DataObjectReference")&&i(r,n(z2)))})}tb.$inject=["eventBus","tooltips","translate"];const V2={__depends__:[F2],__init__:["modelingFeedback"],modelingFeedback:["type",tb]};var G2=500,W2=1250,U2=1500,Uc=Math.round;function q2(e){return{x:e.x+Uc(e.width/2),y:e.y+Uc(e.height/2)}}function nb(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",U2,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=Y2(l),D(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",W2,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",G2,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=Uc(u.x),u.y=Uc(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(Wi(s)){var c=no(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(At(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Ce(s.target).has("djs-hit-no-move")){var p=q2(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}nb.$inject=["eventBus","dragging","modeling","selection","rules"];function Y2(e){var t=$r(e,"id");return we(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var ib=499,cf="djs-dragging",rb="drop-ok",ob="drop-not-ok",ab="new-parent",sb="attach-ok";function cb(e,t,n,i){function r(c){var u=o(c),l=K2(u);return l}function o(c){var u=Do(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[sb,rb,ob,ab].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,cf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",ib,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=ae("g");ee(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();ve(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=eu([p,o(l)]):p=o(l),T(p,function(m){t.addMarker(m,cf)}),u.allDraggedElements=p,u.differentParents=X2(l)}),e.on("shape.move.move",ib,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,sb):u.canExecute&&f&&p.id!==f.id?a(p,ab):a(p,u.canExecute?rb:ob)),Nt(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;T(l,function(f){t.removeMarker(f,cf)}),p&&wt(p)}),this.makeDraggable=s}cb.$inject=["eventBus","canvas","styles","previewSupport"];function K2(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=we(e,function(i){return Ve(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function X2(e){return t0($r(e,function(t){return t.parent&&t.parent.id}))!==1}const Z2={__depends__:[Bs,Tn,of,ni,yi,so],__init__:["move","movePreview"],move:["type",nb],movePreview:["type",cb]};var ub=".djs-palette-toggle",lb=".entry",Q2=ub+", "+lb,uf="djs-palette-",J2="shown",lf="open",pb="two-column",ek=1e3;function vt(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()})}vt.$inject=["eventBus","canvas"],vt.prototype.registerProvider=function(e,t){t||(t=e,e=ek),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},vt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(nk,{})},vt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},vt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Ke(vt.HTML_MARKUP);n.appendChild(i),Je(n).add(uf+J2),an.bind(i,Q2,"click",function(r){var o=r.delegateTarget;if(Cu(o,ub))return e.toggle();e.trigger("click",r)}),he.bind(i,"mousedown",function(r){r.stopPropagation()}),an.bind(i,lb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},vt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},vt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Je(n),a=Je(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(pb,r),a.toggle(uf+pb,r),"open"in e&&(o.toggle(lf,e.open),a.toggle(uf+lf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},vt.prototype._update=function(){var e=Fe(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Wa(e),T(t,function(n,i){var r=n.group||"default",o=Fe("[data-group="+da(r)+"]",e);o||(o=Ke('<div class="group"></div>'),Gt(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Ke(a);if(o.appendChild(s),!n.separator&&(Gt(s,"data-action",i),n.title&&Gt(s,"title",n.title),n.className&&tk(s,n.className),n.imageUrl)){var c=Ke("<img>");Gt(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},vt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=Gt(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},vt.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(Tt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},vt.prototype._layoutChanged=function(){this._toggleState({})},vt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},vt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},vt.prototype.open=function(){this._toggleState({open:!0})},vt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},vt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},vt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Fe(".djs-palette-entries",this._container),this._toolsContainer=Fe("[data-group=tools]",t)),n=this._toolsContainer,T(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Je(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},vt.prototype.isOpen=function(){return Je(this._container).has(lf)},vt.prototype._getParentContainer=function(){return this._canvas.getContainer()},vt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function tk(e,t){var n=Je(e),i=le(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function nk(e,t){var n=t.getPaletteEntries();return Tt(n)?n(e):(T(n,function(i,r){e[r]=i}),e)}const ik={__init__:["palette"],palette:["type",vt]};var fb="crosshair",db="selected",rk="djs-dragging-active-lasso";function or(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=ae("rect");ee(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ve(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&ee(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,db);for(const g of h)m.has(g)||t.addMarker(g,db)}},remove:function(p){this.update(p),p.frame&&wt(p.frame),u(!1)}};function u(p){Ce(t.getContainer()).toggle(rk,p)}function l(p){var f=i.getAll();return new Set(Br(Vr(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=hb(p),f.add=Ms(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=hb(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(Ms(p))return s.activateLasso(p.originalEvent),!0})}or.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],or.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:fb,data:{context:{}},keepSelection:!0})},or.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:fb,data:{context:{}},keepSelection:!0})},or.prototype._select=function(e){this._selection.select(e)},or.prototype.select=function(e,t,n=[]){var i=Br(Vr(e,t));this._select([...n,...i])},or.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},or.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function hb(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 ok={__depends__:[Hs,Zo],__init__:["lassoTool"],lassoTool:["type",or]};var pf=1500,mb="grab";function bo(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",pf,function(c){if(Yo(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(pf,function(c){if(!(!gb(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(pf,function(c){!gb(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!Yo(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}bo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],bo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:mb,data:{context:n||{}}})},bo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:mb,data:{context:{reactivate:n}}})},bo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},bo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function gb(e){return St("Space",e)}const ak={__depends__:[Hs,Zo],__init__:["handTool"],handTool:["type",bo]};var vb="connect-ok",yb="connect-not-ok";function xo(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?vb:yb))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?vb:yb)}),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})}xo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],xo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},xo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},xo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},xo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const sk={__depends__:[Jp,ni,yi,Hs,Zo],globalConnect:["type",xo]};function ff(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)}ff.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],ff.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(D({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 D(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const ck={__depends__:[ik,js,Wg,ok,ak,sk,Ho],__init__:["paletteProvider"],paletteProvider:["type",ff]};var uk=250;function df(e,t,n,i,r){W.call(this,e);function o(s){var c=s.canExecute.replacements;T(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);D(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=Fe('[data-element-id="'+da(f.id)+'"]',s.dragGroup);h&&ee(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;T(c,function(u,l){var p=Fe('[data-element-id="'+da(l)+'"]',s.dragGroup);p&&ee(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",uk,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}df.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],J(df,W);const lk={__depends__:[so],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",df]};var pk=1250,hf=40,fk=20,dk=10,_b=20,bb=["x","y"],hk=Math.abs;function xb(e){e.on(["connect.hover","connect.move","connect.end"],pk,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&un(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&mk(t,o,_k(o)),o&&yk(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Dn(r),Ee(o,["bpmn:Event","bpmn:Gateway"])&&Eb(t,Dn(o)),Ee(o,["bpmn:Task","bpmn:SubProcess"])&&gk(t,o),y(a,"bpmn:BoundaryEvent")&&s===a.host&&vk(t)):wb(i,"bpmn:MessageFlow")?(y(r,"bpmn:Event")&&(n.connectionStart=Dn(r)),y(o,"bpmn:Event")&&Eb(t,Dn(o))):n.connectionStart=n.initialConnectionStart)})}xb.$inject=["eventBus"];function mk(e,t,n){bb.forEach(function(i){var r=Sb(i,t);e[i]<t[i]+n?gt(e,i,t[i]+n):e[i]>t[i]+r-n&>(e,i,t[i]+r-n)})}function gk(e,t){var n=Dn(t);bb.forEach(function(i){bk(e,t,i)&>(e,i,n[i])})}function vk(e){var t=e.context,n=t.source,i=t.target;if(!xk(t)){var r=Dn(n),o=Lt(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;hk(c-r[s])<hf&&(c>r[s]?u=r[s]+hf:u=r[s]-hf,gt(e,s,u))})}}function Eb(e,t){gt(e,"x",t.x),gt(e,"y",t.y)}function wb(e,t){return e&&e.type===t}function yk(e,t){return Pi(t,function(n){return wb(e,n)})}function Sb(e,t){return e==="x"?t.width:t.height}function _k(e){return y(e,"bpmn:Task")?dk:fk}function bk(e,t,n){return e[n]>t[n]+_b&&e[n]<t[n]+Sb(n,t)-_b}function xk(e){var t=e.hover,n=e.source;return t&&n&&t===n}function ar(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}ar.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},ar.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},ar.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},ar.prototype.getSnapLocations=function(){return this._snapLocations},ar.prototype.setSnapLocations=function(e){this._snapLocations=e},ar.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new qc,n.initDefaults(this._defaultSnaps)),n};function qc(){this._snapValues={}}qc.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)},qc.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&uM(e[n],r[n],i)},qc.prototype.initDefaults=function(e){var t=this;T(e||{},function(n,i){T(n,function(r){t.add(i,r)})})};var Ek=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"],Ek,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&un(r.originalEvent))&&!(_o(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 ar);var o;t.get(i.id)?o=Dn(i,e):o={x:e.x+Dn(i).x,y:e.y+Dn(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}),be(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 T(i,function(r){if(be(r)){be(t)&&e.add("mid",Dn(r));return}if(Ve(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);T(o,function(a){e.add("mid",a)});return}e.add("mid",Dn(r))}),!de(t.x)||!de(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Dn(t)),e},ai.prototype.getSnapTargets=function(e,t){return l_(t).filter(function(n){return!wk(n)})};function wk(e){return!!e.hidden}var Rb=1500;function Eo(e,t){t.invoke(ai,this),e.on(["create.move","create.end"],Rb,Pk),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Rb,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!_o(n)&&Sk(n,o)})}J(Eo,ai),Eo.$inject=["eventBus","injector"],Eo.prototype.initSnap=function(e){var t=ai.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return T(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Pb(o,i,e))}),T(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Pb(o,i,e))}),y(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Eo.prototype.addSnapTargetPoints=function(e,t,n){ai.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);T(i,function(o){(Ck(o)||Rk([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",c_(o)),e.add("bottom-right",u_(o)))});var r=this._elementRegistry;return T(t.incoming,function(o){if(r.get(t.id)){Cb(i,o.source)||e.add("mid",pe(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),T(t.outgoing,function(o){if(r.get(t.id)){Cb(i,o.target)||e.add("mid",pe(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},Eo.prototype.getSnapTargets=function(e,t){return ai.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!y(n,"bpmn:Lane")})};function Sk(e,t){var n=ue(t),i=Hm(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=pe(o),/top/.test(i)?gt(e,"y",n.top-a.y):/bottom/.test(i)&>(e,"y",n.bottom-a.y),/left/.test(i)?gt(e,"x",n.left-a.x):/right/.test(i)&>(e,"x",n.right-a.x)}function Rk(e,t){return e.every(function(n){return y(n,t)})}function Ck(e){return y(e,"bpmn:SubProcess")&&Re(e)?!0:y(e,"bpmn:Participant")}function Pk(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 Cb(e,t){return e.indexOf(t)!==-1}function Pb(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var Ak=1250;function Ta(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],Ak,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&un(i.originalEvent))&&!_o(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),kk(s)&>(i,"x",i.x),Dk(s)&>(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ta.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new ar);var o=Ab(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ta.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return T(r,function(o){e.add("corner",u_(o)),e.add("corner",c_(o))}),e.add("corner",Ab(t,i)),e},Ta.$inject=["eventBus","snapping"],Ta.prototype.getSnapTargets=function(e,t){return l_(t).filter(function(n){return!Tk(n,e)&&!Ve(n)&&!Mk(n)&&!be(n)})};function Ab(e,t){var n=pe(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 Tk(e,t){return e.host===t}function Mk(e){return!!e.hidden}function kk(e){return e==="n"||e==="s"}function Dk(e){return e==="e"||e==="w"}var Ok=7,Ik=1e3;function sr(e){this._canvas=e,this._asyncHide=nu(Jt(this.hide,this),Ik)}sr.$inject=["canvas"],sr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:_o(e,"x"),y:_o(e,"y")};T(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(T(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,Ok),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),T(["x","y"],function(a){var s=o[a];At(s)&>(e,a,s.originValue)})},sr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=ae("path");return ee(n,{d:"M0,0 L0,0"}),Ce(n).add("djs-snap-line"),ve(t,n),{update:function(i){de(i)?e==="horizontal"?ee(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):ee(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):ee(n,{display:"none"})}}},sr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},sr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},sr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},sr.prototype.hide=function(){T(this._snapLines,function(e){e.update()})};const Lk={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",ai],resizeSnapping:["type",Ta],snapping:["type",sr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",xb],createMoveSnapping:["type",Eo]};var Tb=300;function ye(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=Fe(ye.INPUT_SELECTOR,this._container),this._resultsContainer=Fe(ye.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}ye.$inject=["canvas","eventBus","selection","translate"],ye.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:an.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,ye.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,ye.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,ye.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,ye.INPUT_SELECTOR,"keydown",function(n){St("ArrowUp",n)&&n.preventDefault(),St("ArrowDown",n)&&n.preventDefault()}),t(this._container,ye.INPUT_SELECTOR,"keyup",function(n){if(St("Escape",n))return e.close();if(St("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(St("ArrowUp",n))return e._scrollToDirection(!0);if(St("ArrowDown",n))return e._scrollToDirection();St(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},ye.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){an.unbind(e.el,e.type,e.listener)})},ye.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=Fe(ye.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},ye.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},ye.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)}},ye.prototype._clearResults=function(){Wa(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},ye.prototype._getCurrentResult=function(){return Fe(ye.RESULT_SELECTED_SELECTOR,this._resultsContainer)},ye.prototype._createResultNode=function(e,t){var n=Ke(ye.RESULT_HTML);return e.primaryTokens.length>0&&Mb(n,e.primaryTokens,ye.RESULT_PRIMARY_HTML),Mb(n,e.secondaryTokens,ye.RESULT_SECONDARY_HTML),Gt(n,ye.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},ye.prototype.registerProvider=function(e){this._searchProvider=e},ye.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,Je(this._canvas.getContainer()).add("djs-search-open"),Je(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},ye.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,Je(this._canvas.getContainer()).remove("djs-search-open"),Je(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},ye.prototype.toggle=function(){this.isOpen()?this.close():this.open()},ye.prototype.isOpen=function(){return this._open},ye.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Je(t).remove(ye.RESULT_SELECTED_CLASS);var n=Gt(e,ye.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Je(e).add(ye.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Tb}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},ye.prototype._select=function(e){var t=Gt(e,ye.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Tb}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},ye.prototype._getBoxHtml=function(){const e=Ke(ye.BOX_HTML),t=Fe(ye.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Mb(e,t,n){var i=Nk(t),r=Ke(n);r.innerHTML=i,e.appendChild(r)}function Nk(e){var t="";return e.forEach(function(n){var i=$v(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+ye.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}ye.CONTAINER_SELECTOR=".djs-search-container",ye.INPUT_SELECTOR=".djs-search-input input",ye.RESULTS_CONTAINER_SELECTOR=".djs-search-results",ye.RESULT_SELECTOR=".djs-search-result",ye.RESULT_SELECTED_CLASS="djs-search-result-selected",ye.RESULT_SELECTED_SELECTOR="."+ye.RESULT_SELECTED_CLASS,ye.RESULT_ID_ATTRIBUTE="data-result-id",ye.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",ye.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
334
|
+
</svg>`},e2=900;function Sa(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",e2,this)}Sa.$inject=["popupMenu","distributeElements","translate","rules"],Sa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&D(t,this._getEntries(e)),t},Sa.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Sa.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:T_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:T_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const t2={__depends__:[Up,JM],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Bc],distributeElementsMenuProvider:["type",Sa]};var M_="is not a registered action",n2="is already registered";function In(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}In.$inject=["eventBus","injector"],In.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)})},In.prototype.trigger=function(e,t){if(!this._actions[e])throw nf(e,M_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},In.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);M(e,function(i,r){n._registerAction(r,i)})},In.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw nf(e,n2);this._actions[e]=t},In.prototype.unregister=function(e){if(!this.isRegistered(e))throw nf(e,M_);this._actions[e]=void 0},In.prototype.getActions=function(){return Object.keys(this._actions)},In.prototype.isRegistered=function(e){return!!this._actions[e]};function nf(e,t){return new Error(e+" "+t)}const i2={__init__:["editorActions"],editorActions:["type",In]};function $c(e){e.invoke(In,this)}ee($c,In),$c.$inject=["injector"],$c.prototype._registerDefaultActions=function(e){In.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=[],S=h.type;m.length&&(g=we(m,function(E){return!y(E,"bpmn:Lane")}),u.trigger(g,S))}),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(S){return y(S.parent,"bpmn:Collaboration")}):g=n.filter(function(S){return S!==h&&!y(S.parent,"bpmn:SubProcess")}),m=pt(g),f.moveElements(g,{x:-m.x,y:-m.y},h)}),i&&d&&this._registerAction("replaceElement",function(h){d.triggerEntry("replace","click",h)})};const r2={__depends__:[i2],editorActions:["type",$c]};function k_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Ee(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}k_.$inject=["eventBus"];function Dr(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;on(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Dr.$inject=["eventBus","gridSnapping","modeling"],ee(Dr,W),Dr.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},Dr.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},Dr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),D(e,o),e},Dr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),D(e,o),e};var o2=2e3;function D_(e,t){e.on(["spaceTool.move","spaceTool.end"],o2,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)}})}D_.$inject=["eventBus","gridSnapping"];const a2={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Dr],gridSnappingSpaceToolBehavior:["type",D_]};var jc=10;function rf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var s2=1200,c2=800;function nr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",c2,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"],s2,function(o){var a=o.originalEvent;if(!(!r.active||a&&pn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=l2(o,u,e);p&&(l.offset=p);var f=u2(o,u);f&&D(l,f),_o(o,u)||r.snapEvent(o,u,l)})}})}nr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);mt(e,t,i)},nr.prototype.getGridSpacing=function(){return jc},nr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=rf(e,jc);var i,r;return t&&t.min&&(i=t.min,he(i)&&(i=rf(i+n,jc,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,he(r)&&(r=rf(r+n,jc,"floor"),e=Math.min(e,r))),e-=n,e},nr.prototype.isActive=function(){return this.active},nr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},nr.prototype.toggleActive=function(){this.setActive(!this.active)},nr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function u2(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&&(Fc(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&&(Fc(t)?I_(s)?a.x.max=c.left:a.x.min=c.right:O_(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(Fc(t)?I_(s)?a.x.min=u.left:a.x.max=u.right:O_(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function l2(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&he(s[t])||(s||(s=o.snapOffset={}),he(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Fc(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 Fc(e){return e==="x"}function O_(e){return e.indexOf("n")!==-1}function I_(e){return e.indexOf("w")!==-1}const p2={__depends__:[a2],__init__:["gridSnapping"],gridSnapping:["type",nr]};var f2=2e3;function L_(e,t,n){e.on("autoPlace",f2,function(i){var r=i.source,o=fe(r),a=i.shape,s=Ov(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")&&(d2(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}L_.$inject=["eventBus","gridSnapping","elementRegistry"];function d2(e){return e==="x"}var h2=1750;function N_(e,t,n){t.on(["create.start","shape.move.start"],h2,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}))}})}N_.$inject=["canvas","eventBus","gridSnapping"];var m2=3e3;function Hc(e,t,n){W.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],m2,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||g2(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Hc.$inject=["eventBus","gridSnapping","modeling"],ee(Hc,W),Hc.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=_2(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function g2(e){return e.length>3}function v2(e){return e==="h"}function y2(e){return e==="v"}function _2(e,t,n){var i=fi(t,n),r={};return v2(i)&&(r.y=e.snapValue(t.y)),y2(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=D({},t,r),n=D({},n,r)),[t,n]}const b2={__depends__:[p2,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",L_],gridSnappingParticipantBehavior:["type",N_],gridSnappingLayoutConnectionBehavior:["type",Hc]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",k_]};var x2=30,B_=30;function Ra(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 Re(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(y(r,"bpmn:SubProcess"))return Re(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Ra.$inject=["eventBus","interactionEvents"],Ra.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ra.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=kt(e)?{width:x2,height:e.height}:{width:e.width,height:B_};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ra.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:B_}),!0};const E2={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ra]};function zc(e){e.invoke(po,this)}ee(zc,po),zc.$inject=["injector"],zc.prototype.registerBindings=function(e,t){po.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 w2={__depends__:[kp],__init__:["keyboardBindings"],keyboardBindings:["type",zc]};var S2={moveSpeed:1,moveSpeedAccelerated:10},R2=1500,$_="left",j_="up",F_="right",H_="down",C2={ArrowLeft:$_,Left:$_,ArrowUp:j_,Up:j_,ArrowRight:F_,Right:F_,ArrowDown:H_,Down:H_},P2={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 z_(e,t,n,i,r){var o=this;this._config=D({},S2,e||{}),t.addListener(R2,function(a){var s=a.keyEvent,c=C2[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=P2[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}z_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const A2={__depends__:[kp,Tn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",z_]};var V_=10;function Ca(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=yS(l,p,u),c.newBounds=bS(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=oh(p),!T2(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)})}Ca.prototype.canResize=function(e){var t=this._rules,n=jn(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ca.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=D({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,G_(t,o),"resize",{autoActivate:!0,cursor:M2(o),data:{shape:t,context:r}})},Ca.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:V_,height:V_},r=Uh(t,e.childrenBoxPadding),xS(n,t,i,r)},Ca.$inject=["eventBus","rules","modeling","dragging"];function T2(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function G_(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 M2(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 W_="djs-resizing",U_="resize-not-ok",k2=500;function q_(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,W_)),s.width>5&&te(c,{x:s.x,width:s.width}),s.height>5&&te(c,{y:s.y,height:s.height}),o.canExecute?Ce(c).remove(U_):Ce(c).add(U_)}function r(o){var a=o.shape,s=o.frame;s&&wt(o.frame),t.removeMarker(a,W_)}e.on("resize.move",k2,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}q_.$inject=["eventBus","canvas","previewSupport"];var Vc=-6,Gc=8,Wc=20,Pa="djs-resizer",D2=["n","w","s","e","nw","ne","se","sw"];function ir(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&&M(a,en(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}ir.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Wi(o)&&i.activate(o,e,n)}me.bind(t,"mousedown",r),me.bind(t,"touchstart",r)},ir.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=O2(i),a=ae("g");Ce(a).add(Pa),Ce(a).add(Pa+"-"+e.id),Ce(a).add(Pa+"-"+i),ve(r,a);var s=ae("rect");te(s,{x:-Gc/2+o.x,y:-Gc/2+o.y,width:Gc,height:Gc}),Ce(s).add(Pa+"-visual"),ve(a,s);var c=ae("rect");return te(c,{x:-Wc/2+o.x,y:-Wc/2+o.y,width:Wc,height:Wc}),Ce(c).add(Pa+"-hit"),ve(a,c),os(a,t,n),a},ir.prototype.createResizer=function(e,t){var n=G_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},ir.prototype.addResizer=function(e){var t=this;Ve(e)||M(D2,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},ir.prototype.removeResizers=function(){var e=this._getResizersParent();Xa(e)},ir.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},ir.$inject=["eventBus","canvas","selection","resize"];function O2(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Vc:e.indexOf("w")!==-1&&(t.x=Vc),e.indexOf("s")!==-1?t.y=-Vc:e.indexOf("n")!==-1&&(t.y=Vc),t}const Y_={__depends__:[ti,yi,so],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ca],resizePreview:["type",q_],resizeHandles:["type",ir]};var I2=2e3;function Aa(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"],I2,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||Ee(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Aa.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Aa.prototype.activate=function(e){var t=xn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);D(n,i);var r={},o=n.style||{};return D(o,{backgroundColor:null,border:null}),(Ee(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||K_(e))&&D(r,{centerVertically:!0}),Hi(e)&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),y(e,"bpmn:TextAnnotation")&&(D(r,{resizable:!0,autoResize:!0}),D(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),D(n,{options:r,style:o}),n}},Aa.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")||B2(e)){var h=kt(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};D(o,m),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:h?"rotate(-90deg)":null})}if(N2(e)){var g=kt(e),S=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};D(o,S),D(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)"})}(Ee(e,["bpmn:Task","bpmn:CallActivity"])||K_(e))&&(D(o,{width:i.width,height:i.height}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),L2(e)&&(D(o,{width:i.width,x:i.x}),D(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var E=1,b=i.width+2*E;if(n.labelTarget&&(D(o,{width:b,height:i.height+2*E,x:i.x-E,y:i.y-E}),D(d,{fontSize:u+"px",lineHeight:l})),Hi(n)&&!cs(n)&&!be(n)){var x=Gu(e),w=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),A=u,I=br.width*a+2*E;D(o,{width:I,height:A+2*E,x:w.x-I/2,y:w.y-A/2-E}),D(d,{fontSize:u+"px",lineHeight:l})}return y(e,"bpmn:TextAnnotation")&&(D(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}),D(d,{textAlign:"left",paddingTop:Yr*a+"px",paddingBottom:Yr*a+"px",paddingLeft:Yr*a+"px",paddingRight:Yr*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},Aa.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}),$2(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function K_(e){return y(e,"bpmn:SubProcess")&&!Re(e)}function L2(e){return y(e,"bpmn:SubProcess")&&Re(e)}function N2(e){return y(e,"bpmn:Participant")&&!Re(e)}function B2(e){return y(e,"bpmn:Participant")&&Re(e)}function $2(e){return!e||!e.trim()}var X_="djs-element-hidden",Z_="djs-label-hidden";function Q_(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=ae("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=ae("path");te(p,{d:l,strokeWidth:2,stroke:j2(o)}),ve(s,p),ve(r,s),Nt(s,o.x,o.y)}y(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,X_):(y(o,"bpmn:Task")||y(o,"bpmn:CallActivity")||y(o,"bpmn:SubProcess")||y(o,"bpmn:Participant")||y(o,"bpmn:Lane"))&&t.addMarker(o,Z_)}),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}});te(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,X_),t.removeMarker(o,Z_)),o=void 0,a=void 0,s&&(wt(s),s=void 0)})}Q_.$inject=["eventBus","canvas","pathMap"];function j2(e,t){var n=Me(e);return n.get("stroke")||t||"black"}const F2={__depends__:[cp,Y_,w_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Aa],labelEditingPreview:["type",Q_]};var H2=500,z2=1e3;function ri(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){bw(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){M(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],H2,function(o){var a=o.element,s=o.gfx,c=He(".djs-outline",s);c&&i.updateOutline(a,c)})}ri.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=He(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),ve(t,n),this.updateOutline(e,n)),n},ri.prototype._createOutlineGfx=function(){var e=ae("rect");return te(e,D({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},ri.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},ri.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&M(i,function(r){n=n||r.updateOutline(t,e)}),n||te(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},ri.prototype.updateConnectionOutline=function(e,t){var n=pt(t);te(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},ri.prototype.registerProvider=function(e,t){t||(t=e,e=z2),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},ri.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ri.prototype.getOutline=function(e){var t,n=this._getProviders();return M(n,function(i){Tt(i.getOutline)&&(t=t||i.getOutline(e))}),t},ri.$inject=["eventBus","styles","elementRegistry"];var Uc=6;function of(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)})}of.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Xa(t);var n=e.length>1,i=this._canvas.getContainer();if(Ce(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=V2(pt(e)),o=ae("rect");te(o,D({rx:3},r)),Ce(o).add("djs-selection-outline"),ve(t,o)}},of.$inject=["eventBus","canvas","selection"];function V2(e){return{x:e.x-Uc,y:e.y-Uc,width:e.width+Uc*2,height:e.height+Uc*2}}const af={__depends__:[Tn],__init__:["outline","multiSelectionOutline"],outline:["type",ri],multiSelectionOutline:["type",of]},J_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],eb={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},G2=15,qc=2;function tb(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=>Ee(h,J_));if(f.length===1){const h=f[0];be(h)?a(h,h.labelTarget):(d=h.labels)!=null&&d.length&&a(h.labels[0],h)}if(f.length===2){const h=f.find(be),m=f.find(g=>{var S;return(S=g.labels)==null?void 0:S.includes(h)});h&&m&&a(h,m)}}),e.on("shape.changed",function({element:p}){var f;!Ee(p,J_)||!l(p)||(be(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=ko([fe(f),fe(p)],eb),h=d.getAttribute("d"),g=r.isSelected(p)?c(p):u(p),S=Lo(g,h);if(!S)return;const b=r.isSelected(f)?c(f):u(f),x=Lo(b,h)||fe(f);Wo(x,S)<G2||(Nu(d,[x,S]),ve(o,d))}function s(){Ka(`.${eb.class}`,o).forEach(wt)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+rr(f,"x")-qc,y:p.y+rr(f,"y")-qc,width:rr(f,"width")+qc*2,height:rr(f,"height")+qc*2};return Uu(d,rr(f,"rx"))}if(f.cx){const d=rr(f,"r"),h={x:p.x+rr(f,"cx")-d,y:p.y+rr(f,"cy")-d,width:d*2,height:d*2};return Th(h)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}tb.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function rr(e,t){return parseFloat(te(e,t)||0)}const W2={__depends__:[Tn,af],__init__:["labelLink"],labelLink:["type",tb]};var U2=new ao("tt");function q2(e){var t=Ke('<div class="djs-tooltip-container" />');return Xt(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function Y2(e,t,n){Xt(e,{left:t+"px",top:n+"px"})}function sf(e,t){e.style.display=t===!1?"none":""}var nb="djs-tooltip",cf="."+nb;function nn(e,t){this._eventBus=e,this._canvas=t,this._ids=U2,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=q2(t.getContainer());var n=this;cn.bind(this._tooltipRoot,cf,"mousedown",function(i){i.stopPropagation()}),cn.bind(this._tooltipRoot,cf,"mouseover",function(i){n.trigger("mouseover",i)}),cn.bind(this._tooltipRoot,cf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}nn.$inject=["eventBus","canvas"],nn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=D({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},nn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Gt(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},nn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},nn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},nn.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)}},nn.prototype.remove=function(e){var t=this.get(e);t&&(Kn(t.html),Kn(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},nn.prototype.show=function(){sf(this._tooltipRoot)},nn.prototype.hide=function(){sf(this._tooltipRoot,!1)},nn.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},nn.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)),on(n)&&(n=Ke(n)),i=Ke('<div data-tooltip-id="'+t+'" class="'+nb+'">'),Xt(i,{position:"absolute"}),i.appendChild(n),e.type&&Je(i).add("djs-tooltip-"+e.type),e.className&&Je(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},nn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;Y2(n,t.x,t.y)},nn.prototype._updateTooltipVisibilty=function(e){M(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),sf(i,r))})},nn.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 K2={__init__:["tooltips"],tooltips:["type",nn]};var X2="flow elements must be children of pools/participants",Z2="Data object must be placed within a pool/participant.";function ib(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(X2)):y(a,"bpmn:DataObjectReference")&&i(r,n(Z2)))})}ib.$inject=["eventBus","tooltips","translate"];const Q2={__depends__:[K2],__init__:["modelingFeedback"],modelingFeedback:["type",ib]};var J2=500,ek=1250,tk=1500,Yc=Math.round;function nk(e){return{x:e.x+Yc(e.width/2),y:e.y+Yc(e.height/2)}}function rb(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",tk,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=ik(l),D(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",ek,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",J2,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=Yc(u.x),u.y=Yc(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(Wi(s)){var c=no(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(At(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Ce(s.target).has("djs-hit-no-move")){var p=nk(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}rb.$inject=["eventBus","dragging","modeling","selection","rules"];function ik(e){var t=$r(e,"id");return we(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var ob=499,uf="djs-dragging",ab="drop-ok",sb="drop-not-ok",cb="new-parent",ub="attach-ok";function lb(e,t,n,i){function r(c){var u=o(c),l=rk(u);return l}function o(c){var u=Do(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[ub,ab,sb,cb].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,uf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",ob,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=ae("g");te(d,n.cls("djs-drag-group",["no-events"]));var h=t.getActiveLayer();ve(h,d),u.dragGroup=d}f.forEach(function(m){i.addDragger(m,u.dragGroup)}),p?p=iu([p,o(l)]):p=o(l),M(p,function(m){t.addMarker(m,uf)}),u.allDraggedElements=p,u.differentParents=ok(l)}),e.on("shape.move.move",ob,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,ub):u.canExecute&&f&&p.id!==f.id?a(p,cb):a(p,u.canExecute?ab:sb)),Nt(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;M(l,function(f){t.removeMarker(f,uf)}),p&&wt(p)}),this.makeDraggable=s}lb.$inject=["eventBus","canvas","styles","previewSupport"];function rk(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=we(e,function(i){return Ve(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function ok(e){return c0($r(e,function(t){return t.parent&&t.parent.id}))!==1}const ak={__depends__:[js,Tn,af,ti,yi,so],__init__:["move","movePreview"],move:["type",rb],movePreview:["type",lb]};var pb=".djs-palette-toggle",fb=".entry",sk=pb+", "+fb,lf="djs-palette-",ck="shown",pf="open",db="two-column",uk=1e3;function gt(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()})}gt.$inject=["eventBus","canvas"],gt.prototype.registerProvider=function(e,t){t||(t=e,e=uk),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},gt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(pk,{})},gt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},gt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Ke(gt.HTML_MARKUP);n.appendChild(i),Je(n).add(lf+ck),cn.bind(i,sk,"click",function(r){var o=r.delegateTarget;if(Pu(o,pb))return e.toggle();e.trigger("click",r)}),me.bind(i,"mousedown",function(r){r.stopPropagation()}),cn.bind(i,fb,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},gt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},gt.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Je(n),a=Je(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(db,r),a.toggle(lf+db,r),"open"in e&&(o.toggle(pf,e.open),a.toggle(lf+pf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},gt.prototype._update=function(){var e=He(".djs-palette-entries",this._container),t=this._entries=this.getEntries();qa(e),M(t,function(n,i){var r=n.group||"default",o=He("[data-group="+da(r)+"]",e);o||(o=Ke('<div class="group"></div>'),Gt(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Ke(a);if(o.appendChild(s),!n.separator&&(Gt(s,"data-action",i),n.title&&Gt(s,"title",n.title),n.className&&lk(s,n.className),n.imageUrl)){var c=Ke("<img>");Gt(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},gt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=Gt(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},gt.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(Tt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},gt.prototype._layoutChanged=function(){this._toggleState({})},gt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},gt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},gt.prototype.open=function(){this._toggleState({open:!0})},gt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},gt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},gt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=He(".djs-palette-entries",this._container),this._toolsContainer=He("[data-group=tools]",t)),n=this._toolsContainer,M(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Je(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},gt.prototype.isOpen=function(){return Je(this._container).has(pf)},gt.prototype._getParentContainer=function(){return this._canvas.getContainer()},gt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function lk(e,t){var n=Je(e),i=pe(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function pk(e,t){var n=t.getPaletteEntries();return Tt(n)?n(e):(M(n,function(i,r){e[r]=i}),e)}const fk={__init__:["palette"],palette:["type",gt]};var hb="crosshair",mb="selected",dk="djs-dragging-active-lasso";function or(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=ae("rect");te(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ve(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&te(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,mb);for(const g of h)m.has(g)||t.addMarker(g,mb)}},remove:function(p){this.update(p),p.frame&&wt(p.frame),u(!1)}};function u(p){Ce(t.getContainer()).toggle(dk,p)}function l(p){var f=i.getAll();return new Set(Br(Vr(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=gb(p),f.add=Ds(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=gb(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(Ds(p))return s.activateLasso(p.originalEvent),!0})}or.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],or.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:hb,data:{context:{}},keepSelection:!0})},or.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:hb,data:{context:{}},keepSelection:!0})},or.prototype._select=function(e){this._selection.select(e)},or.prototype.select=function(e,t,n=[]){var i=Br(Vr(e,t));this._select([...n,...i])},or.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},or.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function gb(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 hk={__depends__:[Vs,Zo],__init__:["lassoTool"],lassoTool:["type",or]};var ff=1500,vb="grab";function bo(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var a=this,s=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",ff,function(c){if(Yo(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(ff,function(c){if(!(!yb(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(ff,function(c){!yb(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!Yo(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}bo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],bo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:vb,data:{context:n||{}}})},bo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:vb,data:{context:{reactivate:n}}})},bo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},bo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function yb(e){return St("Space",e)}const mk={__depends__:[Vs,Zo],__init__:["handTool"],handTool:["type",bo]};var _b="connect-ok",bb="connect-not-ok";function xo(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?_b:bb))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?_b:bb)}),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})}xo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],xo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},xo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},xo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},xo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const gk={__depends__:[ef,ti,yi,Vs,Zo],globalConnect:["type",xo]};function df(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)}df.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],df.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(S){var E=n.createShape(D({type:p},m));t.start(S,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 D(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(p){o.activateHand(p)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(p){r.activateSelection(p)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(p){i.activateSelection(p)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(p){a.start(p)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const vk={__depends__:[fk,Hs,qg,hk,mk,gk,Ho],__init__:["paletteProvider"],paletteProvider:["type",df]};var yk=250;function hf(e,t,n,i,r){W.call(this,e);function o(s){var c=s.canExecute.replacements;M(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);D(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var h=He('[data-element-id="'+da(f.id)+'"]',s.dragGroup);h&&te(h,{display:"none"});var m=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=m,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;M(c,function(u,l){var p=He('[data-element-id="'+da(l)+'"]',s.dragGroup);p&&te(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",yk,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}hf.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],ee(hf,W);const _k={__depends__:[so],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",hf]};var bk=1250,mf=40,xk=20,Ek=10,xb=20,Eb=["x","y"],wk=Math.abs;function wb(e){e.on(["connect.hover","connect.move","connect.end"],bk,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&pn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&Sk(t,o,Ak(o)),o&&Pk(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=Dn(r),Ee(o,["bpmn:Event","bpmn:Gateway"])&&Sb(t,Dn(o)),Ee(o,["bpmn:Task","bpmn:SubProcess"])&&Rk(t,o),y(a,"bpmn:BoundaryEvent")&&s===a.host&&Ck(t)):Rb(i,"bpmn:MessageFlow")?(y(r,"bpmn:Event")&&(n.connectionStart=Dn(r)),y(o,"bpmn:Event")&&Sb(t,Dn(o))):n.connectionStart=n.initialConnectionStart)})}wb.$inject=["eventBus"];function Sk(e,t,n){Eb.forEach(function(i){var r=Cb(i,t);e[i]<t[i]+n?mt(e,i,t[i]+n):e[i]>t[i]+r-n&&mt(e,i,t[i]+r-n)})}function Rk(e,t){var n=Dn(t);Eb.forEach(function(i){Tk(e,t,i)&&mt(e,i,n[i])})}function Ck(e){var t=e.context,n=t.source,i=t.target;if(!Mk(t)){var r=Dn(n),o=Lt(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;wk(c-r[s])<mf&&(c>r[s]?u=r[s]+mf:u=r[s]-mf,mt(e,s,u))})}}function Sb(e,t){mt(e,"x",t.x),mt(e,"y",t.y)}function Rb(e,t){return e&&e.type===t}function Pk(e,t){return Pi(t,function(n){return Rb(e,n)})}function Cb(e,t){return e==="x"?t.width:t.height}function Ak(e){return y(e,"bpmn:Task")?Ek:xk}function Tk(e,t,n){return e[n]>t[n]+xb&&e[n]<t[n]+Cb(n,t)-xb}function Mk(e){var t=e.hover,n=e.source;return t&&n&&t===n}function ar(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}ar.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},ar.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},ar.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},ar.prototype.getSnapLocations=function(){return this._snapLocations},ar.prototype.setSnapLocations=function(e){this._snapLocations=e},ar.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Kc,n.initDefaults(this._defaultSnaps)),n};function Kc(){this._snapValues={}}Kc.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)},Kc.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&yM(e[n],r[n],i)},Kc.prototype.initDefaults=function(e){var t=this;M(e||{},function(n,i){M(n,function(r){t.add(i,r)})})};var kk=1250;function oi(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"],kk,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&pn(r.originalEvent))&&!(_o(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()})}oi.$inject=["elementRegistry","eventBus","snapping"],oi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new ar);var o;t.get(i.id)?o=Dn(i,e):o={x:e.x+Dn(i).x,y:e.y+Dn(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}),be(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},oi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return M(i,function(r){if(be(r)){be(t)&&e.add("mid",Dn(r));return}if(Ve(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);M(o,function(a){e.add("mid",a)});return}e.add("mid",Dn(r))}),!he(t.x)||!he(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",Dn(t)),e},oi.prototype.getSnapTargets=function(e,t){return f_(t).filter(function(n){return!Dk(n)})};function Dk(e){return!!e.hidden}var Pb=1500;function Eo(e,t){t.invoke(oi,this),e.on(["create.move","create.end"],Pb,Nk),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Pb,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!_o(n)&&Ok(n,o)})}ee(Eo,oi),Eo.$inject=["eventBus","injector"],Eo.prototype.initSnap=function(e){var t=oi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return M(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Tb(o,i,e))}),M(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Tb(o,i,e))}),y(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Eo.prototype.addSnapTargetPoints=function(e,t,n){oi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);M(i,function(o){(Lk(o)||Ik([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",l_(o)),e.add("bottom-right",p_(o)))});var r=this._elementRegistry;return M(t.incoming,function(o){if(r.get(t.id)){Ab(i,o.source)||e.add("mid",fe(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),M(t.outgoing,function(o){if(r.get(t.id)){Ab(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},Eo.prototype.getSnapTargets=function(e,t){return oi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!y(n,"bpmn:Lane")})};function Ok(e,t){var n=ue(t),i=Vm(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=fe(o),/top/.test(i)?mt(e,"y",n.top-a.y):/bottom/.test(i)&&mt(e,"y",n.bottom-a.y),/left/.test(i)?mt(e,"x",n.left-a.x):/right/.test(i)&&mt(e,"x",n.right-a.x)}function Ik(e,t){return e.every(function(n){return y(n,t)})}function Lk(e){return y(e,"bpmn:SubProcess")&&Re(e)?!0:y(e,"bpmn:Participant")}function Nk(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)&&mt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&mt(e,"y",e.y)}}function Ab(e,t){return e.indexOf(t)!==-1}function Tb(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var Bk=1250;function Ta(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],Bk,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&pn(i.originalEvent))&&!_o(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),Fk(s)&&mt(i,"x",i.x),Hk(s)&&mt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ta.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new ar);var o=Mb(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ta.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return M(r,function(o){e.add("corner",p_(o)),e.add("corner",l_(o))}),e.add("corner",Mb(t,i)),e},Ta.$inject=["eventBus","snapping"],Ta.prototype.getSnapTargets=function(e,t){return f_(t).filter(function(n){return!$k(n,e)&&!Ve(n)&&!jk(n)&&!be(n)})};function Mb(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 $k(e,t){return e.host===t}function jk(e){return!!e.hidden}function Fk(e){return e==="n"||e==="s"}function Hk(e){return e==="e"||e==="w"}var zk=7,Vk=1e3;function sr(e){this._canvas=e,this._asyncHide=ou(en(this.hide,this),Vk)}sr.$inject=["canvas"],sr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:_o(e,"x"),y:_o(e,"y")};M(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(M(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,zk),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),M(["x","y"],function(a){var s=o[a];At(s)&&mt(e,a,s.originValue)})},sr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=ae("path");return te(n,{d:"M0,0 L0,0"}),Ce(n).add("djs-snap-line"),ve(t,n),{update:function(i){he(i)?e==="horizontal"?te(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):te(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):te(n,{display:"none"})}}},sr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},sr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},sr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},sr.prototype.hide=function(){M(this._snapLines,function(e){e.update()})};const Gk={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",oi],resizeSnapping:["type",Ta],snapping:["type",sr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",wb],createMoveSnapping:["type",Eo]};var kb=300;function ye(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=He(ye.INPUT_SELECTOR,this._container),this._resultsContainer=He(ye.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}ye.$inject=["canvas","eventBus","selection","translate"],ye.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:cn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,ye.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,ye.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,ye.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,ye.INPUT_SELECTOR,"keydown",function(n){St("ArrowUp",n)&&n.preventDefault(),St("ArrowDown",n)&&n.preventDefault()}),t(this._container,ye.INPUT_SELECTOR,"keyup",function(n){if(St("Escape",n))return e.close();if(St("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(St("ArrowUp",n))return e._scrollToDirection(!0);if(St("ArrowDown",n))return e._scrollToDirection();St(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},ye.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){cn.unbind(e.el,e.type,e.listener)})},ye.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=He(ye.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},ye.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},ye.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)}},ye.prototype._clearResults=function(){qa(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},ye.prototype._getCurrentResult=function(){return He(ye.RESULT_SELECTED_SELECTOR,this._resultsContainer)},ye.prototype._createResultNode=function(e,t){var n=Ke(ye.RESULT_HTML);return e.primaryTokens.length>0&&Db(n,e.primaryTokens,ye.RESULT_PRIMARY_HTML),Db(n,e.secondaryTokens,ye.RESULT_SECONDARY_HTML),Gt(n,ye.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},ye.prototype.registerProvider=function(e){this._searchProvider=e},ye.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,Je(this._canvas.getContainer()).add("djs-search-open"),Je(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},ye.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,Je(this._canvas.getContainer()).remove("djs-search-open"),Je(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},ye.prototype.toggle=function(){this.isOpen()?this.close():this.open()},ye.prototype.isOpen=function(){return this._open},ye.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Je(t).remove(ye.RESULT_SELECTED_CLASS);var n=Gt(e,ye.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Je(e).add(ye.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:kb}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},ye.prototype._select=function(e){var t=Gt(e,ye.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:kb}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},ye.prototype._getBoxHtml=function(){const e=Ke(ye.BOX_HTML),t=He(ye.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Db(e,t,n){var i=Wk(t),r=Ke(n);r.innerHTML=i,e.appendChild(r)}function Wk(e){var t="";return e.forEach(function(n){var i=Fv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+ye.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}ye.CONTAINER_SELECTOR=".djs-search-container",ye.INPUT_SELECTOR=".djs-search-input input",ye.RESULTS_CONTAINER_SELECTOR=".djs-search-results",ye.RESULT_SELECTOR=".djs-search-result",ye.RESULT_SELECTED_CLASS="djs-search-result-selected",ye.RESULT_SELECTED_SELECTOR="."+ye.RESULT_SELECTED_CLASS,ye.RESULT_ID_ATTRIBUTE="data-result-id",ye.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",ye.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
335
335
|
<div class="djs-search-input">
|
|
336
336
|
<svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
337
337
|
<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 +339,4 @@
|
|
|
339
339
|
<input type="text" spellcheck="false" />
|
|
340
340
|
</div>
|
|
341
341
|
<div class="djs-search-results" />
|
|
342
|
-
</div>`,ye.RESULT_HTML='<div class="djs-search-result"></div>',ye.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',ye.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const
|
|
342
|
+
</div>`,ye.RESULT_HTML='<div class="djs-search-result"></div>',ye.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',ye.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const Uk={__depends__:[Ho,pc,Tn],searchPad:["type",ye]};function gf(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}gf.$inject=["elementRegistry","searchPad","canvas","search"],gf.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!be(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:xn(i),id:i.id})),e,{keys:["label","id"]}).map(qk)};function qk(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const Yk={__depends__:[Uk,Gy],__init__:["bpmnSearch"],bpmnSearch:["type",gf]},Kk="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",Xk="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",Zk={width:36,height:50},Qk={width:50,height:50};function Ob(e,t,n){return ae("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const Ln=5;function Xc(e,t){this._styles=t,e.registerProvider(this)}Xc.$inject=["outline","styles"],Xc.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(g1(e))return n=ae("rect"),te(n,D({x:-Ln,y:-Ln,rx:4,width:e.width+Ln*2,height:e.height+Ln*2},t)),n;if(!be(e))return y(e,"bpmn:Gateway")?(n=ae("rect"),D(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),te(n,D({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Ee(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=ae("rect"),te(n,D({x:-Ln,y:-Ln,rx:14,width:e.width+Ln*2,height:e.height+Ln*2},t))):y(e,"bpmn:EndEvent")?(n=ae("circle"),te(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+Ln+1},t))):y(e,"bpmn:Event")?(n=ae("circle"),te(n,D({cx:e.width/2,cy:e.height/2,r:e.width/2+Ln},t))):y(e,"bpmn:DataObjectReference")&&Ib(e,"bpmn:DataObjectReference")?n=Ob(Kk,{x:-6,y:-6},t):y(e,"bpmn:DataStoreReference")&&Ib(e,"bpmn:DataStoreReference")&&(n=Ob(Xk,{x:-6,y:-6},t)),n},Xc.prototype.updateOutline=function(e,t){if(!be(e))return Ee(e,["bpmn:SubProcess","bpmn:Group"])?(te(t,{width:e.width+Ln*2,height:e.height+Ln*2}),!0):!!Ee(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function Ib(e,t){var n;return t==="bpmn:DataObjectReference"?n=Zk:t==="bpmn:DataStoreReference"&&(n=Qk),e.width===n.width&&e.height===n.height}const Jk={__depends__:[af],__init__:["outlineProvider"],outlineProvider:["type",Xc]};var eD='<?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 ai(e){Ur.call(this,e)}ee(ai,Ur),ai.Viewer=er,ai.NavigatedViewer=ha,ai.prototype.createDiagram=function(){return this.importXML(eD)},ai.prototype._interactionModules=[qv,Kv,Qv],ai.prototype._modelingModules=[nM,uc,sM,oM,bM,ef,CM,ZM,Ng,Hs,t2,r2,b2,E2,w2,A2,F2,W2,Rp,Q2,ak,vk,_k,Y_,Gk,Yk,Jk],ai.prototype._modules=[].concat(er.prototype._modules,ai.prototype._interactionModules,ai.prototype._modelingModules);const tD=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(lt.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=lt.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=_u(l);return r("imported",p),{warnings:p}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return lt.onMounted(async()=>{a=new ai({container:o.value,moddleExtensions:$a}),i.xml&&await s(i.xml),r("ready")}),lt.watch(()=>i.xml,u=>{u&&a&&s(u)}),lt.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(lt.openBlock(),lt.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);Q.APPLY_BPMN_OPS_SCHEMA=r0,Q.BPMN_MODDLE_EXTENSIONS=$a,Q.BWL_MODDLE_SCHEMA=bf,Q.BWL_NS=_f,Q.BWL_PREFIX=eu,Q.BWL_SIDES=tu,Q.BpmnModelerView=tD,Q.EDITOR=mE,Q.FLOW_LABEL_INDENT=xu,Q.HEADLESS_BPMN_MODULES=Bv,Q.HEADLESS_TEXT_METRICS=lo,Q.I18N_NS=Nx,Q.I18N_PREFIX=Wf,Q.LABEL_FORK_MARGIN=Eu,Q.MVP_FLOW_NODE_TYPES=ci,Q.SYMBOLIC_OP_KINDS=wf,Q.SYMBOLIC_OP_SCHEMA=Sf,Q.UNDO_EPISODE_COMMAND=nu,Q.applyBpmnOpBatch=Td,Q.applyBpmnOps=Rd,Q.approximateTextWidth=Tp,Q.auditBpmnGeometry=td,Q.auditBpmnGeometryXml=Xx,Q.auditGeometry=Oi,Q.auditTargetsOf=zr,Q.axisSegmentsOf=li,Q.buildBpmnOpBatch=hE,Q.buildRegistryIndex=id,Q.createBpmnEditorController=gE,Q.createBpmnModdle=Uf,Q.createHeadlessBpmnModeler=zA,Q.crossedShapesOf=Di,Q.crossingCost=Ao,Q.describeProcess=Ad,Q.describeProcessXml=dE,Q.edgeCrossCount=Va,Q.edgeCrossingPairsOf=wu,Q.executeAsUndoEpisode=Ef,Q.forwardThreePointCandidates=sd,Q.geometryFindingKey=ki,Q.installHeadlessBpmnDom=Nv,Q.isMvpFlowNodeType=yf,Q.loadBpmnXml=yu,Q.lowerOps=Sd,Q.oppositeOverlapCount=Fx,Q.oppositeOverlapOf=Xf,Q.planCrossPoolRoute=fd,Q.planEdgeRepair=ud,Q.planLabelPlacement=vd,Q.planMiddleSegmentShifts=ad,Q.planOppositeOverlapRepair=md,Q.planSegmentDetours=od,Q.repairIntroducedCrossings=ld,Q.repairIntroducedOppositeOverlaps=gd,Q.repairIntroducedSharedSegmentLabels=yd,Q.rerouteIntroducedCrossPoolEdges=dd,Q.resolverServicesOf=Ed,Q.saveBpmnXml=Bx,Q.sceneCrossingCost=Jf,Q.sceneFromDefinitions=ed,Q.sceneFromRegistry=Fn,Q.sharedSegmentUnderLabel=za,Q.sharedSpansOf=Ha,Q.unreadableOverlapCount=bu,Q.unreadableOverlapOf=Fa,Q.validateOps=xd,Q.warningMessages=_u,Object.defineProperty(Q,Symbol.toStringTag,{value:"Module"})}));
|