@g1cloud/bpmn-modeler-next 5.0.0-alpha.76 → 5.0.0-alpha.77
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/index.d.ts +1 -1
- package/dist/agent/resolver/routeRepair.d.ts +28 -0
- package/dist/bpmn-modeler.js +2340 -2298
- package/dist/bpmn-modeler.umd.cjs +41 -41
- package/package.json +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
(function(se,It){typeof exports=="object"&&typeof module<"u"?It(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],It):(se=typeof globalThis<"u"?globalThis:se||self,It(se.BpmnModeler={},se.Vue))})(this,(function(se,It){"use strict";var $L=Object.defineProperty;var FL=(se,It,Tr)=>It in se?$L(se,It,{enumerable:!0,configurable:!0,writable:!0,value:Tr}):se[It]=Tr;var no=(se,It,Tr)=>FL(se,typeof It!="symbol"?It+"":It,Tr);const Tr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent"],us=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function yd(e){return Tr.includes(e)}function vd(e){return us.includes(e)}const bd="http://g1project.net/spec/bpmn/bwl/1.0",Hu="bwl",zu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],xd={name:"bwl-hints",uri:bd,prefix:Hu,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"}]}]},Gu="bwl.undoEpisode",_d=new WeakSet;function G0(e){_d.has(e)||(e.register(Gu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),_d.add(e))}function wd(e,t){G0(e);const n={run:t};if(e.execute(Gu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Ed=["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"],V0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},W0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},U0={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},Y0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ).",properties:{id:{type:"string"},type:{type:"string",enum:[...us]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},q0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},K0={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},X0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Z0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Q0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},J0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},ew={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},tw={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},nw={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...zu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function fn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const iw={"participant.add":fn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":fn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":fn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":fn("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...us]},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":fn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":fn("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":fn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":fn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":fn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":fn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":fn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":fn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":fn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":fn("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":fn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":fn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":fn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Sd={anyOf:Ed.map(e=>iw[e])},rw={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:W0,irParticipant:U0,irNode:Y0,irFlowCondition:q0,irSequenceFlow:K0,irMessageFlow:X0,irDataStore:Z0,irDataAssociation:Q0,irTextAnnotation:J0,irAssociation:ew,irGroup:tw,bwlPlacement:nw,nullableString:V0,symbolicOp:Sd}};function Vu(e){return Array.prototype.concat.apply([],e)}const Qo=Object.prototype.toString,ow=Object.prototype.hasOwnProperty;function Mr(e){return e===void 0}function Wt(e){return e!==void 0}function io(e){return e==null}function De(e){return Qo.call(e)==="[object Array]"}function Qt(e){return Qo.call(e)==="[object Object]"}function Be(e){return Qo.call(e)==="[object Number]"}function Jt(e){const t=Qo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function An(e){return Qo.call(e)==="[object String]"}function aw(e){if(!De(e))throw new Error("must supply array")}function Tn(e,t){return!io(e)&&ow.call(e,t)}function mt(e,t){const n=ps(t);let i;return F(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Rd(e,t){const n=ps(t);let i=De(e)?-1:void 0;return F(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ye(e,t){const n=ps(t);let i=[];return F(e,function(r,o){n(r,o)&&i.push(r)}),i}function F(e,t){let n,i;if(Mr(e))return;const r=De(e)?pw:lw;for(let o in e)if(Tn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function sw(e,t){if(Mr(e))return[];aw(e);const n=ps(t);return e.filter(function(i,r){return!n(i,r)})}function Mn(e,t,n){return F(e,function(i,r){n=t(n,i,r)}),n}function kr(e,t){return!!Mn(e,function(n,i,r){return n&&t(i,r)},!0)}function Xi(e,t){return!!mt(e,t)}function dn(e,t){let n=[];return F(e,function(i,r){n.push(t(i,r))}),n}function ls(e){return e&&Object.keys(e)||[]}function cw(e){return ls(e).length}function ro(e){return dn(e,t=>t)}function oo(e,t,n={}){return t=Wu(t),F(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Cd(e,...t){e=Wu(e);let n={};return F(t,r=>oo(r,e,n)),dn(n,function(r,o){return r[0]})}const uw=Cd;function di(e,t){t=Wu(t);let n=[];return F(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)}),dn(n,i=>i.v)}function ao(e){return function(t){return kr(e,function(n,i){return t[i]===n})}}function Wu(e){return Jt(e)?e:t=>t[e]}function ps(e){return Jt(e)?e:t=>t===e}function lw(e){return e}function pw(e){return Number(e)}function Uu(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 Sn(e,t){return e.bind(t)}function V(e,...t){return Object.assign(e,...t)}function fw(e,t,n){let i=e;return F(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];Wt(a)&&io(s)&&(s=i[r]=isNaN(+a)?{}:[]),Mr(a)?Mr(n)?delete i[r]:i[r]=n:i=s}),e}function ui(e,t){let n={},i=Object(e);return F(t,function(r){r in i&&(n[r]=e[r])}),n}function hi(e,t){let n={},i=Object(e);return F(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Yu(){}Yu.prototype.get=function(e){return this.$model.properties.get(this,e)},Yu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Pd(e,t){this.model=e,this.properties=t}Pd.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Yu.prototype);F(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}),F(a,Sn(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 dw=V(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Ad=V(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function qu(e,t){var n=Ad[e];return n?n(t):t}function Ku(e){return!!dw[e]}function Td(e){return!!Ad[e]}function hn(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function zn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}zn.prototype.build=function(){return ui(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},zn.prototype.addProperty=function(e,t,n){typeof t=="boolean"&&(n=t,t=void 0),this.addNamedProperty(e,n!==!1);var i=this.properties;t!==void 0?i.splice(t,0,e):i.push(e)},zn.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},zn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=hn(r[0],i),a=hn(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},zn.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},zn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},zn.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},zn.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},zn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},zn.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},zn.prototype.hasProperty=function(e){return this.propertiesByName[e]},zn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(F(e.properties,Sn(function(o){o=V({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Zi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,F(e,Sn(this.registerPackage,this))}Zi.prototype.getPackage=function(e){return this.packageMap[e]},Zi.prototype.getPackages=function(){return this.packages},Zi.prototype.registerPackage=function(e){e=V({},e);var t=this.packageMap;Md(t,e,"prefix"),Md(t,e,"uri"),F(e.types,Sn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Zi.prototype.registerType=function(e,t){e=V({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:V({},e.meta||{})});var n=hn(e.name,t.prefix),i=n.name,r=Object.create(null);F(e.properties,Sn(function(o){var a=hn(o.name,n.prefix),s=a.name;Ku(o.type)||(o.type=hn(o.type,a.prefix).name),V(o,{ns:a,name:s}),r[s]=o},this)),V(e,{ns:n,name:i,propertiesByName:r}),F(e.extends,Sn(function(o){var a=hn(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Zi.prototype.mapTypes=function(e,t,n){var i=Ku(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=hn(c,Ku(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+">");F(i.superClass,n?a:s),t(i,!n),F(i.traits,a)},Zi.prototype.getEffectiveDescriptor=function(e){var t=hn(e),n=new zn(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Zi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Md(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Or(e){this.model=e}Or.prototype.set=function(e,t,n){if(!An(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;hw(n)?i?delete e[r]:delete e.$attrs[Xu(t)]:i?r in e?e[r]=n:kd(e,i,n):e.$attrs[Xu(t)]=n},Or.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Xu(t)];var i=n.name;return!e[i]&&n.isMany&&kd(e,n,[]),e[i]},Or.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=V({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Or.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Or.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Or.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 hw(e){return typeof e>"u"}function kd(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Xu(e){return e.replace(/^:/,"")}function Xn(e,t={}){this.properties=new Or(this),this.factory=new Pd(this,this.properties),this.registry=new Zi(e,this.properties),this.typeCache=Object.create(null),this.config=t}Xn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Xn.prototype.getType=function(e){var t=this.typeCache,n=An(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Xn.prototype.createAny=function(e,t,n){var i=hn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){fw(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}),F(n,function(a,s){Qt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Xn.prototype.getPackage=function(e){return this.registry.getPackage(e)},Xn.prototype.getPackages=function(){return this.registry.getPackages()},Xn.prototype.getElementDescriptor=function(e){return e.$descriptor},Xn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Xn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Xn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Od=String.fromCharCode,mw=Object.prototype.hasOwnProperty,gw=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Jo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Jo).forEach(function(e){Jo[e.toUpperCase()]=Jo[e]});function yw(e,t,n,i){return i?mw.call(Jo,i)?Jo[i]:"&"+i+";":Od(t||parseInt(n,16))}function Dr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(gw,yw):e}var Dd="non-whitespace outside of root node";function Qi(e){return new Error(e)}function vw(e){return"missing namespace for prefix <"+e+">"}function fs(e){return{get:e,enumerable:!0}}function bw(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Ld=Symbol("nameCache");function Zu(e){return e+"$uri"}function xw(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Zu(i)]=n;return t}function ds(){return{line:0,column:0}}function _w(e){throw e}function Id(e){if(!this)return new Id(e);var t=e&&e.proxy,n,i,r,o,a=_w,s,c,u,l,p=ds,f=!1,d=!1,m="",h=!1,b=!1,y=null,g=!1,v,x,C,T;function k(L){L instanceof Error||(L=Qi(L)),y=L,a(L,p)}function A(L){s&&(L instanceof Error||(L=Qi(L)),s(L,p))}this.on=function(L,z){if(typeof z!="function")throw Qi("required args <name, cb>");switch(L){case"openTag":i=z;break;case"text":n=z;break;case"closeTag":r=z;break;case"error":a=z;break;case"warn":s=z;break;case"cdata":o=z;break;case"attention":l=z;break;case"question":u=z;break;case"comment":c=z;break;default:throw Qi("unsupported event: "+L)}return this},this.ns=function(L){if(typeof L>"u"&&(L={}),typeof L!="object")throw Qi("required args <nsMap={}>");var z=Object.create(null),ie;for(ie in L)z[ie]=L[ie];return b=!0,T=z,this};function B(){v=b?[]:null,x=b?xw(T):null,C=[],p=ds,g=!1,y=null,d=!1,m=""}this.parse=function(L){if(typeof L!="string")throw Qi("required args <xml=string>");if(f)throw Qi("parse during stream; call end() first");return B(),D(L),p=ds,g=!1,y},this.write=function(L){if(typeof L!="string")throw Qi("required args <xml=string>");return f||(B(),f=!0),y||(m=D(m+L,!0)||""),this},this.end=function(){return f||B(),f=!1,y||D(m),m="",p=ds,g=!1,y},this.stop=function(){g=!0};function D(L,z=!1){var ie=null,ge=null,Ue,je=0,K=!1,pe=!1,ce=0,ye=0,Te,W,Y,te,Ae,gt,M,E,w,G="",U=0,X;function Ee(lt,zt){var nn=lt.indexOf(":");if(nn===-1)return lt;var rn=x[lt.substring(0,nn)];return rn?zt===rn?lt.substr(nn+1):rn+lt.substr(nn):(A(vw(lt.substring(0,nn))),null)}function He(){if(X!==null)return X;var lt,zt,nn=b&&x.xmlns,rn=b&&h?[]:null,vt=U,At=G,vn=At.length,Ar,jn,Mi,Hn,Dt,Kn={},Iu=new Set,Gt,Ze,at;e:for(;vt<vn;vt++)if(Gt=!1,Ze=At.charCodeAt(vt),!(Ze===32||Ze<14&&Ze>8)){for((Ze<65||Ze>122||Ze>90&&Ze<97)&&Ze!==95&&Ze!==58&&(A("illegal first char attribute name"),Gt=!0),at=vt+1;at<vn;at++)if(Ze=At.charCodeAt(at),!(Ze>96&&Ze<123||Ze>64&&Ze<91||Ze>47&&Ze<59||Ze===46||Ze===45||Ze===95)){if(Ze===32||Ze<14&&Ze>8){A("missing attribute value"),vt=at;continue e}if(Ze===61)break;A("illegal attribute name char"),Gt=!0}if(Dt=At.substring(vt,at),Dt==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),Gt=!0),Ze=At.charCodeAt(at+1),Ze===34)at=At.indexOf('"',vt=at+2),at===-1&&(at=At.indexOf("'",vt),at!==-1&&(A("attribute value quote missmatch"),Gt=!0));else if(Ze===39)at=At.indexOf("'",vt=at+2),at===-1&&(at=At.indexOf('"',vt),at!==-1&&(A("attribute value quote missmatch"),Gt=!0));else for(A("missing attribute value quotes"),Gt=!0,at=at+1;at<vn&&(Ze=At.charCodeAt(at+1),!(Ze===32||Ze<14&&Ze>8));at++);for(at===-1&&(A("missing closing quotes"),at=vn,Gt=!0),Gt||(Mi=At.substring(vt,at)),vt=at;at+1<vn&&(Ze=At.charCodeAt(at+1),!(Ze===32||Ze<14&&Ze>8));at++)vt===at&&(A("illegal character after attribute end"),Gt=!0);if(vt=at+1,Gt)continue e;if(Iu.has(Dt)){A("attribute <"+Dt+"> already defined");continue}if(Iu.add(Dt),!b){Kn[Dt]=Mi;continue}if(h){if(jn=Dt==="xmlns"?"xmlns":Dt.charCodeAt(0)===120&&Dt.substr(0,6)==="xmlns:"?Dt.substr(6):null,jn!==null){if(lt=Dr(Mi),zt=Zu(jn),Hn=T[lt],!Hn){if(jn==="xmlns"||zt in x&&x[zt]!==lt)do Hn="ns"+je++;while(typeof x[Hn]<"u");else Hn=jn;T[lt]=Hn}x[jn]!==Hn&&(Ar||(x=bw(x),Ar=!0),x[jn]=Hn,jn==="xmlns"&&(x[Zu(Hn)]=lt,nn=Hn),x[zt]=lt),Kn[Dt]=Mi;continue}rn.push(Dt,Mi);continue}Dt=Ee(Dt,nn),Dt!==null&&(Kn[Dt]=Mi)}if(h)for(vt=0,vn=rn.length;vt<vn;vt++)Dt=Ee(rn[vt++],nn),Mi=rn[vt],Dt!==null&&(Kn[Dt]=Mi);return X=Kn}function it(){for(var lt=/(\r\n|\r|\n)/g,zt=0,nn=0,rn=0,vt=ye,At,vn;ce>=rn&&(At=lt.exec(L),!(!At||(vt=At[0].length+At.index,vt>ce)));)zt+=1,rn=vt;return ce==-1?(nn=vt,vn=L.substring(ye)):ye===0?vn=L.substring(ye,ce):(nn=ce-rn,vn=ye==-1?L.substring(ce):L.substring(ce,ye+1)),{data:vn,line:zt,column:nn}}for(p=it,t&&(w=Object.create({},{name:fs(function(){return M}),originalName:fs(function(){return E}),attrs:fs(He),ns:fs(function(){return x})}));ye!==-1;){if(L.charCodeAt(ye)===60?ce=ye:ce=L.indexOf("<",ye),ce===-1){if(z)return L.substring(ye);if(C.length)return k("unexpected end of file");if(!d)return k("missing start tag");ye<L.length&&L.substring(ye).trim()&&A(Dd);return}if(d||(d=!0),ye!==ce){if(C.length){if(n&&(n(L.substring(ye,ce),Dr,p),g))return}else if(L.substring(ye,ce).trim()&&(A(Dd),g))return}if(te=L.charCodeAt(ce+1),te===33){if(Y=L.charCodeAt(ce+2),Y===91&&L.substr(ce+3,6)==="CDATA["){if(ye=L.indexOf("]]>",ce),ye===-1)return z?L.substring(ce):k("unclosed cdata");if(o&&(o(L.substring(ce+9,ye),p),g))return;ye+=3;continue}if(Y===45&&L.charCodeAt(ce+3)===45){if(ye=L.indexOf("-->",ce),ye===-1)return z?L.substring(ce):k("unclosed comment");if(c&&(c(L.substring(ce+4,ye),Dr,p),g))return;ye+=3;continue}}if(te===63){if(ye=L.indexOf("?>",ce),ye===-1)return z?L.substring(ce):k("unclosed question");if(u&&(u(L.substring(ce,ye+2),p),g))return;ye+=2;continue}for(Te=ce+1;;Te++){if(Ae=L.charCodeAt(Te),isNaN(Ae))return z?L.substring(ce):(ye=-1,k("unclosed tag"));if(Ae===34)Y=L.indexOf('"',Te+1),Te=Y!==-1?Y:Te;else if(Ae===39)Y=L.indexOf("'",Te+1),Te=Y!==-1?Y:Te;else if(Ae===62){ye=Te;break}}if(te===33){if(l&&(l(L.substring(ce,ye+1),Dr,p),g))return;ye+=1;continue}if(X={},te===47){if(K=!1,pe=!0,!C.length)return k("missing open tag");if(Te=M=C.pop(),Y=ce+2+Te.length,L.substring(ce+2,Y)!==Te)return k("closing tag mismatch");for(;Y<ye;Y++)if(te=L.charCodeAt(Y),!(te===32||te>8&&te<14))return k("close tag")}else{if(L.charCodeAt(ye-1)===47?(Te=M=L.substring(ce+1,ye-1),K=!0,pe=!0):(Te=M=L.substring(ce+1,ye),K=!0,pe=!1),!(te>96&&te<123||te>64&&te<91||te===95||te===58))return k("illegal first char nodeName");for(Y=1,W=Te.length;Y<W;Y++)if(te=Te.charCodeAt(Y),!(te>96&&te<123||te>64&&te<91||te>47&&te<59||te===45||te===95||te==46)){if(te===32||te<14&&te>8){M=Te.substring(0,Y),X=null;break}return k("invalid nodeName")}pe||C.push(M)}if(b){Ue=x,K&&(pe||v.push(Ue),X===null&&(h=Te.indexOf("xmlns",Y)!==-1)&&(U=Y,G=Te,He(),h=!1)),E=M,ge!==x&&(ie=x[Ld],ie===void 0&&(ie=x[Ld]=Object.create(null)),ge=x);var Pt=ie[M];if(Pt!==void 0)M=Pt;else{if(te=M.indexOf(":"),te!==-1){if(gt=x[M.substring(0,te)],!gt)return k("missing namespace on <"+E+">");M=M.substr(te+1)}else gt=x.xmlns;gt&&(M=gt+":"+M),ie[E]=M}}if(K&&(U=Y,G=Te,i&&(t?i(w,Dr,pe,p):i(M,He,Dr,pe,p),g)))return;if(pe){if(r&&(r(t?w:M,Dr,K,p),g))return;b&&(K?x=Ue:x=v.pop())}ye+=1}}}function Bd(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Qu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Nd="property";function $d(e){return e.xml&&e.xml.serialize}function ww(e){const t=$d(e);return t!==Nd&&(t||null)}function Ew(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Fd(e,t){return Bd(t)?e.prefix+":"+Ew(e.localName):e.name}function Sw(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 Rw(e,t,n){const i=hn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=hn(r);var a=n.getPackage(o.prefix);return Sw(o,a)}function Ji(e){return new Error(e)}function ki(e){return e.$descriptor}function Cw(e){V(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Ji("expected element");var n=this.elementsById,i=ki(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Ji("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function ea(){}ea.prototype.handleEnd=function(){},ea.prototype.handleText=function(){},ea.prototype.handleNode=function(){};function Ju(){}Ju.prototype=Object.create(ea.prototype),Ju.prototype.handleNode=function(){return this};function so(){}so.prototype=Object.create(ea.prototype),so.prototype.handleText=function(e){this.body=(this.body||"")+e};function ta(e,t){this.property=e,this.context=t}ta.prototype=Object.create(so.prototype),ta.prototype.handleNode=function(e){if(this.element)throw Ji("expected no sub nodes");return this.element=this.createReference(e),this},ta.prototype.handleEnd=function(){this.element.id=this.body},ta.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function el(e,t){this.element=t,this.propertyDesc=e}el.prototype=Object.create(so.prototype),el.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=qu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function hs(){}hs.prototype=Object.create(so.prototype),hs.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function bn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}bn.prototype=Object.create(hs.prototype),bn.prototype.addReference=function(e){this.context.addReference(e)},bn.prototype.handleText=function(e){var t=this.element,n=ki(t),i=n.bodyProperty;if(!i)throw Ji("unexpected body text <"+e+">");so.prototype.handleText.call(this,e)},bn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=ki(t),i=n.bodyProperty;i&&e!==void 0&&(e=qu(i.type,e),t.set(i.name,e))},bn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=ki(n),r=this.context,o=new n({}),a=this.model,s;return F(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),F(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=qu(l.type,c):u==="xmlns"?u=":"+u:(s=hn(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},bn.prototype.getPropertyForNode=function(e){var t=e.name,n=hn(t),i=this.type,r=this.model,o=ki(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=ww(s);if(u){const l=e.attributes[u];if(l){const p=Rw(l,e.ns,r),f=r.getType(p);return V({},s,{effectiveType:ki(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Fd(n,c),l=r.getType(u);if(s=mt(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return V({},s,{effectiveType:ki(l).name})}else if(s=mt(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Ji("unrecognized element <"+n.name+">")},bn.prototype.toString=function(){return"ElementDescriptor["+ki(this.type).name+"]"},bn.prototype.valueHandler=function(e,t){return new el(e,t)},bn.prototype.referenceHandler=function(e){return new ta(e,this.context)},bn.prototype.handler=function(e){return e==="Element"?new co(this.model,e,this.context):new bn(this.model,e,this.context)},bn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Td(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(V(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function tl(e,t,n){bn.call(this,e,t,n)}tl.prototype=Object.create(bn.prototype),tl.prototype.createElement=function(e){var t=e.name,n=hn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Fd(n,o)||t;if(!r.hasType(a))throw Ji("unexpected element <"+e.originalName+">");return bn.prototype.createElement.call(this,e)};function co(e,t,n){this.model=e,this.context=n}co.prototype=Object.create(hs.prototype),co.prototype.createElement=function(e){var t=e.name,n=hn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},co.prototype.handleChild=function(e){var t=new co(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},co.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function nl(e){e instanceof Xn&&(e={model:e}),V(this,{lax:!1},e)}nl.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof bn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new Cw(V({},t,{rootHandler:i})),s=new Id({proxy:!0}),c=Pw();i.context=a,c.push(i);function u(C,T,k){var A=T(),B=A.line,D=A.column,L=A.data;L.charAt(0)==="<"&&L.indexOf(" ")!==-1&&(L=L.slice(0,L.indexOf(" "))+">");var z="unparsable content "+(L?L+" ":"")+`detected
|
|
1
|
+
(function(ae,Nt){typeof exports=="object"&&typeof module<"u"?Nt(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Nt):(ae=typeof globalThis<"u"?globalThis:ae||self,Nt(ae.BpmnModeler={},ae.Vue))})(this,(function(ae,Nt){"use strict";var jL=Object.defineProperty;var HL=(ae,Nt,Mr)=>Nt in ae?jL(ae,Nt,{enumerable:!0,configurable:!0,writable:!0,value:Mr}):ae[Nt]=Mr;var no=(ae,Nt,Mr)=>HL(ae,typeof Nt!="symbol"?Nt+"":Nt,Mr);const Mr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent"],us=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function yd(e){return Mr.includes(e)}function vd(e){return us.includes(e)}const bd="http://g1project.net/spec/bpmn/bwl/1.0",Hu="bwl",zu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],xd={name:"bwl-hints",uri:bd,prefix:Hu,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"}]}]},Gu="bwl.undoEpisode",_d=new WeakSet;function V0(e){_d.has(e)||(e.register(Gu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),_d.add(e))}function wd(e,t){V0(e);const n={run:t};if(e.execute(Gu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const Ed=["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"],W0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},U0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},Y0={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},q0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ).",properties:{id:{type:"string"},type:{type:"string",enum:[...us]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},K0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},X0={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},Z0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},Q0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},J0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},ew={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},tw={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},nw={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},iw={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...zu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function fn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const rw={"participant.add":fn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":fn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":fn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":fn("node.update",{description:"노드 이름/레인/타입/밴드 갱신. lane = 레인 재배정(이동), type = 태스크·이벤트 타입 전환, band = 행 재지정. 🔴 **기존 문서에서 band 는 「몇 번째 갈래」가 아니라 그 컨테이너의 행 번호**다(describe 의 hints.bands 가 보여 주는 값) — 신규 배치의 band 가 대칭으로 펴지는 것과 다르다. 간선이 도형을 가로지르거나 반대 방향으로 겹칠 때 그 노드를 다른 행으로 옮기는 채널이다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lane:{type:"string"},type:{type:"string",enum:[...us]},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":fn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":fn("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":fn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":fn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":fn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":fn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":fn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":fn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":fn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":fn("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":fn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":fn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":fn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},Sd={anyOf:Ed.map(e=>rw[e])},ow={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:U0,irParticipant:Y0,irNode:q0,irFlowCondition:K0,irSequenceFlow:X0,irMessageFlow:Z0,irDataStore:Q0,irDataAssociation:J0,irTextAnnotation:ew,irAssociation:tw,irGroup:nw,bwlPlacement:iw,nullableString:W0,symbolicOp:Sd}};function Vu(e){return Array.prototype.concat.apply([],e)}const Qo=Object.prototype.toString,aw=Object.prototype.hasOwnProperty;function Tr(e){return e===void 0}function Yt(e){return e!==void 0}function io(e){return e==null}function De(e){return Qo.call(e)==="[object Array]"}function Qt(e){return Qo.call(e)==="[object Object]"}function Be(e){return Qo.call(e)==="[object Number]"}function Jt(e){const t=Qo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function An(e){return Qo.call(e)==="[object String]"}function sw(e){if(!De(e))throw new Error("must supply array")}function Mn(e,t){return!io(e)&&aw.call(e,t)}function mt(e,t){const n=ps(t);let i;return F(e,function(r,o){if(n(r,o))return i=r,!1}),i}function Rd(e,t){const n=ps(t);let i=De(e)?-1:void 0;return F(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ye(e,t){const n=ps(t);let i=[];return F(e,function(r,o){n(r,o)&&i.push(r)}),i}function F(e,t){let n,i;if(Tr(e))return;const r=De(e)?fw:pw;for(let o in e)if(Mn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function cw(e,t){if(Tr(e))return[];sw(e);const n=ps(t);return e.filter(function(i,r){return!n(i,r)})}function Tn(e,t,n){return F(e,function(i,r){n=t(n,i,r)}),n}function kr(e,t){return!!Tn(e,function(n,i,r){return n&&t(i,r)},!0)}function Xi(e,t){return!!mt(e,t)}function dn(e,t){let n=[];return F(e,function(i,r){n.push(t(i,r))}),n}function ls(e){return e&&Object.keys(e)||[]}function uw(e){return ls(e).length}function ro(e){return dn(e,t=>t)}function oo(e,t,n={}){return t=Wu(t),F(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Cd(e,...t){e=Wu(e);let n={};return F(t,r=>oo(r,e,n)),dn(n,function(r,o){return r[0]})}const lw=Cd;function di(e,t){t=Wu(t);let n=[];return F(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)}),dn(n,i=>i.v)}function ao(e){return function(t){return kr(e,function(n,i){return t[i]===n})}}function Wu(e){return Jt(e)?e:t=>t[e]}function ps(e){return Jt(e)?e:t=>t===e}function pw(e){return e}function fw(e){return Number(e)}function Uu(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 Sn(e,t){return e.bind(t)}function V(e,...t){return Object.assign(e,...t)}function dw(e,t,n){let i=e;return F(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];Yt(a)&&io(s)&&(s=i[r]=isNaN(+a)?{}:[]),Tr(a)?Tr(n)?delete i[r]:i[r]=n:i=s}),e}function ui(e,t){let n={},i=Object(e);return F(t,function(r){r in i&&(n[r]=e[r])}),n}function hi(e,t){let n={},i=Object(e);return F(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Yu(){}Yu.prototype.get=function(e){return this.$model.properties.get(this,e)},Yu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Pd(e,t){this.model=e,this.properties=t}Pd.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Yu.prototype);F(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}),F(a,Sn(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 hw=V(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Ad=V(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function qu(e,t){var n=Ad[e];return n?n(t):t}function Ku(e){return!!hw[e]}function Md(e){return!!Ad[e]}function hn(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function zn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}zn.prototype.build=function(){return ui(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},zn.prototype.addProperty=function(e,t,n){typeof t=="boolean"&&(n=t,t=void 0),this.addNamedProperty(e,n!==!1);var i=this.properties;t!==void 0?i.splice(t,0,e):i.push(e)},zn.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(s===-1)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},zn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=hn(r[0],i),a=hn(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},zn.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},zn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},zn.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},zn.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},zn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},zn.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},zn.prototype.hasProperty=function(e){return this.propertiesByName[e]},zn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(F(e.properties,Sn(function(o){o=V({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Zi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,F(e,Sn(this.registerPackage,this))}Zi.prototype.getPackage=function(e){return this.packageMap[e]},Zi.prototype.getPackages=function(){return this.packages},Zi.prototype.registerPackage=function(e){e=V({},e);var t=this.packageMap;Td(t,e,"prefix"),Td(t,e,"uri"),F(e.types,Sn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Zi.prototype.registerType=function(e,t){e=V({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:V({},e.meta||{})});var n=hn(e.name,t.prefix),i=n.name,r=Object.create(null);F(e.properties,Sn(function(o){var a=hn(o.name,n.prefix),s=a.name;Ku(o.type)||(o.type=hn(o.type,a.prefix).name),V(o,{ns:a,name:s}),r[s]=o},this)),V(e,{ns:n,name:i,propertiesByName:r}),F(e.extends,Sn(function(o){var a=hn(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Zi.prototype.mapTypes=function(e,t,n){var i=Ku(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=hn(c,Ku(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+">");F(i.superClass,n?a:s),t(i,!n),F(i.traits,a)},Zi.prototype.getEffectiveDescriptor=function(e){var t=hn(e),n=new zn(t);this.mapTypes(t,function(r,o){n.addTrait(r,o)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},Zi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Td(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Or(e){this.model=e}Or.prototype.set=function(e,t,n){if(!An(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;mw(n)?i?delete e[r]:delete e.$attrs[Xu(t)]:i?r in e?e[r]=n:kd(e,i,n):e.$attrs[Xu(t)]=n},Or.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Xu(t)];var i=n.name;return!e[i]&&n.isMany&&kd(e,n,[]),e[i]},Or.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=V({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Or.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Or.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Or.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 mw(e){return typeof e>"u"}function kd(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Xu(e){return e.replace(/^:/,"")}function Xn(e,t={}){this.properties=new Or(this),this.factory=new Pd(this,this.properties),this.registry=new Zi(e,this.properties),this.typeCache=Object.create(null),this.config=t}Xn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Xn.prototype.getType=function(e){var t=this.typeCache,n=An(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Xn.prototype.createAny=function(e,t,n){var i=hn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){dw(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}),F(n,function(a,s){Qt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Xn.prototype.getPackage=function(e){return this.registry.getPackage(e)},Xn.prototype.getPackages=function(){return this.registry.getPackages()},Xn.prototype.getElementDescriptor=function(e){return e.$descriptor},Xn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Xn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Xn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Od=String.fromCharCode,gw=Object.prototype.hasOwnProperty,yw=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Jo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Jo).forEach(function(e){Jo[e.toUpperCase()]=Jo[e]});function vw(e,t,n,i){return i?gw.call(Jo,i)?Jo[i]:"&"+i+";":Od(t||parseInt(n,16))}function Dr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(yw,vw):e}var Dd="non-whitespace outside of root node";function Qi(e){return new Error(e)}function bw(e){return"missing namespace for prefix <"+e+">"}function fs(e){return{get:e,enumerable:!0}}function xw(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Ld=Symbol("nameCache");function Zu(e){return e+"$uri"}function _w(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Zu(i)]=n;return t}function ds(){return{line:0,column:0}}function ww(e){throw e}function Id(e){if(!this)return new Id(e);var t=e&&e.proxy,n,i,r,o,a=ww,s,c,u,l,p=ds,f=!1,d=!1,m="",h=!1,v=!1,y=null,g=!1,b,x,C,M;function k(L){L instanceof Error||(L=Qi(L)),y=L,a(L,p)}function A(L){s&&(L instanceof Error||(L=Qi(L)),s(L,p))}this.on=function(L,z){if(typeof z!="function")throw Qi("required args <name, cb>");switch(L){case"openTag":i=z;break;case"text":n=z;break;case"closeTag":r=z;break;case"error":a=z;break;case"warn":s=z;break;case"cdata":o=z;break;case"attention":l=z;break;case"question":u=z;break;case"comment":c=z;break;default:throw Qi("unsupported event: "+L)}return this},this.ns=function(L){if(typeof L>"u"&&(L={}),typeof L!="object")throw Qi("required args <nsMap={}>");var z=Object.create(null),ie;for(ie in L)z[ie]=L[ie];return v=!0,M=z,this};function B(){b=v?[]:null,x=v?_w(M):null,C=[],p=ds,g=!1,y=null,d=!1,m=""}this.parse=function(L){if(typeof L!="string")throw Qi("required args <xml=string>");if(f)throw Qi("parse during stream; call end() first");return B(),D(L),p=ds,g=!1,y},this.write=function(L){if(typeof L!="string")throw Qi("required args <xml=string>");return f||(B(),f=!0),y||(m=D(m+L,!0)||""),this},this.end=function(){return f||B(),f=!1,y||D(m),m="",p=ds,g=!1,y},this.stop=function(){g=!0};function D(L,z=!1){var ie=null,ge=null,Ue,je=0,K=!1,pe=!1,ce=0,ye=0,Me,W,Y,te,Ae,gt,T,E,w,G="",U=0,X;function Ee(lt,Vt){var nn=lt.indexOf(":");if(nn===-1)return lt;var rn=x[lt.substring(0,nn)];return rn?Vt===rn?lt.substr(nn+1):rn+lt.substr(nn):(A(bw(lt.substring(0,nn))),null)}function He(){if(X!==null)return X;var lt,Vt,nn=v&&x.xmlns,rn=v&&h?[]:null,vt=U,Mt=G,vn=Mt.length,Ar,jn,Ti,Hn,It,Kn={},Iu=new Set,Wt,Ze,at;e:for(;vt<vn;vt++)if(Wt=!1,Ze=Mt.charCodeAt(vt),!(Ze===32||Ze<14&&Ze>8)){for((Ze<65||Ze>122||Ze>90&&Ze<97)&&Ze!==95&&Ze!==58&&(A("illegal first char attribute name"),Wt=!0),at=vt+1;at<vn;at++)if(Ze=Mt.charCodeAt(at),!(Ze>96&&Ze<123||Ze>64&&Ze<91||Ze>47&&Ze<59||Ze===46||Ze===45||Ze===95)){if(Ze===32||Ze<14&&Ze>8){A("missing attribute value"),vt=at;continue e}if(Ze===61)break;A("illegal attribute name char"),Wt=!0}if(It=Mt.substring(vt,at),It==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),Wt=!0),Ze=Mt.charCodeAt(at+1),Ze===34)at=Mt.indexOf('"',vt=at+2),at===-1&&(at=Mt.indexOf("'",vt),at!==-1&&(A("attribute value quote missmatch"),Wt=!0));else if(Ze===39)at=Mt.indexOf("'",vt=at+2),at===-1&&(at=Mt.indexOf('"',vt),at!==-1&&(A("attribute value quote missmatch"),Wt=!0));else for(A("missing attribute value quotes"),Wt=!0,at=at+1;at<vn&&(Ze=Mt.charCodeAt(at+1),!(Ze===32||Ze<14&&Ze>8));at++);for(at===-1&&(A("missing closing quotes"),at=vn,Wt=!0),Wt||(Ti=Mt.substring(vt,at)),vt=at;at+1<vn&&(Ze=Mt.charCodeAt(at+1),!(Ze===32||Ze<14&&Ze>8));at++)vt===at&&(A("illegal character after attribute end"),Wt=!0);if(vt=at+1,Wt)continue e;if(Iu.has(It)){A("attribute <"+It+"> already defined");continue}if(Iu.add(It),!v){Kn[It]=Ti;continue}if(h){if(jn=It==="xmlns"?"xmlns":It.charCodeAt(0)===120&&It.substr(0,6)==="xmlns:"?It.substr(6):null,jn!==null){if(lt=Dr(Ti),Vt=Zu(jn),Hn=M[lt],!Hn){if(jn==="xmlns"||Vt in x&&x[Vt]!==lt)do Hn="ns"+je++;while(typeof x[Hn]<"u");else Hn=jn;M[lt]=Hn}x[jn]!==Hn&&(Ar||(x=xw(x),Ar=!0),x[jn]=Hn,jn==="xmlns"&&(x[Zu(Hn)]=lt,nn=Hn),x[Vt]=lt),Kn[It]=Ti;continue}rn.push(It,Ti);continue}It=Ee(It,nn),It!==null&&(Kn[It]=Ti)}if(h)for(vt=0,vn=rn.length;vt<vn;vt++)It=Ee(rn[vt++],nn),Ti=rn[vt],It!==null&&(Kn[It]=Ti);return X=Kn}function it(){for(var lt=/(\r\n|\r|\n)/g,Vt=0,nn=0,rn=0,vt=ye,Mt,vn;ce>=rn&&(Mt=lt.exec(L),!(!Mt||(vt=Mt[0].length+Mt.index,vt>ce)));)Vt+=1,rn=vt;return ce==-1?(nn=vt,vn=L.substring(ye)):ye===0?vn=L.substring(ye,ce):(nn=ce-rn,vn=ye==-1?L.substring(ce):L.substring(ce,ye+1)),{data:vn,line:Vt,column:nn}}for(p=it,t&&(w=Object.create({},{name:fs(function(){return T}),originalName:fs(function(){return E}),attrs:fs(He),ns:fs(function(){return x})}));ye!==-1;){if(L.charCodeAt(ye)===60?ce=ye:ce=L.indexOf("<",ye),ce===-1){if(z)return L.substring(ye);if(C.length)return k("unexpected end of file");if(!d)return k("missing start tag");ye<L.length&&L.substring(ye).trim()&&A(Dd);return}if(d||(d=!0),ye!==ce){if(C.length){if(n&&(n(L.substring(ye,ce),Dr,p),g))return}else if(L.substring(ye,ce).trim()&&(A(Dd),g))return}if(te=L.charCodeAt(ce+1),te===33){if(Y=L.charCodeAt(ce+2),Y===91&&L.substr(ce+3,6)==="CDATA["){if(ye=L.indexOf("]]>",ce),ye===-1)return z?L.substring(ce):k("unclosed cdata");if(o&&(o(L.substring(ce+9,ye),p),g))return;ye+=3;continue}if(Y===45&&L.charCodeAt(ce+3)===45){if(ye=L.indexOf("-->",ce),ye===-1)return z?L.substring(ce):k("unclosed comment");if(c&&(c(L.substring(ce+4,ye),Dr,p),g))return;ye+=3;continue}}if(te===63){if(ye=L.indexOf("?>",ce),ye===-1)return z?L.substring(ce):k("unclosed question");if(u&&(u(L.substring(ce,ye+2),p),g))return;ye+=2;continue}for(Me=ce+1;;Me++){if(Ae=L.charCodeAt(Me),isNaN(Ae))return z?L.substring(ce):(ye=-1,k("unclosed tag"));if(Ae===34)Y=L.indexOf('"',Me+1),Me=Y!==-1?Y:Me;else if(Ae===39)Y=L.indexOf("'",Me+1),Me=Y!==-1?Y:Me;else if(Ae===62){ye=Me;break}}if(te===33){if(l&&(l(L.substring(ce,ye+1),Dr,p),g))return;ye+=1;continue}if(X={},te===47){if(K=!1,pe=!0,!C.length)return k("missing open tag");if(Me=T=C.pop(),Y=ce+2+Me.length,L.substring(ce+2,Y)!==Me)return k("closing tag mismatch");for(;Y<ye;Y++)if(te=L.charCodeAt(Y),!(te===32||te>8&&te<14))return k("close tag")}else{if(L.charCodeAt(ye-1)===47?(Me=T=L.substring(ce+1,ye-1),K=!0,pe=!0):(Me=T=L.substring(ce+1,ye),K=!0,pe=!1),!(te>96&&te<123||te>64&&te<91||te===95||te===58))return k("illegal first char nodeName");for(Y=1,W=Me.length;Y<W;Y++)if(te=Me.charCodeAt(Y),!(te>96&&te<123||te>64&&te<91||te>47&&te<59||te===45||te===95||te==46)){if(te===32||te<14&&te>8){T=Me.substring(0,Y),X=null;break}return k("invalid nodeName")}pe||C.push(T)}if(v){Ue=x,K&&(pe||b.push(Ue),X===null&&(h=Me.indexOf("xmlns",Y)!==-1)&&(U=Y,G=Me,He(),h=!1)),E=T,ge!==x&&(ie=x[Ld],ie===void 0&&(ie=x[Ld]=Object.create(null)),ge=x);var At=ie[T];if(At!==void 0)T=At;else{if(te=T.indexOf(":"),te!==-1){if(gt=x[T.substring(0,te)],!gt)return k("missing namespace on <"+E+">");T=T.substr(te+1)}else gt=x.xmlns;gt&&(T=gt+":"+T),ie[E]=T}}if(K&&(U=Y,G=Me,i&&(t?i(w,Dr,pe,p):i(T,He,Dr,pe,p),g)))return;if(pe){if(r&&(r(t?w:T,Dr,K,p),g))return;v&&(K?x=Ue:x=b.pop())}ye+=1}}}function Bd(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Qu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Nd="property";function $d(e){return e.xml&&e.xml.serialize}function Ew(e){const t=$d(e);return t!==Nd&&(t||null)}function Sw(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Fd(e,t){return Bd(t)?e.prefix+":"+Sw(e.localName):e.name}function Rw(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 Cw(e,t,n){const i=hn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=hn(r);var a=n.getPackage(o.prefix);return Rw(o,a)}function Ji(e){return new Error(e)}function ki(e){return e.$descriptor}function Pw(e){V(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Ji("expected element");var n=this.elementsById,i=ki(t),r=i.idProperty,o;if(r&&(o=t.get(r.name),o)){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(o))throw new Error("illegal ID <"+o+">");if(n[o])throw Ji("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function ea(){}ea.prototype.handleEnd=function(){},ea.prototype.handleText=function(){},ea.prototype.handleNode=function(){};function Ju(){}Ju.prototype=Object.create(ea.prototype),Ju.prototype.handleNode=function(){return this};function so(){}so.prototype=Object.create(ea.prototype),so.prototype.handleText=function(e){this.body=(this.body||"")+e};function ta(e,t){this.property=e,this.context=t}ta.prototype=Object.create(so.prototype),ta.prototype.handleNode=function(e){if(this.element)throw Ji("expected no sub nodes");return this.element=this.createReference(e),this},ta.prototype.handleEnd=function(){this.element.id=this.body},ta.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function el(e,t){this.element=t,this.propertyDesc=e}el.prototype=Object.create(so.prototype),el.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=qu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function hs(){}hs.prototype=Object.create(so.prototype),hs.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t};function bn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}bn.prototype=Object.create(hs.prototype),bn.prototype.addReference=function(e){this.context.addReference(e)},bn.prototype.handleText=function(e){var t=this.element,n=ki(t),i=n.bodyProperty;if(!i)throw Ji("unexpected body text <"+e+">");so.prototype.handleText.call(this,e)},bn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=ki(t),i=n.bodyProperty;i&&e!==void 0&&(e=qu(i.type,e),t.set(i.name,e))},bn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=ki(n),r=this.context,o=new n({}),a=this.model,s;return F(t,function(c,u){var l=i.propertiesByName[u],p;l&&l.isReference?l.isMany?(p=c.split(" "),F(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=qu(l.type,c):u==="xmlns"?u=":"+u:(s=hn(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},bn.prototype.getPropertyForNode=function(e){var t=e.name,n=hn(t),i=this.type,r=this.model,o=ki(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=Ew(s);if(u){const l=e.attributes[u];if(l){const p=Cw(l,e.ns,r),f=r.getType(p);return V({},s,{effectiveType:ki(f).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Fd(n,c),l=r.getType(u);if(s=mt(o.properties,function(p){return!p.isVirtual&&!p.isReference&&!p.isAttribute&&l.hasType(p.type)}),s)return V({},s,{effectiveType:ki(l).name})}else if(s=mt(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Ji("unrecognized element <"+n.name+">")},bn.prototype.toString=function(){return"ElementDescriptor["+ki(this.type).name+"]"},bn.prototype.valueHandler=function(e,t){return new el(e,t)},bn.prototype.referenceHandler=function(e){return new ta(e,this.context)},bn.prototype.handler=function(e){return e==="Element"?new co(this.model,e,this.context):new bn(this.model,e,this.context)},bn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Md(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(V(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function tl(e,t,n){bn.call(this,e,t,n)}tl.prototype=Object.create(bn.prototype),tl.prototype.createElement=function(e){var t=e.name,n=hn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Fd(n,o)||t;if(!r.hasType(a))throw Ji("unexpected element <"+e.originalName+">");return bn.prototype.createElement.call(this,e)};function co(e,t,n){this.model=e,this.context=n}co.prototype=Object.create(hs.prototype),co.prototype.createElement=function(e){var t=e.name,n=hn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},co.prototype.handleChild=function(e){var t=new co(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},co.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function nl(e){e instanceof Xn&&(e={model:e}),V(this,{lax:!1},e)}nl.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof bn?(i=t,t={}):typeof t=="string"?(i=this.handler(t),t={}):typeof i=="string"&&(i=this.handler(i));var r=this.model,o=this.lax,a=new Pw(V({},t,{rootHandler:i})),s=new Id({proxy:!0}),c=Aw();i.context=a,c.push(i);function u(C,M,k){var A=M(),B=A.line,D=A.column,L=A.data;L.charAt(0)==="<"&&L.indexOf(" ")!==-1&&(L=L.slice(0,L.indexOf(" "))+">");var z="unparsable content "+(L?L+" ":"")+`detected
|
|
2
2
|
line: `+B+`
|
|
3
3
|
column: `+D+`
|
|
4
|
-
nested error: `+C.message;if(k)return a.addWarning({message:z,error:C}),!0;throw Ji(z)}function l(C,
|
|
5
|
-
`,Tw=/<|>|'|"|&|\n\r|\n/g,jd=/<|>|&/g;function mi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}mi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},mi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},mi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},mi.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},mi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},mi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},mi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},mi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},mi.prototype.getUsed=function(e){var t=[].concat(this.wellknown,this.custom);return t.filter(n=>{var i=this.getNSKey(n);return this.used[i]})};function
|
|
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 Vw(e){e=V({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new zw,o=new Gw(r,e.format);e.preamble&&o.append(Aw);var a=new _t,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(Ww(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function Ww(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Qu)n[i]=Qu[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function gs(e,t){Xn.call(this,e,t)}gs.prototype=Object.create(Xn.prototype),gs.prototype.fromXML=function(e,t,n){An(t)||(n=t,t="bpmn:Definitions");var i=new nl(V({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},gs.prototype.toXML=function(e,t){var n=new Vw(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var Uw="BPMN20",Yw="http://www.omg.org/spec/BPMN/20100524/MODEL",qw="bpmn",Kw=[],Xw=[{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"}]}],Zw=[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],Qw={tagAlias:"lowerCase",typePrefix:"t"},Jw={name:Uw,uri:Yw,prefix:qw,associations:Kw,types:Xw,enumerations:Zw,xml:Qw},eE="BPMNDI",tE="http://www.omg.org/spec/BPMN/20100524/DI",nE="bpmndi",iE=[{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"]}],rE=[{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"}]}],oE=[],aE={name:eE,uri:tE,prefix:nE,types:iE,enumerations:rE,associations:oE},sE="DC",cE="http://www.omg.org/spec/DD/20100524/DC",uE="dc",lE=[{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}]}],pE=[],fE={name:sE,uri:cE,prefix:uE,types:lE,associations:pE},dE="DI",hE="http://www.omg.org/spec/DD/20100524/DI",mE="di",gE=[{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"}]}],yE=[],vE={tagAlias:"lowerCase"},bE={name:dE,uri:hE,prefix:mE,types:gE,associations:yE,xml:vE},xE="bpmn.io colors for BPMN",_E="http://bpmn.io/schema/bpmn/biocolor/1.0",wE="bioc",EE=[{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"}]}],SE=[],RE=[],CE={name:xE,uri:_E,prefix:wE,types:EE,enumerations:SE,associations:RE},PE="BPMN in Color",AE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",TE="color",ME=[{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"}]}],kE=[],OE=[],DE={name:PE,uri:AE,prefix:TE,types:ME,enumerations:kE,associations:OE};const LE={bpmn:Jw,bpmndi:aE,dc:fE,di:bE,bioc:CE,color:DE};function Vd(e,t){const n=V({},LE,e);return new gs(n,t)}const IE={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"}},BE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Wd="i18n",ys={[Wd]:IE,[Hu]:xd};function Ud(){return Vd(ys)}const Yd=Ud();async function ol(e){const{rootElement:t,warnings:n}=await Yd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function NE(e){const{xml:t}=await Yd.toXML(e,{format:!0});return t}function al(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const uo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},$E=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function FE(e){const t=uo;return $E.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 lo(e,t){let n=0;for(const i of e)n+=t*FE(i);return n}function qd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&jE(e),HE(e),zE(e),GE(e)}function jE(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:lo(r,o),fontBoundingBoxAscent:o*uo.ascentEm,fontBoundingBoxDescent:o*uo.descentEm,actualBoundingBoxAscent:o*uo.ascentEm,actualBoundingBoxDescent:o*uo.descentEm}}};t.getContext=()=>n}function HE(e){if(e.SVGMatrix)return;class t{constructor(){no(this,"a",1);no(this,"b",0);no(this,"c",0);no(this,"d",1);no(this,"e",0);no(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 zE(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 GE(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:lo(n,12),height:14}})}const vs=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),VE=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),WE=1,sl=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),UE=2;function Ut(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Kd=20,bs=5,Xd=3,YE=8,Zd=12,qE=Zd*1.2;function cl(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>lo(o,Zd))),r=n.length*qE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Qd=1;function xn(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 po(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of xn(e))for(const s of xn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Qd)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const u=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);u>=Kd&&(!n||u>n.length)&&(n={axis:a.axis,length:u,kind:c})}return n}function ul(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Jd(e,t){const n=po(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function KE(e,t){let n=0;for(const i of t)i.id!==e.id&&Jd(e,i)&&n++;return n}function Gn(e,t){let n=0;for(const i of t)i.id!==e.id&&po(e,i)&&n++;return n}const eh=15,th=20;function XE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-th||t.at>n[1]+th)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 ll=20;function xs(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Qd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Kd||n.push([r-ll,o+ll])}return n}function _s(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of xn(e)){const o=XE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of xs(r,xn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const ZE=10,QE=1,JE=(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 e1(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,m)=>{if(m===0)return d<=0;const h=d/m;if(m>0){if(h>p)return!1;h>l&&(l=h)}else{if(h<l)return!1;h<p&&(p=h)}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 pl(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 t1=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,fo=1;function Oi(e,t){const n=e.x+fo,i=e.x+e.width-fo,r=e.y+fo,o=e.y+e.height-fo;return t.axis==="h"?t.at>r&&t.at<o&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<o&&t.hi>r}function na(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function nh(e,t){const n=e.label;if(!n)return null;if(xn(e).some(i=>Oi(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(xn(i).some(r=>Oi(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(na(i).some(r=>Oi(n,r)))return i.id;return null}function an(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(e1(e.waypoints[o],e.waypoints[o+1],r,UE)){i.push(r);break}}return i}function n1(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 ih=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ia(e,t){let n=0;for(const i of t){if(i.id===e.id||ih(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++)n1(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Vn(e,t){let n=0;for(const i of t)i.id===e.id||ih(e,i)||ia(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function rh(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)ia(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function ws(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ia(n[i],[n[r]])>0){const o=n[i].id,a=n[r].id;t.push(o<a?[o,a]:[a,o])}return t.sort((i,r)=>`${i[0]}|${i[1]}`.localeCompare(`${r[0]}|${r[1]}`))}function oh(e){const t=ws(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let r=0,o=0;for(const[a,s]of t){const c=i.get(a),u=i.get(s);if(!c||!u)continue;const l=n(c.type),p=n(u.type);l==="solid"&&p==="solid"?r++:l==="dashed"&&p==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:i1(e)}}function i1(e){const t=e.shapes.filter(r=>r.type==="bpmn:Participant");if(t.length<3)return 0;const n=r=>{const o=e.shapes.find(a=>a.id===r);if(o)return t.find(a=>o.x>=a.x&&o.y>=a.y&&o.x+o.width<=a.x+a.width&&o.y+o.height<=a.y+a.height)};let i=0;for(const r of e.edges){if(r.type!=="bpmn:MessageFlow"||r.endpoints.length<2)continue;const o=n(r.endpoints[0]),a=n(r.endpoints[1]);if(!o||!a||o.id===a.id)continue;const s=Math.min(o.y,a.y),c=Math.max(o.y+o.height,a.y+a.height);t.some(u=>u.id!==o.id&&u.id!==a.id&&u.y>s&&u.y+u.height<c)&&i++}return i}function ah(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!sl.has(r.type)&&!i.has(r.id)&&r.x>=n.x&&r.y>=n.y&&r.x+r.width<=n.right&&r.y+r.height<=n.bottom).map(r=>r.id).sort()}function sh(e){var n;const t=(n=xt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=xt(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const ch=e=>e?{members:e}:{},Wn=e=>e.shapes.filter(t=>!t.container);function r1(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const r=i.endpoints.find(a=>a!==e.id),o=r?n.get(r):void 0;if(o){if(o.container)return o.id;if(o.parent)return o.parent}}}function uh(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(xn(i).some(r=>Oi(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(na(i).some(r=>Oi(n,r)))return i.id;return null}function ho(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function Yt(e){const t=[],n=e.shapes.filter(y=>!y.container);for(const y of e.edges)for(const g of an(y,n))t.push({kind:"edge-crosses-shape",edge:y.id,shape:g.id});const i=e.shapes.filter(y=>y.container&&VE.has(y.type));if(i.length){const y=(g,v)=>{const x=e.shapes.find(C=>C.id===v);return!!x&&x.x>=g.x&&x.y>=g.y&&x.x+x.width<=g.x+g.width&&x.y+x.height<=g.y+g.height};for(const g of e.edges)for(const v of an(g,i))g.endpoints.includes(v.id)||g.endpoints.some(x=>y(v,x))||t.push({kind:"edge-crosses-subprocess",edge:g.id,subProcess:v.id})}for(const y of e.edges){if(y.waypoints.length<2)continue;const g=[[y.source,y.waypoints[0]],[y.target,y.waypoints[y.waypoints.length-1]]];for(const[v,x]of g){if(!v)continue;const C=e.shapes.find(B=>B.id===v);if(!C||C.container)continue;const T=Math.max(C.x-x.x,x.x-(C.x+C.width),0),k=Math.max(C.y-x.y,x.y-(C.y+C.height),0),A=Math.hypot(T,k);A>ZE&&t.push({kind:"edge-endpoint-detached",edge:y.id,shape:v,distance:Math.round(A)})}}const r=e.shapes.filter(y=>y.type==="bpmn:Participant");for(let y=0;y<r.length;y++)for(let g=y+1;g<r.length;g++){const v=r[y],x=r[g];if(v.x+v.width<=x.x||x.x+x.width<=v.x||v.y+v.height<=x.y||x.y+x.height<=v.y)continue;const C=(T,k)=>T.x<=k.x&&T.y<=k.y&&T.x+T.width>=k.x+k.width&&T.y+T.height>=k.y+k.height;t.push({kind:"pool-overlap",pools:[v.id,x.id],contained:C(v,x)||C(x,v)})}const o=n.filter(y=>!y.attached);for(let y=0;y<o.length;y++)for(let g=y+1;g<o.length;g++){const v=o[y],x=o[g];if(!pl(v,x,WE))continue;const C=v.id<x.id?[v.id,x.id]:[x.id,v.id];t.push({kind:"shape-overlap",shapes:C,identical:t1(v,x)})}const a=e.shapes.filter(y=>y.type==="bpmn:Group"&&Array.isArray(y.members)&&y.members.length>0);for(let y=0;y<a.length;y++)for(let g=y+1;g<a.length;g++){const v=a[y],x=a[g],C=Math.min(v.x+v.width,x.x+x.width)-Math.max(v.x,x.x),T=Math.min(v.y+v.height,x.y+x.height)-Math.max(v.y,x.y);if(C<=bs||T<=bs)continue;const k=v.id<x.id?[v.id,x.id]:[x.id,v.id],A=new Set(x.members);if(v.members.some(D=>A.has(D))){const D=ah(e,a,{x:Math.max(v.x,x.x),y:Math.max(v.y,x.y),right:Math.min(v.x+v.width,x.x+x.width),bottom:Math.min(v.y+v.height,x.y+x.height)});D.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:k,shapes:D});continue}const B=v.x<=x.x&&v.y<=x.y&&v.x+v.width>=x.x+x.width&&v.y+v.height>=x.y+x.height?v.id:x.x<=v.x&&x.y<=v.y&&x.x+x.width>=v.x+v.width&&x.y+x.height>=v.y+v.height?x.id:void 0;t.push({kind:"group-overlap-unintended",groups:k,...B?{container:B}:{}})}const s=new Set(a.flatMap(y=>[...y.members])),c=y=>e.shapes.filter(g=>!g.container&&!sl.has(g.type)&&g.x>=y.x&&g.y>=y.y&&g.x+g.width<=y.x+y.width&&g.y+g.height<=y.y+y.height);for(const y of a){const g=c(y);if(!g.length)continue;const v=new Set(y.members),x=g.filter(C=>!v.has(C.id));x.some(C=>s.has(C.id))&&(x.length*2<g.length||t.push({kind:"group-overlap-unreadable",reason:"minority",group:y.id,shapes:x.map(C=>C.id).sort()}))}for(const y of a){const g=new Set(c(y).map(A=>A.id)),v=new Set(y.members),x=new Set([...g].filter(A=>!v.has(A)&&s.has(A)));if(!x.size)continue;let C=!1,T=!1,k=!1;for(const A of e.edges){if(A.type!=="bpmn:SequenceFlow"||!A.source||!A.target)continue;const B=x.has(A.source),D=x.has(A.target);!B&&D&&!g.has(A.source)?C=!0:B&&!D&&!g.has(A.target)?T=!0:B&&D&&(k=!0)}C&&T&&k&&t.push({kind:"group-overlap-unreadable",reason:"throughpass",group:y.id,shapes:[...x].sort()})}const u=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<u.length;y++)for(let g=y+1;g<u.length;g++)for(let v=g+1;v<u.length;v++){const x=[u[y],u[g],u[v]],C={x:Math.max(...x.map(A=>A.x)),y:Math.max(...x.map(A=>A.y)),right:Math.min(...x.map(A=>A.x+A.width)),bottom:Math.min(...x.map(A=>A.y+A.height))};if(C.right-C.x<=bs||C.bottom-C.y<=bs)continue;const T=ah(e,[],C);if(!T.length)continue;const k=x.map(A=>A.id).sort();t.push({kind:"group-stack-unreadable",groups:k,shapes:T})}for(const y of e.shapes.filter(g=>g.type==="bpmn:Group"))for(const g of e.shapes){if(g.container||g.attached||sl.has(g.type)||g.width<=0||g.height<=0)continue;const v=[["top",y.y,"h",y.x,y.x+y.width],["bottom",y.y+y.height,"h",y.x,y.x+y.width],["left",y.x,"v",y.y,y.y+y.height],["right",y.x+y.width,"v",y.y,y.y+y.height]];for(const[x,C,T,k,A]of v){const B=T==="h"?g.x:g.y,D=T==="h"?g.x+g.width:g.y+g.height;if(!(B<A&&k<D))continue;const L=T==="h"?g.y:g.x,z=T==="h"?g.y+g.height:g.x+g.width;if(!(L<C&&C<z))continue;const ie=Math.min(C-L,z-C);ie<YE||t.push({kind:"group-cuts-shape",group:y.id,shape:g.id,side:x,depth:ie})}}const l=e.shapes.filter(y=>y.container&&y.type!=="bpmn:Group"&&y.type!=="bpmn:Lane");for(const y of e.shapes.filter(g=>g.type==="bpmn:Group"))for(const g of l){const v=y.x<g.x+g.width&&g.x<y.x+y.width,x=y.y<g.y+g.height&&g.y<y.y+y.height,C=[["top",y.y,g.y,v],["bottom",y.y+y.height,g.y+g.height,v],["left",y.x,g.x,x],["right",y.x+y.width,g.x+g.width,x]];for(const[T,k,A,B]of C)B&&Math.abs(k-A)<=Xd&&t.push({kind:"group-on-container-boundary",group:y.id,container:g.id,side:T})}const p=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<p.length;y++)for(let g=y+1;g<p.length;g++){const v=p[y],x=p[g],C=v.x<x.x+x.width&&x.x<v.x+v.width,T=v.y<x.y+x.height&&x.y<v.y+v.height,k=[["x",v.x+v.width,x.x,T],["x",x.x+x.width,v.x,T],["y",v.y+v.height,x.y,C],["y",x.y+x.height,v.y,C]];for(const[A,B,D,L]of k)if(L&&Math.abs(B-D)<=Xd){t.push({kind:"group-on-group-boundary",groups:v.id<x.id?[v.id,x.id]:[x.id,v.id],axis:A});break}}for(let y=0;y<e.edges.length;y++)for(let g=y+1;g<e.edges.length;g++){const v=e.edges[y],x=e.edges[g],C=po(v,x);if(!C)continue;const T=v.id<x.id?[v.id,x.id]:[x.id,v.id];t.push({kind:C.kind==="opposite"?"edge-overlap-opposite":C.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:T,axis:C.axis,length:Math.round(C.length)})}for(const y of e.edges){if(!y.label)continue;const g=_s(y,e.edges);g&&t.push({kind:"label-on-shared-segment",edge:y.id,other:g.other,axis:g.axis})}for(const y of e.edges){if(!y.label)continue;const g=nh(y,e);g&&t.push({kind:"label-over-line",edge:y.id,line:g})}const f=new Set(n.map(y=>y.id)),d=e.shapes.filter(y=>y.type==="bpmn:Participant"&&y.label);for(const y of[...n,...d.filter(g=>!f.has(g.id))]){if(!y.label)continue;const g=uh(y,e);g&&t.push({kind:"label-over-line",edge:y.id,line:g})}const m=new Set(e.shapes.filter(y=>y.type==="bpmn:TextAnnotation").map(y=>y.id));for(const y of d)for(const{owner:g,rect:v}of ho(e))g===y.id||m.has(g)||pl(y.label,v,fo)&&t.push({kind:"pool-name-over-label",pool:y.id,label:g});const h=ho(e);for(const y of n)if(y.type==="bpmn:TextAnnotation")for(const{owner:g,rect:v}of h)g!==y.id&&pl(y,v,fo)&&t.push({kind:"annotation-over-label",annotation:y.id,label:g});const b=new Map(e.shapes.map(y=>[y.id,y]));for(const y of n){const g=y.parent??r1(y,e,b);if(!g)continue;const v=b.get(g);!v||!v.container||JE(v,y,QE)||t.push({kind:"shape-outside-container",shape:y.id,container:v.id})}return t.sort((y,g)=>Ut(y).localeCompare(Ut(g)))}const xt=e=>typeof e=="object"&&e!==null?e:void 0,Mt=e=>typeof e=="number"?e:0,Di=e=>{const t=xt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function o1(e){const t=xt(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=Di(o);a&&n.push(a)}}return n}function a1(e){const t=xt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Di(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Di(t.targetRef);return n&&i?{source:n,target:i}:{}}function s1(e,t){const n=xt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Di(n);return r?t.get(r):void 0}if(vs.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Di(n)}function lh(e){var a,s,c,u,l;const t=[],n=[],i=((a=xt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=xt(e))==null?void 0:s.rootElements)??[]){const f=xt(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const m=xt(d),h=Di(m),b=Di(m==null?void 0:m.processRef);h&&b?r.set(b,h):h&&o.add(h)}}for(const p of i){const f=xt((c=xt(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const m of d){const h=xt(m);if(!h)continue;const b=xt(h.bpmnElement),y=typeof(b==null?void 0:b.id)=="string"?b.id:void 0;if(!y)continue;const g=typeof(b==null?void 0:b.$type)=="string"?b.$type:"",v=xt(h.bounds);if(v){const C=h.isExpanded===!1&&g!=="bpmn:Participant",T=xt((u=xt(h.label))==null?void 0:u.bounds),k={id:y,type:g,x:Mt(v.x),y:Mt(v.y),width:Mt(v.width),height:Mt(v.height),container:vs.has(g)&&!C,attached:(b==null?void 0:b.attachedToRef)!==void 0,...b?{parent:s1(b,r)}:{},...T?{label:{x:Mt(T.x),y:Mt(T.y),width:Mt(T.width),height:Mt(T.height)}}:{},...g==="bpmn:Group"?ch(sh(b)):{}},A=h.isHorizontal!==!1,B=typeof(b==null?void 0:b.name)=="string"?b.name:"";o.has(y)&&A&&B&&(k.label=cl(k,B)),t.push(k);continue}const x=h.waypoint;if(Array.isArray(x)){const C=xt((l=xt(h.label))==null?void 0:l.bounds);n.push({id:y,type:g,waypoints:x.map(T=>{var k,A;return{x:Mt((k=xt(T))==null?void 0:k.x),y:Mt((A=xt(T))==null?void 0:A.y)}}),endpoints:o1(b),...a1(b),...C?{label:{x:Mt(C.x),y:Mt(C.y),width:Mt(C.width),height:Mt(C.height)}}:{}})}}}return{shapes:t,edges:n}}function ph(e){return Yt(lh(e))}async function c1(e){const{definitions:t,warnings:n}=await ol(e);return{findings:ph(t),warnings:n}}function et(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const h=xt(o.label),b=Di(o.source),y=Di(o.target);n.push({id:o.id,type:a,waypoints:s.map(g=>({x:Mt(g.x),y:Mt(g.y)})),endpoints:[b,y].filter(g=>!!g),...b&&y?{source:b,target:y}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Mt(h.y),width:Mt(h.width),height:Mt(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=xt(o.businessObject),u=xt(o.label);let l=xt(o.parent);for(;l&&l.type==="bpmn:Lane";)l=xt(l.parent);const p=typeof(l==null?void 0:l.type)=="string"?l.type:"",f=l&&vs.has(p)&&p!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Mt(o.width),height:Mt(o.height),container:vs.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:Mt(u.y),width:Mt(u.width),height:Mt(u.height)}}:{},...a==="bpmn:Group"?ch(sh(c)):{}},m=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&m&&((i=xt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=cl(d,m)),t.push(d)}return{shapes:t,edges:n}}const u1={"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 l1(e,t){const n=u1[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function fh(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function dh(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 l1(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&fh(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?fh(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 fl=20,p1=4,yt=(e,t)=>Math.abs(e-t)<.5;function Es(e,t,n,i=fl){if(yt(e.y,t.y)&&!yt(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(yt(e.x,t.x)&&!yt(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 hh(e,t,n,i=fl){if(n.length<2)return null;if(yt(e.y,t.y)&&!yt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,u=e.x<t.x?s:a,l=Math.min(...n.map(d=>d.y))-i,p=Math.max(...n.map(d=>d.y+d.height))+i,f=d=>[{x:c,y:e.y},{x:c,y:d},{x:u,y:d},{x:u,y:e.y}];return[f(l),f(p)]}if(yt(e.x,t.x)&&!yt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,u=e.y<t.y?s:a,l=Math.min(...n.map(d=>d.x))-i,p=Math.max(...n.map(d=>d.x+d.width))+i,f=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:u},{x:e.x,y:u}];return[f(l),f(p)]}return null}function mh(e,t,n=fl){if(e.length!==4)return null;const[i,r,o,a]=e;if(yt(i.y,r.y)&&yt(r.x,o.x)&&yt(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(yt(i.x,r.x)&&yt(r.y,o.y)&&yt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function Ss(e,t){if(e.endpoints.length!==2)return[];const n=t.find(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 gh=30,f1=[0,-25,25,-40,40];function d1(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+gh:s-gh,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return f1.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const dl=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],mo=(e,t,n)=>an({...e,waypoints:t},n).length;function hl(e,t,n,i){let r=[...e.waypoints],o=mo(e,r,t);if(o===0)return null;let a=!1;for(const p of Ss(e,t))if(mo(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(xn),c=p=>xn({...e,waypoints:p}).some(f=>xs(f,s).length>0),u=d1(e,t).filter(p=>mo(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);if(e.endpoints.length===2&&r.length>2){const p=t.find(d=>d.id===e.endpoints[0]),f=t.find(d=>d.id===e.endpoints[1]);if(p&&f&&yt(p.y+p.height/2,f.y+f.height/2)){const d=[r[0],r[r.length-1]];if(yt(d[0].y,d[1].y)&&!yt(d[0].x,d[1].x)){const m=t.filter(g=>!e.endpoints.includes(g.id)&&an({...e,waypoints:d},[g]).length>0),h=m.length>=2?hh(d[0],d[1],m):null,y=(h?h.map(g=>[d[0],...g,d[1]]):m.length===1?(Es(d[0],d[1],m[0])??[]).map(g=>[d[0],...g,d[1]]):m.length===0?[d]:[]).filter(g=>mo(e,g,t)===0&&g.length<=r.length).sort((g,v)=>Number(l(v))-Number(l(g)));if(y.length)return y.find(g=>!c(g))??y[0]}}}for(let p=0;p+1<r.length;p++){const f=r[p],d=r[p+1],m=t.filter(y=>!e.endpoints.includes(y.id)&&an({...e,waypoints:[f,d]},[y]).length>0);if(m.length<2)continue;const h=hh(f,d,m);if(!h)continue;const b=h.map(y=>dl(r,p,y)).filter(y=>mo(e,y,t)===0).sort((y,g)=>Number(l(g))-Number(l(y)));if(b.length)return b.find(y=>!c(y))??b[0]}for(let p=0;p<p1&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const m=r[d],h=r[d+1];for(const b of t){if(e.endpoints.includes(b.id)||an({...e,waypoints:[m,h]},[b]).length===0)continue;const y=Es(m,h,b),g=y?y.map(x=>dl(r,d,x)):mh(r,b)??[];if(!g.length)continue;const v=[...g].sort((x,C)=>Number(l(C))-Number(l(x)));for(const x of v){const C=mo(e,x,t);if(C<o){r=x,o=C,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function ml(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=et(i),a=Wn(o),s=new Set,c=Yt(o).filter(l=>l.kind==="edge-crosses-shape"&&!t.has(Ut(l)));if(!c.length)return s;const u=new Map;for(const l of c){if(l.kind!=="edge-crosses-shape"||u.has(l.edge))continue;const p=o.edges.find(f=>f.id===l.edge);p&&u.set(l.edge,p)}for(const[l,p]of u){if(n&&!n.has(l))continue;const f=i.get(l);if(!f)continue;const d=f.parent,m=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=hl(p,a,m,o.edges);if(!h){an(p,a).some(v=>v.type==="bpmn:TextAnnotation")&&s.add(l);continue}const b=o.edges.filter(v=>v.id!==l),y=Gn(p,b);Gn({...p,waypoints:h},b)>y||r.updateWaypoints(f,h)}return s}const h1=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,r.x)-1,y:Math.min(i.y,r.y)-1,width:Math.max(2,Math.abs(r.x-i.x)+2),height:Math.max(2,Math.abs(r.y-i.y)+2),container:!1,attached:!1})}return t},gl=(e,t)=>ia(e,[t])>0;function yh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=et(i),a=Wn(o);let s=o;const c=new Set(Yt(o).map(Ut));for(const[u,l]of ws(o))if(!t.has(`${u}|${l}`))for(const[p,f]of[[u,l],[l,u]]){if(n.has(p))continue;const d=s.edges.find(B=>B.id===p),m=s.edges.find(B=>B.id===f);if(!d||!m)continue;const h=i.get(p);if(!h)continue;const b=h.parent,y=b&&typeof b.x=="number"&&typeof b.width=="number"?{x:b.x,y:b.y,width:b.width,height:b.height}:void 0,g=h1(m),v=[...Ss(d,a)??[]],x=hl(d,[...a,...g],y,o.edges);x&&v.push(x);for(let B=0;B+1<d.waypoints.length;B++)for(const D of g)for(const L of Es(d.waypoints[B],d.waypoints[B+1],D)??[])v.push(dl(d.waypoints,B,L));const C=s.edges.filter(B=>B.id!==p),T=B=>({...s,edges:s.edges.map(D=>D.id===p?{...D,waypoints:B}:D)}),k=B=>!y||B.every(D=>D.x>=y.x&&D.x<=y.x+y.width&&D.y>=y.y&&D.y<=y.y+y.height),A=v.find(B=>{const D={...d,waypoints:B};return gl(D,m)||!k(B)||C.some(L=>L.id!==f&&!gl(d,L)&&gl(D,L))?!1:Yt(T(B)).every(L=>c.has(Ut(L)))});if(A){r.updateWaypoints(h,A),s=T(A);break}}}const m1=10;function vh(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 bh(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(z=>z.type==="bpmn:Participant"&&z.container),i=t.shapes.find(z=>z.id===e.endpoints[0]),r=t.shapes.find(z=>z.id===e.endpoints[1]);if(!i||!r)return null;const o=vh(i,n),a=vh(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter(z=>z.id!==o.id&&z.id!==a.id&&z.y>=c.y+c.height&&z.y+z.height<=u.y).sort((z,ie)=>z.y-ie.y);if(!l.length)return null;const p=l[0],f=l[l.length-1],d=(c.y+c.height+p.y)/2,m=(f.y+f.height+u.y)/2,h=s?d:m,b=s?m:d,y=e.waypoints[0],g=e.waypoints[e.waypoints.length-1],v=Wn(t),x=t.edges.filter(z=>z.id!==e.id),C=Vn(e,x),T=an(e,v).length;if(C===0&&T===0||T===0&&e.waypoints.length===2)return null;const k=Math.min(...l.map(z=>z.x)),A=Math.max(...l.map(z=>z.x+z.width)),B=(y.x+g.x)/2,D=z=>z.filter((ie,ge)=>ge===0||!(yt(ie.x,z[ge-1].x)&&yt(ie.y,z[ge-1].y)));let L;for(let z=k;z<=A;z+=m1){const ie=D([y,{x:y.x,y:h},{x:z,y:h},{x:z,y:b},{x:g.x,y:b},g]),ge={...e,waypoints:ie};if(an(ge,v).length>0)continue;const Ue=Vn(ge,x),je=Math.abs(z-B);(!L||Ue<L.cross||Ue===L.cross&&je<L.detour)&&(L={pts:ie,cross:Ue,detour:je})}return L&&(T>0?L.cross<=C:L.cross<C)?L.pts:null}function xh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=et(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=et(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=bh(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const gi=[25,-25,40,-40],go=35;function g1(e,t){const n=e.x+e.width/2,i=t.x+t.width/2,r=[];for(const o of[!0,!1]){const a=o?e.y:e.y+e.height,s=o?t.y:t.y+t.height,c=o?Math.min(e.y,t.y)-go:Math.max(e.y+e.height,t.y+t.height)+go;for(const u of[0,...gi])if(!(Math.abs(u)>=e.width/2-5))for(const l of[0,...gi]){if(Math.abs(l)>=t.width/2-5)continue;const p=n+u,f=i+l;r.push({pts:[{x:p,y:a},{x:p,y:c},{x:f,y:c},{x:f,y:s}],cost:Math.abs(l)+Math.abs(u)})}}return r}function Rs(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return g1(n,i);const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-go:n.y+n.height+go,p=[];for(const g of[0,...gi]){if(Math.abs(g)>=i.width/2-5)continue;const v=o+g;p.push({pts:[{x:n.x,y:r},{x:v,y:r},{x:v,y:c}],cost:Math.abs(g)});for(const x of[0,...gi]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;p.push({pts:[{x:C,y:u},{x:C,y:l},{x:v,y:l},{x:v,y:c}],cost:Math.abs(g)+Math.abs(x)})}}const f=50,d=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const g of[0,...gi]){if(Math.abs(g)>=n.width/2-5)continue;const v=a+g;p.push({pts:[{x:v,y:m},{x:v,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(g)})}const h=60,b=s?i.y+i.height:i.y,y=s?i.y+i.height+go:i.y-go;for(const g of[0,...gi]){if(Math.abs(g)>=i.width/2-5)continue;const v=o+g;for(const x of[0,...gi]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;p.push({pts:[{x:C,y:m},{x:C,y},{x:v,y},{x:v,y:b}],cost:h+Math.abs(g)+Math.abs(x)})}}return p}const Cs=30;function _h(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=yt(i.y,r.y)&&!yt(i.x,r.x),a=yt(i.x,r.x)&&!yt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<Cs||Math.abs(i.y-(s.y+s.height))<Cs)return!0}else{const c=Math.min(i.y,r.y);if(Math.max(i.y,r.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<Cs||Math.abs(i.x-(s.x+s.width))<Cs)return!0}}return!1}const Ps=40;function y1(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-Ps,a=r.x+r.width+Ps,s=r.y-Ps,c=r.y+r.height+Ps;for(let u=1;u<e.length-2;u++){const l=e[u],p=e[u+1],f={x:Math.min(l.x,p.x),y:Math.min(l.y,p.y)},d={x:Math.max(l.x,p.x),y:Math.max(l.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function wh(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(T=>T.container),i=new Map(t.shapes.map(T=>[T.id,T])),r=Wn(t),o=t.edges.filter(T=>T.id!==e.id),a=Gn(e,o),s=Vn(e,o),c=T=>y1(T,t.shapes,e.endpoints)+(_h(T,n)?1:0),u=c(e.waypoints),l=T=>{if(!T)return;const k=T.x+T.width/2,A=T.y+T.height/2;return n.find(B=>B.type==="bpmn:Lane"&&k>=B.x&&k<=B.x+B.width&&A>=B.y&&A<=B.y+B.height)},p=l(i.get(e.endpoints[0]??"")),f=l(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,m=T=>{if(!d||!f)return!1;for(let k=1;k<T.length-2;k++){const A=T[k],B=T[k+1];if(yt(A.y,B.y)&&!yt(A.x,B.x)&&A.y>f.y&&A.y<f.y+f.height)return!0}return!1},h=m(e.waypoints),y=(T=>{if(!T)return;const k=T.x+T.width/2,A=T.y+T.height/2;return n.filter(B=>B.type==="bpmn:Participant"&&k>=B.x&&k<=B.x+B.width&&A>=B.y&&A<=B.y+B.height).sort((B,D)=>B.width*B.height-D.width*D.height)[0]})(i.get(e.endpoints[0]??"")),g=T=>{if(!y)return 0;let k=0;for(let A=1;A<T.length-1;A++){const B=T[A];(B.x<y.x||B.x>y.x+y.width||B.y<y.y||B.y>y.y+y.height)&&k++}return k},v=g(e.waypoints);if(!_h(e.waypoints,n)&&!(d&&!h)&&v===0)return null;const x=T=>T.reduce((k,A,B)=>B?k+Math.abs(A.x-T[B-1].x)+Math.abs(A.y-T[B-1].y):0,0);let C;for(const{pts:T,cost:k}of Rs(e,i)){const A={...e,waypoints:T};if(an(A,r).length>0)continue;const B=Gn(A,o);if(B>a)continue;const D=g(T);if(D>v)continue;const L=D<v&&B===0;if(!L&&Vn(A,o)>s)continue;const z=c(T),ie=m(T);if(!L&&!(ie&&!h)&&z>=u)continue;const Ue=ie?0:1,je=x(T);(!C||D<C.out||D===C.out&&(Ue<C.lane||Ue===C.lane&&(B<C.opp||B===C.opp&&(z<C.sc||z===C.sc&&(k<C.cost||k===C.cost&&je<C.len)))))&&(C={pts:T,out:D,sc:z,lane:Ue,opp:B,cost:k,len:je})}return(C==null?void 0:C.pts)??null}function v1(e,t){const{elementRegistry:n}=e,i=e.modeling,r=et(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=et(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=Wn(a),u=a.edges.filter(d=>d.id!==o),l=an(s,c).length,p=Gn(s,u),f=Vn(s,u);for(const d of Ss(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const m={...s,waypoints:d};if(an(m,c).length>l||Gn(m,u)>p||Vn(m,u)>f)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function Eh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=et(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=et(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=wh(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function yl(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=yt(n[0].x,n[1].x)&&!yt(n[0].y,n[1].y),s=yt(n[n.length-1].x,n[n.length-2].x)&&!yt(n[n.length-1].y,n[n.length-2].y);for(const c of gi){if(a&&r&&Math.abs(c)<r.width/2-5){const u=n.map(l=>({...l}));u[0].x+=c,u[1].x+=c,i.push({pts:u,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const u=n.map(l=>({...l}));u[u.length-1].x+=c,u[u.length-2].x+=c,i.push({pts:u,cost:Math.abs(c)})}}return i}function b1(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const r=i.y+i.height<=n.y,o=n.y+n.height<=i.y;if(!r&&!o)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,u=n.y+n.height/2,l=i.x+i.width/2,p=i.y+i.height/2,f=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,m=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,b=[];for(const y of[0,...gi])Math.abs(y)<i.width/2-5&&b.push({pts:[{x:f,y:u},{x:l+y,y:u},{x:l+y,y:h}],cost:Math.abs(y)}),Math.abs(y)<i.height/2-5&&b.push({pts:[{x:c,y:d},{x:c,y:p+y},{x:m,y:p+y}],cost:Math.abs(y)});return b}function vl(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const r=Math.max(n.x,i.x),o=Math.min(n.x+n.width,i.x+i.width);if(o-r<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,u=a?i.y+i.height:i.y,l=(r+o)/2,p=[];for(const f of[0,...gi]){const d=l+f;d<=r||d>=o||p.push({pts:[{x:d,y:c},{x:d,y:u}],cost:Math.abs(f)})}return p}function Sh(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Wn(t),r=t.edges.filter(d=>d.id!==e.id),o=Gn(e,r);if(o===0)return null;const a=Vn(e,r);let s;const c=d=>d.reduce((m,h,b)=>b?m+Math.abs(h.x-d[b-1].x)+Math.abs(h.y-d[b-1].y):0,0),u=3,l=d=>{const m=d[0],h=d[d.length-1],b=Math.hypot(h.x-m.x,h.y-m.y);return b>=1&&c(d)/b>=u?1:0},p=l(e.waypoints),f=[...Rs(e,n),...vl(e,n),...yl(e,n)];for(const{pts:d,cost:m}of f){const h={...e,waypoints:d};if(an(h,i).length>0)continue;const b=Gn(h,r),y=Vn(h,r),g=o-b+(p-l(d));if(b>=o||y-a>g)continue;const v=c(d);(!s||b<s.opposite||b===s.opposite&&(y<s.cross||y===s.cross&&(m<s.cost||m===s.cost&&v<s.len)))&&(s={pts:d,opposite:b,cross:y,cost:m,len:v})}return(s==null?void 0:s.pts)??null}function Rh(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=po(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function x1(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Wn(t),r=t.edges.filter(f=>f.id!==e.id),o=Rh(e,r);if(o===0)return null;const a=Gn(e,r),s=Vn(e,r),c=f=>f.reduce((d,m,h)=>h?d+Math.abs(m.x-f[h-1].x)+Math.abs(m.y-f[h-1].y):0,0),u=2;let l;const p=[...Rs(e,n),...vl(e,n),...b1(e,n),...yl(e,n)];for(const{pts:f,cost:d}of p){const m={...e,waypoints:f};if(an(m,i).length>0)continue;const h=Rh(m,r);if(h>=o)continue;const b=Gn(m,r);if(b-h>a-o)continue;const y=Vn(m,r);if(y-s>(o-h)*u)continue;const g=c(f);(!l||h<l.fake||h===l.fake&&(b<l.unreadable||b===l.unreadable&&(y<l.cross||y===l.cross&&(d<l.cost||d===l.cost&&g<l.length))))&&(l={pts:f,fake:h,unreadable:b,cross:y,cost:d,length:g})}return(l==null?void 0:l.pts)??null}function Ch(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Yt(et(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(Ut(s)));if(!o.length)return;const a=new Set;for(const s of o)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=et(i),u=c.edges.find(f=>f.id===s);if(!u)continue;const l=x1(u,c);if(!l)continue;const p=i.get(s);p&&r.updateWaypoints(p,l)}}function Ph(e,t){const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");return!!n&&!!i&&i.x+i.width>n.x}function Ah(e,t,n){var u;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((u=po(e,t))==null?void 0:u.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(l=>l&&(l===o||l===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:Ph(e,n)&&Ph(t,n)}function Th(e,t,n){let i=0;for(const r of t)r.id!==e.id&&Ah(e,r,n)&&i++;return i}function _1(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Wn(t),r=t.edges.filter(f=>f.id!==e.id),o=Th(e,r,n);if(o===0)return null;const a=Gn(e,r),s=Vn(e,r),c=f=>f.reduce((d,m,h)=>h?d+Math.abs(m.x-f[h-1].x)+Math.abs(m.y-f[h-1].y):0,0),u=2;let l;const p=[...Rs(e,n),...vl(e,n),...yl(e,n)];for(const{pts:f,cost:d}of p){const m={...e,waypoints:f};if(an(m,i).length>0)continue;const h=Th(m,r,n);if(h>=o)continue;const b=Gn(m,r);if(b-h>a-o)continue;const y=Vn(m,r);if(y-s>(o-h)*u)continue;const g=c(f);(!l||h<l.chain||h===l.chain&&(b<l.unreadable||b===l.unreadable&&(y<l.cross||y===l.cross&&(d<l.cost||d===l.cost&&g<l.length))))&&(l={pts:f,chain:h,unreadable:b,cross:y,cost:d,length:g})}return(l==null?void 0:l.pts)??null}function w1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=et(i),a=new Map(o.shapes.map(u=>[u.id,u])),s=Yt(o).filter(u=>u.kind==="edge-overlap-opposite"&&!t.has(Ut(u)));if(!s.length)return;const c=new Set;for(const u of s){if(u.kind!=="edge-overlap-opposite")continue;const[l,p]=u.edges.map(f=>o.edges.find(d=>d.id===f));if(!(!l||!p||!Ah(l,p,a)))for(const f of u.edges)n.has(f)||c.add(f)}for(const u of[...c].sort()){const l=et(i),p=l.edges.find(m=>m.id===u);if(!p)continue;const f=_1(p,l);if(!f)continue;const d=i.get(u);d&&r.updateWaypoints(d,f)}}function Mh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=et(i),a=Yt(o).filter(l=>ul(l)&&!t.has(Ut(l)));if(!a.length)return;const s=new Set;for(const l of a)if(ul(l))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=et(i),f=p.edges.find(h=>h.id===l);if(!f)continue;const d=Sh(f,p);if(!d)continue;const m=i.get(l);m&&r.updateWaypoints(m,d)}}const E1=10,S1=(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 kh(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!_s(e,i))return null;const r=Wn(t),o=i.flatMap(xn);for(const a of xn(e)){let s=[[a.lo,a.hi]];for(const[d,m]of xs(a,o))s=s.flatMap(([h,b])=>{const y=[];return d>h&&y.push([h,Math.min(b,d)]),m<b&&y.push([Math.max(h,m),b]),y.filter(([g,v])=>v>g)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,m])=>m-d>=c+E1*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-eh}:{x:a.at+kn+n.width/2,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!_s({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&S1(f,d)))return f}return null}const kn=8;function Oh(e,t){const n=e.label;if(!n)return null;const i=xn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=f=>{const d=f.axis==="h"?r:o,m=f.axis==="h"?o-f.at:r-f.at,h=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(m,h)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(xn),...t.shapes.filter(f=>f.container).flatMap(na)],u=f=>!c.some(d=>Oi(f,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+kn,p=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const f of[s.at+kn,s.at-kn-n.width])for(const d of p){const m=n.y+d;if(m<s.lo||m+n.height>s.hi)continue;const h={...n,x:f,y:m};if(u(h))return h}else for(const f of[s.at-kn-n.height,s.at+kn])for(const d of p){const m=n.x+d;if(m<s.lo||m+n.width>s.hi)continue;const h={...n,x:m,y:f};if(u(h))return h}return null}function Dh(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=et(n),o=new Set(Yt(r).map(Ut));for(const[a,s]of t){const c=s.wps,u=n.get(a),l=u==null?void 0:u.label;if(!l||!(u!=null&&u.waypoints)||u.waypoints.length!==c.length)continue;const p=u.waypoints[0].x-c[0].x,f=u.waypoints[0].y-c[0].y;if(!u.waypoints.every((v,x)=>v.x-c[x].x===p&&v.y-c[x].y===f))continue;const d=s.label.x+p-l.x,m=s.label.y+f-l.y;if(d===0&&m===0)continue;const h=r.edges.find(v=>v.id===a);if(!(h!=null&&h.label))continue;const b={...h.label,x:h.label.x+d,y:h.label.y+m},y={...r,edges:r.edges.map(v=>v.id===a?{...v,label:b}:v)},g=Yt(y);g.some(v=>!o.has(Ut(v)))||(i.moveElements([l],{x:d,y:m}),r=y,o=new Set(g.map(Ut)))}}function Lh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=et(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=Oh(o,r);if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function Ih(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=et(i),a=Yt(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Ut(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=kh(c,o);if(!u)continue;const l=i.get(s.edge),p=l==null?void 0:l.label;p&&r.moveElements([p],{x:u.x-p.x,y:u.y-p.y})}}function Bh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(xn),...t.shapes.filter(f=>f.container).flatMap(na)],r=i.filter(f=>Oi(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=ho(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Oi(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),u=[];for(const f of r)f.axis==="h"?u.push({...n,y:f.at-kn-n.height},{...n,y:f.at+kn}):u.push({...n,x:f.at-kn-n.width},{...n,x:f.at+kn});const l=e.x+e.width/2,p=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+kn},{...n,x:l-n.width/2,y:e.y-kn-n.height},{...n,x:e.x+e.width+kn,y:p-n.height/2},{...n,x:e.x-kn-n.width,y:p-n.height/2}),u.find(c)??null}function Nh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=et(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Bh(o,et(n));if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}const R1=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,$h=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Fh={"participant.add":[{path:"participant",shape:["id"]},{path:"participant.lanes[]",shape:["id"],optional:!0}],"participant.update":[{path:"id",shape:null},{path:"lanes[]",shape:["id"],optional:!0}],"node.add":[{path:"node",shape:["id","type"]}],"node.update":[{path:"id",shape:null}],"sequenceFlow.add":[{path:"flow",shape:["id","source","target"]}],"sequenceFlow.update":[{path:"id",shape:null}],"messageFlow.add":[{path:"flow",shape:["id","source","target"]}],"messageFlow.update":[{path:"id",shape:null}],"dataStore.add":[{path:"dataStore",shape:["id"]},{path:"associations[]",shape:["source","target"],optional:!0}],"dataStore.update":[{path:"id",shape:null}],"dataAssociation.add":[{path:"association",shape:["source","target"]}],"association.add":[{path:"association",shape:["source","target"]}],"annotation.add":[{path:"annotation",shape:["id","text"]},{path:"association",shape:["source","target"],optional:!0},{path:"placement",shape:["anchor","side"],optional:!0}],"annotation.update":[{path:"id",shape:null},{path:"placement",shape:["anchor","side"],optional:!0}],"group.add":[{path:"group",shape:["id"]},{path:"group.members[]",shape:null,optional:!0}],"group.update":[{path:"id",shape:null},{path:"members[]",shape:null,optional:!0}],"element.remove":[{path:"id",shape:null}]},As=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),bl=e=>typeof e=="string"&&e!=="";function C1(e){const t=[];function n(i,r,o,a){if(a===null){bl(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!As(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)bl(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a;if(!As(i)||!bl(i.kind)||!(i.kind in Fh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const s of Fh[i.kind]){const c=s.path.endsWith("[]"),u=c?s.path.slice(0,-2):s.path,l=u.split(".");let p=i;for(const d of l.slice(0,-1)){if(!As(p))break;p=p[d]}if(!As(p))continue;const f=p[l[l.length-1]];if(!(f===void 0&&s.optional)&&!(f===null&&s.optional)){if(!c){n(r,s.path,f,s.shape);continue}if(!Array.isArray(f)){t.push({kind:"payload-invalid",opIndex:r,field:s.path});continue}f.forEach((d,m)=>n(r,`${u}[${m}]`,d,s.shape))}}if(i.kind==="node.add"||i.kind==="node.update"){const s=i.band;s!==void 0&&(!Number.isInteger(s)||s<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"});const c=i.kind==="node.add"?(o=i.node)==null?void 0:o.type:i.type;typeof c=="string"&&!vd(c)&&t.push({kind:"node-type-unsupported",opIndex:r,id:(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"",type:c})}}),t}function jh(e,t){const n=C1(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,m){if(!R1.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,{...m,opIndex:f})}e.forEach((f,d)=>{var m;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(h=>h.id)});for(const h of f.participant.lanes??[])a(d,h.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 h of f.associations??[])h.id&&a(d,h.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"}),(m=f.association)!=null&&m.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(h=>h.id));for(const h of f.lanes)t.categoryOf(h.id)===void 0&&a(d,h.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,m,h){const b=s(d);if(b===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:m});return}if(h&&!h.includes(b)){i.push({kind:"ref-category",opIndex:f,ref:d,role:m,expected:h.join("|"),actual:b});return}return b}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var m;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:b}=f.node;if(h===void 0){(l||b!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,h,"participant",["participant"])===void 0)break;b!==void 0&&((((m=r.get(h))==null?void 0:m.lanes)??o.get(h)??t.lanesOf(h)).includes(b)||i.push({kind:"lane-unknown",opIndex:d,lane:b,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:b,target:y,name:g,condition:v}=f.flow,x=u(d,b,"source",["flowNode"]),C=u(d,y,"target",["flowNode"]);x&&C&&c(b)!==c(y)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),g!==void 0&&v!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:b,target:y}=f.flow,g=u(d,b,"source",["flowNode","participant"]),v=u(d,y,"target",["flowNode","participant"]);if(g&&v){const x=c(b),C=c(y);x!==void 0&&x===C&&i.push({kind:"message-flow-same-pool",opIndex:d,id:h})}break}case"dataStore.add":{for(const h of f.associations??[]){if([h.source,h.target].filter(g=>g===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const y=h.source===f.dataStore.id?h.target:h.source;u(d,y,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:b}=f.association,y=u(d,h,"source"),g=u(d,b,"target");if(y&&g){const v=new Set([y,g]);v.has("dataStore")&&v.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:b})}break}case"association.add":{const{id:h,source:b,target:y}=f.association,g=u(d,b,"source"),v=u(d,y,"target");g&&v&&g!=="annotation"&&v!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${b}->${y}`});break}case"annotation.add":{if(f.association){const{source:h,target:b}=f.association;if(h!==f.annotation.id&&b!==f.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:f.annotation.id});else{const y=h===f.annotation.id?b:h;u(d,y,"association")}}f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.add":{for(const h of f.group.members??[]){const b=u(d,h,"member");b&&$h.has(b)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:b})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const h=t.lanesOf(f.id),b=f.lanes.map(g=>g.id);for(const g of h)b.includes(g)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:g});for(const g of b)t.categoryOf(g)!==void 0&&!h.includes(g)&&i.push({kind:"id-duplicate",opIndex:d,id:g});const y=b.filter(g=>h.includes(g));y.length===h.length&&y.some((g,v)=>g!==h[v])&&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 h=t.participantOf(f.id);(h?o.get(h)??t.lanesOf(h):[]).includes(f.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:f.lane,participant:h??""})}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 h=f.source===void 0||u(d,f.source,"source",["flowNode"])!==void 0,b=f.target===void 0||u(d,f.target,"target",["flowNode"])!==void 0,y=t.endpointsOf(f.id),g=f.source??(y==null?void 0:y.source),v=f.target??(y==null?void 0:y.target);h&&b&&g!==void 0&&v!==void 0&&new Set([c(g),c(v),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 h of f.members??[]){const b=u(d,h,"member");b&&$h.has(b)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:b})}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,m){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const h=t.categoryOf(d);if(h===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(m&&h!==m){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:m,actual:h});return}return h}}function Hh(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"),spaceTool:e.get("spaceTool")}}function Ts(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Ms={"top-left":[-1,-1],top:[0,-1],"top-right":[1,-1],right:[1,0],"bottom-right":[1,1],bottom:[0,1],"bottom-left":[-1,1],left:[-1,0]},sn=10,P1=300,zh=40,A1=10;function xl(e,t,n,i,r){const o=n,a=(D,L)=>{const[z,ie]=Ms[D];let ge={x:t.x+t.width/2+z*(t.width/2+o.width/2+L),y:t.y+t.height/2+ie*(t.height/2+o.height/2+L)};const Ue=i.x+sn+o.width/2,je=i.x+i.width-sn-o.width/2,K=i.y+sn+o.height/2,pe=i.y+i.height-sn-o.height/2,ce={x:Math.min(je,Math.max(Ue,ge.x)),y:Math.min(pe,Math.max(K,ge.y))};return(ce.x!==ge.x||ce.y!==ge.y)&&(ge=Math.abs(ce.x-(t.x+t.width/2))<(t.width+o.width)/2+sn&&Math.abs(ce.y-(t.y+t.height/2))<(t.height+o.height)/2+sn?{x:t.x+t.width+sn+o.width/2,y:ce.y}:ce),ge},s=(i.children??[]).filter(D=>!("waypoints"in D&&D.waypoints)&&D.type!=="bpmn:Lane"&&D.type!=="label"&&typeof D.x=="number"&&D.id!==r.selfId),c=et(e),u=D=>{var z,ie;if(!r.selfId)return!1;const L=e.get(D);return!!L&&(((z=L.source)==null?void 0:z.id)===r.selfId||((ie=L.target)==null?void 0:ie.id)===r.selfId)},l=c.edges.filter(D=>!u(D.id)).flatMap(xn),p=ho(c).filter(D=>D.owner!==r.selfId).map(D=>D.rect),f=D=>({x0:D.x-o.width/2-sn,x1:D.x+o.width/2+sn,y0:D.y-o.height/2-sn,y1:D.y+o.height/2+sn}),d=D=>{const L=f(D);return s.some(z=>L.x0<z.x+z.width&&L.x1>z.x&&L.y0<z.y+z.height&&L.y1>z.y)},m=D=>{const L=f(D);return l.some(z=>z.axis==="h"?z.at>L.y0&&z.at<L.y1&&z.lo<L.x1&&z.hi>L.x0:z.at>L.x0&&z.at<L.x1&&z.lo<L.y1&&z.hi>L.y0)},h=D=>{const L=f(D);return p.some(z=>L.x0<z.x+z.width&&L.x1>z.x&&L.y0<z.y+z.height&&L.y1>z.y)},b=c.shapes.filter(D=>D.type==="bpmn:Group").flatMap(D=>[{axis:"h",at:D.y,lo:D.x,hi:D.x+D.width},{axis:"h",at:D.y+D.height,lo:D.x,hi:D.x+D.width},{axis:"v",at:D.x,lo:D.y,hi:D.y+D.height},{axis:"v",at:D.x+D.width,lo:D.y,hi:D.y+D.height}]),y=D=>{const L=f(D);return b.some(z=>z.axis==="h"?z.at>L.y0&&z.at<L.y1&&z.lo<L.x1&&z.hi>L.x0:z.at>L.x0&&z.at<L.x1&&z.lo<L.y1&&z.hi>L.y0)},g=D=>d(D)||m(D)||h(D)||y(D),v=D=>D.x-o.width/2>=i.x&&D.x+o.width/2<=i.x+i.width&&D.y-o.height/2>=i.y&&D.y+o.height/2<=i.y+i.height;if(r.placement){const D=je=>je.startsWith("top")?je.replace(/^top/,"bottom"):je.replace(/^bottom/,"top"),L=je=>je.endsWith("left")?je.replace(/left$/,"right"):je.replace(/right$/,"left"),z=r.placement.side,ie=[z,D(z),L(z),D(L(z)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ge=r.placement.offset??50;let Ue=a(z,ge);if(g(Ue)){const je=new Set;for(const K of ie){if(je.has(K))continue;je.add(K);const pe=a(K,ge);if(v(pe)&&!g(pe)){Ue=pe;break}}}return Ue}const x=r.from,C=i.x+sn+o.width/2,T=i.x+i.width-sn-o.width/2,k=i.y+sn+o.height/2,A=i.y+i.height-sn-o.height/2;let B={x:Math.min(T,Math.max(C,x.x)),y:Math.min(A,Math.max(k,x.y))};if(g(B)){const D=(t.width+o.width)/2+sn,z=[{x:B.x+D,y:B.y},{x:B.x-D,y:B.y},{x:B.x,y:B.y-o.height-sn},{x:B.x,y:B.y+o.height+sn}].filter(v).find(ie=>!g(ie));z&&(B=z)}return B}function en(e,t){return e.filter(n=>n.kind===t)}function Gh(e,t){var x0,_0,w0,E0,S0,R0,C0,P0,A0,T0,M0,k0,O0,D0,L0,I0,B0,N0,$0,F0,j0,H0,z0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:u}=t,l=()=>a.getRootElement(),p=_=>o.get(_),f=_=>{const R=p(_);if(!R)throw new Error(`하강 참조 해소 실패: ${_}`);return R},d=_=>{let R=_.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},m=new Map;for(const _ of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))m.set(_.id,{x:_.x,y:_.y});const h=en(e,"participant.add"),b=en(e,"node.add"),y=en(e,"sequenceFlow.add"),g=en(e,"messageFlow.add"),v=en(e,"dataStore.add"),x=en(e,"dataAssociation.add"),C=en(e,"annotation.add"),T=en(e,"group.add"),k=new Map(b.map(_=>[_.node.id,_])),A=(_,R,P)=>{var j;const O=_.businessObject,$=(((j=O.extensionElements)==null?void 0:j.values)??[]).filter(H=>H.$type!==R),I=P?[...$,i.create(R,P)]:$;if(!I.length){O.extensionElements&&n.updateProperties(_,{extensionElements:void 0});return}const N=i.create("bpmn:ExtensionElements",{values:I});I.forEach(H=>{H.$parent=N}),n.updateProperties(_,{extensionElements:N})},B=_=>({anchor:_.anchor,side:_.side,..._.offset!==void 0?{offset:_.offset}:{}});for(const _ of en(e,"element.remove")){const R=p(_.id);R&&n.removeElements([R])}const D=_=>o.filter(R=>{var P;return R.type==="bpmn:Lane"&&((P=d(R))==null?void 0:P.id)===_}).sort((R,P)=>R.y-P.y);for(const _ of en(e,"participant.update")){const R=f(_.id);if(_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),!_.lanes)continue;const P=D(_.id);if(!P.length){n.splitLane(R,_.lanes.length),D(_.id).forEach(($,I)=>{const N=_.lanes[I];N&&n.updateProperties($,{id:N.id,name:N.name})});continue}const O=new Set(P.map($=>$.id));_.lanes.forEach(($,I)=>{if(O.has($.id)){n.updateProperties(f($.id),{name:$.name});return}const N=I===0?n.addLane(D(_.id)[0],"top"):n.addLane(f(_.lanes[I-1].id),"bottom");n.updateProperties(N,{id:$.id,name:$.name})})}const L=150,z=130,ie=80,ge=90,Ue=180,je=30,K=30,pe=(_,R,P,O,$)=>{const I=P-R.width/2,N=O-R.height/2;return(_.children??[]).find(j=>!("waypoints"in j&&j.waypoints)&&j.type!=="bpmn:Lane"&&j.type!=="label"&&!($!=null&&$.has(j.id))&&typeof j.x=="number"&&I<j.x+j.width+K&&I+R.width+K>j.x&&N<j.y+j.height&&N+R.height>j.y)},ce=new Set;for(const _ of h){ce.add(`pool:${_.participant.id}`);for(const R of _.participant.lanes??[])ce.add(R.id)}const ye=new Map;for(const _ of b){const R=_.node.lane??`pool:${_.node.participant??""}`;let P=ye.get(R);P||ye.set(R,P=new Set([0])),_.band!==void 0&&P.add(_.band)}const Te=new Map;for(const[_,R]of ye){if(!ce.has(_))continue;const P=[...R].sort((I,N)=>I-N),O=P.map((I,N)=>N===0?0:N%2===1?Math.ceil(N/2):-(N/2)),$=Math.min(...O);Te.set(_,new Map(P.map((I,N)=>[I,O[N]-$])))}{const _=new Map;for(const R of h)(R.participant.lanes??[]).forEach((P,O)=>_.set(P.id,O));for(const[R,P]of Te){if(!_.has(R)||P.size<2)continue;const O=_.get(R),$=P.get(0)??0,I=new Set;for(const Q of b){if(Q.node.lane!==R||(Q.band??0)!==0||!Q.node.type.endsWith("Gateway"))continue;const Ce={in:new Set,out:new Set,cross:new Set};for(const xe of y){const Re=xe.flow.source===Q.node.id;if(!Re&&xe.flow.target!==Q.node.id)continue;const ut=k.get(Re?xe.flow.target:xe.flow.source);if(!ut||ut.node.participant!==Q.node.participant||!ut.node.lane)continue;let ae,me=!1;if(ut.node.lane!==R){const Pe=_.get(ut.node.lane);if(Pe===void 0)continue;ae=Pe>O?"down":"up",me=!0}else{const Pe=P.get(ut.band??0)??$;ae=Pe>$?"down":Pe<$?"up":void 0}ae&&(Ce[Re?"out":"in"].add(ae),me&&Ce.cross.add(ae))}for(const xe of["up","down"])Ce.in.has(xe)&&Ce.out.has(xe)&&Ce.cross.has(xe)&&I.add(xe)}if(I.size!==1)continue;const[N]=I,j=Math.max(...P.values()),H=N==="down"?j:0;if($===H)continue;const q=[...P.entries()].filter(([Q])=>Q!==0).sort((Q,Ce)=>Q[1]-Ce[1]),ue=[...Array(j+1).keys()].filter(Q=>Q!==H),be=new Map([[0,H]]);q.forEach(([Q],Ce)=>be.set(Q,ue[Ce])),Te.set(R,be)}}const W=_=>{var R;return(((R=ye.get(_))==null?void 0:R.size)??0)>1},Y=_=>_.band??(_.node.lane||!W(`pool:${_.node.participant??""}`)?void 0:0),te=new Map,Ae=_=>te.get(_.node.id)??Y(_),gt=new Set,M=new Set;{const _=new Map;for(const O of y)_.set(O.flow.target,(_.get(O.flow.target)??0)+1);const R=O=>{const $=[],I=new Set([O]),N=[O];for(;N.length;){const j=N.shift();$.push(j);for(const H of y)H.flow.source!==j||I.has(H.flow.target)||(_.get(H.flow.target)??0)!==1||(I.add(H.flow.target),N.push(H.flow.target))}return $},P=(O,$)=>{var I;return((I=Te.get(O))==null?void 0:I.get($))??$};for(const O of b){if(!O.node.type.endsWith("Gateway"))continue;const $=O.node.lane??`pool:${O.node.participant??""}`,I=Te.get($);if(!I||I.size<2)continue;const N=Ae(O);if(N===void 0||P($,N)!==P($,0))continue;const j=P($,N),H=y.filter(xe=>xe.flow.source===O.node.id).map(xe=>k.get(xe.flow.target)).filter(xe=>!!xe&&(xe.node.lane??`pool:${xe.node.participant??""}`)===$),q=H.filter(xe=>{const Re=Ae(xe);return Re!==void 0&&P($,Re)===j&&(_.get(xe.node.id)??0)===1}),ue=H.some(xe=>{const Re=Ae(xe);return Re!==void 0&&P($,Re)>j});if(q.length!==1||!ue)continue;const be=new Set(H.flatMap(xe=>R(xe.node.id)));if(!y.some(xe=>xe.flow.target===O.node.id&&be.has(xe.flow.source)))continue;const Ce=new Map;for(const[xe,Re]of I)Ce.set(xe,Re+1);Ce.set(-1,0),Te.set($,Ce);for(const xe of R(q[0].node.id))k.has(xe)&&(te.set(xe,-1),M.add(xe));gt.add(O.node.id)}}const E=(_,R)=>{var P;return((P=Te.get(_))==null?void 0:P.get(R))??R},w=(_,R,P,O)=>{const $=_?p(_):R?p(R):void 0;if(!$)return!1;const I=_?$.y+Math.min($.height/2,ge):$.y+ie;return Math.abs(I+E(_??`pool:${R??""}`,P)*L-O)<=L/2},G=new Map;for(const[_,R]of ye){let P=0;for(const O of R)P=Math.max(P,E(_,O));G.set(_,P)}const U=_=>Ue+L*_,X=(_,R,P)=>{const O=l().children.filter($=>!("waypoints"in $&&$.waypoints)&&$.id!==R&&typeof $.y=="number"&&$.y>=_);O.length&&n.moveElements(O,{x:0,y:P})},Ee=(_,R,P)=>{const O=_.type==="bpmn:Participant"?_:void 0;if(!O||O.children.some(j=>j.type==="bpmn:Lane"))return;const $=P+R.height/2+je-O.y;if(O.height>=$)return;const I=$-O.height,N=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:$}),X(N,O.id,I)},He=(_,R)=>{const P=R-_.height;if(P<=0)return;const O=d(_)??_,$=[],I=H=>{$.push(H);for(const q of H.children??[])I(q)};I(O);const N=_.y+_.height-10,j=u.calculateAdjustments($,"y",P,N);u.makeSpace(j.movingShapes,j.resizingShapes,{x:0,y:P},"s",N)},it=(_,R,P)=>{if(_){const N=f(_),j=U(R);if(N.height>=j)return;const H=j-N.height,q=d(N),ue=q?q.y+q.height:N.y+N.height;He(N,j),X(ue,q==null?void 0:q.id,H);return}if(!P)return;const O=L*(R+1);if(P.height>=O)return;const $=O-P.height,I=P.y+P.height;n.resizeShape(P,{x:P.x,y:P.y,width:P.width,height:O}),X(I,P.id,$)},Pt=new Map;for(const _ of y)Pt.set(_.flow.target,(Pt.get(_.flow.target)??0)+1);const lt=_=>(Pt.get(_)??0)<=1,zt=(_,R,P)=>{if(!_)return!0;const O=p(_);return O?P-R.height/2>=O.y&&P+R.height/2<=O.y+O.height:!0},nn=h.map((_,R)=>({op:_,declared:R}));nn.sort((_,R)=>{const P=_.op.order??Number.POSITIVE_INFINITY,O=R.op.order??Number.POSITIVE_INFINITY;return P!==O?P-O:_.declared-R.declared});let rn=80;for(const _ of o.getAll())_.parent===l()&&"height"in _&&typeof _.y=="number"&&(rn=Math.max(rn,_.y+_.height+60));for(const{op:_}of nn){const R=_.participant,P=b.filter(Q=>Q.node.participant===R.id).length,O=((x0=R.lanes)==null?void 0:x0.length)??0,$=Math.max(1200,P*160+300),I=(R.lanes??[]).map(Q=>U(G.get(Q.id)??0)),N=I.reduce((Q,Ce)=>Q+Ce,0);O&&N<300&&(I[O-1]+=300-N);const j=Math.max(300,L*((G.get(`pool:${R.id}`)??0)+1)),H=R.blackBox||P+O===0?120:O?Math.max(300,N):j,q=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,..._.order!==void 0?{"bwl:poolOrder":_.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:$,height:H,isExpanded:!0}),ue=n.createShape(q,{x:100+$/2,y:rn+H/2},l()),be=R.lanes??[];if(be.length&&n.splitLane(ue,be.length),be.length){const Q=o.filter(Ce=>{var xe;return Ce.type==="bpmn:Lane"&&((xe=d(Ce))==null?void 0:xe.id)===R.id}).sort((Ce,xe)=>Ce.y-xe.y);if(Q.forEach((Ce,xe)=>{const Re=be[xe];Re&&n.updateProperties(Ce,{id:Re.id,name:Re.name})}),I.some(Ce=>Ce!==ue.height/O)){let Ce=ue.y;Q.forEach((xe,Re)=>{const ut=I[Re];n.resizeShape(xe,{x:xe.x,y:Ce,width:xe.width,height:ut}),Ce+=ut})}}rn=ue.y+ue.height+60}const vt=_=>{var O;const R=k.get(_);if(R)return R.node.participant??"";const P=p(_);return P?P.type==="bpmn:Participant"?P.id:((O=d(P))==null?void 0:O.id)??"":""},At=new Map,vn=_=>{let R=At.get(_);return R||At.set(_,R={nodes:[],flows:[]}),R};for(const _ of b)vn(_.node.participant??"").nodes.push(_);for(const _ of y)vn(vt(_.flow.source)).flows.push(_);const Ar=_=>{var R;return i.create("bpmn:SequenceFlow",{id:_.id,name:_.name??((R=_.condition)==null?void 0:R.label)})},jn=(_,R)=>r.createShape({type:Ts(_.type),businessObject:i.create(Ts(_.type),{id:_.id,name:_.name,...R!==void 0?{"bwl:band":R}:{}})}),Mi=[...nn.map(({op:_})=>_.participant.id).filter(_=>At.has(_)),...[...At.keys()].filter(_=>!h.some(R=>R.participant.id===_))],Hn=_=>_.endsWith("Gateway");for(const _ of Mi){const R=At.get(_),P=_?f(_):void 0,O=P?P.x+150:250;let $=P?P.y+80:120;const I=(ae,me,Pe)=>{if(ae){const ke=f(ae);return ke.y+Math.min(ke.height/2,ge)+E(ae,me??0)*L}return me!==void 0&&P?P.y+ie+E(`pool:${_}`,me)*L:Pe},N=(ae,me,Pe)=>{if(ae){const ke=f(ae);return ke.y+Math.min(ke.height/2,ge)+me*L}return P?P.y+ie+me*L:Pe},j=ae=>ae.participant?f(ae.participant):l(),H=(ae,me,Pe,ke,ct,rt,st)=>{const ze=Pe!==void 0||ke!==void 0,le=E(Pe??`pool:${_}`,ke??0);if((ke===void 0||w(Pe,_,ke,st??Number.NaN))&&st!==void 0&&zt(Pe,me,st)&&!pe(ae,me,ct,st))return{x:ct,y:st};if(ze)for(let Z=0;Z<4;Z++){const fe=N(Pe,le+Z,rt);if(!pe(ae,me,ct,fe))return it(Pe,le+Z,P),{x:ct,y:fe}}const Ke=I(Pe,ke,rt);ze?it(Pe,le,P):Ee(ae,me,Ke);let re=ct;for(let Z=0;Z<64;Z++){const fe=pe(ae,me,re,Ke);if(!fe)break;re=fe.x+fe.width+z+me.width/2}return{x:re,y:Ke}},q=new Set(R.flows.map(ae=>ae.flow.target)),ue=new Map;for(const ae of R.nodes){if(q.has(ae.node.id))continue;const me=jn(ae.node,ae.band),Pe=Y(ae),ke=ae.node.lane?`${ae.node.lane}|${Pe??""}`:Pe!==void 0?`band:${Pe}`:"",ct=j(ae.node),rt=H(ct,me,ae.node.lane,Pe,ue.get(ke)??O,$);n.createShape(me,rt,ct),ue.set(ke,rt.x+me.width+z),!ae.node.lane&&Pe===void 0&&($+=160)}const be=new Set,Q=new Map,Ce=new Map,xe=new Map;if(_&&ce.has(`pool:${_}`)){const ae=new Map;for(const le of R.flows)ae.set(le.flow.target,(ae.get(le.flow.target)??0)+1);const me=le=>I(le.node.lane,Ae(le),Number.NaN),Pe=new Set,ke=le=>{var Z;const Ke=(Z=k.get(le))==null?void 0:Z.node.participant;if(Ke)return p(Ke);const re=p(le);if(re)return re.type==="bpmn:Participant"?re:d(re)},ct=le=>{const Ke=[],re=new Set([le]),Z=[le];for(;Z.length;){const fe=Z.shift(),de=k.get(fe);de&&Ke.push(de);for(const oe of R.flows)oe.flow.source!==fe||re.has(oe.flow.target)||(ae.get(oe.flow.target)??0)!==1||(re.add(oe.flow.target),Z.push(oe.flow.target))}return Ke},rt=le=>{if(!P)return;const Ke=new Set(le.map(fe=>fe.node.id));let re=!1,Z=!1;for(const fe of g){if(!Ke.has(fe.flow.source))continue;const de=ke(fe.flow.target);!de||de.id===P.id||(de.y<P.y?re=!0:Z=!0)}return re&&!Z?"up":Z&&!re?"down":void 0};for(const le of R.nodes){if(!Hn(le.node.type))continue;const Ke=I(le.node.lane,Y(le),Number.NaN);if(Number.isNaN(Ke))continue;const re=[];for(const oe of R.flows){if(oe.flow.source!==le.node.id)continue;const Se=k.get(oe.flow.target);if(!Se||Se.node.lane!==le.node.lane||(ae.get(Se.node.id)??0)!==1)continue;const he=Y(Se);if(he===void 0)continue;const Ve=I(Se.node.lane,he,Number.NaN);if(Number.isNaN(Ve))continue;const Tt=ct(Se.node.id),Je=rt(Tt);Je&&re.push({subtree:Tt,band:he,row:Ve,dir:Je})}if(!re.some(oe=>oe.dir==="up")||!re.some(oe=>oe.dir==="down")||!re.some(oe=>oe.dir==="up"&&re.some(Se=>Se.dir==="down"&&Se.row<oe.row)))continue;const fe=[...re].sort((oe,Se)=>oe.row-Se.row);[...re.filter(oe=>oe.dir==="up"),...re.filter(oe=>oe.dir==="down")].sort((oe,Se)=>oe.dir===Se.dir?oe.row-Se.row:oe.dir==="up"?-1:1).forEach((oe,Se)=>{const he=fe[Se].band;if(he!==oe.band){Pe.add(le.node.id);for(const Ve of oe.subtree)Y(Ve)===oe.band&&te.set(Ve.node.id,he)}})}const st=le=>{if(!P)return;const Ke=new Set(le.map(fe=>fe.node.id));let re=!1,Z=!1;for(const fe of g){if(!Ke.has(fe.flow.target))continue;const de=ke(fe.flow.source);!de||de.id===P.id||(de.y<P.y?re=!0:Z=!0)}return re&&!Z?"up":Z&&!re?"down":void 0};for(const le of R.nodes){if(!Hn(le.node.type))continue;const Ke=le.node.lane??`pool:${_}`,re=Te.get(Ke);if(!re||re.size<2)continue;const Z=re.get(0);if(Z===void 0)continue;const fe=Math.max(...re.values()),de=Z===fe&&Z!==0?"down":void 0;if(!de)continue;const oe=[];for(const Je of R.flows){if(Je.flow.source!==le.node.id)continue;const ot=k.get(Je.flow.target);if(!ot||ot.node.lane!==le.node.lane||(ae.get(ot.node.id)??0)!==1)continue;const Vt=Ae(ot);Vt!==void 0&&oe.push({t:ot,subtree:ct(ot.node.id),band:Vt})}const Se=oe.find(Je=>(re.get(Je.band)??Je.band)===Z);if(!Se||st(Se.subtree)===de||rt(Se.subtree)===de)continue;const he=oe.find(Je=>Je!==Se&&st(Je.subtree)===de);if(!he)continue;const Ve=Se.band,Tt=he.band;for(const Je of Se.subtree)Ae(Je)===Ve&&te.set(Je.node.id,Tt);for(const Je of he.subtree)Ae(Je)===Tt&&te.set(Je.node.id,Ve);Pe.add(le.node.id)}for(const le of R.nodes){if(!Hn(le.node.type))continue;const Ke=me(le);if(Number.isNaN(Ke)||C.some(oe=>{var Se,he;return(((Se=oe.placement)==null?void 0:Se.anchor)??(oe.association?oe.association.source===oe.annotation.id?oe.association.target:oe.association.source:void 0))===le.node.id&&((he=oe.placement)==null?void 0:he.side.startsWith("bottom"))}))continue;let Z,fe=!1,de;for(const oe of R.flows){if(oe.flow.source!==le.node.id)continue;const Se=k.get(oe.flow.target);if(!Se||!Se.node.lane&&Y(Se)===void 0)continue;const he=me(Se);Number.isNaN(he)||(Math.abs(he-Ke)<.5&&(fe=!0),he>Ke?!Z||he>Z.row?Z={id:Se.node.id,row:he,count:1}:he===Z.row&&Z.count++:he<Ke&&Se.node.lane===le.node.lane&&(!de||he>de.row?de={op:Se,row:he,count:1}:he===de.row&&de.count++))}Z&&Z.count===1&&(ae.get(Z.id)??0)===1&&!Pe.has(le.node.id)&&be.add(Z.id),!fe&&de&&de.count===1&&(ae.get(de.op.node.id)??0)===1&&!gt.has(le.node.id)&&Q.set(de.op.node.id,{lane:le.node.lane,band:Ae(le)})}const ze=new Map;for(const le of g)ze.set(le.flow.target,[...ze.get(le.flow.target)??[],le]);for(const le of R.nodes){const Ke=ze.get(le.node.id);if(!Ke||Ke.length!==1||!ae.get(le.node.id)||!le.node.lane&&Y(le)===void 0||M.has(le.node.id))continue;const re=(_0=k.get(Ke[0].flow.source))==null?void 0:_0.node.participant,Z=re?p(re):void 0;if(!Z||!P||Z.id===P.id)continue;const fe=le.node.lane??`pool:${_}`,de=Te.get(fe);if(!de)continue;const oe=de.get(0)??0,Se=(de.get(Ae(le)??0)??oe)-oe;if(Se===0)continue;const he=Z.y<P.y;if(he&&Se<0||!he&&Se>0)continue;let Ve;for(const[Tt,Je]of de){const ot=Je-oe;(he&&ot<0&&(!Ve||ot<Ve.row)||!he&&ot>0&&(!Ve||ot>Ve.row))&&(Ve={band:Tt,row:ot})}Ve&&Ce.set(le.node.id,{lane:le.node.lane,band:Ve.band})}}const Re=new Set;let ut=0;for(;ut++<R.nodes.length+2;){for(let Pe=0;Pe<R.nodes.length+R.flows.length+2;Pe++){let ke=!1;for(const ct of R.flows){const rt=ct.flow;if(Re.has(rt.id))continue;const st=p(rt.source);if(!st)continue;const ze=p(rt.target),le=k.get(rt.target);if(!ze&&le){const Ke=jn(le.node,le.band),re=Ae(le);if(le.node.lane||re!==void 0){const Z=j(le.node),fe=st,de=fe.x+(xe.get(rt.source)??0)+fe.width+z,oe=Q.get(rt.target)??Ce.get(rt.target),Se=H(Z,Ke,oe?oe.lane:le.node.lane,oe?oe.band:re,be.has(rt.target)?fe.x+fe.width/2:de,Number.NaN,oe||!lt(rt.target)?void 0:fe.y+fe.height/2),he=n.createShape(Ke,Se,Z);be.has(rt.target)&&xe.set(rt.target,de-(he.x+he.width/2)),n.connect(st,he,{type:"bpmn:SequenceFlow",businessObject:Ar(rt)})}else s.append(st,Ke,{connection:{type:"bpmn:SequenceFlow",businessObject:Ar(rt)}})}else if(ze)n.connect(st,ze,{type:"bpmn:SequenceFlow",businessObject:Ar(rt)});else continue;Re.add(rt.id),ke=!0}if(!ke)break}const ae=R.nodes.filter(Pe=>!p(Pe.node.id));if(!ae.length)break;const me=ae[0];{const Pe=jn(me.node,me.band),ke=j(me.node),ct=Y(me);n.createShape(Pe,H(ke,Pe,me.node.lane,ct,O,$),ke),!me.node.lane&&ct===void 0&&($+=160)}}}const Dt=40,Kn=(_,R=()=>!0)=>{const P=p(_);if(!P)return[];const O=[P],$=new Set([_]);for(let I=0;I<O.length;I++){const N=O[I].id;for(const j of y){const H=j.flow.target;if(j.flow.source!==N||$.has(H)||!k.has(H))continue;$.add(H);const q=p(H);q&&R(q)&&O.push(q)}}return O},Iu=(_,R=()=>!0)=>{const P=p(_);if(!P)return[];const O=[P],$=new Set([_]);for(let I=0;I<O.length;I++){const N=O[I].id;for(const j of y){const H=j.flow.source;if(j.flow.target!==N||$.has(H)||!k.has(H))continue;$.add(H);const q=p(H);q&&R(q)&&O.push(q)}}return O},Gt=30,Ze=_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number",at=(_,R)=>{const P=new Set(_.flatMap(N=>N.subtree.map(j=>j.id)));for(const N of _){const j=(N.pool.children??[]).filter(Ze).filter(q=>!P.has(q.id));if(N.subtree.some(q=>j.some(ue=>q.x+R<ue.x+ue.width+Gt&&q.x+R+q.width+Gt>ue.x&&q.y<ue.y+ue.height&&q.y+q.height>ue.y)))return null}const O=_.map(N=>N.pool.width),$=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));n.moveElements(_.flatMap(N=>N.subtree),{x:R,y:0});const I=_.map(N=>{const H=Math.max(...N.subtree.map(q=>q.x+q.width))+150-(N.pool.x+N.pool.width);return H>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:N.pool.width+H,height:N.pool.height}),H});return()=>{n.moveElements(_.flatMap(N=>N.subtree),{x:-R,y:0}),_.forEach((N,j)=>{I[j]>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:O[j],height:N.pool.height})});for(let N=0;N<3;N++){let j=0;for(const H of $){const q=H.x-H.label.x,ue=H.y-H.label.y;Math.abs(q)<=.5&&Math.abs(ue)<=.5||(n.moveElements([H.label],{x:q,y:ue}),j++)}if(!j)break}}},J_=_=>{var $,I;const R=new Map,P=new Map;for(const N of o.getAll()){if(N.type!=="bpmn:Participant")continue;const j=N;(j.children??[]).length||(R.set(j.id,j),P.set(j.id,[]))}for(const N of o.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const j=N,H=($=j.source)==null?void 0:$.id,q=(I=j.target)==null?void 0:I.id;H&&q&&P.has(H)&&P.get(H).push(q),H&&q&&P.has(q)&&P.get(q).push(H)}const O=[];for(const[N,j]of P)j.length&&j.every(H=>_.has(H))&&O.push(R.get(N));return O},e0=(_,R)=>{if(!_.length)return null;const P=new Set(_.map(N=>N.id)),O=o.getAll().filter(N=>N.type==="bpmn:Participant"&&!P.has(N.id));if(_.some(N=>O.some(j=>N.x+R<j.x+j.width+Gt&&N.x+R+N.width+Gt>j.x&&N.y<j.y+j.height&&N.y+N.height>j.y)))return null;const I=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));return n.moveElements(_,{x:R,y:0}),()=>{n.moveElements(_,{x:-R,y:0});for(let N=0;N<3;N++){let j=0;for(const H of I){const q=H.x-H.label.x,ue=H.y-H.label.y;Math.abs(q)<=.5&&Math.abs(ue)<=.5||(n.moveElements([H.label],{x:q,y:ue}),j++)}if(!j)break}}},t0=()=>{let _=0;for(const R of o.getAll()){if(R.type!=="bpmn:DataInputAssociation"&&R.type!=="bpmn:DataOutputAssociation")continue;const P=R.waypoints??[];for(let O=1;O<P.length;O++)_+=Math.hypot(P[O].x-P[O-1].x,P[O].y-P[O-1].y)}return _},n0=()=>{let _=0;for(const R of o.getAll()){if(R.type!=="bpmn:Association")continue;const P=R.waypoints??[];for(let O=1;O<P.length;O++)_+=Math.hypot(P[O].x-P[O-1].x,P[O].y-P[O-1].y)}return _},bL=_=>{const R=[];for(const P of o.getAll()){if(P.type!=="bpmn:TextAnnotation")continue;const O=P;if(_.has(O.id))continue;const I=[...O.incoming??[],...O.outgoing??[]].filter(H=>H.type==="bpmn:Association").map(H=>H.source===O?H.target:H.source);if(!I.length||I.some(H=>H===void 0))continue;const N=H=>{if(!("waypoints"in H&&H.waypoints))return[H.id];const q=H,ue=[q.source,q.target];return ue.some(be=>!be)?[]:ue.map(be=>be.id)},j=I.flatMap(H=>N(H));j.length&&j.every(H=>_.has(H))&&R.push(O)}return R},i0=()=>Yt(et(o)).filter(_=>_.kind==="edge-crosses-shape").length,r0=_=>{const R=(_.children??[]).filter(Ze);let P=0;for(let O=0;O<R.length;O++)for(let $=O+1;$<R.length;$++){const I=R[O],N=R[$];I.x<N.x+N.width&&I.x+I.width>N.x&&I.y<N.y+N.height&&I.y+I.height>N.y&&P++}return P},Ko=()=>{const _=et(o),R=P=>P.length>=2&&(P.every(O=>Math.abs(O.x-P[0].x)<.01)||P.every(O=>Math.abs(O.y-P[0].y)<.01));return{messages:_.edges.filter(P=>P.type==="bpmn:MessageFlow"&&P.waypoints.length===2).length,lines:_.edges.filter(P=>R(P.waypoints)).length}},xL=_=>{const R=new Map;for(const O of o.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const $=O;if(!$.waypoints||$.waypoints.length!==2)continue;const I=$.source,N=$.target;if(!I||!N)continue;const j=_.has(I.id);if(j===_.has(N.id))continue;const H=j?N:I,q=d(H);if(!q||_.has(H.id))continue;const ue=R.get(q.id);ue?H.x<ue.minX&&(ue.minX=H.x):R.set(q.id,{pool:q,minX:H.x})}const P=[];for(const{pool:O,minX:$}of R.values()){const I=(O.children??[]).filter(N=>Ze(N)&&!_.has(N.id)&&N.x>=$);I.length&&P.push({subtree:I,pool:O})}return P};for(const _ of en(e,"sequenceFlow.update")){if(_.target===void 0)continue;const R=k.get(_.target);if(!R)continue;const P=p(_.target),O=p(_.id);if(!P||!O)continue;const $=_.source!==void 0?p(_.source):O.source,I=O.target;if(!$||!I||I.id===P.id)continue;const N=Kn(_.target),j=new Set(N.map(ze=>ze.id)),H=Math.min(...N.map(ze=>ze.x)),q=Math.max(...N.map(ze=>ze.x+ze.width)),ue=$.x+$.width,be=q-H+Dt*2-(I.x-ue);let Q=[];if(be>0){const ze=d(P),le=(ze==null?void 0:ze.children)??[],Ke=de=>de.type==="bpmn:Lane";Q=(()=>{const de=new Set;for(const Se of le)Ze(Se)&&!j.has(Se.id)&&Se.id!==$.id&&Se.x>=I.x&&de.add(Se.id);const oe=[];for(const Se of le){if(Se.type!=="bpmn:DataStoreReference"&&Se.type!=="bpmn:DataObjectReference")continue;const he=Se,Tt=[...he.incoming??[],...he.outgoing??[]].filter(Je=>Je.type==="bpmn:DataInputAssociation"||Je.type==="bpmn:DataOutputAssociation").map(Je=>Je.source===he?Je.target:Je.source);Tt.length&&Tt.every(Je=>Je!==void 0&&de.has(Je.id))&&oe.push(he)}return oe})();const Z=le.filter(de=>!("waypoints"in de&&de.waypoints)&&!Ke(de)&&!j.has(de.id)&&de.id!==$.id&&de.x>=I.x),fe=ze?[ze,...le.filter(de=>Ke(de))]:[];if(Z.length){const de=new Set(Z.map(Vt=>Vt.id)),oe=xL(de),Se=new Set(de);for(const Vt of oe)for(const Pn of Vt.subtree)Se.add(Pn.id);const he=bL(Se),Ve=J_(de),Tt=new Set(de);for(const Vt of oe)for(const Pn of Vt.subtree)Tt.add(Pn.id);const Je=oe.length?J_(Tt):Ve;n.createSpace(Z,fe,{x:be,y:0},"e",I.x-1);let ot=!1;if(oe.length){const Vt=Ko(),Pn=at(oe,be);if(Pn){const En=Je.length?e0(Je,be):null,to=Ko();to.messages>Vt.messages&&to.lines>=Vt.lines?ot=!0:(En==null||En(),Pn())}}if(!ot){for(const Vt of oe){const Pn=Ko(),En=at([Vt],be);if(!En)continue;const to=Ko();(to.messages<=Pn.messages||to.lines<Pn.lines)&&En()}if(Ve.length){const Vt=Ko(),Pn=e0(Ve,be);if(Pn){const En=Ko();(En.messages<=Vt.messages||En.lines<Vt.lines)&&Pn()}}}if(he.length){const Vt=()=>new Set(Yt(et(o)).map(En=>Ut(En))),Pn=En=>{const to=n0(),LL=Vt(),IL=En.map(Lt=>({a:Lt,x:Lt.x,y:Lt.y})),BL=o.filter(Lt=>Lt.type==="label").map(Lt=>({label:Lt,x:Lt.x,y:Lt.y}));n.moveElements(En,{x:be,y:0});const NL=[...Vt()].filter(Lt=>!LL.has(Lt));if(n0()<to&&NL.length===0)return!0;for(const{a:Lt,x:ss,y:cs}of IL)(Lt.x!==ss||Lt.y!==cs)&&n.moveElements([Lt],{x:ss-Lt.x,y:cs-Lt.y});for(const Lt of BL){const ss=Lt.x-Lt.label.x,cs=Lt.y-Lt.label.y;(ss!==0||cs!==0)&&n.moveElements([Lt.label],{x:ss,y:cs})}return!1};if(!Pn(he)&&he.length>1)for(const En of he)Pn([En])}}}const Ce=R.node.lane!==void 0?p(R.node.lane):R.node.participant!==void 0?p(R.node.participant):void 0,xe=ze=>{if(!Ce)return!0;const le=ze.y+ze.height/2;return le>=Ce.y&&le<=Ce.y+Ce.height},Re=!xe($)&&xe(I)?I:$,ut=Re.y+Re.height/2,ae=ut-(P.y+P.height/2),me=R.band!==void 0,Pe=me?[P]:N,ke=(R.band===void 0||w(R.node.lane,R.node.participant,R.band,ut))&<(_.target)&&Pe.every(ze=>{var le;return zt((le=k.get(ze.id))==null?void 0:le.node.lane,ze,ze.y+ze.height/2+ae)}),ct=ze=>Math.abs(ze.y+ze.height/2-(P.y+P.height/2))<=L/2;if(ke&&me){const ze=Math.abs(ae)<=L/2?N.filter(le=>le.id!==P.id&&ct(le)):[];if(n.moveElements(N,{x:ue+Dt-H,y:0}),n.moveElements([P],{x:0,y:ae}),ze.length){const le=()=>new Set(Yt(et(o)).map(oe=>Ut(oe))),Ke=le(),re=o.filter(oe=>oe.type==="label").map(oe=>({label:oe,x:oe.x,y:oe.y}));n.moveElements(ze,{x:0,y:ae});const Z=le(),fe=[...Z].filter(oe=>!Ke.has(oe)).length,de=[...Ke].filter(oe=>!Z.has(oe)).length;if(fe>de){n.moveElements(ze,{x:0,y:-ae});for(const oe of re){const Se=oe.x-oe.label.x,he=oe.y-oe.label.y;(Se!==0||he!==0)&&n.moveElements([oe.label],{x:Se,y:he})}}}}else n.moveElements(N,{x:ue+Dt-H,y:ke?ae:0});const rt=d(P);if(!ke&&R.node.lane===void 0&&R.band!==void 0&&rt){const ze=rt.y+ie+E(`pool:${R.node.participant??""}`,R.band)*L,le=ze-(P.y+P.height/2);le!==0&&!pe(rt,P,P.x+P.width/2,ze,j)&&n.moveElements([P],{x:0,y:le})}const st=Q.length?d(Q[0]):void 0;if(st){const ze={assoc:t0(),overlaps:r0(st),crosses:i0()},le=Q.map(he=>({st:he,x:he.x})),Ke=o.filter(he=>he.type==="label").map(he=>({label:he,x:he.x,y:he.y})),re=Math.min(...Q.flatMap(he=>[...he.incoming??[],...he.outgoing??[]].filter(Ve=>Ve.type==="bpmn:DataInputAssociation"||Ve.type==="bpmn:DataOutputAssociation").map(Ve=>(Ve.source===he?Ve.target:Ve.source).x))),Z=new Set(Q.map(he=>he.id)),fe=(st.children??[]).filter(Ze).filter(he=>!Z.has(he.id));let de=re;for(const he of[...Q].sort((Ve,Tt)=>Ve.x-Tt.x)){let Ve=de;for(let Tt=0;Tt<100;Tt++){const Je=fe.find(ot=>Ve<ot.x+ot.width+Gt&&Ve+he.width+Gt>ot.x&&he.y<ot.y+ot.height&&he.y+he.height>ot.y);if(!Je)break;Ve=Je.x+Je.width+Gt}Ve!==he.x&&n.moveElements([he],{x:Ve-he.x,y:0}),de=Ve+he.width+Gt}const oe=de+150-(st.x+st.width);oe>0&&n.resizeShape(st,{x:st.x,y:st.y,width:st.width+oe,height:st.height});const Se={assoc:t0(),overlaps:r0(st),crosses:i0()};if(Se.assoc>=ze.assoc||Se.overlaps>ze.overlaps||Se.crosses>ze.crosses){for(const{st:he,x:Ve}of le)he.x!==Ve&&n.moveElements([he],{x:Ve-he.x,y:0});oe>0&&n.resizeShape(st,{x:st.x,y:st.y,width:st.width-oe,height:st.height});for(const he of Ke){const Ve=he.x-he.label.x,Tt=he.y-he.label.y;(Ve!==0||Tt!==0)&&n.moveElements([he.label],{x:Ve,y:Tt})}}}}const o0=(_,R)=>{const P=R.target===_,O=f(R.source),$=f(R.target),I=P?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,$,R.id?{type:I,businessObject:i.create(I,{id:R.id})}:{type:I})},_L=100,a0=_=>{for(const R of h){if(!R.participant.blackBox)continue;const P=p(R.participant.id);if(!P)continue;const O=[];for(const I of g){const N=I.flow.source===R.participant.id?I.flow.target:I.flow.target===R.participant.id?I.flow.source:void 0,j=N?p(N):void 0;j&&typeof j.x=="number"&&j.type!=="bpmn:Participant"&&O.push(j)}if(!O.length)continue;if(!_&&R.order===void 0){const I=(()=>{var j;const N=new Map;for(const H of O){const q=d(H);if(!q)continue;const ue=N.get(q.id);ue?ue.n+=1:N.set(q.id,{shape:q,n:1})}return(j=[...N.values()].sort((H,q)=>q.n-H.n)[0])==null?void 0:j.shape})();if(I){const N=q=>q.reduce((ue,be)=>ue+be,0)/q.length,j=N(O.map(q=>q.y+q.height/2))<I.y+I.height/2,H=o.filter(q=>q.type==="bpmn:Participant"&&q.id!==R.participant.id&&q.id!==I.id).filter(q=>j?q.y+q.height<=I.y+5:q.y>=I.y+I.height-5);if(H.length){const q=[...H.reduce((Q,Ce)=>Q.set(Ce.y,(Q.get(Ce.y)??0)+1),new Map)].sort((Q,Ce)=>Ce[1]-Q[1]||(j?Ce[0]-Q[0]:Q[0]-Ce[0]))[0][0],ue=Math.min(P.width,P1),be=Math.round(N(O.map(Q=>Q.x+Q.width/2))-ue/2);if(be!==P.x||q!==P.y||ue!==P.width){const Q=()=>new Set(Yt(et(o)).map(me=>Ut(me))),Ce=Q(),xe={x:P.x,y:P.y,width:P.width,height:P.height};n.resizeShape(P,{x:be,y:q,width:ue,height:P.height});const Re=Q(),ut=[...Re].filter(me=>!Ce.has(me)).length,ae=[...Ce].filter(me=>!Re.has(me)).length;ut>ae&&n.resizeShape(P,xe)}}}}const $=Math.max(...O.map(I=>I.x+I.width/2))+_L;if($>P.x+P.width&&n.resizeShape(P,{x:P.x,y:P.y,width:$-P.x,height:P.height}),!!_)for(const I of g){const N=p(I.flow.id),j=I.flow.source===R.participant.id?I.flow.target:I.flow.target===R.participant.id?I.flow.source:void 0,H=j?p(j):void 0;if(!N||!H||H.type==="bpmn:Participant")continue;const q=H.x+H.width/2;if(q<P.x+10||q>P.x+P.width-10)continue;const ue=P.y>H.y,be=ue?H.y+H.height:H.y,Q=ue?P.y:P.y+P.height,Ce=I.flow.source===R.participant.id?[{x:q,y:Q},{x:q,y:be}]:[{x:q,y:be},{x:q,y:Q}],xe=et(o),Re={...xe.edges.find(ut=>ut.id===I.flow.id),waypoints:Ce};an(Re,Wn(xe)).length||n.updateWaypoints(N,Ce)}}};a0(!1);for(const _ of g){const R=_.flow;n.connect(f(R.source),f(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const P=new Set([...y.map(H=>H.flow.id),...g.map(H=>H.flow.id)].filter(H=>!!H)),O=o.filter(H=>!!H.waypoints),$=(H,q)=>Math.abs(q.x-H.x)<2?"L":Math.abs(q.x-(H.x+H.width))<2?"R":Math.abs(q.y-H.y)<2?"T":Math.abs(q.y-(H.y+H.height))<2?"B":void 0,I=new Map,N=(H,q,ue)=>{if(!H||!q||typeof H.x!="number")return;const be=$(H,q);if(!be)return;let Q=I.get(H.id);Q||I.set(H.id,Q=new Map),Q.set(be,[...Q.get(be)??[],ue])};for(const H of O){const q=H.waypoints;!q||q.length<2||(N(H.source,q[0],{id:H.id,dir:"out"}),N(H.target,q[q.length-1],{id:H.id,dir:"in"}))}const j=new Set;for(const[H,q]of I){const ue=p(H);if(!ue||typeof ue.x!="number"||![...q.values()].some(me=>{const Pe=me.filter(ke=>ke.dir==="in");return me.length>=3&&Pe.length>=1&&me.some(ke=>ke.dir==="out")&&Pe.some(ke=>P.has(ke.id))}))continue;const Q=d(ue);if(!Q||j.has(Q.id)||(Q.children??[]).some(me=>me.type==="bpmn:Lane"))continue;const Ce=(w0=q.get("T"))!=null&&w0.length?(E0=q.get("B"))!=null&&E0.length?void 0:"B":"T";if(!Ce||(Ce==="T"?ue.y-Q.y:Q.y+Q.height-(ue.y+ue.height))>=L)continue;const Re=(Q.children??[]).filter(me=>!("waypoints"in me&&me.waypoints)&&me.type!=="label"&&typeof me.x=="number"),ut=Q.y+Q.height;n.resizeShape(Q,{x:Q.x,y:Q.y,width:Q.width,height:Q.height+L});const ae=l().children.filter(me=>!("waypoints"in me&&me.waypoints)&&me.id!==Q.id&&typeof me.y=="number"&&me.y>=ut);ae.length&&n.moveElements(ae,{x:0,y:L}),Ce==="T"&&Re.length&&n.moveElements(Re,{x:0,y:L}),j.add(Q.id)}}const fd=20,s0=4,wL=2,EL=[10,30,80],Xo=()=>{const _=et(o);return{bad:Yt(_).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:rh(_),straight:_.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Zo=_=>{const R=et(o),P=R.edges.find(O=>O.id===_);return P?an(P,Wn(R)).length:0},Bu=_=>Zo(_)>0,Nu=_=>et(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==_&&R.waypoints.length===2).length,SL=(_,R,P)=>at([{subtree:_,pool:R}],P),c0=(_,R)=>R.bad>_.bad||R.crossings>_.crossings&&R.straight<=_.straight&&R.bad>=_.bad,$u=(_,R)=>c0(_,R)||R.straight<_.straight,Fu=(_,R,P=()=>!0,O=c0)=>{const $=Xo(),I=at(_,R);if(!I)return!1;const N=Xo();return O($,N)||!P()?(I(),!1):!0},u0=(_,R,P,O=()=>!0)=>Fu([{subtree:_,pool:R}],P,O),Qr=_=>{var R;return!!((R=k.get(_))!=null&&R.node.participant)},os=new Map;for(const _ of g){if(!Qr(_.flow.target))continue;const R=os.get(_.flow.target)??[];R.push(_),os.set(_.flow.target,R)}const ju=[...os.keys()],dd=new Set(y.map(_=>_.flow.target)),l0=_=>nn.findIndex(({op:R})=>R.participant.id===_);ju.sort((_,R)=>{var $,I;const P=dd.has(_)?1:0,O=dd.has(R)?1:0;return P!==O?P-O:l0(($=k.get(_))==null?void 0:$.node.participant)-l0((I=k.get(R))==null?void 0:I.node.participant)});const Jr=_=>_.x+_.width/2,RL=_=>{const R=new Map;for(const $ of o.getAll()){const I=$;if(!I.waypoints||!I.source||!I.target)continue;(R.get(I.source.id)??R.set(I.source.id,[]).get(I.source.id)).push(I.target.id)}const P=new Set([_]),O=[_];for(let $=0;$<O.length;$++)for(const I of R.get(O[$])??[])P.has(I)||(P.add(I),O.push(I));return P},CL=(_,R)=>{const P=RL(R);let O;for(const $ of o.getAll()){const I=$;if(I.type!=="bpmn:MessageFlow"||!I.source||!I.target||I.target.id!==_||P.has(I.source.id))continue;const N=I.source;if(typeof N.x!="number"||N.type==="bpmn:Participant")continue;const j=Jr(N);(O===void 0||j>O)&&(O=j)}return O},hd=(_,R)=>{const P=p(_.flow.source);if(P)return P.type==="bpmn:Participant"?CL(P.id,R):Jr(P)},p0=_=>{let R;for(const P of os.get(_)??[]){const O=hd(P,_);O!==void 0&&(!R||O>R.cx)&&(R={op:P,cx:O})}return R==null?void 0:R.op},PL=_=>{const R=p0(_),P=p(_),O=R?hd(R,_):void 0;return P&&O!==void 0?O-Jr(P):void 0},AL=_=>{const R=PL(_);return R!==void 0&&Math.abs(R)<fd},f0=(_,R,P,O,$)=>{var I;for(let N=!0;N;){N=!1;for(const j of g){if(j.flow.id===P)continue;const H=R.has(j.flow.source),q=R.has(j.flow.target);if(H===q||O(H?j.flow.source:j.flow.target))continue;const ue=H?j.flow.target:j.flow.source;if($(ue)||!Qr(ue))continue;const be=p(j.flow.id);if(!(be!=null&&be.waypoints)||be.waypoints.length!==2)continue;const Q=p(ue),Ce=(I=k.get(ue))==null?void 0:I.node.participant;if(!Q||!Ce)continue;const xe=Kn(ue,Re=>Re.x>=Q.x).filter(Re=>!R.has(Re.id));if(!(!xe.length||xe.some(Re=>$(Re.id)))){for(const Re of xe)R.add(Re.id);_.set(Ce,[..._.get(Ce)??[],...xe]),N=!0}}}return[..._].map(([N,j])=>({subtree:j,pool:f(N)}))},d0=(_,R,P,O,$)=>f0(new Map([[R,[..._]]]),new Set(_.map(I=>I.id)),O,I=>I===P,I=>I===$),md=_=>{const R=p0(_);if(!R)return null;const P=p(_),O=p(R.flow.source),$=hd(R,_);if(!P||!O||$===void 0)return null;const I=$-Jr(P);if(I>=fd){const N=k.get(_).node.participant,j=Kn(_,H=>H.x>=P.x);return{groups:d0(j,N,_,R.flow.id,R.flow.source),dx:I}}if(-I>=fd&&Qr(R.flow.source)){const N=k.get(R.flow.source).node.participant,j=Kn(R.flow.source,H=>H.x>=O.x&&!AL(H.id));return{groups:d0(j,N,R.flow.source,R.flow.id,_),dx:-I}}return null},h0=()=>ju.map(_=>({id:_,plan:md(_)})).filter(_=>!!_.plan).sort((_,R)=>Math.min(..._.plan.groups.flatMap(P=>P.subtree.map(O=>O.x)))-Math.min(...R.plan.groups.flatMap(P=>P.subtree.map(O=>O.x)))).map(_=>_.id);for(let _=0;_<3;_++){const R=Xo(),P=[];for(const $ of h0()){const I=md($);if(!I)continue;const N=at(I.groups,I.dx);N&&P.push(N)}if(!P.length)break;if(!$u(R,Xo()))continue;for(const $ of P.reverse())$();let O=!1;for(const $ of h0()){const I=md($);I&&Fu(I.groups,I.dx,()=>!0,$u)&&(O=!0)}if(!O)break}for(const _ of ju){if(dd.has(_))continue;const R=k.get(_);if(!R||R.node.lane!==void 0)continue;const P=Y(R);if(P===void 0)continue;const O=p(_),$=O?d(O):void 0;if(!O||!$)continue;const I=$.y+ie+E(`pool:${R.node.participant??""}`,P)*L,N=I-(O.y+O.height/2);N!==0&&!pe($,O,O.x+O.width/2,I)&&n.moveElements([O],{x:0,y:N})}for(const _ of ju.flatMap(R=>os.get(R)??[])){if(!Bu(_.flow.id))continue;const R=p(_.flow.target);if(!R)continue;const P=f(k.get(_.flow.target).node.participant),O=Kn(_.flow.target,j=>j.x>=R.x),$=R.width+z,I=Zo(_.flow.id),N=Nu(_.flow.id);for(let j=1;j<=s0;j++){const H=()=>Zo(_.flow.id)<I&&Nu(_.flow.id)>=N;if(u0(O,P,$*j,H))break}}for(const _ of g){if(!Bu(_.flow.id))continue;const R=p(_.flow.source),P=p(_.flow.target);if(!R||!P||R.type==="bpmn:Participant"||P.type==="bpmn:Participant")continue;const O=R.x+R.width/2;if(Math.abs(O-(P.x+P.width/2))>15)continue;const[$,I]=R.y<P.y?[R.y+R.height,P.y]:[P.y+P.height,R.y],N=[...k.values()].map(j=>p(j.node.id)).filter(j=>!!j&&j.id!==R.id&&j.id!==P.id).filter(j=>j.x<=O&&O<=j.x+j.width&&j.y+j.height>$&&j.y<I).sort((j,H)=>j.x-H.x);for(const j of N){const H=(S0=k.get(j.id))==null?void 0:S0.node.participant,q=H?p(H):void 0;if(!q)continue;const ue=[...k.values()].filter(Pe=>Pe.node.participant===H).map(Pe=>Pe.node.id),be=Pe=>Pe.map(ke=>p(ke)).filter(ke=>!!ke),Ce=[Iu(j.id,Pe=>{var ke;return((ke=k.get(Pe.id))==null?void 0:ke.node.participant)===H}),be(ue)].filter(Pe=>Pe.length),xe=j.width+z,Re=Zo(_.flow.id),ut=Nu(_.flow.id),ae=()=>Zo(_.flow.id)<Re&&Nu(_.flow.id)>=ut;let me=!1;for(const Pe of Ce){for(let ke=1;ke<=s0;ke++)if(u0(Pe,q,xe*ke,ae)){me=!0;break}if(me)break}if(!Bu(_.flow.id))break}}for(const _ of g){if(!Bu(_.flow.id))continue;const R=p(_.flow.id);if(((R0=R==null?void 0:R.waypoints)==null?void 0:R0.length)!==2)continue;const P=p(_.flow.source),O=p(_.flow.target);if(!P||!O||P.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!Qr(_.flow.source)||!Qr(_.flow.target)||Math.abs(Jr(P)-Jr(O))>wL)continue;const $=Jr(P),I=R.waypoints.map(Re=>Re.y),[N,j]=[Math.min(...I),Math.max(...I)],H=Wn(et(o)).filter(Re=>Re.id!==P.id&&Re.id!==O.id&&Re.x<$&&$<Re.x+Re.width&&N<Re.y+Re.height&&Re.y<j);if(!H.length)continue;const q=(C0=k.get(_.flow.source))==null?void 0:C0.node.participant,ue=(P0=k.get(_.flow.target))==null?void 0:P0.node.participant;if(!q||!ue)continue;const be=new Map;for(const[Re,ut,ae]of[[_.flow.source,P,q],[_.flow.target,O,ue]]){const me=be.get(ae)??[],Pe=Kn(Re,ke=>ke.x>=ut.x).filter(ke=>!me.some(ct=>ct.id===ke.id));be.set(ae,[...me,...Pe])}const Q=new Set([...be.values()].flat().map(Re=>Re.id)),Ce=f0(be,Q,_.flow.id,Re=>Re===_.flow.source||Re===_.flow.target,()=>!1),xe=Math.max(...H.map(Re=>Re.x+Re.width));for(const Re of EL){const ut=xe+Re-$;if(ut<=0)continue;if(Fu(Ce,ut,()=>{var me,Pe;return Zo(_.flow.id)===0&&((Pe=(me=p(_.flow.id))==null?void 0:me.waypoints)==null?void 0:Pe.length)===2},$u))break}}{const _=P=>P.y+P.height/2,R=[];for(const P of k.keys()){if(!Qr(P))continue;const O=y.filter(N=>N.flow.target===P);if(O.length!==1)continue;const $=p(O[0].flow.source),I=p(P);!$||!I||!k.has($.id)||Math.abs(_($)-_(I))>1||I.x-($.x+$.width)<=z+1||R.push({id:P,pred:$,node:I})}R.sort((P,O)=>P.node.x-O.node.x);for(const{id:P}of R){const O=k.get(P),$=p(P),I=p(y.find(Q=>Q.flow.target===P).flow.source);if(!$||!I)continue;const N=$.x-(I.x+I.width);if(N<=z+1)continue;const j=f(O.node.participant),H=Kn(P,Q=>Q.x>=$.x),q=Xo(),ue=SL(H,j,-(N-z));if(!ue)continue;const be=Xo();(be.bad>q.bad||be.crossings>=q.crossings||be.straight<q.straight)&&ue()}}a0(!0);for(const _ of v){const R=_.associations??[],P=R.map(I=>I.source===_.dataStore.id?I.target:I.source).map(p).find(Boolean),O=P?d(P)??l():l(),$=P?{x:P.x+P.width/2,y:P.y+P.height+110}:{x:200,y:rn+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:_.dataStore.id,name:_.dataStore.name})},$,O);for(const I of R)o0(_.dataStore.id,I)}for(const _ of x){const P=f(_.association.target).type==="bpmn:DataStoreReference"?_.association.target:_.association.source;o0(P,_.association)}let m0=0;const eo=10,g0=40,TL=(_,R)=>{const P=R.map(H=>d(H)).filter(H=>!!H);for(const H of P){const q=eo,ue=H.y,be=H.y+H.height,Q=H.x,Ce=H.x+H.width;if(Math.abs(_.y-ue)<q){const xe=ue+q-_.y;_.y+=xe,_.height-=xe}if(Math.abs(_.y+_.height-be)<q&&(_.height=be-q-_.y),Math.abs(_.x-Q)<q){const xe=Q+q-_.x;_.x+=xe,_.width-=xe}Math.abs(_.x+_.width-Ce)<q&&(_.width=Ce-q-_.x)}if(!P.length)return;const O=Math.min(...P.map(H=>H.y)),$=Math.max(...P.map(H=>H.y+H.height)),I=O-_.y,N=_.y+_.height-$,j=g0-eo;if(I>0!=N>0)if(I>0&&I<j){const H=I+eo;_.y+=H,_.height-=H}else N>0&&N<j&&(_.height-=N+eo)},ML=(_,R)=>{const P=eo,O=30,$=o.filter(I=>I.type==="bpmn:Group"&&I.id!==R);for(const I of $){const N=I.x,j=I.x+I.width,H=I.y,q=I.y+I.height,ue=_.y<q&&H<_.y+_.height,be=_.x<j&&N<_.x+_.width;if(ue){if(Math.abs(_.x-j)<P){const Q=Math.min(j+P-_.x,O);Q>0&&_.width-Q>0&&(_.x+=Q,_.width-=Q)}if(Math.abs(_.x+_.width-N)<P){const Q=Math.min(_.x+_.width-(N-P),O);Q>0&&_.width-Q>0&&(_.width-=Q)}}if(be){if(Math.abs(_.y-q)<P){const Q=Math.min(q+P-_.y,O);Q>0&&_.height-Q>0&&(_.y+=Q,_.height-=Q)}if(Math.abs(_.y+_.height-H)<P){const Q=Math.min(_.y+_.height-(H-P),O);Q>0&&_.height-Q>0&&(_.height-=Q)}}}},gd=(_,R)=>{const P=g0,O=Math.min(..._.map(H=>H.x))-P,$=Math.min(..._.map(H=>H.y))-P,I=Math.max(..._.map(H=>H.x+H.width))+P,N=Math.max(..._.map(H=>H.y+H.height))+P,j={x:O,y:$,width:I-O,height:N-$};return TL(j,_),ML(j,R),j};for(const _ of T){const R=(_.group.members??[]).map(p).filter($=>!!$);let P;R.length?P=gd(R,_.group.id):(P={x:300+m0*350,y:40,width:300,height:200},m0++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:_.group.id}),width:P.width,height:P.height},{x:P.x+P.width/2,y:P.y+P.height/2},l());_.group.name&&n.updateLabel(O,_.group.name),(A0=_.group.members)!=null&&A0.length&&A(O,"bwl:Members",{refs:_.group.members.join(" ")})}{const _=o.filter($=>!!$.waypoints),R=new Map,P=($,I)=>{!$||!I||(R.has($)||R.set($,new Set),R.get($).add(I))};for(const $ of _){const I=(T0=$.source)==null?void 0:T0.id,N=(M0=$.target)==null?void 0:M0.id;P(I,N),((k0=$.type)!=null&&k0.includes("DataOutputAssociation")||(O0=$.type)!=null&&O0.includes("DataInputAssociation")||$.type==="bpmn:Association")&&P(N,I)}const O=o.filter($=>$.type==="bpmn:Group");for(const $ of O){const N=(((D0=$.businessObject.extensionElements)==null?void 0:D0.values)??[]).find(ae=>ae.$type==="bwl:Members"),j=((N==null?void 0:N.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const H=new Set(j),q=[...j];for(;q.length;){const ae=q.shift();for(const me of R.get(ae)??[])H.has(me)||(H.add(me),q.push(me))}const ue=$.x,be=$.x+$.width,Q=$.y,Ce=$.y+$.height,xe=ae=>y.filter(me=>me.flow.target===ae).length,Re=ae=>{var Pe;const me=((Pe=p(ae))==null?void 0:Pe.type)??"";if(me==="bpmn:StartEvent"&&xe(ae)===0)return!1;if(me.endsWith("Gateway")){const ke=y.filter(ct=>ct.flow.target===ae).map(ct=>ct.flow.source);if(ke.length&&ke.every(ct=>{var rt;return((rt=p(ct))==null?void 0:rt.type)==="bpmn:StartEvent"&&xe(ct)===0}))return!1}return!0},ut=o.filter(ae=>Ze(ae)).filter(ae=>ae.type!=="bpmn:Group"&&ae.type!=="bpmn:Participant"&&ae.type!=="bpmn:TextAnnotation"&&!H.has(ae.id)&&Qr(ae.id)&&Re(ae.id)&&ae.x<be&&ae.x+ae.width>ue&&ae.y<Ce&&ae.y+ae.height>Q);if(ut.length)for(const ae of[-1,1]){const me=ut.filter(re=>(re.x+re.width-ue<=be-re.x?-1:1)===ae);if(!me.length)continue;const Pe=[];for(const re of me){const Z=Pe.find(fe=>fe.some(de=>re.y<de.y+de.height&&re.y+re.height>de.y));Z?Z.push(re):Pe.push([re])}const ke=new Map;for(const re of Pe){let Z=ae<0?ue-eo:be+eo;for(const fe of[...re].sort((de,oe)=>ae<0?oe.x-de.x:de.x-oe.x)){const de=ae<0?Math.min(fe.x,Z-fe.width):Math.max(fe.x,Z);Z=ae<0?de-Gt:de+fe.width+Gt,de!==fe.x&&Math.sign(de-fe.x)===ae&&ke.set(fe.id,de-fe.x)}}const ct=new Map,rt=re=>ct.get(re)===re||!ct.get(re)?re:rt(ct.get(re));for(const re of me)ct.set(re.id,re.id);for(const re of g){const Z=ke.has(re.flow.source)?re.flow.source:void 0,fe=ke.has(re.flow.target)?re.flow.target:void 0;if(!Z||!fe)continue;const de=p(re.flow.id);((L0=de==null?void 0:de.waypoints)==null?void 0:L0.length)===2&&ct.set(rt(Z),rt(fe))}const st=new Map;for(const re of me){if(!ke.has(re.id))continue;const Z=rt(re.id);st.set(Z,[...st.get(Z)??[],re])}const ze=[...st.values()].sort((re,Z)=>ae<0?Math.min(...re.map(fe=>fe.x))-Math.min(...Z.map(fe=>fe.x)):Math.max(...Z.map(fe=>fe.x))-Math.max(...re.map(fe=>fe.x))),le=[];let Ke=!0;for(const re of ze){const Z=re.map(oe=>ke.get(oe.id)??0).reduce((oe,Se)=>Math.abs(Se)>Math.abs(oe)?Se:oe,0),fe=new Map;let de=!0;for(const oe of re){const Se=d(oe);if(!Se){de=!1;break}fe.has(Se.id)||fe.set(Se.id,{subtree:[],pool:Se}),fe.get(Se.id).subtree.push(oe)}de&&Fu([...fe.values()],Z,()=>!0,$u)?le.push({shapes:re,dx:Z}):Ke=!1}if(!Ke)for(const re of le.reverse())n.moveElements(re.shapes,{x:-re.dx,y:0})}}}{const _=new Set([...T.map(R=>R.group.id),...en(e,"group.update").map(R=>R.id)]);for(const R of o.filter(P=>P.type==="bpmn:Group")){if(_.has(R.id))continue;const O=(((I0=R.businessObject.extensionElements)==null?void 0:I0.values)??[]).find(j=>j.$type==="bwl:Members"),$=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(p).filter(j=>!!j);!$.length||!$.some(j=>{const H=m.get(j.id);return!H||H.x!==j.x||H.y!==j.y})||!$.some(j=>j.x<R.x||j.y<R.y||j.x+j.width>R.x+R.width||j.y+j.height>R.y+R.height)||n.resizeShape(R,gd($,R.id))}}{const R=new Map(ho(et(o)).map(j=>[j.owner,j.rect])),P=o.filter(j=>!!j.waypoints),O=new Map,$=(j,H)=>{!j||!H||(O.has(j)||O.set(j,new Set),O.get(j).add(H))};for(const j of P){const H=(B0=j.source)==null?void 0:B0.id,q=(N0=j.target)==null?void 0:N0.id;$(H,q),(($0=j.type)!=null&&$0.includes("DataOutputAssociation")||(F0=j.type)!=null&&F0.includes("DataInputAssociation")||j.type==="bpmn:Association")&&$(q,H)}const I=j=>y.filter(H=>H.flow.target===j).length,N=j=>{var q;const H=((q=p(j))==null?void 0:q.type)??"";if(H==="bpmn:StartEvent"&&I(j)===0)return!1;if(H.endsWith("Gateway")){const ue=y.filter(be=>be.flow.target===j).map(be=>be.flow.source);if(ue.length&&ue.every(be=>{var Q;return((Q=p(be))==null?void 0:Q.type)==="bpmn:StartEvent"&&I(be)===0}))return!1}return!0};for(const j of o.filter(H=>H.type==="bpmn:Group")){const q=(((j0=j.businessObject.extensionElements)==null?void 0:j0.values)??[]).find(Z=>Z.$type==="bwl:Members"),ue=((q==null?void 0:q.refs)??"").split(" ").filter(Boolean);if(!ue.length)continue;const be=ue.map(p).filter(Z=>!!Z);if(!be.length||!(T.some(Z=>Z.group.id===j.id)||en(e,"group.update").some(Z=>Z.id===j.id)||be.some(Z=>{const fe=m.get(Z.id);return!fe||fe.x!==Z.x||fe.y!==Z.y})))continue;const Ce=new Set(ue),xe=[...ue];for(;xe.length;){const Z=xe.shift();for(const fe of O.get(Z)??[])Ce.has(fe)||(Ce.add(fe),xe.push(fe))}const Re=j.x,ut=j.x+j.width,ae=j.y,me=j.y+j.height,Pe=Z=>{const fe=R.get(Z.id),de={x:Z.x,y:Z.y,width:Z.width,height:Z.height};return fe?[de,{x:fe.x,y:fe.y,width:fe.width,height:fe.height}]:[de]},ke=be.flatMap(Pe),ct=Math.min(...ke.map(Z=>Z.x)),rt=Math.max(...ke.map(Z=>Z.x+Z.width)),st=Math.min(...ke.map(Z=>Z.y)),ze=Math.max(...ke.map(Z=>Z.y+Z.height)),le={L:ct-Re,R:ut-rt,T:st-ae,B:me-ze},Ke=o.filter(Z=>Ze(Z)).filter(Z=>Z.type!=="bpmn:Group"&&Z.type!=="bpmn:Participant"&&Z.type!=="bpmn:TextAnnotation"&&!Ce.has(Z.id)&&N(Z.id)&&Z.x<ut&&Z.x+Z.width>Re&&Z.y<me&&Z.y+Z.height>ae);if(!Ke.length)continue;const re={L:0,R:0,T:0,B:0};for(const Z of Ke){const fe=Pe(Z),de=Math.min(...fe.map(ot=>ot.x)),oe=Math.max(...fe.map(ot=>ot.x+ot.width)),Se=Math.min(...fe.map(ot=>ot.y)),he=Math.max(...fe.map(ot=>ot.y+ot.height)),Ve={L:oe-Re,R:ut-de,T:he-ae,B:me-Se},Tt=["L","R","T","B"].filter(ot=>Ve[ot]<=le[ot]+.001);if(!Tt.length)continue;const Je=Tt.reduce((ot,Vt)=>Ve[Vt]<Ve[ot]?Vt:ot,Tt[0]);re[Je]=Math.max(re[Je],Math.min(Ve[Je]+10,le[Je]))}!re.L&&!re.R&&!re.T&&!re.B||n.resizeShape(j,{x:j.x+re.L,y:j.y+re.T,width:j.width-re.L-re.R,height:j.height-re.T-re.B})}}const y0=_=>{const R=_.waypoints;if(R!=null&&R.length){const O=R[Math.floor((R.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const P=_;return{x:P.x,y:P.y,width:P.width,height:P.height}};let as=0;const v0=12,b0=14,kL=15,OL=300,DL=_=>{const R=_.split(`
|
|
7
|
-
`),P=Math.max(...R.map(I=>lo(I,v0))),O=Math.max(100,Math.min(OL,Math.ceil(P)+b0)),$=R.reduce((I,N)=>I+Math.max(1,Math.ceil((lo(N,v0)+b0)/O)),0);return{width:O,height:Math.max(30,$*kL+10)}};for(const _ of C){const R=_.association,P=((H0=_.placement)==null?void 0:H0.anchor)??(R?R.source===_.annotation.id?R.target:R.source:void 0),O=P?p(P):void 0,$=O?y0(O):void 0,I=DL(_.annotation.text??"");let N;if($&&_.placement){const[ue,be]=Ms[_.placement.side],Q=_.placement.offset??50;N={x:$.x+$.width/2+ue*($.width/2+I.width/2+Q),y:$.y+$.height/2+be*($.height/2+I.height/2+Q)}}else $?(N={x:$.x+$.width/2+180+as%3*260,y:$.y-110-as%2*95},as++):(N={x:300+as*260,y:60},as++);const j=O?d(O)??l():l(),H=j;$&&typeof H.x=="number"&&typeof H.width=="number"&&H.type==="bpmn:Participant"&&(N=xl(o,$,I,H,_.placement?{placement:_.placement}:{from:N}));const q=n.createShape({type:"bpmn:TextAnnotation",width:I.width,height:I.height,businessObject:i.create("bpmn:TextAnnotation",{id:_.annotation.id,text:_.annotation.text})},N,j);if(R){const ue=be=>be===_.annotation.id?q:f(be);n.connect(ue(R.source),ue(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}_.placement&&A(q,"bwl:Placement",B(_.placement))}for(const _ of en(e,"association.add")){const R=_.association;n.connect(f(R.source),f(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const _ of en(e,"node.update")){let R=f(_.id);if(_.type&&Ts(_.type)!==R.type&&(R=c.replaceElement(R,{type:Ts(_.type)})),_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.lane||_.band!==void 0){_.band!==void 0&&n.updateProperties(R,{"bwl:band":_.band});const P=R.y+R.height/2,O=d(R),$=_.lane?f(_.lane):((O==null?void 0:O.children)??[]).find(N=>N.type==="bpmn:Lane"&&P>=N.y&&P<=N.y+N.height);_.band!==void 0&&it($==null?void 0:$.id,_.band,O);const I=$?$.y+(_.band===void 0?$.height/2:Math.min($.height/2,ge)+E($.id,_.band)*L):_.band!==void 0&&O?O.y+ie+E(`pool:${O.id}`,_.band)*L:void 0;if(I!==void 0){const N=I-P;N!==0&&n.moveElements([R],{x:0,y:N})}}}for(const _ of en(e,"sequenceFlow.update")){const R=f(_.id);if(_.source!==void 0||_.target!==void 0){const P=R,O=_.source!==void 0?f(_.source):P.source,$=_.target!==void 0?f(_.target):P.target,I=N=>({x:N.x+N.width/2,y:N.y+N.height/2});n.reconnect(P,O,$,[I(O),I($)])}_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.condition!==void 0&&n.updateProperties(R,{name:((z0=_.condition)==null?void 0:z0.label)??void 0})}for(const _ of en(e,"messageFlow.update"))_.name!==void 0&&n.updateProperties(f(_.id),{name:_.name??void 0});for(const _ of en(e,"dataStore.update"))_.name!==void 0&&n.updateProperties(f(_.id),{name:_.name??void 0});for(const _ of en(e,"annotation.update")){const R=f(_.id);if(_.text!==void 0&&n.updateProperties(R,{text:_.text}),_.placement===null)A(R,"bwl:Placement",null);else if(_.placement){const P=f(_.placement.anchor),O=y0(P),$=d(P)??l(),I=typeof $.x=="number"&&typeof $.width=="number"&&$.type==="bpmn:Participant",[N,j]=Ms[_.placement.side],H=_.placement.offset??50,q={x:O.x+O.width/2+N*(O.width/2+R.width/2+H),y:O.y+O.height/2+j*(O.height/2+R.height/2+H)},ue=I?xl(o,O,{width:R.width,height:R.height},$,{placement:_.placement,selfId:_.id}):q;n.moveElements([R],{x:ue.x-(R.x+R.width/2),y:ue.y-(R.y+R.height/2)}),A(R,"bwl:Placement",B(_.placement))}}for(const _ of en(e,"group.update")){const R=f(_.id);if(_.name!==void 0&&n.updateLabel(R,_.name??""),_.members){const P=_.members.map(p).filter(O=>!!O);P.length&&n.resizeShape(R,gd(P,_.id)),A(R,"bwl:Members",{refs:_.members.join(" ")})}}}function _l(e){switch(e.kind){case"annotation-over-label":return[e.annotation];case"edge-crosses-shape":return[e.shape];case"shape-outside-container":return[e.shape];case"shape-overlap":return e.shapes;default:return[]}}function T1(e,t,n){var l,p;const{elementRegistry:i}=e,r=e.modeling,o=f=>Yt(f).filter(d=>!t.has(Ut(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=et(i),c=o(s),u=[...new Set(c.flatMap(_l))].filter(f=>n.has(f)&&a(f));if(u.length)for(const f of u){const d=i.get(f);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let m=d.parent,h;for(;m;){if(m.type==="bpmn:Participant"){h=m;break}m=m.parent}if(!h){const ge=d.x+d.width/2,Ue=d.y+d.height/2;h=i.getAll().find(je=>{if(je.type!=="bpmn:Participant")return!1;const K=je;return typeof K.x=="number"&&typeof K.width=="number"&&ge>=K.x&&ge<=K.x+K.width&&Ue>=K.y&&Ue<=K.y+K.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const y=(((l=d.businessObject.extensionElements)==null?void 0:l.values)??[]).find(ge=>ge.$type==="bwl:Placement"),g=[...d.incoming??[],...d.outgoing??[]].find(ge=>ge.type==="bpmn:Association"),v=(y!=null&&y.anchor?i.get(y.anchor):void 0)??(g?((p=g.source)==null?void 0:p.id)===f?g.target:g.source:void 0);if(!v)continue;const x=v.waypoints,C=x!=null&&x.length?{x:x[Math.floor((x.length-1)/2)].x,y:x[Math.floor((x.length-1)/2)].y,width:0,height:0}:{x:v.x,y:v.y,width:v.width,height:v.height},T={width:d.width,height:d.height},k={x:d.x+d.width/2,y:d.y+d.height/2},A=y==null?void 0:y.side,B=[];A&&A in Ms&&B.push(xl(i,C,T,h,{placement:{side:A,offset:(y==null?void 0:y.offset)??null},selfId:f}));for(const[ge,Ue]of[[-1,0],[1,0],[0,-1],[0,1]])for(let je=1;je<=A1;je++)B.push({x:k.x+ge*zh*je,y:k.y+Ue*zh*je});const D={...s,edges:s.edges.filter(ge=>ge.id!==(g==null?void 0:g.id))},L=o(D),z=L.filter(ge=>_l(ge).includes(f)).length;if(!z)continue;let ie;for(const ge of B){const Ue=ge.x-k.x,je=ge.y-k.y;if(!Ue&&!je||ge.x-T.width/2<h.x||ge.x+T.width/2>h.x+h.width||ge.y-T.height/2<h.y||ge.y+T.height/2>h.y+h.height)continue;const K={...D,shapes:D.shapes.map(Te=>Te.id===f?{...Te,x:Te.x+Ue,y:Te.y+je}:Te)},pe=o(K),ce=pe.filter(Te=>_l(Te).includes(f)).length;if(ce>=z||pe.length>L.length)continue;const ye=Math.abs(Ue)+Math.abs(je);if((!ie||ce<ie.mine||ce===ie.mine&&(pe.length<ie.all||pe.length===ie.all&&ye<ie.dist))&&(ie={x:ge.x,y:ge.y,mine:ce,all:pe.length,dist:ye}),ie.mine===0&&ie.all<L.length)break}ie&&r.moveElements([d],{x:ie.x-k.x,y:ie.y-k.y})}}const M1=60;function k1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>Yt(l).filter(p=>!t.has(Ut(p))),a=l=>l.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(l=>[l.id,l])),c=(l,p)=>p.x>=l.x&&p.y>=l.y&&p.x+p.width<=l.x+l.width&&p.y+p.height<=l.y+l.height,u=l=>{if(!s.get(l))return[l];const f=new Set,d=new Set([l]);for(let h=0;h<4;h++){let b=!1;for(const y of n.shapes)y.type!=="bpmn:Group"||f.has(y.id)||[...d].some(g=>{const v=s.get(g);return v&&c(y,v)})&&(f.add(y.id),b=!0);for(const y of n.shapes)y.type!=="bpmn:Participant"||d.has(y.id)||[...f].some(g=>{const v=s.get(g);return v&&c(v,y)})&&(d.add(y.id),b=!0);if(!b)break}const m=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!f.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...f].some(b=>{const y=s.get(b);return y&&c(y,h)})).map(h=>h.id);return[...d,...f,...m]};for(let l=0;l<6;l++){const p=et(i),f=o(p),d=a(f);if(!d.length)return;const m=new Map(p.shapes.map(x=>[x.id,x]));let h=null;for(const x of d){if(x.kind!=="pool-overlap")continue;const[C,T]=x.pools,k=m.get(C),A=m.get(T);if(!k||!A)continue;const[B,D]=k.x<=A.x?[k,A]:[A,k];if(x.contained)continue;const L=s.get(B.id),z=s.get(D.id),ie=L&&z?Math.max(z.x-(L.x+L.width),0):M1,ge=B.x+B.width+ie-D.x;if(ge<=0)continue;const Ue=u(D.id).filter(je=>i.get(je));Ue.length&&(!h||ge>h.dx)&&(h={movers:Ue,dx:ge})}if(!h)return;const b=h.movers.map(x=>i.get(x)).filter(x=>!!x&&typeof x.x=="number");if(!b.length)return;const y=f.length,g=d.length;r.moveElements(b,{x:h.dx,y:0});const v=o(et(i));if(!(a(v).length<g&&v.length<=y)){r.moveElements(b,{x:-h.dx,y:0});return}}}function O1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>Yt(u).filter(l=>!t.has(Ut(l))),a=(u,l)=>l.x>=u.x&&l.y>=u.y&&l.x+l.width<=u.x+u.width&&l.y+l.height<=u.y+u.height,s=u=>({l:Math.min(...u.map(l=>l.x)),t:Math.min(...u.map(l=>l.y)),r:Math.max(...u.map(l=>l.x+l.width)),b:Math.max(...u.map(l=>l.y+l.height))}),c=n.shapes.filter(u=>{var l;return u.type==="bpmn:Group"&&!((l=u.members)!=null&&l.length)});if(c.length)for(const u of c){const l=i.get(u.id);if(!l||typeof l.x!="number")continue;const p=n.shapes.filter(T=>T.id!==u.id&&T.type!=="bpmn:Group"&&a(u,T));if(!p.length)continue;const f=p.map(T=>i.get(T.id)).filter(T=>!!T&&typeof T.x=="number");if(f.length!==p.length)continue;const d=s(p),m=s(f),h=m.l+(u.x-d.l),b=m.t+(u.y-d.t),y=m.r+(u.x+u.width-d.r),g=m.b+(u.y+u.height-d.b),v={x:h,y:b,width:y-h,height:g-b};if(v.width<=0||v.height<=0||Math.abs(v.x-l.x)<1&&Math.abs(v.y-l.y)<1&&Math.abs(v.width-l.width)<1&&Math.abs(v.height-l.height)<1)continue;const x=o(et(i)).length,C={x:l.x,y:l.y,width:l.width,height:l.height};r.resizeShape(l,v),o(et(i)).length>x&&r.resizeShape(l,C)}}function Vh(e,t,n=Gh){const i=Hh(e),r=jh(t,dh(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=et(i.elementRegistry),s=new Set(Yt(a).map(Ut)),c=new Set(a.edges.map(g=>g.id)),u=new Set(a.shapes.map(g=>g.id)),l=ws(a),p=l.length,f=new Set(l.map(([g,v])=>`${g}|${v}`)),d=new Map;for(const g of i.elementRegistry.filter(v=>"waypoints"in v&&!!v.waypoints))g.label&&d.set(g.id,{wps:g.waypoints.map(v=>({x:v.x,y:v.y})),label:{x:g.label.x,y:g.label.y}});const m=e.get("commandStack");try{wd(m,()=>{n(t,i),k1(i,s,a),O1(i,s,a),xh(i,c);const g=ml(i,s);yh(i,f,c),Mh(i,s,c),Eh(i,c),v1(i,c),Ch(i,s,c),w1(i,s,c),Ih(i,s,c),Lh(i,c),Nh(i,u),T1(i,s,u),ml(i,s,g),Dh(i,d)})}catch(g){return{ok:!1,issues:[{kind:"lower-failed",message:g instanceof Error?g.message:String(g)}],findings:[],stats:o}}const h=et(i.elementRegistry),b=Yt(h).filter(g=>!s.has(Ut(g))),y=oh(h);return{ok:!0,issues:[],findings:b,stats:{edgeCrossings:{before:p,after:y.pairs.length,pairs:y.pairs,solidPairs:y.solidPairs,dashedPairs:y.dashedPairs,mixedPairs:y.mixedPairs,crossPoolMessages:y.crossPoolMessages}}}}function D1(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function L1(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Wh(e,t){const n=L1(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Uh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function I1(e){return typeof e=="string"&&zu.includes(e)}function li(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Yh(e){const t=e.rootElements??[],n=t.find(K=>K.$type==="bpmn:Collaboration"),i=new Map(t.filter(K=>K.$type==="bpmn:Process").map(K=>[K.id,K])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],m=[],h=[],b=[],y=new Set,g=new Set,v=K=>{K&&y.add(K)},x=K=>{y.add(K),g.add(K)},C=K=>{const pe=Uh(K,"bwl:Placement");if(!pe)return;const ce=typeof pe.anchor=="string"?pe.anchor:void 0;if(!ce||!I1(pe.side))return;const ye=typeof pe.offset=="number"?pe.offset:void 0;h.push({owner:K.id,anchor:ce,side:pe.side,...ye!==void 0?{offset:ye}:{}})},T=K=>{const pe=Uh(K,"bwl:Members"),ce=typeof(pe==null?void 0:pe.refs)=="string"?pe.refs.split(/\s+/).filter(Boolean):[];ce.length&&b.push({owner:K.id,refs:ce})},k=K=>{var pe;for(const ce of K)switch(v(ce.id),ce.$type){case"bpmn:TextAnnotation":x(ce.id),s.push({id:ce.id,text:typeof ce.text=="string"?ce.text:""}),C(ce);break;case"bpmn:Association":d.push({id:ce.id,type:ce.$type,source:li(ce.sourceRef),target:li(ce.targetRef)});break;case"bpmn:Group":{x(ce.id);const ye=(pe=ce.categoryValueRef)==null?void 0:pe.value;c.push({id:ce.id,...typeof ye=="string"&&ye?{name:ye}:{}}),T(ce);break}default:u.push({id:ce.id,type:ce.$type,reason:"type-outside-mvp"})}},A=K=>{for(const pe of K.flowElements??[])v(pe.id),u.push({id:pe.id,type:pe.$type,reason:"inside-container"}),(pe.flowElements??[]).length&&A(pe);for(const pe of K.artifacts??[])v(pe.id),u.push({id:pe.id,type:pe.$type,reason:"inside-container"})},B=(K,pe)=>{const ce=K.flowElements??[],ye=(K.laneSets??[]).flatMap(W=>W.lanes??[]),Te=new Map;for(const W of ye){v(W.id);for(const Y of W.flowNodeRef??[]){const te=li(Y);te&&Te.set(te,W.id)}}for(const W of ce){if(v(W.id),W.$type==="bpmn:SequenceFlow"){p.push({id:W.id,source:li(W.sourceRef),target:li(W.targetRef),...typeof W.name=="string"&&W.name?{name:W.name}:{}});continue}if(W.$type==="bpmn:DataStoreReference"){x(W.id),a.push({id:W.id,...W.name?{name:W.name}:{}});continue}const Y=D1(W.$type);if(!yd(Y)){u.push({id:W.id,type:W.$type,reason:"type-outside-mvp"});continue}x(W.id);const te=Y==="boundaryEvent"?li(W.attachedToRef):void 0;o.push({id:W.id,type:Y,...W.name?{name:W.name}:{},...pe?{participant:pe}:{},...Te.has(W.id)?{lane:Te.get(W.id)}:{},...te?{attachedTo:te}:{}}),Y==="subProcess"&&A(W);const Ae=Wh(W,"bwl:band");Ae!==void 0&&(l.bands[W.id]=Ae);for(const gt of W.dataOutputAssociations??[])v(gt.id),m.push({id:gt.id,type:gt.$type,source:W.id,target:li(gt.targetRef)});for(const gt of W.dataInputAssociations??[])v(gt.id),m.push({id:gt.id,type:gt.$type,source:li((gt.sourceRef??[])[0]),target:W.id})}k(K.artifacts??[])};if(n){const K=new Set;for(const pe of n.participants??[]){x(pe.id);const ce=li(pe.processRef);ce&&K.add(ce);const ye=ce?i.get(ce):void 0,Te=((ye==null?void 0:ye.laneSets)??[]).flatMap(Ae=>Ae.lanes??[]),W=Te.map(Ae=>({id:Ae.id,...Ae.name?{name:Ae.name}:{}}));for(const Ae of W)x(Ae.id);const Y=!ye||(ye.flowElements??[]).length===0&&Te.length===0&&(ye.artifacts??[]).length===0;r.push({id:pe.id,...pe.name?{name:pe.name}:{},...Y?{blackBox:!0}:{},...W.length?{lanes:W}:{}});const te=Wh(pe,"bwl:poolOrder");te!==void 0&&(l.poolOrders[pe.id]=te),ye&&B(ye,pe.id)}for(const pe of n.messageFlows??[])v(pe.id),f.push({id:pe.id,source:li(pe.sourceRef),target:li(pe.targetRef),...typeof pe.name=="string"&&pe.name?{name:pe.name}:{}});k(n.artifacts??[]);for(const[pe,ce]of i)!K.has(pe)&&(ce.flowElements??[]).length>0&&u.push({id:pe,type:ce.$type,reason:"unreachable-process"})}else for(const K of i.values())B(K);const D=[],L=[],z=[],ie=[],ge=(K,pe)=>!!K&&!!pe&&g.has(K)&&g.has(pe);for(const K of p){if(!ge(K.source,K.target)){u.push({id:K.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}D.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),g.add(K.id)}for(const K of f){if(!ge(K.source,K.target)){u.push({id:K.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}L.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),g.add(K.id)}for(const K of m){if(!ge(K.source,K.target)){u.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}ie.push({...K.id?{id:K.id}:{},source:K.source,target:K.target}),K.id&&g.add(K.id)}for(const K of d){if(!ge(K.source,K.target)){u.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}z.push({...K.id?{id:K.id}:{},source:K.source,target:K.target})}const Ue=new Map(c.map(K=>[K.id,K]));for(const{owner:K,refs:pe}of b){const ce=pe.filter(Te=>y.has(Te)),ye=Ue.get(K);ye&&ce.length&&(ye.members=ce)}for(const K of h)y.has(K.anchor)&&(l.placements[K.owner]={anchor:K.anchor,side:K.side,...K.offset!==void 0?{offset:K.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:D,...L.length?{messageFlows:L}:{},...a.length?{dataStores:a}:{},...ie.length?{dataAssociations:ie}:{},...s.length?{annotations:s}:{},...z.length?{associations:z}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function B1(e){const{definitions:t,warnings:n}=await ol(e);return{...Yh(t),warnings:n}}function N1(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function qh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Vh(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 $1=Symbol("bpmn-editor");function F1(){const e=It.ref(!1),t=It.ref(!0),n=It.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const 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 qh(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:al(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 _e(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function j1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wl={exports:{}},Kh;function H1(){if(Kh)return wl.exports;Kh=1;var e=wl.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},wl.exports}var z1=H1(),G1=j1(z1);function yi(e){if(!(this instanceof yi))return new yi(e);e=e||[128,36,1],this._seed=e.length?G1.rack(e[0],e[1],e[2]):e}yi.prototype.next=function(e){return this._seed(e||!0)},yi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},yi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},yi.prototype.assigned=function(e){return this._seed.get(e)||!1},yi.prototype.unclaim=function(e){delete this._seed.hats[e]},yi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const qt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};qt.td=qt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],qt.option=qt.optgroup=[1,'<select multiple="multiple">',"</select>"],qt.thead=qt.tbody=qt.colgroup=qt.caption=qt.tfoot=[1,"<table>","</table>"],qt.polyline=qt.ellipse=qt.polygon=qt.circle=qt.text=qt.line=qt.path=qt.rect=qt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function bt(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:p}=l;return p.remove(),p}let[r,o,a]=Object.hasOwn(qt,i)?qt[i]:qt._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 V1(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 _n(e,...t){const n=e.style;return F(t,function(i){i&&F(i,function(r,o){n[o]=r})}),e}function mn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const W1=Object.prototype.toString;function wt(e){return new er(e)}function er(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}er.prototype.add=function(e){return this.list.add(e),this},er.prototype.remove=function(e){return W1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},er.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},er.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},er.prototype.array=function(){return Array.from(this.list)},er.prototype.has=er.prototype.contains=function(e){return this.list.contains(e)};function ks(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Ir(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function U1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Os={},Xh;function Y1(){if(Xh)return Os;Xh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Os.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Os.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Os}var Zh=Y1(),q1=U1(Zh),Ne=V1({__proto__:null,default:q1},[Zh]),Qh=["focus","blur"];function K1(e,t,n,i,r){return Qh.indexOf(n)!==-1&&(r=!0),Ne.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Ir(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function X1(e,t,n,i){return Qh.indexOf(t)!==-1&&(i=!0),Ne.unbind(e,t,n,i)}var On={bind:K1,unbind:X1};function El(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function pt(e,t){return t=t||document,t.querySelector(e)}function Ds(e,t){return t=t||document,t.querySelectorAll(e)}function vi(e){e.parentNode&&e.parentNode.removeChild(e)}function Z1(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function Q1(e,t){return t.appendChild(Z1(e,t))}function $e(e,t){return Q1(t,e),e}var Sl=2,Jh={"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":Sl,"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":Sl,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function J1(e,t){return Jh[t]?e.style[t]:e.getAttributeNS(null,t)}function em(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Jh[i];r?(r===Sl&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function eS(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)em(e,r,t[r])}function we(e,t,n){if(typeof t=="string")if(n!==void 0)em(e,t,n);else return J1(e,t);else eS(e,t);return e}const tS=Object.prototype.toString;function Qe(e){return new tr(e)}function tr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}tr.prototype.add=function(e){return this.list.add(e),this},tr.prototype.remove=function(e){return tS.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},tr.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},tr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},tr.prototype.array=function(){return Array.from(this.list)},tr.prototype.has=tr.prototype.contains=function(e){return this.list.contains(e)};function Ls(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function tm(e){return e.cloneNode(!0)}var Rl={svg:"http://www.w3.org/2000/svg"},nm='<svg xmlns="'+Rl.svg+'"';function nS(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Rl.svg)===-1&&(e=nm+e.substring(4)):(e=nm+">"+e+"</svg>",t=!0);var n=iS(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function iS(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Me(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=nS(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Rl.svg,e),t&&we(n,t),n}var Cl=null;function im(){return Cl===null&&(Cl=Me("svg")),Cl}function rm(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function rS(e,t,n,i,r,o){var a=im().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return rm(a,e);case 6:return rm(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function ra(e){return im().createSVGTransform()}var om=/([&<>]{1})/g,oS=/([&<>\n\r"]{1})/g,aS={"&":"&","<":"<",">":">",'"':"'"};function Pl(e,t){function n(i,r){return aS[r]||r}return e.replace(t,n)}function am(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Pl(e.textContent,om));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,'="',Pl(o.value,oS),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)am(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Pl(e.nodeValue,om),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function sS(e){for(var t=e.firstChild,n=[];t;)am(t,n),t=t.nextSibling;return n.join("")}function sm(e,t){return sS(e)}function Kt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function cS(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function uS(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(cS(e,i))}function oa(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),uS(n,t)),n.consolidate()}const lS=/^class[ {]/;function pS(e){return lS.test(e.toString())}function Al(e){return Array.isArray(e)}function Tl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Is(...e){e.length===1&&Al(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const fS=/constructor\s*[^(]*\(\s*([^)]*)\)/m,dS=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,hS=/\/\*([^*]*)\*\//m;function mS(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(pS(e)?fS:dS);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(hS);return(r&&r[1]||i).trim()})||[]}function cm(e,t){const n=t||{get:function(v,x){if(i.push(v),x===!1)return null;throw s(`No provider for "${v}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(v){const x=i.join(" -> ");return i.length=0,new Error(x?`${v} (Resolving: ${x})`:v)};function c(v,x){if(!r[v]&&v.includes(".")){const C=v.split(".");let T=c(C.shift());for(;C.length;)T=T[C.shift()];return T}if(Tl(o,v))return o[v];if(Tl(r,v)){if(i.indexOf(v)!==-1)throw i.push(v),s("Cannot resolve circular dependency!");return i.push(v),o[v]=r[v][0](r[v][1]),i.pop(),o[v]}return n.get(v,x)}function u(v,x){if(typeof x>"u"&&(x={}),typeof v!="function")if(Al(v))v=Is(v.slice());else throw s(`Cannot invoke "${v}". Expected a function!`);const T=(v.$inject||mS(v)).map(k=>Tl(x,k)?x[k]:c(k));return{fn:v,dependencies:T}}function l(v){const{fn:x,dependencies:C}=u(v),T=Function.prototype.bind.call(x,null,...C);return new T}function p(v,x,C){const{fn:T,dependencies:k}=u(v,C);return T.apply(x,k)}function f(v){return Is(x=>v.get(x))}function d(v,x){if(x&&x.length){const C=Object.create(null),T=Object.create(null),k=[],A=[],B=[];let D,L,z,ie;for(let ge in r)D=r[ge],x.indexOf(ge)!==-1&&(D[2]==="private"?(L=k.indexOf(D[3]),L===-1?(z=D[3].createChild([],x),ie=f(z),k.push(D[3]),A.push(z),B.push(ie),C[ge]=[ie,ge,"private",z]):C[ge]=[B[L],ge,"private",A[L]]):C[ge]=[D[2],D[1]],T[ge]=!0),(D[2]==="factory"||D[2]==="type")&&D[1].$scope&&x.forEach(Ue=>{D[1].$scope.indexOf(Ue)!==-1&&(C[ge]=[D[2],D[1]],T[Ue]=!0)});x.forEach(ge=>{if(!T[ge])throw new Error('No provider for "'+ge+'". Cannot use provider from the parent!')}),v.unshift(C)}return new cm(v,a)}const m={factory:p,type:l,value:function(v){return v}};function h(v,x){const C=v.__init__||[];return function(){C.forEach(T=>{typeof T=="string"?x.get(T):x.invoke(T)})}}function b(v){const x=v.__exports__;if(x){const C=v.__modules__,T=Object.keys(v).reduce((L,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&(L[z]=v[z]),L),Object.create(null)),k=(C||[]).concat(T),A=d(k),B=Is(function(L){return A.get(L)});x.forEach(function(L){r[L]=[B,L,"private",A]});const D=(v.__init__||[]).slice();return D.unshift(function(){A.init()}),v=Object.assign({},v,{__init__:D}),h(v,A)}return Object.keys(v).forEach(function(C){if(C==="__init__"||C==="__depends__")return;const T=v[C];if(T[2]==="private"){r[C]=T;return}const k=T[0],A=T[1];r[C]=[m[k],gS(k,A),k]}),h(v,a)}function y(v,x){return v.indexOf(x)!==-1||(v=(x.__depends__||[]).reduce(y,v),v.indexOf(x)!==-1)?v:v.concat(x)}function g(v){const x=v.reduce(y,[]).map(b);let C=!1;return function(){C||(C=!0,x.forEach(T=>T()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=g(e)}function gS(e,t){return e!=="value"&&Al(t)&&(t=Is(t.slice())),t}var yS=1e3;function Li(e,t){var n=this;t=t||yS,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}Li.prototype.canRender=function(e){},Li.prototype.drawShape=function(e,t){},Li.prototype.drawConnection=function(e,t){},Li.prototype.getShapePath=function(e){},Li.prototype.getConnectionPath=function(e){};function Br(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function vS(e){return["M",e.x,e.y]}function Ml(e){return["L",e.x,e.y]}function bS(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function xS(e,t){const n=e.length,i=[vS(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(Ml(a));continue}const c=Math.min(t,kl(a.x-o.x,a.y-o.y),kl(s.x-a.x,s.y-a.y));if(!c){i.push(Ml(a));continue}const u=Bs(a,o,c),l=Bs(a,o,c*.5),p=Bs(a,s,c),f=Bs(a,s,c*.5);i.push(Ml(u)),i.push(bS(l,f,p))}return i}function Bs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=kl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function kl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function aa(e,t,n){Be(t)&&(n=t,t=null),t||(t={});const i=Me("path",t);return Be(n)&&(i.dataset.cornerRadius=String(n)),Ol(i,e)}function Ol(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return we(e,{d:Br(xS(t,n))}),e}function Ns(e){var t=new Set(e);return Ye(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Nr(e,t,n){n=n||0,De(e)||(e=[e]),F(e,function(i,r){var o=t(i,r,n);De(o)&&o.length&&Nr(o,t,n+1)})}function Dl(e,t,n){var i=new Set,r=new Set;return Nr(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function sa(e,t){return Dl(e)}function _S(e,t,n){Mr(t)&&(t=!0),Qt(t)&&(n=t,t=!0),n=n||{};var i=ca(n.allShapes),r=ca(n.allConnections),o=ca(n.enclosedElements),a=ca(n.enclosedConnections),s=ca(n.topLevel,t&&oo(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,F(l.incoming,c),F(l.outgoing,c),l.children}return Nr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Bt(e,t){t=!!t,De(e)||(e=[e]);var n,i,r,o;return F(e,function(a){var s=a;a.waypoints&&!t&&(s=Bt(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,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 yo(e,t){var n={};return F(e,function(i){var r=i;r.waypoints&&(r=Bt(r)),!Be(t.y)&&r.x>t.x&&(n[i.id]=i),!Be(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Be(t.width)&&Be(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Be(t.width)||!Be(t.height))&&(n[i.id]=i)}),n}function um(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function lm(e){return!!(e&&e.isFrame)}function ca(e,t){return V({},e||{},t||{})}var wS=1;function nr(e,t){Li.call(this,e,wS),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})}_e(nr,Li),nr.prototype.canRender=function(){return!0},nr.prototype.drawShape=function(t,n,i){var r=Me("rect");return we(r,{x:0,y:0,width:n.width||0,height:n.height||0}),lm(n)?we(r,V({},this.FRAME_STYLE,i||{})):we(r,V({},this.SHAPE_STYLE,i||{})),$e(t,r),r},nr.prototype.drawConnection=function(t,n,i){var r=aa(n.waypoints,V({},this.CONNECTION_STYLE,i||{}));return $e(t,r),r},nr.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return Br(a)},nr.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return Br(o)},nr.$inject=["eventBus","styles"];function ES(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return V(o,{class:n})},this.style=function(n,i){!De(n)&&!i&&(i=n,n=[]);var r=Mn(n,function(o,a){return V(o,e[a]||{})},{});return i?V(r,i):r},this.computeStyle=function(n,i,r){return De(i)||(r=i,i=[]),t.style(i||[],V({},r,n||{}))}}const SS={__init__:["defaultRenderer"],defaultRenderer:["type",nr],styles:["type",ES]};function kt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Ot(e,t,n){if(!(!e||!t)){typeof n!="number"&&(n=-1);var i=e.indexOf(t);if(i!==-1){if(i===n)return;if(n!==-1)e.splice(i,1);else return}n!==-1?e.splice(n,0,t):e.push(t)}}function Ll(e,t){return!e||!t?-1:e.indexOf(t)}function ua(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Il(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=ua(e,t);return Math.abs(r/o)<=i}var RS=2;function Ii(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(CS(r,n))return o;return!1}function CS(e,t){const n=t[0];return kr(t,function(i){return Math.abs(n[e]-i[e])<=RS})}function pm(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 Bl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var PS=/,?([a-z]),?/gi,fm=parseFloat,Nt=Math,ir=Nt.PI,bi=Nt.min,xi=Nt.max,dm=Nt.pow,rr=Nt.abs,AS=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,TS=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,hm=Array.isArray||function(e){return e instanceof Array};function MS(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function kS(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 OS(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 MS(r,i)?(kS(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function DS(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(AS,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(TS,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=$l,n}function LS(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 IS(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 Nl(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 $l(){return this.join(",").replace(PS,"$1")}function BS(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=$l,t}function mm(e,t,n,i,r,o,a,s,c){var u=1-c,l=dm(u,3),p=dm(u,2),f=c*c,d=f*c,m=l*e+p*3*c*n+u*3*c*c*r+d*a,h=l*t+p*3*c*i+u*3*c*c*o+d*s;return{x:$s(m),y:$s(h)}}function gm(e){var t=zS(...e);return Nl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function or(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function NS(e,t){return e=Nl(e),t=Nl(t),or(t,e.x,e.y)||or(t,e.x2,e.y)||or(t,e.x,e.y2)||or(t,e.x2,e.y2)||or(e,t.x,t.y)||or(e,t.x2,t.y)||or(e,t.x,t.y2)||or(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function ym(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 vm(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,m=0;m<l;m++){var h=u*p[m]+u,b=ym(h,e,n,r,a),y=ym(h,t,i,o,s),g=b*b+y*y;d+=f[m]*Nt.sqrt(g)}return u*d}function $S(e,t,n,i,r,o,a,s){if(!(xi(e,n)<bi(r,a)||bi(e,n)>xi(r,a)||xi(t,i)<bi(o,s)||bi(t,i)>xi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var p=$s(c/l),f=$s(u/l),d=+p.toFixed(2),m=+f.toFixed(2);if(!(d<+bi(e,n).toFixed(2)||d>+xi(e,n).toFixed(2)||d<+bi(r,a).toFixed(2)||d>+xi(r,a).toFixed(2)||m<+bi(t,i).toFixed(2)||m>+xi(t,i).toFixed(2)||m<+bi(o,s).toFixed(2)||m>+xi(o,s).toFixed(2)))return{x:p,y:f}}}}function $s(e){return Math.round(e*1e11)/1e11}function FS(e,t,n){var i=gm(e),r=gm(t);if(!NS(i,r))return[];var o=vm(...e),a=vm(...t),s=xm(e)?1:~~(o/5)||1,c=xm(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),p={},f=[],d,m;for(d=0;d<s+1;d++){var h=mm(...e,d/s);u[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=mm(...t,d/c),l[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(m=0;m<c;m++){var b=u[d],y=u[d+1],g=l[m],v=l[m+1],x=rr(y.x-b.x)<.01?"y":"x",C=rr(v.x-g.x)<.01?"y":"x",T=$S(b.x,b.y,y.x,y.y,g.x,g.y,v.x,v.y),k;if(T){if(k=T.x.toFixed(9)+"#"+T.y.toFixed(9),p[k])continue;p[k]=!0;var A=b.t+rr((T[x]-b[x])/(y[x]-b[x]))*(y.t-b.t),B=g.t+rr((T[C]-g[C])/(v[C]-g[C]))*(v.t-g.t);A>=0&&A<=1&&B>=0&&B<=1&&f.push({x:T.x,y:T.y,t1:A,t2:B})}}return f}function bm(e,t,n){e=Em(e),t=Em(t);for(var i,r,o,a,s,c,u,l,p,f,d=n?0:[],m=0,h=e.length;m<h;m++){var b=e[m];if(b[0]=="M")i=s=b[1],r=c=b[2];else{b[0]=="C"?(p=[i,r,...b.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var y=0,g=t.length;y<g;y++){var v=t[y];if(v[0]=="M")o=u=v[1],a=l=v[2];else{v[0]=="C"?(f=[o,a,...v.slice(1)],o=f[6],a=f[7]):(f=[o,a,o,a,u,l,u,l],o=u,a=l);var x=FS(p,f);{for(var C=0,T=x.length;C<T;C++)x[C].segment1=m,x[C].segment2=y,x[C].bez1=p,x[C].bez2=f;d=d.concat(x)}}}}}return d}function jS(e){return hm(e)&&hm(e[0])}function HS(e){if(LS(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 m=0,h=u.length;m<h;m++)c[m]=u[m];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=$l,t}function xm(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Fs(e,t,n,i){return[e,t,n,i,n,i]}function _m(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 wm(e,t,n,i,r,o,a,s,c,u){var l=ir*120/180,p=ir/180*(+r||0),f=[],d,m=OS(function(M,E,w){var G=M*Nt.cos(w)-E*Nt.sin(w),U=M*Nt.sin(w)+E*Nt.cos(w);return{x:G,y:U}});if(u)k=u[0],A=u[1],C=u[2],T=u[3];else{d=m(e,t,-p),e=d.x,t=d.y,d=m(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,b=(t-c)/2,y=h*h/(n*n)+b*b/(i*i);y>1&&(y=Nt.sqrt(y),n=y*n,i=y*i);var g=n*n,v=i*i,x=(o==a?-1:1)*Nt.sqrt(rr((g*v-g*b*b-v*h*h)/(g*b*b+v*h*h))),C=x*n*b/i+(e+s)/2,T=x*-i*h/n+(t+c)/2,k=Nt.asin(((t-T)/i).toFixed(9)),A=Nt.asin(((c-T)/i).toFixed(9));k=e<C?ir-k:k,A=s<C?ir-A:A,k<0&&(k=ir*2+k),A<0&&(A=ir*2+A),a&&k>A&&(k=k-ir*2),!a&&A>k&&(A=A-ir*2)}var B=A-k;if(rr(B)>l){var D=A,L=s,z=c;A=k+l*(a&&A>k?1:-1),s=C+n*Nt.cos(A),c=T+i*Nt.sin(A),f=wm(s,c,n,i,r,0,a,L,z,[A,D,C,T])}B=A-k;var ie=Nt.cos(k),ge=Nt.sin(k),Ue=Nt.cos(A),je=Nt.sin(A),K=Nt.tan(B/4),pe=4/3*n*K,ce=4/3*i*K,ye=[e,t],Te=[e+pe*ge,t-ce*ie],W=[s+pe*je,c-ce*Ue],Y=[s,c];if(Te[0]=2*ye[0]-Te[0],Te[1]=2*ye[1]-Te[1],u)return[Te,W,Y].concat(f);f=[Te,W,Y].concat(f).join().split(",");for(var te=[],Ae=0,gt=f.length;Ae<gt;Ae++)te[Ae]=Ae%2?m(f[Ae-1],f[Ae],p).y:m(f[Ae],f[Ae+1],p).x;return te}function zS(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,m,h,b,y,g=0;g<2;++g){if(g==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),rr(l)<1e-12){if(rr(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}b=p*p-4*f*l,y=Nt.sqrt(b),!(b<0)&&(m=(-p+y)/(2*l),0<m&&m<1&&c.push(m),h=(-p-y)/(2*l),0<h&&h<1&&c.push(h))}for(var v=c.length,x=v,C;v--;)d=c[v],C=1-d,u[0][v]=C*C*C*e+3*C*C*d*n+3*C*d*d*r+d*d*d*a,u[1][v]=C*C*C*t+3*C*C*d*i+3*C*d*d*o+d*d*d*s;return u[0][x]=e,u[1][x]=t,u[0][x+1]=a,u[1][x+1]=s,u[0].length=u[1].length=x+2,{x0:bi(...u[0]),y0:bi(...u[1]),x1:xi(...u[0]),y1:xi(...u[1])}}function Em(e){if(jS(e)||(e=DS(e)),IS(e))return e;for(var t=BS(HS(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,m){var h,b;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",...wm(d.x,d.y,...f.slice(1))];break;case"S":m=="C"||m=="S"?(h=d.x*2-d.bx,b=d.y*2-d.by):(h=d.x,b=d.y),f=["C",h,b,...f.slice(1)];break;case"T":m=="Q"||m=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",..._m(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",..._m(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Fs(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Fs(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Fs(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Fs(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 m=f[d];m.length;)o[d]="A",f.splice(d++,0,["C",...m.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=fm(l[p-4])||n.x,n.by=fm(l[p-3])||n.y}return t}function ft(e){return Qt(e)&&Tn(e,"waypoints")}function Ge(e){return Qt(e)&&Tn(e,"labelTarget")}function GS(e){return Qt(e)&&io(e.parent)}function Sm(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Bi(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Oe(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function js(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function VS(e){return Bi({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function WS(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],m=d&&d.endLength||0,h=qS(f,l);u.push({start:f,end:l,startLength:m,endLength:m+h,length:h})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function Le(e){return ft(e)?WS(e):VS(e)}function cn(e,t,n){n=n||0,Qt(n)||(n={x:n,y:n});var i=Oe(e),r=Oe(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,u=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function la(e,t,n){var i=US(e,t);return i.length===1||i.length===2&&ua(i[0],i[1])<1?Bi(i[0]):i.length>1?(i=di(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Bi(i[n?0:i.length-1])):null}function US(e,t){return bm(e,t)}function YS(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ua(n,r)===0||Il(i,r,n)?e.splice(t,1):t++;return e}function qS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Hs(e,t){return Math.round(e*t)/t}function Rm(e){return Be(e)?e+"px":e}function KS(e){for(;e.parent;)e=e.parent;return e}function XS(e){e=V({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),_n(n,{position:"relative",overflow:"hidden",width:Rm(e.width),height:Rm(e.height)}),t.appendChild(n),n}function Cm(e,t,n){const i=Me("g");Qe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const ZS="base",Pm=0,QS=1,JS={shape:["x","y","width","height"],connection:["waypoints"]};function Ie(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}Ie.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Ie.prototype._init=function(e){const t=this._eventBus,n=this._container=XS(e),i=this._svg=Me("svg");we(i,{width:"100%",height:"100%"}),mn(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")}),$e(n,i);const r=this._viewport=Cm(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Uu(this._viewboxChanged,300)),this._restoreFocus=Uu(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Ie.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},Ie.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Ie.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=um(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Ie.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Ie.prototype.restoreFocus=function(){this._restoreFocus()},Ie.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Ie.prototype.isFocused=function(){return this._focused},Ie.prototype.getDefaultLayer=function(){return this.getLayer(ZS,Pm)},Ie.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},Ie.prototype._getChildIndex=function(e){return Mn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Ie.prototype._createLayer=function(e,t){typeof t>"u"&&(t=QS);const n=this._getChildIndex(t);return{group:Cm(this._viewport,"layer-"+e,n),index:t,visible:!0}},Ie.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},Ie.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(Kt(n),t.visible=!1),n},Ie.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Kt(t.group))},Ie.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Ie.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(KS(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Ie.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Ie.prototype._findPlaneForRoot=function(e){return mt(this._planes,function(t){return t.rootElement===e})},Ie.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Ie.prototype._resolveElements=function(e){return De(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Ie.prototype.getContainer=function(){return this._container},Ie.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(F([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Qe(r).add(t)):(e.markers.delete(t),Qe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ie.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ie.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ie.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Ie.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ie.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Ie.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,Pm);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Ie.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},Ie.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},Ie.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},Ie.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},Ie.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},Ie.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=JS[e];if(!kr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ie.prototype._setParent=function(e,t,n){Ot(t.children,e,n),e.parent=t},Ie.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},Ie.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ie.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ie.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),kt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Ie.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ie.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ie.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ie.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ie.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ie.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);oa(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=oa(t),r=a?a.matrix:rS(),s=Hs(r.a,1e3),c=Hs(-r.e||0,1e3),u=Hs(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},Ie.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=V({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Am(t,n)}),{x:n.e,y:n.f}},Ie.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(m=>m!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=Bt(o),s=Oe(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=Oe(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,p=a.y-c.y;else{const m=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),b=Math.max(0,s.bottom-f.bottom),y=Math.min(0,s.top-f.top);l=m||h,p=b||y}this.scroll({dx:-l*u,dy:-p*u})},Ie.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Hs(i.a,1e3)};function Am(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ie.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},Ie.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const p=c.a;return t?(a=V(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),Am(this._viewport,l),l},Ie.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ie.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},Ie.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var vo="data-element-id";function Un(e){this._elements={},this._eventBus=e}Un.$inject=["eventBus"],Un.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),we(t,vo,i),n&&we(n,vo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Un.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(we(i.gfx,vo,""),i.secondaryGfx&&we(i.secondaryGfx,vo,""),delete t[n])},Un.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},Un.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&we(t,vo,i),t},Un.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&we(e,vo);var n=this._elements[t];return n&&n.element},Un.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Un.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=n[i],o=t[r],a=o.element,s=o.gfx;if(e(a,s))return a}},Un.prototype.getAll=function(){return this.filter(function(e){return e})},Un.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},Un.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Un.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function eR(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 tR(e){return e.__refs_collection===!0}function nR(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Tm(e,t,n){var i=eR(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 iR(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 Zn(e,t){if(!(this instanceof Zn))return new Zn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Zn.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?Tm(this,t,e):iR(this,t,e)},Zn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return tR(n)||Tm(this,t,e),n},Zn.prototype.ensureBound=function(e,t){nR(e,t)||this.bind(e,t)},Zn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Zn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Fl=new Zn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Mm=new Zn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),km=new Zn({name:"attachers",collection:!0},{name:"host"}),Om=new Zn({name:"outgoing",collection:!0},{name:"source"}),Dm=new Zn({name:"incoming",collection:!0},{name:"target"});function bo(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),Fl.bind(this,"parent"),Mm.bind(this,"labels"),Om.bind(this,"outgoing"),Dm.bind(this,"incoming")}function pa(){bo.call(this),Fl.bind(this,"children"),km.bind(this,"host"),km.bind(this,"attachers")}_e(pa,bo);function Lm(){bo.call(this),Fl.bind(this,"children")}_e(Lm,pa);function Im(){pa.call(this),Mm.bind(this,"labelTarget")}_e(Im,pa);function Bm(){bo.call(this),Om.bind(this,"source"),Dm.bind(this,"target")}_e(Bm,bo);var rR={connection:Bm,shape:pa,label:Im,root:Lm};function oR(e,t){var n=rR[e];if(!n)throw new Error("unknown type: <"+e+">");return V(new n,t)}function aR(e){return e instanceof bo}function Ni(){this._uid=12}Ni.prototype.createRoot=function(e){return this.create("root",e)},Ni.prototype.createLabel=function(e){return this.create("label",e)},Ni.prototype.createShape=function(e){return this.create("shape",e)},Ni.prototype.createConnection=function(e){return this.create("connection",e)},Ni.prototype.create=function(e,t){return t=V({},t||{}),t.id||(t.id=e+"_"+this._uid++),oR(e,t)};var zs="__fn",Nm=1e3,sR=Array.prototype.slice;function Dn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Dn.prototype.on=function(e,t,n,i){if(e=De(e)?e:[e],Jt(t)&&(i=n,n=t,t=Nm),!Be(t))throw new Error("priority must be a number");var r=n;i&&(r=Sn(n,i),r[zs]=n[zs]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Dn.prototype.once=function(e,t,n,i){var r=this;if(Jt(t)&&(i=n,n=t,t=Nm),!Be(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[zs]=n,this.on(e,t,o)},Dn.prototype.off=function(e,t){e=De(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Dn.prototype.createEvent=function(e){var t=new fa;return t.init(e),t},Dn.prototype.fire=function(e,t){var n,i,r,o;if(o=sR.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof fa?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Dn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Dn.prototype._destroy=function(){this._listeners={}},Dn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Dn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=cR(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},Dn.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},Dn.prototype._getListeners=function(e){return this._listeners[e]},Dn.prototype._setListeners=function(e,t){this._listeners[e]=t},Dn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[zs]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function fa(){}fa.prototype.stopPropagation=function(){this.cancelBubble=!0},fa.prototype.preventDefault=function(){this.defaultPrevented=!0},fa.prototype.init=function(e){V(this,e||{})};function cR(e,t){return e.apply(null,t)}function $r(e){return e.childNodes[0]}function uR(e){return e.parentNode.childNodes[1]}function Gs(e,t,n,i,r){var o=ra();o.setTranslate(t,n);var a=ra();a.setRotate(i||0,0,0);var s=ra();s.setScale(1,1),oa(e,[o,a,s])}function un(e,t,n){var i=ra();i.setTranslate(t,n),oa(e,i)}function $m(e,t){var n=ra();n.setRotate(t,0,0),oa(e,n)}function Yn(e,t){this._eventBus=e,this._elementRegistry=t}Yn.$inject=["eventBus","elementRegistry"],Yn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=uR(t),n||(n=Me("g"),Qe(n).add("djs-children"),$e(t.parentNode,n))):n=t,n},Yn.prototype._clear=function(e){var t=$r(e);return ks(t),t},Yn.prototype._createContainer=function(e,t,n,i){var r=Me("g");Qe(r).add("djs-group"),typeof n<"u"?lR(r,t,t.childNodes[n]):$e(t,r);var o=Me("g");Qe(o).add("djs-element"),Qe(o).add("djs-"+e),i&&Qe(o).add("djs-frame"),$e(r,o);var a=Me("g");return Qe(a).add("djs-visual"),$e(o,a),o},Yn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,lm(t))},Yn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Mn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),F(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;F(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Yn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Yn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Yn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Yn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Yn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),un(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?we(n,"display","none"):we(n,"display","block")}},Yn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Kt(t.parentNode)};function lR(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const pR={__depends__:[SS],__init__:["canvas"],canvas:["type",Ie],elementRegistry:["type",Un],elementFactory:["type",Ni],eventBus:["type",Dn],graphicsFactory:["type",Yn]};function fR(e){var t=new cm(e);return t.init(),t}function dR(e){e=e||{};var t={config:["value",e]},n=[t,pR].concat(e.modules||[]);return fR(n)}function ar(e,t){this._injector=t||dR(e),this.get("eventBus").fire("diagram.init")}ar.prototype.get=function(e,t){return this._injector.get(e,t)},ar.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ar.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ar.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function gn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Rn(e,t){return e.$instanceOf(t)}function hR(e){return mt(e.rootElements,function(t){return Rn(t,"bpmn:Process")||Rn(t,"bpmn:Collaboration")})}function mR(e){var t={},n=[],i={};function r(W,Y){return function(te){W(te,Y)}}function o(W){t[W.id]=W}function a(W){return t[W.id]}function s(W,Y){var te=W.gfx;if(te)throw new Error(`already rendered ${gn(W)}`);return e.element(W,i[W.id],Y)}function c(W,Y){return e.root(W,i[W.id],Y)}function u(W,Y){try{var te=i[W.id]&&s(W,Y);return o(W),te}catch(Ae){l(Ae.message,{element:W,error:Ae}),console.error(`failed to import ${gn(W)}`,Ae)}}function l(W,Y){e.error(W,Y)}var p=this.registerDi=function(Y){var te=Y.bpmnElement;te?i[te.id]?l(`multiple DI elements defined for ${gn(te)}`,{element:te}):i[te.id]=Y:l(`no bpmnElement referenced in ${gn(Y)}`,{element:Y})};function f(W){d(W.plane)}function d(W){p(W),F(W.planeElement,m)}function m(W){p(W)}this.handleDefinitions=function(Y,te){var Ae=Y.diagrams;if(te&&Ae.indexOf(te)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!te&&Ae&&Ae.length&&(te=Ae[0]),!te)throw new Error("no diagram to display");i={},f(te);var gt=te.plane;if(!gt)throw new Error(`no plane for ${gn(te)}`);var M=gt.bpmnElement;if(!M)if(M=hR(Y),M)l(`correcting missing bpmnElement on ${gn(gt)} to ${gn(M)}`),gt.bpmnElement=M,p(gt);else throw new Error("no process or collaboration to display");var E=c(M,gt);if(Rn(M,"bpmn:Process")||Rn(M,"bpmn:SubProcess"))b(M,E);else if(Rn(M,"bpmn:Collaboration"))ye(M,E),y(Y.rootElements,E);else throw new Error(`unsupported bpmnElement for ${gn(gt)}: ${gn(M)}`);h(n)};var h=this.handleDeferred=function(){for(var Y;n.length;)Y=n.shift(),Y()};function b(W,Y){K(W,Y),B(W.ioSpecification,Y),A(W.artifacts,Y),o(W)}function y(W,Y){var te=Ye(W,function(Ae){return!a(Ae)&&Rn(Ae,"bpmn:Process")&&Ae.laneSets});te.forEach(r(b,Y))}function g(W,Y){u(W,Y)}function v(W,Y){F(W,r(g,Y))}function x(W,Y){u(W,Y)}function C(W,Y){u(W,Y)}function T(W,Y){u(W,Y)}function k(W,Y){u(W,Y)}function A(W,Y){F(W,function(te){Rn(te,"bpmn:Association")?n.push(function(){k(te,Y)}):k(te,Y)})}function B(W,Y){W&&(F(W.dataInputs,r(C,Y)),F(W.dataOutputs,r(T,Y)))}var D=this.handleSubProcess=function(Y,te){K(Y,te),A(Y.artifacts,te)};function L(W,Y){var te=u(W,Y);Rn(W,"bpmn:SubProcess")&&D(W,te||Y),Rn(W,"bpmn:Activity")&&B(W.ioSpecification,Y),n.push(function(){F(W.dataInputAssociations,r(x,Y)),F(W.dataOutputAssociations,r(x,Y))})}function z(W,Y){u(W,Y)}function ie(W,Y){u(W,Y)}function ge(W,Y){n.push(function(){var te=u(W,Y);W.childLaneSet&&Ue(W.childLaneSet,te||Y),Te(W)})}function Ue(W,Y){F(W.lanes,r(ge,Y))}function je(W,Y){F(W,r(Ue,Y))}function K(W,Y){pe(W.flowElements,Y),W.laneSets&&je(W.laneSets,Y)}function pe(W,Y){F(W,function(te){Rn(te,"bpmn:SequenceFlow")?n.push(function(){z(te,Y)}):Rn(te,"bpmn:BoundaryEvent")?n.unshift(function(){L(te,Y)}):Rn(te,"bpmn:FlowNode")?L(te,Y):Rn(te,"bpmn:DataObject")||(Rn(te,"bpmn:DataStoreReference")||Rn(te,"bpmn:DataObjectReference")?ie(te,Y):l(`unrecognized flowElement ${gn(te)} in context ${gn(Y&&Y.businessObject)}`,{element:te,context:Y}))})}function ce(W,Y){var te=u(W,Y),Ae=W.processRef;Ae&&b(Ae,te||Y)}function ye(W,Y){F(W.participants,r(ce,Y)),n.push(function(){v(W.messageFlows,Y)}),A(W.artifacts,Y)}function Te(W){F(W.flowNodeRef,function(Y){var te=Y.get("lanes");te&&te.push(W)})}}function S(e,t){var n=ne(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function We(e,t){return Xi(t,function(n){return S(e,n)})}function ne(e){return e&&e.businessObject||e}function tt(e){return e&&e.di}function gR(e,t,n){var i,r,o,a,s=[];function c(u,l){var p={root:function(h,b){return i.add(h,b)},element:function(h,b,y){return i.add(h,b,y)},error:function(h,b){s.push({message:h,context:b})}},f=new mR(p);l=l||u.diagrams&&u.diagrams[0];var d=yR(u,l);if(!d)throw new Error("no diagram to display");F(d,function(h){f.handleDefinitions(u,h)});var m=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(m+"_plane")||o.findRoot(m))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(p){return p.warnings=s,l(p)}})}function yR(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!S(n,"bpmn:Process")&&!S(n,"bpmn:Collaboration")&&(i=vR(n));var r;S(i,"bpmn:Collaboration")?r=i:r=mt(e.rootElements,function(u){if(S(u,"bpmn:Collaboration"))return mt(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=dn(r.participants,function(u){return u.processRef}),o.push(r));var a=Fm(o),s=[t],c=[n];return F(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 Fm(e){var t=[];return F(e,function(n){n&&(t.push(n),t=t.concat(Fm(n.flowElements)))}),t}function vR(e){for(var t=e;t;){if(S(t,"bpmn:Process"))return t;t=t.$parent}}var bR='<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>',jm=bR,Hm={verticalAlign:"middle"},zm={color:"#404040"},xR={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},_R={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},wR={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"},ER='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+jm+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',_i;function SR(){_i=bt(ER),_n(_i,xR),_n(pt("svg",_i),Hm),_n(pt(".backdrop",_i),_R),_n(pt(".notice",_i),wR),_n(pt(".link",_i),zm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function RR(){_i||(SR(),On.bind(_i,".backdrop","click",function(e){document.body.removeChild(_i)})),document.body.appendChild(_i)}const Vs=5,Gm="djs-outline-hidden";function Et(e){e=V({},PR,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),TR(this._container)}_e(Et,ar),Et.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||[]),Ws(s,o),s=CR(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Et.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Et.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ws(o,[]),o}if(typeof t=="string"&&(i=AR(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ws(o,[]),o}try{this.clear()}catch(o){throw Ws(o,[]),o}const{warnings:r}=await gR(this,n,i);return{warnings:r}},Et.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},Et.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=pt(":scope > defs",i._svg),a=sm(r),s=o?"<defs>"+sm(o)+"</defs>":"",c=i.getContainer();wt(c).add(Gm);let u;try{u=r.getBBox()}finally{wt(c).remove(Gm)}const l=u.x-Vs,p=u.y-Vs,f=u.width+Vs*2,d=u.height+Vs*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
4
|
+
nested error: `+C.message;if(k)return a.addWarning({message:z,error:C}),!0;throw Ji(z)}function l(C,M){return u(C,M,!0)}function p(){var C=a.elementsById,M=a.references,k,A;for(k=0;A=M[k];k++){var B=A.element,D=C[A.id],L=ki(B).propertiesByName[A.property];if(D||a.addWarning({message:"unresolved reference <"+A.id+">",element:A.element,property:A.property,value:A.id}),L.isMany){var z=B.get(L.name),ie=z.indexOf(A);ie===-1&&(ie=z.length),D?z[ie]=D:z.splice(ie,1)}else B.set(L.name,D)}}function f(){c.pop().handleEnd()}var d=/^<\?xml /i,m=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function v(C){if(d.test(C)){var M=m.exec(C),k=M&&M[1];!k||h.test(k)||a.addWarning({message:"unsupported document encoding <"+k+">, falling back to UTF-8"})}}function y(C,M){var k=c.peek();try{c.push(k.handleNode(C))}catch(A){u(A,M,o)&&c.push(new Ju)}}function g(C,M){try{c.peek().handleText(C)}catch(k){l(k,M)}}function b(C,M){C.trim()&&g(C,M)}var x=r.getPackages().reduce(function(C,M){return C[M.uri]=M.prefix,C},Object.entries(Qu).reduce(function(C,[M,k]){return C[k]=M,C},r.config&&r.config.nsMap||{}));return s.ns(x).on("openTag",function(C,M,k,A){var B=C.attrs||{},D=Object.keys(B).reduce(function(z,ie){var ge=M(B[ie]);return z[ie]=ge,z},{}),L={name:C.name,originalName:C.originalName,attributes:D,ns:C.ns};y(L,A)}).on("question",v).on("closeTag",f).on("cdata",g).on("text",function(C,M,k){b(M(C),k)}).on("error",u).on("warn",l),new Promise(function(C,M){var k;try{s.parse(e),p()}catch(z){k=z}var A=i.element;!k&&!A&&(k=Ji("failed to parse document as <"+i.type.$descriptor.name+">"));var B=a.warnings,D=a.references,L=a.elementsById;return k?(k.warnings=B,M(k)):C({rootElement:A,elementsById:L,references:D,warnings:B})})},nl.prototype.handler=function(e){return new tl(this.model,e)};function Aw(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var Mw=`<?xml version="1.0" encoding="UTF-8"?>
|
|
5
|
+
`,Tw=/<|>|'|"|&|\n\r|\n/g,jd=/<|>|&/g;function mi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}mi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},mi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},mi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},mi.prototype.add=function(e,t){this.uriMap[e.uri]=e,t?this.wellknown.push(e):this.custom.push(e),this.mapPrefix(e.prefix,e.uri)},mi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},mi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},mi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},mi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},mi.prototype.getUsed=function(e){var t=[].concat(this.wellknown,this.custom);return t.filter(n=>{var i=this.getNSKey(n);return this.used[i]})};function kw(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Ow(e,t){return Bd(t)?kw(e):e}function Hd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function zd(e){return An(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function Dw(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 Lw(e,t){return t.isGeneric?V({localName:t.ns.localName},e):V({localName:Ow(t.ns.localName,t.$pkg)},e)}function Iw(e,t){return V({localName:t.ns.localName},e)}function Bw(e){var t=e.$descriptor;return Ye(t.properties,function(n){var i=n.name;if(n.isVirtual||!Mn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var Nw={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},$w={"<":"lt",">":"gt","&":"amp"};function Gd(e,t,n){return e=An(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function Fw(e){return Gd(e,Tw,Nw)}function jw(e){return Gd(e,jd,$w)}function Hw(e){return Ye(e,function(t){return t.isAttr})}function zw(e){return Ye(e,function(t){return!t.isAttr})}function il(e){this.tagName=e}il.prototype.build=function(e){return this.element=e,this},il.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Lr(){}Lr.prototype.serializeValue=Lr.prototype.serializeTo=function(e){e.append(this.escape?jw(this.value):this.value)},Lr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(jd)!==-1&&(this.escape=!0),this};function rl(e){this.tagName=e}Hd(rl,Lr),rl.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function _t(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}_t.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=Bw(e),this.parseAttributes(Hw(r)),this.parseContainments(zw(r))),this.parseGenericAttributes(e,i),this},_t.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return Lw(t,e)},_t.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return Iw(t,e)},_t.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},_t.prototype.nsAttributeName=function(e){var t;if(An(e)?t=hn(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:V({localName:t.localName},n)},_t.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}))},_t.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Lr().build({type:"String"},t));var n=e.$children;n&&F(n,i=>{this.body.push(new _t(this).build(i))})},_t.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=hn(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)}},_t.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return F(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},_t.prototype.parseGenericAttributes=function(e,t){var n=this;F(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)}})},_t.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;F(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Lr().build(r,o[0]));else if(Md(r.type))F(o,function(u){n.push(new rl(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)F(o,function(u){n.push(new il(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=$d(r);F(o,function(u){var l;c?c===Nd?l=new _t(t,r):l=new ms(t,r,c):l=new _t(t),n.push(l.build(u))})}})},_t.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new mi(i):t=i),t},_t.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},_t.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},_t.prototype.parseAttributes=function(e){var t=this,n=this.element;F(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];F(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},_t.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),zd(e)},_t.prototype.addAttribute=function(e,t){var n=this.attrs;An(t)&&(t=Fw(t));var i=Rd(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)},_t.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=Dw(n).concat(t)),F(t,function(i){e.append(" ").append(zd(i.name)).append('="').append(i.value).append('"')})},_t.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Lr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),F(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function ms(e,t,n){_t.call(this,e,t),this.serialization=n}Hd(ms,_t),ms.prototype.parseNsAttributes=function(e){var t=_t.prototype.parseNsAttributes.call(this,e).filter(a=>a.name!==this.serialization),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(this.serialization),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},ms.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function Gw(){this.value="",this.write=function(e){this.value+=e}}function Vw(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 Ww(e){e=V({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new Gw,o=new Vw(r,e.format);e.preamble&&o.append(Mw);var a=new _t,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(Uw(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function Uw(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Qu)n[i]=Qu[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function gs(e,t){Xn.call(this,e,t)}gs.prototype=Object.create(Xn.prototype),gs.prototype.fromXML=function(e,t,n){An(t)||(n=t,t="bpmn:Definitions");var i=new nl(V({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},gs.prototype.toXML=function(e,t){var n=new Ww(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var Yw="BPMN20",qw="http://www.omg.org/spec/BPMN/20100524/MODEL",Kw="bpmn",Xw=[],Zw=[{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"}]}],Qw=[{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"}]}],Jw={tagAlias:"lowerCase",typePrefix:"t"},eE={name:Yw,uri:qw,prefix:Kw,associations:Xw,types:Zw,enumerations:Qw,xml:Jw},tE="BPMNDI",nE="http://www.omg.org/spec/BPMN/20100524/DI",iE="bpmndi",rE=[{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"]}],oE=[{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"}]}],aE=[],sE={name:tE,uri:nE,prefix:iE,types:rE,enumerations:oE,associations:aE},cE="DC",uE="http://www.omg.org/spec/DD/20100524/DC",lE="dc",pE=[{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}]}],fE=[],dE={name:cE,uri:uE,prefix:lE,types:pE,associations:fE},hE="DI",mE="http://www.omg.org/spec/DD/20100524/DI",gE="di",yE=[{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"}]}],vE=[],bE={tagAlias:"lowerCase"},xE={name:hE,uri:mE,prefix:gE,types:yE,associations:vE,xml:bE},_E="bpmn.io colors for BPMN",wE="http://bpmn.io/schema/bpmn/biocolor/1.0",EE="bioc",SE=[{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"}]}],RE=[],CE=[],PE={name:_E,uri:wE,prefix:EE,types:SE,enumerations:RE,associations:CE},AE="BPMN in Color",ME="http://www.omg.org/spec/BPMN/non-normative/color/1.0",TE="color",kE=[{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"}]}],OE=[],DE=[],LE={name:AE,uri:ME,prefix:TE,types:kE,enumerations:OE,associations:DE};const IE={bpmn:eE,bpmndi:sE,dc:dE,di:xE,bioc:PE,color:LE};function Vd(e,t){const n=V({},IE,e);return new gs(n,t)}const BE={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"}},NE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Wd="i18n",ys={[Wd]:BE,[Hu]:xd};function Ud(){return Vd(ys)}const Yd=Ud();async function ol(e){const{rootElement:t,warnings:n}=await Yd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function $E(e){const{xml:t}=await Yd.toXML(e,{format:!0});return t}function al(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const uo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},FE=/[ᄀ-ᇿ -〿-ヿ㐀-鿿가--⦆]/;function jE(e){const t=uo;return FE.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 lo(e,t){let n=0;for(const i of e)n+=t*jE(i);return n}function qd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&HE(e),zE(e),GE(e),VE(e)}function HE(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:lo(r,o),fontBoundingBoxAscent:o*uo.ascentEm,fontBoundingBoxDescent:o*uo.descentEm,actualBoundingBoxAscent:o*uo.ascentEm,actualBoundingBoxDescent:o*uo.descentEm}}};t.getContext=()=>n}function zE(e){if(e.SVGMatrix)return;class t{constructor(){no(this,"a",1);no(this,"b",0);no(this,"c",0);no(this,"d",1);no(this,"e",0);no(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 GE(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 VE(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:lo(n,12),height:14}})}const vs=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),WE=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),UE=1,sl=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),YE=2;function Et(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"edge-endpoint-detached":return`d|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Kd=20,bs=5,Xd=3,qE=8,Zd=12,KE=Zd*1.2;function cl(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>lo(o,Zd))),r=n.length*KE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Qd=1;function xn(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 po(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of xn(e))for(const s of xn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Qd)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const u=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);u>=Kd&&(!n||u>n.length)&&(n={axis:a.axis,length:u,kind:c})}return n}function ul(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Jd(e,t){const n=po(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function XE(e,t){let n=0;for(const i of t)i.id!==e.id&&Jd(e,i)&&n++;return n}function Gn(e,t){let n=0;for(const i of t)i.id!==e.id&&po(e,i)&&n++;return n}const eh=15,th=20;function ZE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-th||t.at>n[1]+th)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 ll=20;function xs(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Qd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Kd||n.push([r-ll,o+ll])}return n}function _s(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of xn(e)){const o=ZE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of xs(r,xn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const QE=10,JE=1,e1=(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 t1(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,m)=>{if(m===0)return d<=0;const h=d/m;if(m>0){if(h>p)return!1;h>l&&(l=h)}else{if(h<l)return!1;h<p&&(p=h)}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 pl(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 n1=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,fo=1;function Oi(e,t){const n=e.x+fo,i=e.x+e.width-fo,r=e.y+fo,o=e.y+e.height-fo;return t.axis==="h"?t.at>r&&t.at<o&&t.lo<i&&t.hi>n:t.at>n&&t.at<i&&t.lo<o&&t.hi>r}function na(e){return[{axis:"h",at:e.y,lo:e.x,hi:e.x+e.width,dir:1},{axis:"h",at:e.y+e.height,lo:e.x,hi:e.x+e.width,dir:1},{axis:"v",at:e.x,lo:e.y,hi:e.y+e.height,dir:1},{axis:"v",at:e.x+e.width,lo:e.y,hi:e.y+e.height,dir:1}]}function nh(e,t){const n=e.label;if(!n)return null;if(xn(e).some(i=>Oi(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(xn(i).some(r=>Oi(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(na(i).some(r=>Oi(n,r)))return i.id;return null}function an(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(t1(e.waypoints[o],e.waypoints[o+1],r,YE)){i.push(r);break}}return i}function i1(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 ih=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ia(e,t){let n=0;for(const i of t){if(i.id===e.id||ih(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++)i1(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Vn(e,t){let n=0;for(const i of t)i.id===e.id||ih(e,i)||ia(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function rh(e){let t=0;const n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)ia(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function ws(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ia(n[i],[n[r]])>0){const o=n[i].id,a=n[r].id;t.push(o<a?[o,a]:[a,o])}return t.sort((i,r)=>`${i[0]}|${i[1]}`.localeCompare(`${r[0]}|${r[1]}`))}function oh(e){const t=ws(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let r=0,o=0;for(const[a,s]of t){const c=i.get(a),u=i.get(s);if(!c||!u)continue;const l=n(c.type),p=n(u.type);l==="solid"&&p==="solid"?r++:l==="dashed"&&p==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:r1(e)}}function r1(e){const t=e.shapes.filter(r=>r.type==="bpmn:Participant");if(t.length<3)return 0;const n=r=>{const o=e.shapes.find(a=>a.id===r);if(o)return t.find(a=>o.x>=a.x&&o.y>=a.y&&o.x+o.width<=a.x+a.width&&o.y+o.height<=a.y+a.height)};let i=0;for(const r of e.edges){if(r.type!=="bpmn:MessageFlow"||r.endpoints.length<2)continue;const o=n(r.endpoints[0]),a=n(r.endpoints[1]);if(!o||!a||o.id===a.id)continue;const s=Math.min(o.y,a.y),c=Math.max(o.y+o.height,a.y+a.height);t.some(u=>u.id!==o.id&&u.id!==a.id&&u.y>s&&u.y+u.height<c)&&i++}return i}function ah(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!sl.has(r.type)&&!i.has(r.id)&&r.x>=n.x&&r.y>=n.y&&r.x+r.width<=n.right&&r.y+r.height<=n.bottom).map(r=>r.id).sort()}function sh(e){var n;const t=(n=xt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=xt(i);if((r==null?void 0:r.$type)!=="bwl:Members"||typeof r.refs!="string")continue;const o=r.refs.split(/\s+/).filter(Boolean);return o.length?o:void 0}}const ch=e=>e?{members:e}:{},Wn=e=>e.shapes.filter(t=>!t.container);function o1(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const r=i.endpoints.find(a=>a!==e.id),o=r?n.get(r):void 0;if(o){if(o.container)return o.id;if(o.parent)return o.parent}}}function uh(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(xn(i).some(r=>Oi(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(na(i).some(r=>Oi(n,r)))return i.id;return null}function ho(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function kt(e){const t=[],n=e.shapes.filter(y=>!y.container);for(const y of e.edges)for(const g of an(y,n))t.push({kind:"edge-crosses-shape",edge:y.id,shape:g.id});const i=e.shapes.filter(y=>y.container&&WE.has(y.type));if(i.length){const y=(g,b)=>{const x=e.shapes.find(C=>C.id===b);return!!x&&x.x>=g.x&&x.y>=g.y&&x.x+x.width<=g.x+g.width&&x.y+x.height<=g.y+g.height};for(const g of e.edges)for(const b of an(g,i))g.endpoints.includes(b.id)||g.endpoints.some(x=>y(b,x))||t.push({kind:"edge-crosses-subprocess",edge:g.id,subProcess:b.id})}for(const y of e.edges){if(y.waypoints.length<2)continue;const g=[[y.source,y.waypoints[0]],[y.target,y.waypoints[y.waypoints.length-1]]];for(const[b,x]of g){if(!b)continue;const C=e.shapes.find(B=>B.id===b);if(!C||C.container)continue;const M=Math.max(C.x-x.x,x.x-(C.x+C.width),0),k=Math.max(C.y-x.y,x.y-(C.y+C.height),0),A=Math.hypot(M,k);A>QE&&t.push({kind:"edge-endpoint-detached",edge:y.id,shape:b,distance:Math.round(A)})}}const r=e.shapes.filter(y=>y.type==="bpmn:Participant");for(let y=0;y<r.length;y++)for(let g=y+1;g<r.length;g++){const b=r[y],x=r[g];if(b.x+b.width<=x.x||x.x+x.width<=b.x||b.y+b.height<=x.y||x.y+x.height<=b.y)continue;const C=(M,k)=>M.x<=k.x&&M.y<=k.y&&M.x+M.width>=k.x+k.width&&M.y+M.height>=k.y+k.height;t.push({kind:"pool-overlap",pools:[b.id,x.id],contained:C(b,x)||C(x,b)})}const o=n.filter(y=>!y.attached);for(let y=0;y<o.length;y++)for(let g=y+1;g<o.length;g++){const b=o[y],x=o[g];if(!pl(b,x,UE))continue;const C=b.id<x.id?[b.id,x.id]:[x.id,b.id];t.push({kind:"shape-overlap",shapes:C,identical:n1(b,x)})}const a=e.shapes.filter(y=>y.type==="bpmn:Group"&&Array.isArray(y.members)&&y.members.length>0);for(let y=0;y<a.length;y++)for(let g=y+1;g<a.length;g++){const b=a[y],x=a[g],C=Math.min(b.x+b.width,x.x+x.width)-Math.max(b.x,x.x),M=Math.min(b.y+b.height,x.y+x.height)-Math.max(b.y,x.y);if(C<=bs||M<=bs)continue;const k=b.id<x.id?[b.id,x.id]:[x.id,b.id],A=new Set(x.members);if(b.members.some(D=>A.has(D))){const D=ah(e,a,{x:Math.max(b.x,x.x),y:Math.max(b.y,x.y),right:Math.min(b.x+b.width,x.x+x.width),bottom:Math.min(b.y+b.height,x.y+x.height)});D.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:k,shapes:D});continue}const B=b.x<=x.x&&b.y<=x.y&&b.x+b.width>=x.x+x.width&&b.y+b.height>=x.y+x.height?b.id:x.x<=b.x&&x.y<=b.y&&x.x+x.width>=b.x+b.width&&x.y+x.height>=b.y+b.height?x.id:void 0;t.push({kind:"group-overlap-unintended",groups:k,...B?{container:B}:{}})}const s=new Set(a.flatMap(y=>[...y.members])),c=y=>e.shapes.filter(g=>!g.container&&!sl.has(g.type)&&g.x>=y.x&&g.y>=y.y&&g.x+g.width<=y.x+y.width&&g.y+g.height<=y.y+y.height);for(const y of a){const g=c(y);if(!g.length)continue;const b=new Set(y.members),x=g.filter(C=>!b.has(C.id));x.some(C=>s.has(C.id))&&(x.length*2<g.length||t.push({kind:"group-overlap-unreadable",reason:"minority",group:y.id,shapes:x.map(C=>C.id).sort()}))}for(const y of a){const g=new Set(c(y).map(A=>A.id)),b=new Set(y.members),x=new Set([...g].filter(A=>!b.has(A)&&s.has(A)));if(!x.size)continue;let C=!1,M=!1,k=!1;for(const A of e.edges){if(A.type!=="bpmn:SequenceFlow"||!A.source||!A.target)continue;const B=x.has(A.source),D=x.has(A.target);!B&&D&&!g.has(A.source)?C=!0:B&&!D&&!g.has(A.target)?M=!0:B&&D&&(k=!0)}C&&M&&k&&t.push({kind:"group-overlap-unreadable",reason:"throughpass",group:y.id,shapes:[...x].sort()})}const u=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<u.length;y++)for(let g=y+1;g<u.length;g++)for(let b=g+1;b<u.length;b++){const x=[u[y],u[g],u[b]],C={x:Math.max(...x.map(A=>A.x)),y:Math.max(...x.map(A=>A.y)),right:Math.min(...x.map(A=>A.x+A.width)),bottom:Math.min(...x.map(A=>A.y+A.height))};if(C.right-C.x<=bs||C.bottom-C.y<=bs)continue;const M=ah(e,[],C);if(!M.length)continue;const k=x.map(A=>A.id).sort();t.push({kind:"group-stack-unreadable",groups:k,shapes:M})}for(const y of e.shapes.filter(g=>g.type==="bpmn:Group"))for(const g of e.shapes){if(g.container||g.attached||sl.has(g.type)||g.width<=0||g.height<=0)continue;const b=[["top",y.y,"h",y.x,y.x+y.width],["bottom",y.y+y.height,"h",y.x,y.x+y.width],["left",y.x,"v",y.y,y.y+y.height],["right",y.x+y.width,"v",y.y,y.y+y.height]];for(const[x,C,M,k,A]of b){const B=M==="h"?g.x:g.y,D=M==="h"?g.x+g.width:g.y+g.height;if(!(B<A&&k<D))continue;const L=M==="h"?g.y:g.x,z=M==="h"?g.y+g.height:g.x+g.width;if(!(L<C&&C<z))continue;const ie=Math.min(C-L,z-C);ie<qE||t.push({kind:"group-cuts-shape",group:y.id,shape:g.id,side:x,depth:ie})}}const l=e.shapes.filter(y=>y.container&&y.type!=="bpmn:Group"&&y.type!=="bpmn:Lane");for(const y of e.shapes.filter(g=>g.type==="bpmn:Group"))for(const g of l){const b=y.x<g.x+g.width&&g.x<y.x+y.width,x=y.y<g.y+g.height&&g.y<y.y+y.height,C=[["top",y.y,g.y,b],["bottom",y.y+y.height,g.y+g.height,b],["left",y.x,g.x,x],["right",y.x+y.width,g.x+g.width,x]];for(const[M,k,A,B]of C)B&&Math.abs(k-A)<=Xd&&t.push({kind:"group-on-container-boundary",group:y.id,container:g.id,side:M})}const p=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<p.length;y++)for(let g=y+1;g<p.length;g++){const b=p[y],x=p[g],C=b.x<x.x+x.width&&x.x<b.x+b.width,M=b.y<x.y+x.height&&x.y<b.y+b.height,k=[["x",b.x+b.width,x.x,M],["x",x.x+x.width,b.x,M],["y",b.y+b.height,x.y,C],["y",x.y+x.height,b.y,C]];for(const[A,B,D,L]of k)if(L&&Math.abs(B-D)<=Xd){t.push({kind:"group-on-group-boundary",groups:b.id<x.id?[b.id,x.id]:[x.id,b.id],axis:A});break}}for(let y=0;y<e.edges.length;y++)for(let g=y+1;g<e.edges.length;g++){const b=e.edges[y],x=e.edges[g],C=po(b,x);if(!C)continue;const M=b.id<x.id?[b.id,x.id]:[x.id,b.id];t.push({kind:C.kind==="opposite"?"edge-overlap-opposite":C.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:M,axis:C.axis,length:Math.round(C.length)})}for(const y of e.edges){if(!y.label)continue;const g=_s(y,e.edges);g&&t.push({kind:"label-on-shared-segment",edge:y.id,other:g.other,axis:g.axis})}for(const y of e.edges){if(!y.label)continue;const g=nh(y,e);g&&t.push({kind:"label-over-line",edge:y.id,line:g})}const f=new Set(n.map(y=>y.id)),d=e.shapes.filter(y=>y.type==="bpmn:Participant"&&y.label);for(const y of[...n,...d.filter(g=>!f.has(g.id))]){if(!y.label)continue;const g=uh(y,e);g&&t.push({kind:"label-over-line",edge:y.id,line:g})}const m=new Set(e.shapes.filter(y=>y.type==="bpmn:TextAnnotation").map(y=>y.id));for(const y of d)for(const{owner:g,rect:b}of ho(e))g===y.id||m.has(g)||pl(y.label,b,fo)&&t.push({kind:"pool-name-over-label",pool:y.id,label:g});const h=ho(e);for(const y of n)if(y.type==="bpmn:TextAnnotation")for(const{owner:g,rect:b}of h)g!==y.id&&pl(y,b,fo)&&t.push({kind:"annotation-over-label",annotation:y.id,label:g});const v=new Map(e.shapes.map(y=>[y.id,y]));for(const y of n){const g=y.parent??o1(y,e,v);if(!g)continue;const b=v.get(g);!b||!b.container||e1(b,y,JE)||t.push({kind:"shape-outside-container",shape:y.id,container:b.id})}return t.sort((y,g)=>Et(y).localeCompare(Et(g)))}const xt=e=>typeof e=="object"&&e!==null?e:void 0,Ot=e=>typeof e=="number"?e:0,Di=e=>{const t=xt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function a1(e){const t=xt(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=Di(o);a&&n.push(a)}}return n}function s1(e){const t=xt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Di(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Di(t.targetRef);return n&&i?{source:n,target:i}:{}}function c1(e,t){const n=xt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Di(n);return r?t.get(r):void 0}if(vs.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Di(n)}function lh(e){var a,s,c,u,l;const t=[],n=[],i=((a=xt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const p of((s=xt(e))==null?void 0:s.rootElements)??[]){const f=xt(p);if((f==null?void 0:f.$type)==="bpmn:Collaboration")for(const d of f.participants??[]){const m=xt(d),h=Di(m),v=Di(m==null?void 0:m.processRef);h&&v?r.set(v,h):h&&o.add(h)}}for(const p of i){const f=xt((c=xt(p))==null?void 0:c.plane),d=(f==null?void 0:f.planeElement)??[];for(const m of d){const h=xt(m);if(!h)continue;const v=xt(h.bpmnElement),y=typeof(v==null?void 0:v.id)=="string"?v.id:void 0;if(!y)continue;const g=typeof(v==null?void 0:v.$type)=="string"?v.$type:"",b=xt(h.bounds);if(b){const C=h.isExpanded===!1&&g!=="bpmn:Participant",M=xt((u=xt(h.label))==null?void 0:u.bounds),k={id:y,type:g,x:Ot(b.x),y:Ot(b.y),width:Ot(b.width),height:Ot(b.height),container:vs.has(g)&&!C,attached:(v==null?void 0:v.attachedToRef)!==void 0,...v?{parent:c1(v,r)}:{},...M?{label:{x:Ot(M.x),y:Ot(M.y),width:Ot(M.width),height:Ot(M.height)}}:{},...g==="bpmn:Group"?ch(sh(v)):{}},A=h.isHorizontal!==!1,B=typeof(v==null?void 0:v.name)=="string"?v.name:"";o.has(y)&&A&&B&&(k.label=cl(k,B)),t.push(k);continue}const x=h.waypoint;if(Array.isArray(x)){const C=xt((l=xt(h.label))==null?void 0:l.bounds);n.push({id:y,type:g,waypoints:x.map(M=>{var k,A;return{x:Ot((k=xt(M))==null?void 0:k.x),y:Ot((A=xt(M))==null?void 0:A.y)}}),endpoints:a1(v),...s1(v),...C?{label:{x:Ot(C.x),y:Ot(C.y),width:Ot(C.width),height:Ot(C.height)}}:{}})}}}return{shapes:t,edges:n}}function ph(e){return kt(lh(e))}async function u1(e){const{definitions:t,warnings:n}=await ol(e);return{findings:ph(t),warnings:n}}function et(e){var i;const t=[],n=[];for(const r of e.getAll()){const o=r;if(o.type==="label"||o.labelTarget)continue;const a=typeof o.type=="string"?o.type:"";if(a==="bpmn:Definitions"||a.startsWith("bpmndi:"))continue;const s=o.waypoints;if(s){const h=xt(o.label),v=Di(o.source),y=Di(o.target);n.push({id:o.id,type:a,waypoints:s.map(g=>({x:Ot(g.x),y:Ot(g.y)})),endpoints:[v,y].filter(g=>!!g),...v&&y?{source:v,target:y}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Ot(h.y),width:Ot(h.width),height:Ot(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=xt(o.businessObject),u=xt(o.label);let l=xt(o.parent);for(;l&&l.type==="bpmn:Lane";)l=xt(l.parent);const p=typeof(l==null?void 0:l.type)=="string"?l.type:"",f=l&&vs.has(p)&&p!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Ot(o.width),height:Ot(o.height),container:vs.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...f!==void 0?{parent:f}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:Ot(u.y),width:Ot(u.width),height:Ot(u.height)}}:{},...a==="bpmn:Group"?ch(sh(c)):{}},m=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&m&&((i=xt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=cl(d,m)),t.push(d)}return{shapes:t,edges:n}}const l1={"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 p1(e,t){const n=l1[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function fh(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function dh(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 p1(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&fh(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?fh(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 fl=20,f1=4,yt=(e,t)=>Math.abs(e-t)<.5;function Es(e,t,n,i=fl){if(yt(e.y,t.y)&&!yt(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(yt(e.x,t.x)&&!yt(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 hh(e,t,n,i=fl){if(n.length<2)return null;if(yt(e.y,t.y)&&!yt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,u=e.x<t.x?s:a,l=Math.min(...n.map(d=>d.y))-i,p=Math.max(...n.map(d=>d.y+d.height))+i,f=d=>[{x:c,y:e.y},{x:c,y:d},{x:u,y:d},{x:u,y:e.y}];return[f(l),f(p)]}if(yt(e.x,t.x)&&!yt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,u=e.y<t.y?s:a,l=Math.min(...n.map(d=>d.x))-i,p=Math.max(...n.map(d=>d.x+d.width))+i,f=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:u},{x:e.x,y:u}];return[f(l),f(p)]}return null}function mh(e,t,n=fl){if(e.length!==4)return null;const[i,r,o,a]=e;if(yt(i.y,r.y)&&yt(r.x,o.x)&&yt(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(yt(i.x,r.x)&&yt(r.y,o.y)&&yt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function Ss(e,t){if(e.endpoints.length!==2)return[];const n=t.find(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 gh=30,d1=[0,-25,25,-40,40];function h1(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+gh:s-gh,u=a?i.y+i.height:i.y,l=n.x+n.width/2,p=i.x+i.width/2;return d1.map(f=>[{x:l,y:s},{x:l,y:c},{x:p+f,y:c},{x:p+f,y:u}])}const dl=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],mo=(e,t,n)=>an({...e,waypoints:t},n).length;function hl(e,t,n,i){let r=[...e.waypoints],o=mo(e,r,t);if(o===0)return null;let a=!1;for(const p of Ss(e,t))if(mo(e,p,t)===0)return p;const s=(i??[]).filter(p=>p.id!==e.id).flatMap(xn),c=p=>xn({...e,waypoints:p}).some(f=>xs(f,s).length>0),u=h1(e,t).filter(p=>mo(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);if(e.endpoints.length===2&&r.length>2){const p=t.find(d=>d.id===e.endpoints[0]),f=t.find(d=>d.id===e.endpoints[1]);if(p&&f&&yt(p.y+p.height/2,f.y+f.height/2)){const d=[r[0],r[r.length-1]];if(yt(d[0].y,d[1].y)&&!yt(d[0].x,d[1].x)){const m=t.filter(g=>!e.endpoints.includes(g.id)&&an({...e,waypoints:d},[g]).length>0),h=m.length>=2?hh(d[0],d[1],m):null,y=(h?h.map(g=>[d[0],...g,d[1]]):m.length===1?(Es(d[0],d[1],m[0])??[]).map(g=>[d[0],...g,d[1]]):m.length===0?[d]:[]).filter(g=>mo(e,g,t)===0&&g.length<=r.length).sort((g,b)=>Number(l(b))-Number(l(g)));if(y.length)return y.find(g=>!c(g))??y[0]}}}for(let p=0;p+1<r.length;p++){const f=r[p],d=r[p+1],m=t.filter(y=>!e.endpoints.includes(y.id)&&an({...e,waypoints:[f,d]},[y]).length>0);if(m.length<2)continue;const h=hh(f,d,m);if(!h)continue;const v=h.map(y=>dl(r,p,y)).filter(y=>mo(e,y,t)===0).sort((y,g)=>Number(l(g))-Number(l(y)));if(v.length)return v.find(y=>!c(y))??v[0]}for(let p=0;p<f1&&o>0;p++){let f=!1;for(let d=0;d+1<r.length&&!f;d++){const m=r[d],h=r[d+1];for(const v of t){if(e.endpoints.includes(v.id)||an({...e,waypoints:[m,h]},[v]).length===0)continue;const y=Es(m,h,v),g=y?y.map(x=>dl(r,d,x)):mh(r,v)??[];if(!g.length)continue;const b=[...g].sort((x,C)=>Number(l(C))-Number(l(x)));for(const x of b){const C=mo(e,x,t);if(C<o){r=x,o=C,f=!0,a=!0;break}}if(f)break}}if(!f)break}return a&&o===0?r:null}function ml(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=et(i),a=Wn(o),s=new Set,c=kt(o).filter(l=>l.kind==="edge-crosses-shape"&&!t.has(Et(l)));if(!c.length)return s;const u=new Map;for(const l of c){if(l.kind!=="edge-crosses-shape"||u.has(l.edge))continue;const p=o.edges.find(f=>f.id===l.edge);p&&u.set(l.edge,p)}for(const[l,p]of u){if(n&&!n.has(l))continue;const f=i.get(l);if(!f)continue;const d=f.parent,m=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=hl(p,a,m,o.edges);if(!h){an(p,a).some(b=>b.type==="bpmn:TextAnnotation")&&s.add(l);continue}const v=o.edges.filter(b=>b.id!==l),y=Gn(p,v);Gn({...p,waypoints:h},v)>y||r.updateWaypoints(f,h)}return s}const m1=e=>{const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];t.push({id:`__ghost:${e.id}:${n}`,type:"bpmn:Task",x:Math.min(i.x,r.x)-1,y:Math.min(i.y,r.y)-1,width:Math.max(2,Math.abs(r.x-i.x)+2),height:Math.max(2,Math.abs(r.y-i.y)+2),container:!1,attached:!1})}return t},gl=(e,t)=>ia(e,[t])>0;function yh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=et(i),a=Wn(o);let s=o;const c=new Set(kt(o).map(Et));for(const[u,l]of ws(o))if(!t.has(`${u}|${l}`))for(const[p,f]of[[u,l],[l,u]]){if(n.has(p))continue;const d=s.edges.find(B=>B.id===p),m=s.edges.find(B=>B.id===f);if(!d||!m)continue;const h=i.get(p);if(!h)continue;const v=h.parent,y=v&&typeof v.x=="number"&&typeof v.width=="number"?{x:v.x,y:v.y,width:v.width,height:v.height}:void 0,g=m1(m),b=[...Ss(d,a)??[]],x=hl(d,[...a,...g],y,o.edges);x&&b.push(x);for(let B=0;B+1<d.waypoints.length;B++)for(const D of g)for(const L of Es(d.waypoints[B],d.waypoints[B+1],D)??[])b.push(dl(d.waypoints,B,L));const C=s.edges.filter(B=>B.id!==p),M=B=>({...s,edges:s.edges.map(D=>D.id===p?{...D,waypoints:B}:D)}),k=B=>!y||B.every(D=>D.x>=y.x&&D.x<=y.x+y.width&&D.y>=y.y&&D.y<=y.y+y.height),A=b.find(B=>{const D={...d,waypoints:B};return gl(D,m)||!k(B)||C.some(L=>L.id!==f&&!gl(d,L)&&gl(D,L))?!1:kt(M(B)).every(L=>c.has(Et(L)))});if(A){r.updateWaypoints(h,A),s=M(A);break}}}const g1=10;function vh(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 bh(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(z=>z.type==="bpmn:Participant"&&z.container),i=t.shapes.find(z=>z.id===e.endpoints[0]),r=t.shapes.find(z=>z.id===e.endpoints[1]);if(!i||!r)return null;const o=vh(i,n),a=vh(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter(z=>z.id!==o.id&&z.id!==a.id&&z.y>=c.y+c.height&&z.y+z.height<=u.y).sort((z,ie)=>z.y-ie.y);if(!l.length)return null;const p=l[0],f=l[l.length-1],d=(c.y+c.height+p.y)/2,m=(f.y+f.height+u.y)/2,h=s?d:m,v=s?m:d,y=e.waypoints[0],g=e.waypoints[e.waypoints.length-1],b=Wn(t),x=t.edges.filter(z=>z.id!==e.id),C=Vn(e,x),M=an(e,b).length;if(C===0&&M===0||M===0&&e.waypoints.length===2)return null;const k=Math.min(...l.map(z=>z.x)),A=Math.max(...l.map(z=>z.x+z.width)),B=(y.x+g.x)/2,D=z=>z.filter((ie,ge)=>ge===0||!(yt(ie.x,z[ge-1].x)&&yt(ie.y,z[ge-1].y)));let L;for(let z=k;z<=A;z+=g1){const ie=D([y,{x:y.x,y:h},{x:z,y:h},{x:z,y:v},{x:g.x,y:v},g]),ge={...e,waypoints:ie};if(an(ge,b).length>0)continue;const Ue=Vn(ge,x),je=Math.abs(z-B);(!L||Ue<L.cross||Ue===L.cross&&je<L.detour)&&(L={pts:ie,cross:Ue,detour:je})}return L&&(M>0?L.cross<=C:L.cross<C)?L.pts:null}function xh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=et(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=et(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=bh(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const gi=[25,-25,40,-40],go=35;function y1(e,t){const n=e.x+e.width/2,i=t.x+t.width/2,r=[];for(const o of[!0,!1]){const a=o?e.y:e.y+e.height,s=o?t.y:t.y+t.height,c=o?Math.min(e.y,t.y)-go:Math.max(e.y+e.height,t.y+t.height)+go;for(const u of[0,...gi])if(!(Math.abs(u)>=e.width/2-5))for(const l of[0,...gi]){if(Math.abs(l)>=t.width/2-5)continue;const p=n+u,f=i+l;r.push({pts:[{x:p,y:a},{x:p,y:c},{x:f,y:c},{x:f,y:s}],cost:Math.abs(l)+Math.abs(u)})}}return r}function Rs(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return y1(n,i);const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-go:n.y+n.height+go,p=[];for(const g of[0,...gi]){if(Math.abs(g)>=i.width/2-5)continue;const b=o+g;p.push({pts:[{x:n.x,y:r},{x:b,y:r},{x:b,y:c}],cost:Math.abs(g)});for(const x of[0,...gi]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;p.push({pts:[{x:C,y:u},{x:C,y:l},{x:b,y:l},{x:b,y:c}],cost:Math.abs(g)+Math.abs(x)})}}const f=50,d=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const g of[0,...gi]){if(Math.abs(g)>=n.width/2-5)continue;const b=a+g;p.push({pts:[{x:b,y:m},{x:b,y:d},{x:i.x+i.width,y:d}],cost:f+Math.abs(g)})}const h=60,v=s?i.y+i.height:i.y,y=s?i.y+i.height+go:i.y-go;for(const g of[0,...gi]){if(Math.abs(g)>=i.width/2-5)continue;const b=o+g;for(const x of[0,...gi]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;p.push({pts:[{x:C,y:m},{x:C,y},{x:b,y},{x:b,y:v}],cost:h+Math.abs(g)+Math.abs(x)})}}return p}const Cs=30;function _h(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=yt(i.y,r.y)&&!yt(i.x,r.x),a=yt(i.x,r.x)&&!yt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<Cs||Math.abs(i.y-(s.y+s.height))<Cs)return!0}else{const c=Math.min(i.y,r.y);if(Math.max(i.y,r.y)<=s.y||c>=s.y+s.height)continue;if(Math.abs(i.x-s.x)<Cs||Math.abs(i.x-(s.x+s.width))<Cs)return!0}}return!1}const Ps=40;function v1(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-Ps,a=r.x+r.width+Ps,s=r.y-Ps,c=r.y+r.height+Ps;for(let u=1;u<e.length-2;u++){const l=e[u],p=e[u+1],f={x:Math.min(l.x,p.x),y:Math.min(l.y,p.y)},d={x:Math.max(l.x,p.x),y:Math.max(l.y,p.y)};if(f.x<a&&d.x>o&&f.y<c&&d.y>s){i++;break}}}return i}function wh(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(M=>M.container),i=new Map(t.shapes.map(M=>[M.id,M])),r=Wn(t),o=t.edges.filter(M=>M.id!==e.id),a=Gn(e,o),s=Vn(e,o),c=M=>v1(M,t.shapes,e.endpoints)+(_h(M,n)?1:0),u=c(e.waypoints),l=M=>{if(!M)return;const k=M.x+M.width/2,A=M.y+M.height/2;return n.find(B=>B.type==="bpmn:Lane"&&k>=B.x&&k<=B.x+B.width&&A>=B.y&&A<=B.y+B.height)},p=l(i.get(e.endpoints[0]??"")),f=l(i.get(e.endpoints[1]??"")),d=!!p&&!!f&&p.id!==f.id,m=M=>{if(!d||!f)return!1;for(let k=1;k<M.length-2;k++){const A=M[k],B=M[k+1];if(yt(A.y,B.y)&&!yt(A.x,B.x)&&A.y>f.y&&A.y<f.y+f.height)return!0}return!1},h=m(e.waypoints),y=(M=>{if(!M)return;const k=M.x+M.width/2,A=M.y+M.height/2;return n.filter(B=>B.type==="bpmn:Participant"&&k>=B.x&&k<=B.x+B.width&&A>=B.y&&A<=B.y+B.height).sort((B,D)=>B.width*B.height-D.width*D.height)[0]})(i.get(e.endpoints[0]??"")),g=M=>{if(!y)return 0;let k=0;for(let A=1;A<M.length-1;A++){const B=M[A];(B.x<y.x||B.x>y.x+y.width||B.y<y.y||B.y>y.y+y.height)&&k++}return k},b=g(e.waypoints);if(!_h(e.waypoints,n)&&!(d&&!h)&&b===0)return null;const x=M=>M.reduce((k,A,B)=>B?k+Math.abs(A.x-M[B-1].x)+Math.abs(A.y-M[B-1].y):0,0);let C;for(const{pts:M,cost:k}of Rs(e,i)){const A={...e,waypoints:M};if(an(A,r).length>0)continue;const B=Gn(A,o);if(B>a)continue;const D=g(M);if(D>b)continue;const L=D<b&&B===0;if(!L&&Vn(A,o)>s)continue;const z=c(M),ie=m(M);if(!L&&!(ie&&!h)&&z>=u)continue;const Ue=ie?0:1,je=x(M);(!C||D<C.out||D===C.out&&(Ue<C.lane||Ue===C.lane&&(B<C.opp||B===C.opp&&(z<C.sc||z===C.sc&&(k<C.cost||k===C.cost&&je<C.len)))))&&(C={pts:M,out:D,sc:z,lane:Ue,opp:B,cost:k,len:je})}return(C==null?void 0:C.pts)??null}function b1(e,t){const{elementRegistry:n}=e,i=e.modeling,r=et(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=et(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=Wn(a),u=a.edges.filter(d=>d.id!==o),l=an(s,c).length,p=Gn(s,u),f=Vn(s,u);for(const d of Ss(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const m={...s,waypoints:d};if(an(m,c).length>l||Gn(m,u)>p||Vn(m,u)>f)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function Eh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=et(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=et(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=wh(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function yl(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=yt(n[0].x,n[1].x)&&!yt(n[0].y,n[1].y),s=yt(n[n.length-1].x,n[n.length-2].x)&&!yt(n[n.length-1].y,n[n.length-2].y);for(const c of gi){if(a&&r&&Math.abs(c)<r.width/2-5){const u=n.map(l=>({...l}));u[0].x+=c,u[1].x+=c,i.push({pts:u,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const u=n.map(l=>({...l}));u[u.length-1].x+=c,u[u.length-2].x+=c,i.push({pts:u,cost:Math.abs(c)})}}return i}function x1(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const r=i.y+i.height<=n.y,o=n.y+n.height<=i.y;if(!r&&!o)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,u=n.y+n.height/2,l=i.x+i.width/2,p=i.y+i.height/2,f=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,m=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,v=[];for(const y of[0,...gi])Math.abs(y)<i.width/2-5&&v.push({pts:[{x:f,y:u},{x:l+y,y:u},{x:l+y,y:h}],cost:Math.abs(y)}),Math.abs(y)<i.height/2-5&&v.push({pts:[{x:c,y:d},{x:c,y:p+y},{x:m,y:p+y}],cost:Math.abs(y)});return v}function vl(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const r=Math.max(n.x,i.x),o=Math.min(n.x+n.width,i.x+i.width);if(o-r<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,u=a?i.y+i.height:i.y,l=(r+o)/2,p=[];for(const f of[0,...gi]){const d=l+f;d<=r||d>=o||p.push({pts:[{x:d,y:c},{x:d,y:u}],cost:Math.abs(f)})}return p}function Sh(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Wn(t),r=t.edges.filter(d=>d.id!==e.id),o=Gn(e,r);if(o===0)return null;const a=Vn(e,r);let s;const c=d=>d.reduce((m,h,v)=>v?m+Math.abs(h.x-d[v-1].x)+Math.abs(h.y-d[v-1].y):0,0),u=3,l=d=>{const m=d[0],h=d[d.length-1],v=Math.hypot(h.x-m.x,h.y-m.y);return v>=1&&c(d)/v>=u?1:0},p=l(e.waypoints),f=[...Rs(e,n),...vl(e,n),...yl(e,n)];for(const{pts:d,cost:m}of f){const h={...e,waypoints:d};if(an(h,i).length>0)continue;const v=Gn(h,r),y=Vn(h,r),g=o-v+(p-l(d));if(v>=o||y-a>g)continue;const b=c(d);(!s||v<s.opposite||v===s.opposite&&(y<s.cross||y===s.cross&&(m<s.cost||m===s.cost&&b<s.len)))&&(s={pts:d,opposite:v,cross:y,cost:m,len:b})}return(s==null?void 0:s.pts)??null}function Rh(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=po(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function _1(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Wn(t),r=t.edges.filter(f=>f.id!==e.id),o=Rh(e,r);if(o===0)return null;const a=Gn(e,r),s=Vn(e,r),c=f=>f.reduce((d,m,h)=>h?d+Math.abs(m.x-f[h-1].x)+Math.abs(m.y-f[h-1].y):0,0),u=2;let l;const p=[...Rs(e,n),...vl(e,n),...x1(e,n),...yl(e,n)];for(const{pts:f,cost:d}of p){const m={...e,waypoints:f};if(an(m,i).length>0)continue;const h=Rh(m,r);if(h>=o)continue;const v=Gn(m,r);if(v-h>a-o)continue;const y=Vn(m,r);if(y-s>(o-h)*u)continue;const g=c(f);(!l||h<l.fake||h===l.fake&&(v<l.unreadable||v===l.unreadable&&(y<l.cross||y===l.cross&&(d<l.cost||d===l.cost&&g<l.length))))&&(l={pts:f,fake:h,unreadable:v,cross:y,cost:d,length:g})}return(l==null?void 0:l.pts)??null}function Ch(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=kt(et(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(Et(s)));if(!o.length)return;const a=new Set;for(const s of o)if(s.kind==="edge-overlap-unrelated")for(const c of s.edges)n.has(c)||a.add(c);for(const s of[...a].sort()){const c=et(i),u=c.edges.find(f=>f.id===s);if(!u)continue;const l=_1(u,c);if(!l)continue;const p=i.get(s);p&&r.updateWaypoints(p,l)}}function Ph(e,t){const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");return!!n&&!!i&&i.x+i.width>n.x}function Ah(e,t,n){var u;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((u=po(e,t))==null?void 0:u.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(l=>l&&(l===o||l===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:Ph(e,n)&&Ph(t,n)}function Mh(e,t,n){let i=0;for(const r of t)r.id!==e.id&&Ah(e,r,n)&&i++;return i}function w1(e,t){const n=new Map(t.shapes.map(f=>[f.id,f])),i=Wn(t),r=t.edges.filter(f=>f.id!==e.id),o=Mh(e,r,n);if(o===0)return null;const a=Gn(e,r),s=Vn(e,r),c=f=>f.reduce((d,m,h)=>h?d+Math.abs(m.x-f[h-1].x)+Math.abs(m.y-f[h-1].y):0,0),u=2;let l;const p=[...Rs(e,n),...vl(e,n),...yl(e,n)];for(const{pts:f,cost:d}of p){const m={...e,waypoints:f};if(an(m,i).length>0)continue;const h=Mh(m,r,n);if(h>=o)continue;const v=Gn(m,r);if(v-h>a-o)continue;const y=Vn(m,r);if(y-s>(o-h)*u)continue;const g=c(f);(!l||h<l.chain||h===l.chain&&(v<l.unreadable||v===l.unreadable&&(y<l.cross||y===l.cross&&(d<l.cost||d===l.cost&&g<l.length))))&&(l={pts:f,chain:h,unreadable:v,cross:y,cost:d,length:g})}return(l==null?void 0:l.pts)??null}function E1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=et(i),a=new Map(o.shapes.map(u=>[u.id,u])),s=kt(o).filter(u=>u.kind==="edge-overlap-opposite"&&!t.has(Et(u)));if(!s.length)return;const c=new Set;for(const u of s){if(u.kind!=="edge-overlap-opposite")continue;const[l,p]=u.edges.map(f=>o.edges.find(d=>d.id===f));if(!(!l||!p||!Ah(l,p,a)))for(const f of u.edges)n.has(f)||c.add(f)}for(const u of[...c].sort()){const l=et(i),p=l.edges.find(m=>m.id===u);if(!p)continue;const f=w1(p,l);if(!f)continue;const d=i.get(u);d&&r.updateWaypoints(d,f)}}function Th(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=et(i),a=kt(o).filter(l=>ul(l)&&!t.has(Et(l)));if(!a.length)return;const s=new Set;for(const l of a)if(ul(l))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=et(i),f=p.edges.find(h=>h.id===l);if(!f)continue;const d=Sh(f,p);if(!d)continue;const m=i.get(l);m&&r.updateWaypoints(m,d)}}const S1=10,R1=(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 kh(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!_s(e,i))return null;const r=Wn(t),o=i.flatMap(xn);for(const a of xn(e)){let s=[[a.lo,a.hi]];for(const[d,m]of xs(a,o))s=s.flatMap(([h,v])=>{const y=[];return d>h&&y.push([h,Math.min(v,d)]),m<v&&y.push([Math.max(h,m),v]),y.filter(([g,b])=>b>g)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,m])=>m-d>=c+S1*2);if(!u)continue;const l=(u[0]+u[1])/2,p=a.axis==="h"?{x:l,y:a.at-eh}:{x:a.at+kn+n.width/2,y:l},f={x:p.x-n.width/2,y:p.y-n.height/2,width:n.width,height:n.height};if(!_s({...e,label:f},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&R1(f,d)))return f}return null}const kn=8;function Oh(e,t){const n=e.label;if(!n)return null;const i=xn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=f=>{const d=f.axis==="h"?r:o,m=f.axis==="h"?o-f.at:r-f.at,h=d<f.lo?f.lo-d:d>f.hi?d-f.hi:0;return Math.hypot(m,h)},s=i.reduce((f,d)=>a(d)<a(f)?d:f,i[0]),c=[...i,...t.edges.filter(f=>f.id!==e.id).flatMap(xn),...t.shapes.filter(f=>f.container).flatMap(na)],u=f=>!c.some(d=>Oi(f,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+kn,p=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const f of[s.at+kn,s.at-kn-n.width])for(const d of p){const m=n.y+d;if(m<s.lo||m+n.height>s.hi)continue;const h={...n,x:f,y:m};if(u(h))return h}else for(const f of[s.at-kn-n.height,s.at+kn])for(const d of p){const m=n.x+d;if(m<s.lo||m+n.width>s.hi)continue;const h={...n,x:m,y:f};if(u(h))return h}return null}function Dh(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=et(n),o=new Set(kt(r).map(Et));for(const[a,s]of t){const c=s.wps,u=n.get(a),l=u==null?void 0:u.label;if(!l||!(u!=null&&u.waypoints)||u.waypoints.length!==c.length)continue;const p=u.waypoints[0].x-c[0].x,f=u.waypoints[0].y-c[0].y;if(!u.waypoints.every((b,x)=>b.x-c[x].x===p&&b.y-c[x].y===f))continue;const d=s.label.x+p-l.x,m=s.label.y+f-l.y;if(d===0&&m===0)continue;const h=r.edges.find(b=>b.id===a);if(!(h!=null&&h.label))continue;const v={...h.label,x:h.label.x+d,y:h.label.y+m},y={...r,edges:r.edges.map(b=>b.id===a?{...b,label:v}:b)},g=kt(y);g.some(b=>!o.has(Et(b)))||(i.moveElements([l],{x:d,y:m}),r=y,o=new Set(g.map(Et)))}}function Lh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=et(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=Oh(o,r);if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function Ih(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=et(i),a=kt(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Et(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=kh(c,o);if(!u)continue;const l=i.get(s.edge),p=l==null?void 0:l.label;p&&r.moveElements([p],{x:u.x-p.x,y:u.y-p.y})}}function Bh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(xn),...t.shapes.filter(f=>f.container).flatMap(na)],r=i.filter(f=>Oi(n,f));if(!r.length)return null;const o=t.shapes.filter(f=>!f.container&&f.id!==e.id),a=ho(t).filter(f=>f.owner!==e.id).map(f=>f.rect),s=(f,d)=>f.x<d.x+d.width&&d.x<f.x+f.width&&f.y<d.y+d.height&&d.y<f.y+f.height,c=f=>!i.some(d=>Oi(f,d))&&!o.some(d=>s(f,d))&&!a.some(d=>s(f,d)),u=[];for(const f of r)f.axis==="h"?u.push({...n,y:f.at-kn-n.height},{...n,y:f.at+kn}):u.push({...n,x:f.at-kn-n.width},{...n,x:f.at+kn});const l=e.x+e.width/2,p=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+kn},{...n,x:l-n.width/2,y:e.y-kn-n.height},{...n,x:e.x+e.width+kn,y:p-n.height/2},{...n,x:e.x-kn-n.width,y:p-n.height/2}),u.find(c)??null}function Nh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=et(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Bh(o,et(n));if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}function C1(e,t){const n=e.x,i=e.x+e.width,r=e.y,o=e.y+e.height;if(t.x<n||t.x>i||t.y<r||t.y>o)return{x:Math.round(Math.min(Math.max(t.x,n),i)),y:Math.round(Math.min(Math.max(t.y,r),o))};const s=[[t.x-n,{x:n,y:t.y}],[i-t.x,{x:i,y:t.y}],[t.y-r,{x:t.x,y:r}],[o-t.y,{x:t.x,y:o}]].reduce((c,u)=>u[0]<c[0]?u:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function $h(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=et(n),o=new Set(kt(r).map(Et));const a=[...new Set(kt(r).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(Et(s))).map(s=>s.edge))].sort();for(const s of a){const c=r.edges.find(h=>h.id===s);if(!c||c.waypoints.length<2)continue;const u=c.waypoints.map(h=>({...h})),l=[[c.endpoints[0],0],[c.endpoints[1],u.length-1]];let p=!1;for(const[h,v]of l){const y=h?r.shapes.find(b=>b.id===h):void 0;if(!y)continue;const g=C1(y,u[v]);g.x===u[v].x&&g.y===u[v].y||(u[v]=g,p=!0)}if(!p)continue;const f={...r,edges:r.edges.map(h=>h.id===s?{...h,waypoints:u}:h)},d=kt(f);if(d.some(h=>!o.has(Et(h))))continue;const m=n.get(s);m&&(i.updateWaypoints(m,u),r=f,o=new Set(d.map(Et)))}}const P1=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Fh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),jh={"participant.add":[{path:"participant",shape:["id"]},{path:"participant.lanes[]",shape:["id"],optional:!0}],"participant.update":[{path:"id",shape:null},{path:"lanes[]",shape:["id"],optional:!0}],"node.add":[{path:"node",shape:["id","type"]}],"node.update":[{path:"id",shape:null}],"sequenceFlow.add":[{path:"flow",shape:["id","source","target"]}],"sequenceFlow.update":[{path:"id",shape:null}],"messageFlow.add":[{path:"flow",shape:["id","source","target"]}],"messageFlow.update":[{path:"id",shape:null}],"dataStore.add":[{path:"dataStore",shape:["id"]},{path:"associations[]",shape:["source","target"],optional:!0}],"dataStore.update":[{path:"id",shape:null}],"dataAssociation.add":[{path:"association",shape:["source","target"]}],"association.add":[{path:"association",shape:["source","target"]}],"annotation.add":[{path:"annotation",shape:["id","text"]},{path:"association",shape:["source","target"],optional:!0},{path:"placement",shape:["anchor","side"],optional:!0}],"annotation.update":[{path:"id",shape:null},{path:"placement",shape:["anchor","side"],optional:!0}],"group.add":[{path:"group",shape:["id"]},{path:"group.members[]",shape:null,optional:!0}],"group.update":[{path:"id",shape:null},{path:"members[]",shape:null,optional:!0}],"element.remove":[{path:"id",shape:null}]},As=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),bl=e=>typeof e=="string"&&e!=="";function A1(e){const t=[];function n(i,r,o,a){if(a===null){bl(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!As(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)bl(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a;if(!As(i)||!bl(i.kind)||!(i.kind in jh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const s of jh[i.kind]){const c=s.path.endsWith("[]"),u=c?s.path.slice(0,-2):s.path,l=u.split(".");let p=i;for(const d of l.slice(0,-1)){if(!As(p))break;p=p[d]}if(!As(p))continue;const f=p[l[l.length-1]];if(!(f===void 0&&s.optional)&&!(f===null&&s.optional)){if(!c){n(r,s.path,f,s.shape);continue}if(!Array.isArray(f)){t.push({kind:"payload-invalid",opIndex:r,field:s.path});continue}f.forEach((d,m)=>n(r,`${u}[${m}]`,d,s.shape))}}if(i.kind==="node.add"||i.kind==="node.update"){const s=i.band;s!==void 0&&(!Number.isInteger(s)||s<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"});const c=i.kind==="node.add"?(o=i.node)==null?void 0:o.type:i.type;typeof c=="string"&&!vd(c)&&t.push({kind:"node-type-unsupported",opIndex:r,id:(i.kind==="node.add"?(a=i.node)==null?void 0:a.id:i.id)??"",type:c})}}),t}function Hh(e,t){const n=A1(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(f,d,m){if(!P1.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,{...m,opIndex:f})}e.forEach((f,d)=>{var m;switch(f.kind){case"participant.add":a(d,f.participant.id,{category:"participant",lanes:(f.participant.lanes??[]).map(h=>h.id)});for(const h of f.participant.lanes??[])a(d,h.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 h of f.associations??[])h.id&&a(d,h.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"}),(m=f.association)!=null&&m.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(h=>h.id));for(const h of f.lanes)t.categoryOf(h.id)===void 0&&a(d,h.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,m,h){const v=s(d);if(v===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:m});return}if(h&&!h.includes(v)){i.push({kind:"ref-category",opIndex:f,ref:d,role:m,expected:h.join("|"),actual:v});return}return v}const l=t.isCollaboration()||e.some(f=>f.kind==="participant.add");return e.forEach((f,d)=>{var m;switch(f.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:v}=f.node;if(h===void 0){(l||v!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:f.node.id});break}if(u(d,h,"participant",["participant"])===void 0)break;v!==void 0&&((((m=r.get(h))==null?void 0:m.lanes)??o.get(h)??t.lanesOf(h)).includes(v)||i.push({kind:"lane-unknown",opIndex:d,lane:v,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:v,target:y,name:g,condition:b}=f.flow,x=u(d,v,"source",["flowNode"]),C=u(d,y,"target",["flowNode"]);x&&C&&c(v)!==c(y)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),g!==void 0&&b!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:v,target:y}=f.flow,g=u(d,v,"source",["flowNode","participant"]),b=u(d,y,"target",["flowNode","participant"]);if(g&&b){const x=c(v),C=c(y);x!==void 0&&x===C&&i.push({kind:"message-flow-same-pool",opIndex:d,id:h})}break}case"dataStore.add":{for(const h of f.associations??[]){if([h.source,h.target].filter(g=>g===f.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const y=h.source===f.dataStore.id?h.target:h.source;u(d,y,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:v}=f.association,y=u(d,h,"source"),g=u(d,v,"target");if(y&&g){const b=new Set([y,g]);b.has("dataStore")&&b.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:v})}break}case"association.add":{const{id:h,source:v,target:y}=f.association,g=u(d,v,"source"),b=u(d,y,"target");g&&b&&g!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${v}->${y}`});break}case"annotation.add":{if(f.association){const{source:h,target:v}=f.association;if(h!==f.annotation.id&&v!==f.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:f.annotation.id});else{const y=h===f.annotation.id?v:h;u(d,y,"association")}}f.placement&&u(d,f.placement.anchor,"anchor");break}case"group.add":{for(const h of f.group.members??[]){const v=u(d,h,"member");v&&Fh.has(v)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:v})}break}case"participant.update":{if(p(d,f.id,"participant")===void 0)break;if(f.lanes){const h=t.lanesOf(f.id),v=f.lanes.map(g=>g.id);for(const g of h)v.includes(g)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:f.id,lane:g});for(const g of v)t.categoryOf(g)!==void 0&&!h.includes(g)&&i.push({kind:"id-duplicate",opIndex:d,id:g});const y=v.filter(g=>h.includes(g));y.length===h.length&&y.some((g,b)=>g!==h[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 h=t.participantOf(f.id);(h?o.get(h)??t.lanesOf(h):[]).includes(f.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:f.lane,participant:h??""})}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 h=f.source===void 0||u(d,f.source,"source",["flowNode"])!==void 0,v=f.target===void 0||u(d,f.target,"target",["flowNode"])!==void 0,y=t.endpointsOf(f.id),g=f.source??(y==null?void 0:y.source),b=f.target??(y==null?void 0:y.target);h&&v&&g!==void 0&&b!==void 0&&new Set([c(g),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 h of f.members??[]){const v=u(d,h,"member");v&&Fh.has(v)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:v})}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,m){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:f,id:d});return}const h=t.categoryOf(d);if(h===void 0){i.push({kind:"ref-missing",opIndex:f,ref:d,role:"target"});return}if(m&&h!==m){i.push({kind:"ref-category",opIndex:f,ref:d,role:"target",expected:m,actual:h});return}return h}}function zh(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"),spaceTool:e.get("spaceTool")}}function Ms(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Ts={"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]},sn=10,M1=300,Gh=40,T1=10;function xl(e,t,n,i,r){const o=n,a=(D,L)=>{const[z,ie]=Ts[D];let ge={x:t.x+t.width/2+z*(t.width/2+o.width/2+L),y:t.y+t.height/2+ie*(t.height/2+o.height/2+L)};const Ue=i.x+sn+o.width/2,je=i.x+i.width-sn-o.width/2,K=i.y+sn+o.height/2,pe=i.y+i.height-sn-o.height/2,ce={x:Math.min(je,Math.max(Ue,ge.x)),y:Math.min(pe,Math.max(K,ge.y))};return(ce.x!==ge.x||ce.y!==ge.y)&&(ge=Math.abs(ce.x-(t.x+t.width/2))<(t.width+o.width)/2+sn&&Math.abs(ce.y-(t.y+t.height/2))<(t.height+o.height)/2+sn?{x:t.x+t.width+sn+o.width/2,y:ce.y}:ce),ge},s=(i.children??[]).filter(D=>!("waypoints"in D&&D.waypoints)&&D.type!=="bpmn:Lane"&&D.type!=="label"&&typeof D.x=="number"&&D.id!==r.selfId),c=et(e),u=D=>{var z,ie;if(!r.selfId)return!1;const L=e.get(D);return!!L&&(((z=L.source)==null?void 0:z.id)===r.selfId||((ie=L.target)==null?void 0:ie.id)===r.selfId)},l=c.edges.filter(D=>!u(D.id)).flatMap(xn),p=ho(c).filter(D=>D.owner!==r.selfId).map(D=>D.rect),f=D=>({x0:D.x-o.width/2-sn,x1:D.x+o.width/2+sn,y0:D.y-o.height/2-sn,y1:D.y+o.height/2+sn}),d=D=>{const L=f(D);return s.some(z=>L.x0<z.x+z.width&&L.x1>z.x&&L.y0<z.y+z.height&&L.y1>z.y)},m=D=>{const L=f(D);return l.some(z=>z.axis==="h"?z.at>L.y0&&z.at<L.y1&&z.lo<L.x1&&z.hi>L.x0:z.at>L.x0&&z.at<L.x1&&z.lo<L.y1&&z.hi>L.y0)},h=D=>{const L=f(D);return p.some(z=>L.x0<z.x+z.width&&L.x1>z.x&&L.y0<z.y+z.height&&L.y1>z.y)},v=c.shapes.filter(D=>D.type==="bpmn:Group").flatMap(D=>[{axis:"h",at:D.y,lo:D.x,hi:D.x+D.width},{axis:"h",at:D.y+D.height,lo:D.x,hi:D.x+D.width},{axis:"v",at:D.x,lo:D.y,hi:D.y+D.height},{axis:"v",at:D.x+D.width,lo:D.y,hi:D.y+D.height}]),y=D=>{const L=f(D);return v.some(z=>z.axis==="h"?z.at>L.y0&&z.at<L.y1&&z.lo<L.x1&&z.hi>L.x0:z.at>L.x0&&z.at<L.x1&&z.lo<L.y1&&z.hi>L.y0)},g=D=>d(D)||m(D)||h(D)||y(D),b=D=>D.x-o.width/2>=i.x&&D.x+o.width/2<=i.x+i.width&&D.y-o.height/2>=i.y&&D.y+o.height/2<=i.y+i.height;if(r.placement){const D=je=>je.startsWith("top")?je.replace(/^top/,"bottom"):je.replace(/^bottom/,"top"),L=je=>je.endsWith("left")?je.replace(/left$/,"right"):je.replace(/right$/,"left"),z=r.placement.side,ie=[z,D(z),L(z),D(L(z)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ge=r.placement.offset??50;let Ue=a(z,ge);if(g(Ue)){const je=new Set;for(const K of ie){if(je.has(K))continue;je.add(K);const pe=a(K,ge);if(b(pe)&&!g(pe)){Ue=pe;break}}}return Ue}const x=r.from,C=i.x+sn+o.width/2,M=i.x+i.width-sn-o.width/2,k=i.y+sn+o.height/2,A=i.y+i.height-sn-o.height/2;let B={x:Math.min(M,Math.max(C,x.x)),y:Math.min(A,Math.max(k,x.y))};if(g(B)){const D=(t.width+o.width)/2+sn,z=[{x:B.x+D,y:B.y},{x:B.x-D,y:B.y},{x:B.x,y:B.y-o.height-sn},{x:B.x,y:B.y+o.height+sn}].filter(b).find(ie=>!g(ie));z&&(B=z)}return B}function en(e,t){return e.filter(n=>n.kind===t)}function Vh(e,t){var _0,w0,E0,S0,R0,C0,P0,A0,M0,T0,k0,O0,D0,L0,I0,B0,N0,$0,F0,j0,H0,z0,G0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:u}=t,l=()=>a.getRootElement(),p=_=>o.get(_),f=_=>{const R=p(_);if(!R)throw new Error(`하강 참조 해소 실패: ${_}`);return R},d=_=>{let R=_.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},m=new Map;for(const _ of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))m.set(_.id,{x:_.x,y:_.y});const h=en(e,"participant.add"),v=en(e,"node.add"),y=en(e,"sequenceFlow.add"),g=en(e,"messageFlow.add"),b=en(e,"dataStore.add"),x=en(e,"dataAssociation.add"),C=en(e,"annotation.add"),M=en(e,"group.add"),k=new Map(v.map(_=>[_.node.id,_])),A=(_,R,P)=>{var j;const O=_.businessObject,$=(((j=O.extensionElements)==null?void 0:j.values)??[]).filter(H=>H.$type!==R),I=P?[...$,i.create(R,P)]:$;if(!I.length){O.extensionElements&&n.updateProperties(_,{extensionElements:void 0});return}const N=i.create("bpmn:ExtensionElements",{values:I});I.forEach(H=>{H.$parent=N}),n.updateProperties(_,{extensionElements:N})},B=_=>({anchor:_.anchor,side:_.side,..._.offset!==void 0?{offset:_.offset}:{}});for(const _ of en(e,"element.remove")){const R=p(_.id);R&&n.removeElements([R])}const D=_=>o.filter(R=>{var P;return R.type==="bpmn:Lane"&&((P=d(R))==null?void 0:P.id)===_}).sort((R,P)=>R.y-P.y);for(const _ of en(e,"participant.update")){const R=f(_.id);if(_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),!_.lanes)continue;const P=D(_.id);if(!P.length){n.splitLane(R,_.lanes.length),D(_.id).forEach(($,I)=>{const N=_.lanes[I];N&&n.updateProperties($,{id:N.id,name:N.name})});continue}const O=new Set(P.map($=>$.id));_.lanes.forEach(($,I)=>{if(O.has($.id)){n.updateProperties(f($.id),{name:$.name});return}const N=I===0?n.addLane(D(_.id)[0],"top"):n.addLane(f(_.lanes[I-1].id),"bottom");n.updateProperties(N,{id:$.id,name:$.name})})}const L=150,z=130,ie=80,ge=90,Ue=180,je=30,K=30,pe=(_,R,P,O,$)=>{const I=P-R.width/2,N=O-R.height/2;return(_.children??[]).find(j=>!("waypoints"in j&&j.waypoints)&&j.type!=="bpmn:Lane"&&j.type!=="label"&&!($!=null&&$.has(j.id))&&typeof j.x=="number"&&I<j.x+j.width+K&&I+R.width+K>j.x&&N<j.y+j.height&&N+R.height>j.y)},ce=new Set;for(const _ of h){ce.add(`pool:${_.participant.id}`);for(const R of _.participant.lanes??[])ce.add(R.id)}const ye=new Map;for(const _ of v){const R=_.node.lane??`pool:${_.node.participant??""}`;let P=ye.get(R);P||ye.set(R,P=new Set([0])),_.band!==void 0&&P.add(_.band)}const Me=new Map;for(const[_,R]of ye){if(!ce.has(_))continue;const P=[...R].sort((I,N)=>I-N),O=P.map((I,N)=>N===0?0:N%2===1?Math.ceil(N/2):-(N/2)),$=Math.min(...O);Me.set(_,new Map(P.map((I,N)=>[I,O[N]-$])))}{const _=new Map;for(const R of h)(R.participant.lanes??[]).forEach((P,O)=>_.set(P.id,O));for(const[R,P]of Me){if(!_.has(R)||P.size<2)continue;const O=_.get(R),$=P.get(0)??0,I=new Set;for(const Q of v){if(Q.node.lane!==R||(Q.band??0)!==0||!Q.node.type.endsWith("Gateway"))continue;const Ce={in:new Set,out:new Set,cross:new Set};for(const xe of y){const Re=xe.flow.source===Q.node.id;if(!Re&&xe.flow.target!==Q.node.id)continue;const ut=k.get(Re?xe.flow.target:xe.flow.source);if(!ut||ut.node.participant!==Q.node.participant||!ut.node.lane)continue;let se,me=!1;if(ut.node.lane!==R){const Pe=_.get(ut.node.lane);if(Pe===void 0)continue;se=Pe>O?"down":"up",me=!0}else{const Pe=P.get(ut.band??0)??$;se=Pe>$?"down":Pe<$?"up":void 0}se&&(Ce[Re?"out":"in"].add(se),me&&Ce.cross.add(se))}for(const xe of["up","down"])Ce.in.has(xe)&&Ce.out.has(xe)&&Ce.cross.has(xe)&&I.add(xe)}if(I.size!==1)continue;const[N]=I,j=Math.max(...P.values()),H=N==="down"?j:0;if($===H)continue;const q=[...P.entries()].filter(([Q])=>Q!==0).sort((Q,Ce)=>Q[1]-Ce[1]),ue=[...Array(j+1).keys()].filter(Q=>Q!==H),be=new Map([[0,H]]);q.forEach(([Q],Ce)=>be.set(Q,ue[Ce])),Me.set(R,be)}}const W=_=>{var R;return(((R=ye.get(_))==null?void 0:R.size)??0)>1},Y=_=>_.band??(_.node.lane||!W(`pool:${_.node.participant??""}`)?void 0:0),te=new Map,Ae=_=>te.get(_.node.id)??Y(_),gt=new Set,T=new Set;{const _=new Map;for(const O of y)_.set(O.flow.target,(_.get(O.flow.target)??0)+1);const R=O=>{const $=[],I=new Set([O]),N=[O];for(;N.length;){const j=N.shift();$.push(j);for(const H of y)H.flow.source!==j||I.has(H.flow.target)||(_.get(H.flow.target)??0)!==1||(I.add(H.flow.target),N.push(H.flow.target))}return $},P=(O,$)=>{var I;return((I=Me.get(O))==null?void 0:I.get($))??$};for(const O of v){if(!O.node.type.endsWith("Gateway"))continue;const $=O.node.lane??`pool:${O.node.participant??""}`,I=Me.get($);if(!I||I.size<2)continue;const N=Ae(O);if(N===void 0||P($,N)!==P($,0))continue;const j=P($,N),H=y.filter(xe=>xe.flow.source===O.node.id).map(xe=>k.get(xe.flow.target)).filter(xe=>!!xe&&(xe.node.lane??`pool:${xe.node.participant??""}`)===$),q=H.filter(xe=>{const Re=Ae(xe);return Re!==void 0&&P($,Re)===j&&(_.get(xe.node.id)??0)===1}),ue=H.some(xe=>{const Re=Ae(xe);return Re!==void 0&&P($,Re)>j});if(q.length!==1||!ue)continue;const be=new Set(H.flatMap(xe=>R(xe.node.id)));if(!y.some(xe=>xe.flow.target===O.node.id&&be.has(xe.flow.source)))continue;const Ce=new Map;for(const[xe,Re]of I)Ce.set(xe,Re+1);Ce.set(-1,0),Me.set($,Ce);for(const xe of R(q[0].node.id))k.has(xe)&&(te.set(xe,-1),T.add(xe));gt.add(O.node.id)}}const E=(_,R)=>{var P;return((P=Me.get(_))==null?void 0:P.get(R))??R},w=(_,R,P,O)=>{const $=_?p(_):R?p(R):void 0;if(!$)return!1;const I=_?$.y+Math.min($.height/2,ge):$.y+ie;return Math.abs(I+E(_??`pool:${R??""}`,P)*L-O)<=L/2},G=new Map;for(const[_,R]of ye){let P=0;for(const O of R)P=Math.max(P,E(_,O));G.set(_,P)}const U=_=>Ue+L*_,X=(_,R,P)=>{const O=l().children.filter($=>!("waypoints"in $&&$.waypoints)&&$.id!==R&&typeof $.y=="number"&&$.y>=_);O.length&&n.moveElements(O,{x:0,y:P})},Ee=(_,R,P)=>{const O=_.type==="bpmn:Participant"?_:void 0;if(!O||O.children.some(j=>j.type==="bpmn:Lane"))return;const $=P+R.height/2+je-O.y;if(O.height>=$)return;const I=$-O.height,N=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:$}),X(N,O.id,I)},He=(_,R)=>{const P=R-_.height;if(P<=0)return;const O=d(_)??_,$=[],I=H=>{$.push(H);for(const q of H.children??[])I(q)};I(O);const N=_.y+_.height-10,j=u.calculateAdjustments($,"y",P,N);u.makeSpace(j.movingShapes,j.resizingShapes,{x:0,y:P},"s",N)},it=(_,R,P)=>{if(_){const N=f(_),j=U(R);if(N.height>=j)return;const H=j-N.height,q=d(N),ue=q?q.y+q.height:N.y+N.height;He(N,j),X(ue,q==null?void 0:q.id,H);return}if(!P)return;const O=L*(R+1);if(P.height>=O)return;const $=O-P.height,I=P.y+P.height;n.resizeShape(P,{x:P.x,y:P.y,width:P.width,height:O}),X(I,P.id,$)},At=new Map;for(const _ of y)At.set(_.flow.target,(At.get(_.flow.target)??0)+1);const lt=_=>(At.get(_)??0)<=1,Vt=(_,R,P)=>{if(!_)return!0;const O=p(_);return O?P-R.height/2>=O.y&&P+R.height/2<=O.y+O.height:!0},nn=h.map((_,R)=>({op:_,declared:R}));nn.sort((_,R)=>{const P=_.op.order??Number.POSITIVE_INFINITY,O=R.op.order??Number.POSITIVE_INFINITY;return P!==O?P-O:_.declared-R.declared});let rn=80;for(const _ of o.getAll())_.parent===l()&&"height"in _&&typeof _.y=="number"&&(rn=Math.max(rn,_.y+_.height+60));for(const{op:_}of nn){const R=_.participant,P=v.filter(Q=>Q.node.participant===R.id).length,O=((_0=R.lanes)==null?void 0:_0.length)??0,$=Math.max(1200,P*160+300),I=(R.lanes??[]).map(Q=>U(G.get(Q.id)??0)),N=I.reduce((Q,Ce)=>Q+Ce,0);O&&N<300&&(I[O-1]+=300-N);const j=Math.max(300,L*((G.get(`pool:${R.id}`)??0)+1)),H=R.blackBox||P+O===0?120:O?Math.max(300,N):j,q=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,..._.order!==void 0?{"bwl:poolOrder":_.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:$,height:H,isExpanded:!0}),ue=n.createShape(q,{x:100+$/2,y:rn+H/2},l()),be=R.lanes??[];if(be.length&&n.splitLane(ue,be.length),be.length){const Q=o.filter(Ce=>{var xe;return Ce.type==="bpmn:Lane"&&((xe=d(Ce))==null?void 0:xe.id)===R.id}).sort((Ce,xe)=>Ce.y-xe.y);if(Q.forEach((Ce,xe)=>{const Re=be[xe];Re&&n.updateProperties(Ce,{id:Re.id,name:Re.name})}),I.some(Ce=>Ce!==ue.height/O)){let Ce=ue.y;Q.forEach((xe,Re)=>{const ut=I[Re];n.resizeShape(xe,{x:xe.x,y:Ce,width:xe.width,height:ut}),Ce+=ut})}}rn=ue.y+ue.height+60}const vt=_=>{var O;const R=k.get(_);if(R)return R.node.participant??"";const P=p(_);return P?P.type==="bpmn:Participant"?P.id:((O=d(P))==null?void 0:O.id)??"":""},Mt=new Map,vn=_=>{let R=Mt.get(_);return R||Mt.set(_,R={nodes:[],flows:[]}),R};for(const _ of v)vn(_.node.participant??"").nodes.push(_);for(const _ of y)vn(vt(_.flow.source)).flows.push(_);const Ar=_=>{var R;return i.create("bpmn:SequenceFlow",{id:_.id,name:_.name??((R=_.condition)==null?void 0:R.label)})},jn=(_,R)=>r.createShape({type:Ms(_.type),businessObject:i.create(Ms(_.type),{id:_.id,name:_.name,...R!==void 0?{"bwl:band":R}:{}})}),Ti=[...nn.map(({op:_})=>_.participant.id).filter(_=>Mt.has(_)),...[...Mt.keys()].filter(_=>!h.some(R=>R.participant.id===_))],Hn=_=>_.endsWith("Gateway");for(const _ of Ti){const R=Mt.get(_),P=_?f(_):void 0,O=P?P.x+150:250;let $=P?P.y+80:120;const I=(se,me,Pe)=>{if(se){const ke=f(se);return ke.y+Math.min(ke.height/2,ge)+E(se,me??0)*L}return me!==void 0&&P?P.y+ie+E(`pool:${_}`,me)*L:Pe},N=(se,me,Pe)=>{if(se){const ke=f(se);return ke.y+Math.min(ke.height/2,ge)+me*L}return P?P.y+ie+me*L:Pe},j=se=>se.participant?f(se.participant):l(),H=(se,me,Pe,ke,ct,rt,st)=>{const ze=Pe!==void 0||ke!==void 0,le=E(Pe??`pool:${_}`,ke??0);if((ke===void 0||w(Pe,_,ke,st??Number.NaN))&&st!==void 0&&Vt(Pe,me,st)&&!pe(se,me,ct,st))return{x:ct,y:st};if(ze)for(let Z=0;Z<4;Z++){const fe=N(Pe,le+Z,rt);if(!pe(se,me,ct,fe))return it(Pe,le+Z,P),{x:ct,y:fe}}const Ke=I(Pe,ke,rt);ze?it(Pe,le,P):Ee(se,me,Ke);let re=ct;for(let Z=0;Z<64;Z++){const fe=pe(se,me,re,Ke);if(!fe)break;re=fe.x+fe.width+z+me.width/2}return{x:re,y:Ke}},q=new Set(R.flows.map(se=>se.flow.target)),ue=new Map;for(const se of R.nodes){if(q.has(se.node.id))continue;const me=jn(se.node,se.band),Pe=Y(se),ke=se.node.lane?`${se.node.lane}|${Pe??""}`:Pe!==void 0?`band:${Pe}`:"",ct=j(se.node),rt=H(ct,me,se.node.lane,Pe,ue.get(ke)??O,$);n.createShape(me,rt,ct),ue.set(ke,rt.x+me.width+z),!se.node.lane&&Pe===void 0&&($+=160)}const be=new Set,Q=new Map,Ce=new Map,xe=new Map;if(_&&ce.has(`pool:${_}`)){const se=new Map;for(const le of R.flows)se.set(le.flow.target,(se.get(le.flow.target)??0)+1);const me=le=>I(le.node.lane,Ae(le),Number.NaN),Pe=new Set,ke=le=>{var Z;const Ke=(Z=k.get(le))==null?void 0:Z.node.participant;if(Ke)return p(Ke);const re=p(le);if(re)return re.type==="bpmn:Participant"?re:d(re)},ct=le=>{const Ke=[],re=new Set([le]),Z=[le];for(;Z.length;){const fe=Z.shift(),de=k.get(fe);de&&Ke.push(de);for(const oe of R.flows)oe.flow.source!==fe||re.has(oe.flow.target)||(se.get(oe.flow.target)??0)!==1||(re.add(oe.flow.target),Z.push(oe.flow.target))}return Ke},rt=le=>{if(!P)return;const Ke=new Set(le.map(fe=>fe.node.id));let re=!1,Z=!1;for(const fe of g){if(!Ke.has(fe.flow.source))continue;const de=ke(fe.flow.target);!de||de.id===P.id||(de.y<P.y?re=!0:Z=!0)}return re&&!Z?"up":Z&&!re?"down":void 0};for(const le of R.nodes){if(!Hn(le.node.type))continue;const Ke=I(le.node.lane,Y(le),Number.NaN);if(Number.isNaN(Ke))continue;const re=[];for(const oe of R.flows){if(oe.flow.source!==le.node.id)continue;const Se=k.get(oe.flow.target);if(!Se||Se.node.lane!==le.node.lane||(se.get(Se.node.id)??0)!==1)continue;const he=Y(Se);if(he===void 0)continue;const Ve=I(Se.node.lane,he,Number.NaN);if(Number.isNaN(Ve))continue;const Tt=ct(Se.node.id),Je=rt(Tt);Je&&re.push({subtree:Tt,band:he,row:Ve,dir:Je})}if(!re.some(oe=>oe.dir==="up")||!re.some(oe=>oe.dir==="down")||!re.some(oe=>oe.dir==="up"&&re.some(Se=>Se.dir==="down"&&Se.row<oe.row)))continue;const fe=[...re].sort((oe,Se)=>oe.row-Se.row);[...re.filter(oe=>oe.dir==="up"),...re.filter(oe=>oe.dir==="down")].sort((oe,Se)=>oe.dir===Se.dir?oe.row-Se.row:oe.dir==="up"?-1:1).forEach((oe,Se)=>{const he=fe[Se].band;if(he!==oe.band){Pe.add(le.node.id);for(const Ve of oe.subtree)Y(Ve)===oe.band&&te.set(Ve.node.id,he)}})}const st=le=>{if(!P)return;const Ke=new Set(le.map(fe=>fe.node.id));let re=!1,Z=!1;for(const fe of g){if(!Ke.has(fe.flow.target))continue;const de=ke(fe.flow.source);!de||de.id===P.id||(de.y<P.y?re=!0:Z=!0)}return re&&!Z?"up":Z&&!re?"down":void 0};for(const le of R.nodes){if(!Hn(le.node.type))continue;const Ke=le.node.lane??`pool:${_}`,re=Me.get(Ke);if(!re||re.size<2)continue;const Z=re.get(0);if(Z===void 0)continue;const fe=Math.max(...re.values()),de=Z===fe&&Z!==0?"down":void 0;if(!de)continue;const oe=[];for(const Je of R.flows){if(Je.flow.source!==le.node.id)continue;const ot=k.get(Je.flow.target);if(!ot||ot.node.lane!==le.node.lane||(se.get(ot.node.id)??0)!==1)continue;const Ut=Ae(ot);Ut!==void 0&&oe.push({t:ot,subtree:ct(ot.node.id),band:Ut})}const Se=oe.find(Je=>(re.get(Je.band)??Je.band)===Z);if(!Se||st(Se.subtree)===de||rt(Se.subtree)===de)continue;const he=oe.find(Je=>Je!==Se&&st(Je.subtree)===de);if(!he)continue;const Ve=Se.band,Tt=he.band;for(const Je of Se.subtree)Ae(Je)===Ve&&te.set(Je.node.id,Tt);for(const Je of he.subtree)Ae(Je)===Tt&&te.set(Je.node.id,Ve);Pe.add(le.node.id)}for(const le of R.nodes){if(!Hn(le.node.type))continue;const Ke=me(le);if(Number.isNaN(Ke)||C.some(oe=>{var Se,he;return(((Se=oe.placement)==null?void 0:Se.anchor)??(oe.association?oe.association.source===oe.annotation.id?oe.association.target:oe.association.source:void 0))===le.node.id&&((he=oe.placement)==null?void 0:he.side.startsWith("bottom"))}))continue;let Z,fe=!1,de;for(const oe of R.flows){if(oe.flow.source!==le.node.id)continue;const Se=k.get(oe.flow.target);if(!Se||!Se.node.lane&&Y(Se)===void 0)continue;const he=me(Se);Number.isNaN(he)||(Math.abs(he-Ke)<.5&&(fe=!0),he>Ke?!Z||he>Z.row?Z={id:Se.node.id,row:he,count:1}:he===Z.row&&Z.count++:he<Ke&&Se.node.lane===le.node.lane&&(!de||he>de.row?de={op:Se,row:he,count:1}:he===de.row&&de.count++))}Z&&Z.count===1&&(se.get(Z.id)??0)===1&&!Pe.has(le.node.id)&&be.add(Z.id),!fe&&de&&de.count===1&&(se.get(de.op.node.id)??0)===1&&!gt.has(le.node.id)&&Q.set(de.op.node.id,{lane:le.node.lane,band:Ae(le)})}const ze=new Map;for(const le of g)ze.set(le.flow.target,[...ze.get(le.flow.target)??[],le]);for(const le of R.nodes){const Ke=ze.get(le.node.id);if(!Ke||Ke.length!==1||!se.get(le.node.id)||!le.node.lane&&Y(le)===void 0||T.has(le.node.id))continue;const re=(w0=k.get(Ke[0].flow.source))==null?void 0:w0.node.participant,Z=re?p(re):void 0;if(!Z||!P||Z.id===P.id)continue;const fe=le.node.lane??`pool:${_}`,de=Me.get(fe);if(!de)continue;const oe=de.get(0)??0,Se=(de.get(Ae(le)??0)??oe)-oe;if(Se===0)continue;const he=Z.y<P.y;if(he&&Se<0||!he&&Se>0)continue;let Ve;for(const[Tt,Je]of de){const ot=Je-oe;(he&&ot<0&&(!Ve||ot<Ve.row)||!he&&ot>0&&(!Ve||ot>Ve.row))&&(Ve={band:Tt,row:ot})}Ve&&Ce.set(le.node.id,{lane:le.node.lane,band:Ve.band})}}const Re=new Set;let ut=0;for(;ut++<R.nodes.length+2;){for(let Pe=0;Pe<R.nodes.length+R.flows.length+2;Pe++){let ke=!1;for(const ct of R.flows){const rt=ct.flow;if(Re.has(rt.id))continue;const st=p(rt.source);if(!st)continue;const ze=p(rt.target),le=k.get(rt.target);if(!ze&&le){const Ke=jn(le.node,le.band),re=Ae(le);if(le.node.lane||re!==void 0){const Z=j(le.node),fe=st,de=fe.x+(xe.get(rt.source)??0)+fe.width+z,oe=Q.get(rt.target)??Ce.get(rt.target),Se=H(Z,Ke,oe?oe.lane:le.node.lane,oe?oe.band:re,be.has(rt.target)?fe.x+fe.width/2:de,Number.NaN,oe||!lt(rt.target)?void 0:fe.y+fe.height/2),he=n.createShape(Ke,Se,Z);be.has(rt.target)&&xe.set(rt.target,de-(he.x+he.width/2)),n.connect(st,he,{type:"bpmn:SequenceFlow",businessObject:Ar(rt)})}else s.append(st,Ke,{connection:{type:"bpmn:SequenceFlow",businessObject:Ar(rt)}})}else if(ze)n.connect(st,ze,{type:"bpmn:SequenceFlow",businessObject:Ar(rt)});else continue;Re.add(rt.id),ke=!0}if(!ke)break}const se=R.nodes.filter(Pe=>!p(Pe.node.id));if(!se.length)break;const me=se[0];{const Pe=jn(me.node,me.band),ke=j(me.node),ct=Y(me);n.createShape(Pe,H(ke,Pe,me.node.lane,ct,O,$),ke),!me.node.lane&&ct===void 0&&($+=160)}}}const It=40,Kn=(_,R=()=>!0)=>{const P=p(_);if(!P)return[];const O=[P],$=new Set([_]);for(let I=0;I<O.length;I++){const N=O[I].id;for(const j of y){const H=j.flow.target;if(j.flow.source!==N||$.has(H)||!k.has(H))continue;$.add(H);const q=p(H);q&&R(q)&&O.push(q)}}return O},Iu=(_,R=()=>!0)=>{const P=p(_);if(!P)return[];const O=[P],$=new Set([_]);for(let I=0;I<O.length;I++){const N=O[I].id;for(const j of y){const H=j.flow.source;if(j.flow.target!==N||$.has(H)||!k.has(H))continue;$.add(H);const q=p(H);q&&R(q)&&O.push(q)}}return O},Wt=30,Ze=_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number",at=(_,R)=>{const P=new Set(_.flatMap(N=>N.subtree.map(j=>j.id)));for(const N of _){const j=(N.pool.children??[]).filter(Ze).filter(q=>!P.has(q.id));if(N.subtree.some(q=>j.some(ue=>q.x+R<ue.x+ue.width+Wt&&q.x+R+q.width+Wt>ue.x&&q.y<ue.y+ue.height&&q.y+q.height>ue.y)))return null}const O=_.map(N=>N.pool.width),$=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));n.moveElements(_.flatMap(N=>N.subtree),{x:R,y:0});const I=_.map(N=>{const H=Math.max(...N.subtree.map(q=>q.x+q.width))+150-(N.pool.x+N.pool.width);return H>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:N.pool.width+H,height:N.pool.height}),H});return()=>{n.moveElements(_.flatMap(N=>N.subtree),{x:-R,y:0}),_.forEach((N,j)=>{I[j]>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:O[j],height:N.pool.height})});for(let N=0;N<3;N++){let j=0;for(const H of $){const q=H.x-H.label.x,ue=H.y-H.label.y;Math.abs(q)<=.5&&Math.abs(ue)<=.5||(n.moveElements([H.label],{x:q,y:ue}),j++)}if(!j)break}}},e0=_=>{var $,I;const R=new Map,P=new Map;for(const N of o.getAll()){if(N.type!=="bpmn:Participant")continue;const j=N;(j.children??[]).length||(R.set(j.id,j),P.set(j.id,[]))}for(const N of o.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const j=N,H=($=j.source)==null?void 0:$.id,q=(I=j.target)==null?void 0:I.id;H&&q&&P.has(H)&&P.get(H).push(q),H&&q&&P.has(q)&&P.get(q).push(H)}const O=[];for(const[N,j]of P)j.length&&j.every(H=>_.has(H))&&O.push(R.get(N));return O},t0=(_,R)=>{if(!_.length)return null;const P=new Set(_.map(N=>N.id)),O=o.getAll().filter(N=>N.type==="bpmn:Participant"&&!P.has(N.id));if(_.some(N=>O.some(j=>N.x+R<j.x+j.width+Wt&&N.x+R+N.width+Wt>j.x&&N.y<j.y+j.height&&N.y+N.height>j.y)))return null;const I=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));return n.moveElements(_,{x:R,y:0}),()=>{n.moveElements(_,{x:-R,y:0});for(let N=0;N<3;N++){let j=0;for(const H of I){const q=H.x-H.label.x,ue=H.y-H.label.y;Math.abs(q)<=.5&&Math.abs(ue)<=.5||(n.moveElements([H.label],{x:q,y:ue}),j++)}if(!j)break}}},n0=()=>{let _=0;for(const R of o.getAll()){if(R.type!=="bpmn:DataInputAssociation"&&R.type!=="bpmn:DataOutputAssociation")continue;const P=R.waypoints??[];for(let O=1;O<P.length;O++)_+=Math.hypot(P[O].x-P[O-1].x,P[O].y-P[O-1].y)}return _},i0=()=>{let _=0;for(const R of o.getAll()){if(R.type!=="bpmn:Association")continue;const P=R.waypoints??[];for(let O=1;O<P.length;O++)_+=Math.hypot(P[O].x-P[O-1].x,P[O].y-P[O-1].y)}return _},_L=_=>{const R=[];for(const P of o.getAll()){if(P.type!=="bpmn:TextAnnotation")continue;const O=P;if(_.has(O.id))continue;const I=[...O.incoming??[],...O.outgoing??[]].filter(H=>H.type==="bpmn:Association").map(H=>H.source===O?H.target:H.source);if(!I.length||I.some(H=>H===void 0))continue;const N=H=>{if(!("waypoints"in H&&H.waypoints))return[H.id];const q=H,ue=[q.source,q.target];return ue.some(be=>!be)?[]:ue.map(be=>be.id)},j=I.flatMap(H=>N(H));j.length&&j.every(H=>_.has(H))&&R.push(O)}return R},r0=()=>kt(et(o)).filter(_=>_.kind==="edge-crosses-shape").length,o0=_=>{const R=(_.children??[]).filter(Ze);let P=0;for(let O=0;O<R.length;O++)for(let $=O+1;$<R.length;$++){const I=R[O],N=R[$];I.x<N.x+N.width&&I.x+I.width>N.x&&I.y<N.y+N.height&&I.y+I.height>N.y&&P++}return P},Ko=()=>{const _=et(o),R=P=>P.length>=2&&(P.every(O=>Math.abs(O.x-P[0].x)<.01)||P.every(O=>Math.abs(O.y-P[0].y)<.01));return{messages:_.edges.filter(P=>P.type==="bpmn:MessageFlow"&&P.waypoints.length===2).length,lines:_.edges.filter(P=>R(P.waypoints)).length}},wL=_=>{const R=new Map;for(const O of o.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const $=O;if(!$.waypoints||$.waypoints.length!==2)continue;const I=$.source,N=$.target;if(!I||!N)continue;const j=_.has(I.id);if(j===_.has(N.id))continue;const H=j?N:I,q=d(H);if(!q||_.has(H.id))continue;const ue=R.get(q.id);ue?H.x<ue.minX&&(ue.minX=H.x):R.set(q.id,{pool:q,minX:H.x})}const P=[];for(const{pool:O,minX:$}of R.values()){const I=(O.children??[]).filter(N=>Ze(N)&&!_.has(N.id)&&N.x>=$);I.length&&P.push({subtree:I,pool:O})}return P};for(const _ of en(e,"sequenceFlow.update")){if(_.target===void 0)continue;const R=k.get(_.target);if(!R)continue;const P=p(_.target),O=p(_.id);if(!P||!O)continue;const $=_.source!==void 0?p(_.source):O.source,I=O.target;if(!$||!I||I.id===P.id)continue;const N=Kn(_.target),j=new Set(N.map(ze=>ze.id)),H=Math.min(...N.map(ze=>ze.x)),q=Math.max(...N.map(ze=>ze.x+ze.width)),ue=$.x+$.width,be=q-H+It*2-(I.x-ue);let Q=[];if(be>0){const ze=d(P),le=(ze==null?void 0:ze.children)??[],Ke=de=>de.type==="bpmn:Lane";Q=(()=>{const de=new Set;for(const Se of le)Ze(Se)&&!j.has(Se.id)&&Se.id!==$.id&&Se.x>=I.x&&de.add(Se.id);const oe=[];for(const Se of le){if(Se.type!=="bpmn:DataStoreReference"&&Se.type!=="bpmn:DataObjectReference")continue;const he=Se,Tt=[...he.incoming??[],...he.outgoing??[]].filter(Je=>Je.type==="bpmn:DataInputAssociation"||Je.type==="bpmn:DataOutputAssociation").map(Je=>Je.source===he?Je.target:Je.source);Tt.length&&Tt.every(Je=>Je!==void 0&&de.has(Je.id))&&oe.push(he)}return oe})();const Z=le.filter(de=>!("waypoints"in de&&de.waypoints)&&!Ke(de)&&!j.has(de.id)&&de.id!==$.id&&de.x>=I.x),fe=ze?[ze,...le.filter(de=>Ke(de))]:[];if(Z.length){const de=new Set(Z.map(Ut=>Ut.id)),oe=wL(de),Se=new Set(de);for(const Ut of oe)for(const Pn of Ut.subtree)Se.add(Pn.id);const he=_L(Se),Ve=e0(de),Tt=new Set(de);for(const Ut of oe)for(const Pn of Ut.subtree)Tt.add(Pn.id);const Je=oe.length?e0(Tt):Ve;n.createSpace(Z,fe,{x:be,y:0},"e",I.x-1);let ot=!1;if(oe.length){const Ut=Ko(),Pn=at(oe,be);if(Pn){const En=Je.length?t0(Je,be):null,to=Ko();to.messages>Ut.messages&&to.lines>=Ut.lines?ot=!0:(En==null||En(),Pn())}}if(!ot){for(const Ut of oe){const Pn=Ko(),En=at([Ut],be);if(!En)continue;const to=Ko();(to.messages<=Pn.messages||to.lines<Pn.lines)&&En()}if(Ve.length){const Ut=Ko(),Pn=t0(Ve,be);if(Pn){const En=Ko();(En.messages<=Ut.messages||En.lines<Ut.lines)&&Pn()}}}if(he.length){const Ut=()=>new Set(kt(et(o)).map(En=>Et(En))),Pn=En=>{const to=i0(),BL=Ut(),NL=En.map(Bt=>({a:Bt,x:Bt.x,y:Bt.y})),$L=o.filter(Bt=>Bt.type==="label").map(Bt=>({label:Bt,x:Bt.x,y:Bt.y}));n.moveElements(En,{x:be,y:0});const FL=[...Ut()].filter(Bt=>!BL.has(Bt));if(i0()<to&&FL.length===0)return!0;for(const{a:Bt,x:ss,y:cs}of NL)(Bt.x!==ss||Bt.y!==cs)&&n.moveElements([Bt],{x:ss-Bt.x,y:cs-Bt.y});for(const Bt of $L){const ss=Bt.x-Bt.label.x,cs=Bt.y-Bt.label.y;(ss!==0||cs!==0)&&n.moveElements([Bt.label],{x:ss,y:cs})}return!1};if(!Pn(he)&&he.length>1)for(const En of he)Pn([En])}}}const Ce=R.node.lane!==void 0?p(R.node.lane):R.node.participant!==void 0?p(R.node.participant):void 0,xe=ze=>{if(!Ce)return!0;const le=ze.y+ze.height/2;return le>=Ce.y&&le<=Ce.y+Ce.height},Re=!xe($)&&xe(I)?I:$,ut=Re.y+Re.height/2,se=ut-(P.y+P.height/2),me=R.band!==void 0,Pe=me?[P]:N,ke=(R.band===void 0||w(R.node.lane,R.node.participant,R.band,ut))&<(_.target)&&Pe.every(ze=>{var le;return Vt((le=k.get(ze.id))==null?void 0:le.node.lane,ze,ze.y+ze.height/2+se)}),ct=ze=>Math.abs(ze.y+ze.height/2-(P.y+P.height/2))<=L/2;if(ke&&me){const ze=Math.abs(se)<=L/2?N.filter(le=>le.id!==P.id&&ct(le)):[];if(n.moveElements(N,{x:ue+It-H,y:0}),n.moveElements([P],{x:0,y:se}),ze.length){const le=()=>new Set(kt(et(o)).map(oe=>Et(oe))),Ke=le(),re=o.filter(oe=>oe.type==="label").map(oe=>({label:oe,x:oe.x,y:oe.y}));n.moveElements(ze,{x:0,y:se});const Z=le(),fe=[...Z].filter(oe=>!Ke.has(oe)).length,de=[...Ke].filter(oe=>!Z.has(oe)).length;if(fe>de){n.moveElements(ze,{x:0,y:-se});for(const oe of re){const Se=oe.x-oe.label.x,he=oe.y-oe.label.y;(Se!==0||he!==0)&&n.moveElements([oe.label],{x:Se,y:he})}}}}else n.moveElements(N,{x:ue+It-H,y:ke?se:0});const rt=d(P);if(!ke&&R.node.lane===void 0&&R.band!==void 0&&rt){const ze=rt.y+ie+E(`pool:${R.node.participant??""}`,R.band)*L,le=ze-(P.y+P.height/2);le!==0&&!pe(rt,P,P.x+P.width/2,ze,j)&&n.moveElements([P],{x:0,y:le})}const st=Q.length?d(Q[0]):void 0;if(st){const ze={assoc:n0(),overlaps:o0(st),crosses:r0()},le=Q.map(he=>({st:he,x:he.x})),Ke=o.filter(he=>he.type==="label").map(he=>({label:he,x:he.x,y:he.y})),re=Math.min(...Q.flatMap(he=>[...he.incoming??[],...he.outgoing??[]].filter(Ve=>Ve.type==="bpmn:DataInputAssociation"||Ve.type==="bpmn:DataOutputAssociation").map(Ve=>(Ve.source===he?Ve.target:Ve.source).x))),Z=new Set(Q.map(he=>he.id)),fe=(st.children??[]).filter(Ze).filter(he=>!Z.has(he.id));let de=re;for(const he of[...Q].sort((Ve,Tt)=>Ve.x-Tt.x)){let Ve=de;for(let Tt=0;Tt<100;Tt++){const Je=fe.find(ot=>Ve<ot.x+ot.width+Wt&&Ve+he.width+Wt>ot.x&&he.y<ot.y+ot.height&&he.y+he.height>ot.y);if(!Je)break;Ve=Je.x+Je.width+Wt}Ve!==he.x&&n.moveElements([he],{x:Ve-he.x,y:0}),de=Ve+he.width+Wt}const oe=de+150-(st.x+st.width);oe>0&&n.resizeShape(st,{x:st.x,y:st.y,width:st.width+oe,height:st.height});const Se={assoc:n0(),overlaps:o0(st),crosses:r0()};if(Se.assoc>=ze.assoc||Se.overlaps>ze.overlaps||Se.crosses>ze.crosses){for(const{st:he,x:Ve}of le)he.x!==Ve&&n.moveElements([he],{x:Ve-he.x,y:0});oe>0&&n.resizeShape(st,{x:st.x,y:st.y,width:st.width-oe,height:st.height});for(const he of Ke){const Ve=he.x-he.label.x,Tt=he.y-he.label.y;(Ve!==0||Tt!==0)&&n.moveElements([he.label],{x:Ve,y:Tt})}}}}const a0=(_,R)=>{const P=R.target===_,O=f(R.source),$=f(R.target),I=P?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,$,R.id?{type:I,businessObject:i.create(I,{id:R.id})}:{type:I})},EL=100,s0=_=>{for(const R of h){if(!R.participant.blackBox)continue;const P=p(R.participant.id);if(!P)continue;const O=[];for(const I of g){const N=I.flow.source===R.participant.id?I.flow.target:I.flow.target===R.participant.id?I.flow.source:void 0,j=N?p(N):void 0;j&&typeof j.x=="number"&&j.type!=="bpmn:Participant"&&O.push(j)}if(!O.length)continue;if(!_&&R.order===void 0){const I=(()=>{var j;const N=new Map;for(const H of O){const q=d(H);if(!q)continue;const ue=N.get(q.id);ue?ue.n+=1:N.set(q.id,{shape:q,n:1})}return(j=[...N.values()].sort((H,q)=>q.n-H.n)[0])==null?void 0:j.shape})();if(I){const N=q=>q.reduce((ue,be)=>ue+be,0)/q.length,j=N(O.map(q=>q.y+q.height/2))<I.y+I.height/2,H=o.filter(q=>q.type==="bpmn:Participant"&&q.id!==R.participant.id&&q.id!==I.id).filter(q=>j?q.y+q.height<=I.y+5:q.y>=I.y+I.height-5);if(H.length){const q=[...H.reduce((Q,Ce)=>Q.set(Ce.y,(Q.get(Ce.y)??0)+1),new Map)].sort((Q,Ce)=>Ce[1]-Q[1]||(j?Ce[0]-Q[0]:Q[0]-Ce[0]))[0][0],ue=Math.min(P.width,M1),be=Math.round(N(O.map(Q=>Q.x+Q.width/2))-ue/2);if(be!==P.x||q!==P.y||ue!==P.width){const Q=()=>new Set(kt(et(o)).map(me=>Et(me))),Ce=Q(),xe={x:P.x,y:P.y,width:P.width,height:P.height};n.resizeShape(P,{x:be,y:q,width:ue,height:P.height});const Re=Q(),ut=[...Re].filter(me=>!Ce.has(me)).length,se=[...Ce].filter(me=>!Re.has(me)).length;ut>se&&n.resizeShape(P,xe)}}}}const $=Math.max(...O.map(I=>I.x+I.width/2))+EL;if($>P.x+P.width&&n.resizeShape(P,{x:P.x,y:P.y,width:$-P.x,height:P.height}),!!_)for(const I of g){const N=p(I.flow.id),j=I.flow.source===R.participant.id?I.flow.target:I.flow.target===R.participant.id?I.flow.source:void 0,H=j?p(j):void 0;if(!N||!H||H.type==="bpmn:Participant")continue;const q=H.x+H.width/2;if(q<P.x+10||q>P.x+P.width-10)continue;const ue=P.y>H.y,be=ue?H.y+H.height:H.y,Q=ue?P.y:P.y+P.height,Ce=I.flow.source===R.participant.id?[{x:q,y:Q},{x:q,y:be}]:[{x:q,y:be},{x:q,y:Q}],xe=et(o),Re={...xe.edges.find(ut=>ut.id===I.flow.id),waypoints:Ce};an(Re,Wn(xe)).length||n.updateWaypoints(N,Ce)}}};s0(!1);for(const _ of g){const R=_.flow;n.connect(f(R.source),f(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const P=new Set([...y.map(H=>H.flow.id),...g.map(H=>H.flow.id)].filter(H=>!!H)),O=o.filter(H=>!!H.waypoints),$=(H,q)=>Math.abs(q.x-H.x)<2?"L":Math.abs(q.x-(H.x+H.width))<2?"R":Math.abs(q.y-H.y)<2?"T":Math.abs(q.y-(H.y+H.height))<2?"B":void 0,I=new Map,N=(H,q,ue)=>{if(!H||!q||typeof H.x!="number")return;const be=$(H,q);if(!be)return;let Q=I.get(H.id);Q||I.set(H.id,Q=new Map),Q.set(be,[...Q.get(be)??[],ue])};for(const H of O){const q=H.waypoints;!q||q.length<2||(N(H.source,q[0],{id:H.id,dir:"out"}),N(H.target,q[q.length-1],{id:H.id,dir:"in"}))}const j=new Set;for(const[H,q]of I){const ue=p(H);if(!ue||typeof ue.x!="number"||![...q.values()].some(me=>{const Pe=me.filter(ke=>ke.dir==="in");return me.length>=3&&Pe.length>=1&&me.some(ke=>ke.dir==="out")&&Pe.some(ke=>P.has(ke.id))}))continue;const Q=d(ue);if(!Q||j.has(Q.id)||(Q.children??[]).some(me=>me.type==="bpmn:Lane"))continue;const Ce=(E0=q.get("T"))!=null&&E0.length?(S0=q.get("B"))!=null&&S0.length?void 0:"B":"T";if(!Ce||(Ce==="T"?ue.y-Q.y:Q.y+Q.height-(ue.y+ue.height))>=L)continue;const Re=(Q.children??[]).filter(me=>!("waypoints"in me&&me.waypoints)&&me.type!=="label"&&typeof me.x=="number"),ut=Q.y+Q.height;n.resizeShape(Q,{x:Q.x,y:Q.y,width:Q.width,height:Q.height+L});const se=l().children.filter(me=>!("waypoints"in me&&me.waypoints)&&me.id!==Q.id&&typeof me.y=="number"&&me.y>=ut);se.length&&n.moveElements(se,{x:0,y:L}),Ce==="T"&&Re.length&&n.moveElements(Re,{x:0,y:L}),j.add(Q.id)}}const fd=20,c0=4,SL=2,RL=[10,30,80],Xo=()=>{const _=et(o);return{bad:kt(_).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:rh(_),straight:_.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Zo=_=>{const R=et(o),P=R.edges.find(O=>O.id===_);return P?an(P,Wn(R)).length:0},Bu=_=>Zo(_)>0,Nu=_=>et(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==_&&R.waypoints.length===2).length,CL=(_,R,P)=>at([{subtree:_,pool:R}],P),u0=(_,R)=>R.bad>_.bad||R.crossings>_.crossings&&R.straight<=_.straight&&R.bad>=_.bad,$u=(_,R)=>u0(_,R)||R.straight<_.straight,Fu=(_,R,P=()=>!0,O=u0)=>{const $=Xo(),I=at(_,R);if(!I)return!1;const N=Xo();return O($,N)||!P()?(I(),!1):!0},l0=(_,R,P,O=()=>!0)=>Fu([{subtree:_,pool:R}],P,O),Qr=_=>{var R;return!!((R=k.get(_))!=null&&R.node.participant)},os=new Map;for(const _ of g){if(!Qr(_.flow.target))continue;const R=os.get(_.flow.target)??[];R.push(_),os.set(_.flow.target,R)}const ju=[...os.keys()],dd=new Set(y.map(_=>_.flow.target)),p0=_=>nn.findIndex(({op:R})=>R.participant.id===_);ju.sort((_,R)=>{var $,I;const P=dd.has(_)?1:0,O=dd.has(R)?1:0;return P!==O?P-O:p0(($=k.get(_))==null?void 0:$.node.participant)-p0((I=k.get(R))==null?void 0:I.node.participant)});const Jr=_=>_.x+_.width/2,PL=_=>{const R=new Map;for(const $ of o.getAll()){const I=$;if(!I.waypoints||!I.source||!I.target)continue;(R.get(I.source.id)??R.set(I.source.id,[]).get(I.source.id)).push(I.target.id)}const P=new Set([_]),O=[_];for(let $=0;$<O.length;$++)for(const I of R.get(O[$])??[])P.has(I)||(P.add(I),O.push(I));return P},AL=(_,R)=>{const P=PL(R);let O;for(const $ of o.getAll()){const I=$;if(I.type!=="bpmn:MessageFlow"||!I.source||!I.target||I.target.id!==_||P.has(I.source.id))continue;const N=I.source;if(typeof N.x!="number"||N.type==="bpmn:Participant")continue;const j=Jr(N);(O===void 0||j>O)&&(O=j)}return O},hd=(_,R)=>{const P=p(_.flow.source);if(P)return P.type==="bpmn:Participant"?AL(P.id,R):Jr(P)},f0=_=>{let R;for(const P of os.get(_)??[]){const O=hd(P,_);O!==void 0&&(!R||O>R.cx)&&(R={op:P,cx:O})}return R==null?void 0:R.op},ML=_=>{const R=f0(_),P=p(_),O=R?hd(R,_):void 0;return P&&O!==void 0?O-Jr(P):void 0},TL=_=>{const R=ML(_);return R!==void 0&&Math.abs(R)<fd},d0=(_,R,P,O,$)=>{var I;for(let N=!0;N;){N=!1;for(const j of g){if(j.flow.id===P)continue;const H=R.has(j.flow.source),q=R.has(j.flow.target);if(H===q||O(H?j.flow.source:j.flow.target))continue;const ue=H?j.flow.target:j.flow.source;if($(ue)||!Qr(ue))continue;const be=p(j.flow.id);if(!(be!=null&&be.waypoints)||be.waypoints.length!==2)continue;const Q=p(ue),Ce=(I=k.get(ue))==null?void 0:I.node.participant;if(!Q||!Ce)continue;const xe=Kn(ue,Re=>Re.x>=Q.x).filter(Re=>!R.has(Re.id));if(!(!xe.length||xe.some(Re=>$(Re.id)))){for(const Re of xe)R.add(Re.id);_.set(Ce,[..._.get(Ce)??[],...xe]),N=!0}}}return[..._].map(([N,j])=>({subtree:j,pool:f(N)}))},h0=(_,R,P,O,$)=>d0(new Map([[R,[..._]]]),new Set(_.map(I=>I.id)),O,I=>I===P,I=>I===$),md=_=>{const R=f0(_);if(!R)return null;const P=p(_),O=p(R.flow.source),$=hd(R,_);if(!P||!O||$===void 0)return null;const I=$-Jr(P);if(I>=fd){const N=k.get(_).node.participant,j=Kn(_,H=>H.x>=P.x);return{groups:h0(j,N,_,R.flow.id,R.flow.source),dx:I}}if(-I>=fd&&Qr(R.flow.source)){const N=k.get(R.flow.source).node.participant,j=Kn(R.flow.source,H=>H.x>=O.x&&!TL(H.id));return{groups:h0(j,N,R.flow.source,R.flow.id,_),dx:-I}}return null},m0=()=>ju.map(_=>({id:_,plan:md(_)})).filter(_=>!!_.plan).sort((_,R)=>Math.min(..._.plan.groups.flatMap(P=>P.subtree.map(O=>O.x)))-Math.min(...R.plan.groups.flatMap(P=>P.subtree.map(O=>O.x)))).map(_=>_.id);for(let _=0;_<3;_++){const R=Xo(),P=[];for(const $ of m0()){const I=md($);if(!I)continue;const N=at(I.groups,I.dx);N&&P.push(N)}if(!P.length)break;if(!$u(R,Xo()))continue;for(const $ of P.reverse())$();let O=!1;for(const $ of m0()){const I=md($);I&&Fu(I.groups,I.dx,()=>!0,$u)&&(O=!0)}if(!O)break}for(const _ of ju){if(dd.has(_))continue;const R=k.get(_);if(!R||R.node.lane!==void 0)continue;const P=Y(R);if(P===void 0)continue;const O=p(_),$=O?d(O):void 0;if(!O||!$)continue;const I=$.y+ie+E(`pool:${R.node.participant??""}`,P)*L,N=I-(O.y+O.height/2);N!==0&&!pe($,O,O.x+O.width/2,I)&&n.moveElements([O],{x:0,y:N})}for(const _ of ju.flatMap(R=>os.get(R)??[])){if(!Bu(_.flow.id))continue;const R=p(_.flow.target);if(!R)continue;const P=f(k.get(_.flow.target).node.participant),O=Kn(_.flow.target,j=>j.x>=R.x),$=R.width+z,I=Zo(_.flow.id),N=Nu(_.flow.id);for(let j=1;j<=c0;j++){const H=()=>Zo(_.flow.id)<I&&Nu(_.flow.id)>=N;if(l0(O,P,$*j,H))break}}for(const _ of g){if(!Bu(_.flow.id))continue;const R=p(_.flow.source),P=p(_.flow.target);if(!R||!P||R.type==="bpmn:Participant"||P.type==="bpmn:Participant")continue;const O=R.x+R.width/2;if(Math.abs(O-(P.x+P.width/2))>15)continue;const[$,I]=R.y<P.y?[R.y+R.height,P.y]:[P.y+P.height,R.y],N=[...k.values()].map(j=>p(j.node.id)).filter(j=>!!j&&j.id!==R.id&&j.id!==P.id).filter(j=>j.x<=O&&O<=j.x+j.width&&j.y+j.height>$&&j.y<I).sort((j,H)=>j.x-H.x);for(const j of N){const H=(R0=k.get(j.id))==null?void 0:R0.node.participant,q=H?p(H):void 0;if(!q)continue;const ue=[...k.values()].filter(Pe=>Pe.node.participant===H).map(Pe=>Pe.node.id),be=Pe=>Pe.map(ke=>p(ke)).filter(ke=>!!ke),Ce=[Iu(j.id,Pe=>{var ke;return((ke=k.get(Pe.id))==null?void 0:ke.node.participant)===H}),be(ue)].filter(Pe=>Pe.length),xe=j.width+z,Re=Zo(_.flow.id),ut=Nu(_.flow.id),se=()=>Zo(_.flow.id)<Re&&Nu(_.flow.id)>=ut;let me=!1;for(const Pe of Ce){for(let ke=1;ke<=c0;ke++)if(l0(Pe,q,xe*ke,se)){me=!0;break}if(me)break}if(!Bu(_.flow.id))break}}for(const _ of g){if(!Bu(_.flow.id))continue;const R=p(_.flow.id);if(((C0=R==null?void 0:R.waypoints)==null?void 0:C0.length)!==2)continue;const P=p(_.flow.source),O=p(_.flow.target);if(!P||!O||P.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!Qr(_.flow.source)||!Qr(_.flow.target)||Math.abs(Jr(P)-Jr(O))>SL)continue;const $=Jr(P),I=R.waypoints.map(Re=>Re.y),[N,j]=[Math.min(...I),Math.max(...I)],H=Wn(et(o)).filter(Re=>Re.id!==P.id&&Re.id!==O.id&&Re.x<$&&$<Re.x+Re.width&&N<Re.y+Re.height&&Re.y<j);if(!H.length)continue;const q=(P0=k.get(_.flow.source))==null?void 0:P0.node.participant,ue=(A0=k.get(_.flow.target))==null?void 0:A0.node.participant;if(!q||!ue)continue;const be=new Map;for(const[Re,ut,se]of[[_.flow.source,P,q],[_.flow.target,O,ue]]){const me=be.get(se)??[],Pe=Kn(Re,ke=>ke.x>=ut.x).filter(ke=>!me.some(ct=>ct.id===ke.id));be.set(se,[...me,...Pe])}const Q=new Set([...be.values()].flat().map(Re=>Re.id)),Ce=d0(be,Q,_.flow.id,Re=>Re===_.flow.source||Re===_.flow.target,()=>!1),xe=Math.max(...H.map(Re=>Re.x+Re.width));for(const Re of RL){const ut=xe+Re-$;if(ut<=0)continue;if(Fu(Ce,ut,()=>{var me,Pe;return Zo(_.flow.id)===0&&((Pe=(me=p(_.flow.id))==null?void 0:me.waypoints)==null?void 0:Pe.length)===2},$u))break}}{const _=P=>P.y+P.height/2,R=[];for(const P of k.keys()){if(!Qr(P))continue;const O=y.filter(N=>N.flow.target===P);if(O.length!==1)continue;const $=p(O[0].flow.source),I=p(P);!$||!I||!k.has($.id)||Math.abs(_($)-_(I))>1||I.x-($.x+$.width)<=z+1||R.push({id:P,pred:$,node:I})}R.sort((P,O)=>P.node.x-O.node.x);for(const{id:P}of R){const O=k.get(P),$=p(P),I=p(y.find(Q=>Q.flow.target===P).flow.source);if(!$||!I)continue;const N=$.x-(I.x+I.width);if(N<=z+1)continue;const j=f(O.node.participant),H=Kn(P,Q=>Q.x>=$.x),q=Xo(),ue=CL(H,j,-(N-z));if(!ue)continue;const be=Xo();(be.bad>q.bad||be.crossings>=q.crossings||be.straight<q.straight)&&ue()}}s0(!0);for(const _ of b){const R=_.associations??[],P=R.map(I=>I.source===_.dataStore.id?I.target:I.source).map(p).find(Boolean),O=P?d(P)??l():l(),$=P?{x:P.x+P.width/2,y:P.y+P.height+110}:{x:200,y:rn+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:_.dataStore.id,name:_.dataStore.name})},$,O);for(const I of R)a0(_.dataStore.id,I)}for(const _ of x){const P=f(_.association.target).type==="bpmn:DataStoreReference"?_.association.target:_.association.source;a0(P,_.association)}let g0=0;const eo=10,y0=40,kL=(_,R)=>{const P=R.map(H=>d(H)).filter(H=>!!H);for(const H of P){const q=eo,ue=H.y,be=H.y+H.height,Q=H.x,Ce=H.x+H.width;if(Math.abs(_.y-ue)<q){const xe=ue+q-_.y;_.y+=xe,_.height-=xe}if(Math.abs(_.y+_.height-be)<q&&(_.height=be-q-_.y),Math.abs(_.x-Q)<q){const xe=Q+q-_.x;_.x+=xe,_.width-=xe}Math.abs(_.x+_.width-Ce)<q&&(_.width=Ce-q-_.x)}if(!P.length)return;const O=Math.min(...P.map(H=>H.y)),$=Math.max(...P.map(H=>H.y+H.height)),I=O-_.y,N=_.y+_.height-$,j=y0-eo;if(I>0!=N>0)if(I>0&&I<j){const H=I+eo;_.y+=H,_.height-=H}else N>0&&N<j&&(_.height-=N+eo)},OL=(_,R)=>{const P=eo,O=30,$=o.filter(I=>I.type==="bpmn:Group"&&I.id!==R);for(const I of $){const N=I.x,j=I.x+I.width,H=I.y,q=I.y+I.height,ue=_.y<q&&H<_.y+_.height,be=_.x<j&&N<_.x+_.width;if(ue){if(Math.abs(_.x-j)<P){const Q=Math.min(j+P-_.x,O);Q>0&&_.width-Q>0&&(_.x+=Q,_.width-=Q)}if(Math.abs(_.x+_.width-N)<P){const Q=Math.min(_.x+_.width-(N-P),O);Q>0&&_.width-Q>0&&(_.width-=Q)}}if(be){if(Math.abs(_.y-q)<P){const Q=Math.min(q+P-_.y,O);Q>0&&_.height-Q>0&&(_.y+=Q,_.height-=Q)}if(Math.abs(_.y+_.height-H)<P){const Q=Math.min(_.y+_.height-(H-P),O);Q>0&&_.height-Q>0&&(_.height-=Q)}}}},gd=(_,R)=>{const P=y0,O=Math.min(..._.map(H=>H.x))-P,$=Math.min(..._.map(H=>H.y))-P,I=Math.max(..._.map(H=>H.x+H.width))+P,N=Math.max(..._.map(H=>H.y+H.height))+P,j={x:O,y:$,width:I-O,height:N-$};return kL(j,_),OL(j,R),j};for(const _ of M){const R=(_.group.members??[]).map(p).filter($=>!!$);let P;R.length?P=gd(R,_.group.id):(P={x:300+g0*350,y:40,width:300,height:200},g0++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:_.group.id}),width:P.width,height:P.height},{x:P.x+P.width/2,y:P.y+P.height/2},l());_.group.name&&n.updateLabel(O,_.group.name),(M0=_.group.members)!=null&&M0.length&&A(O,"bwl:Members",{refs:_.group.members.join(" ")})}{const _=o.filter($=>!!$.waypoints),R=new Map,P=($,I)=>{!$||!I||(R.has($)||R.set($,new Set),R.get($).add(I))};for(const $ of _){const I=(T0=$.source)==null?void 0:T0.id,N=(k0=$.target)==null?void 0:k0.id;P(I,N),((O0=$.type)!=null&&O0.includes("DataOutputAssociation")||(D0=$.type)!=null&&D0.includes("DataInputAssociation")||$.type==="bpmn:Association")&&P(N,I)}const O=o.filter($=>$.type==="bpmn:Group");for(const $ of O){const N=(((L0=$.businessObject.extensionElements)==null?void 0:L0.values)??[]).find(se=>se.$type==="bwl:Members"),j=((N==null?void 0:N.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const H=new Set(j),q=[...j];for(;q.length;){const se=q.shift();for(const me of R.get(se)??[])H.has(me)||(H.add(me),q.push(me))}const ue=$.x,be=$.x+$.width,Q=$.y,Ce=$.y+$.height,xe=se=>y.filter(me=>me.flow.target===se).length,Re=se=>{var Pe;const me=((Pe=p(se))==null?void 0:Pe.type)??"";if(me==="bpmn:StartEvent"&&xe(se)===0)return!1;if(me.endsWith("Gateway")){const ke=y.filter(ct=>ct.flow.target===se).map(ct=>ct.flow.source);if(ke.length&&ke.every(ct=>{var rt;return((rt=p(ct))==null?void 0:rt.type)==="bpmn:StartEvent"&&xe(ct)===0}))return!1}return!0},ut=o.filter(se=>Ze(se)).filter(se=>se.type!=="bpmn:Group"&&se.type!=="bpmn:Participant"&&se.type!=="bpmn:TextAnnotation"&&!H.has(se.id)&&Qr(se.id)&&Re(se.id)&&se.x<be&&se.x+se.width>ue&&se.y<Ce&&se.y+se.height>Q);if(ut.length)for(const se of[-1,1]){const me=ut.filter(re=>(re.x+re.width-ue<=be-re.x?-1:1)===se);if(!me.length)continue;const Pe=[];for(const re of me){const Z=Pe.find(fe=>fe.some(de=>re.y<de.y+de.height&&re.y+re.height>de.y));Z?Z.push(re):Pe.push([re])}const ke=new Map;for(const re of Pe){let Z=se<0?ue-eo:be+eo;for(const fe of[...re].sort((de,oe)=>se<0?oe.x-de.x:de.x-oe.x)){const de=se<0?Math.min(fe.x,Z-fe.width):Math.max(fe.x,Z);Z=se<0?de-Wt:de+fe.width+Wt,de!==fe.x&&Math.sign(de-fe.x)===se&&ke.set(fe.id,de-fe.x)}}const ct=new Map,rt=re=>ct.get(re)===re||!ct.get(re)?re:rt(ct.get(re));for(const re of me)ct.set(re.id,re.id);for(const re of g){const Z=ke.has(re.flow.source)?re.flow.source:void 0,fe=ke.has(re.flow.target)?re.flow.target:void 0;if(!Z||!fe)continue;const de=p(re.flow.id);((I0=de==null?void 0:de.waypoints)==null?void 0:I0.length)===2&&ct.set(rt(Z),rt(fe))}const st=new Map;for(const re of me){if(!ke.has(re.id))continue;const Z=rt(re.id);st.set(Z,[...st.get(Z)??[],re])}const ze=[...st.values()].sort((re,Z)=>se<0?Math.min(...re.map(fe=>fe.x))-Math.min(...Z.map(fe=>fe.x)):Math.max(...Z.map(fe=>fe.x))-Math.max(...re.map(fe=>fe.x))),le=[];let Ke=!0;for(const re of ze){const Z=re.map(oe=>ke.get(oe.id)??0).reduce((oe,Se)=>Math.abs(Se)>Math.abs(oe)?Se:oe,0),fe=new Map;let de=!0;for(const oe of re){const Se=d(oe);if(!Se){de=!1;break}fe.has(Se.id)||fe.set(Se.id,{subtree:[],pool:Se}),fe.get(Se.id).subtree.push(oe)}de&&Fu([...fe.values()],Z,()=>!0,$u)?le.push({shapes:re,dx:Z}):Ke=!1}if(!Ke)for(const re of le.reverse())n.moveElements(re.shapes,{x:-re.dx,y:0})}}}{const _=new Set([...M.map(R=>R.group.id),...en(e,"group.update").map(R=>R.id)]);for(const R of o.filter(P=>P.type==="bpmn:Group")){if(_.has(R.id))continue;const O=(((B0=R.businessObject.extensionElements)==null?void 0:B0.values)??[]).find(j=>j.$type==="bwl:Members"),$=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(p).filter(j=>!!j);!$.length||!$.some(j=>{const H=m.get(j.id);return!H||H.x!==j.x||H.y!==j.y})||!$.some(j=>j.x<R.x||j.y<R.y||j.x+j.width>R.x+R.width||j.y+j.height>R.y+R.height)||n.resizeShape(R,gd($,R.id))}}{const R=new Map(ho(et(o)).map(j=>[j.owner,j.rect])),P=o.filter(j=>!!j.waypoints),O=new Map,$=(j,H)=>{!j||!H||(O.has(j)||O.set(j,new Set),O.get(j).add(H))};for(const j of P){const H=(N0=j.source)==null?void 0:N0.id,q=($0=j.target)==null?void 0:$0.id;$(H,q),((F0=j.type)!=null&&F0.includes("DataOutputAssociation")||(j0=j.type)!=null&&j0.includes("DataInputAssociation")||j.type==="bpmn:Association")&&$(q,H)}const I=j=>y.filter(H=>H.flow.target===j).length,N=j=>{var q;const H=((q=p(j))==null?void 0:q.type)??"";if(H==="bpmn:StartEvent"&&I(j)===0)return!1;if(H.endsWith("Gateway")){const ue=y.filter(be=>be.flow.target===j).map(be=>be.flow.source);if(ue.length&&ue.every(be=>{var Q;return((Q=p(be))==null?void 0:Q.type)==="bpmn:StartEvent"&&I(be)===0}))return!1}return!0};for(const j of o.filter(H=>H.type==="bpmn:Group")){const q=(((H0=j.businessObject.extensionElements)==null?void 0:H0.values)??[]).find(Z=>Z.$type==="bwl:Members"),ue=((q==null?void 0:q.refs)??"").split(" ").filter(Boolean);if(!ue.length)continue;const be=ue.map(p).filter(Z=>!!Z);if(!be.length||!(M.some(Z=>Z.group.id===j.id)||en(e,"group.update").some(Z=>Z.id===j.id)||be.some(Z=>{const fe=m.get(Z.id);return!fe||fe.x!==Z.x||fe.y!==Z.y})))continue;const Ce=new Set(ue),xe=[...ue];for(;xe.length;){const Z=xe.shift();for(const fe of O.get(Z)??[])Ce.has(fe)||(Ce.add(fe),xe.push(fe))}const Re=j.x,ut=j.x+j.width,se=j.y,me=j.y+j.height,Pe=Z=>{const fe=R.get(Z.id),de={x:Z.x,y:Z.y,width:Z.width,height:Z.height};return fe?[de,{x:fe.x,y:fe.y,width:fe.width,height:fe.height}]:[de]},ke=be.flatMap(Pe),ct=Math.min(...ke.map(Z=>Z.x)),rt=Math.max(...ke.map(Z=>Z.x+Z.width)),st=Math.min(...ke.map(Z=>Z.y)),ze=Math.max(...ke.map(Z=>Z.y+Z.height)),le={L:ct-Re,R:ut-rt,T:st-se,B:me-ze},Ke=o.filter(Z=>Ze(Z)).filter(Z=>Z.type!=="bpmn:Group"&&Z.type!=="bpmn:Participant"&&Z.type!=="bpmn:TextAnnotation"&&!Ce.has(Z.id)&&N(Z.id)&&Z.x<ut&&Z.x+Z.width>Re&&Z.y<me&&Z.y+Z.height>se);if(!Ke.length)continue;const re={L:0,R:0,T:0,B:0};for(const Z of Ke){const fe=Pe(Z),de=Math.min(...fe.map(ot=>ot.x)),oe=Math.max(...fe.map(ot=>ot.x+ot.width)),Se=Math.min(...fe.map(ot=>ot.y)),he=Math.max(...fe.map(ot=>ot.y+ot.height)),Ve={L:oe-Re,R:ut-de,T:he-se,B:me-Se},Tt=["L","R","T","B"].filter(ot=>Ve[ot]<=le[ot]+.001);if(!Tt.length)continue;const Je=Tt.reduce((ot,Ut)=>Ve[Ut]<Ve[ot]?Ut:ot,Tt[0]);re[Je]=Math.max(re[Je],Math.min(Ve[Je]+10,le[Je]))}!re.L&&!re.R&&!re.T&&!re.B||n.resizeShape(j,{x:j.x+re.L,y:j.y+re.T,width:j.width-re.L-re.R,height:j.height-re.T-re.B})}}const v0=_=>{const R=_.waypoints;if(R!=null&&R.length){const O=R[Math.floor((R.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const P=_;return{x:P.x,y:P.y,width:P.width,height:P.height}};let as=0;const b0=12,x0=14,DL=15,LL=300,IL=_=>{const R=_.split(`
|
|
7
|
+
`),P=Math.max(...R.map(I=>lo(I,b0))),O=Math.max(100,Math.min(LL,Math.ceil(P)+x0)),$=R.reduce((I,N)=>I+Math.max(1,Math.ceil((lo(N,b0)+x0)/O)),0);return{width:O,height:Math.max(30,$*DL+10)}};for(const _ of C){const R=_.association,P=((z0=_.placement)==null?void 0:z0.anchor)??(R?R.source===_.annotation.id?R.target:R.source:void 0),O=P?p(P):void 0,$=O?v0(O):void 0,I=IL(_.annotation.text??"");let N;if($&&_.placement){const[ue,be]=Ts[_.placement.side],Q=_.placement.offset??50;N={x:$.x+$.width/2+ue*($.width/2+I.width/2+Q),y:$.y+$.height/2+be*($.height/2+I.height/2+Q)}}else $?(N={x:$.x+$.width/2+180+as%3*260,y:$.y-110-as%2*95},as++):(N={x:300+as*260,y:60},as++);const j=O?d(O)??l():l(),H=j;$&&typeof H.x=="number"&&typeof H.width=="number"&&H.type==="bpmn:Participant"&&(N=xl(o,$,I,H,_.placement?{placement:_.placement}:{from:N}));const q=n.createShape({type:"bpmn:TextAnnotation",width:I.width,height:I.height,businessObject:i.create("bpmn:TextAnnotation",{id:_.annotation.id,text:_.annotation.text})},N,j);if(R){const ue=be=>be===_.annotation.id?q:f(be);n.connect(ue(R.source),ue(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}_.placement&&A(q,"bwl:Placement",B(_.placement))}for(const _ of en(e,"association.add")){const R=_.association;n.connect(f(R.source),f(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const _ of en(e,"node.update")){let R=f(_.id);if(_.type&&Ms(_.type)!==R.type&&(R=c.replaceElement(R,{type:Ms(_.type)})),_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.lane||_.band!==void 0){_.band!==void 0&&n.updateProperties(R,{"bwl:band":_.band});const P=R.y+R.height/2,O=d(R),$=_.lane?f(_.lane):((O==null?void 0:O.children)??[]).find(N=>N.type==="bpmn:Lane"&&P>=N.y&&P<=N.y+N.height);_.band!==void 0&&it($==null?void 0:$.id,_.band,O);const I=$?$.y+(_.band===void 0?$.height/2:Math.min($.height/2,ge)+E($.id,_.band)*L):_.band!==void 0&&O?O.y+ie+E(`pool:${O.id}`,_.band)*L:void 0;if(I!==void 0){const N=I-P;N!==0&&n.moveElements([R],{x:0,y:N})}}}for(const _ of en(e,"sequenceFlow.update")){const R=f(_.id);if(_.source!==void 0||_.target!==void 0){const P=R,O=_.source!==void 0?f(_.source):P.source,$=_.target!==void 0?f(_.target):P.target,I=N=>({x:N.x+N.width/2,y:N.y+N.height/2});n.reconnect(P,O,$,[I(O),I($)])}_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.condition!==void 0&&n.updateProperties(R,{name:((G0=_.condition)==null?void 0:G0.label)??void 0})}for(const _ of en(e,"messageFlow.update"))_.name!==void 0&&n.updateProperties(f(_.id),{name:_.name??void 0});for(const _ of en(e,"dataStore.update"))_.name!==void 0&&n.updateProperties(f(_.id),{name:_.name??void 0});for(const _ of en(e,"annotation.update")){const R=f(_.id);if(_.text!==void 0&&n.updateProperties(R,{text:_.text}),_.placement===null)A(R,"bwl:Placement",null);else if(_.placement){const P=f(_.placement.anchor),O=v0(P),$=d(P)??l(),I=typeof $.x=="number"&&typeof $.width=="number"&&$.type==="bpmn:Participant",[N,j]=Ts[_.placement.side],H=_.placement.offset??50,q={x:O.x+O.width/2+N*(O.width/2+R.width/2+H),y:O.y+O.height/2+j*(O.height/2+R.height/2+H)},ue=I?xl(o,O,{width:R.width,height:R.height},$,{placement:_.placement,selfId:_.id}):q;n.moveElements([R],{x:ue.x-(R.x+R.width/2),y:ue.y-(R.y+R.height/2)}),A(R,"bwl:Placement",B(_.placement))}}for(const _ of en(e,"group.update")){const R=f(_.id);if(_.name!==void 0&&n.updateLabel(R,_.name??""),_.members){const P=_.members.map(p).filter(O=>!!O);P.length&&n.resizeShape(R,gd(P,_.id)),A(R,"bwl:Members",{refs:_.members.join(" ")})}}}function _l(e){switch(e.kind){case"annotation-over-label":return[e.annotation];case"edge-crosses-shape":return[e.shape];case"shape-outside-container":return[e.shape];case"shape-overlap":return e.shapes;default:return[]}}function k1(e,t,n){var l,p;const{elementRegistry:i}=e,r=e.modeling,o=f=>kt(f).filter(d=>!t.has(Et(d))),a=f=>{var d;return((d=i.get(f))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=et(i),c=o(s),u=[...new Set(c.flatMap(_l))].filter(f=>n.has(f)&&a(f));if(u.length)for(const f of u){const d=i.get(f);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let m=d.parent,h;for(;m;){if(m.type==="bpmn:Participant"){h=m;break}m=m.parent}if(!h){const ge=d.x+d.width/2,Ue=d.y+d.height/2;h=i.getAll().find(je=>{if(je.type!=="bpmn:Participant")return!1;const K=je;return typeof K.x=="number"&&typeof K.width=="number"&&ge>=K.x&&ge<=K.x+K.width&&Ue>=K.y&&Ue<=K.y+K.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const y=(((l=d.businessObject.extensionElements)==null?void 0:l.values)??[]).find(ge=>ge.$type==="bwl:Placement"),g=[...d.incoming??[],...d.outgoing??[]].find(ge=>ge.type==="bpmn:Association"),b=(y!=null&&y.anchor?i.get(y.anchor):void 0)??(g?((p=g.source)==null?void 0:p.id)===f?g.target:g.source:void 0);if(!b)continue;const x=b.waypoints,C=x!=null&&x.length?{x:x[Math.floor((x.length-1)/2)].x,y:x[Math.floor((x.length-1)/2)].y,width:0,height:0}:{x:b.x,y:b.y,width:b.width,height:b.height},M={width:d.width,height:d.height},k={x:d.x+d.width/2,y:d.y+d.height/2},A=y==null?void 0:y.side,B=[];A&&A in Ts&&B.push(xl(i,C,M,h,{placement:{side:A,offset:(y==null?void 0:y.offset)??null},selfId:f}));for(const[ge,Ue]of[[-1,0],[1,0],[0,-1],[0,1]])for(let je=1;je<=T1;je++)B.push({x:k.x+ge*Gh*je,y:k.y+Ue*Gh*je});const D={...s,edges:s.edges.filter(ge=>ge.id!==(g==null?void 0:g.id))},L=o(D),z=L.filter(ge=>_l(ge).includes(f)).length;if(!z)continue;let ie;for(const ge of B){const Ue=ge.x-k.x,je=ge.y-k.y;if(!Ue&&!je||ge.x-M.width/2<h.x||ge.x+M.width/2>h.x+h.width||ge.y-M.height/2<h.y||ge.y+M.height/2>h.y+h.height)continue;const K={...D,shapes:D.shapes.map(Me=>Me.id===f?{...Me,x:Me.x+Ue,y:Me.y+je}:Me)},pe=o(K),ce=pe.filter(Me=>_l(Me).includes(f)).length;if(ce>=z||pe.length>L.length)continue;const ye=Math.abs(Ue)+Math.abs(je);if((!ie||ce<ie.mine||ce===ie.mine&&(pe.length<ie.all||pe.length===ie.all&&ye<ie.dist))&&(ie={x:ge.x,y:ge.y,mine:ce,all:pe.length,dist:ye}),ie.mine===0&&ie.all<L.length)break}ie&&r.moveElements([d],{x:ie.x-k.x,y:ie.y-k.y})}}const O1=60;function D1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>kt(l).filter(p=>!t.has(Et(p))),a=l=>l.filter(p=>p.kind==="pool-overlap"),s=new Map(n.shapes.map(l=>[l.id,l])),c=(l,p)=>p.x>=l.x&&p.y>=l.y&&p.x+p.width<=l.x+l.width&&p.y+p.height<=l.y+l.height,u=l=>{if(!s.get(l))return[l];const f=new Set,d=new Set([l]);for(let h=0;h<4;h++){let v=!1;for(const y of n.shapes)y.type!=="bpmn:Group"||f.has(y.id)||[...d].some(g=>{const b=s.get(g);return b&&c(y,b)})&&(f.add(y.id),v=!0);for(const y of n.shapes)y.type!=="bpmn:Participant"||d.has(y.id)||[...f].some(g=>{const b=s.get(g);return b&&c(b,y)})&&(d.add(y.id),v=!0);if(!v)break}const m=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!f.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...f].some(v=>{const y=s.get(v);return y&&c(y,h)})).map(h=>h.id);return[...d,...f,...m]};for(let l=0;l<6;l++){const p=et(i),f=o(p),d=a(f);if(!d.length)return;const m=new Map(p.shapes.map(x=>[x.id,x]));let h=null;for(const x of d){if(x.kind!=="pool-overlap")continue;const[C,M]=x.pools,k=m.get(C),A=m.get(M);if(!k||!A)continue;const[B,D]=k.x<=A.x?[k,A]:[A,k];if(x.contained)continue;const L=s.get(B.id),z=s.get(D.id),ie=L&&z?Math.max(z.x-(L.x+L.width),0):O1,ge=B.x+B.width+ie-D.x;if(ge<=0)continue;const Ue=u(D.id).filter(je=>i.get(je));Ue.length&&(!h||ge>h.dx)&&(h={movers:Ue,dx:ge})}if(!h)return;const v=h.movers.map(x=>i.get(x)).filter(x=>!!x&&typeof x.x=="number");if(!v.length)return;const y=f.length,g=d.length;r.moveElements(v,{x:h.dx,y:0});const b=o(et(i));if(!(a(b).length<g&&b.length<=y)){r.moveElements(v,{x:-h.dx,y:0});return}}}function L1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>kt(u).filter(l=>!t.has(Et(l))),a=(u,l)=>l.x>=u.x&&l.y>=u.y&&l.x+l.width<=u.x+u.width&&l.y+l.height<=u.y+u.height,s=u=>({l:Math.min(...u.map(l=>l.x)),t:Math.min(...u.map(l=>l.y)),r:Math.max(...u.map(l=>l.x+l.width)),b:Math.max(...u.map(l=>l.y+l.height))}),c=n.shapes.filter(u=>{var l;return u.type==="bpmn:Group"&&!((l=u.members)!=null&&l.length)});if(c.length)for(const u of c){const l=i.get(u.id);if(!l||typeof l.x!="number")continue;const p=n.shapes.filter(M=>M.id!==u.id&&M.type!=="bpmn:Group"&&a(u,M));if(!p.length)continue;const f=p.map(M=>i.get(M.id)).filter(M=>!!M&&typeof M.x=="number");if(f.length!==p.length)continue;const d=s(p),m=s(f),h=m.l+(u.x-d.l),v=m.t+(u.y-d.t),y=m.r+(u.x+u.width-d.r),g=m.b+(u.y+u.height-d.b),b={x:h,y:v,width:y-h,height:g-v};if(b.width<=0||b.height<=0||Math.abs(b.x-l.x)<1&&Math.abs(b.y-l.y)<1&&Math.abs(b.width-l.width)<1&&Math.abs(b.height-l.height)<1)continue;const x=o(et(i)).length,C={x:l.x,y:l.y,width:l.width,height:l.height};r.resizeShape(l,b),o(et(i)).length>x&&r.resizeShape(l,C)}}function Wh(e,t,n=Vh){const i=zh(e),r=Hh(t,dh(i.elementRegistry)),o={edgeCrossings:{before:0,after:0,pairs:[],solidPairs:0,dashedPairs:0,mixedPairs:0,crossPoolMessages:0}};if(r.length)return{ok:!1,issues:r,findings:[],stats:o};const a=et(i.elementRegistry),s=new Set(kt(a).map(Et)),c=new Set(a.edges.map(g=>g.id)),u=new Set(a.shapes.map(g=>g.id)),l=ws(a),p=l.length,f=new Set(l.map(([g,b])=>`${g}|${b}`)),d=new Map;for(const g of i.elementRegistry.filter(b=>"waypoints"in b&&!!b.waypoints))g.label&&d.set(g.id,{wps:g.waypoints.map(b=>({x:b.x,y:b.y})),label:{x:g.label.x,y:g.label.y}});const m=e.get("commandStack");try{wd(m,()=>{n(t,i),D1(i,s,a),L1(i,s,a),xh(i,c);const g=ml(i,s);yh(i,f,c),Th(i,s,c),Eh(i,c),b1(i,c),Ch(i,s,c),E1(i,s,c),Ih(i,s,c),Lh(i,c),Nh(i,u),k1(i,s,u),ml(i,s,g),$h(i,s),Dh(i,d)})}catch(g){return{ok:!1,issues:[{kind:"lower-failed",message:g instanceof Error?g.message:String(g)}],findings:[],stats:o}}const h=et(i.elementRegistry),v=kt(h).filter(g=>!s.has(Et(g))),y=oh(h);return{ok:!0,issues:[],findings:v,stats:{edgeCrossings:{before:p,after:y.pairs.length,pairs:y.pairs,solidPairs:y.solidPairs,dashedPairs:y.dashedPairs,mixedPairs:y.mixedPairs,crossPoolMessages:y.crossPoolMessages}}}}function I1(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function B1(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Uh(e,t){const n=B1(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Yh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function N1(e){return typeof e=="string"&&zu.includes(e)}function li(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function qh(e){const t=e.rootElements??[],n=t.find(K=>K.$type==="bpmn:Collaboration"),i=new Map(t.filter(K=>K.$type==="bpmn:Process").map(K=>[K.id,K])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},p=[],f=[],d=[],m=[],h=[],v=[],y=new Set,g=new Set,b=K=>{K&&y.add(K)},x=K=>{y.add(K),g.add(K)},C=K=>{const pe=Yh(K,"bwl:Placement");if(!pe)return;const ce=typeof pe.anchor=="string"?pe.anchor:void 0;if(!ce||!N1(pe.side))return;const ye=typeof pe.offset=="number"?pe.offset:void 0;h.push({owner:K.id,anchor:ce,side:pe.side,...ye!==void 0?{offset:ye}:{}})},M=K=>{const pe=Yh(K,"bwl:Members"),ce=typeof(pe==null?void 0:pe.refs)=="string"?pe.refs.split(/\s+/).filter(Boolean):[];ce.length&&v.push({owner:K.id,refs:ce})},k=K=>{var pe;for(const ce of K)switch(b(ce.id),ce.$type){case"bpmn:TextAnnotation":x(ce.id),s.push({id:ce.id,text:typeof ce.text=="string"?ce.text:""}),C(ce);break;case"bpmn:Association":d.push({id:ce.id,type:ce.$type,source:li(ce.sourceRef),target:li(ce.targetRef)});break;case"bpmn:Group":{x(ce.id);const ye=(pe=ce.categoryValueRef)==null?void 0:pe.value;c.push({id:ce.id,...typeof ye=="string"&&ye?{name:ye}:{}}),M(ce);break}default:u.push({id:ce.id,type:ce.$type,reason:"type-outside-mvp"})}},A=K=>{for(const pe of K.flowElements??[])b(pe.id),u.push({id:pe.id,type:pe.$type,reason:"inside-container"}),(pe.flowElements??[]).length&&A(pe);for(const pe of K.artifacts??[])b(pe.id),u.push({id:pe.id,type:pe.$type,reason:"inside-container"})},B=(K,pe)=>{const ce=K.flowElements??[],ye=(K.laneSets??[]).flatMap(W=>W.lanes??[]),Me=new Map;for(const W of ye){b(W.id);for(const Y of W.flowNodeRef??[]){const te=li(Y);te&&Me.set(te,W.id)}}for(const W of ce){if(b(W.id),W.$type==="bpmn:SequenceFlow"){p.push({id:W.id,source:li(W.sourceRef),target:li(W.targetRef),...typeof W.name=="string"&&W.name?{name:W.name}:{}});continue}if(W.$type==="bpmn:DataStoreReference"){x(W.id),a.push({id:W.id,...W.name?{name:W.name}:{}});continue}const Y=I1(W.$type);if(!yd(Y)){u.push({id:W.id,type:W.$type,reason:"type-outside-mvp"});continue}x(W.id);const te=Y==="boundaryEvent"?li(W.attachedToRef):void 0;o.push({id:W.id,type:Y,...W.name?{name:W.name}:{},...pe?{participant:pe}:{},...Me.has(W.id)?{lane:Me.get(W.id)}:{},...te?{attachedTo:te}:{}}),Y==="subProcess"&&A(W);const Ae=Uh(W,"bwl:band");Ae!==void 0&&(l.bands[W.id]=Ae);for(const gt of W.dataOutputAssociations??[])b(gt.id),m.push({id:gt.id,type:gt.$type,source:W.id,target:li(gt.targetRef)});for(const gt of W.dataInputAssociations??[])b(gt.id),m.push({id:gt.id,type:gt.$type,source:li((gt.sourceRef??[])[0]),target:W.id})}k(K.artifacts??[])};if(n){const K=new Set;for(const pe of n.participants??[]){x(pe.id);const ce=li(pe.processRef);ce&&K.add(ce);const ye=ce?i.get(ce):void 0,Me=((ye==null?void 0:ye.laneSets)??[]).flatMap(Ae=>Ae.lanes??[]),W=Me.map(Ae=>({id:Ae.id,...Ae.name?{name:Ae.name}:{}}));for(const Ae of W)x(Ae.id);const Y=!ye||(ye.flowElements??[]).length===0&&Me.length===0&&(ye.artifacts??[]).length===0;r.push({id:pe.id,...pe.name?{name:pe.name}:{},...Y?{blackBox:!0}:{},...W.length?{lanes:W}:{}});const te=Uh(pe,"bwl:poolOrder");te!==void 0&&(l.poolOrders[pe.id]=te),ye&&B(ye,pe.id)}for(const pe of n.messageFlows??[])b(pe.id),f.push({id:pe.id,source:li(pe.sourceRef),target:li(pe.targetRef),...typeof pe.name=="string"&&pe.name?{name:pe.name}:{}});k(n.artifacts??[]);for(const[pe,ce]of i)!K.has(pe)&&(ce.flowElements??[]).length>0&&u.push({id:pe,type:ce.$type,reason:"unreachable-process"})}else for(const K of i.values())B(K);const D=[],L=[],z=[],ie=[],ge=(K,pe)=>!!K&&!!pe&&g.has(K)&&g.has(pe);for(const K of p){if(!ge(K.source,K.target)){u.push({id:K.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}D.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),g.add(K.id)}for(const K of f){if(!ge(K.source,K.target)){u.push({id:K.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}L.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),g.add(K.id)}for(const K of m){if(!ge(K.source,K.target)){u.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}ie.push({...K.id?{id:K.id}:{},source:K.source,target:K.target}),K.id&&g.add(K.id)}for(const K of d){if(!ge(K.source,K.target)){u.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}z.push({...K.id?{id:K.id}:{},source:K.source,target:K.target})}const Ue=new Map(c.map(K=>[K.id,K]));for(const{owner:K,refs:pe}of v){const ce=pe.filter(Me=>y.has(Me)),ye=Ue.get(K);ye&&ce.length&&(ye.members=ce)}for(const K of h)y.has(K.anchor)&&(l.placements[K.owner]={anchor:K.anchor,side:K.side,...K.offset!==void 0?{offset:K.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:D,...L.length?{messageFlows:L}:{},...a.length?{dataStores:a}:{},...ie.length?{dataAssociations:ie}:{},...s.length?{annotations:s}:{},...z.length?{associations:z}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function $1(e){const{definitions:t,warnings:n}=await ol(e);return{...qh(t),warnings:n}}function F1(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Kh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Wh(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 j1=Symbol("bpmn-editor");function H1(){const e=Nt.ref(!1),t=Nt.ref(!0),n=Nt.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 Kh(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:al(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 _e(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function z1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var wl={exports:{}},Xh;function G1(){if(Xh)return wl.exports;Xh=1;var e=wl.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},wl.exports}var V1=G1(),W1=z1(V1);function yi(e){if(!(this instanceof yi))return new yi(e);e=e||[128,36,1],this._seed=e.length?W1.rack(e[0],e[1],e[2]):e}yi.prototype.next=function(e){return this._seed(e||!0)},yi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},yi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},yi.prototype.assigned=function(e){return this._seed.get(e)||!1},yi.prototype.unclaim=function(e){delete this._seed.hats[e]},yi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const qt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};qt.td=qt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],qt.option=qt.optgroup=[1,'<select multiple="multiple">',"</select>"],qt.thead=qt.tbody=qt.colgroup=qt.caption=qt.tfoot=[1,"<table>","</table>"],qt.polyline=qt.ellipse=qt.polygon=qt.circle=qt.text=qt.line=qt.path=qt.rect=qt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function bt(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:p}=l;return p.remove(),p}let[r,o,a]=Object.hasOwn(qt,i)?qt[i]:qt._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 U1(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 _n(e,...t){const n=e.style;return F(t,function(i){i&&F(i,function(r,o){n[o]=r})}),e}function mn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const Y1=Object.prototype.toString;function wt(e){return new er(e)}function er(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}er.prototype.add=function(e){return this.list.add(e),this},er.prototype.remove=function(e){return Y1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},er.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},er.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},er.prototype.array=function(){return Array.from(this.list)},er.prototype.has=er.prototype.contains=function(e){return this.list.contains(e)};function ks(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Ir(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function q1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Os={},Zh;function K1(){if(Zh)return Os;Zh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Os.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Os.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Os}var Qh=K1(),X1=q1(Qh),Ne=U1({__proto__:null,default:X1},[Qh]),Jh=["focus","blur"];function Z1(e,t,n,i,r){return Jh.indexOf(n)!==-1&&(r=!0),Ne.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Ir(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function Q1(e,t,n,i){return Jh.indexOf(t)!==-1&&(i=!0),Ne.unbind(e,t,n,i)}var On={bind:Z1,unbind:Q1};function El(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function pt(e,t){return t=t||document,t.querySelector(e)}function Ds(e,t){return t=t||document,t.querySelectorAll(e)}function vi(e){e.parentNode&&e.parentNode.removeChild(e)}function J1(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function eS(e,t){return t.appendChild(J1(e,t))}function $e(e,t){return eS(t,e),e}var Sl=2,em={"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":Sl,"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":Sl,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function tS(e,t){return em[t]?e.style[t]:e.getAttributeNS(null,t)}function tm(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=em[i];r?(r===Sl&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function nS(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)tm(e,r,t[r])}function we(e,t,n){if(typeof t=="string")if(n!==void 0)tm(e,t,n);else return tS(e,t);else nS(e,t);return e}const iS=Object.prototype.toString;function Qe(e){return new tr(e)}function tr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}tr.prototype.add=function(e){return this.list.add(e),this},tr.prototype.remove=function(e){return iS.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},tr.prototype.removeMatching=function(e){const t=this.array();for(let n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},tr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},tr.prototype.array=function(){return Array.from(this.list)},tr.prototype.has=tr.prototype.contains=function(e){return this.list.contains(e)};function Ls(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function nm(e){return e.cloneNode(!0)}var Rl={svg:"http://www.w3.org/2000/svg"},im='<svg xmlns="'+Rl.svg+'"';function rS(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(Rl.svg)===-1&&(e=im+e.substring(4)):(e=im+">"+e+"</svg>",t=!0);var n=oS(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function oS(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Te(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=rS(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Rl.svg,e),t&&we(n,t),n}var Cl=null;function rm(){return Cl===null&&(Cl=Te("svg")),Cl}function om(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function aS(e,t,n,i,r,o){var a=rm().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return om(a,e);case 6:return om(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function ra(e){return rm().createSVGTransform()}var am=/([&<>]{1})/g,sS=/([&<>\n\r"]{1})/g,cS={"&":"&","<":"<",">":">",'"':"'"};function Pl(e,t){function n(i,r){return cS[r]||r}return e.replace(t,n)}function sm(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Pl(e.textContent,am));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,'="',Pl(o.value,sS),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)sm(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",Pl(e.nodeValue,am),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function uS(e){for(var t=e.firstChild,n=[];t;)sm(t,n),t=t.nextSibling;return n.join("")}function cm(e,t){return uS(e)}function Kt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function lS(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function pS(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(lS(e,i))}function oa(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),pS(n,t)),n.consolidate()}const fS=/^class[ {]/;function dS(e){return fS.test(e.toString())}function Al(e){return Array.isArray(e)}function Ml(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Is(...e){e.length===1&&Al(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const hS=/constructor\s*[^(]*\(\s*([^)]*)\)/m,mS=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,gS=/\/\*([^*]*)\*\//m;function yS(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(dS(e)?hS:mS);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(gS);return(r&&r[1]||i).trim()})||[]}function um(e,t){const n=t||{get:function(b,x){if(i.push(b),x===!1)return null;throw s(`No provider for "${b}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(b){const x=i.join(" -> ");return i.length=0,new Error(x?`${b} (Resolving: ${x})`:b)};function c(b,x){if(!r[b]&&b.includes(".")){const C=b.split(".");let M=c(C.shift());for(;C.length;)M=M[C.shift()];return M}if(Ml(o,b))return o[b];if(Ml(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(Al(b))b=Is(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const M=(b.$inject||yS(b)).map(k=>Ml(x,k)?x[k]:c(k));return{fn:b,dependencies:M}}function l(b){const{fn:x,dependencies:C}=u(b),M=Function.prototype.bind.call(x,null,...C);return new M}function p(b,x,C){const{fn:M,dependencies:k}=u(b,C);return M.apply(x,k)}function f(b){return Is(x=>b.get(x))}function d(b,x){if(x&&x.length){const C=Object.create(null),M=Object.create(null),k=[],A=[],B=[];let D,L,z,ie;for(let ge in r)D=r[ge],x.indexOf(ge)!==-1&&(D[2]==="private"?(L=k.indexOf(D[3]),L===-1?(z=D[3].createChild([],x),ie=f(z),k.push(D[3]),A.push(z),B.push(ie),C[ge]=[ie,ge,"private",z]):C[ge]=[B[L],ge,"private",A[L]]):C[ge]=[D[2],D[1]],M[ge]=!0),(D[2]==="factory"||D[2]==="type")&&D[1].$scope&&x.forEach(Ue=>{D[1].$scope.indexOf(Ue)!==-1&&(C[ge]=[D[2],D[1]],M[Ue]=!0)});x.forEach(ge=>{if(!M[ge])throw new Error('No provider for "'+ge+'". Cannot use provider from the parent!')}),b.unshift(C)}return new um(b,a)}const m={factory:p,type:l,value:function(b){return b}};function h(b,x){const C=b.__init__||[];return function(){C.forEach(M=>{typeof M=="string"?x.get(M):x.invoke(M)})}}function v(b){const x=b.__exports__;if(x){const C=b.__modules__,M=Object.keys(b).reduce((L,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&(L[z]=b[z]),L),Object.create(null)),k=(C||[]).concat(M),A=d(k),B=Is(function(L){return A.get(L)});x.forEach(function(L){r[L]=[B,L,"private",A]});const D=(b.__init__||[]).slice();return D.unshift(function(){A.init()}),b=Object.assign({},b,{__init__:D}),h(b,A)}return Object.keys(b).forEach(function(C){if(C==="__init__"||C==="__depends__")return;const M=b[C];if(M[2]==="private"){r[C]=M;return}const k=M[0],A=M[1];r[C]=[m[k],vS(k,A),k]}),h(b,a)}function y(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(y,b),b.indexOf(x)!==-1)?b:b.concat(x)}function g(b){const x=b.reduce(y,[]).map(v);let C=!1;return function(){C||(C=!0,x.forEach(M=>M()))}}this.get=c,this.invoke=p,this.instantiate=l,this.createChild=d,this.init=g(e)}function vS(e,t){return e!=="value"&&Al(t)&&(t=Is(t.slice())),t}var bS=1e3;function Li(e,t){var n=this;t=t||bS,e.on(["render.shape","render.connection"],t,function(i,r){var o=i.type,a=r.element,s=r.gfx,c=r.attrs;if(n.canRender(a))return o==="render.shape"?n.drawShape(s,a,c):n.drawConnection(s,a,c)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(i,r){if(n.canRender(r))return i.type==="render.getShapePath"?n.getShapePath(r):n.getConnectionPath(r)})}Li.prototype.canRender=function(e){},Li.prototype.drawShape=function(e,t){},Li.prototype.drawConnection=function(e,t){},Li.prototype.getShapePath=function(e){},Li.prototype.getConnectionPath=function(e){};function Br(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function xS(e){return["M",e.x,e.y]}function Tl(e){return["L",e.x,e.y]}function _S(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function wS(e,t){const n=e.length,i=[xS(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(Tl(a));continue}const c=Math.min(t,kl(a.x-o.x,a.y-o.y),kl(s.x-a.x,s.y-a.y));if(!c){i.push(Tl(a));continue}const u=Bs(a,o,c),l=Bs(a,o,c*.5),p=Bs(a,s,c),f=Bs(a,s,c*.5);i.push(Tl(u)),i.push(_S(l,f,p))}return i}function Bs(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=kl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function kl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function aa(e,t,n){Be(t)&&(n=t,t=null),t||(t={});const i=Te("path",t);return Be(n)&&(i.dataset.cornerRadius=String(n)),Ol(i,e)}function Ol(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return we(e,{d:Br(wS(t,n))}),e}function Ns(e){var t=new Set(e);return Ye(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Nr(e,t,n){n=n||0,De(e)||(e=[e]),F(e,function(i,r){var o=t(i,r,n);De(o)&&o.length&&Nr(o,t,n+1)})}function Dl(e,t,n){var i=new Set,r=new Set;return Nr(e,function(o,a,s){i.add(o);var c=o.children;if(c&&!r.has(c))return r.add(c),c}),Array.from(i)}function sa(e,t){return Dl(e)}function ES(e,t,n){Tr(t)&&(t=!0),Qt(t)&&(n=t,t=!0),n=n||{};var i=ca(n.allShapes),r=ca(n.allConnections),o=ca(n.enclosedElements),a=ca(n.enclosedConnections),s=ca(n.topLevel,t&&oo(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,F(l.incoming,c),F(l.outgoing,c),l.children}return Nr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function $t(e,t){t=!!t,De(e)||(e=[e]);var n,i,r,o;return F(e,function(a){var s=a;a.waypoints&&!t&&(s=$t(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 yo(e,t){var n={};return F(e,function(i){var r=i;r.waypoints&&(r=$t(r)),!Be(t.y)&&r.x>t.x&&(n[i.id]=i),!Be(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Be(t.width)&&Be(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Be(t.width)||!Be(t.height))&&(n[i.id]=i)}),n}function lm(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function pm(e){return!!(e&&e.isFrame)}function ca(e,t){return V({},e||{},t||{})}var SS=1;function nr(e,t){Li.call(this,e,SS),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})}_e(nr,Li),nr.prototype.canRender=function(){return!0},nr.prototype.drawShape=function(t,n,i){var r=Te("rect");return we(r,{x:0,y:0,width:n.width||0,height:n.height||0}),pm(n)?we(r,V({},this.FRAME_STYLE,i||{})):we(r,V({},this.SHAPE_STYLE,i||{})),$e(t,r),r},nr.prototype.drawConnection=function(t,n,i){var r=aa(n.waypoints,V({},this.CONNECTION_STYLE,i||{}));return $e(t,r),r},nr.prototype.getShapePath=function(t){var n=t.x,i=t.y,r=t.width,o=t.height,a=[["M",n,i],["l",r,0],["l",0,o],["l",-r,0],["z"]];return Br(a)},nr.prototype.getConnectionPath=function(t){var n=t.waypoints,i,r,o=[];for(i=0;r=n[i];i++)r=r.original||r,o.push([i===0?"M":"L",r.x,r.y]);return Br(o)},nr.$inject=["eventBus","styles"];function RS(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return V(o,{class:n})},this.style=function(n,i){!De(n)&&!i&&(i=n,n=[]);var r=Tn(n,function(o,a){return V(o,e[a]||{})},{});return i?V(r,i):r},this.computeStyle=function(n,i,r){return De(i)||(r=i,i=[]),t.style(i||[],V({},r,n||{}))}}const CS={__init__:["defaultRenderer"],defaultRenderer:["type",nr],styles:["type",RS]};function Dt(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 Ll(e,t){return!e||!t?-1:e.indexOf(t)}function ua(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Il(e,t,n,i){if(typeof i>"u"&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=ua(e,t);return Math.abs(r/o)<=i}var PS=2;function Ii(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(AS(r,n))return o;return!1}function AS(e,t){const n=t[0];return kr(t,function(i){return Math.abs(n[e]-i[e])<=PS})}function fm(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 Bl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var MS=/,?([a-z]),?/gi,dm=parseFloat,Ft=Math,ir=Ft.PI,bi=Ft.min,xi=Ft.max,hm=Ft.pow,rr=Ft.abs,TS=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,kS=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,mm=Array.isArray||function(e){return e instanceof Array};function OS(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function DS(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 LS(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 OS(r,i)?(DS(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function IS(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(TS,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(kS,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=$l,n}function BS(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 NS(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 Nl(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 $l(){return this.join(",").replace(MS,"$1")}function $S(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=$l,t}function gm(e,t,n,i,r,o,a,s,c){var u=1-c,l=hm(u,3),p=hm(u,2),f=c*c,d=f*c,m=l*e+p*3*c*n+u*3*c*c*r+d*a,h=l*t+p*3*c*i+u*3*c*c*o+d*s;return{x:$s(m),y:$s(h)}}function ym(e){var t=VS(...e);return Nl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function or(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function FS(e,t){return e=Nl(e),t=Nl(t),or(t,e.x,e.y)||or(t,e.x2,e.y)||or(t,e.x,e.y2)||or(t,e.x2,e.y2)||or(e,t.x,t.y)||or(e,t.x2,t.y)||or(e,t.x,t.y2)||or(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}function vm(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 bm(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,m=0;m<l;m++){var h=u*p[m]+u,v=vm(h,e,n,r,a),y=vm(h,t,i,o,s),g=v*v+y*y;d+=f[m]*Ft.sqrt(g)}return u*d}function jS(e,t,n,i,r,o,a,s){if(!(xi(e,n)<bi(r,a)||bi(e,n)>xi(r,a)||xi(t,i)<bi(o,s)||bi(t,i)>xi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var p=$s(c/l),f=$s(u/l),d=+p.toFixed(2),m=+f.toFixed(2);if(!(d<+bi(e,n).toFixed(2)||d>+xi(e,n).toFixed(2)||d<+bi(r,a).toFixed(2)||d>+xi(r,a).toFixed(2)||m<+bi(t,i).toFixed(2)||m>+xi(t,i).toFixed(2)||m<+bi(o,s).toFixed(2)||m>+xi(o,s).toFixed(2)))return{x:p,y:f}}}}function $s(e){return Math.round(e*1e11)/1e11}function HS(e,t,n){var i=ym(e),r=ym(t);if(!FS(i,r))return[];var o=bm(...e),a=bm(...t),s=_m(e)?1:~~(o/5)||1,c=_m(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),p={},f=[],d,m;for(d=0;d<s+1;d++){var h=gm(...e,d/s);u[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=gm(...t,d/c),l[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(m=0;m<c;m++){var v=u[d],y=u[d+1],g=l[m],b=l[m+1],x=rr(y.x-v.x)<.01?"y":"x",C=rr(b.x-g.x)<.01?"y":"x",M=jS(v.x,v.y,y.x,y.y,g.x,g.y,b.x,b.y),k;if(M){if(k=M.x.toFixed(9)+"#"+M.y.toFixed(9),p[k])continue;p[k]=!0;var A=v.t+rr((M[x]-v[x])/(y[x]-v[x]))*(y.t-v.t),B=g.t+rr((M[C]-g[C])/(b[C]-g[C]))*(b.t-g.t);A>=0&&A<=1&&B>=0&&B<=1&&f.push({x:M.x,y:M.y,t1:A,t2:B})}}return f}function xm(e,t,n){e=Sm(e),t=Sm(t);for(var i,r,o,a,s,c,u,l,p,f,d=n?0:[],m=0,h=e.length;m<h;m++){var v=e[m];if(v[0]=="M")i=s=v[1],r=c=v[2];else{v[0]=="C"?(p=[i,r,...v.slice(1)],i=p[6],r=p[7]):(p=[i,r,i,r,s,c,s,c],i=s,r=c);for(var y=0,g=t.length;y<g;y++){var b=t[y];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=HS(p,f);{for(var C=0,M=x.length;C<M;C++)x[C].segment1=m,x[C].segment2=y,x[C].bez1=p,x[C].bez2=f;d=d.concat(x)}}}}}return d}function zS(e){return mm(e)&&mm(e[0])}function GS(e){if(BS(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 m=0,h=u.length;m<h;m++)c[m]=u[m];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=$l,t}function _m(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Fs(e,t,n,i){return[e,t,n,i,n,i]}function wm(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 Em(e,t,n,i,r,o,a,s,c,u){var l=ir*120/180,p=ir/180*(+r||0),f=[],d,m=LS(function(T,E,w){var G=T*Ft.cos(w)-E*Ft.sin(w),U=T*Ft.sin(w)+E*Ft.cos(w);return{x:G,y:U}});if(u)k=u[0],A=u[1],C=u[2],M=u[3];else{d=m(e,t,-p),e=d.x,t=d.y,d=m(s,c,-p),s=d.x,c=d.y;var h=(e-s)/2,v=(t-c)/2,y=h*h/(n*n)+v*v/(i*i);y>1&&(y=Ft.sqrt(y),n=y*n,i=y*i);var g=n*n,b=i*i,x=(o==a?-1:1)*Ft.sqrt(rr((g*b-g*v*v-b*h*h)/(g*v*v+b*h*h))),C=x*n*v/i+(e+s)/2,M=x*-i*h/n+(t+c)/2,k=Ft.asin(((t-M)/i).toFixed(9)),A=Ft.asin(((c-M)/i).toFixed(9));k=e<C?ir-k:k,A=s<C?ir-A:A,k<0&&(k=ir*2+k),A<0&&(A=ir*2+A),a&&k>A&&(k=k-ir*2),!a&&A>k&&(A=A-ir*2)}var B=A-k;if(rr(B)>l){var D=A,L=s,z=c;A=k+l*(a&&A>k?1:-1),s=C+n*Ft.cos(A),c=M+i*Ft.sin(A),f=Em(s,c,n,i,r,0,a,L,z,[A,D,C,M])}B=A-k;var ie=Ft.cos(k),ge=Ft.sin(k),Ue=Ft.cos(A),je=Ft.sin(A),K=Ft.tan(B/4),pe=4/3*n*K,ce=4/3*i*K,ye=[e,t],Me=[e+pe*ge,t-ce*ie],W=[s+pe*je,c-ce*Ue],Y=[s,c];if(Me[0]=2*ye[0]-Me[0],Me[1]=2*ye[1]-Me[1],u)return[Me,W,Y].concat(f);f=[Me,W,Y].concat(f).join().split(",");for(var te=[],Ae=0,gt=f.length;Ae<gt;Ae++)te[Ae]=Ae%2?m(f[Ae-1],f[Ae],p).y:m(f[Ae],f[Ae+1],p).x;return te}function VS(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,p,f,d,m,h,v,y,g=0;g<2;++g){if(g==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),rr(l)<1e-12){if(rr(p)<1e-12)continue;d=-f/p,0<d&&d<1&&c.push(d);continue}v=p*p-4*f*l,y=Ft.sqrt(v),!(v<0)&&(m=(-p+y)/(2*l),0<m&&m<1&&c.push(m),h=(-p-y)/(2*l),0<h&&h<1&&c.push(h))}for(var b=c.length,x=b,C;b--;)d=c[b],C=1-d,u[0][b]=C*C*C*e+3*C*C*d*n+3*C*d*d*r+d*d*d*a,u[1][b]=C*C*C*t+3*C*C*d*i+3*C*d*d*o+d*d*d*s;return u[0][x]=e,u[1][x]=t,u[0][x+1]=a,u[1][x+1]=s,u[0].length=u[1].length=x+2,{x0:bi(...u[0]),y0:bi(...u[1]),x1:xi(...u[0]),y1:xi(...u[1])}}function Sm(e){if(zS(e)||(e=IS(e)),NS(e))return e;for(var t=$S(GS(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(f,d,m){var h,v;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",...Em(d.x,d.y,...f.slice(1))];break;case"S":m=="C"||m=="S"?(h=d.x*2-d.bx,v=d.y*2-d.by):(h=d.x,v=d.y),f=["C",h,v,...f.slice(1)];break;case"T":m=="Q"||m=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),f=["C",...wm(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",...wm(d.x,d.y,f[1],f[2],f[3],f[4])];break;case"L":f=["C",...Fs(d.x,d.y,f[1],f[2])];break;case"H":f=["C",...Fs(d.x,d.y,f[1],d.y)];break;case"V":f=["C",...Fs(d.x,d.y,d.x,f[1])];break;case"Z":f=["C",...Fs(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 m=f[d];m.length;)o[d]="A",f.splice(d++,0,["C",...m.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=dm(l[p-4])||n.x,n.by=dm(l[p-3])||n.y}return t}function ft(e){return Qt(e)&&Mn(e,"waypoints")}function Ge(e){return Qt(e)&&Mn(e,"labelTarget")}function WS(e){return Qt(e)&&io(e.parent)}function Rm(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Bi(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Oe(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function js(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function US(e){return Bi({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function YS(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],m=d&&d.endLength||0,h=XS(f,l);u.push({start:f,end:l,startLength:m,endLength:m+h,length:h})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function Le(e){return ft(e)?YS(e):US(e)}function cn(e,t,n){n=n||0,Qt(n)||(n={x:n,y:n});var i=Oe(e),r=Oe(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,u=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function la(e,t,n){var i=qS(e,t);return i.length===1||i.length===2&&ua(i[0],i[1])<1?Bi(i[0]):i.length>1?(i=di(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Bi(i[n?0:i.length-1])):null}function qS(e,t){return xm(e,t)}function KS(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],ua(n,r)===0||Il(i,r,n)?e.splice(t,1):t++;return e}function XS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Hs(e,t){return Math.round(e*t)/t}function Cm(e){return Be(e)?e+"px":e}function ZS(e){for(;e.parent;)e=e.parent;return e}function QS(e){e=V({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),_n(n,{position:"relative",overflow:"hidden",width:Cm(e.width),height:Cm(e.height)}),t.appendChild(n),n}function Pm(e,t,n){const i=Te("g");Qe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const JS="base",Am=0,eR=1,tR={shape:["x","y","width","height"],connection:["waypoints"]};function Ie(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}Ie.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Ie.prototype._init=function(e){const t=this._eventBus,n=this._container=QS(e),i=this._svg=Te("svg");we(i,{width:"100%",height:"100%"}),mn(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")}),$e(n,i);const r=this._viewport=Pm(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Uu(this._viewboxChanged,300)),this._restoreFocus=Uu(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Ie.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},Ie.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Ie.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=lm(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Ie.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Ie.prototype.restoreFocus=function(){this._restoreFocus()},Ie.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Ie.prototype.isFocused=function(){return this._focused},Ie.prototype.getDefaultLayer=function(){return this.getLayer(JS,Am)},Ie.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},Ie.prototype._getChildIndex=function(e){return Tn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Ie.prototype._createLayer=function(e,t){typeof t>"u"&&(t=eR);const n=this._getChildIndex(t);return{group:Pm(this._viewport,"layer-"+e,n),index:t,visible:!0}},Ie.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},Ie.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(Kt(n),t.visible=!1),n},Ie.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Kt(t.group))},Ie.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Ie.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(ZS(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Ie.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Ie.prototype._findPlaneForRoot=function(e){return mt(this._planes,function(t){return t.rootElement===e})},Ie.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Ie.prototype._resolveElements=function(e){return De(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Ie.prototype.getContainer=function(){return this._container},Ie.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(F([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Qe(r).add(t)):(e.markers.delete(t),Qe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ie.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ie.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ie.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Ie.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ie.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Ie.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,Am);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Ie.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},Ie.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},Ie.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},Ie.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},Ie.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},Ie.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=tR[e];if(!kr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ie.prototype._setParent=function(e,t,n){Lt(t.children,e,n),e.parent=t},Ie.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},Ie.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ie.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ie.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),Dt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Ie.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ie.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ie.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ie.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ie.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ie.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);oa(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=oa(t),r=a?a.matrix:aS(),s=Hs(r.a,1e3),c=Hs(-r.e||0,1e3),u=Hs(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},Ie.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=V({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Mm(t,n)}),{x:n.e,y:n.f}},Ie.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(m=>m!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=$t(o),s=Oe(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=Oe(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,p=a.y-c.y;else{const m=Math.max(0,s.right-f.right),h=Math.min(0,s.left-f.left),v=Math.max(0,s.bottom-f.bottom),y=Math.min(0,s.top-f.top);l=m||h,p=v||y}this.scroll({dx:-l*u,dy:-p*u})},Ie.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Hs(i.a,1e3)};function Mm(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ie.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},Ie.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const p=c.a;return t?(a=V(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),Mm(this._viewport,l),l},Ie.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ie.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},Ie.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var vo="data-element-id";function Un(e){this._elements={},this._eventBus=e}Un.$inject=["eventBus"],Un.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),we(t,vo,i),n&&we(n,vo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Un.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(we(i.gfx,vo,""),i.secondaryGfx&&we(i.secondaryGfx,vo,""),delete t[n])},Un.prototype.updateId=function(e,t){this._validateId(t),typeof e=="string"&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},Un.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&we(t,vo,i),t},Un.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&we(e,vo);var n=this._elements[t];return n&&n.element},Un.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Un.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=n[i],o=t[r],a=o.element,s=o.gfx;if(e(a,s))return a}},Un.prototype.getAll=function(){return this.filter(function(e){return e})},Un.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},Un.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Un.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};function nR(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 iR(e){return e.__refs_collection===!0}function rR(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Tm(e,t,n){var i=nR(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 oR(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 Zn(e,t){if(!(this instanceof Zn))return new Zn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Zn.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?Tm(this,t,e):oR(this,t,e)},Zn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return iR(n)||Tm(this,t,e),n},Zn.prototype.ensureBound=function(e,t){rR(e,t)||this.bind(e,t)},Zn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Zn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Fl=new Zn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),km=new Zn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Om=new Zn({name:"attachers",collection:!0},{name:"host"}),Dm=new Zn({name:"outgoing",collection:!0},{name:"source"}),Lm=new Zn({name:"incoming",collection:!0},{name:"target"});function bo(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),Fl.bind(this,"parent"),km.bind(this,"labels"),Dm.bind(this,"outgoing"),Lm.bind(this,"incoming")}function pa(){bo.call(this),Fl.bind(this,"children"),Om.bind(this,"host"),Om.bind(this,"attachers")}_e(pa,bo);function Im(){bo.call(this),Fl.bind(this,"children")}_e(Im,pa);function Bm(){pa.call(this),km.bind(this,"labelTarget")}_e(Bm,pa);function Nm(){bo.call(this),Dm.bind(this,"source"),Lm.bind(this,"target")}_e(Nm,bo);var aR={connection:Nm,shape:pa,label:Bm,root:Im};function sR(e,t){var n=aR[e];if(!n)throw new Error("unknown type: <"+e+">");return V(new n,t)}function cR(e){return e instanceof bo}function Ni(){this._uid=12}Ni.prototype.createRoot=function(e){return this.create("root",e)},Ni.prototype.createLabel=function(e){return this.create("label",e)},Ni.prototype.createShape=function(e){return this.create("shape",e)},Ni.prototype.createConnection=function(e){return this.create("connection",e)},Ni.prototype.create=function(e,t){return t=V({},t||{}),t.id||(t.id=e+"_"+this._uid++),sR(e,t)};var zs="__fn",$m=1e3,uR=Array.prototype.slice;function Dn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Dn.prototype.on=function(e,t,n,i){if(e=De(e)?e:[e],Jt(t)&&(i=n,n=t,t=$m),!Be(t))throw new Error("priority must be a number");var r=n;i&&(r=Sn(n,i),r[zs]=n[zs]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Dn.prototype.once=function(e,t,n,i){var r=this;if(Jt(t)&&(i=n,n=t,t=$m),!Be(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[zs]=n,this.on(e,t,o)},Dn.prototype.off=function(e,t){e=De(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Dn.prototype.createEvent=function(e){var t=new fa;return t.init(e),t},Dn.prototype.fire=function(e,t){var n,i,r,o;if(o=uR.call(arguments),typeof e=="object"&&(t=e,e=t.type),!e)throw new Error("no event type specified");if(i=this._listeners[e],!!i){t instanceof fa?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Dn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Dn.prototype._destroy=function(){this._listeners={}},Dn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Dn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=lR(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},Dn.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},Dn.prototype._getListeners=function(e){return this._listeners[e]},Dn.prototype._setListeners=function(e,t){this._listeners[e]=t},Dn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[zs]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function fa(){}fa.prototype.stopPropagation=function(){this.cancelBubble=!0},fa.prototype.preventDefault=function(){this.defaultPrevented=!0},fa.prototype.init=function(e){V(this,e||{})};function lR(e,t){return e.apply(null,t)}function $r(e){return e.childNodes[0]}function pR(e){return e.parentNode.childNodes[1]}function Gs(e,t,n,i,r){var o=ra();o.setTranslate(t,n);var a=ra();a.setRotate(i||0,0,0);var s=ra();s.setScale(1,1),oa(e,[o,a,s])}function un(e,t,n){var i=ra();i.setTranslate(t,n),oa(e,i)}function Fm(e,t){var n=ra();n.setRotate(t,0,0),oa(e,n)}function Yn(e,t){this._eventBus=e,this._elementRegistry=t}Yn.$inject=["eventBus","elementRegistry"],Yn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=pR(t),n||(n=Te("g"),Qe(n).add("djs-children"),$e(t.parentNode,n))):n=t,n},Yn.prototype._clear=function(e){var t=$r(e);return ks(t),t},Yn.prototype._createContainer=function(e,t,n,i){var r=Te("g");Qe(r).add("djs-group"),typeof n<"u"?fR(r,t,t.childNodes[n]):$e(t,r);var o=Te("g");Qe(o).add("djs-element"),Qe(o).add("djs-"+e),i&&Qe(o).add("djs-frame"),$e(r,o);var a=Te("g");return Qe(a).add("djs-visual"),$e(o,a),o},Yn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,pm(t))},Yn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Tn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),F(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;F(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Yn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Yn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Yn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Yn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Yn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),un(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?we(n,"display","none"):we(n,"display","block")}},Yn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Kt(t.parentNode)};function fR(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const dR={__depends__:[CS],__init__:["canvas"],canvas:["type",Ie],elementRegistry:["type",Un],elementFactory:["type",Ni],eventBus:["type",Dn],graphicsFactory:["type",Yn]};function hR(e){var t=new um(e);return t.init(),t}function mR(e){e=e||{};var t={config:["value",e]},n=[t,dR].concat(e.modules||[]);return hR(n)}function ar(e,t){this._injector=t||mR(e),this.get("eventBus").fire("diagram.init")}ar.prototype.get=function(e,t){return this._injector.get(e,t)},ar.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ar.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ar.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function gn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Rn(e,t){return e.$instanceOf(t)}function gR(e){return mt(e.rootElements,function(t){return Rn(t,"bpmn:Process")||Rn(t,"bpmn:Collaboration")})}function yR(e){var t={},n=[],i={};function r(W,Y){return function(te){W(te,Y)}}function o(W){t[W.id]=W}function a(W){return t[W.id]}function s(W,Y){var te=W.gfx;if(te)throw new Error(`already rendered ${gn(W)}`);return e.element(W,i[W.id],Y)}function c(W,Y){return e.root(W,i[W.id],Y)}function u(W,Y){try{var te=i[W.id]&&s(W,Y);return o(W),te}catch(Ae){l(Ae.message,{element:W,error:Ae}),console.error(`failed to import ${gn(W)}`,Ae)}}function l(W,Y){e.error(W,Y)}var p=this.registerDi=function(Y){var te=Y.bpmnElement;te?i[te.id]?l(`multiple DI elements defined for ${gn(te)}`,{element:te}):i[te.id]=Y:l(`no bpmnElement referenced in ${gn(Y)}`,{element:Y})};function f(W){d(W.plane)}function d(W){p(W),F(W.planeElement,m)}function m(W){p(W)}this.handleDefinitions=function(Y,te){var Ae=Y.diagrams;if(te&&Ae.indexOf(te)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!te&&Ae&&Ae.length&&(te=Ae[0]),!te)throw new Error("no diagram to display");i={},f(te);var gt=te.plane;if(!gt)throw new Error(`no plane for ${gn(te)}`);var T=gt.bpmnElement;if(!T)if(T=gR(Y),T)l(`correcting missing bpmnElement on ${gn(gt)} to ${gn(T)}`),gt.bpmnElement=T,p(gt);else throw new Error("no process or collaboration to display");var E=c(T,gt);if(Rn(T,"bpmn:Process")||Rn(T,"bpmn:SubProcess"))v(T,E);else if(Rn(T,"bpmn:Collaboration"))ye(T,E),y(Y.rootElements,E);else throw new Error(`unsupported bpmnElement for ${gn(gt)}: ${gn(T)}`);h(n)};var h=this.handleDeferred=function(){for(var Y;n.length;)Y=n.shift(),Y()};function v(W,Y){K(W,Y),B(W.ioSpecification,Y),A(W.artifacts,Y),o(W)}function y(W,Y){var te=Ye(W,function(Ae){return!a(Ae)&&Rn(Ae,"bpmn:Process")&&Ae.laneSets});te.forEach(r(v,Y))}function g(W,Y){u(W,Y)}function b(W,Y){F(W,r(g,Y))}function x(W,Y){u(W,Y)}function C(W,Y){u(W,Y)}function M(W,Y){u(W,Y)}function k(W,Y){u(W,Y)}function A(W,Y){F(W,function(te){Rn(te,"bpmn:Association")?n.push(function(){k(te,Y)}):k(te,Y)})}function B(W,Y){W&&(F(W.dataInputs,r(C,Y)),F(W.dataOutputs,r(M,Y)))}var D=this.handleSubProcess=function(Y,te){K(Y,te),A(Y.artifacts,te)};function L(W,Y){var te=u(W,Y);Rn(W,"bpmn:SubProcess")&&D(W,te||Y),Rn(W,"bpmn:Activity")&&B(W.ioSpecification,Y),n.push(function(){F(W.dataInputAssociations,r(x,Y)),F(W.dataOutputAssociations,r(x,Y))})}function z(W,Y){u(W,Y)}function ie(W,Y){u(W,Y)}function ge(W,Y){n.push(function(){var te=u(W,Y);W.childLaneSet&&Ue(W.childLaneSet,te||Y),Me(W)})}function Ue(W,Y){F(W.lanes,r(ge,Y))}function je(W,Y){F(W,r(Ue,Y))}function K(W,Y){pe(W.flowElements,Y),W.laneSets&&je(W.laneSets,Y)}function pe(W,Y){F(W,function(te){Rn(te,"bpmn:SequenceFlow")?n.push(function(){z(te,Y)}):Rn(te,"bpmn:BoundaryEvent")?n.unshift(function(){L(te,Y)}):Rn(te,"bpmn:FlowNode")?L(te,Y):Rn(te,"bpmn:DataObject")||(Rn(te,"bpmn:DataStoreReference")||Rn(te,"bpmn:DataObjectReference")?ie(te,Y):l(`unrecognized flowElement ${gn(te)} in context ${gn(Y&&Y.businessObject)}`,{element:te,context:Y}))})}function ce(W,Y){var te=u(W,Y),Ae=W.processRef;Ae&&v(Ae,te||Y)}function ye(W,Y){F(W.participants,r(ce,Y)),n.push(function(){b(W.messageFlows,Y)}),A(W.artifacts,Y)}function Me(W){F(W.flowNodeRef,function(Y){var te=Y.get("lanes");te&&te.push(W)})}}function S(e,t){var n=ne(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function We(e,t){return Xi(t,function(n){return S(e,n)})}function ne(e){return e&&e.businessObject||e}function tt(e){return e&&e.di}function vR(e,t,n){var i,r,o,a,s=[];function c(u,l){var p={root:function(h,v){return i.add(h,v)},element:function(h,v,y){return i.add(h,v,y)},error:function(h,v){s.push({message:h,context:v})}},f=new yR(p);l=l||u.diagrams&&u.diagrams[0];var d=bR(u,l);if(!d)throw new Error("no diagram to display");F(d,function(h){f.handleDefinitions(u,h)});var m=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(m+"_plane")||o.findRoot(m))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(p){return p.warnings=s,l(p)}})}function bR(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!S(n,"bpmn:Process")&&!S(n,"bpmn:Collaboration")&&(i=xR(n));var r;S(i,"bpmn:Collaboration")?r=i:r=mt(e.rootElements,function(u){if(S(u,"bpmn:Collaboration"))return mt(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=dn(r.participants,function(u){return u.processRef}),o.push(r));var a=jm(o),s=[t],c=[n];return F(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 jm(e){var t=[];return F(e,function(n){n&&(t.push(n),t=t.concat(jm(n.flowElements)))}),t}function xR(e){for(var t=e;t;){if(S(t,"bpmn:Process"))return t;t=t.$parent}}var _R='<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>',Hm=_R,zm={verticalAlign:"middle"},Gm={color:"#404040"},wR={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},ER={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},SR={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"},RR='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Hm+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',_i;function CR(){_i=bt(RR),_n(_i,wR),_n(pt("svg",_i),zm),_n(pt(".backdrop",_i),ER),_n(pt(".notice",_i),SR),_n(pt(".link",_i),Gm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function PR(){_i||(CR(),On.bind(_i,".backdrop","click",function(e){document.body.removeChild(_i)})),document.body.appendChild(_i)}const Vs=5,Vm="djs-outline-hidden";function St(e){e=V({},MR,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),kR(this._container)}_e(St,ar),St.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(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||[]),Ws(s,o),s=AR(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},St.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},St.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Ws(o,[]),o}if(typeof t=="string"&&(i=TR(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Ws(o,[]),o}try{this.clear()}catch(o){throw Ws(o,[]),o}const{warnings:r}=await vR(this,n,i);return{warnings:r}},St.prototype.saveXML=async function(t){t=t||{};let n=this._definitions,i,r;try{if(!n)throw new Error("no definitions loaded");n=this._emit("saveXML.start",{definitions:n})||n,r=(await this._moddle.toXML(n,t)).xml,r=this._emit("saveXML.serialized",{xml:r})||r}catch(a){i=a}const o=i?{error:i}:{xml:r};if(this._emit("saveXML.done",o),i)throw i;return o},St.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=pt(":scope > defs",i._svg),a=cm(r),s=o?"<defs>"+cm(o)+"</defs>":"",c=i.getContainer();wt(c).add(Vm);let u;try{u=r.getBBox()}finally{wt(c).remove(Vm)}const l=u.x-Vs,p=u.y-Vs,f=u.width+Vs*2,d=u.height+Vs*2;t=`<?xml version="1.0" encoding="utf-8"?>
|
|
8
8
|
<!-- created with bpmn-js / http://bpmn.io -->
|
|
9
9
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
10
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+l+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Et.prototype._setDefinitions=function(e){this._definitions=e},Et.prototype.getModules=function(){return this._modules},Et.prototype.clear=function(){this.getDefinitions()&&ar.prototype.clear.call(this)},Et.prototype.destroy=function(){ar.prototype.destroy.call(this),vi(this._container)},Et.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Et.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Et.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=pt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Et.prototype.getDefinitions=function(){return this._definitions},Et.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Et.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=V(hi(n,["additionalModules"]),{canvas:V({},n.canvas,{container:e}),modules:a});ar.call(this,s),n&&n.container&&this.attachTo(n.container)},Et.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Et.prototype._createContainer=function(e){const t=bt('<div class="bjs-container"></div>');return _n(t,{width:Vm(e.width),height:Vm(e.height),position:e.position}),t},Et.prototype._createModdle=function(e){const t=V({},this._moddleExtensions,e.moddleExtensions);return new Vd(t)},Et.prototype._modules=[];function Ws(e,t){return e.warnings=t,e}function CR(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 PR={width:"100%",height:"100%",position:"relative"};function Vm(e){return e+(Be(e)?"px":"")}function AR(e,t){return t&&mt(e.diagrams,function(n){return n.id===t})||null}function TR(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+jm+"</a>",i=bt(n);_n(pt("svg",i),Hm),_n(i,zm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ne.bind(i,"click",function(r){RR(),r.preventDefault()})}function xo(e){Et.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)}_e(xo,Et),xo.prototype._createModdle=function(e){var t=Et.prototype._createModdle.call(this,e);return t.ids=new yi([32,36,1]),t},xo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function Xe(e,t){return S(e,"bpmn:CallActivity")?!1:S(e,"bpmn:SubProcess")?(t=t||tt(e),t&&S(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):S(e,"bpmn:Participant")?!!ne(e).processRef:!0}function tn(e){if(!(!S(e,"bpmn:Participant")&&!S(e,"bpmn:Lane"))){var t=tt(e).isHorizontal;return t===void 0?!0:t}}function MR(e){return e&&ne(e).isInterrupting!==!1}function yn(e){return e&&!!ne(e).triggeredByEvent}function _o(e,t){var n=ne(e).eventDefinitions;return Xi(n,function(i){return S(i,t)})}function kR(e){return _o(e,"bpmn:ErrorEventDefinition")}function OR(e){return _o(e,"bpmn:EscalationEventDefinition")}function DR(e){return _o(e,"bpmn:CompensateEventDefinition")}var Fr={width:90,height:20},Wm=15;function sr(e){return S(e,"bpmn:Event")||S(e,"bpmn:Gateway")||S(e,"bpmn:DataStoreReference")||S(e,"bpmn:DataObjectReference")||S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput")||S(e,"bpmn:SequenceFlow")||S(e,"bpmn:MessageFlow")||S(e,"bpmn:Group")}function Us(e){return Ge(e.label)}function LR(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=IR(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-=Wm:a+=Wm,{x:a,y:s}}function IR(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 jl(e){return e.waypoints?LR(e.waypoints):S(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Fr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Fr.height/2}}function BR(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Fr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=jl(t),i=Fr),V({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Um(e){if(S(e,"bpmn:FlowElement")||S(e,"bpmn:Participant")||S(e,"bpmn:Lane")||S(e,"bpmn:SequenceFlow")||S(e,"bpmn:MessageFlow")||S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput"))return"name";if(S(e,"bpmn:TextAnnotation"))return"text";if(S(e,"bpmn:Group"))return"categoryValueRef"}function NR(e){var t=e.categoryValueRef;return t&&t.value||""}function qn(e){var t=e.businessObject,n=Um(t);if(n)return n==="categoryValueRef"?NR(t):t[n]||""}function $R(e,t){var n=e.businessObject,i=Um(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function FR(e){return Ge(e)&&sr(e.labelTarget)}var wo=7;function Ym(e){let t=[];return F(e.incoming,n=>{S(n,"bpmn:Association")&&S(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),F(e.outgoing,n=>{S(n,"bpmn:Association")&&S(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function da(e){const t=new Map;return F(Dl(e),n=>{F(Ym(n),i=>{t.has(i.annotation)||t.set(i.annotation,{annotation:i.annotation,associations:[]}),t.get(i.annotation).associations.push(i.association)})}),[...t.values()]}var Hl="hsl(225, 10%, 15%)",jR="white";function wi(e,t){return Xi(e.eventDefinitions,function(n){return n.$type===t})}function HR(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function zR(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function qe(e,t,n){var i=tt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||jR}function ve(e,t,n){var i=tt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Hl}function ha(e,t,n,i){var r=tt(e),o=r.get("label");return i||o&&o.get("color:color")||t||ve(e,n)}function qm(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 Br(r)}function zl(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 Br(a)}function GR(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 Br(s)}function VR(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 Br(o)}function ma(e,t={}){return{width:Qn(e,t),height:Ln(e,t)}}function Qn(e,t={}){return Tn(t,"width")?t.width:e.width}function Ln(e,t={}){return Tn(t,"height")?t.height:e.height}var WR=new yi,UR=10,Ys=3,YR=1.5,qs=10,qR=4,Eo=.95,KR=1,XR=.25;function jr(e,t,n,i,r,o,a){Li.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(M){return n.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Hl,strokeWidth:2,fill:"white"})}function p(M){return n.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Hl,strokeWidth:2})}function f(M,E){var{ref:w={x:0,y:0},scale:G=1,element:U,parentGfx:X=r._svg}=E,Ee=Me("marker",{id:M,viewBox:"0 0 20 20",refX:w.x,refY:w.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});$e(Ee,U);var He=pt(":scope > defs",X);He||(He=Me("defs"),$e(X,He)),$e(He,Ee)}function d(M,E,w,G){var U=WR.nextPrefixed("marker-");return m(M,U,E,w,G),"url(#"+U+")"}function m(M,E,w,G,U){if(w==="sequenceflow-end"){var X=Me("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:U,stroke:U,strokeWidth:1})});f(E,{element:X,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(w==="messageflow-start"){var Ee=Me("circle",{cx:6,cy:6,r:3.5,...l({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});f(E,{element:Ee,ref:{x:6,y:6},parentGfx:M})}if(w==="messageflow-end"){var He=Me("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});f(E,{element:He,ref:{x:8.5,y:5},parentGfx:M})}if(w==="association-start"){var it=Me("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(E,{element:it,ref:{x:1,y:10},scale:.5,parentGfx:M})}if(w==="association-end"){var Pt=Me("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(E,{element:Pt,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(w==="conditional-flow-marker"){var lt=Me("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:G,stroke:U})});f(E,{element:lt,ref:{x:-1,y:10},scale:.5,parentGfx:M})}if(w==="conditional-default-flow-marker"){var zt=Me("path",{d:"M 6 4 L 10 16",...l({stroke:U,fill:"none"})});f(E,{element:zt,ref:{x:0,y:10},scale:.5,parentGfx:M})}}function h(M,E,w,G,U={}){Qt(G)&&(U=G,G=0),G=G||0,U=l(U);var X=E/2,Ee=w/2,He=Me("circle",{cx:X,cy:Ee,r:Math.round((E+w)/4-G),...U});return $e(M,He),He}function b(M,E,w,G,U,X){Qt(U)&&(X=U,U=0),U=U||0,X=l(X);var Ee=Me("rect",{x:U,y:U,width:E-U*2,height:w-U*2,rx:G,ry:G,...X});return $e(M,Ee),Ee}function y(M,E,w,G){var U=E/2,X=w/2,Ee=[{x:U,y:0},{x:E,y:X},{x:U,y:w},{x:0,y:X}],He=Ee.map(function(Pt){return Pt.x+","+Pt.y}).join(" ");G=l(G);var it=Me("polygon",{...G,points:He});return $e(M,it),it}function g(M,E,w,G){w=p(w);var U=aa(E,w,G);return $e(M,U),U}function v(M,E,w){return g(M,E,w,5)}function x(M,E,w){w=p(w);var G=Me("path",{...w,d:E});return $e(M,G),G}function C(M,E,w,G){return x(E,w,V({"data-marker":M},G))}function T(M){return gt[M]}function k(M){return function(E,w,G){return T(M)(E,w,G)}}var A={"bpmn:MessageEventDefinition":function(M,E,w={},G){var U=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.235,my:.315}}),X=G?ve(E,c,w.stroke):qe(E,s,w.fill),Ee=G?qe(E,s,w.fill):ve(E,c,w.stroke),He=x(M,U,{fill:X,stroke:Ee,strokeWidth:1});return He},"bpmn:TimerEventDefinition":function(M,E,w={}){var G=w.width||E.width,U=w.height||E.height,X=w.width?1:2,Ee=h(M,G,U,.2*U,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:X}),He=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}});x(M,He,{stroke:ve(E,c,w.stroke),strokeWidth:X});for(var it=0;it<12;it++){var Pt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}}),lt=G/2,zt=U/2;x(M,Pt,{strokeWidth:1,stroke:ve(E,c,w.stroke),transform:"rotate("+it*30+","+zt+","+lt+")"})}return Ee},"bpmn:EscalationEventDefinition":function(M,E,w={},G){var U=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.5,my:.2}}),X=G?ve(E,c,w.stroke):qe(E,s,w.fill);return x(M,U,{fill:X,stroke:ve(E,c,w.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(M,E,w={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.5,my:.222}});return x(M,G,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(M,E,w={},G){var U=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.57,my:.263}}),X=G?ve(E,c,w.stroke):qe(E,s,w.fill);return x(M,U,{fill:X,stroke:ve(E,c,w.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(M,E,w={},G){var U=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.2,my:.722}}),X=G?ve(E,c,w.stroke):qe(E,s,w.fill);return x(M,U,{fill:X,stroke:ve(E,c,w.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(M,E,w={},G){var U=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.638,my:-.055}}),X=G?ve(E,c,w.stroke):"none",Ee=x(M,U,{fill:X,stroke:ve(E,c,w.stroke),strokeWidth:1});return $m(Ee,45),Ee},"bpmn:CompensateEventDefinition":function(M,E,w={},G){var U=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.22,my:.5}}),X=G?ve(E,c,w.stroke):qe(E,s,w.fill);return x(M,U,{fill:X,stroke:ve(E,c,w.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(M,E,w={},G){var U=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.5,my:.2}}),X=G?ve(E,c,w.stroke):qe(E,s,w.fill);return x(M,U,{strokeWidth:1,fill:X,stroke:ve(E,c,w.stroke)})},"bpmn:MultipleEventDefinition":function(M,E,w={},G){var U=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.211,my:.36}}),X=G?ve(E,c,w.stroke):qe(E,s,w.fill);return x(M,U,{fill:X,stroke:ve(E,c,w.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(M,E,w={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.458,my:.194}});return x(M,G,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(M,E,w={}){var G=h(M,E.width,E.height,8,{fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke),strokeWidth:4});return G}};function B(M,E,w={},G){var U=ne(M),X=HR(U),Ee=G||M;return U.get("eventDefinitions")&&U.get("eventDefinitions").length>1?U.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](E,Ee,w,X):A["bpmn:MultipleEventDefinition"](E,Ee,w,X):wi(U,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](E,Ee,w,X):wi(U,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](E,Ee,w,X):wi(U,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](E,Ee,w,X):wi(U,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](E,Ee,w,X):wi(U,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](E,Ee,w,X):wi(U,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](E,Ee,w,X):wi(U,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](E,Ee,w,X):wi(U,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](E,Ee,w,X):wi(U,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](E,Ee,w,X):wi(U,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](E,Ee,w,X):null}var D={ParticipantMultiplicityMarker:function(M,E,w={}){var G=Qn(E,w),U=Ln(E,w),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2-6)/G,my:(U-15)/U}});C("participant-multiplicity",M,X,{strokeWidth:2,fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke)})},SubProcessMarker:function(M,E,w={}){var G=b(M,14,14,0,{strokeWidth:1,fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke)});un(G,E.width/2-7.5,E.height-20);var U=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}});C("sub-process",M,U,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke)})},ParallelMarker:function(M,E,w){var G=Qn(E,w),U=Ln(E,w),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+w.parallel)/G,my:(U-20)/U}});C("parallel",M,X,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke)})},SequentialMarker:function(M,E,w){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+w.seq)/E.width,my:(E.height-19)/E.height}});C("sequential",M,G,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke)})},CompensationMarker:function(M,E,w){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+w.compensation)/E.width,my:(E.height-13)/E.height}});C("compensation",M,G,{strokeWidth:1,fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke)})},LoopMarker:function(M,E,w){var G=Qn(E,w),U=Ln(E,w),X=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+w.loop)/G,my:(U-7)/U}});C("loop",M,X,{strokeWidth:1.5,fill:"none",stroke:ve(E,c,w.stroke),strokeMiterlimit:.5})},AdhocMarker:function(M,E,w){var G=Qn(E,w),U=Ln(E,w),X=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+w.adhoc)/G,my:(U-15)/U}});C("adhoc",M,X,{strokeWidth:1,fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke)})}};function L(M,E,w,G){D[M](E,w,G)}function z(M,E,w=[],G={}){G={fill:G.fill,stroke:G.stroke,width:Qn(E,G),height:Ln(E,G)};var U=ne(E),X=w.includes("SubProcessMarker");X?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},U.get("isForCompensation")&&w.push("CompensationMarker"),S(U,"bpmn:AdHocSubProcess")&&(w.push("AdhocMarker"),X||V(G,{compensation:G.compensation-18}));var Ee=U.get("loopCharacteristics"),He=Ee&&Ee.get("isSequential");Ee&&(V(G,{compensation:G.compensation-18}),w.includes("AdhocMarker")&&V(G,{seq:-23,loop:-18,parallel:-24}),He===void 0&&w.push("LoopMarker"),He===!1&&w.push("ParallelMarker"),He===!0&&w.push("SequentialMarker")),w.includes("CompensationMarker")&&w.length===1&&V(G,{compensation:-8}),F(w,function(it){L(it,M,E,G)})}function ie(M,E,w={}){w=V({size:{width:100}},w);var G=o.createText(E||"",w);return Qe(G).add("djs-label"),$e(M,G),G}function ge(M,E,w,G={}){var U=ne(E),X=ma({x:E.x,y:E.y,width:E.width,height:E.height},G);return ie(M,U.name,{align:w,box:X,padding:7,style:{fill:ha(E,u,c,G.stroke)}})}function Ue(M,E,w={}){var G={width:E.width,height:E.height,x:E.width/2+E.x,y:E.height/2+E.y};return ie(M,qn(E),{box:G,style:V({},o.getExternalStyle(),{fill:ha(E,u,c,w.stroke)})})}function je(M,E,w,G={}){var U=tn(w),X=ie(M,E,{box:{height:30,width:U?Ln(w,G):Qn(w,G)},align:"center-middle",style:{fill:ha(w,u,c,G.stroke)}});if(U){var Ee=-1*Ln(w,G);Gs(X,0,-Ee,270)}}function K(M,E,w={}){var{width:G,height:U}=ma(E,w);return b(M,G,U,qs,{...w,fill:qe(E,s,w.fill),fillOpacity:Eo,stroke:ve(E,c,w.stroke)})}function pe(M,E,w={}){var G=ne(E),U=qe(E,s,w.fill),X=ve(E,c,w.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(w.markerEnd=d(M,"association-end",U,X)),G.get("associationDirection")==="Both"&&(w.markerStart=d(M,"association-start",U,X)),w=nt(w,["markerStart","markerEnd"]),v(M,E.waypoints,{...w,stroke:X,strokeDasharray:"0, 5"})}function ce(M,E,w={}){var G=qe(E,s,w.fill),U=ve(E,c,w.stroke),X=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}}),Ee=x(M,X,{fill:G,fillOpacity:Eo,stroke:U}),He=ne(E);if(zR(He)){var it=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.33,my:(E.height-18)/E.height}});x(M,it,{strokeWidth:2,fill:G,stroke:U})}return Ee}function ye(M,E,w={}){return h(M,E.width,E.height,{fillOpacity:Eo,...w,fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke)})}function Te(M,E,w={}){return y(M,E.width,E.height,{fill:qe(E,s,w.fill),fillOpacity:Eo,stroke:ve(E,c,w.stroke)})}function W(M,E,w={}){var G=b(M,Qn(E,w),Ln(E,w),0,{fill:qe(E,s,w.fill),fillOpacity:w.fillOpacity||Eo,stroke:ve(E,c,w.stroke),strokeWidth:1.5}),U=ne(E);if(S(U,"bpmn:Lane")){var X=U.get("name");je(M,X,E,w)}return G}function Y(M,E,w={}){var G=K(M,E,w),U=Xe(E);if(yn(E)&&(we(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!U)){var X=ne(E).flowElements||[],Ee=X.filter(He=>S(He,"bpmn:StartEvent"));Ee.length===1&&te(Ee[0],M,w,E)}return ge(M,E,U?"center-top":"center-middle",w),U?z(M,E,void 0,w):z(M,E,["SubProcessMarker"],w),G}function te(M,E,w,G){var U=22,X={fill:qe(G,s,w.fill),stroke:ve(G,c,w.stroke),width:U,height:U},Ee=ne(M).isInterrupting,He=Ee?0:3,it=Ee?1:1.2,Pt=20,lt=(U-Pt)/2,zt="translate("+lt+","+lt+")";h(E,Pt,Pt,{fill:X.fill,stroke:X.stroke,strokeWidth:it,strokeDasharray:He,transform:zt}),B(M,E,X,G)}function Ae(M,E,w={}){var G=K(M,E,w);return ge(M,E,"center-middle",w),z(M,E,void 0,w),G}var gt=this.handlers={"bpmn:AdHocSubProcess":function(M,E,w={}){return Xe(E)?w=nt(w,["fill","stroke","width","height"]):w=nt(w,["fill","stroke"]),Y(M,E,w)},"bpmn:Association":function(M,E,w={}){return w=nt(w,["fill","stroke"]),pe(M,E,w)},"bpmn:BoundaryEvent":function(M,E,w={}){var{renderIcon:G=!0}=w;w=nt(w,["fill","stroke"]);var U=ne(E),X=U.get("cancelActivity");w={strokeWidth:1.5,fill:qe(E,s,w.fill),fillOpacity:KR,stroke:ve(E,c,w.stroke)},X||(w.strokeDasharray="6");var Ee=ye(M,E,w);return h(M,E.width,E.height,Ys,{...w,fill:"none"}),G&&B(E,M,w),Ee},"bpmn:BusinessRuleTask":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=Ae(M,E,w),U=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),X=x(M,U);we(X,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1});var Ee=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),He=x(M,Ee);return we(He,{fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(M,E,w={}){return w=nt(w,["fill","stroke"]),Y(M,E,{strokeWidth:5,...w})},"bpmn:ComplexGateway":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=Te(M,E,w),U=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.26}});return x(M,U,{fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=ce(M,E,w);return x(M,G,{fill:"none",stroke:ve(E,c,w.stroke),strokeWidth:1}),U},"bpmn:DataInputAssociation":function(M,E,w={}){return w=nt(w,["fill","stroke"]),pe(M,E,{...w,markerEnd:d(M,"association-end",qe(E,s,w.fill),ve(E,c,w.stroke))})},"bpmn:DataObject":function(M,E,w={}){return w=nt(w,["fill","stroke"]),ce(M,E,w)},"bpmn:DataObjectReference":k("bpmn:DataObject"),"bpmn:DataOutput":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=ce(M,E,w);return x(M,G,{strokeWidth:1,fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke)}),U},"bpmn:DataOutputAssociation":function(M,E,w={}){return w=nt(w,["fill","stroke"]),pe(M,E,{...w,markerEnd:d(M,"association-end",qe(E,s,w.fill),ve(E,c,w.stroke))})},"bpmn:DataStoreReference":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:0,my:.133}});return x(M,G,{fill:qe(E,s,w.fill),fillOpacity:Eo,stroke:ve(E,c,w.stroke),strokeWidth:2})},"bpmn:EndEvent":function(M,E,w={}){var{renderIcon:G=!0}=w;w=nt(w,["fill","stroke"]);var U=ye(M,E,{...w,strokeWidth:4});return G&&B(E,M,w),U},"bpmn:EventBasedGateway":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=ne(E),U=Te(M,E,w);h(M,E.width,E.height,E.height*.2,{fill:qe(E,"none",w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1});var X=G.get("eventGatewayType"),Ee=!!G.get("instantiate");function He(){var Pt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:E.width,containerHeight:E.height,position:{mx:.36,my:.44}});x(M,Pt,{fill:"none",stroke:ve(E,c,w.stroke),strokeWidth:2})}if(X==="Parallel"){var it=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}});x(M,it,{fill:"none",stroke:ve(E,c,w.stroke),strokeWidth:1})}else X==="Exclusive"&&(Ee||h(M,E.width,E.height,E.height*.26,{fill:"none",stroke:ve(E,c,w.stroke),strokeWidth:1}),He());return U},"bpmn:ExclusiveGateway":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=Te(M,E,w),U=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}}),X=tt(E);return X.get("isMarkerVisible")&&x(M,U,{fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(M,E,w={}){return w=nt(w,["fill","stroke"]),Te(M,E,w)},"bpmn:Group":function(M,E,w={}){return w=nt(w,["fill","stroke","width","height"]),b(M,E.width,E.height,qs,{stroke:ve(E,c,w.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Qn(E,w),height:Ln(E,w)})},"bpmn:InclusiveGateway":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=Te(M,E,w);return h(M,E.width,E.height,E.height*.24,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(M,E,w={}){var{renderIcon:G=!0}=w;w=nt(w,["fill","stroke"]);var U=ye(M,E,{...w,strokeWidth:1.5});return h(M,E.width,E.height,Ys,{fill:"none",stroke:ve(E,c,w.stroke),strokeWidth:1.5}),G&&B(E,M,w),U},"bpmn:IntermediateCatchEvent":k("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":k("bpmn:IntermediateEvent"),"bpmn:Lane":function(M,E,w={}){return w=nt(w,["fill","stroke","width","height"]),W(M,E,{...w,fillOpacity:XR})},"bpmn:ManualTask":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=Ae(M,E,w),U=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(M,U,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=ne(E),U=tt(E),X=qe(E,s,w.fill),Ee=ve(E,c,w.stroke),He=v(M,E.waypoints,{markerEnd:d(M,"messageflow-end",X,Ee),markerStart:d(M,"messageflow-start",X,Ee),stroke:Ee,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var it=He.getPointAtLength(He.getTotalLength()/2),Pt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:it.x,y:it.y}}),lt={strokeWidth:1};U.get("messageVisibleKind")==="initiating"?(lt.fill=X,lt.stroke=Ee):(lt.fill=Ee,lt.stroke=X);var zt=x(M,Pt,lt),nn=G.get("messageRef"),rn=nn.get("name"),vt=ie(M,rn,{align:"center-top",fitBox:!0,style:{fill:Ee}}),At=zt.getBBox(),vn=vt.getBBox(),Ar=it.x-vn.width/2,jn=it.y+At.height/2+UR;Gs(vt,Ar,jn,0)}return He},"bpmn:ParallelGateway":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=Te(M,E,w),U=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.2}});return x(M,U,{fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke),strokeWidth:1}),G},"bpmn:Participant":function(M,E,w={}){w=nt(w,["fill","stroke","width","height"]);var G=W(M,E,w),U=Xe(E),X=tn(E),Ee=ne(E),He=Ee.get("name");if(U){var it=X?[{x:30,y:0},{x:30,y:Ln(E,w)}]:[{x:0,y:30},{x:Qn(E,w),y:30}];g(M,it,{stroke:ve(E,c,w.stroke),strokeWidth:YR}),je(M,He,E,w)}else{var Pt=ma(E,w);X||(Pt.height=Qn(E,w),Pt.width=Ln(E,w));var lt=ie(M,He,{box:Pt,align:"center-middle",style:{fill:ha(E,u,c,w.stroke)}});if(!X){var zt=-1*Ln(E,w);Gs(lt,0,-zt,270)}}return Ee.get("participantMultiplicity")&&L("ParticipantMultiplicityMarker",M,E,w),G},"bpmn:ReceiveTask":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=ne(E),U=Ae(M,E,w),X;return G.get("instantiate")?(h(M,28,28,20*.22,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1}),X=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):X=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(M,X,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1}),U},"bpmn:ScriptTask":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=Ae(M,E,w),U=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(M,U,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=Ae(M,E,w),U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(M,U,{fill:ve(E,c,w.stroke),stroke:qe(E,s,w.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=qe(E,s,w.fill),U=ve(E,c,w.stroke),X=v(M,E.waypoints,{markerEnd:d(M,"sequenceflow-end",G,U),stroke:U}),Ee=ne(E),{source:He}=E;if(He){var it=ne(He);Ee.get("conditionExpression")&&S(it,"bpmn:Activity")&&we(X,{markerStart:d(M,"conditional-flow-marker",G,U)}),it.get("default")&&(S(it,"bpmn:Gateway")||S(it,"bpmn:Activity"))&&it.get("default")===Ee&&we(X,{markerStart:d(M,"conditional-default-flow-marker",G,U)})}return X},"bpmn:ServiceTask":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=Ae(M,E,w);h(M,10,10,{fill:qe(E,s,w.fill),stroke:"none",transform:"translate(6, 6)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(M,U,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1}),h(M,10,10,{fill:qe(E,s,w.fill),stroke:"none",transform:"translate(11, 10)"});var X=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(M,X,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(M,E,w={}){var{renderIcon:G=!0}=w;w=nt(w,["fill","stroke"]);var U=ne(E);U.get("isInterrupting")||(w={...w,strokeDasharray:"6"});var X=ye(M,E,w);return G&&B(E,M,w),X},"bpmn:SubProcess":function(M,E,w={}){return Xe(E)?w=nt(w,["fill","stroke","width","height"]):w=nt(w,["fill","stroke"]),Y(M,E,w)},"bpmn:Task":function(M,E,w={}){return w=nt(w,["fill","stroke"]),Ae(M,E,w)},"bpmn:TextAnnotation":function(M,E,w={}){w=nt(w,["fill","stroke"]);var{width:G,height:U}=ma(E,w),X=b(M,G,U,0,0,{fill:"none",stroke:"none"}),Ee=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:0,my:0}});x(M,Ee,{stroke:ve(E,c,w.stroke)});var He=ne(E),it=He.get("text")||"";return ie(M,it,{align:"left-top",box:ma(E,w),padding:wo,style:{fill:ha(E,u,c,w.stroke)}}),X},"bpmn:Transaction":function(M,E,w={}){Xe(E)?w=nt(w,["fill","stroke","width","height"]):w=nt(w,["fill","stroke"]);var G=Y(M,E,{strokeWidth:1.5,...w}),U=n.style(["no-fill","no-events"],{stroke:ve(E,c,w.stroke),strokeWidth:1.5}),X=Xe(E);return X||(w={}),b(M,Qn(E,w),Ln(E,w),qs-Ys,Ys,U),G},"bpmn:UserTask":function(M,E,w={}){w=nt(w,["fill","stroke"]);var G=Ae(M,E,w),U=15,X=12,Ee=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:X}});x(M,Ee,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:.5});var He=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:X}});x(M,He,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:.5});var it=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:X}});return x(M,it,{fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke),strokeWidth:.5}),G},label:function(M,E,w={}){return Ue(M,E,w)}};this._drawPath=x,this._renderer=T}_e(jr,Li),jr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],jr.prototype.canRender=function(e){return S(e,"bpmn:BaseElement")},jr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},jr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},jr.prototype.getShapePath=function(e){return Ge(e)?zl(e,qR):S(e,"bpmn:Event")?qm(e):S(e,"bpmn:Activity")?zl(e,qs):S(e,"bpmn:Gateway")?GR(e):VR(e)};function nt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var ZR=0,QR={width:150,height:50};function JR(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function eC(e){return Qt(e)?V({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Gl=null;function tC(){return Gl||(Gl=document.createElement("canvas").getContext("2d")),Gl}function nC(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(Km(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Km(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function iC(e,t){var n=tC();if(!n)return{width:0,height:0};n.font=nC(t),"letterSpacing"in n&&(n.letterSpacing=Km(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 rC(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=iC(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return oC(e,r,i,o);r=sC(r,o.width,t)}}function oC(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 Xm="";function aC(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===Xm)&&r.pop();break}var a=r[r.length-1];return a&&a===Xm&&(r[r.length-1]="-"),r.join("")}function sC(e,t,n){var i=Math.max(e.length*(n/t),1),r=aC(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ks(e){this._config=V({},{size:QR,padding:ZR,style:{},align:"center-top"},e||{})}Ks.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ks.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ks.prototype.layoutText=function(e,t){for(var n=V({},this._config.size,t.box),i=V({},this._config.style,t.style),r=JR(t.align||this._config.align),o=eC(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=cC(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(rC(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Mn(u,function(b,y,g){return b+(s||y.height)},0)+o.top+o.bottom,f=Mn(u,function(b,y,g){return y.width>b?y.width:b},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var m=Me("text");we(m,i),F(u,function(b){var y;switch(d+=s||b.height,r.horizontal){case"left":y=o.left;break;case"right":y=(a?f:l)-o.right-b.width;break;default:y=Math.max(((a?f:l)-b.width)/2+o.left,0)}var g=Me("tspan");we(g,{x:y,y:d}),g.textContent=b.text,$e(m,g)});var h={width:f,height:p};return{dimensions:h,element:m}};function cC(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var uC=12,lC=1.2,pC=40;function Zm(e){var t=V({fontFamily:"Arial, sans-serif",fontSize:uC,fontWeight:"normal",lineHeight:lC},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=V({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ks({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Fr.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:wo});return{x:a.x,y:a.y,width:a.width,height:Math.max(pC,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,V({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Zm.$inject=["config.textRenderer"];function fC(){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=gC(i.d,{mx:r,my:o,e:a});return p}}var dC=/\{([^{}]+)\}/g,hC=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function mC(e,t,n){var i=n;return t.replace(hC,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 gC(e,t){return String(e).replace(dC,function(n,i){return mC(n,i,t)})}const yC={__init__:["bpmnRenderer"],bpmnRenderer:["type",jr],textRenderer:["type",Zm],pathMap:["type",fC]};function vC(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ga={translate:["value",vC]};function Xs(e,t,n){return V({id:e.id,type:e.$type,businessObject:e,di:t},n)}function bC(e,t,n){var i=e.waypoint;return!i||i.length<2?[Le(t),Le(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Qm(e,t,n){return new Error(`element ${gn(t)} referenced by ${gn(e)}#${n} not yet drawn`)}function $i(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}$i.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],$i.prototype.add=function(e,t,n){var i,r,o;if(S(t,"bpmndi:BPMNPlane")){var a=S(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Xs(e,t,a)),this._canvas.addRootElement(i)}else if(S(t,"bpmndi:BPMNShape")){var s=!Xe(e,t),c=_C(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Xs(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),S(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),S(e,"bpmn:Lane")&&(o=0),S(e,"bpmn:DataStoreReference")&&(xC(n,Le(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(S(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Xs(e,t,{hidden:r,source:l,target:p,waypoints:bC(t,l,p)})),S(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${gn(t)} for element ${gn(e)}`);return sr(e)&&qn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},$i.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${gn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Qm(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},$i.prototype.addLabel=function(e,t,n){var i,r,o;return i=BR(t,n),r=qn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Xs(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!qn(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},$i.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?Qm(e,i,t+"Ref"):new Error(`${gn(e)}#${t} Ref not specified`)},$i.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},$i.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},$i.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function xC(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 _C(e){return S(e,"bpmn:Group")}const Jm={__depends__:[yC,{__depends__:[ga],bpmnImporter:["type",$i]}]};function ya(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function pi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Vl(e){return Math.log(e)/Math.log(10)}var wC=1e3;function ee(e){this._eventBus=e}ee.$inject=["eventBus"];function EC(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}ee.prototype.on=function(e,t,n,i,r,o){if((Jt(t)||Be(t))&&(o=r,r=i,i=n,n=t,t=null),Jt(n)&&(o=r,r=i,i=n,n=wC),Qt(r)&&(o=r,r=!1),!Jt(i))throw new Error("handlerFn must be a function");De(e)||(e=[e]);var a=this._eventBus;F(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?EC(i,o):i,o)})},ee.prototype.canExecute=Fi("canExecute"),ee.prototype.preExecute=Fi("preExecute"),ee.prototype.preExecuted=Fi("preExecuted"),ee.prototype.execute=Fi("execute"),ee.prototype.executed=Fi("executed"),ee.prototype.postExecute=Fi("postExecute"),ee.prototype.postExecuted=Fi("postExecuted"),ee.prototype.revert=Fi("revert"),ee.prototype.reverted=Fi("reverted");function Fi(e){return function(n,i,r,o,a){(Jt(n)||Be(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Wl=["top","bottom","left","right"],Zs=10;function Ul(e,t){ee.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Us(r)&&!ft(r)){var o=CC(r);o&&i(r,o)}}function i(r,o){var a=Le(r),s=r.label,c=Le(s);if(s.parent){var u=Oe(r),l;switch(o){case"top":l={x:a.x,y:u.top-Zs-s.height/2};break;case"left":l={x:u.left-Zs-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Zs+s.height/2};break;case"right":l={x:u.right+Zs+s.width/2,y:a.y};break}var p=pi(l,c);t.moveShape(s,p)}}}_e(Ul,ee),Ul.$inject=["eventBus","modeling"];function SC(e){var t=e.host,n=Le(e),i=cn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Wl.filter(function(a){return r.indexOf(a)===-1});return o}function RC(e){var t=Le(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return eg(t,i)});return n}function CC(e){var t=Le(e.label),n=Le(e),i=eg(n,t);if(PC(i)){var r=RC(e);if(e.host){var o=SC(e);r=r.concat(o)}var a=Wl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?cn(e.label,e)!=="intersect"?void 0:i:a[0]}}function eg(e,t){return cn(t,e,5)}function PC(e){return Wl.indexOf(e)!==-1}function Yl(e){ee.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(S(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)}_e(Yl,ee),Yl.$inject=["eventBus"];var AC=1500;function ql(e,t,n){e.invoke(ee,this),this.preExecute("elements.delete",AC,function(r){var o=r.context,a=o.elements,s=i(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=Ye(r,u=>S(u,"bpmn:Participant")||S(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>S(u,"bpmn:Artifact"))),c=new Set;return F(o,u=>{const l=new Set(ro(yo(Array.from(s),Bt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}_e(ql,ee),ql.$inject=["injector","eventBus","canvas"];function Kl(e,t){e.invoke(ee,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ye(r.incoming.concat(r.outgoing),function(a){return S(a,"bpmn:Association")});F(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}_e(Kl,ee),Kl.$inject=["injector","modeling"];function So(e,t){for(An(t)&&(t=[t]);e=e.parent;)if(We(e,t))return e;return null}function tg(e,t){var n=So(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=So(e,i),n)return tn(n);if(We(e,i))return tn(e);var r;for(r=ne(e);r&&!S(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ne(a);return s&&s.get("processRef")===r});return o?tn(o):!0}var ng=500;function Qs(e,t){t.invoke(ee,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ng,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return ig(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",ng,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];ig(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Qs.$inject=["bpmnReplace","injector"],_e(Qs,ee),Qs.prototype._replaceShape=function(e,t){var n=TC(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function TC(e){var t=ne(e),n=t.eventDefinitions;return n&&n[0]}function ig(e,t){return!Ge(e)&&We(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Xl(e,t){ee.call(this,e);function n(i){return Ye(i.attachers,function(r){return S(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);S(r,"bpmn:EventBasedGateway")&&S(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;S(r,"bpmn:Gateway")&&S(o,"bpmn:EventBasedGateway")&&F(o.outgoing,function(a){var s=a.target,c=n(s);S(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Xl.$inject=["eventBus","modeling"],_e(Xl,ee);function rg(e){return e.create("bpmn:Category")}function MC(e){return e.create("bpmn:CategoryValue")}function og(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=MC(e)),n.$parent||(n.$parent=rg(e)),n}function kC(e,t,n){return Ot(t.get("categoryValue"),e),e.$parent=t,Ot(n.get("rootElements"),t),t.$parent=n,e}function OC(e){var t=e.$parent;return t&&(kt(t.get("categoryValue"),e),e.$parent=null),e}function DC(e){var t=e.$parent;return t&&(kt(t.get("rootElements"),e),e.$parent=null),e}var LC=500;function Zl(e,t,n){n.invoke(ee,this);function i(c){return t.filter(function(u){return S(u,"bpmn:Group")&&!u.labelTarget}).map(ne).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&&kC(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&DC(u),c&&!r(c,l)&&OC(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!S(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;!S(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ne(u))},!0),this.executed(["shape.move","shape.resize"],LC,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,ne(u))},!0),this.executed("group.updateRefs",function(c){ag(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){ag(c).forEach(function(u){s(u.categoryValue,u.category,ne(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!S(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ne(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!S(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Zl.$inject=["bpmnjs","elementRegistry","injector"],_e(Zl,ee);function ag(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Ql(e,t,n){ee.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(b){const y=b.source,g=b.target;Ro(y)&&va(g)&&l(g)}function r(b){const y=b.connection,g=b.source,v=b.target;Ro(g)&&Js(v)&&(u(v),f(g,[y]))}function o(b){const y=b.newTarget,g=b.oldSource,v=b.oldTarget;if(v!==y){const x=g;va(v)&&l(v),Ro(x)&&Js(y)&&u(y)}}function a(b){const{element:y}=b;va(y)?(p(y),d(y)):Js(y)&&m(y)}function s(b){const{newData:y,oldShape:g}=b;if(Ro(b.oldShape)&&y.eventDefinitionType!=="bpmn:CompensateEventDefinition"||y.type!=="bpmn:BoundaryEvent"){const v=g.outgoing.find(({target:x})=>va(x));v&&v.target&&(b._connectionTarget=v.target)}else if(!Ro(b.oldShape)&&y.eventDefinitionType==="bpmn:CompensateEventDefinition"&&y.type==="bpmn:BoundaryEvent"){const v=g.outgoing.find(({target:x})=>Js(x));v&&v.target&&(b._connectionTarget=v.target),h(g)}}function c(b){const{_connectionTarget:y,newShape:g}=b;y&&t.connect(g,y)}function u(b){t.updateProperties(b,{isForCompensation:!0})}function l(b){t.updateProperties(b,{isForCompensation:void 0})}function p(b){for(const y of b.incoming)n.canConnect(y.source,b)||t.removeConnection(y);for(const y of b.outgoing)n.canConnect(b,y.target)||t.removeConnection(y)}function f(b,y){b.outgoing.filter(x=>S(x,"bpmn:Association")).filter(x=>va(x.target)&&!y.includes(x)).forEach(x=>t.removeConnection(x))}function d(b){const y=b.attachers.slice();y.length&&t.removeElements(y)}function m(b){const y=b.incoming.filter(g=>Ro(g.source));t.removeElements(y)}function h(b){const y=b.outgoing.filter(g=>S(g,"bpmn:SequenceFlow"));t.removeElements(y)}}_e(Ql,ee),Ql.$inject=["eventBus","modeling","bpmnRules"];function va(e){const t=ne(e);return t&&t.get("isForCompensation")}function Ro(e){return e&&S(e,"bpmn:BoundaryEvent")&&_o(e,"bpmn:CompensateEventDefinition")}function Js(e){return e&&S(e,"bpmn:Activity")&&!yn(e)}function Jl(e){e.invoke(ee,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;S(i,"bpmn:Lane")&&!S(r,"bpmn:Lane")&&(n.parent=So(i,"bpmn:Participant"))})}Jl.$inject=["injector"],_e(Jl,ee);function ep(e,t){ee.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(S(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}})}ep.$inject=["eventBus","bpmnFactory"],_e(ep,ee);var tp=20,np=20,sg=30,ec=2e3;function ip(e,t,n){ee.call(this,t),t.on(["create.start","shape.move.start"],ec,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!S(a,"bpmn:Participant")||!S(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!S(p,"bpmn:Group")&&!Ge(p)&&!ft(p)});if(c.length){var u=Bt(c),l=IC(a,u);V(a,l),o.createConstraints=BC(a,u)}}}),t.on("create.start",ec,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}S(a,"bpmn:Participant")&&S(s,"bpmn:Process")&&(t.on("element.hover",ec,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return S(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",ec,function(r){var o=r.elements,a=r.parent,s=NC(o),c;s&&S(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ne(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;S(a,"bpmn:Participant")&&S(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=ne(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)&&ne(s).set("processRef",ne(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)&&ne(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)}ip.$inject=["canvas","eventBus","modeling"],_e(ip,ee);function IC(e,t){t={width:t.width+tp*2+sg,height:t.height+np*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 BC(e,t){return t=Oe(t),{bottom:t.top+e.height/2-np,left:t.right-e.width/2+tp,top:t.bottom-e.height/2+np,right:t.left+e.width/2-tp-sg}}function NC(e){return mt(e,function(t){return S(t,"bpmn:Participant")})}var cg="__targetRef_placeholder";function rp(e,t){ee.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],ug(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],ug(o));function n(a,s,c){var u=a.get("dataInputAssociations");return mt(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=mt(c,function(l){return l.name===cg});return!u&&s&&(u=t.create("bpmn:Property",{name:cg}),Ot(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||kt(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,m=s.oldTarget||s.target,h=m&&m.businessObject,b=c.businessObject,y;h&&h!==p&&r(h,u),d&&d!==p&&r(d,u),p?(y=i(p,!0),b.targetRef=y):b.targetRef=null}}rp.$inject=["eventBus","bpmnFactory"],_e(rp,ee);function ug(e){return function(t){var n=t.context,i=n.connection;if(S(i,"bpmn:DataInputAssociation"))return e(t)}}function tc(e){this._bpmnUpdater=e}tc.$inject=["bpmnUpdater"],tc.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},tc.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function op(e,t,n,i){ee.call(this,i),t.registerHandler("dataStore.updateContainment",tc);function r(){return n.filter(function(s){return S(s,"bpmn:Participant")&&ne(s).processRef})[0]}function o(s){return s.children.filter(function(c){return S(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:tt(s),newSemanticParent:l.processRef||l,newDiParent:tt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;S(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 S(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!S(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;S(u,"bpmn:DataStoreReference")&&u.type!=="label"&&S(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(!S(l,"bpmn:Collaboration")&&S(u,"bpmn:DataStoreReference")&&u.type!=="label"&&S(p,"bpmn:Collaboration")){var f=S(l,"bpmn:Participant")?l:FC(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();We(u,["bpmn:Participant","bpmn:SubProcess"])&&S(l,"bpmn:Collaboration")&&o(l).filter(function(p){return $C(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){S(l,"bpmn:Process")&&a(f,l)})})}op.$inject=["canvas","commandStack","elementRegistry","eventBus"],_e(op,ee);function $C(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 FC(e,t){for(;e.parent;){if(S(e.parent,t))return e.parent;e=e.parent}}var nc=Math.max,ic=Math.min,jC=20;function lg(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function HC(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 zC(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}function rc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Be(r)&&(i=(/top|left/.test(e)?ic:nc)(i,r)),Be(o)&&(i=(/top|left/.test(e)?nc:ic)(i,o)),i}function GC(e,t){if(!t)return e;var n=Oe(e);return js({top:rc("top",n,t),right:rc("right",n,t),bottom:rc("bottom",n,t),left:rc("left",n,t)})}function VC(e,t,n,i){var r=Oe(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?Oe(i):o,s={top:ic(o.top,a.top),left:ic(o.left,a.left),bottom:nc(o.bottom,a.bottom),right:nc(o.right,a.right)};return js(s)}function ba(e,t){return typeof e<"u"?e:jC}function WC(e,t){var n,i,r,o;return typeof t=="object"?(n=ba(t.left),i=ba(t.right),r=ba(t.top),o=ba(t.bottom)):n=i=r=o=ba(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function UC(e){return!(e.waypoints||e.type==="label")}function pg(e,t){var n;if(e.length===void 0?n=Ye(e.children,UC):n=e,n.length)return WC(Bt(n),t)}var cr=Math.abs;function YC(e,t){return lg(Oe(t),Oe(e))}var qC=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Jn=30;function oc(e,t){return t=t||[],e.children.filter(function(n){S(n,"bpmn:Lane")&&(oc(n,t),t.push(n))}),t}function ur(e){return e.children.filter(function(t){return S(t,"bpmn:Lane")})}function ei(e){return So(e,qC)||e}function KC(e,t){var n=ei(e),i=S(n,"bpmn:Process")?[]:[n],r=oc(n,i),o=Oe(e),a=Oe(t),s=YC(e,t),c=[],u=tn(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,m=u?s.left:0,h=Oe(l);s.top&&(cr(h.bottom-o.top)<10&&(d=a.top-h.bottom),cr(h.top-o.top)<5&&(p=a.top-h.top)),s.left&&(cr(h.right-o.left)<10&&(f=a.left-h.right),cr(h.left-o.left)<5&&(m=a.left-h.left)),s.bottom&&(cr(h.top-o.bottom)<10&&(p=a.bottom-h.top),cr(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(cr(h.left-o.right)<10&&(m=a.right-h.left),cr(h.right-o.right)<5&&(f=a.right-h.right)),(p||f||d||m)&&c.push({shape:l,newBounds:zC(l,{top:p,right:f,bottom:d,left:m})})}}),c}var XC=500;function ap(e,t){ee.call(this,e);function n(i,r){var o=tn(i),a=ur(r),s=[],c=[],u=[],l=[];if(Nr(a,function(b){return o?b.y>i.y?c.push(b):s.push(b):b.x>i.x?l.push(b):u.push(b),b.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,m,h;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&&(m=t.calculateAdjustments(u,"x",p,i.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:p,y:0},"e")),l.length&&(h=t.calculateAdjustments(l,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",XC,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;S(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}ap.$inject=["eventBus","spaceTool"],_e(ap,ee);var fg=500;function ac(e,t){t.invoke(ee,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",fg,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return dg(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",fg,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;dg(a,QC(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}ac.$inject=["bpmnReplace","injector"],_e(ac,ee),ac.prototype._replaceShape=function(e){var t=ZC(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function ZC(e){var t=ne(e),n=t.eventDefinitions;return n&&n[0]}function dg(e,t){return!Ge(e)&&S(e,"bpmn:BoundaryEvent")&&!t}function QC(e,t){return e.indexOf(t)!==-1}var sc=Math.round,JC=Math.max;function eP(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 tP(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var hg=10;function nP(e,t){var n,i;for(n=0;i=e[n];n++)if(ua(i,t)<=hg)return{point:e[n],bendpoint:!0,index:n};return null}function iP(e,t){var n=bm(eP(t,hg),tP(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=JC(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:sc(i.x+r.x)/2,y:sc(i.y+r.y)/2},index:i.segment2}:{point:{x:sc(i.x),y:sc(i.y)},index:i.segment2}:null}function sp(e,t){return nP(e,t)||iP(e,t)}function cp(e,t,n){ee.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,p,f,d,m,h=r.outgoing.slice(),b=r.incoming.slice(),y;Be(a.width)?y=Le(a):y=a;var g=sp(s,y);if(g){if(c=s.slice(0,g.index),u=s.slice(g.index+(g.bendpoint?1:0)),!c.length||!u.length)return;l=g.bendpoint?s[g.index]:y,(c.length===1||!mg(r,c[c.length-1]))&&c.push(gg(l)),(u.length===1||!mg(r,u[0]))&&u.unshift(gg(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||y),d=o),t.canConnect(r,f,o)&&(d?m=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||y),m=o));var v=[].concat(d&&Ye(b,function(x){return x.source===d.source})||[],m&&Ye(h,function(x){return x.target===m.target})||[]);v.length&&n.removeElements(v)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=Le(c),l={x:u.x+s.x,y:u.y+s.y},p=mt(o.children,function(f){var d=t.canInsert(a,f);return d&&sp(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)}_e(cp,ee),cp.$inject=["eventBus","bpmnRules","modeling"];function mg(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 gg(e){return V({},e)}function up(e,t){ee.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Co(r)){var c=[];S(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&Co(u)):c=a.incoming.filter(u=>u!==r&&Co(u)&&S(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(S(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(Co).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Co).forEach(function(s){const c=a.incoming.filter(Co).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}up.$inject=["eventBus","modeling"],_e(up,ee);function Co(e){return S(e,"bpmn:SequenceFlow")}var cc=1500,yg=2e3;function vg(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],cc,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;S(a,"bpmn:Lane")&&!We(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=ei(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||We(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],cc,function(i){var r=i.hover;S(r,"bpmn:Lane")&&(i.hover=ei(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],cc,function(i){var r=i.context,o=i.hover,a=r.type;S(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=ei(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],cc,function(i){var r=i.context,o=r.start;S(o,"bpmn:Lane")&&(r.start=ei(o)||o)}),t.on("shape.move.start",yg,function(i){var r=i.shape;S(r,"bpmn:Lane")&&(i.shape=ei(r)||r)}),t.on("spaceTool.move",yg,function(i){var r=i.hover;r&&S(r,"bpmn:Lane")&&(i.hover=ei(r))})}vg.$inject=["elementRegistry","eventBus","canvas"];var bg=770;function lp(e,t,n,i){n.invoke(ee,this);function r(s,c){var u=ne(s),l=c.categoryValue||u.categoryValueRef;l||(l=og(e,u));var p=c.category||l.$parent||rg(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=ne(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;S(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;S(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=ne(u);if(!(!S(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(!(!S(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=ne(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!S(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ne(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!S(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ne(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!S(u,"bpmn:Group")||u.labelTarget||ne(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!S(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",bg,function(s){var c=s.descriptor,u=s.element;if(!(!S(u,"bpmn:Group")||u.labelTarget)){var l=ne(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",bg,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})}lp.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],_e(lp,ee);function pp(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 xg(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=pp(i,r,o,a),u=pp(i,r,o,s),l;c&&u?_g(c,o)>_g(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],Le(i.source)),t(r[r.length-1],r[r.length-2],Le(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}xg.$inject=["eventBus"];function _g(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function fp(e){ee.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,r=ne(i),o=tt(i);if(We(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}fp.$inject=["eventBus"],_e(fp,ee);function wg(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Eg(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function rP(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 oP(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 dp(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=oP([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 Sg(e,t){var n=dp(e,t),i={x:n.x-e.x,y:n.y-e.y};return wg(i)}function xa(e,t){return wg({x:e.x-t.x,y:e.y-t.y})}var Rg=Math.sqrt,Cg=Math.min,aP=Math.max,Pg=Math.abs;function Ag(e){return Math.pow(e,2)}function _a(e,t){return Rg(Ag(e.x-t.x)+Ag(e.y-t.y))}function sP(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],Mg(i,r)?u=[i]:(o=_a(e,i),a=_a(e,r),c=Cg(o,a),u=cP(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:Mg(i,u[0])?n:n+1}),u.length===2&&(s=lP(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:_a(i,s)/_a(i,r)}),p=_a(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function cP(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 m=Rg(d),h=-p+m,b=-p-m,y={x:e.x-r*h,y:e.y-o*h};if(d===0)return[y];var g={x:e.x-r*b,y:e.y-o*b};return[y,g].filter(function(v){return uP(v,e,t)})}function uP(e,t,n){return Tg(e.x,t.x,n.x)&&Tg(e.y,t.y,n.y)}function Tg(e,t,n){return e>=Cg(t,n)-uc&&e<=aP(t,n)+uc}function lP(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var uc=.1;function Mg(e,t){return Pg(e.x-t.x)<=uc&&Pg(e.y-t.y)<=uc}function pP(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=Og(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 kg(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=sP(e,n),c=s.segmentIndex,u=pP(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Dg(n,c),p=Dg(t,u),f=s.position,d=dP(l,f),m=fP(l,p);if(s.type==="bendpoint"){var h=t.length-n.length,b=s.bendpointIndex,y=n[b];if(t.indexOf(y)!==-1)return a;if(h===0){var g=t[b];return r=g.x-s.position.x,o=g.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&b!==0&&b<n.length-1&&(d=Og(n,b))}var v={x:(p[1].x-p[0].x)*d+p[0].x,y:(p[1].y-p[0].y)*d+p[0].y},x=rP({x:e.x-f.x,y:e.y-f.y},m);return r=v.x+x.x-e.x,o=v.y+x.y-e.y,{point:Bi(v),delta:Bi({x:r,y:o})}}function Og(e,t){var n=xa(e[t-1],e[t]),i=xa(e[t],e[t+1]),r=n/(n+i);return r}function fP(e,t){var n=Eg(e),i=Eg(t);return i-n}function Dg(e,t){return[e[t],e[t+1]]}function dP(e,t){var n=xa(e[0],e[1]),i=xa(e[0],t);return n===0?0:i/n}function hP(e,t,n,i){var r=Le(e);return kg(r,t,n,i).delta}function wa(e,t,n){var i=ya(t),r=ya(n),o=pi(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Bi({x:r.x+a.x,y:r.y+a.y})}function Lg(e,t,n){var i=ya(e),r=ya(t),o=ya(n),a=pi(e,i),s=pi(i,r),c=mP(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return Bi({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function mP(e,t,n){var i=Oe(t),r=Oe(n);if(gP(i,r))return null;var o=cn(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=cn(n,s),c!==o?null:a}function gP(e,t){return yP(e,t)||vP(e,t)}function yP(e,t){return e.right!==t.right&&e.left!==t.left}function vP(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Ig="name",Bg="text";function hp(e,t,n,i){ee.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ne(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(Ig in u&&t.updateLabel(c,u[Ig]),Bg in u&&S(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Bg]||"");t.updateLabel(c,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;Ge(u)||!sr(u)||qn(u)&&t.updateLabel(u,qn(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=V({},s.hints),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),hP(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=ne(c);l&&sr(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!Ge(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(qn(c)||"",{box:l,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=l.y!==c.y,m=c.y+c.height;s.newBounds={width:l.width,height:f,x:l.x,y:d?m-f:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Us(c)){var p=c.label,f=Le(p),d=_P(l),m=xP(f,d),h=bP(m,l,u);t.moveShape(p,h)}})}_e(hp,ee),hp.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function bP(e,t,n){var i=wa(e,t,n);return Bi(pi(i,e))}function xP(e,t){if(t.length){var n=wP(e,t);return dp(e,n)}}function _P(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 wP(e,t){var n=t.map(function(r){return{line:r,distance:Sg(e,r)}}),i=di(n,"distance");return i[0].line}function EP(e,t,n,i){return kg(e,t,n,i).point}function mp(e,t){ee.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=V({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),EP(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)})})}_e(mp,ee),mp.$inject=["eventBus","modeling"];function lc(e,t,n){var i=fc(e),r=$g(i,t),o=i[0];return r.length?r[r.length-1]:wa(o.original||o,n,t)}function pc(e,t,n){var i=fc(e),r=$g(i,t),o=i[i.length-1];return r.length?r[0]:wa(o.original||o,n,t)}function gp(e,t,n){var i=fc(e),r=Ng(t,n),o=i[0];return wa(o.original||o,r,t)}function yp(e,t,n){var i=fc(e),r=Ng(t,n),o=i[i.length-1];return wa(o.original||o,r,t)}function Ng(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function fc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function $g(e,t){var n=dn(e,RP);return Ye(n,function(i){return SP(i,t)})}function SP(e,t){return cn(t,e,1)==="intersect"}function RP(e){return e.original||e}function vp(e,t){ee.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(CP(i,r)){var o=PP(i);o.incoming.forEach(function(a){var s=pc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=lc(a,r,i);t.reconnectStart(a,r,s)})}},!0)}vp.$inject=["eventBus","modeling"],_e(vp,ee);function CP(e,t){return S(e,"bpmn:Participant")&&Xe(e)&&S(t,"bpmn:Participant")&&!Xe(t)}function PP(e){var t=sa([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){S(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){S(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const AP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Fg(e){const t=ne(e);if(!S(t,"bpmn:BoundaryEvent")&&!(S(t,"bpmn:StartEvent")&&yn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:AP.some(i=>S(n[0],i))}function jg(e){return S(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function bp(e,t){e.invoke(ee,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Fg(r))return;const a=jg(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ne(i).get(a),u=ne(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}bp.$inject=["injector","modeling"],_e(bp,ee);function xp(e,t){ee.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=tt(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}_e(xp,ee),xp.$inject=["eventBus","modeling"];function _p(e,t,n){ee.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!S(o,"bpmn:SequenceFlow")||!S(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=TP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}_e(_p,ee),_p.$inject=["eventBus","bpmnRules","modeling"];function Po(e){return e.original||e}function TP(e,t){var n=pp(Po(e[e.length-2]),Po(e[e.length-1]),Po(t[1]),Po(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Po(e[0]),Po(t[t.length-1])]}function wp(e,t){ee.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;S(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)}wp.$inject=["eventBus","modeling"],_e(wp,ee);function Ep(e,t,n,i){ee.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;S(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),S(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,m;d=n.canConnect(p,f),!(!d||d.type===l.type)&&(m=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=m,r&&s(l,m))}function s(c,u){var l=r.context(),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;F(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=mt(p.outgoing,ao({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})})}_e(Ep,ee),Ep.$inject=["eventBus","modeling","bpmnRules","injector"];function dc(e,t,n,i,r,o){i.invoke(ee,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=Mn(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=[];F(s.closure.topLevel,function(f){yn(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})})}_e(dc,ee),dc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;F(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},dc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var MP=1500,kP={width:140,height:120},Sp={width:300,height:60},Rp={width:60,height:300},hc={width:300,height:150},mc={width:150,height:300},Hg={width:140,height:120},zg={width:100,height:40};function Gg(e){e.on("resize.start",MP,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(S(i,"bpmn:Lane")||S(i,"bpmn:Participant"))&&(n.resizeConstraints=BP(i,r,o)),S(i,"bpmn:SubProcess")&&Xe(i)&&(n.minDimensions=Hg),S(i,"bpmn:TextAnnotation")&&(n.minDimensions=zg)})}Gg.$inject=["eventBus"];var lr=Math.abs,OP=Math.min,DP=Math.max;function Vg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Ao(e,t,n){return Vg(e,t,n,OP)}function To(e,t,n){return Vg(e,t,n,DP)}var LP={top:20,left:50,right:20,bottom:20},IP={top:50,left:20,right:20,bottom:20};function BP(e,t,n){var i=ei(e),r=!0,o=!0,a=oc(i,[i]),s=Oe(e),c={},u={},l=tn(e),p=l?Sp:Rp;/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(m){var h=Oe(m);l?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&lr(s.top-h.bottom)<10&&To(c,"top",h.top+p.height),lr(s.top-h.top)<5&&Ao(u,"top",h.bottom-p.height)),/e/.test(t)&&(n&&lr(s.right-h.left)<10&&Ao(c,"right",h.right-p.width),lr(s.right-h.right)<5&&To(u,"right",h.left+p.width)),/s/.test(t)&&(n&&lr(s.bottom-h.top)<10&&Ao(c,"bottom",h.bottom-p.height),lr(s.bottom-h.bottom)<5&&To(u,"bottom",h.top+p.height)),/w/.test(t)&&(n&&lr(s.left-h.right)<10&&To(c,"left",h.left+p.width),lr(s.left-h.left)<5&&Ao(u,"left",h.right-p.width))});var f=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(S(m,"bpmn:FlowElement")||S(m,"bpmn:Artifact"))}),d=l?LP:IP;return f.forEach(function(m){var h=Oe(m);/n/.test(t)&&(!l||r)&&Ao(u,"top",h.top-d.top),/e/.test(t)&&(l||o)&&To(u,"right",h.right+d.right),/s/.test(t)&&(!l||o)&&To(u,"bottom",h.bottom+d.bottom),/w/.test(t)&&(l||r)&&Ao(u,"left",h.left-d.left)}),{min:u,max:c}}function Wg(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Mo(e){return e.originalEvent||e.srcEvent}function Cp(e){Wg(e),Wg(Mo(e))}function Hr(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 Ug(){return/mac/i.test(navigator.platform)}function Yg(e,t){return(Mo(e)||e).button===t}function pr(e){return Yg(e,0)}function NP(e){return Yg(e,1)}function Ea(e){var t=Mo(e)||e;return pr(e)?Ug()?t.metaKey:t.ctrlKey:!1}function gc(e){var t=Mo(e)||e;return pr(e)&&t.shiftKey}var qg=1001;function Kg(e,t){e.on("resize.start",qg+500,function(n){var i=n.context,r=i.shape;(S(r,"bpmn:Lane")||S(r,"bpmn:Participant"))&&(i.balanced=!Ea(n))}),e.on("resize.end",qg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(S(r,"bpmn:Lane")||S(r,"bpmn:Participant"))return o&&(a=Sm(a),t.resizeLane(r,a,i.balanced)),!1})}Kg.$inject=["eventBus","modeling"];var $P=500;function Pp(e,t,n,i,r){n.invoke(ee,this);function o(l){return We(l,["bpmn:ReceiveTask","bpmn:SendTask"])||FP(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!mt(f,ao({id:l.id}))}function s(l){if(S(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(S(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(S(l,"bpmn:MessageEventDefinition"))return"messageRef";if(S(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(We(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(We(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=ne(p),d=c(f),m;d&&!a(d)&&(m=e.getDefinitions().get("rootElements"),Ot(m,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var p=l.addedRootElement;if(p){var f=e.getDefinitions().get("rootElements");kt(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=ne(f),m=c(d);m&&(p.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",$P,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)})}Pp.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],_e(Pp,ee);function FP(e,t){return De(t)||(t=[t]),Xi(t,function(n){return _o(e,n)})}var Xg=Math.max;function Zg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return F(n,function(a){var s=a.id;S(a,"bpmn:Participant")&&(o[s]=HP(a,i,r)),S(a,"bpmn:Lane")&&(o[s]=tn(a)?Sp:Rp),S(a,"bpmn:SubProcess")&&Xe(a)&&(o[s]=Hg),S(a,"bpmn:TextAnnotation")&&(o[s]=zg),S(a,"bpmn:Group")&&(o[s]=kP)}),o})}Zg.$inject=["eventBus"];function jP(e){return e==="x"}function HP(e,t,n){var i=tn(e);if(!VP(e))return i?hc:mc;var r=jP(t),o={};return r?i?o=hc:o={width:GP(e,n,r),height:mc.height}:i?o={width:hc.width,height:zP(e,n,r)}:o=mc,o}function zP(e,t,n){var i;return i=WP(e,t,n),Xg(hc.height,i)}function GP(e,t,n){var i;return i=UP(e,t,n),Xg(mc.width,i)}function VP(e){return!!ur(e).length}function WP(e,t,n){var i=ur(e),r;return r=Ap(i,t,n),e.height-r.height+Sp.height}function UP(e,t,n){var i=ur(e),r;return r=Ap(i,t,n),e.width-r.width+Rp.width}function Ap(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=ur(r),o.length?Ap(o,t,n):r}var Qg="_plane";function Jg(e){var t=e.id;return YP(t)}function Ei(e){var t=e.id;return S(e,"bpmn:SubProcess")?ey(t):t}function zr(e){return ey(e)}function yc(e){var t=tt(e);return S(t,"bpmndi:BPMNPlane")}function ey(e){return e+Qg}function YP(e){return e.replace(new RegExp(Qg+"$"),"")}var ty=400,qP=600,ny={x:180,y:160};function ji(e,t,n,i,r,o,a){ee.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return S(p,"bpmn:SubProcess")&&!Xe(p)}function u(p){var f=p.shape,d=p.newRootElement,m=ne(f);d=s._addDiagram(d||m),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=ne(f);s._removeDiagram(d);var m=p.newRootElement=a.get(Ei(d));e.removeRootElement(m)}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;F(f,function(d){if(c(d)){var m=a.get(Ei(d));if(!(!m||!d.children||!d.children.length)){var h=iy(d);s._showRecursively(h),s._moveChildrenToShape(h,m)}}})},!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;!S(f,"bpmn:SubProcess")||!Xe(f)||F(da([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,m=e.findRoot(Ei(f));if(!(!d||!m)){var h=d.children;n.moveElements(h,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(S(f,"bpmn:SubProcess")){var d=p.properties,m=p.oldProperties,h=m.id,b=d.id;if(h!==b){if(yc(f)){a.updateId(f,zr(b)),a.updateId(h,b);return}var y=a.get(zr(h));y&&a.updateId(zr(h),zr(b))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(S(f,"bpmn:SubProcess")){var d=p.properties,m=p.oldProperties,h=m.id,b=d.id;if(h!==b){if(yc(f)){a.updateId(f,zr(h)),a.updateId(b,h);return}var y=a.get(zr(b));y&&a.updateId(y,zr(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(yc(f)){var d=f,m=a.get(Jg(d));!m||m===d||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",ty,function(p){var f=p.shape;S(f,"bpmn:SubProcess")&&(Xe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",ty,function(p){var f=p.shape;S(f,"bpmn:SubProcess")&&(Xe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",qP,function(p){var f=p.shape;if(S(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Xe(f))s._moveChildrenToShape(d.children.slice(),f),F(da(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),F(h.associations,b=>{n.moveConnection(b,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var m=iy(f);s._moveChildrenToShape(m,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var m=Ei(f),h=a.get(m);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,m=p.elements,h=d.parent,b=S(tt(h),"bpmndi:BPMNPlane");if(b){var y=Jg(h),g=mt(m,function(v){return v.id===y});g&&(f.parent=g.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}_e(ji,ee),ji.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=Bt(i),o;if(!t.x)o={x:ny.x-r.x,y:ny.y-r.y};else{var a=Le(t),s=Le(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},ji.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Ym(e).map(i=>i.annotation));n.size&&F(da(e.children),i=>{n.has(i.annotation)&&F(i.associations,r=>{t.removeConnection(r)})})},ji.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},ji.prototype._addDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),n.push(e.di.$parent),e},ji.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:Ei(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},ji.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=mt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},ji.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function KP(e){var t=[];return F(da(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function iy(e){return e.children.slice().concat(KP(e.children)).concat(XP(e))}function XP(e){return Dl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Tp(e,t){e.invoke(ee,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!S(r,"bpmn:SubProcess")||S(r,"bpmn:AdHocSubProcess")||!(S(i,"bpmn:Task")||S(i,"bpmn:CallActivity"))||!Xe(r))){var o=ZP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Tp.$inject=["injector","modeling"],_e(Tp,ee);function ZP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Mp(e,t){ee.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;S(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&&S(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(!(!S(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,qn(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}_e(Mp,ee),Mp.$inject=["eventBus","textRenderer"];function kp(e,t){ee.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Xe(i))return;var r=sa(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();F(s,function(u){o(u,!0)}),F(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||S(a,"bpmn:Association")&&(S(a.source,"bpmn:TextAnnotation")||S(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Le(i)):t.reconnectStart(a,i,Le(i)))}},!0)}_e(kp,ee),kp.$inject=["eventBus","modeling"];var Op=500;function Dp(e,t,n){ee.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,p;return l=QP(c).concat([a]),p=pg(l),p?(u.width=Math.max(p.width,u.width),u.height=Math.max(p.height,u.height),u.x=p.x+(p.width-u.width)/2,u.y=p.y+(p.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],Op,function(a){var s=a.context,c=s.shape;S(c,"bpmn:SubProcess")&&(c.collapsed?tt(c).isExpanded=!1:(i(c.children),tt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Op,function(a){var s=a.context,c=s.shape;c.collapsed?tt(c).isExpanded=!1:tt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Op,function(a){var s=a.context.shape,c=t.getDefaultSize(s),u;s.collapsed?u=o(s,c):u=r(s,c),n.resizeShape(s,u,null,{autoResize:s.collapsed?!1:"nwse"})})}_e(Dp,ee),Dp.$inject=["eventBus","elementFactory","modeling"];function QP(e){return e.filter(function(t){return!t.hidden})}function Lp(e,t,n,i){t.invoke(ee,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Ge(a)||(S(a,"bpmn:Participant")&&Xe(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;S(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}_e(Lp,ee),Lp.$inject=["canvas","injector","moddle","modeling"];function Ip(e,t){ee.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;JP(r,o)&&t.updateProperties(o,{default:null})})}_e(Ip,ee),Ip.$inject=["eventBus","modeling"];function JP(e,t){if(!S(e,"bpmn:SequenceFlow"))return!1;var n=ne(t),i=ne(e);return n.get("default")===i}var eA=500,tA=5e3,ry=["shape.create","shape.delete","shape.move","shape.resize"],oy=[...ry,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Bp(e,t){ee.call(this,e);var n;function i(){return n=n||new nA,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(oy,tA,function(){i()}),this.postExecuted(oy,eA,function(){o()}),this.preExecute(ry,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(S(c,"bpmn:Lane")&&u.addLane(c),S(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}Bp.$inject=["eventBus","modeling"],_e(Bp,ee);function nA(){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 iA=500,rA=5e3,ay=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],sy=[...ay,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Np(e,t){ee.call(this,e);var n;function i(){return n=n||new oA,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(sy,rA,function(){i()}),this.postExecuted(sy,iA,function(){o()}),this.preExecute(ay,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(S(s,"bpmn:FlowElement")&&c.addFlowElement(s),S(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;S(s,"bpmn:Group")&&r().addGroup(s)})}Np.$inject=["eventBus","modeling"],_e(Np,ee);function oA(){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 $p(e,t){ee.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)aA(o)&&!cA(o)&&t.updateProperties(o,{isForCompensation:void 0})})}_e($p,ee),$p.$inject=["eventBus","modeling"];function aA(e){const t=ne(e);return t&&t.isForCompensation}function sA(e){return e&&S(e,"bpmn:BoundaryEvent")&&_o(e,"bpmn:CompensateEventDefinition")}function cA(e){return e.incoming.filter(n=>sA(n.source)).length>0}const uA={__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",Ul],appendBehavior:["type",Yl],associationBehavior:["type",Kl],attachEventBehavior:["type",Qs],artifactBehavior:["type",ql],boundaryEventBehavior:["type",Xl],categoryRootElementReferenceBehavior:["type",Zl],compensateBoundaryEventBehaviour:["type",Ql],createBehavior:["type",Jl],createDataObjectBehavior:["type",ep],createParticipantBehavior:["type",ip],dataInputAssociationBehavior:["type",rp],dataStoreBehavior:["type",op],deleteLaneBehavior:["type",ap],detachEventBehavior:["type",ac],dropOnFlowBehavior:["type",cp],eventBasedGatewayBehavior:["type",up],fixHoverBehavior:["type",vg],groupBehavior:["type",lp],importDockingFix:["type",xg],isHorizontalFix:["type",fp],labelBehavior:["type",hp],layoutConnectionBehavior:["type",mp],messageFlowBehavior:["type",vp],nonInterruptingBehavior:["type",bp],removeElementBehavior:["type",_p],removeEmbeddedLabelBoundsBehavior:["type",xp],removeParticipantBehavior:["type",wp],replaceConnectionBehavior:["type",Ep],replaceElementBehaviour:["type",dc],resizeBehavior:["type",Gg],resizeLaneBehavior:["type",Kg],rootElementReferenceBehavior:["type",Pp],spaceToolBehavior:["type",Zg],subProcessPlaneBehavior:["type",ji],subProcessStartEventBehavior:["type",Tp],textAnnotationBehavior:["type",Mp],toggleCollapseConnectionBehaviour:["type",kp],toggleElementCollapseBehaviour:["type",Dp],unclaimIdBehavior:["type",Lp],unsetDefaultFlowBehavior:["type",Ip],updateFlowNodeRefsBehavior:["type",Bp],updateCategoryValueRefsBehavior:["type",Np],setCompensationActivityAfterPasteBehavior:["type",$p]};function Fp(e){this._commandStack=e.get("commandStack",!1)}Fp.$inject=["injector"],Fp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Si={__init__:["rules"],rules:["type",Fp]};function ti(e){ee.call(this,e),this.init()}ti.$inject=["eventBus"],_e(ti,ee),ti.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)})},ti.prototype.init=function(){};function cy(e,t){var n=cn(e,t,-15);return n!=="intersect"?n:null}function ln(e){ti.call(this,e)}_e(ln,ti),ln.$inject=["eventBus"],ln.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return lA(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return bc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return bc(n,i,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,i=e.direction;return _y(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return ft(i)&&!xc(t,i)?!1:kr(t,function(r){return ft(r)?bc(r.source,r.target,r):r.host?Sa(r,r.host,null,n):Gp(r,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,r=e.hints;return r!=null&&r.keyboardMove&&n.some(function(a){return my(a)&&!n.includes(a.host)})?!1:Sa(n,t,null,i)||by(n,t,i)||xy(n,t)||xc(n,t)}),this.addRule("shape.create",function(e){return Gp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Sa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Cy(n,t)})},ln.prototype.canConnectMessageFlow=Sy,ln.prototype.canConnectSequenceFlow=Ry,ln.prototype.canConnectDataAssociation=Vp,ln.prototype.canConnectAssociation=wy,ln.prototype.canConnectCompensationAssociation=Ey,ln.prototype.canMove=xy,ln.prototype.canAttach=Sa,ln.prototype.canReplace=by,ln.prototype.canDrop=ko,ln.prototype.canInsert=xc,ln.prototype.canCreate=Gp,ln.prototype.canConnect=bc,ln.prototype.canResize=_y,ln.prototype.canCopy=Cy;function lA(e){return jp(e)?null:We(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function jp(e){return!e||Ge(e)}function uy(e){do{if(S(e,"bpmn:Process"))return ne(e);if(S(e,"bpmn:Participant"))return ne(e).processRef||ne(e)}while(e=e.parent)}function Hp(e){return S(e,"bpmn:TextAnnotation")}function zp(e){return S(e,"bpmn:Group")&&!e.labelTarget}function ly(e){return S(e,"bpmn:BoundaryEvent")&&Ri(e,"bpmn:CompensateEventDefinition")}function vc(e){return ne(e).isForCompensation}function pA(e,t){var n=uy(e),i=uy(t);return n===i}function fA(e){return S(e,"bpmn:InteractionNode")&&!S(e,"bpmn:BoundaryEvent")&&(!S(e,"bpmn:Event")||S(e,"bpmn:ThrowEvent")&&dy(e,"bpmn:MessageEventDefinition"))}function dA(e){return S(e,"bpmn:InteractionNode")&&!vc(e)&&(!S(e,"bpmn:Event")||S(e,"bpmn:CatchEvent")&&dy(e,"bpmn:MessageEventDefinition"))&&!(S(e,"bpmn:BoundaryEvent")&&!Ri(e,"bpmn:MessageEventDefinition"))}function py(e){for(var t=e;t=t.parent;){if(S(t,"bpmn:FlowElementsContainer"))return ne(t);if(S(t,"bpmn:Participant"))return ne(t).processRef}return null}function fy(e,t){var n=py(e),i=py(t);return n===i}function Ri(e,t){var n=ne(e);return!!mt(n.eventDefinitions||[],function(i){return S(i,t)})}function dy(e,t){var n=ne(e);return(n.eventDefinitions||[]).every(function(i){return S(i,t)})}function hA(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:EndEvent")&&!yn(e)&&!(S(e,"bpmn:IntermediateThrowEvent")&&Ri(e,"bpmn:LinkEventDefinition"))&&!ly(e)&&!vc(e)}function mA(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:StartEvent")&&!S(e,"bpmn:BoundaryEvent")&&!yn(e)&&!(S(e,"bpmn:IntermediateCatchEvent")&&Ri(e,"bpmn:LinkEventDefinition"))&&!vc(e)}function gA(e){return S(e,"bpmn:ReceiveTask")||S(e,"bpmn:IntermediateCatchEvent")&&(Ri(e,"bpmn:MessageEventDefinition")||Ri(e,"bpmn:TimerEventDefinition")||Ri(e,"bpmn:ConditionalEventDefinition")||Ri(e,"bpmn:SignalEventDefinition"))}function yA(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function hy(e,t){var n=yA(t);return n.indexOf(e)!==-1}function bc(e,t,n){if(jp(e)||jp(t))return null;if(!S(n,"bpmn:DataAssociation")){if(Sy(e,t))return{type:"bpmn:MessageFlow"};if(Ry(e,t))return{type:"bpmn:SequenceFlow"}}var i=Vp(e,t);return i||(Ey(e,t)?{type:"bpmn:Association",associationDirection:"One"}:wy(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function ko(e,t){return Ge(e)||zp(e)?!0:S(t,"bpmn:Participant")&&!Xe(t)?!1:S(e,"bpmn:Participant")?S(t,"bpmn:Process")||S(t,"bpmn:Collaboration"):We(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:S(e,"bpmn:Lane")?S(t,"bpmn:Participant")||S(t,"bpmn:Lane"):S(e,"bpmn:BoundaryEvent")&&!vA(e)?!1:S(e,"bpmn:FlowElement")&&!S(e,"bpmn:DataStoreReference")?S(t,"bpmn:FlowElementsContainer")?Xe(t):We(t,["bpmn:Participant","bpmn:Lane"]):S(e,"bpmn:DataStoreReference")&&S(t,"bpmn:Collaboration")?Xi(ne(t).get("participants"),function(n){return!!n.get("processRef")}):We(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?We(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):S(e,"bpmn:MessageFlow")?S(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function vA(e){return ne(e).cancelActivity&&(gy(e)||yy(e))}function my(e){return!Ge(e)&&S(e,"bpmn:BoundaryEvent")}function bA(e){return S(e,"bpmn:Lane")}function xA(e){return my(e)||S(e,"bpmn:IntermediateThrowEvent")&&gy(e)?!0:S(e,"bpmn:IntermediateCatchEvent")&&yy(e)}function gy(e){var t=ne(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function yy(e){return vy(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function vy(e,t){return t.some(function(n){return Ri(e,n)})}function _A(e){return S(e,"bpmn:ReceiveTask")&&mt(e.incoming,function(t){return S(t.source,"bpmn:EventBasedGateway")})}function Sa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Ge(r)||!xA(r)||yn(t)||!S(t,"bpmn:Activity")||vc(t)||i&&!cy(i,t)||_A(t)?!1:"attach"}function by(e,t,n){if(!t)return!1;var i={replacements:[]};return F(e,function(r){yn(t)||S(r,"bpmn:StartEvent")&&r.type!=="label"&&ko(r,t)&&(MR(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(kR(r)||OR(r)||DR(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),vy(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&S(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),S(t,"bpmn:Transaction")||Ri(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(S(r,"bpmn:EndEvent")&&ko(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),S(r,"bpmn:BoundaryEvent")&&Sa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function xy(e,t){return Xi(e,bA)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return ko(n,t)})}function Gp(e,t,n,i){return t?Ge(e)||zp(e)?!0:ko(e,t)||xc(e,t):!1}function _y(e,t,n){return S(e,"bpmn:SubProcess")?Xe(e)&&(!t||t.width>=100&&t.height>=80):S(e,"bpmn:Lane")||S(e,"bpmn:Participant")?!0:Hp(e)?n?n==="e"||n==="w":!0:zp(e)?!0:Ge(e)?n?n==="e"||n==="w":!0:!1}function wA(e,t){var n=Hp(e),i=Hp(t);return(n||i)&&n!==i}function wy(e,t){return hy(t,e)||hy(e,t)?!1:wA(e,t)?!0:!!Vp(e,t)}function Ey(e,t){return fy(e,t)&&ly(e)&&S(t,"bpmn:Activity")&&!SA(t,e)&&!yn(t)}function Sy(e,t){return Ay(e)&&!Ay(t)?!1:fA(e)&&dA(t)&&!pA(e,t)}function Ry(e,t){return hA(e)&&mA(t)&&fy(e,t)&&!(S(e,"bpmn:EventBasedGateway")&&!gA(t))}function Vp(e,t){return We(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&We(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:We(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&We(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function xc(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:We(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ge(t)&&S(e,"bpmn:FlowNode")&&!S(e,"bpmn:BoundaryEvent")&&ko(e,t.parent)}function Wp(e,t){return e&&t&&e.indexOf(t)!==-1}function Cy(e,t){return Ge(t)?!0:!(S(t,"bpmn:Lane")&&!Wp(e,t.parent)||S(t,"bpmn:MessageFlow")&&!EA(e,t))}function EA(e,t){var n=Py(t.source),i=Py(t.target);return Wp(e,n)&&Wp(e,i)}function Py(e){for(;e;e=e.parent)if(S(e,"bpmn:Participant"))return e;return null}function Ay(e){return So(e,"bpmn:Process")||So(e,"bpmn:Collaboration")}function SA(e,t){return e.attachers.includes(t)}const RA={__depends__:[Si],__init__:["bpmnRules"],bpmnRules:["type",ln]};var CA=2e3;function Ty(e,t){e.on("saveXML.start",CA,n);function n(){var i=t.getRootElements();F(i,function(r){var o=tt(r),a,s;a=sa([r]),a=Ye(a,function(c){return c!==r&&!c.labelTarget}),s=dn(a,tt),o.set("planeElement",s)})}}Ty.$inject=["eventBus","canvas"];const PA={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Ty]};function _c(e){ee.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}_c.prototype.getOrdering=function(e,t){return null},_e(_c,ee);function Up(e,t){_c.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=mt(n,function(c){return We(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!We(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||S(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=Rd(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}}}Up.$inject=["eventBus","canvas"],_e(Up,_c);const AA={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Up]};function Ra(){}Ra.prototype.get=function(){return this._data},Ra.prototype.set=function(e){this._data=e},Ra.prototype.clear=function(){var e=this._data;return delete this._data,e},Ra.prototype.isEmpty=function(){return!this._data};const TA={clipboard:["type",Ra]};var My=1500;function ky(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",My,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",My,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=Hr(a),c=document.elementFromPoint(s.x,s.y),MA(c)}}ky.$inject=["elementRegistry","eventBus","injector"];function MA(e){return Ir(e,"svg, .djs-element",!0)}const kA={__init__:["hoverFix"],hoverFix:["type",ky]};function OA(e){return!0}function wc(e){return pr(e)||NP(e)}var Oy=500;function Dy(e,t,n){var i=this;function r(A,B,D){if(!s(A,B)){var L,z,ie;D?z=t.getGraphics(D):(L=B.delegateTarget||B.target,L&&(z=L,D=t.get(z))),!(!z||!D)&&(ie=e.fire(A,{element:D,gfx:z,originalEvent:B}),ie===!1&&(B.stopPropagation(),B.preventDefault()))}}var o={};function a(A){return o[A]}function s(A,B){var D=u[A]||pr;return!D(B)}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":OA,"element.mousedown":wc,"element.mouseup":wc,"element.click":wc,"element.dblclick":wc};function l(A,B,D){var L=c[A];if(!L)throw new Error("unmapped DOM event name <"+A+">");return r(L,B,D)}var p="svg, .djs-element";function f(A,B,D,L){var z=o[D]=function(ie){r(D,ie)};L&&(u[D]=L),z.$delegate=On.bind(A,p,B,z)}function d(A,B,D){var L=a(D);L&&On.unbind(A,B,L.$delegate)}function m(A){F(c,function(B,D){f(A,D,B)})}function h(A){F(c,function(B,D){d(A,D,B)})}e.on("canvas.destroy",function(A){h(A.svg)}),e.on("canvas.init",function(A){m(A.svg)}),e.on(["shape.added","connection.added"],function(A){var B=A.element,D=A.gfx;e.fire("interactionEvents.createHit",{element:B,gfx:D})}),e.on(["shape.changed","connection.changed"],Oy,function(A){var B=A.element,D=A.gfx;e.fire("interactionEvents.updateHit",{element:B,gfx:D})}),e.on("interactionEvents.createHit",Oy,function(A){var B=A.element,D=A.gfx;i.createDefaultHit(B,D)}),e.on("interactionEvents.updateHit",function(A){var B=A.element,D=A.gfx;i.updateDefaultHit(B,D)});var b=C("djs-hit djs-hit-stroke"),y=C("djs-hit djs-hit-click-stroke"),g=C("djs-hit djs-hit-all"),v=C("djs-hit djs-hit-no-move"),x={all:g,"click-stroke":y,stroke:b,"no-move":v};function C(A,B){return B=V({stroke:"white",strokeWidth:15},B||{}),n.cls(A,["no-fill","no-border"],B)}function T(A,B){var D=x[B];if(!D)throw new Error("invalid hit type <"+B+">");return we(A,D),A}function k(A,B){$e(A,B)}this.removeHits=function(A){var B=Ds(".djs-hit",A);F(B,Kt)},this.createDefaultHit=function(A,B){var D=A.waypoints,L=A.isFrame,z;return D?this.createWaypointsHit(B,D):(z=L?"stroke":"all",this.createBoxHit(B,z,{width:A.width,height:A.height}))},this.createWaypointsHit=function(A,B){var D=aa(B);return T(D,"stroke"),k(A,D),D},this.createBoxHit=function(A,B,D){D=V({x:0,y:0},D);var L=Me("rect");return T(L,B),we(L,D),k(A,L),L},this.updateDefaultHit=function(A,B){var D=pt(".djs-hit",B);if(D)return A.waypoints?Ol(D,A.waypoints):we(D,{width:A.width,height:A.height}),D},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Dy.$inject=["eventBus","elementRegistry","styles"];const Ec={__init__:["interactionEvents"],interactionEvents:["type",Dy]};function Oo(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)})}Oo.$inject=["eventBus","canvas"],Oo.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()})}},Oo.prototype.get=function(){return Array.from(this._selectedElements)},Oo.prototype.isSelected=function(e){return this._selectedElements.has(e)},Oo.prototype.select=function(e,t){var n=this.get();De(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?F(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Ly="hover",Iy="selected";function By(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,Ly)}),t.on("element.out",function(r){i(r.element,Ly)}),t.on("selection.changed",function(r){function o(u){i(u,Iy)}function a(u){n(u,Iy)}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)})}By.$inject=["canvas","eventBus"];function Ny(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;De(u)?t.select(u):t.select(s.filter(DA))}}),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=mt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(pr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=gc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Ny.$inject=["eventBus","selection","canvas","elementRegistry"];function DA(e){return!e.hidden}const ni={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ec],selection:["type",Oo],selectionVisuals:["type",By],selectionBehavior:["type",Ny]};var LA=/^djs-cursor-.*$/;function Sc(e){var t=wt(document.body);t.removeMatching(LA),e&&t.add("djs-cursor-"+e)}function $y(){Sc(null)}var IA=5e3;function Fy(e,t){t=t||"element.click";function n(){return!1}return e.once(t,IA,n),function(){e.off(t,n)}}var BA=["c","C"],NA=["v","V"],$A=["d","D"],FA=["x","X"],jA=["y","Y"],jy=["z","Z"];function HA(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function In(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Xt(e,t){return e=De(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Yp(e){return e.shiftKey}function zA(e){return In(e)&&Xt(BA,e)}function GA(e){return In(e)&&Xt(NA,e)}function VA(e){return In(e)&&Xt($A,e)}function WA(e){return In(e)&&Xt(FA,e)}function UA(e){return In(e)&&!Yp(e)&&Xt(jy,e)}function YA(e){return In(e)&&(Xt(jA,e)||Xt(jy,e)&&Yp(e))}var Do=Math.round,Hy="djs-drag-active";function Gr(e){e.preventDefault()}function qA(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function KA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function zy(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(v){var x=t.viewbox(),C=t._container.getBoundingClientRect();return{x:x.x+(v.x-C.left)/x.scale,y:x.y+(v.y-C.top)/x.scale}}function s(v,x){x=x||o;var C=e.createEvent(V({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+v,C)===!1?!1:e.fire(x.prefix+"."+v,C)}function c(v){var x=v.filter(function(C){return i.get(C.id)});x.length&&n.select(x)}function u(v,x){var C=o.payload,T=o.displacement,k=o.globalStart,A=Hr(v),B=pi(A,k),D=o.localStart,L=a(A),z=pi(L,D);if(!o.active&&(x||KA(B)>o.threshold)){if(V(C,{x:Do(D.x+T.x),y:Do(D.y+T.y),dx:0,dy:0},{originalEvent:v}),s("start")===!1)return b();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&Sc(o.cursor),t.addMarker(t.getRootElement(),Hy)}Cp(v),o.active&&(V(C,{x:Do(L.x+T.x),y:Do(L.y+T.y),dx:Do(z.x),dy:Do(z.y)},{originalEvent:v}),s("move"))}function l(v){var x,C=!0;o.active&&(v&&(o.payload.originalEvent=v,Cp(v)),C=s("end")),C===!1&&s("rejected"),x=y(C!==!0),s("ended",x)}function p(v){Xt("Escape",v)&&(Gr(v),b())}function f(v){var x;o.active&&(x=Fy(e),setTimeout(x,400),Gr(v)),l(v)}function d(v){u(v)}function m(v){var x=o.payload;x.hoverGfx=v.gfx,x.hover=v.element,s("hover")}function h(v){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function b(v){var x;if(o){var C=o.active;C&&s("cancel"),x=y(v),C&&s("canceled",x)}}function y(v){var x,C;s("cleanup"),$y(),o.trapClick?C=f:C=l,Ne.unbind(document,"mousemove",u),Ne.unbind(document,"dragstart",Gr),Ne.unbind(document,"selectstart",Gr),Ne.unbind(document,"mousedown",C,!0),Ne.unbind(document,"mouseup",C,!0),Ne.unbind(document,"keyup",p),Ne.unbind(document,"touchstart",d,!0),Ne.unbind(document,"touchcancel",b,!0),Ne.unbind(document,"touchmove",u,!0),Ne.unbind(document,"touchend",l,!0),e.off("element.hover",m),e.off("element.out",h),t.removeMarker(t.getRootElement(),Hy);var T=o.payload.previousSelection;return v!==!1&&T&&!n.get().length&&c(T),x=o,o=null,x}function g(v,x,C,T){o&&b(!1),typeof x=="string"&&(T=C,C=x,x=null),T=V({},r,T||{});var k=T.data||{},A,B,D,L,z;if(T.trapClick?L=f:L=l,v?(A=Mo(v)||v,B=Hr(v),Cp(v),A.type==="dragstart"&&Gr(A)):(A=null,B={x:0,y:0}),D=a(B),x||(x=D),z=qA(A),o=V({prefix:C,data:k,payload:{},globalStart:B,displacement:pi(x,D),localStart:D,isTouch:z},T),T.manual||(z?(Ne.bind(document,"touchstart",d,!0),Ne.bind(document,"touchcancel",b,!0),Ne.bind(document,"touchmove",u,!0),Ne.bind(document,"touchend",l,!0)):(Ne.bind(document,"mousemove",u),Ne.bind(document,"dragstart",Gr),Ne.bind(document,"selectstart",Gr),Ne.bind(document,"mousedown",L,!0),Ne.bind(document,"mouseup",L,!0)),Ne.bind(document,"keyup",p),e.on("element.hover",m),e.on("element.out",h)),s("init")===!1)return b(),!1;T.autoActivate&&u(v,!0)}e.on("diagram.destroy",b),this.init=g,this.move=u,this.hover=m,this.out=h,this.end=l,this.cancel=b,this.context=function(){return o},this.setOptions=function(v){V(r,v)}}zy.$inject=["eventBus","canvas","selection","elementRegistry"];const Hi={__depends__:[kA,ni],dragging:["type",zy]};function Lo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Lo.prototype.next=function(){return this._prefix+ ++this._counter};const XA=new Lo("ps");var ZA=["marker-start","marker-mid","marker-end"],QA=["circle","ellipse","line","path","polygon","polyline","path","rect"];function fr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}fr.$inject=["elementRegistry","eventBus","canvas","styles"],fr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},fr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},fr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=tm(n);return this._cloneMarkers($r(r),i),we(r,this._styles.cls(i,[])),$e(t,r),we(r,"data-preview-support-element-id",e.id),r},fr.prototype.addFrame=function(e,t){var n=Me("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return $e(t,n),we(n,"data-preview-support-element-id",e.id),n},fr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),nT(e)&&ZA.forEach(function(r){if(we(e,r)){var o=JA(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},fr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,XA.next()].join("-"),a=pt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||tm(n);s.id=o,Qe(s).add(r);var c=pt(":scope > defs",e);c||(c=Me("defs"),$e(e,c)),$e(c,s);var u=tT(s.id);we(t,i,u)};function JA(e,t,n){var i=eT(we(e,t));return pt("marker#"+i,n||document)}function eT(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function tT(e){return"url(#"+e+")"}function nT(e){return QA.indexOf(e.nodeName)!==-1}const Io={__init__:["previewSupport"],previewSupport:["type",fr]};var iT="drop-ok",Gy="drop-not-ok",Vy="attach-ok",Wy="new-parent",Uy="create",rT=2e3;function Yy(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Ye(c,function(g){var v=g.labelTarget;return!g.parent&&!(Ge(g)&&c.indexOf(v)!==-1)});var d=mt(c,function(g){return!ft(g)}),m=!1,h=!1,b=!1;Ky(c)&&(m=r.allowed("shape.attach",{position:l,shape:d,target:u})),m||(Ky(c)?b=r.allowed("shape.create",{position:l,shape:d,source:p,target:u}):b=r.allowed("elements.create",{elements:c,position:l,target:u}));var y=f.connectionTarget;return b||m?(d&&p&&(h=r.allowed("connection.create",{source:y===p?d:p,target:y===p?p:d,hints:{targetParent:u,targetAttach:m}})),{attach:m,connect:h}):b===null||m===null?null:!1}function a(c,u){[Vy,iT,Gy,Wy].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}qy(c);var m={x:c.x,y:c.y},h=u.canExecute=p&&o(l,p,m,f,d);p&&h!==null&&(u.target=p,h&&h.attach?a(p,Vy):a(p,h?Wy:Gy))}),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,m=u.canExecute,h=m&&m.attach,b=m&&m.connect,y=u.hints||{};if(m===!1||!d)return!1;qy(c);var g={x:c.x,y:c.y};b?p=i.appendShape(l,p,g,d,{attach:h,connection:b===!0?{}:b,connectionTarget:y.connectionTarget}):(f=i.createElements(f,g,d,V({},y,{attach:h})),p=mt(f,function(v){return!ft(v)})),V(u,{elements:f,shape:p}),V(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Uy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],rT,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){De(u)||(u=[u]);var p=mt(u,function(m){return!ft(m)});if(p){l=V({elements:u,hints:{},shape:p},l||{}),F(u,function(m){Be(m.x)||(m.x=0),Be(m.y)||(m.y=0)});var f=Ye(u,function(m){return!m.hidden}),d=Bt(f);F(u,function(m){ft(m)&&(m.waypoints=dn(m.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),V(m,{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2})}),t.init(c,Uy,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}Yy.$inject=["canvas","dragging","eventBus","modeling","rules"];function qy(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 Ky(e){return e&&e.length===1&&!ft(e[0])}var oT=750;function Xy(e,t,n,i,r){function o(a){var s=Me("g");we(s,r.cls("djs-drag-group",["no-events"]));var c=Me("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),un(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",oT,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(),$e(p,l)),un(l,a.x,a.y)):Kt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Kt(c)})}Xy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Rc={__depends__:[Hi,Io,Si,ni],__init__:["create","createPreview"],create:["type",Yy],createPreview:["type",Xy]};function qp(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)})}qp.$inject=["eventBus"],qp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||aT(0,0)};function aT(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const Ca={__init__:["mouse"],mouse:["type",qp]};var Zy=2e3;function Bn(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),sT(l)&&(u.priority=2,u.host=l.host.id),ft(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=cT(l)),Ge(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),F(["x","y","width","height"],function(f){Be(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",Zy,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Zy,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;V(u,{createElementsBehavior:!1})})}Bn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Bn.prototype.copy=function(e,t={}){var n,i;return De(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(De(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Bn.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})}}},Bn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Bn.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},Bn.prototype._getElementIdsFromTree=function(e){var t={};return F(e,function(n){F(n,function(i){i.id&&(t[i.id]=!0)})}),t},Bn.prototype._paste=function(e,t,n,i){F(e,function(o){Be(o.x)||(o.x=0),Be(o.y)||(o.y=0)});var r=Bt(e);return F(e,function(o){ft(o)&&(o.waypoints=dn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),V(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,V({},i))},Bn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return F(e,function(o,a){o=di(o,"priority"),F(o,function(s){var c=V({},hi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(ft(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(Ge(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},Bn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(hi(e,["id"]));return t},Bn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(hi(e,["id"]));return t},Bn.prototype.createShape=function(e){var t=this._elementFactory.createShape(hi(e,["id"]));return t},Bn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(ft(e)&&(!n.has(e.source)||!n.has(e.target))||Ge(e)&&!n.has(e.labelTarget))},Bn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Ns(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 m={element:p,depth:f};r.push(m),o.set(p,m);return}if(d.depth<f){r=u(d,r);var h={element:d.element,depth:f};r.push(h),o.set(p,h)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Nr(a,function(p,f,d){if(Ge(p))return;F(p.labels,function(b){c(b,d)});function m(b){b&&b.length&&F(b,function(y){F(y.labels,function(g){c(g,d)}),c(y,d)})}F([p.attachers,p.incoming,p.outgoing],m),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=dn(r,function(p){return p.element});var l=new Set(e);return r=dn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=di(r,function(p){return p.descriptor.priority}),e=dn(r,function(p){return p.element}),F(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){Jy(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){Jy(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function sT(e){return!!e.host}function cT(e){return dn(e.waypoints,function(t){return t=Qy(t),t.original&&(t.original=Qy(t.original)),t})}function Qy(e){return V({},e)}function Jy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const uT={__depends__:[TA,Rc,Ca,Si],__init__:["copyPaste"],copyPaste:["type",Bn]};function Kp(e,t,n){De(n)||(n=[n]),F(n,function(i){Mr(e[i])||(t[i]=e[i])})}var Xp=750;function ev(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Xp,function(c){var u=c.descriptor,l=c.element,p=ne(l);if(Ge(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(tt(l),!0);d.bpmnElement=f,Kp(f,u,"name"),Kp(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=ne(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(ne(c).attachedToRef=ne(u[c.host])),hi(l,Mn(l,function(f,d,m){var h=d.element,b=d.property;return m===c.id&&(h.set(b,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(Ge(l)){l.businessObject=ne(u[l.labelTarget]),l.di=tt(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,Kp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",Xp,function(c){var u=c.descriptor,l=c.element;if(S(l,"bpmn:Participant")){var p=ne(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;S(u,"bpmn:SubProcess")&&F(da(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",Xp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}ev.$inject=["bpmnFactory","eventBus","moddleCopy"];const lT=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],pT=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Pa(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return di(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Qt(r)&&r.$descriptor;if(a&&pT.includes(a))return o;if(a&&lT.includes(a)||a&&s&&!mt(s.properties,ao({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(S(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}Pa.$inject=["eventBus","bpmnFactory","moddle"],Pa.prototype.copyElement=function(e,t,n,i=!1){n&&!De(n)&&(n=[n]),n=n||Zp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(De(r)&&(n=r),F(n,o=>{let a;Tn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Wt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Pa.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return Qt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):De(e)?Mn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Qt(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},Pa.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function Zp(e,t){return Mn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const tv={__depends__:[uT],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",ev],moddleCopy:["type",Pa]};var nv=Math.round;function Qp(e,t){this._modeling=e,this._eventBus=t}Qp.$inject=["modeling","eventBus"],Qp.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=nv(s+o/2),l=nv(c+a/2),p=i.replaceShape(e,V({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function iv(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}iv.$inject=["selection","eventBus"];const fT={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",iv],replace:["type",Qp]};function dT(e,t,n){De(n)||(n=[n]),F(n,function(i){Mr(e[i])||(t[i]=e[i])})}var hT=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function mT(e,t){var n=e&&Tn(e,"collapsed")?e.collapsed:!Xe(e),i;return t&&(Tn(t,"collapsed")||Tn(t,"isExpanded"))?i=Tn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function rv(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(Cc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&mT(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),dT(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var m=Zp(p.$descriptor),h=Zp(f.$descriptor,!0),b=gT(m,h);V(f,ui(c,hT));var y=Ye(b,function(x){return x==="eventDefinitions"?ov(s,c.eventDefinitionType):x==="loopCharacteristics"?!yn(f):Tn(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!yn(f):!0});if(f=n.copyElement(p,f,y),c.eventDefinitionType&&(ov(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),S(p,"bpmn:Activity")){if(Cc(p))d.isExpanded=Xe(s);else if(c&&Tn(c,"isExpanded")){d.isExpanded=c.isExpanded;var g=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=g.width,d.height=g.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Xe(s)&&!S(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Cc(p)&&!Cc(f)&&(u.moveChildren=!1),S(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var v=tn(s);tt(s).isHorizontal||(tt(d).isHorizontal=v),d.width=v?s.width:t.getDefaultSize(d).width,d.height=v?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,We(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&We(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!S(p,"bpmn:BoundaryEvent")&&S(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}rv.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Cc(e){return S(e,"bpmn:SubProcess")}function ov(e,t){var n=ne(e);return t&&n.get("eventDefinitions").some(function(i){return S(i,t)})}function gT(e,t){return e.filter(function(n){return t.includes(n)})}const av={__depends__:[tv,fT,ni],bpmnReplace:["type",rv]};var yT=250;function Vr(e){this._eventBus=e,this._tools=[],this._active=null}Vr.$inject=["eventBus"],Vr.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)},Vr.prototype.isActive=function(e){return e&&this._active===e},Vr.prototype.length=function(e){return this._tools.length},Vr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Vr.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),F(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,yT,function(r){this._active&&(vT(r)||this.setActive(null))},this)};function vT(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Ir(t,'.group[data-group="tools"]')}const Pc={__depends__:[Hi],__init__:["toolManager"],toolManager:["type",Vr]};function bT(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 xT(e,t){var n=[],i=new Set(e);F(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;F(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 _T(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 Jp=Math.abs,wT=Math.round,zi={x:"width",y:"height"},sv="crosshair",dr={n:"top",w:"left",s:"bottom",e:"right"},ET=1500,Ac={n:"s",w:"e",s:"n",e:"w"},Tc=20;function ii(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",ET,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&uv(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,m=u.start;if(u.initialized){uv(c);var h={x:0,y:0};h[l]=wT(c["d"+l]),s.makeSpace(f,d,h,p,m),n.once("spaceTool.ended",function(b){s.activateSelection(b.originalEvent,!0,!0)})}})}ii.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],ii.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:sv,data:{context:{reactivate:n}},trapClick:!1})},ii.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:sv,data:{context:{}}})},ii.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},ii.prototype.init=function(e,t){var n=Jp(e.dx)>Jp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Jp(i)<5)return!1;i<0&&(i*=-1),Ea(e)&&(i*=-1);var o=bT(n,i),a=this._canvas.getRootElement();!gc(e)&&e.hover&&(a=e.hover);var s=[...sa(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=ST(c,n,o,r,u);return V(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),Sc("resize-"+(n==="x"?"ew":"ns")),!0},ii.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 m=d.label;m&&!s.has(m)&&(s.add(m),o.push(m))}function f(d){c.has(d)||(c.add(d),a.push(d))}return F(e,function(d){if(!(!d.parent||Ge(d))){if(ft(d)){l.push(d);return}var m=d[t],h=m+d[zi[t]];if(RT(d)&&(n>0&&Le(d)[t]>i||n<0&&Le(d)[t]<i)){u.push(d);return}if(n>0&&m>i||n<0&&h<i){p(d);return}if(m<i&&h>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),F(o,function(d){var m=d.attachers;m&&F(m,function(h){p(h)})}),F(u,function(d){var m=d.host;(s.has(m)||c.has(m))&&p(d)}),F(l,function(d){var m=d.source,h=d.target,b=d.label;(s.has(m)||c.has(m))&&(s.has(h)||c.has(h))&&b&&p(b)}),{movingShapes:o,resizingShapes:a}},ii.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},ii.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function cv(e){return{top:e.top-Tc,right:e.right+Tc,bottom:e.bottom+Tc,left:e.left-Tc}}function uv(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Be(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Be(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Be(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Be(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function ST(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 F(a,function(f){var d=f.attachers,m=f.children,h=Oe(f),b=Ye(m,function(z){return!ft(z)&&!Ge(z)&&!l.has(z)&&!p.has(z)}),y=Ye(m,function(z){return!ft(z)&&!Ge(z)&&l.has(z)}),g,v,x,C=[],T=[],k,A,B,D;b.length&&(v=cv(Oe(Bt(b))),g=i-h[dr[n]]+v[dr[n]],n==="n"?s.bottom=u=Be(u)?Math.min(u,g):g:n==="w"?s.right=u=Be(u)?Math.min(u,g):g:n==="s"?s.top=c=Be(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Be(c)?Math.max(c,g):g)),y.length&&(x=cv(Oe(Bt(y))),g=i-x[dr[Ac[n]]]+h[dr[Ac[n]]],n==="n"?s.bottom=u=Be(u)?Math.min(u,g):g:n==="w"?s.right=u=Be(u)?Math.min(u,g):g:n==="s"?s.top=c=Be(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Be(c)?Math.max(c,g):g)),d&&d.length&&(d.forEach(function(z){l.has(z)?C.push(z):T.push(z)}),C.length&&(k=Oe(Bt(C.map(Le))),A=h[dr[Ac[n]]]-(k[dr[Ac[n]]]-i)),T.length&&(B=Oe(Bt(T.map(Le))),D=B[dr[n]]-(h[dr[n]]-i)),n==="n"?(g=Math.min(A||1/0,D||1/0),s.bottom=u=Be(u)?Math.min(u,g):g):n==="w"?(g=Math.min(A||1/0,D||1/0),s.right=u=Be(u)?Math.min(u,g):g):n==="s"?(g=Math.max(A||-1/0,D||-1/0),s.top=c=Be(c)?Math.max(c,g):g):n==="e"&&(g=Math.max(A||-1/0,D||-1/0),s.left=c=Be(c)?Math.max(c,g):g));var L=r&&r[f.id];L&&(n==="n"?(g=i+f[zi[t]]-L[zi[t]],s.bottom=u=Be(u)?Math.min(u,g):g):n==="w"?(g=i+f[zi[t]]-L[zi[t]],s.right=u=Be(u)?Math.min(u,g):g):n==="s"?(g=i-f[zi[t]]+L[zi[t]],s.top=c=Be(c)?Math.max(c,g):g):n==="e"&&(g=i-f[zi[t]]+L[zi[t]],s.left=c=Be(c)?Math.max(c,g):g))}),s}}function RT(e){return!!e.host}var ef="djs-dragging",lv="djs-resizing",CT=250,Mc=Math.max;function pv(e,t,n,i,r){function o(a,s){F(a,function(c){r.addDragger(c,s),n.addMarker(c,ef)})}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=Me("g");we(l,i.cls("djs-crosshair-group",["no-events"])),$e(s,l);var p=Me("path");we(p,"d",u.x),Qe(p).add("djs-crosshair"),$e(l,p);var f=Me("path");we(f,"d",u.y),Qe(f).add("djs-crosshair"),$e(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;un(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Kt(c)}),e.on("spaceTool.move",CT,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=Me("path"),we(c,"d","M0,0 L0,0"),Qe(c).add("djs-crosshair"),$e(f,c),s.line=c;var d=Me("g");we(d,i.cls("djs-drag-group",["no-events"])),$e(n.getActiveLayer(),d),o(l,d);var m=new Set(l);F(p,function(T){m.add(T)});var h=new Set,b=s.movingConnections=[];m.forEach(function(T){F(T.outgoing,function(k){h.has(k)||!ft(k)||!m.has(k.target)||(h.add(k),b.push(k))})}),o(b,d),s.dragGroup=d}if(!s.frameGroup){var y=Me("g");we(y,i.cls("djs-frame-group",["no-events"])),$e(n.getActiveLayer(),y);var g=[];F(p,function(T){var k=r.addFrame(T,y),A=k.getBBox();g.push({element:k,initialBounds:A}),n.addMarker(T,lv)}),s.frameGroup=y,s.frames=g}var v={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};we(c,{d:v[u]});var x={x:"y",y:"x"},C={x:a.dx,y:a.dy};C[x[s.axis]]=0,un(s.dragGroup,C.x,C.y),F(s.frames,function(T){var k=T.element,A=T.initialBounds,B,D;s.direction==="e"?we(k,{width:Mc(A.width+C.x,5)}):(B=Mc(A.width-C.x,5),we(k,{width:B,x:A.x+A.width-B})),s.direction==="s"?we(k,{height:Mc(A.height+C.y,5)}):(D=Mc(A.height-C.y,5),we(k,{height:D,y:A.y+A.height-D}))})}}),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;F(c,function(m){n.removeMarker(m,ef)}),F(u,function(m){n.removeMarker(m,ef)}),f&&(Kt(p),Kt(f)),F(l,function(m){n.removeMarker(m,lv)}),d&&Kt(d)})}pv.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const PT={__init__:["spaceToolPreview"],__depends__:[Hi,Si,Pc,Io,Ca],spaceTool:["type",ii],spaceToolPreview:["type",pv]};function kc(e,t){e.invoke(ii,this),this._canvas=t}kc.$inject=["injector","canvas"],_e(kc,ii),kc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=ro(yo(r.children.filter(u=>S(u,"bpmn:Artifact")),Bt(o))));const s=[...e,...a];var c=ii.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(S(u,"bpmn:TextAnnotation")||AT(u)&&(t==="y"&&tn(u)||t==="x"&&!tn(u)))}),c};function AT(e){return S(e,"bpmn:Participant")&&!ne(e).processRef}const fv={__depends__:[PT],spaceTool:["type",kc]};function St(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)}St.$inject=["eventBus","injector"],St.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()},St.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},St.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},St.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()}},St.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()}},St.prototype.register=function(e,t){this._setHandler(e,t)},St.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)},St.prototype.canUndo=function(){return!!this._getUndoAction()},St.prototype.canRedo=function(){return!!this._getRedoAction()},St.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},St.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},St.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)})},St.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},St.prototype._createId=function(){return this._uid++},St.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},St.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()},St.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)},St.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:Cd("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},St.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=De(e)?e:[e],t.dirty=t.dirty.concat(e))},St.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},St.prototype._revertedAction=function(e){this._stackIdx--},St.prototype._getHandler=function(e){return this._handlerMap[e]},St.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 TT={commandStack:["type",St]};function hr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var MT=250,dv=1400;function tf(e,t,n){ee.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",dv,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=hv(a),o.validatedShapes=hv(s)}),i&&t.on("shape.move.start",MT,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",dv,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];F(s,function(u){F(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;hr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=Ll(s.labels,a),o.labelTarget=s,a.labelTarget=null)}),this.revert("shape.delete",function(r){var o=r.context,a=o.shape,s=o.labelTarget,c=o.labelTargetIndex;s&&(Ot(s.labels,a,c),a.labelTarget=s)})}_e(tf,ee),tf.$inject=["injector","eventBus","modeling"];function hv(e){var t=new Set(e);return Ye(e,function(n){return!t.has(n.labelTarget)})}const kT={__init__:["labelSupport"],labelSupport:["type",tf]};var OT=251,mv=1401,gv="attach-ok";function nf(e,t,n,i,r){ee.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",mv,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=DT(c),s.validatedShapes=LT(u)}),o&&t.on("shape.move.start",OT,function(a){var s=a.context,c=s.shapes,u=rf(c);F(u,function(l){o.makeDraggable(s,l,!0),F(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,gv),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,gv)}))}}),this.preExecuted("elements.move",mv,function(a){var s=a.context,c=s.closure,u=s.shapes,l=rf(u);F(l,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Ye(c,function(p){var f=p.host;return IT(p)&&!BT(c,f)}),F(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;F(s,function(c){F(c.attachers,function(u){F(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),F(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;hr(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&&F(u.attachers,function(l){var p=Lg(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&&F(p,function(d){var m=Lg(d,u,l);r.moveShape(d,m,d.parent),F(d.labels,function(h){r.moveShape(h,m,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;hr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}_e(nf,ee),nf.$inject=["injector","eventBus","canvas","rules","modeling"];function rf(e){return Vu(dn(e,function(t){return t.attachers||[]}))}function DT(e){var t=rf(e);return uw("id",e,t)}function LT(e){var t=oo(e,"id");return Ye(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function IT(e){return!!e.host}function BT(e,t){return e.indexOf(t)!==-1}const NT={__depends__:[Si],__init__:["attachSupport"],attachSupport:["type",nf]};function yv(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(um(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)})}yv.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const of={__init__:["changeSupport"],changeSupport:["type",yv]};function ri(e){this._model=e}ri.$inject=["moddle"],ri.prototype._needsId=function(e){return We(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},ri.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;S(e,"bpmn:Activity")?t="Activity":S(e,"bpmn:Event")?t="Event":S(e,"bpmn:Gateway")?t="Gateway":We(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},ri.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},ri.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},ri.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",V({bpmnElement:e,bounds:this.createDiBounds()},t))},ri.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},ri.prototype.createDiWaypoints=function(e){var t=this;return dn(e,function(n){return t.createDiWaypoint(n)})},ri.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ui(e,["x","y"]))},ri.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",V({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},ri.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",V({bpmnElement:e},t))};function Nn(e,t,n){ee.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var m=d.context,h=m.hints||{},b;!m.cropped&&h.createElementsBehavior!==!1&&(b=m.connection,b.waypoints=n.getCroppedWaypoints(b),m.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var m=d.context;i.updateParent(m.shape||m.connection,m.oldParent)}function a(d){var m=d.context,h=m.shape||m.connection,b=m.parent||m.newParent;i.updateParent(h,b)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$n(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$n(a));function s(d){var m=d.context,h=m.oldRoot,b=h.children;F(b,function(y){S(y,"bpmn:BaseElement")&&i.updateParent(y)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var m=d.context.shape;S(m,"bpmn:BaseElement")&&i.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],$n(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],$n(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"],$n(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],$n(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],$n(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],$n(l)),this.executed("connection.reconnect",$n(function(d){var m=d.context,h=m.connection,b=m.oldSource,y=m.newSource,g=ne(h),v=ne(b),x=ne(y);g.conditionExpression&&!We(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=g.conditionExpression,delete g.conditionExpression),b!==y&&v.default===g&&(m.oldDefault=v.default,delete v.default)})),this.reverted("connection.reconnect",$n(function(d){var m=d.context,h=m.connection,b=m.oldSource,y=m.newSource,g=ne(h),v=ne(b),x=ne(y);m.oldConditionExpression&&(g.conditionExpression=m.oldConditionExpression),m.oldDefault&&(v.default=m.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],$n(p)),this.reverted(["element.updateAttachment"],$n(p)),this.executed("element.updateLabel",$n(f)),this.reverted("element.updateLabel",$n(f));function f(d){const{element:m}=d.context,h=qn(m),b=tt(m),y=b&&b.get("label");sr(m)||yc(m)||(h&&!y?b.set("label",t.create("bpmndi:BPMNLabel")):!h&&y&&b.set("label",void 0))}}_e(Nn,ee),Nn.$inject=["eventBus","bpmnFactory","connectionDocking"],Nn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Nn.prototype.updateParent=function(e,t){if(!Ge(e)&&!(S(e,"bpmn:DataStoreReference")&&e.parent&&S(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=tt(e),o=n&&n.businessObject,a=tt(n);S(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),S(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),S(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),S(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Nn.prototype.updateBounds=function(e){var t=tt(e),n=FT(e);if(n){var i=pi(n,t.get("bounds"));V(n,{x:e.x+i.x,y:e.y+i.y})}var r=Ge(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),V(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Nn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;S(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),kt(i,e)),S(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Ot(r,e))}},Nn.prototype.updateDiConnection=function(e,t,n){var i=tt(e),r=tt(t),o=tt(n);i.sourceElement&&i.sourceElement.bpmnElement!==ne(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ne(n)&&(i.targetElement=n&&o)},Nn.prototype.updateDiParent=function(e,t){if(t&&!S(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(kt(n,e),e.$parent=null)}};function $T(e){for(;e&&!S(e,"bpmn:Definitions");)e=e.$parent;return e}Nn.prototype.getLaneSet=function(e){var t,n;return S(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(S(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)},Nn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput"))&&(S(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(S(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(S(e,"bpmn:FlowElement")){if(t){if(S(t,"bpmn:Participant"))t=t.processRef;else if(S(t,"bpmn:Lane"))do t=t.$parent.$parent;while(S(t,"bpmn:Lane"))}i="flowElements"}else if(S(e,"bpmn:Artifact")){for(;t&&!S(t,"bpmn:Process")&&!S(t,"bpmn:SubProcess")&&!S(t,"bpmn:Collaboration");)if(S(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(S(e,"bpmn:MessageFlow"))i="messageFlows";else if(S(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=$T(e.$parent||t),e.$parent&&(kt(o.get("rootElements"),r),r.$parent=null),t&&(Ot(o.get("rootElements"),r),r.$parent=o))}else S(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":S(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),kt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);kt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Nn.prototype.updateConnectionWaypoints=function(e){var t=tt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Nn.prototype.updateConnection=function(e){var t=e.connection,n=ne(t),i=t.source,r=ne(i),o=t.target,a=ne(t.target),s;if(S(n,"bpmn:DataAssociation"))S(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):S(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=S(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(kt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(kt(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)},Nn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function $n(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;S(i,"bpmn:BaseElement")&&e(t)}}function FT(e){if(S(e,"bpmn:Activity")){var t=tt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function mr(e,t){Ni.call(this),this._bpmnFactory=e,this._moddle=t}_e(mr,Ni),mr.$inject=["bpmnFactory","moddle"],mr.prototype._baseCreate=Ni.prototype.create,mr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,V({type:"label",di:n},Fr,t))}return this.createElement(e,t)},mr.prototype.createElement=function(e,t){t=V({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!HT(r)){var o=V({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}S(i,"bpmn:Group")&&(t=V({isFrame:!0},t)),t=jT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=af(r,t,"isExpanded")),We(i,["bpmn:Lane","bpmn:Participant"])&&(t=af(r,t,"isHorizontal")),S(i,"bpmn:SubProcess")&&(t.collapsed=!Xe(i,r)),S(i,"bpmn:ExclusiveGateway")&&(Tn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Wt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Wt(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=V({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},mr.prototype.getDefaultSize=function(e,t){var n=ne(e);if(t=t||tt(e),S(n,"bpmn:SubProcess"))return Xe(n,t)?{width:350,height:200}:{width:100,height:80};if(S(n,"bpmn:Task"))return{width:100,height:80};if(S(n,"bpmn:Gateway"))return{width:50,height:50};if(S(n,"bpmn:Event"))return{width:36,height:36};if(S(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Xe(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return S(n,"bpmn:Lane")?{width:400,height:100}:S(n,"bpmn:DataObjectReference")?{width:36,height:50}:S(n,"bpmn:DataStoreReference")?{width:50,height:50}:S(n,"bpmn:TextAnnotation")?{width:100,height:40}:S(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},mr.prototype.createParticipantShape=function(e){return Qt(e)||(e={isExpanded:e}),e=V({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function jT(e,t,n){return F(n,function(i){t=af(e,t,i)}),t}function af(e,t,n){return t[n]===void 0?t:(e[n]=t[n],hi(t,[n]))}function HT(e){return We(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Oc(e,t){this._modeling=e,this._canvas=t}Oc.$inject=["modeling","canvas"],Oc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;F(n,function(r){var o={x:0,y:0};Wt(i.left)?o.x=i.left-r.x:Wt(i.right)?o.x=i.right-r.width-r.x:Wt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Wt(i.top)?o.y=i.top-r.y:Wt(i.bottom)?o.y=i.bottom-r.height-r.y:Wt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Oc.prototype.postExecute=function(e){};function Dc(e){this._modeling=e}Dc.$inject=["modeling"],Dc.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},Dc.prototype.postExecute=function(e){var t=e.hints||{};zT(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 zT(e,t){return Xi(e.outgoing,function(n){return n.target===t})}function Lc(e,t){this._canvas=e,this._layouter=t}Lc.$inject=["canvas","layouter"],Lc.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},Lc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Ic=Math.round;function sf(e){this._modeling=e}sf.$inject=["modeling"],sf.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;F(t,function(p){Be(p.x)||(p.x=0),Be(p.y)||(p.y=0)});var s=Ye(t,function(p){return!p.hidden}),c=Bt(s);F(t,function(p){ft(p)&&(p.waypoints=dn(p.waypoints,function(f){return{x:Ic(f.x-c.x-c.width/2+r.x),y:Ic(f.y-c.y-c.height/2+r.y)}})),V(p,{x:Ic(p.x-c.x-c.width/2+r.x),y:Ic(p.y-c.y-c.height/2+r.y)})});var u=new Set(Ns(t)),l={};F(t,function(p){if(ft(p)){l[p.id]=Be(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=V({},o);u.has(p)||(f.autoResize=!1),Ge(p)&&(f=hi(f,["attach"])),l[p.id]=Be(i)?a.createShape(p,ui(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,ui(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=ro(l)};var vv=Math.round;function gr(e){this._canvas=e}gr.$inject=["canvas"],gr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?V(t,n):V(t,{x:n.x-vv(t.width/2),y:n.y-vv(t.height/2)}),this._canvas.addShape(t,i,r),t},gr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Aa(e){gr.call(this,e)}_e(Aa,gr),Aa.$inject=["canvas"];var GT=gr.prototype.execute;Aa.prototype.execute=function(e){var t=e.shape;return WT(t),t.labelTarget=e.labelTarget,GT.call(this,e)};var VT=gr.prototype.revert;Aa.prototype.revert=function(e){return e.shape.labelTarget=null,VT.call(this,e)};function WT(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Ta(e,t){this._canvas=e,this._modeling=t}Ta.$inject=["canvas","modeling"],Ta.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;hr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),hr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Ta.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Ll(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Ta.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Ot(n.children,t,i),this._canvas.addConnection(t,n),t};function cf(e,t){this._modeling=e,this._elementRegistry=t}cf.$inject=["modeling","elementRegistry"],cf.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;F(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function Ma(e,t){this._canvas=e,this._modeling=t}Ma.$inject=["canvas","modeling"],Ma.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;hr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),hr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),hr(n.children,function(i){ft(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Ma.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Ll(i.children,n),t.removeShape(n),n},Ma.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Ot(i.children,n,r),t.addShape(n,i),n};function Bc(e){this._modeling=e}Bc.$inject=["modeling"];var bv={x:"y",y:"x"};Bc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(b,y){b.range.min=Math.min(y[i],b.range.min),b.range.max=Math.max(y[i]+y[r],b.range.max)}function a(b){return b[i]+b[r]/2}function s(b){return b.length-1}function c(b){return b.max-b.min}function u(b,y){var g={y:0};g[i]=b-a(y),g[i]&&(g[bv[i]]=0,t.moveElements([y],g,y.parent))}var l=n[0],p=s(n),f=n[p],d,m,h=0;F(n,function(b,y){var g,v,x;if(b.elements.length<2){y&&y!==n.length-1&&(o(b,b.elements[0]),h+=c(b.range));return}g=di(b.elements,i),v=g[0],y===p&&(v=g[s(g)]),x=a(v),b.range=null,F(g,function(C){if(u(x,C),b.range===null){b.range={min:C[i],max:C[i]+C[r]};return}o(b,C)}),y&&y!==n.length-1&&(h+=c(b.range))}),m=Math.abs(f.range.min-l.range.max),d=Math.round((m-h)/(n.length-1)),!(d<n.length-1)&&F(n,function(b,y){var g={},v;b===l||b===f||(v=n[y-1],b.range.max=0,F(b.elements,function(x,C){g[bv[i]]=0,g[i]=v.range.max-x[i]+d,b.range.min!==x[i]&&(g[i]+=x[i]-b.range.min),g[i]&&t.moveElements([x],g,x.parent),b.range.max=Math.max(x[i]+x[r],C?b.range.max:0)}))})},Bc.prototype.postExecute=function(e){};function Nc(e,t){this._layouter=e,this._canvas=t}Nc.$inject=["layouter","canvas"],Nc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return V(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Nc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function uf(){}uf.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=kt(o.children,t),Ot(i.children,t,r),t.parent=i,F(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},uf.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return kt(n.children,t),Ot(i.children,t,r),t.parent=i,F(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 lf(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}lf.prototype.add=function(e,t){return this.addAll([e],t)},lf.prototype.addAll=function(e,t){var n=_S(e,!!t,this);return V(this,n),this};function ka(e){this._modeling=e}ka.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ka.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),F(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),F(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&&gp(p,p.source,t),connectionEnd:d&&yp(p,p.target,t)})})},ka.prototype.getClosure=function(e){return new lf().addAll(e,!0)};function $c(e){this._helper=new ka(e)}$c.$inject=["modeling"],$c.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},$c.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Wr(e){this._modeling=e,this._helper=new ka(e)}Wr.$inject=["modeling"],Wr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=ui(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=kt(o.children,t),Ot(i.children,t,r),V(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Wr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(F(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:yp(o,t,n)})}),F(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:gp(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Wr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Ot(n.children,t,i),V(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Wr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Wr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Oa(e){this._modeling=e}Oa.$inject=["modeling"],Oa.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return De(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Oa.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||xv(De(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||xv(De(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Oa.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function xv(e){return e.original||e}function Gi(e,t){this._modeling=e,this._rules=t}Gi.$inject=["modeling","rules"],Gi.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(m,h,b){return i.allowed("connection.reconnect",{connection:b,source:m,target:h})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var 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();F(f,function(m){var h=m.source,b=c(h,s,m);b&&t.reconnectEnd(m,s,pc(m,s,l),a)}),F(d,function(m){var h=m.target,b=c(s,h,m);b&&t.reconnectStart(m,s,lc(m,s,l),a)})},Gi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Gi.prototype.execute=function(e){},Gi.prototype.revert=function(e){},Gi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Gi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Gi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Da(e){this._modeling=e}Da.$inject=["modeling"],Da.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Da.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(F(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:pc(o,n,i)})}),F(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:lc(o,n,i)})}))},Da.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function yr(e){this._modeling=e}yr.$inject=["modeling"],yr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),F(r,function(s){a[s.id]=YT(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(xT(i,r),t,n,o,i,r,a)},yr.prototype.execute=function(){},yr.prototype.revert=function(){},yr.prototype.moveShapes=function(e,t){var n=this;F(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},yr.prototype.resizeShapes=function(e,t,n){var i=this;F(e,function(r){var o=_T(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},yr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);F(e,function(l){var p=l.source,f=l.target,d=UT(l),m=wv(n),h={},b=c.has(p)||u.has(p),y=c.has(f)||u.has(f);b&&y?(d=dn(d,function(g){return Ev(g,i,n)&&(g[m]=g[m]+t[m]),g.original&&Ev(g.original,i,n)&&(g.original[m]=g.original[m]+t[m]),g}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(b||y)&&(c.has(p)?h.connectionStart=gp(l,p,t):c.has(f)?h.connectionEnd=yp(l,f,t):u.has(p)?h.connectionStart=lc(l,p,a[p.id]):u.has(f)&&(h.connectionEnd=pc(l,f,a[f.id])),s._modeling.layoutConnection(l,h))})};function _v(e){return V({},e)}function UT(e){return dn(e.waypoints,function(t){return t=_v(t),t.original&&(t.original=_v(t.original)),t})}function wv(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Ev(e,t,n){var i=wv(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function YT(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Fc(e){this._modeling=e}Fc.$inject=["modeling"],Fc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Sv(n),t.collapsed=!t.collapsed;var i=Rv(n,t.collapsed);return[t].concat(i)},Fc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Cv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Sv(e){var t={};return F(e,function(n){t[n.id]=n.hidden,n.children&&(t=V({},t,Sv(n.children)))}),t}function Rv(e,t){var n=[];return F(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Rv(i.children,i.collapsed||t)))}),n}function Cv(e,t){var n=[];return F(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Cv(i.children,t)))}),n}function jc(e){this._modeling=e}jc.$inject=["modeling"],jc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Pv(i,t),Av(n,t),t.host=n,t},jc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Pv(n,t),Av(i,t,r),t};function Pv(e,t){return kt(e&&e.attachers,t)}function Av(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Ot(i,t,n)}}function pf(){}pf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},pf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function dt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}dt.$inject=["eventBus","elementFactory","commandStack"],dt.prototype.getHandlers=function(){return{"shape.append":Dc,"shape.create":gr,"shape.delete":Ma,"shape.move":Wr,"shape.resize":Da,"shape.replace":Gi,"shape.toggleCollapse":Fc,spaceTool:yr,"label.create":Aa,"connection.create":Lc,"connection.delete":Ta,"connection.move":uf,"connection.layout":Nc,"connection.updateWaypoints":pf,"connection.reconnect":Oa,"elements.create":sf,"elements.move":$c,"elements.delete":cf,"elements.distribute":Bc,"elements.align":Oc,"element.updateAttachment":jc}},dt.prototype.registerHandlers=function(e){F(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},dt.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)},dt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},dt.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)},dt.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)},dt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},dt.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},dt.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},dt.prototype.createElements=function(e,t,n,i,r){De(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},dt.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},dt.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},dt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},dt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},dt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},dt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},dt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},dt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},dt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},dt.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)},dt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},dt.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)},dt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,V(i,{docking:"source"}))},dt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,V(i,{docking:"target"}))},dt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},dt.prototype._create=function(e,t){return aR(t)?t:this._elementFactory.create(e,t)},dt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function La(e){this._elementRegistry=e}La.$inject=["elementRegistry"],La.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||qT(n,ls(i));return Tv(n,i),e.oldProperties=o,e.changed=r,r},La.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Tv(n,t),i},La.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return S(e,"bpmn:DataObject")?KT(e,t):[]};function qT(e,t){return Mn(t,function(n,i){return n[i]=e.get(i),n},{})}function Tv(e,t){F(t,function(n,i){e.set(i,n)})}function KT(e,t){return t.filter(function(n){return S(n,"bpmn:DataObjectReference")&&ne(n).dataObjectRef===e})}var Ia="default",Vi="id",Mv="di",XT={width:0,height:0};function Ba(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ba.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ba.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=tM(e.properties),s=e.oldProperties||ZT(t,a);return kv(a,o)&&(r.unclaim(o[Vi]),i.updateId(t,a[Vi]),r.claim(a[Vi],o)),Ia in a&&(a[Ia]&&n.push(i.get(a[Ia].id)),o[Ia]&&n.push(i.get(o[Ia].id))),Ov(t,a),e.oldProperties=s,e.changed=n,n},Ba.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ne(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,XT)}},Ba.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Ov(t,i),kv(n,r)&&(a.unclaim(n[Vi]),o.updateId(t,i[Vi]),a.claim(i[Vi],r)),e.changed};function kv(e,t){return Vi in e&&e[Vi]!==t[Vi]}function ZT(e,t){var n=ls(t),i=e.businessObject,r=tt(e);return Mn(n,function(o,a){return a!==Mv?o[a]=i.get(a):o[a]=QT(r,ls(t.di)),o},{})}function QT(e,t){return Mn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Ov(e,t){var n=e.businessObject,i=tt(e);F(t,function(r,o){o!==Mv?n.set(o,r):i&&JT(i,r)})}function JT(e,t){F(t,function(n,i){e.set(i,n)})}var eM=["default"];function tM(e){var t=V({},e);return eM.forEach(function(n){n in e&&(t[n]=ne(t[n]))}),t}function Hc(e,t){this._canvas=e,this._modeling=t}Hc.$inject=["canvas","modeling"],Hc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=tt(r);return t.setRootElement(n),t.removeRootElement(r),Ot(a.rootElements,i),i.$parent=a,kt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Hc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=tt(n);return t.setRootElement(r),t.removeRootElement(n),kt(a.rootElements,i),i.$parent=null,Ot(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function ff(e,t){this._modeling=e,this._spaceTool=t}ff.$inject=["modeling","spaceTool"],ff.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=ei(i),a=o===i,s=a?i:i.parent,c=ur(s),u=tn(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+Jn,y:i.y,width:i.width-Jn,height:i.height}:{x:i.x,y:i.y+Jn,width:i.width,height:i.height-Jn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Nr(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:Ye(x.children,function(C){return C!==i})});var f,d,m,h,b;r==="top"?(f=-120,d=i.y,m=d+10,h="n",b="y"):r==="left"?(f=-120,d=i.x,m=d+10,h="w",b="x"):r==="bottom"?(f=120,d=i.y+i.height,m=d-10,h="s",b="y"):r==="right"&&(f=120,d=i.x+i.width,m=d-10,h="e",b="x");var y=t.calculateAdjustments(p,b,f,m),g=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(y.movingShapes,y.resizingShapes,g,h,m);var v=u?{x:i.x+(a?Jn:0),y:d-(r==="top"?120:0),width:i.width-(a?Jn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Jn:0),width:120,height:i.height-(a?Jn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},v,s)};function df(e){this._modeling=e}df.$inject=["modeling"],df.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=ur(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=tn(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+Jn,y:n.y+f*c,width:n.width-Jn,height:u}:{x:n.x+f*c,y:n.y+Jn,width:u,height:n.height-Jn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function Na(e,t){this._modeling=e,this._spaceTool=t}Na.$inject=["modeling","spaceTool"],Na.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Na.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=KC(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Na.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Oe(e),r=Oe(t),o=lg(r,i),a=ei(e),s=[],c=[];Nr(a,function(m){return s.push(m),(S(m,"bpmn:Lane")||S(m,"bpmn:Participant"))&&c.push(m),m.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 $a="flowNodeRef",hf="lanes";function zc(){}zc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=Oe(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=ei(l);return r[p.id]||(r[p.id]=oc(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=ei(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return S(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get(hf),d=f.slice(),m=u(l);i.push({flowNode:p,remove:d,add:m})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get($a).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},zc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(hf);n.remove.forEach(function(o){kt(r,o),kt(o.get($a),i)}),n.add.forEach(function(o){Ot(r,o),Ot(o.get($a),i)})}),[]},zc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(hf);n.add.forEach(function(o){kt(r,o),kt(o.get($a),i)}),n.remove.forEach(function(o){Ot(r,o),Ot(o.get($a),i)})}),[]};var mf="categoryValueRef";function Fa(e,t){this._bpmnFactory=e,this._elementRegistry=t}Fa.$inject=["bpmnFactory","elementRegistry"],Fa.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(g,v,x){if(v){var C=a.get(g);C||(C={},a.set(g,C)),!(x&&C.present)&&(!x&&C.past||(x?C.present={categoryValue:v,root:gf(g)}:C.past={categoryValue:v}))}}function c(g){r.set(g,ne(g))}function u(){n.filter(function(g){return S(g,"bpmn:FlowElement")&&!Ge(g)&&g.parent}).forEach(c)}function l(g){var v=ne(g),x=v.get("categoryValueRef");return x||(x=og(i,v),o.push(nM(g,x))),x}function p(g){return g.reduce(function(v,x){var C=gf(x),T=v.get(C);return T||(T=[],v.set(C,T)),T.push(x),v},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(g){return S(g,"bpmn:Group")&&!Ge(g)&&g.parent}).forEach(function(g){var v=ne(g).get("categoryValueRef");if(!v){var x=gf(g),C=f.get(x)||[],T=yo(C,g),k=Object.keys(T).length>0;k&&(v=l(g))}s(g,v,!0)}),t.forEach(function(g){s(g.groupShape,g.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),m=Array.from(a.values()).reduce(function(g,v){return v.present&&g.add(v.present.categoryValue),v.past&&g.add(v.past.categoryValue),g},new Set),h=new Map,b=p(d);a.forEach(function(g,v){var x=g.present;if(x){var C=b.get(x.root)||[],T=yo(C,v);C.forEach(function(k){if(T[k.id]){var A=h.get(k);A||(A=new Set,h.set(k,A)),A.add(x.categoryValue)}})}});var y=d.reduce(function(g,v){var x=r.get(v),C=x.get(mf),T=new Set(C),k=h.get(v)||new Set,A=Array.from(k).filter(function(D){return!T.has(D)}),B=C.filter(function(D){return m.has(D)&&!k.has(D)});return(A.length||B.length)&&g.push({businessObject:x,categoryValuesToAdd:A,categoryValuesToRemove:B}),g},[]);return{flowElements:y,groups:o}},Fa.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),iM(t.groups),oM(t.flowElements),[]},Fa.prototype.revert=function(e){var t=e.updates;return aM(t.flowElements),rM(t.groups),[]};function nM(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function iM(e){e.forEach(function(t){ne(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function rM(e){e.forEach(function(t){ne(t.groupShape).categoryValueRef=null})}function oM(e){e.forEach(function(t){var n=t.businessObject,i=n.get(mf);t.categoryValuesToRemove.forEach(function(r){kt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Ot(i,r,!0)})})}function aM(e){e.forEach(function(t){var n=t.businessObject,i=n.get(mf);t.categoryValuesToAdd.forEach(function(r){kt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Ot(i,r,!0)})})}function gf(e){for(;e.parent;)e=e.parent;return e}function Gc(e){this._moddle=e}Gc.$inject=["moddle"],Gc.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},Gc.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var sM={fill:void 0,stroke:void 0};function yf(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(An(t)){var n=cM(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}yf.$inject=["commandStack"],yf.prototype.postExecute=function(e){var t=e.elements,n=e.colors||sM,i=this,r={};"fill"in n&&V(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&V(r,{"border-color":this._normalizeColor(n.stroke)}),F(t,function(o){var a=ft(o)?ui(r,["border-color"]):r,s=tt(o);if(uM(a),Ge(o)){if(!s||!S(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!We(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function cM(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 uM(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var lM={width:0,height:0};function Dv(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return $R(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!Ge(u)&&sr(u)&&!Us(u)&&!Lv(p)){var f=7,d=jl(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=qn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!Ge(l)&&!S(l,"bpmn:TextAnnotation"))){if(Ge(l)&&Lv(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var m=qn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,m)),f&&e.resizeShape(l,f,lM)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Dv.$inject=["modeling","textRenderer","bpmnFactory"];function Lv(e){return!e||!e.trim()}function pn(e,t,n,i){dt.call(this,e,t,n),this._bpmnRules=i}_e(pn,dt),pn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],pn.prototype.getHandlers=function(){var e=dt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=La,e["element.updateProperties"]=Ba,e["canvas.updateRoot"]=Hc,e["lane.add"]=ff,e["lane.resize"]=Na,e["lane.split"]=df,e["lane.updateRefs"]=zc,e["group.updateRefs"]=Fa,e["id.updateClaim"]=Gc,e["element.setColor"]=yf,e["element.updateLabel"]=Dv,e},pn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},pn.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)},pn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},pn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},pn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},pn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},pn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},pn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},pn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},pn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},pn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},pn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Iv(){}Iv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Le(t.source||e.source),t.connectionEnd||Le(t.target||e.target)]};var Vc=20,pM=5,Wc=Math.round,Bv=20,fM={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function dM(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function hM(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Nv(e,t,n){var i=cn(t,e,pM),r=n.split(":")[0],o=Wc((t.x-e.x)/2+e.x),a=Wc((t.y-e.y)/2+e.y),s,c,u=hM(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=dM(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Vc*(/l/.test(r)?-1:1),y:f?a+Vc:a}):(f=o===e.x,s={x:f?o+Vc:o,y:e.y+Vc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:vf(e,s,c).concat(s),directions:c,turnNextDirections:f}}function mM(e,t,n){return Nv(e,t,n)}function gM(e,t,n){var i=Nv(t,e,$v(n));return{waypoints:i.waypoints.slice().reverse(),directions:$v(i.directions),turnNextDirections:i.turnNextDirections}}function yM(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=vf(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function $v(e){return e.split(":").reverse().join(":")}function vM(e,t,n){var i=Wc((t.x-e.x)/2+e.x),r=Wc((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function vf(e,t,n){if(n=n||"h:h",!PM(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(jv(n)){var i=mM(e,t,n),r=gM(e,t,n),o=yM(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return vM(e,t,n)}function bM(e,t,n){var i=vf(e,t,n);return i.unshift(e),i.push(t),zv(i)}function xM(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=sw(o,"straight")[0]||"h:h",s=fM[a]||0,c=cn(e,t,s),u=CM(c,a);n=n||Le(e),i=i||Le(t);var l=u.split(":"),p=Hv(n,e,l[0],AM(c)),f=Hv(i,t,l[1],c);return bM(p,f,u)}function _M(e,t,n,i,r,o){De(n)&&(r=n,o=i,n=Le(e),i=Le(t)),o=V({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&EM(e,t,n,i,o),c||(c=o.connectionEnd&&RM(t,e,i,r),c)||(c=o.connectionStart&&SM(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:xM(e,t,n,i,o)}function wM(e,t,n){return e>=t&&e<=n}function Fv(e,t,n){var i={x:"width",y:"height"};return wM(t[e],n[e],n[e]+n[i[e]])}function EM(e,t,n,i,r){var o={},a,s;return s=cn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Fv(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:Fv(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 SM(e,t,n,i){return bf(e,t,n,i)}function RM(e,t,n,i){var r=i.slice().reverse();return r=bf(e,t,n,r),r?r.reverse():null}function bf(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!mt(l,function(p,f){var d=l[f-1];return d&&ua(p,d)<3})}function o(l,p,f){var d=Ii(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(pm(l[d],p,Bv)||pm(l[d],f,Bv))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=bf(e,t,n,u)),c&&Ii(c)?null:c}function CM(e,t){if(jv(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 PM(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function jv(e){return e&&/t|r|b|l/.test(e)}function AM(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 Hv(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 zv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return Il(r,o,n,0)||t.push(n),t},[])}var TM=-10,MM=40,kM={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},OM={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},xf={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ja={top:"t",right:"r",bottom:"b",left:"l"};function Uc(e){this._elementRegistry=e}_e(Uc,Iv),Uc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=Gv(r&&r[0],n)),a||(a=Gv(r&&r[r.length-1],i)),(S(e,"bpmn:Association")||S(e,"bpmn:DataAssociation"))&&r&&!Vv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=tg(n,s)?kM:OM;return S(e,"bpmn:MessageFlow")?c=LM(n,i,l):(S(e,"bpmn:SequenceFlow")||Vv(n,i))&&(n===i?c={preferredLayouts:jM(n,e,l)}:S(n,"bpmn:BoundaryEvent")?c={preferredLayouts:HM(n,i,a,l)}:Ha(n)||Ha(i)?c={preferredLayouts:l.subProcess,preserveDocking:BM(n)}:S(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:S(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=V(c,t),u=zv(_M(n,i,o,a,r,c))),u||[o,a]};function DM(e){var t=e.host;return cn(Le(e),t,TM)}function LM(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:IM(e,t)}}function IM(e,t){return S(t,"bpmn:Participant")?"source":S(e,"bpmn:Participant")?"target":Ha(t)?"source":Ha(e)||S(t,"bpmn:Event")?"target":S(e,"bpmn:Event")?"source":null}function BM(e){return Ha(e)?"target":"source"}function Gv(e,t){return e?e.original||e:Le(t)}function Vv(e,t){return S(t,"bpmn:Activity")&&S(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Ha(e){return S(e,"bpmn:SubProcess")&&Xe(e)}function Ur(e,t){return e===t}function NM(e,t){return t.indexOf(e)!==-1}function Bo(e){var t=/right|left/.exec(e);return t&&t[0]}function No(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Wv(e,t){return xf[e]===t}function $M(e,t){var n=Bo(e),i=xf[n];return t.indexOf(i)!==-1}function FM(e,t){var n=No(e),i=xf[n];return t.indexOf(i)!==-1}function Uv(e){return e==="right"||e==="left"}function jM(e,t,n){var i=t.waypoints,r=i&&i.length&&cn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function HM(e,t,n,i){var r=Le(e),o=Le(t),a=DM(e),s,c,u=Ur(e.host,t),l=NM(a,["top","right","bottom","left"]),p=cn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?zM(a,l,e,t,n,i):(s=GM(a,p,l,i.isHorizontal),c=VM(a,p,l,i.isHorizontal),[s+":"+c])}function zM(e,t,n,i,r,o){var a=t?e:o.isHorizontal?No(e):Bo(e),s=ja[a],c;return t?Uv(e)?c=Yv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Yv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Yv(e,t,n,i){var r=MM;return!(_f(e,i,n,r)||_f(e,i,{x:n.x+n.width,y:n.y+n.height},r)||_f(e,i,Le(t),r))}function _f(e,t,n,i){return Math.abs(t[e]-n[e])<i}function GM(e,t,n,i){if(n)return ja[e];var r=No(e),o=Bo(e),a=No(t),s=Bo(t);if(i){if(Ur(r,a)||Wv(o,s))return ja[r]}else if(Ur(o,s)||Wv(r,a))return ja[o];return ja[i?o:r]}function VM(e,t,n,i){if(n)return Uv(e)?$M(e,t)||Ur(e,t)?"h":"v":FM(e,t)||Ur(e,t)?"v":"h";var r=No(e),o=Bo(e),a=No(t),s=Bo(t);return a&&!s?"v":s&&!a?"h":i?Ur(r,a)?"h":"v":Ur(o,s)?"v":"h"}Uc.$inject=["elementRegistry"];function qv(e){return V({original:e.point.original||e.point},e.actual)}function vr(e,t){this._elementRegistry=e,this._graphicsFactory=t}vr.$inject=["elementRegistry","graphicsFactory"],vr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(qv(i)),o.push(qv(r)),o},vr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},vr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return la(i,r,n)},vr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},vr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},vr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const wf={__init__:["modeling","bpmnUpdater"],__depends__:[uA,RA,PA,AA,av,TT,kT,NT,ni,of,fv],bpmnFactory:["type",ri],bpmnUpdater:["type",Nn],elementFactory:["type",mr],modeling:["type",pn],layouter:["type",Uc],connectionDocking:["type",vr]};var WM=10,Kv=50,UM=250;function Ef(e,t,n,i){for(var r;r=YM(e,n,t);)n=i(t,n,r);return n}function Sf(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 YM(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=KM(e);return mt(r,function(o){if(o===n)return!1;var a=cn(o,i,WM);return a==="intersect"})}function qM(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||Kv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||UM,c=t.reference||"start";o||(o=QM);function u(m,h){return r==="n"?c==="start"?Oe(m).top-Oe(h).bottom:c==="center"?Oe(m).top-Le(h).y:Oe(m).top-Oe(h).top:r==="w"?c==="start"?Oe(m).left-Oe(h).right:c==="center"?Oe(m).left-Le(h).x:Oe(m).left-Oe(h).left:r==="s"?c==="start"?Oe(h).top-Oe(m).bottom:c==="center"?Le(h).y-Oe(m).bottom:Oe(h).bottom-Oe(m).bottom:c==="start"?Oe(h).left-Oe(m).right:c==="center"?Le(h).x-Oe(m).right:Oe(h).right-Oe(m).right}var l=e.incoming.filter(o).map(function(m){var h=a(m),b=h<0?u(m.source,e):u(e,m.source);return{id:m.source.id,distance:b,weight:h}}),p=e.outgoing.filter(o).map(function(m){var h=a(m),b=h>0?u(e,m.target):u(m.target,e);return{id:m.target.id,distance:b,weight:h}}),f=l.concat(p).reduce(function(m,h){return m[h.id+"__weight_"+h.weight]=h,m},{}),d=Mn(f,function(m,h){var b=h.distance,y=h.weight;return b<0||b>s||(m[String(b)]||(m[String(b)]=0),m[String(b)]+=1*y,(!m.distance||m[m.distance]<m[String(b)])&&(m.distance=b)),m},{});return d.distance||i}function KM(e){var t=Rf(e);return e.host&&(t=t.concat(Rf(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Rf(i))},[]))),t}function Rf(e){return ZM(e).concat(XM(e))}function XM(e){return e.incoming.map(function(t){return t.source})}function ZM(e){return e.outgoing.map(function(t){return t.target})}function QM(){return!0}var JM=100;function Xv(e,t,n){e.on("autoPlace",JM,function(i){var r=i.shape,o=i.source;return e2(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}}Xv.$inject=["eventBus","modeling","canvas"];function e2(e,t,n){n||(n={});var i=n.defaultDistance||Kv,r=Le(e),o=Oe(e);return{x:o.right+i+t.width/2,y:r.y}}function Zv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Zv.$inject=["eventBus","selection"];const t2={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Xv],autoPlaceSelectionBehavior:["type",Zv]};function Qv(e,t,n){var i=tg(e,n);if(S(t,"bpmn:TextAnnotation"))return i2(e,t,i);if(We(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return r2(e,t,i);if(S(t,"bpmn:FlowNode"))return n2(e,t,i)}function n2(e,t,n){var i=Oe(e),r=Le(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=qM(e,{filter:function(d){return S(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;S(e,"bpmn:BoundaryEvent")&&(u=cn(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+Jv(u,c,o)}:{x:r.x+Jv(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Ef(e,t,l,Sf(f))}function Jv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function i2(e,t,n){var i=Oe(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};ft(e)&&(r=Le(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return Ef(e,t,r,Sf(a))}function r2(e,t,n){var i=Oe(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 Ef(e,t,r,Sf(a))}function eb(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Qv(r,i,t)})}eb.$inject=["eventBus","elementRegistry"];const Yc={__depends__:[t2],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",eb]},tb=[Jm,ga,wf,Yc];function o2(e={}){qd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new xo({container:t,moddleExtensions:e.moddleExtensions??ys,additionalModules:[...tb,...e.additionalModules??[]]})}var a2=new Lo("ov"),s2=500;function on(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=a2,this._overlayDefaults=V({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=c2(n.getContainer()),this._init()}on.$inject=["config.overlays","eventBus","canvas","elementRegistry"],on.prototype.get=function(e){if(An(e)&&(e={id:e}),An(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ye(t.overlays,ao({type:e.type})):t.overlays.slice():[]}else return e.type?Ye(this._overlays,ao({type:e.type})):e.id?this._overlays[e.id]:null},on.prototype.add=function(e,t,n){if(Qt(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=V({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},on.prototype.remove=function(e){var t=this.get(e)||[];De(t)||(t=[t]);var n=this;F(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(vi(i.html),vi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},on.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},on.prototype.show=function(){qc(this._overlayRoot)},on.prototype.hide=function(){qc(this._overlayRoot,!1)},on.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ks(this._overlayRoot)},on.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Bt(t);i=o.x,r=o.y}nb(n,i,r),mn(e.html,"data-container-id",t.id)},on.prototype._updateOverlay=function(e){var t=e.position,n=e.htmlContainer,i=e.element,r=t.left,o=t.top;if(t.right!==void 0){var a;i.waypoints?a=Bt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Bt(i).height:s=i.height,o=t.bottom*-1+s}nb(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},on.prototype._createOverlayContainer=function(e){var t=bt('<div class="djs-overlays" />');_n(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},on.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";ib(this._overlayRoot,n)},on.prototype._getOverlayContainer=function(e,t){var n=mt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},on.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)),An(i)&&(i=bt(i)),o=this._getOverlayContainer(n),r=bt('<div class="djs-overlay" data-overlay-id="'+t+'">'),_n(r,{position:"absolute"}),r.appendChild(i),e.type&&wt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();qc(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},on.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&&(Wt(r)&&r>t.scale||Wt(o)&&o<t.scale))&&(c=!1),qc(a,c),this._updateOverlayScale(e,t)},on.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),Wt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Wt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Wt(a)&&(s="scale("+a+","+a+")"),ib(o,s)},on.prototype._updateOverlaysVisibilty=function(e){var t=this;F(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},on.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});F(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){vi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",s2,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(F(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&&wt(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 c2(e){var t=bt('<div class="djs-overlay-container" />');return _n(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function nb(e,t,n){_n(e,{left:t+"px",top:n+"px"})}function qc(e,t){e.style.display=t===!1?"none":""}function ib(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Kc={__init__:["overlays"],overlays:["type",on]};function Cf(e,t){t.invoke(ee,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}_e(Cf,ee),Cf.$inject=["canvas","injector"];const u2={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Cf]};function za(e){return CSS.escape(e)}var l2={"&":"&","<":"<",">":">",'"':""","'":"'"};function rb(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return l2[t]})}var p2="bjs-breadcrumbs-shown";function ob(e,t,n){var i=bt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=wt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=ne(u),p=mt(a,function(f){return f===l});p&&s()});function s(c){c&&(a=f2(c));var u=a.flatMap(function(p){var f=n.findRoot(Ei(p))||n.findRoot(p.id);if(!f&&S(p,"bpmn:Process")){var d=t.find(function(b){var y=ne(b);return y&&y.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var m=rb(p.name||p.id),h=bt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var l=u.length>1;o.toggle(p2,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}ob.$inject=["eventBus","elementRegistry","canvas"];function f2(e){for(var t=ne(e),n=[],i=t;i;i=i.$parent)(S(i,"bpmn:SubProcess")||S(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function ab(e,t){var n=null,i=new d2;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,!(!S(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})}ab.$inject=["eventBus","canvas"];function d2(){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 sb={x:180,y:160};function Yr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Yr.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)})}},Yr.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;S(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),m2(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},Yr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=h2(e),i={x:n.x-sb.x,y:n.y-sb.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)})},Yr.prototype._moveToDiPlane=function(e,t){var n=cb(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Yr.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},Yr.$inject=["eventBus","moddle"];function cb(e){return S(e,"bpmndi:BPMNDiagram")?e:cb(e.$parent)}function h2(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=Oe(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),js(t)}function m2(e,t){var n=e.$parent;return!(!S(n,"bpmn:SubProcess")||n===t.bpmnElement||We(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Xc=250,g2='<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>',y2="bjs-drilldown-empty";function br(e,t,n,i,r){ee.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",Xc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Xc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Xc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],Xc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}_e(br,ee),br.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},br.prototype._canDrillDown=function(e){var t=this._canvas;return S(e,"bpmn:SubProcess")&&t.findRoot(Ei(e))},br.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ne(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;wt(i.html).toggle(y2,!r)}},br.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ne(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=bt('<button type="button" class="bjs-drilldown">'+g2+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(Ei(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},br.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},br.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const v2={__depends__:[Kc,of,u2],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",ob],drilldownCentering:["type",ab],drilldownOverlayBehavior:["type",br],subprocessCompatibility:["type",Yr]};function xr(e){Et.call(this,e)}_e(xr,Et),xr.prototype._modules=[Jm,v2,Kc,ni,ga],xr.prototype._moddleExtensions={};var Zc="keyboard.keydown",b2="keyboard.keyup",x2=1e3,ub="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 wn(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(ub));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}wn.$inject=["config.keyboard","eventBus"],wn.prototype._keydownHandler=function(e){this._keyHandler(e,Zc)},wn.prototype._keyupHandler=function(e){this._keyHandler(e,b2)},wn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Zc,i),n&&e.preventDefault()}},wn.prototype._isEventIgnored=function(e){return!1},wn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(ub)),this.unbind(),e=this._node=this._target,Ne.bind(e,"keydown",this._keydownHandler),Ne.bind(e,"keyup",this._keyupHandler),this._fire("bind")},wn.prototype.getBinding=function(){return this._node},wn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ne.unbind(e,"keydown",this._keydownHandler),Ne.unbind(e,"keyup",this._keyupHandler)),this._node=null},wn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},wn.prototype.addListener=function(e,t,n){Jt(e)&&(n=t,t=e,e=x2),this._eventBus.on(n||Zc,e,t)},wn.prototype.removeListener=function(e,t){this._eventBus.off(t||Zc,e)},wn.prototype.hasModifier=HA,wn.prototype.isCmd=In,wn.prototype.isShift=Yp,wn.prototype.isKey=Xt;var _2=500;function $o(e,t){var n=this;e.on("editorActions.init",_2,function(i){var r=i.editorActions;n.registerBindings(t,r)})}$o.$inject=["eventBus","keyboard"],$o.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(UA(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(YA(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(zA(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(GA(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(VA(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(WA(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Xt(["+","Add","="],r)&&In(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Xt(["-","Subtract"],r)&&In(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Xt("0",r)&&In(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Xt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Pf={__init__:["keyboard","keyboardBindings"],keyboard:["type",wn],keyboardBindings:["type",$o]};var w2={moveSpeed:50,moveSpeedAccelerated:200};function lb(e,t,n){var i=this;this._config=V({},w2,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})}}lb.$inject=["config.keyboardMove","keyboard","canvas"];const pb={__depends__:[Pf],__init__:["keyboardMove"],keyboardMove:["type",lb]};var E2=15;function fb(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=Hr(s),p=pi(l,c);if(!n.dragging&&S2(p)>E2&&(n.dragging=!0,u===0&&Fy(e),Sc("grab")),n.dragging){var f=n.last||n.start;p=pi(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){Ne.unbind(document,"mousemove",r),Ne.unbind(document,"mouseup",o),n=null,$y()}function a(s){if(!Ir(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Hr(s)},Ne.bind(document,"mousemove",r),Ne.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}fb.$inject=["eventBus","canvas"];function S2(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const db={__init__:["moveCanvas"],moveCanvas:["type",fb]};function hb(e,t){var n=Vl(e.min),i=Vl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function R2(e,t){return Math.max(e.min,Math.min(e.max,t))}var C2=Math.sign||function(e){return e>=0?1:-1},Af={min:.2,max:4},mb=10,P2=.1,A2=.75;function Ci(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Sn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||A2;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Ci.$inject=["config.zoomScroll","eventBus","canvas"],Ci.prototype.scroll=function(t){this._canvas.scroll(t)},Ci.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Ci.prototype.zoom=function(t,n){var i=hb(Af,mb*2);this._totalDelta+=t,Math.abs(this._totalDelta)>P2&&(this._zoom(t,n,i),this._totalDelta=0)},Ci.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Ug()&&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))*C2(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},Ci.prototype.stepZoom=function(t,n){var i=hb(Af,mb);this._zoom(t,n,i)},Ci.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Vl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(R2(Af,s),t)},Ci.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Ne[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Ci.prototype._init=function(e){this.toggle(e)};const gb={__init__:["zoomScroll"],zoomScroll:["type",Ci]};function Ga(e){xr.call(this,e)}_e(Ga,xr),Ga.prototype._navigationModules=[pb,db,gb],Ga.prototype._modules=[].concat(xr.prototype._modules,Ga.prototype._navigationModules);function Tf(e){return e&&e[e.length-1]}function yb(e){return e.y}function vb(e){return e.x}var T2={left:vb,center:vb,right:function(e){return e.x+e.width},top:yb,middle:yb,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=Tf(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(F(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=di(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Tf(c).center,o;u=t[0],t=di(t,function(f){return f[i]+f[r]}),l=Tf(t),o[e]=p(u,l)}return o},Fo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ye(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),De(i)&&(r=i),!(r.length<2||!i)){var o=T2[t],a=di(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const M2={__init__:["alignElements"],alignElements:["type",Fo]},k2=new Lo;function jo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}jo.$inject=["eventBus"],jo.prototype.schedule=function(e,t=k2.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},jo.prototype._schedule=function(e,t){const n=O2();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}},jo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},jo.prototype._cancel=function(e){clearTimeout(e.executionId)};function O2(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const D2={scheduler:["type",jo]};var L2="djs-element-hidden",Qc=".entry",I2=1e3,bb=8,B2=300;function $t(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}$t.$inject=["canvas","elementRegistry","eventBus","scheduler"],$t.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=De(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=De(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},$t.prototype._createContainer=function(){var e=bt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},$t.prototype.registerProvider=function(e,t){t||(t=e,e=I2),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},$t.prototype.getEntries=function(e){var t=this._getProviders(),n=De(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return F(t,function(r){if(Jt(r[n])){var o=r[n](e);Jt(o)?i=o(i):F(o,function(a,s){i[s]=a})}}),i},$t.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=mn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},B2);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},$t.prototype.triggerEntry=function(e,t,n,i){if(this.isShown()){var r=this._current.target,o=this._current.entries,a=o[e];if(a){var s=a.action;if(this._eventBus.fire("contextPad.trigger",{entry:a,event:n})!==!1){if(Jt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},$t.prototype.open=function(e,t){if(!(!t&&this.isOpen(e))){var n=this._eventBus.fire("contextPad.open.allowed",{target:e});n!==!1&&(this.close(),this._updateAndOpen(e))}},$t.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},$t.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;F(t,function(r,o){var a=r.group||"default",s=bt(r.html||'<div class="entry" draggable="true"></div>'),c;mn(s,"data-action",o),c=pt("[data-group="+za(a)+"]",n),c||(c=bt('<div class="group"></div>'),mn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&N2(s,r.className),r.title&&mn(s,"title",r.title),r.imageUrl&&(i=bt("<img>"),mn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),wt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},$t.prototype._createHtml=function(e){var t=this,n=bt('<div class="djs-context-pad"></div>');return On.bind(n,Qc,"click",function(i){t.trigger("click",i)}),On.bind(n,Qc,"dragstart",function(i){t.trigger("dragstart",i)}),On.bind(n,Qc,"mouseover",function(i){t.trigger("mouseover",i)}),On.bind(n,Qc,"mouseout",function(i){t.trigger("mouseout",i)}),Ne.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},$t.prototype.getPad=function(e){console.warn(new Error("ContextPad#getPad is deprecated and will be removed in future library versions, cf. https://github.com/bpmn-io/diagram-js/pull/888"));let t;return this.isOpen()&&F2(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},$t.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},$t.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return De(e)!==De(n)?!1:De(e)?e.length===n.length&&kr(e,function(i){return n.includes(i)}):n===e},$t.prototype.isShown=function(){return this.isOpen()&&wt(this._current.html).has("open")},$t.prototype.show=function(){this.isOpen()&&(wt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},$t.prototype.hide=function(){this.isOpen()&&(wt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},$t.prototype._getPosition=function(e){if(!De(e)&&ft(e)){var t=this._canvas.viewbox(),n=$2(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+bb*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+bb*this._canvas.zoom(),top:s.top-a.top}},$t.prototype._updatePosition=function(){const e=()=>{if(this.isOpen()){var t=this._current.html,n=this._getPosition(this._current.target);"x"in n&&"y"in n?(t.style.left=n.x+"px",t.style.top=n.y+"px"):["top","right","bottom","left"].forEach(function(i){i in n&&(t.style[i]=n[i]+"px")})}};this._scheduler.schedule(e,"ContextPad#_updatePosition")},$t.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=De(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,L2)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},$t.prototype._getTargetBounds=function(e){var t=this,n=De(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function N2(e,t){var n=wt(e);t=De(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function $2(e){return e.waypoints[e.waypoints.length-1]}function F2(e,t){return e=De(e)?e:[e],t=De(t)?t:[t],e.length===t.length&&kr(e,function(n){return t.includes(n)})}const xb={__depends__:[Ec,D2,Kc],contextPad:["type",$t]};var Jc,Rt,_b,_r,wb,Eb,Sb,Mf,eu,Va,Rb,kf,Of,Df,tu={},nu=[],j2=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,iu=Array.isArray;function Wi(e,t){for(var n in t)e[n]=t[n];return e}function Lf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Cb(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?Jc.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return ru(e,a,i,r,null)}function ru(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++_b,__i:-1,__u:0};return r==null&&Rt.vnode!=null&&Rt.vnode(o),o}function ou(e){return e.children}function au(e,t){this.props=e,this.context=t}function qr(e,t){if(t==null)return e.__?qr(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"?qr(e):null}function H2(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Wi({},t);o.__v=t.__v+1,Rt.vnode&&Rt.vnode(o),If(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??qr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Lb(i,o,r),t.__e=t.__=null,o.__e!=n&&Pb(o)}}function Pb(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}),Pb(e)}function Ab(e){(!e.__d&&(e.__d=!0)&&_r.push(e)&&!su.__r++||wb!=Rt.debounceRendering)&&((wb=Rt.debounceRendering)||Eb)(su)}function su(){try{for(var e,t=1;_r.length;)_r.length>t&&_r.sort(Sb),e=_r.shift(),t=_r.length,H2(e)}finally{_r.length=su.__r=0}}function Tb(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,m,h,b,y=i&&i.__k||nu,g=t.length;for(c=z2(n,t,y,c,g),p=0;p<g;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&y[d.__i]||tu,d.__i=p,b=If(e,d,f,r,o,a,s,c,u,l),m=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Bf(f.ref,null,d),l.push(d.ref,d.__c||m,d)),h==null&&m!=null&&(h=m),4&d.__u?(c=Mb(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&b!==void 0?c=b:m&&(c=m.nextSibling),d.__u&=-7);return n.__e=h,c}function z2(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]=ru(null,a,null,null,null):iu(a)?a=e.__k[o]=ru(ou,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=ru(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=G2(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=qr(s)),Bb(s,s));return i}function Mb(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=Mb(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=qr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function G2(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 kb(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||j2.test(t)?n:n+"px"}function cu(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||kb(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||kb(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Rb,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[Va]=i[Va]:(n[Va]=kf,e.addEventListener(t,o?Df:Of,o)):e.removeEventListener(t,o?Df:Of,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Ob(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[eu]==null)t[eu]=kf++;else if(t[eu]<n[Va])return;return n(Rt.event?Rt.event(t):t)}}}function If(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,m,h,b,y,g,v,x,C,T,k,A,B,D=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=Rt.__b)&&l(t);e:if(typeof D=="function"){p=a.length;try{if(g=t.props,v=D.prototype&&D.prototype.render,x=(l=D.contextType)&&i[l.__c],C=l?x?x.props.value:l.__:i,n.__c?y=(f=t.__c=n.__c).__=f.__E:(v?t.__c=f=new D(g,C):(t.__c=f=new au(g,C),f.constructor=D,f.render=W2),x&&x.sub(f),f.state||(f.state={}),f.__n=i,d=f.__d=!0,f.__h=[],f._sb=[]),v&&f.__s==null&&(f.__s=f.state),v&&D.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Wi({},f.__s)),Wi(f.__s,D.getDerivedStateFromProps(g,f.__s))),m=f.props,h=f.state,f.__v=t,d)v&&D.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),v&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(v&&D.getDerivedStateFromProps==null&&g!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(g,C),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(g,f.__s,C)===!1){t.__v!=n.__v&&(f.props=g,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(L){L&&(L.__=t)}),nu.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=qr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(g,f.__s,C),v&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,b)})}if(f.context=C,f.props=g,f.__P=e,f.__e=!1,T=Rt.__r,k=0,v)f.state=f.__s,f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),nu.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,T&&T(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++k<25);f.state=f.__s,f.getChildContext!=null&&(i=Wi(Wi({},i),f.getChildContext())),v&&!d&&f.getSnapshotBeforeUpdate!=null&&(b=f.getSnapshotBeforeUpdate(m,h)),A=l!=null&&l.type===ou&&l.key==null?Ib(l.props.children):l,s=Tb(e,iu(A)?A:[A],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),y&&(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(B=o.length;B--;)Lf(o[B])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),L.then||Db(t),Rt.__e(L,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=V2(n.__e,t,n,i,r,o,a,c,u);return(l=Rt.diffed)&&l(t),128&t.__u?void 0:s}function Db(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Db))}function Lb(e,t,n){for(var i=0;i<n.length;i++)Bf(n[i],n[++i],n[++i]);Rt.__c&&Rt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Rt.__e(o,r.__v)}})}function Ib(e){return typeof e!="object"||e==null||e.__b>0?e:iu(e)?e.map(Ib):e.constructor!==void 0?null:Wi({},e)}function V2(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,m,h,b=n.props||tu,y=t.props,g=t.type;if(g=="svg"?r="http://www.w3.org/2000/svg":g=="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==!!g&&(g?d.localName==g:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(g==null)return document.createTextNode(y);e=document.createElementNS(r,g,y.is&&y),s&&(Rt.__m&&Rt.__m(t,o),s=!1),o=null}if(g==null)b===y||s&&e.data==y||(e.data=y);else{if(o=g=="textarea"&&y.defaultValue!=null?null:o&&Jc.call(e.childNodes),!s&&o!=null)for(b={},u=0;u<e.attributes.length;u++)b[(d=e.attributes[u]).name]=d.value;for(u in b)d=b[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in y||u=="value"&&"defaultValue"in y||u=="checked"&&"defaultChecked"in y||cu(e,u,null,d,r);for(u in y)d=y[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?m=d:u=="checked"?h=d:s&&typeof d!="function"||b[u]===d||cu(e,u,d,b[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=""),Tb(t.type=="template"?e.content:e,iu(f)?f:[f],t,n,i,g=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&qr(n,0),s,c),o!=null)for(u=o.length;u--;)Lf(o[u]);s&&g!="textarea"||(u="value",g=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[u]||g=="progress"&&!m||g=="option"&&m!=b[u])&&cu(e,u,m,b[u],r),u="checked",h!=null&&h!=e[u]&&cu(e,u,h,b[u],r))}return e}function Bf(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){Rt.__e(r,n)}}function Bb(e,t,n){var i,r;if(Rt.unmount&&Rt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Bf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Rt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Bb(i[r],t,n||typeof e.type!="function");n||Lf(e.__e),e.__c=e.__=e.__e=void 0}function W2(e,t,n){return this.constructor(e,n)}function Nb(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Rt.__&&Rt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],If(t,e=t.__k=Cb(ou,null,[e]),r||tu,tu,t.namespaceURI,r?null:t.firstChild?Jc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Lb(o,e,a),e.props.children=null}Jc=nu.slice,Rt={__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}},_b=0,au.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Wi({},this.state),typeof e=="function"&&(e=e(Wi({},n),this.props)),e&&Wi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ab(this))},au.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ab(this))},au.prototype.render=ou,_r=[],Eb=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Sb=function(e,t){return e.__v.__b-t.__v.__b},su.__r=0,Mf=Math.random().toString(8),eu="__d"+Mf,Va="__a"+Mf,Rb=/(PointerCapture)$|Capture$/i,kf=0,Of=Ob(!1),Df=Ob(!0);var $b=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,$b(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Fb=new Map;function U2(e){var t=Fb.get(this);return t||(t=new Map,Fb.set(this,t)),(t=$b(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
-
`||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ht=
|
|
10
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+f+'" height="'+d+'" viewBox="'+l+" "+p+" "+f+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},St.prototype._setDefinitions=function(e){this._definitions=e},St.prototype.getModules=function(){return this._modules},St.prototype.clear=function(){this.getDefinitions()&&ar.prototype.clear.call(this)},St.prototype.destroy=function(){ar.prototype.destroy.call(this),vi(this._container)},St.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},St.prototype.off=function(e,t){this.get("eventBus").off(e,t)},St.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),typeof e=="string"&&(e=pt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},St.prototype.getDefinitions=function(){return this._definitions},St.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},St.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=V(hi(n,["additionalModules"]),{canvas:V({},n.canvas,{container:e}),modules:a});ar.call(this,s),n&&n.container&&this.attachTo(n.container)},St.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},St.prototype._createContainer=function(e){const t=bt('<div class="bjs-container"></div>');return _n(t,{width:Wm(e.width),height:Wm(e.height),position:e.position}),t},St.prototype._createModdle=function(e){const t=V({},this._moddleExtensions,e.moddleExtensions);return new Vd(t)},St.prototype._modules=[];function Ws(e,t){return e.warnings=t,e}function AR(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 MR={width:"100%",height:"100%",position:"relative"};function Wm(e){return e+(Be(e)?"px":"")}function TR(e,t){return t&&mt(e.diagrams,function(n){return n.id===t})||null}function kR(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Hm+"</a>",i=bt(n);_n(pt("svg",i),zm),_n(i,Gm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ne.bind(i,"click",function(r){PR(),r.preventDefault()})}function xo(e){St.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}_e(xo,St),xo.prototype._createModdle=function(e){var t=St.prototype._createModdle.call(this,e);return t.ids=new yi([32,36,1]),t},xo.prototype._collectIds=function(e,t){var n=e.$model,i=n.ids,r;i.clear();for(r in t)i.claim(r,t[r])};function Xe(e,t){return S(e,"bpmn:CallActivity")?!1:S(e,"bpmn:SubProcess")?(t=t||tt(e),t&&S(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):S(e,"bpmn:Participant")?!!ne(e).processRef:!0}function tn(e){if(!(!S(e,"bpmn:Participant")&&!S(e,"bpmn:Lane"))){var t=tt(e).isHorizontal;return t===void 0?!0:t}}function OR(e){return e&&ne(e).isInterrupting!==!1}function yn(e){return e&&!!ne(e).triggeredByEvent}function _o(e,t){var n=ne(e).eventDefinitions;return Xi(n,function(i){return S(i,t)})}function DR(e){return _o(e,"bpmn:ErrorEventDefinition")}function LR(e){return _o(e,"bpmn:EscalationEventDefinition")}function IR(e){return _o(e,"bpmn:CompensateEventDefinition")}var Fr={width:90,height:20},Um=15;function sr(e){return S(e,"bpmn:Event")||S(e,"bpmn:Gateway")||S(e,"bpmn:DataStoreReference")||S(e,"bpmn:DataObjectReference")||S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput")||S(e,"bpmn:SequenceFlow")||S(e,"bpmn:MessageFlow")||S(e,"bpmn:Group")}function Us(e){return Ge(e.label)}function BR(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=NR(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=Um:a+=Um,{x:a,y:s}}function NR(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 jl(e){return e.waypoints?BR(e.waypoints):S(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Fr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Fr.height/2}}function $R(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Fr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=jl(t),i=Fr),V({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Ym(e){if(S(e,"bpmn:FlowElement")||S(e,"bpmn:Participant")||S(e,"bpmn:Lane")||S(e,"bpmn:SequenceFlow")||S(e,"bpmn:MessageFlow")||S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput"))return"name";if(S(e,"bpmn:TextAnnotation"))return"text";if(S(e,"bpmn:Group"))return"categoryValueRef"}function FR(e){var t=e.categoryValueRef;return t&&t.value||""}function qn(e){var t=e.businessObject,n=Ym(t);if(n)return n==="categoryValueRef"?FR(t):t[n]||""}function jR(e,t){var n=e.businessObject,i=Ym(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function HR(e){return Ge(e)&&sr(e.labelTarget)}var wo=7;function qm(e){let t=[];return F(e.incoming,n=>{S(n,"bpmn:Association")&&S(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),F(e.outgoing,n=>{S(n,"bpmn:Association")&&S(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function da(e){const t=new Map;return F(Dl(e),n=>{F(qm(n),i=>{t.has(i.annotation)||t.set(i.annotation,{annotation:i.annotation,associations:[]}),t.get(i.annotation).associations.push(i.association)})}),[...t.values()]}var Hl="hsl(225, 10%, 15%)",zR="white";function wi(e,t){return Xi(e.eventDefinitions,function(n){return n.$type===t})}function GR(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function VR(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function qe(e,t,n){var i=tt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||zR}function ve(e,t,n){var i=tt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Hl}function ha(e,t,n,i){var r=tt(e),o=r.get("label");return i||o&&o.get("color:color")||t||ve(e,n)}function Km(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 Br(r)}function zl(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 Br(a)}function WR(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 Br(s)}function UR(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 Br(o)}function ma(e,t={}){return{width:Qn(e,t),height:Ln(e,t)}}function Qn(e,t={}){return Mn(t,"width")?t.width:e.width}function Ln(e,t={}){return Mn(t,"height")?t.height:e.height}var YR=new yi,qR=10,Ys=3,KR=1.5,qs=10,XR=4,Eo=.95,ZR=1,QR=.25;function jr(e,t,n,i,r,o,a){Li.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(T){return n.computeStyle(T,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Hl,strokeWidth:2,fill:"white"})}function p(T){return n.computeStyle(T,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Hl,strokeWidth:2})}function f(T,E){var{ref:w={x:0,y:0},scale:G=1,element:U,parentGfx:X=r._svg}=E,Ee=Te("marker",{id:T,viewBox:"0 0 20 20",refX:w.x,refY:w.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});$e(Ee,U);var He=pt(":scope > defs",X);He||(He=Te("defs"),$e(X,He)),$e(He,Ee)}function d(T,E,w,G){var U=YR.nextPrefixed("marker-");return m(T,U,E,w,G),"url(#"+U+")"}function m(T,E,w,G,U){if(w==="sequenceflow-end"){var X=Te("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:U,stroke:U,strokeWidth:1})});f(E,{element:X,ref:{x:11,y:10},scale:.5,parentGfx:T})}if(w==="messageflow-start"){var Ee=Te("circle",{cx:6,cy:6,r:3.5,...l({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});f(E,{element:Ee,ref:{x:6,y:6},parentGfx:T})}if(w==="messageflow-end"){var He=Te("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});f(E,{element:He,ref:{x:8.5,y:5},parentGfx:T})}if(w==="association-start"){var it=Te("path",{d:"M 11 5 L 1 10 L 11 15",...p({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(E,{element:it,ref:{x:1,y:10},scale:.5,parentGfx:T})}if(w==="association-end"){var At=Te("path",{d:"M 1 5 L 11 10 L 1 15",...p({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});f(E,{element:At,ref:{x:11,y:10},scale:.5,parentGfx:T})}if(w==="conditional-flow-marker"){var lt=Te("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:G,stroke:U})});f(E,{element:lt,ref:{x:-1,y:10},scale:.5,parentGfx:T})}if(w==="conditional-default-flow-marker"){var Vt=Te("path",{d:"M 6 4 L 10 16",...l({stroke:U,fill:"none"})});f(E,{element:Vt,ref:{x:0,y:10},scale:.5,parentGfx:T})}}function h(T,E,w,G,U={}){Qt(G)&&(U=G,G=0),G=G||0,U=l(U);var X=E/2,Ee=w/2,He=Te("circle",{cx:X,cy:Ee,r:Math.round((E+w)/4-G),...U});return $e(T,He),He}function v(T,E,w,G,U,X){Qt(U)&&(X=U,U=0),U=U||0,X=l(X);var Ee=Te("rect",{x:U,y:U,width:E-U*2,height:w-U*2,rx:G,ry:G,...X});return $e(T,Ee),Ee}function y(T,E,w,G){var U=E/2,X=w/2,Ee=[{x:U,y:0},{x:E,y:X},{x:U,y:w},{x:0,y:X}],He=Ee.map(function(At){return At.x+","+At.y}).join(" ");G=l(G);var it=Te("polygon",{...G,points:He});return $e(T,it),it}function g(T,E,w,G){w=p(w);var U=aa(E,w,G);return $e(T,U),U}function b(T,E,w){return g(T,E,w,5)}function x(T,E,w){w=p(w);var G=Te("path",{...w,d:E});return $e(T,G),G}function C(T,E,w,G){return x(E,w,V({"data-marker":T},G))}function M(T){return gt[T]}function k(T){return function(E,w,G){return M(T)(E,w,G)}}var A={"bpmn:MessageEventDefinition":function(T,E,w={},G){var U=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.235,my:.315}}),X=G?ve(E,c,w.stroke):qe(E,s,w.fill),Ee=G?qe(E,s,w.fill):ve(E,c,w.stroke),He=x(T,U,{fill:X,stroke:Ee,strokeWidth:1});return He},"bpmn:TimerEventDefinition":function(T,E,w={}){var G=w.width||E.width,U=w.height||E.height,X=w.width?1:2,Ee=h(T,G,U,.2*U,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:X}),He=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}});x(T,He,{stroke:ve(E,c,w.stroke),strokeWidth:X});for(var it=0;it<12;it++){var At=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}}),lt=G/2,Vt=U/2;x(T,At,{strokeWidth:1,stroke:ve(E,c,w.stroke),transform:"rotate("+it*30+","+Vt+","+lt+")"})}return Ee},"bpmn:EscalationEventDefinition":function(T,E,w={},G){var U=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.5,my:.2}}),X=G?ve(E,c,w.stroke):qe(E,s,w.fill);return x(T,U,{fill:X,stroke:ve(E,c,w.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(T,E,w={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.5,my:.222}});return x(T,G,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(T,E,w={},G){var U=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.57,my:.263}}),X=G?ve(E,c,w.stroke):qe(E,s,w.fill);return x(T,U,{fill:X,stroke:ve(E,c,w.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(T,E,w={},G){var U=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.2,my:.722}}),X=G?ve(E,c,w.stroke):qe(E,s,w.fill);return x(T,U,{fill:X,stroke:ve(E,c,w.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(T,E,w={},G){var U=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.638,my:-.055}}),X=G?ve(E,c,w.stroke):"none",Ee=x(T,U,{fill:X,stroke:ve(E,c,w.stroke),strokeWidth:1});return Fm(Ee,45),Ee},"bpmn:CompensateEventDefinition":function(T,E,w={},G){var U=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.22,my:.5}}),X=G?ve(E,c,w.stroke):qe(E,s,w.fill);return x(T,U,{fill:X,stroke:ve(E,c,w.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(T,E,w={},G){var U=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.5,my:.2}}),X=G?ve(E,c,w.stroke):qe(E,s,w.fill);return x(T,U,{strokeWidth:1,fill:X,stroke:ve(E,c,w.stroke)})},"bpmn:MultipleEventDefinition":function(T,E,w={},G){var U=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.211,my:.36}}),X=G?ve(E,c,w.stroke):qe(E,s,w.fill);return x(T,U,{fill:X,stroke:ve(E,c,w.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(T,E,w={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:w.width||E.width,containerHeight:w.height||E.height,position:{mx:.458,my:.194}});return x(T,G,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(T,E,w={}){var G=h(T,E.width,E.height,8,{fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke),strokeWidth:4});return G}};function B(T,E,w={},G){var U=ne(T),X=GR(U),Ee=G||T;return U.get("eventDefinitions")&&U.get("eventDefinitions").length>1?U.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](E,Ee,w,X):A["bpmn:MultipleEventDefinition"](E,Ee,w,X):wi(U,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](E,Ee,w,X):wi(U,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](E,Ee,w,X):wi(U,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](E,Ee,w,X):wi(U,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](E,Ee,w,X):wi(U,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](E,Ee,w,X):wi(U,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](E,Ee,w,X):wi(U,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](E,Ee,w,X):wi(U,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](E,Ee,w,X):wi(U,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](E,Ee,w,X):wi(U,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](E,Ee,w,X):null}var D={ParticipantMultiplicityMarker:function(T,E,w={}){var G=Qn(E,w),U=Ln(E,w),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2-6)/G,my:(U-15)/U}});C("participant-multiplicity",T,X,{strokeWidth:2,fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke)})},SubProcessMarker:function(T,E,w={}){var G=v(T,14,14,0,{strokeWidth:1,fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke)});un(G,E.width/2-7.5,E.height-20);var U=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}});C("sub-process",T,U,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke)})},ParallelMarker:function(T,E,w){var G=Qn(E,w),U=Ln(E,w),X=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+w.parallel)/G,my:(U-20)/U}});C("parallel",T,X,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke)})},SequentialMarker:function(T,E,w){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+w.seq)/E.width,my:(E.height-19)/E.height}});C("sequential",T,G,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke)})},CompensationMarker:function(T,E,w){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+w.compensation)/E.width,my:(E.height-13)/E.height}});C("compensation",T,G,{strokeWidth:1,fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke)})},LoopMarker:function(T,E,w){var G=Qn(E,w),U=Ln(E,w),X=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+w.loop)/G,my:(U-7)/U}});C("loop",T,X,{strokeWidth:1.5,fill:"none",stroke:ve(E,c,w.stroke),strokeMiterlimit:.5})},AdhocMarker:function(T,E,w){var G=Qn(E,w),U=Ln(E,w),X=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+w.adhoc)/G,my:(U-15)/U}});C("adhoc",T,X,{strokeWidth:1,fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke)})}};function L(T,E,w,G){D[T](E,w,G)}function z(T,E,w=[],G={}){G={fill:G.fill,stroke:G.stroke,width:Qn(E,G),height:Ln(E,G)};var U=ne(E),X=w.includes("SubProcessMarker");X?G={...G,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:G={...G,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},U.get("isForCompensation")&&w.push("CompensationMarker"),S(U,"bpmn:AdHocSubProcess")&&(w.push("AdhocMarker"),X||V(G,{compensation:G.compensation-18}));var Ee=U.get("loopCharacteristics"),He=Ee&&Ee.get("isSequential");Ee&&(V(G,{compensation:G.compensation-18}),w.includes("AdhocMarker")&&V(G,{seq:-23,loop:-18,parallel:-24}),He===void 0&&w.push("LoopMarker"),He===!1&&w.push("ParallelMarker"),He===!0&&w.push("SequentialMarker")),w.includes("CompensationMarker")&&w.length===1&&V(G,{compensation:-8}),F(w,function(it){L(it,T,E,G)})}function ie(T,E,w={}){w=V({size:{width:100}},w);var G=o.createText(E||"",w);return Qe(G).add("djs-label"),$e(T,G),G}function ge(T,E,w,G={}){var U=ne(E),X=ma({x:E.x,y:E.y,width:E.width,height:E.height},G);return ie(T,U.name,{align:w,box:X,padding:7,style:{fill:ha(E,u,c,G.stroke)}})}function Ue(T,E,w={}){var G={width:E.width,height:E.height,x:E.width/2+E.x,y:E.height/2+E.y};return ie(T,qn(E),{box:G,style:V({},o.getExternalStyle(),{fill:ha(E,u,c,w.stroke)})})}function je(T,E,w,G={}){var U=tn(w),X=ie(T,E,{box:{height:30,width:U?Ln(w,G):Qn(w,G)},align:"center-middle",style:{fill:ha(w,u,c,G.stroke)}});if(U){var Ee=-1*Ln(w,G);Gs(X,0,-Ee,270)}}function K(T,E,w={}){var{width:G,height:U}=ma(E,w);return v(T,G,U,qs,{...w,fill:qe(E,s,w.fill),fillOpacity:Eo,stroke:ve(E,c,w.stroke)})}function pe(T,E,w={}){var G=ne(E),U=qe(E,s,w.fill),X=ve(E,c,w.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(w.markerEnd=d(T,"association-end",U,X)),G.get("associationDirection")==="Both"&&(w.markerStart=d(T,"association-start",U,X)),w=nt(w,["markerStart","markerEnd"]),b(T,E.waypoints,{...w,stroke:X,strokeDasharray:"0, 5"})}function ce(T,E,w={}){var G=qe(E,s,w.fill),U=ve(E,c,w.stroke),X=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}}),Ee=x(T,X,{fill:G,fillOpacity:Eo,stroke:U}),He=ne(E);if(VR(He)){var it=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.33,my:(E.height-18)/E.height}});x(T,it,{strokeWidth:2,fill:G,stroke:U})}return Ee}function ye(T,E,w={}){return h(T,E.width,E.height,{fillOpacity:Eo,...w,fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke)})}function Me(T,E,w={}){return y(T,E.width,E.height,{fill:qe(E,s,w.fill),fillOpacity:Eo,stroke:ve(E,c,w.stroke)})}function W(T,E,w={}){var G=v(T,Qn(E,w),Ln(E,w),0,{fill:qe(E,s,w.fill),fillOpacity:w.fillOpacity||Eo,stroke:ve(E,c,w.stroke),strokeWidth:1.5}),U=ne(E);if(S(U,"bpmn:Lane")){var X=U.get("name");je(T,X,E,w)}return G}function Y(T,E,w={}){var G=K(T,E,w),U=Xe(E);if(yn(E)&&(we(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!U)){var X=ne(E).flowElements||[],Ee=X.filter(He=>S(He,"bpmn:StartEvent"));Ee.length===1&&te(Ee[0],T,w,E)}return ge(T,E,U?"center-top":"center-middle",w),U?z(T,E,void 0,w):z(T,E,["SubProcessMarker"],w),G}function te(T,E,w,G){var U=22,X={fill:qe(G,s,w.fill),stroke:ve(G,c,w.stroke),width:U,height:U},Ee=ne(T).isInterrupting,He=Ee?0:3,it=Ee?1:1.2,At=20,lt=(U-At)/2,Vt="translate("+lt+","+lt+")";h(E,At,At,{fill:X.fill,stroke:X.stroke,strokeWidth:it,strokeDasharray:He,transform:Vt}),B(T,E,X,G)}function Ae(T,E,w={}){var G=K(T,E,w);return ge(T,E,"center-middle",w),z(T,E,void 0,w),G}var gt=this.handlers={"bpmn:AdHocSubProcess":function(T,E,w={}){return Xe(E)?w=nt(w,["fill","stroke","width","height"]):w=nt(w,["fill","stroke"]),Y(T,E,w)},"bpmn:Association":function(T,E,w={}){return w=nt(w,["fill","stroke"]),pe(T,E,w)},"bpmn:BoundaryEvent":function(T,E,w={}){var{renderIcon:G=!0}=w;w=nt(w,["fill","stroke"]);var U=ne(E),X=U.get("cancelActivity");w={strokeWidth:1.5,fill:qe(E,s,w.fill),fillOpacity:ZR,stroke:ve(E,c,w.stroke)},X||(w.strokeDasharray="6");var Ee=ye(T,E,w);return h(T,E.width,E.height,Ys,{...w,fill:"none"}),G&&B(E,T,w),Ee},"bpmn:BusinessRuleTask":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=Ae(T,E,w),U=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),X=x(T,U);we(X,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1});var Ee=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),He=x(T,Ee);return we(He,{fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(T,E,w={}){return w=nt(w,["fill","stroke"]),Y(T,E,{strokeWidth:5,...w})},"bpmn:ComplexGateway":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=Me(T,E,w),U=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.26}});return x(T,U,{fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=ce(T,E,w);return x(T,G,{fill:"none",stroke:ve(E,c,w.stroke),strokeWidth:1}),U},"bpmn:DataInputAssociation":function(T,E,w={}){return w=nt(w,["fill","stroke"]),pe(T,E,{...w,markerEnd:d(T,"association-end",qe(E,s,w.fill),ve(E,c,w.stroke))})},"bpmn:DataObject":function(T,E,w={}){return w=nt(w,["fill","stroke"]),ce(T,E,w)},"bpmn:DataObjectReference":k("bpmn:DataObject"),"bpmn:DataOutput":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=ce(T,E,w);return x(T,G,{strokeWidth:1,fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke)}),U},"bpmn:DataOutputAssociation":function(T,E,w={}){return w=nt(w,["fill","stroke"]),pe(T,E,{...w,markerEnd:d(T,"association-end",qe(E,s,w.fill),ve(E,c,w.stroke))})},"bpmn:DataStoreReference":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:0,my:.133}});return x(T,G,{fill:qe(E,s,w.fill),fillOpacity:Eo,stroke:ve(E,c,w.stroke),strokeWidth:2})},"bpmn:EndEvent":function(T,E,w={}){var{renderIcon:G=!0}=w;w=nt(w,["fill","stroke"]);var U=ye(T,E,{...w,strokeWidth:4});return G&&B(E,T,w),U},"bpmn:EventBasedGateway":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=ne(E),U=Me(T,E,w);h(T,E.width,E.height,E.height*.2,{fill:qe(E,"none",w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1});var X=G.get("eventGatewayType"),Ee=!!G.get("instantiate");function He(){var At=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:E.width,containerHeight:E.height,position:{mx:.36,my:.44}});x(T,At,{fill:"none",stroke:ve(E,c,w.stroke),strokeWidth:2})}if(X==="Parallel"){var it=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}});x(T,it,{fill:"none",stroke:ve(E,c,w.stroke),strokeWidth:1})}else X==="Exclusive"&&(Ee||h(T,E.width,E.height,E.height*.26,{fill:"none",stroke:ve(E,c,w.stroke),strokeWidth:1}),He());return U},"bpmn:ExclusiveGateway":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=Me(T,E,w),U=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}}),X=tt(E);return X.get("isMarkerVisible")&&x(T,U,{fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(T,E,w={}){return w=nt(w,["fill","stroke"]),Me(T,E,w)},"bpmn:Group":function(T,E,w={}){return w=nt(w,["fill","stroke","width","height"]),v(T,E.width,E.height,qs,{stroke:ve(E,c,w.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Qn(E,w),height:Ln(E,w)})},"bpmn:InclusiveGateway":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=Me(T,E,w);return h(T,E.width,E.height,E.height*.24,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(T,E,w={}){var{renderIcon:G=!0}=w;w=nt(w,["fill","stroke"]);var U=ye(T,E,{...w,strokeWidth:1.5});return h(T,E.width,E.height,Ys,{fill:"none",stroke:ve(E,c,w.stroke),strokeWidth:1.5}),G&&B(E,T,w),U},"bpmn:IntermediateCatchEvent":k("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":k("bpmn:IntermediateEvent"),"bpmn:Lane":function(T,E,w={}){return w=nt(w,["fill","stroke","width","height"]),W(T,E,{...w,fillOpacity:QR})},"bpmn:ManualTask":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=Ae(T,E,w),U=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(T,U,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=ne(E),U=tt(E),X=qe(E,s,w.fill),Ee=ve(E,c,w.stroke),He=b(T,E.waypoints,{markerEnd:d(T,"messageflow-end",X,Ee),markerStart:d(T,"messageflow-start",X,Ee),stroke:Ee,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var it=He.getPointAtLength(He.getTotalLength()/2),At=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:it.x,y:it.y}}),lt={strokeWidth:1};U.get("messageVisibleKind")==="initiating"?(lt.fill=X,lt.stroke=Ee):(lt.fill=Ee,lt.stroke=X);var Vt=x(T,At,lt),nn=G.get("messageRef"),rn=nn.get("name"),vt=ie(T,rn,{align:"center-top",fitBox:!0,style:{fill:Ee}}),Mt=Vt.getBBox(),vn=vt.getBBox(),Ar=it.x-vn.width/2,jn=it.y+Mt.height/2+qR;Gs(vt,Ar,jn,0)}return He},"bpmn:ParallelGateway":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=Me(T,E,w),U=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.2}});return x(T,U,{fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke),strokeWidth:1}),G},"bpmn:Participant":function(T,E,w={}){w=nt(w,["fill","stroke","width","height"]);var G=W(T,E,w),U=Xe(E),X=tn(E),Ee=ne(E),He=Ee.get("name");if(U){var it=X?[{x:30,y:0},{x:30,y:Ln(E,w)}]:[{x:0,y:30},{x:Qn(E,w),y:30}];g(T,it,{stroke:ve(E,c,w.stroke),strokeWidth:KR}),je(T,He,E,w)}else{var At=ma(E,w);X||(At.height=Qn(E,w),At.width=Ln(E,w));var lt=ie(T,He,{box:At,align:"center-middle",style:{fill:ha(E,u,c,w.stroke)}});if(!X){var Vt=-1*Ln(E,w);Gs(lt,0,-Vt,270)}}return Ee.get("participantMultiplicity")&&L("ParticipantMultiplicityMarker",T,E,w),G},"bpmn:ReceiveTask":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=ne(E),U=Ae(T,E,w),X;return G.get("instantiate")?(h(T,28,28,20*.22,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1}),X=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):X=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(T,X,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1}),U},"bpmn:ScriptTask":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=Ae(T,E,w),U=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(T,U,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=Ae(T,E,w),U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(T,U,{fill:ve(E,c,w.stroke),stroke:qe(E,s,w.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=qe(E,s,w.fill),U=ve(E,c,w.stroke),X=b(T,E.waypoints,{markerEnd:d(T,"sequenceflow-end",G,U),stroke:U}),Ee=ne(E),{source:He}=E;if(He){var it=ne(He);Ee.get("conditionExpression")&&S(it,"bpmn:Activity")&&we(X,{markerStart:d(T,"conditional-flow-marker",G,U)}),it.get("default")&&(S(it,"bpmn:Gateway")||S(it,"bpmn:Activity"))&&it.get("default")===Ee&&we(X,{markerStart:d(T,"conditional-default-flow-marker",G,U)})}return X},"bpmn:ServiceTask":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=Ae(T,E,w);h(T,10,10,{fill:qe(E,s,w.fill),stroke:"none",transform:"translate(6, 6)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(T,U,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1}),h(T,10,10,{fill:qe(E,s,w.fill),stroke:"none",transform:"translate(11, 10)"});var X=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(T,X,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(T,E,w={}){var{renderIcon:G=!0}=w;w=nt(w,["fill","stroke"]);var U=ne(E);U.get("isInterrupting")||(w={...w,strokeDasharray:"6"});var X=ye(T,E,w);return G&&B(E,T,w),X},"bpmn:SubProcess":function(T,E,w={}){return Xe(E)?w=nt(w,["fill","stroke","width","height"]):w=nt(w,["fill","stroke"]),Y(T,E,w)},"bpmn:Task":function(T,E,w={}){return w=nt(w,["fill","stroke"]),Ae(T,E,w)},"bpmn:TextAnnotation":function(T,E,w={}){w=nt(w,["fill","stroke"]);var{width:G,height:U}=ma(E,w),X=v(T,G,U,0,0,{fill:"none",stroke:"none"}),Ee=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:0,my:0}});x(T,Ee,{stroke:ve(E,c,w.stroke)});var He=ne(E),it=He.get("text")||"";return ie(T,it,{align:"left-top",box:ma(E,w),padding:wo,style:{fill:ha(E,u,c,w.stroke)}}),X},"bpmn:Transaction":function(T,E,w={}){Xe(E)?w=nt(w,["fill","stroke","width","height"]):w=nt(w,["fill","stroke"]);var G=Y(T,E,{strokeWidth:1.5,...w}),U=n.style(["no-fill","no-events"],{stroke:ve(E,c,w.stroke),strokeWidth:1.5}),X=Xe(E);return X||(w={}),v(T,Qn(E,w),Ln(E,w),qs-Ys,Ys,U),G},"bpmn:UserTask":function(T,E,w={}){w=nt(w,["fill","stroke"]);var G=Ae(T,E,w),U=15,X=12,Ee=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:X}});x(T,Ee,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:.5});var He=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:X}});x(T,He,{fill:qe(E,s,w.fill),stroke:ve(E,c,w.stroke),strokeWidth:.5});var it=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:X}});return x(T,it,{fill:ve(E,c,w.stroke),stroke:ve(E,c,w.stroke),strokeWidth:.5}),G},label:function(T,E,w={}){return Ue(T,E,w)}};this._drawPath=x,this._renderer=M}_e(jr,Li),jr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],jr.prototype.canRender=function(e){return S(e,"bpmn:BaseElement")},jr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},jr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},jr.prototype.getShapePath=function(e){return Ge(e)?zl(e,XR):S(e,"bpmn:Event")?Km(e):S(e,"bpmn:Activity")?zl(e,qs):S(e,"bpmn:Gateway")?WR(e):UR(e)};function nt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var JR=0,eC={width:150,height:50};function tC(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function nC(e){return Qt(e)?V({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Gl=null;function iC(){return Gl||(Gl=document.createElement("canvas").getContext("2d")),Gl}function rC(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(Xm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Xm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function oC(e,t){var n=iC();if(!n)return{width:0,height:0};n.font=rC(t),"letterSpacing"in n&&(n.letterSpacing=Xm(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 aC(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=oC(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return sC(e,r,i,o);r=uC(r,o.width,t)}}function sC(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 Zm="";function cC(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===Zm)&&r.pop();break}var a=r[r.length-1];return a&&a===Zm&&(r[r.length-1]="-"),r.join("")}function uC(e,t,n){var i=Math.max(e.length*(n/t),1),r=cC(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ks(e){this._config=V({},{size:eC,padding:JR,style:{},align:"center-top"},e||{})}Ks.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ks.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ks.prototype.layoutText=function(e,t){for(var n=V({},this._config.size,t.box),i=V({},this._config.style,t.style),r=tC(t.align||this._config.align),o=nC(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=lC(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(aC(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var p=Tn(u,function(v,y,g){return v+(s||y.height)},0)+o.top+o.bottom,f=Tn(u,function(v,y,g){return y.width>v?y.width:v},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-p)/2),d-=(s||u[0].height)/4;var m=Te("text");we(m,i),F(u,function(v){var y;switch(d+=s||v.height,r.horizontal){case"left":y=o.left;break;case"right":y=(a?f:l)-o.right-v.width;break;default:y=Math.max(((a?f:l)-v.width)/2+o.left,0)}var g=Te("tspan");we(g,{x:y,y:d}),g.textContent=v.text,$e(m,g)});var h={width:f,height:p};return{dimensions:h,element:m}};function lC(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var pC=12,fC=1.2,dC=40;function Qm(e){var t=V({fontFamily:"Arial, sans-serif",fontSize:pC,fontWeight:"normal",lineHeight:fC},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=V({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ks({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Fr.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:wo});return{x:a.x,y:a.y,width:a.width,height:Math.max(dC,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,V({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Qm.$inject=["config.textRenderer"];function hC(){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=vC(i.d,{mx:r,my:o,e:a});return p}}var mC=/\{([^{}]+)\}/g,gC=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function yC(e,t,n){var i=n;return t.replace(gC,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 vC(e,t){return String(e).replace(mC,function(n,i){return yC(n,i,t)})}const bC={__init__:["bpmnRenderer"],bpmnRenderer:["type",jr],textRenderer:["type",Qm],pathMap:["type",hC]};function xC(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ga={translate:["value",xC]};function Xs(e,t,n){return V({id:e.id,type:e.$type,businessObject:e,di:t},n)}function _C(e,t,n){var i=e.waypoint;return!i||i.length<2?[Le(t),Le(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Jm(e,t,n){return new Error(`element ${gn(t)} referenced by ${gn(e)}#${n} not yet drawn`)}function $i(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}$i.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],$i.prototype.add=function(e,t,n){var i,r,o;if(S(t,"bpmndi:BPMNPlane")){var a=S(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Xs(e,t,a)),this._canvas.addRootElement(i)}else if(S(t,"bpmndi:BPMNShape")){var s=!Xe(e,t),c=EC(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Xs(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),S(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),S(e,"bpmn:Lane")&&(o=0),S(e,"bpmn:DataStoreReference")&&(wC(n,Le(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(S(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),p=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Xs(e,t,{hidden:r,source:l,target:p,waypoints:_C(t,l,p)})),S(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${gn(t)} for element ${gn(e)}`);return sr(e)&&qn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},$i.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${gn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Jm(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},$i.prototype.addLabel=function(e,t,n){var i,r,o;return i=$R(t,n),r=qn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Xs(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!qn(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},$i.prototype._getConnectedElement=function(e,t){var n,i,r=e.$type;if(i=e[t+"Ref"],t==="source"&&r==="bpmn:DataInputAssociation"&&(i=i&&i[0]),(t==="source"&&r==="bpmn:DataOutputAssociation"||t==="target"&&r==="bpmn:DataInputAssociation")&&(i=e.$parent),n=i&&this._getElement(i),n)return n;throw i?Jm(e,i,t+"Ref"):new Error(`${gn(e)}#${t} Ref not specified`)},$i.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},$i.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},$i.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function wC(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 EC(e){return S(e,"bpmn:Group")}const eg={__depends__:[bC,{__depends__:[ga],bpmnImporter:["type",$i]}]};function ya(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function pi(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Vl(e){return Math.log(e)/Math.log(10)}var SC=1e3;function ee(e){this._eventBus=e}ee.$inject=["eventBus"];function RC(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}ee.prototype.on=function(e,t,n,i,r,o){if((Jt(t)||Be(t))&&(o=r,r=i,i=n,n=t,t=null),Jt(n)&&(o=r,r=i,i=n,n=SC),Qt(r)&&(o=r,r=!1),!Jt(i))throw new Error("handlerFn must be a function");De(e)||(e=[e]);var a=this._eventBus;F(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?RC(i,o):i,o)})},ee.prototype.canExecute=Fi("canExecute"),ee.prototype.preExecute=Fi("preExecute"),ee.prototype.preExecuted=Fi("preExecuted"),ee.prototype.execute=Fi("execute"),ee.prototype.executed=Fi("executed"),ee.prototype.postExecute=Fi("postExecute"),ee.prototype.postExecuted=Fi("postExecuted"),ee.prototype.revert=Fi("revert"),ee.prototype.reverted=Fi("reverted");function Fi(e){return function(n,i,r,o,a){(Jt(n)||Be(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Wl=["top","bottom","left","right"],Zs=10;function Ul(e,t){ee.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Us(r)&&!ft(r)){var o=AC(r);o&&i(r,o)}}function i(r,o){var a=Le(r),s=r.label,c=Le(s);if(s.parent){var u=Oe(r),l;switch(o){case"top":l={x:a.x,y:u.top-Zs-s.height/2};break;case"left":l={x:u.left-Zs-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Zs+s.height/2};break;case"right":l={x:u.right+Zs+s.width/2,y:a.y};break}var p=pi(l,c);t.moveShape(s,p)}}}_e(Ul,ee),Ul.$inject=["eventBus","modeling"];function CC(e){var t=e.host,n=Le(e),i=cn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Wl.filter(function(a){return r.indexOf(a)===-1});return o}function PC(e){var t=Le(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return tg(t,i)});return n}function AC(e){var t=Le(e.label),n=Le(e),i=tg(n,t);if(MC(i)){var r=PC(e);if(e.host){var o=CC(e);r=r.concat(o)}var a=Wl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?cn(e.label,e)!=="intersect"?void 0:i:a[0]}}function tg(e,t){return cn(t,e,5)}function MC(e){return Wl.indexOf(e)!==-1}function Yl(e){ee.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(S(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)}_e(Yl,ee),Yl.$inject=["eventBus"];var TC=1500;function ql(e,t,n){e.invoke(ee,this),this.preExecute("elements.delete",TC,function(r){var o=r.context,a=o.elements,s=i(a);s.length&&(o.elements=a.concat(s))}),t.on("shape.move.start",function(r){var o=r.context.shapes,a=i(o);a.length&&(r.context.shapes=o.concat(a))});function i(r){var o=Ye(r,u=>S(u,"bpmn:Participant")||S(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>S(u,"bpmn:Artifact"))),c=new Set;return F(o,u=>{const l=new Set(ro(yo(Array.from(s),$t(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}_e(ql,ee),ql.$inject=["injector","eventBus","canvas"];function Kl(e,t){e.invoke(ee,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ye(r.incoming.concat(r.outgoing),function(a){return S(a,"bpmn:Association")});F(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}_e(Kl,ee),Kl.$inject=["injector","modeling"];function So(e,t){for(An(t)&&(t=[t]);e=e.parent;)if(We(e,t))return e;return null}function ng(e,t){var n=So(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=So(e,i),n)return tn(n);if(We(e,i))return tn(e);var r;for(r=ne(e);r&&!S(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ne(a);return s&&s.get("processRef")===r});return o?tn(o):!0}var ig=500;function Qs(e,t){t.invoke(ee,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ig,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return rg(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",ig,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];rg(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Qs.$inject=["bpmnReplace","injector"],_e(Qs,ee),Qs.prototype._replaceShape=function(e,t){var n=kC(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function kC(e){var t=ne(e),n=t.eventDefinitions;return n&&n[0]}function rg(e,t){return!Ge(e)&&We(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Xl(e,t){ee.call(this,e);function n(i){return Ye(i.attachers,function(r){return S(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);S(r,"bpmn:EventBasedGateway")&&S(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;S(r,"bpmn:Gateway")&&S(o,"bpmn:EventBasedGateway")&&F(o.outgoing,function(a){var s=a.target,c=n(s);S(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Xl.$inject=["eventBus","modeling"],_e(Xl,ee);function og(e){return e.create("bpmn:Category")}function OC(e){return e.create("bpmn:CategoryValue")}function ag(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=OC(e)),n.$parent||(n.$parent=og(e)),n}function DC(e,t,n){return Lt(t.get("categoryValue"),e),e.$parent=t,Lt(n.get("rootElements"),t),t.$parent=n,e}function LC(e){var t=e.$parent;return t&&(Dt(t.get("categoryValue"),e),e.$parent=null),e}function IC(e){var t=e.$parent;return t&&(Dt(t.get("rootElements"),e),e.$parent=null),e}var BC=500;function Zl(e,t,n){n.invoke(ee,this);function i(c){return t.filter(function(u){return S(u,"bpmn:Group")&&!u.labelTarget}).map(ne).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&&DC(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&IC(u),c&&!r(c,l)&&LC(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!S(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;!S(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ne(u))},!0),this.executed(["shape.move","shape.resize"],BC,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,ne(u))},!0),this.executed("group.updateRefs",function(c){sg(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){sg(c).forEach(function(u){s(u.categoryValue,u.category,ne(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!S(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ne(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!S(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Zl.$inject=["bpmnjs","elementRegistry","injector"],_e(Zl,ee);function sg(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Ql(e,t,n){ee.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(v){const y=v.source,g=v.target;Ro(y)&&va(g)&&l(g)}function r(v){const y=v.connection,g=v.source,b=v.target;Ro(g)&&Js(b)&&(u(b),f(g,[y]))}function o(v){const y=v.newTarget,g=v.oldSource,b=v.oldTarget;if(b!==y){const x=g;va(b)&&l(b),Ro(x)&&Js(y)&&u(y)}}function a(v){const{element:y}=v;va(y)?(p(y),d(y)):Js(y)&&m(y)}function s(v){const{newData:y,oldShape:g}=v;if(Ro(v.oldShape)&&y.eventDefinitionType!=="bpmn:CompensateEventDefinition"||y.type!=="bpmn:BoundaryEvent"){const b=g.outgoing.find(({target:x})=>va(x));b&&b.target&&(v._connectionTarget=b.target)}else if(!Ro(v.oldShape)&&y.eventDefinitionType==="bpmn:CompensateEventDefinition"&&y.type==="bpmn:BoundaryEvent"){const b=g.outgoing.find(({target:x})=>Js(x));b&&b.target&&(v._connectionTarget=b.target),h(g)}}function c(v){const{_connectionTarget:y,newShape:g}=v;y&&t.connect(g,y)}function u(v){t.updateProperties(v,{isForCompensation:!0})}function l(v){t.updateProperties(v,{isForCompensation:void 0})}function p(v){for(const y of v.incoming)n.canConnect(y.source,v)||t.removeConnection(y);for(const y of v.outgoing)n.canConnect(v,y.target)||t.removeConnection(y)}function f(v,y){v.outgoing.filter(x=>S(x,"bpmn:Association")).filter(x=>va(x.target)&&!y.includes(x)).forEach(x=>t.removeConnection(x))}function d(v){const y=v.attachers.slice();y.length&&t.removeElements(y)}function m(v){const y=v.incoming.filter(g=>Ro(g.source));t.removeElements(y)}function h(v){const y=v.outgoing.filter(g=>S(g,"bpmn:SequenceFlow"));t.removeElements(y)}}_e(Ql,ee),Ql.$inject=["eventBus","modeling","bpmnRules"];function va(e){const t=ne(e);return t&&t.get("isForCompensation")}function Ro(e){return e&&S(e,"bpmn:BoundaryEvent")&&_o(e,"bpmn:CompensateEventDefinition")}function Js(e){return e&&S(e,"bpmn:Activity")&&!yn(e)}function Jl(e){e.invoke(ee,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;S(i,"bpmn:Lane")&&!S(r,"bpmn:Lane")&&(n.parent=So(i,"bpmn:Participant"))})}Jl.$inject=["injector"],_e(Jl,ee);function ep(e,t){ee.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(S(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}})}ep.$inject=["eventBus","bpmnFactory"],_e(ep,ee);var tp=20,np=20,cg=30,ec=2e3;function ip(e,t,n){ee.call(this,t),t.on(["create.start","shape.move.start"],ec,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!S(a,"bpmn:Participant")||!S(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(p){return!S(p,"bpmn:Group")&&!Ge(p)&&!ft(p)});if(c.length){var u=$t(c),l=NC(a,u);V(a,l),o.createConstraints=$C(a,u)}}}),t.on("create.start",ec,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}S(a,"bpmn:Participant")&&S(s,"bpmn:Process")&&(t.on("element.hover",ec,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return S(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",ec,function(r){var o=r.elements,a=r.parent,s=FC(o),c;s&&S(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ne(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;S(a,"bpmn:Participant")&&S(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=ne(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)&&ne(s).set("processRef",ne(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)&&ne(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)}ip.$inject=["canvas","eventBus","modeling"],_e(ip,ee);function NC(e,t){t={width:t.width+tp*2+cg,height:t.height+np*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 $C(e,t){return t=Oe(t),{bottom:t.top+e.height/2-np,left:t.right-e.width/2+tp,top:t.bottom-e.height/2+np,right:t.left+e.width/2-tp-cg}}function FC(e){return mt(e,function(t){return S(t,"bpmn:Participant")})}var ug="__targetRef_placeholder";function rp(e,t){ee.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],lg(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],lg(o));function n(a,s,c){var u=a.get("dataInputAssociations");return mt(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=mt(c,function(l){return l.name===ug});return!u&&s&&(u=t.create("bpmn:Property",{name:ug}),Lt(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||Dt(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,m=s.oldTarget||s.target,h=m&&m.businessObject,v=c.businessObject,y;h&&h!==p&&r(h,u),d&&d!==p&&r(d,u),p?(y=i(p,!0),v.targetRef=y):v.targetRef=null}}rp.$inject=["eventBus","bpmnFactory"],_e(rp,ee);function lg(e){return function(t){var n=t.context,i=n.connection;if(S(i,"bpmn:DataInputAssociation"))return e(t)}}function tc(e){this._bpmnUpdater=e}tc.$inject=["bpmnUpdater"],tc.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},tc.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]};function op(e,t,n,i){ee.call(this,i),t.registerHandler("dataStore.updateContainment",tc);function r(){return n.filter(function(s){return S(s,"bpmn:Participant")&&ne(s).processRef})[0]}function o(s){return s.children.filter(function(c){return S(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:tt(s),newSemanticParent:l.processRef||l,newDiParent:tt(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;S(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 S(p,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(p){return!S(p,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;S(u,"bpmn:DataStoreReference")&&u.type!=="label"&&S(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(!S(l,"bpmn:Collaboration")&&S(u,"bpmn:DataStoreReference")&&u.type!=="label"&&S(p,"bpmn:Collaboration")){var f=S(l,"bpmn:Participant")?l:HC(l,"bpmn:Participant");a(u,f)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();We(u,["bpmn:Participant","bpmn:SubProcess"])&&S(l,"bpmn:Collaboration")&&o(l).filter(function(p){return jC(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){S(l,"bpmn:Process")&&a(f,l)})})}op.$inject=["canvas","commandStack","elementRegistry","eventBus"],_e(op,ee);function jC(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 HC(e,t){for(;e.parent;){if(S(e.parent,t))return e.parent;e=e.parent}}var nc=Math.max,ic=Math.min,zC=20;function pg(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function GC(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 VC(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}}function rc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Be(r)&&(i=(/top|left/.test(e)?ic:nc)(i,r)),Be(o)&&(i=(/top|left/.test(e)?nc:ic)(i,o)),i}function WC(e,t){if(!t)return e;var n=Oe(e);return js({top:rc("top",n,t),right:rc("right",n,t),bottom:rc("bottom",n,t),left:rc("left",n,t)})}function UC(e,t,n,i){var r=Oe(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?Oe(i):o,s={top:ic(o.top,a.top),left:ic(o.left,a.left),bottom:nc(o.bottom,a.bottom),right:nc(o.right,a.right)};return js(s)}function ba(e,t){return typeof e<"u"?e:zC}function YC(e,t){var n,i,r,o;return typeof t=="object"?(n=ba(t.left),i=ba(t.right),r=ba(t.top),o=ba(t.bottom)):n=i=r=o=ba(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function qC(e){return!(e.waypoints||e.type==="label")}function fg(e,t){var n;if(e.length===void 0?n=Ye(e.children,qC):n=e,n.length)return YC($t(n),t)}var cr=Math.abs;function KC(e,t){return pg(Oe(t),Oe(e))}var XC=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Jn=30;function oc(e,t){return t=t||[],e.children.filter(function(n){S(n,"bpmn:Lane")&&(oc(n,t),t.push(n))}),t}function ur(e){return e.children.filter(function(t){return S(t,"bpmn:Lane")})}function ei(e){return So(e,XC)||e}function ZC(e,t){var n=ei(e),i=S(n,"bpmn:Process")?[]:[n],r=oc(n,i),o=Oe(e),a=Oe(t),s=KC(e,t),c=[],u=tn(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,m=u?s.left:0,h=Oe(l);s.top&&(cr(h.bottom-o.top)<10&&(d=a.top-h.bottom),cr(h.top-o.top)<5&&(p=a.top-h.top)),s.left&&(cr(h.right-o.left)<10&&(f=a.left-h.right),cr(h.left-o.left)<5&&(m=a.left-h.left)),s.bottom&&(cr(h.top-o.bottom)<10&&(p=a.bottom-h.top),cr(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(cr(h.left-o.right)<10&&(m=a.right-h.left),cr(h.right-o.right)<5&&(f=a.right-h.right)),(p||f||d||m)&&c.push({shape:l,newBounds:VC(l,{top:p,right:f,bottom:d,left:m})})}}),c}var QC=500;function ap(e,t){ee.call(this,e);function n(i,r){var o=tn(i),a=ur(r),s=[],c=[],u=[],l=[];if(Nr(a,function(v){return o?v.y>i.y?c.push(v):s.push(v):v.x>i.x?l.push(v):u.push(v),v.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,m,h;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&&(m=t.calculateAdjustments(u,"x",p,i.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:p,y:0},"e")),l.length&&(h=t.calculateAdjustments(l,"x",-p,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-p,y:0},"w"))}}this.postExecuted("shape.delete",QC,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;S(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}ap.$inject=["eventBus","spaceTool"],_e(ap,ee);var dg=500;function ac(e,t){t.invoke(ee,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",dg,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return hg(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",dg,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;hg(a,eP(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}ac.$inject=["bpmnReplace","injector"],_e(ac,ee),ac.prototype._replaceShape=function(e){var t=JC(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function JC(e){var t=ne(e),n=t.eventDefinitions;return n&&n[0]}function hg(e,t){return!Ge(e)&&S(e,"bpmn:BoundaryEvent")&&!t}function eP(e,t){return e.indexOf(t)!==-1}var sc=Math.round,tP=Math.max;function nP(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 iP(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var mg=10;function rP(e,t){var n,i;for(n=0;i=e[n];n++)if(ua(i,t)<=mg)return{point:e[n],bendpoint:!0,index:n};return null}function oP(e,t){var n=xm(nP(t,mg),iP(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=tP(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:sc(i.x+r.x)/2,y:sc(i.y+r.y)/2},index:i.segment2}:{point:{x:sc(i.x),y:sc(i.y)},index:i.segment2}:null}function sp(e,t){return rP(e,t)||oP(e,t)}function cp(e,t,n){ee.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,p,f,d,m,h=r.outgoing.slice(),v=r.incoming.slice(),y;Be(a.width)?y=Le(a):y=a;var g=sp(s,y);if(g){if(c=s.slice(0,g.index),u=s.slice(g.index+(g.bendpoint?1:0)),!c.length||!u.length)return;l=g.bendpoint?s[g.index]:y,(c.length===1||!gg(r,c[c.length-1]))&&c.push(yg(l)),(u.length===1||!gg(r,u[0]))&&u.unshift(yg(l))}p=o.source,f=o.target,t.canConnect(p,r,o)&&(n.reconnectEnd(o,r,c||y),d=o),t.canConnect(r,f,o)&&(d?m=n.connect(r,f,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||y),m=o));var b=[].concat(d&&Ye(v,function(x){return x.source===d.source})||[],m&&Ye(h,function(x){return x.target===m.target})||[]);b.length&&n.removeElements(b)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=Le(c),l={x:u.x+s.x,y:u.y+s.y},p=mt(o.children,function(f){var d=t.canInsert(a,f);return d&&sp(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)}_e(cp,ee),cp.$inject=["eventBus","bpmnRules","modeling"];function gg(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 yg(e){return V({},e)}function up(e,t){ee.call(this,e),this.preExecuted("connection.create",function(n){var i=n.context,r=i.connection,o=i.source,a=i.target,s=i.hints;if(!(s&&s.createElementsBehavior===!1)&&Co(r)){var c=[];S(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&Co(u)):c=a.incoming.filter(u=>u!==r&&Co(u)&&S(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(S(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(Co).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Co).forEach(function(s){const c=a.incoming.filter(Co).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}up.$inject=["eventBus","modeling"],_e(up,ee);function Co(e){return S(e,"bpmn:SequenceFlow")}var cc=1500,vg=2e3;function bg(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],cc,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;S(a,"bpmn:Lane")&&!We(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=ei(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||We(o,["bpmn:Group","bpmn:TextAnnotation"]))&&(i.hover=s,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],cc,function(i){var r=i.hover;S(r,"bpmn:Lane")&&(i.hover=ei(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],cc,function(i){var r=i.context,o=i.hover,a=r.type;S(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=ei(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],cc,function(i){var r=i.context,o=r.start;S(o,"bpmn:Lane")&&(r.start=ei(o)||o)}),t.on("shape.move.start",vg,function(i){var r=i.shape;S(r,"bpmn:Lane")&&(i.shape=ei(r)||r)}),t.on("spaceTool.move",vg,function(i){var r=i.hover;r&&S(r,"bpmn:Lane")&&(i.hover=ei(r))})}bg.$inject=["elementRegistry","eventBus","canvas"];var xg=770;function lp(e,t,n,i){n.invoke(ee,this);function r(s,c){var u=ne(s),l=c.categoryValue||u.categoryValueRef;l||(l=ag(e,u));var p=c.category||l.$parent||og(e);u.categoryValueRef=l,l.$parent=p,c.categoryValue=l,c.category=p}function o(s,c){var u=ne(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;S(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;S(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=ne(u);if(!(!S(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(!(!S(u,"bpmn:Group")||u.labelTarget)){var l=c.category,p=c.categoryValue,f=ne(u);p&&(f.categoryValueRef=p,p.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!S(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ne(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!S(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ne(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!S(u,"bpmn:Group")||u.labelTarget||ne(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!S(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",xg,function(s){var c=s.descriptor,u=s.element;if(!(!S(u,"bpmn:Group")||u.labelTarget)){var l=ne(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",xg,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})}lp.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],_e(lp,ee);function pp(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 _g(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=pp(i,r,o,a),u=pp(i,r,o,s),l;c&&u?wg(c,o)>wg(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],Le(i.source)),t(r[r.length-1],r[r.length-2],Le(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}_g.$inject=["eventBus"];function wg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function fp(e){ee.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(n){var i=n.context.shape,r=ne(i),o=tt(i);if(We(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}fp.$inject=["eventBus"],_e(fp,ee);function Eg(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Sg(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function aP(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 sP(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 dp(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=sP([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 Rg(e,t){var n=dp(e,t),i={x:n.x-e.x,y:n.y-e.y};return Eg(i)}function xa(e,t){return Eg({x:e.x-t.x,y:e.y-t.y})}var Cg=Math.sqrt,Pg=Math.min,cP=Math.max,Ag=Math.abs;function Mg(e){return Math.pow(e,2)}function _a(e,t){return Cg(Mg(e.x-t.x)+Mg(e.y-t.y))}function uP(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],kg(i,r)?u=[i]:(o=_a(e,i),a=_a(e,r),c=Pg(o,a),u=lP(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:kg(i,u[0])?n:n+1}),u.length===2&&(s=fP(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:_a(i,s)/_a(i,r)}),p=_a(l.position,e),(!d||f>p)&&(d=l,f=p)}return d}function lP(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 m=Cg(d),h=-p+m,v=-p-m,y={x:e.x-r*h,y:e.y-o*h};if(d===0)return[y];var g={x:e.x-r*v,y:e.y-o*v};return[y,g].filter(function(b){return pP(b,e,t)})}function pP(e,t,n){return Tg(e.x,t.x,n.x)&&Tg(e.y,t.y,n.y)}function Tg(e,t,n){return e>=Pg(t,n)-uc&&e<=cP(t,n)+uc}function fP(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var uc=.1;function kg(e,t){return Ag(e.x-t.x)<=uc&&Ag(e.y-t.y)<=uc}function dP(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=Dg(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 Og(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=uP(e,n),c=s.segmentIndex,u=dP(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Lg(n,c),p=Lg(t,u),f=s.position,d=mP(l,f),m=hP(l,p);if(s.type==="bendpoint"){var h=t.length-n.length,v=s.bendpointIndex,y=n[v];if(t.indexOf(y)!==-1)return a;if(h===0){var g=t[v];return r=g.x-s.position.x,o=g.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&v!==0&&v<n.length-1&&(d=Dg(n,v))}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=aP({x:e.x-f.x,y:e.y-f.y},m);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:Bi(b),delta:Bi({x:r,y:o})}}function Dg(e,t){var n=xa(e[t-1],e[t]),i=xa(e[t],e[t+1]),r=n/(n+i);return r}function hP(e,t){var n=Sg(e),i=Sg(t);return i-n}function Lg(e,t){return[e[t],e[t+1]]}function mP(e,t){var n=xa(e[0],e[1]),i=xa(e[0],t);return n===0?0:i/n}function gP(e,t,n,i){var r=Le(e);return Og(r,t,n,i).delta}function wa(e,t,n){var i=ya(t),r=ya(n),o=pi(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Bi({x:r.x+a.x,y:r.y+a.y})}function Ig(e,t,n){var i=ya(e),r=ya(t),o=ya(n),a=pi(e,i),s=pi(i,r),c=yP(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return Bi({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function yP(e,t,n){var i=Oe(t),r=Oe(n);if(vP(i,r))return null;var o=cn(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=cn(n,s),c!==o?null:a}function vP(e,t){return bP(e,t)||xP(e,t)}function bP(e,t){return e.right!==t.right&&e.left!==t.left}function xP(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Bg="name",Ng="text";function hp(e,t,n,i){ee.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ne(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(Bg in u&&t.updateLabel(c,u[Bg]),Ng in u&&S(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Ng]||"");t.updateLabel(c,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;Ge(u)||!sr(u)||qn(u)&&t.updateLabel(u,qn(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=V({},s.hints),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),gP(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=ne(c);l&&sr(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!Ge(c)||u.autoResize)){var l=s.newBounds,p=i.getDimensions(qn(c)||"",{box:l,style:i.getExternalStyle()}),f=Math.ceil(p.height),d=l.y!==c.y,m=c.y+c.height;s.newBounds={width:l.width,height:f,x:l.x,y:d?m-f:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Us(c)){var p=c.label,f=Le(p),d=EP(l),m=wP(f,d),h=_P(m,l,u);t.moveShape(p,h)}})}_e(hp,ee),hp.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function _P(e,t,n){var i=wa(e,t,n);return Bi(pi(i,e))}function wP(e,t){if(t.length){var n=SP(e,t);return dp(e,n)}}function EP(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 SP(e,t){var n=t.map(function(r){return{line:r,distance:Rg(e,r)}}),i=di(n,"distance");return i[0].line}function RP(e,t,n,i){return Og(e,t,n,i).point}function mp(e,t){ee.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=V({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),RP(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)})})}_e(mp,ee),mp.$inject=["eventBus","modeling"];function lc(e,t,n){var i=fc(e),r=Fg(i,t),o=i[0];return r.length?r[r.length-1]:wa(o.original||o,n,t)}function pc(e,t,n){var i=fc(e),r=Fg(i,t),o=i[i.length-1];return r.length?r[0]:wa(o.original||o,n,t)}function gp(e,t,n){var i=fc(e),r=$g(t,n),o=i[0];return wa(o.original||o,r,t)}function yp(e,t,n){var i=fc(e),r=$g(t,n),o=i[i.length-1];return wa(o.original||o,r,t)}function $g(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function fc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Fg(e,t){var n=dn(e,PP);return Ye(n,function(i){return CP(i,t)})}function CP(e,t){return cn(t,e,1)==="intersect"}function PP(e){return e.original||e}function vp(e,t){ee.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(AP(i,r)){var o=MP(i);o.incoming.forEach(function(a){var s=pc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=lc(a,r,i);t.reconnectStart(a,r,s)})}},!0)}vp.$inject=["eventBus","modeling"],_e(vp,ee);function AP(e,t){return S(e,"bpmn:Participant")&&Xe(e)&&S(t,"bpmn:Participant")&&!Xe(t)}function MP(e){var t=sa([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){S(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){S(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const TP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function jg(e){const t=ne(e);if(!S(t,"bpmn:BoundaryEvent")&&!(S(t,"bpmn:StartEvent")&&yn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:TP.some(i=>S(n[0],i))}function Hg(e){return S(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function bp(e,t){e.invoke(ee,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!jg(r))return;const a=Hg(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ne(i).get(a),u=ne(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}bp.$inject=["injector","modeling"],_e(bp,ee);function xp(e,t){ee.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=tt(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}_e(xp,ee),xp.$inject=["eventBus","modeling"];function _p(e,t,n){ee.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!S(o,"bpmn:SequenceFlow")||!S(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=kP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}_e(_p,ee),_p.$inject=["eventBus","bpmnRules","modeling"];function Po(e){return e.original||e}function kP(e,t){var n=pp(Po(e[e.length-2]),Po(e[e.length-1]),Po(t[1]),Po(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Po(e[0]),Po(t[t.length-1])]}function wp(e,t){ee.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;S(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)}wp.$inject=["eventBus","modeling"],_e(wp,ee);function Ep(e,t,n,i){ee.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;S(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(f="bpmn:MessageFlow")),S(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,m;d=n.canConnect(p,f),!(!d||d.type===l.type)&&(m=t.connect(p,f,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=m,r&&s(l,m))}function s(c,u){var l=r.context(),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;F(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=mt(p.outgoing,ao({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})})}_e(Ep,ee),Ep.$inject=["eventBus","modeling","bpmnRules","injector"];function dc(e,t,n,i,r,o){i.invoke(ee,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=Tn(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=[];F(s.closure.topLevel,function(f){yn(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})})}_e(dc,ee),dc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;F(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},dc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var OP=1500,DP={width:140,height:120},Sp={width:300,height:60},Rp={width:60,height:300},hc={width:300,height:150},mc={width:150,height:300},zg={width:140,height:120},Gg={width:100,height:40};function Vg(e){e.on("resize.start",OP,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(S(i,"bpmn:Lane")||S(i,"bpmn:Participant"))&&(n.resizeConstraints=$P(i,r,o)),S(i,"bpmn:SubProcess")&&Xe(i)&&(n.minDimensions=zg),S(i,"bpmn:TextAnnotation")&&(n.minDimensions=Gg)})}Vg.$inject=["eventBus"];var lr=Math.abs,LP=Math.min,IP=Math.max;function Wg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Ao(e,t,n){return Wg(e,t,n,LP)}function Mo(e,t,n){return Wg(e,t,n,IP)}var BP={top:20,left:50,right:20,bottom:20},NP={top:50,left:20,right:20,bottom:20};function $P(e,t,n){var i=ei(e),r=!0,o=!0,a=oc(i,[i]),s=Oe(e),c={},u={},l=tn(e),p=l?Sp:Rp;/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(m){var h=Oe(m);l?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&lr(s.top-h.bottom)<10&&Mo(c,"top",h.top+p.height),lr(s.top-h.top)<5&&Ao(u,"top",h.bottom-p.height)),/e/.test(t)&&(n&&lr(s.right-h.left)<10&&Ao(c,"right",h.right-p.width),lr(s.right-h.right)<5&&Mo(u,"right",h.left+p.width)),/s/.test(t)&&(n&&lr(s.bottom-h.top)<10&&Ao(c,"bottom",h.bottom-p.height),lr(s.bottom-h.bottom)<5&&Mo(u,"bottom",h.top+p.height)),/w/.test(t)&&(n&&lr(s.left-h.right)<10&&Mo(c,"left",h.left+p.width),lr(s.left-h.left)<5&&Ao(u,"left",h.right-p.width))});var f=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(S(m,"bpmn:FlowElement")||S(m,"bpmn:Artifact"))}),d=l?BP:NP;return f.forEach(function(m){var h=Oe(m);/n/.test(t)&&(!l||r)&&Ao(u,"top",h.top-d.top),/e/.test(t)&&(l||o)&&Mo(u,"right",h.right+d.right),/s/.test(t)&&(!l||o)&&Mo(u,"bottom",h.bottom+d.bottom),/w/.test(t)&&(l||r)&&Ao(u,"left",h.left-d.left)}),{min:u,max:c}}function Ug(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function To(e){return e.originalEvent||e.srcEvent}function Cp(e){Ug(e),Ug(To(e))}function Hr(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 Yg(){return/mac/i.test(navigator.platform)}function qg(e,t){return(To(e)||e).button===t}function pr(e){return qg(e,0)}function FP(e){return qg(e,1)}function Ea(e){var t=To(e)||e;return pr(e)?Yg()?t.metaKey:t.ctrlKey:!1}function gc(e){var t=To(e)||e;return pr(e)&&t.shiftKey}var Kg=1001;function Xg(e,t){e.on("resize.start",Kg+500,function(n){var i=n.context,r=i.shape;(S(r,"bpmn:Lane")||S(r,"bpmn:Participant"))&&(i.balanced=!Ea(n))}),e.on("resize.end",Kg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(S(r,"bpmn:Lane")||S(r,"bpmn:Participant"))return o&&(a=Rm(a),t.resizeLane(r,a,i.balanced)),!1})}Xg.$inject=["eventBus","modeling"];var jP=500;function Pp(e,t,n,i,r){n.invoke(ee,this);function o(l){return We(l,["bpmn:ReceiveTask","bpmn:SendTask"])||HP(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var p=e.getDefinitions(),f=p.get("rootElements");return!!mt(f,ao({id:l.id}))}function s(l){if(S(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(S(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(S(l,"bpmn:MessageEventDefinition"))return"messageRef";if(S(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(We(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(We(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=ne(p),d=c(f),m;d&&!a(d)&&(m=e.getDefinitions().get("rootElements"),Lt(m,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");Dt(f,p)}},!0),t.on("copyPaste.copyElement",function(l){var p=l.descriptor,f=l.element;if(!(f.labelTarget||!o(f))){var d=ne(f),m=c(d);m&&(p.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",jP,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)})}Pp.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],_e(Pp,ee);function HP(e,t){return De(t)||(t=[t]),Xi(t,function(n){return _o(e,n)})}var Zg=Math.max;function Qg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return F(n,function(a){var s=a.id;S(a,"bpmn:Participant")&&(o[s]=GP(a,i,r)),S(a,"bpmn:Lane")&&(o[s]=tn(a)?Sp:Rp),S(a,"bpmn:SubProcess")&&Xe(a)&&(o[s]=zg),S(a,"bpmn:TextAnnotation")&&(o[s]=Gg),S(a,"bpmn:Group")&&(o[s]=DP)}),o})}Qg.$inject=["eventBus"];function zP(e){return e==="x"}function GP(e,t,n){var i=tn(e);if(!UP(e))return i?hc:mc;var r=zP(t),o={};return r?i?o=hc:o={width:WP(e,n,r),height:mc.height}:i?o={width:hc.width,height:VP(e,n,r)}:o=mc,o}function VP(e,t,n){var i;return i=YP(e,t,n),Zg(hc.height,i)}function WP(e,t,n){var i;return i=qP(e,t,n),Zg(mc.width,i)}function UP(e){return!!ur(e).length}function YP(e,t,n){var i=ur(e),r;return r=Ap(i,t,n),e.height-r.height+Sp.height}function qP(e,t,n){var i=ur(e),r;return r=Ap(i,t,n),e.width-r.width+Rp.width}function Ap(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=ur(r),o.length?Ap(o,t,n):r}var Jg="_plane";function ey(e){var t=e.id;return KP(t)}function Ei(e){var t=e.id;return S(e,"bpmn:SubProcess")?ty(t):t}function zr(e){return ty(e)}function yc(e){var t=tt(e);return S(t,"bpmndi:BPMNPlane")}function ty(e){return e+Jg}function KP(e){return e.replace(new RegExp(Jg+"$"),"")}var ny=400,XP=600,iy={x:180,y:160};function ji(e,t,n,i,r,o,a){ee.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(p){return S(p,"bpmn:SubProcess")&&!Xe(p)}function u(p){var f=p.shape,d=p.newRootElement,m=ne(f);d=s._addDiagram(d||m),p.newRootElement=e.addRootElement(d)}function l(p){var f=p.shape,d=ne(f);s._removeDiagram(d);var m=p.newRootElement=a.get(Ei(d));e.removeRootElement(m)}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;F(f,function(d){if(c(d)){var m=a.get(Ei(d));if(!(!m||!d.children||!d.children.length)){var h=ry(d);s._showRecursively(h),s._moveChildrenToShape(h,m)}}})},!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;!S(f,"bpmn:SubProcess")||!Xe(f)||F(da([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,m=e.findRoot(Ei(f));if(!(!d||!m)){var h=d.children;n.moveElements(h,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(p){var f=p.element;if(S(f,"bpmn:SubProcess")){var d=p.properties,m=p.oldProperties,h=m.id,v=d.id;if(h!==v){if(yc(f)){a.updateId(f,zr(v)),a.updateId(h,v);return}var y=a.get(zr(h));y&&a.updateId(zr(h),zr(v))}}},!0),this.reverted("element.updateProperties",function(p){var f=p.element;if(S(f,"bpmn:SubProcess")){var d=p.properties,m=p.oldProperties,h=m.id,v=d.id;if(h!==v){if(yc(f)){a.updateId(f,zr(h)),a.updateId(v,h);return}var y=a.get(zr(v));y&&a.updateId(y,zr(h))}}},!0),t.on("element.changed",function(p){var f=p.element;if(yc(f)){var d=f,m=a.get(ey(d));!m||m===d||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",ny,function(p){var f=p.shape;S(f,"bpmn:SubProcess")&&(Xe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.reverted("shape.toggleCollapse",ny,function(p){var f=p.shape;S(f,"bpmn:SubProcess")&&(Xe(f)?l(p):(u(p),s._showRecursively(f.children)))},!0),this.postExecuted("shape.toggleCollapse",XP,function(p){var f=p.shape;if(S(f,"bpmn:SubProcess")){var d=p.newRootElement;if(d)if(Xe(f))s._moveChildrenToShape(d.children.slice(),f),F(da(f.children),h=>{n.moveShape(h.annotation,{x:0,y:0},f.parent),F(h.associations,v=>{n.moveConnection(v,{x:0,y:0},f.parent)})});else{s._disconnectSharedAnnotations(f);var m=ry(f);s._moveChildrenToShape(m,d)}}},!0),t.on("copyPaste.createTree",function(p){var f=p.element,d=p.children;if(c(f)){var m=Ei(f),h=a.get(m);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(p){var f=p.descriptor,d=p.element,m=p.elements,h=d.parent,v=S(tt(h),"bpmndi:BPMNPlane");if(v){var y=ey(h),g=mt(m,function(b){return b.id===y});g&&(f.parent=g.id)}}),t.on("copyPaste.pasteElement",function(p){var f=p.descriptor;f.parent&&(c(f.parent)||f.parent.hidden)&&(f.hidden=!0)})}_e(ji,ee),ji.prototype._moveChildrenToShape=function(e,t){var n=this._modeling;if(e.length){var i=e.filter(function(c){return!c.hidden});if(!i.length){n.moveElements(e,{x:0,y:0},t,{autoResize:!1});return}var r=$t(i),o;if(!t.x)o={x:iy.x-r.x,y:iy.y-r.y};else{var a=Le(t),s=Le(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},ji.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(qm(e).map(i=>i.annotation));n.size&&F(da(e.children),i=>{n.has(i.annotation)&&F(i.associations,r=>{t.removeConnection(r)})})},ji.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach(function(r){r.hidden=!!t,i=i.concat(r),r.children&&(i=i.concat(n._showRecursively(r.children,r.collapsed||t)))}),i},ji.prototype._addDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),n.push(e.di.$parent),e},ji.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:Ei(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},ji.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=mt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},ji.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function ZP(e){var t=[];return F(da(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function ry(e){return e.children.slice().concat(ZP(e.children)).concat(QP(e))}function QP(e){return Dl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Mp(e,t){e.invoke(ee,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!S(r,"bpmn:SubProcess")||S(r,"bpmn:AdHocSubProcess")||!(S(i,"bpmn:Task")||S(i,"bpmn:CallActivity"))||!Xe(r))){var o=JP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Mp.$inject=["injector","modeling"],_e(Mp,ee);function JP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Tp(e,t){ee.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;S(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&&S(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(!(!S(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,qn(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}_e(Tp,ee),Tp.$inject=["eventBus","textRenderer"];function kp(e,t){ee.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Xe(i))return;var r=sa(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();F(s,function(u){o(u,!0)}),F(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||S(a,"bpmn:Association")&&(S(a.source,"bpmn:TextAnnotation")||S(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Le(i)):t.reconnectStart(a,i,Le(i)))}},!0)}_e(kp,ee),kp.$inject=["eventBus","modeling"];var Op=500;function Dp(e,t,n){ee.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,p;return l=eA(c).concat([a]),p=fg(l),p?(u.width=Math.max(p.width,u.width),u.height=Math.max(p.height,u.height),u.x=p.x+(p.width-u.width)/2,u.y=p.y+(p.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],Op,function(a){var s=a.context,c=s.shape;S(c,"bpmn:SubProcess")&&(c.collapsed?tt(c).isExpanded=!1:(i(c.children),tt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Op,function(a){var s=a.context,c=s.shape;c.collapsed?tt(c).isExpanded=!1:tt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Op,function(a){var s=a.context.shape,c=t.getDefaultSize(s),u;s.collapsed?u=o(s,c):u=r(s,c),n.resizeShape(s,u,null,{autoResize:s.collapsed?!1:"nwse"})})}_e(Dp,ee),Dp.$inject=["eventBus","elementFactory","modeling"];function eA(e){return e.filter(function(t){return!t.hidden})}function Lp(e,t,n,i){t.invoke(ee,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Ge(a)||(S(a,"bpmn:Participant")&&Xe(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;S(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}_e(Lp,ee),Lp.$inject=["canvas","injector","moddle","modeling"];function Ip(e,t){ee.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;tA(r,o)&&t.updateProperties(o,{default:null})})}_e(Ip,ee),Ip.$inject=["eventBus","modeling"];function tA(e,t){if(!S(e,"bpmn:SequenceFlow"))return!1;var n=ne(t),i=ne(e);return n.get("default")===i}var nA=500,iA=5e3,oy=["shape.create","shape.delete","shape.move","shape.resize"],ay=[...oy,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Bp(e,t){ee.call(this,e);var n;function i(){return n=n||new rA,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(ay,iA,function(){i()}),this.postExecuted(ay,nA,function(){o()}),this.preExecute(oy,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(S(c,"bpmn:Lane")&&u.addLane(c),S(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}Bp.$inject=["eventBus","modeling"],_e(Bp,ee);function rA(){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 oA=500,aA=5e3,sy=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],cy=[...sy,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Np(e,t){ee.call(this,e);var n;function i(){return n=n||new sA,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(cy,aA,function(){i()}),this.postExecuted(cy,oA,function(){o()}),this.preExecute(sy,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(S(s,"bpmn:FlowElement")&&c.addFlowElement(s),S(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;S(s,"bpmn:Group")&&r().addGroup(s)})}Np.$inject=["eventBus","modeling"],_e(Np,ee);function sA(){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 $p(e,t){ee.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)cA(o)&&!lA(o)&&t.updateProperties(o,{isForCompensation:void 0})})}_e($p,ee),$p.$inject=["eventBus","modeling"];function cA(e){const t=ne(e);return t&&t.isForCompensation}function uA(e){return e&&S(e,"bpmn:BoundaryEvent")&&_o(e,"bpmn:CompensateEventDefinition")}function lA(e){return e.incoming.filter(n=>uA(n.source)).length>0}const pA={__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",Ul],appendBehavior:["type",Yl],associationBehavior:["type",Kl],attachEventBehavior:["type",Qs],artifactBehavior:["type",ql],boundaryEventBehavior:["type",Xl],categoryRootElementReferenceBehavior:["type",Zl],compensateBoundaryEventBehaviour:["type",Ql],createBehavior:["type",Jl],createDataObjectBehavior:["type",ep],createParticipantBehavior:["type",ip],dataInputAssociationBehavior:["type",rp],dataStoreBehavior:["type",op],deleteLaneBehavior:["type",ap],detachEventBehavior:["type",ac],dropOnFlowBehavior:["type",cp],eventBasedGatewayBehavior:["type",up],fixHoverBehavior:["type",bg],groupBehavior:["type",lp],importDockingFix:["type",_g],isHorizontalFix:["type",fp],labelBehavior:["type",hp],layoutConnectionBehavior:["type",mp],messageFlowBehavior:["type",vp],nonInterruptingBehavior:["type",bp],removeElementBehavior:["type",_p],removeEmbeddedLabelBoundsBehavior:["type",xp],removeParticipantBehavior:["type",wp],replaceConnectionBehavior:["type",Ep],replaceElementBehaviour:["type",dc],resizeBehavior:["type",Vg],resizeLaneBehavior:["type",Xg],rootElementReferenceBehavior:["type",Pp],spaceToolBehavior:["type",Qg],subProcessPlaneBehavior:["type",ji],subProcessStartEventBehavior:["type",Mp],textAnnotationBehavior:["type",Tp],toggleCollapseConnectionBehaviour:["type",kp],toggleElementCollapseBehaviour:["type",Dp],unclaimIdBehavior:["type",Lp],unsetDefaultFlowBehavior:["type",Ip],updateFlowNodeRefsBehavior:["type",Bp],updateCategoryValueRefsBehavior:["type",Np],setCompensationActivityAfterPasteBehavior:["type",$p]};function Fp(e){this._commandStack=e.get("commandStack",!1)}Fp.$inject=["injector"],Fp.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Si={__init__:["rules"],rules:["type",Fp]};function ti(e){ee.call(this,e),this.init()}ti.$inject=["eventBus"],_e(ti,ee),ti.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)})},ti.prototype.init=function(){};function uy(e,t){var n=cn(e,t,-15);return n!=="intersect"?n:null}function ln(e){ti.call(this,e)}_e(ln,ti),ln.$inject=["eventBus"],ln.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return fA(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return bc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return bc(n,i,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,i=e.direction;return wy(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return ft(i)&&!xc(t,i)?!1:kr(t,function(r){return ft(r)?bc(r.source,r.target,r):r.host?Sa(r,r.host,null,n):Gp(r,i)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position,r=e.hints;return r!=null&&r.keyboardMove&&n.some(function(a){return gy(a)&&!n.includes(a.host)})?!1:Sa(n,t,null,i)||xy(n,t,i)||_y(n,t)||xc(n,t)}),this.addRule("shape.create",function(e){return Gp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Sa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return Py(n,t)})},ln.prototype.canConnectMessageFlow=Ry,ln.prototype.canConnectSequenceFlow=Cy,ln.prototype.canConnectDataAssociation=Vp,ln.prototype.canConnectAssociation=Ey,ln.prototype.canConnectCompensationAssociation=Sy,ln.prototype.canMove=_y,ln.prototype.canAttach=Sa,ln.prototype.canReplace=xy,ln.prototype.canDrop=ko,ln.prototype.canInsert=xc,ln.prototype.canCreate=Gp,ln.prototype.canConnect=bc,ln.prototype.canResize=wy,ln.prototype.canCopy=Py;function fA(e){return jp(e)?null:We(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function jp(e){return!e||Ge(e)}function ly(e){do{if(S(e,"bpmn:Process"))return ne(e);if(S(e,"bpmn:Participant"))return ne(e).processRef||ne(e)}while(e=e.parent)}function Hp(e){return S(e,"bpmn:TextAnnotation")}function zp(e){return S(e,"bpmn:Group")&&!e.labelTarget}function py(e){return S(e,"bpmn:BoundaryEvent")&&Ri(e,"bpmn:CompensateEventDefinition")}function vc(e){return ne(e).isForCompensation}function dA(e,t){var n=ly(e),i=ly(t);return n===i}function hA(e){return S(e,"bpmn:InteractionNode")&&!S(e,"bpmn:BoundaryEvent")&&(!S(e,"bpmn:Event")||S(e,"bpmn:ThrowEvent")&&hy(e,"bpmn:MessageEventDefinition"))}function mA(e){return S(e,"bpmn:InteractionNode")&&!vc(e)&&(!S(e,"bpmn:Event")||S(e,"bpmn:CatchEvent")&&hy(e,"bpmn:MessageEventDefinition"))&&!(S(e,"bpmn:BoundaryEvent")&&!Ri(e,"bpmn:MessageEventDefinition"))}function fy(e){for(var t=e;t=t.parent;){if(S(t,"bpmn:FlowElementsContainer"))return ne(t);if(S(t,"bpmn:Participant"))return ne(t).processRef}return null}function dy(e,t){var n=fy(e),i=fy(t);return n===i}function Ri(e,t){var n=ne(e);return!!mt(n.eventDefinitions||[],function(i){return S(i,t)})}function hy(e,t){var n=ne(e);return(n.eventDefinitions||[]).every(function(i){return S(i,t)})}function gA(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:EndEvent")&&!yn(e)&&!(S(e,"bpmn:IntermediateThrowEvent")&&Ri(e,"bpmn:LinkEventDefinition"))&&!py(e)&&!vc(e)}function yA(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:StartEvent")&&!S(e,"bpmn:BoundaryEvent")&&!yn(e)&&!(S(e,"bpmn:IntermediateCatchEvent")&&Ri(e,"bpmn:LinkEventDefinition"))&&!vc(e)}function vA(e){return S(e,"bpmn:ReceiveTask")||S(e,"bpmn:IntermediateCatchEvent")&&(Ri(e,"bpmn:MessageEventDefinition")||Ri(e,"bpmn:TimerEventDefinition")||Ri(e,"bpmn:ConditionalEventDefinition")||Ri(e,"bpmn:SignalEventDefinition"))}function bA(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function my(e,t){var n=bA(t);return n.indexOf(e)!==-1}function bc(e,t,n){if(jp(e)||jp(t))return null;if(!S(n,"bpmn:DataAssociation")){if(Ry(e,t))return{type:"bpmn:MessageFlow"};if(Cy(e,t))return{type:"bpmn:SequenceFlow"}}var i=Vp(e,t);return i||(Sy(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Ey(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function ko(e,t){return Ge(e)||zp(e)?!0:S(t,"bpmn:Participant")&&!Xe(t)?!1:S(e,"bpmn:Participant")?S(t,"bpmn:Process")||S(t,"bpmn:Collaboration"):We(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:S(e,"bpmn:Lane")?S(t,"bpmn:Participant")||S(t,"bpmn:Lane"):S(e,"bpmn:BoundaryEvent")&&!xA(e)?!1:S(e,"bpmn:FlowElement")&&!S(e,"bpmn:DataStoreReference")?S(t,"bpmn:FlowElementsContainer")?Xe(t):We(t,["bpmn:Participant","bpmn:Lane"]):S(e,"bpmn:DataStoreReference")&&S(t,"bpmn:Collaboration")?Xi(ne(t).get("participants"),function(n){return!!n.get("processRef")}):We(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?We(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):S(e,"bpmn:MessageFlow")?S(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function xA(e){return ne(e).cancelActivity&&(yy(e)||vy(e))}function gy(e){return!Ge(e)&&S(e,"bpmn:BoundaryEvent")}function _A(e){return S(e,"bpmn:Lane")}function wA(e){return gy(e)||S(e,"bpmn:IntermediateThrowEvent")&&yy(e)?!0:S(e,"bpmn:IntermediateCatchEvent")&&vy(e)}function yy(e){var t=ne(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function vy(e){return by(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function by(e,t){return t.some(function(n){return Ri(e,n)})}function EA(e){return S(e,"bpmn:ReceiveTask")&&mt(e.incoming,function(t){return S(t.source,"bpmn:EventBasedGateway")})}function Sa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Ge(r)||!wA(r)||yn(t)||!S(t,"bpmn:Activity")||vc(t)||i&&!uy(i,t)||EA(t)?!1:"attach"}function xy(e,t,n){if(!t)return!1;var i={replacements:[]};return F(e,function(r){yn(t)||S(r,"bpmn:StartEvent")&&r.type!=="label"&&ko(r,t)&&(OR(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(DR(r)||LR(r)||IR(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),by(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&S(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),S(t,"bpmn:Transaction")||Ri(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(S(r,"bpmn:EndEvent")&&ko(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),S(r,"bpmn:BoundaryEvent")&&Sa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function _y(e,t){return Xi(e,_A)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return ko(n,t)})}function Gp(e,t,n,i){return t?Ge(e)||zp(e)?!0:ko(e,t)||xc(e,t):!1}function wy(e,t,n){return S(e,"bpmn:SubProcess")?Xe(e)&&(!t||t.width>=100&&t.height>=80):S(e,"bpmn:Lane")||S(e,"bpmn:Participant")?!0:Hp(e)?n?n==="e"||n==="w":!0:zp(e)?!0:Ge(e)?n?n==="e"||n==="w":!0:!1}function SA(e,t){var n=Hp(e),i=Hp(t);return(n||i)&&n!==i}function Ey(e,t){return my(t,e)||my(e,t)?!1:SA(e,t)?!0:!!Vp(e,t)}function Sy(e,t){return dy(e,t)&&py(e)&&S(t,"bpmn:Activity")&&!CA(t,e)&&!yn(t)}function Ry(e,t){return My(e)&&!My(t)?!1:hA(e)&&mA(t)&&!dA(e,t)}function Cy(e,t){return gA(e)&&yA(t)&&dy(e,t)&&!(S(e,"bpmn:EventBasedGateway")&&!vA(t))}function Vp(e,t){return We(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&We(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:We(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&We(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function xc(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(e.length!==1)return!1;e=e[0]}return t.source===e||t.target===e?!1:We(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ge(t)&&S(e,"bpmn:FlowNode")&&!S(e,"bpmn:BoundaryEvent")&&ko(e,t.parent)}function Wp(e,t){return e&&t&&e.indexOf(t)!==-1}function Py(e,t){return Ge(t)?!0:!(S(t,"bpmn:Lane")&&!Wp(e,t.parent)||S(t,"bpmn:MessageFlow")&&!RA(e,t))}function RA(e,t){var n=Ay(t.source),i=Ay(t.target);return Wp(e,n)&&Wp(e,i)}function Ay(e){for(;e;e=e.parent)if(S(e,"bpmn:Participant"))return e;return null}function My(e){return So(e,"bpmn:Process")||So(e,"bpmn:Collaboration")}function CA(e,t){return e.attachers.includes(t)}const PA={__depends__:[Si],__init__:["bpmnRules"],bpmnRules:["type",ln]};var AA=2e3;function Ty(e,t){e.on("saveXML.start",AA,n);function n(){var i=t.getRootElements();F(i,function(r){var o=tt(r),a,s;a=sa([r]),a=Ye(a,function(c){return c!==r&&!c.labelTarget}),s=dn(a,tt),o.set("planeElement",s)})}}Ty.$inject=["eventBus","canvas"];const MA={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Ty]};function _c(e){ee.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(n){var i=n.context,r=i.shape||i.connection,o=i.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.parent=a.parent),i.parentIndex=a.index)}),this.preExecute(["shape.move","connection.move"],function(n){var i=n.context,r=i.shape||i.connection,o=i.newParent||r.parent,a=t.getOrdering(r,o);a&&(a.parent!==void 0&&(i.newParent=a.parent),i.newParentIndex=a.index)})}_c.prototype.getOrdering=function(e,t){return null},_e(_c,ee);function Up(e,t){_c.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function i(a){if(a.labelTarget)return{level:10};var s=mt(n,function(c){return We(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!We(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||S(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=Rd(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}}}Up.$inject=["eventBus","canvas"],_e(Up,_c);const TA={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Up]};function Ra(){}Ra.prototype.get=function(){return this._data},Ra.prototype.set=function(e){this._data=e},Ra.prototype.clear=function(){var e=this._data;return delete this._data,e},Ra.prototype.isEmpty=function(){return!this._data};const kA={clipboard:["type",Ra]};var ky=1500;function Oy(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",ky,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",ky,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=Hr(a),c=document.elementFromPoint(s.x,s.y),OA(c)}}Oy.$inject=["elementRegistry","eventBus","injector"];function OA(e){return Ir(e,"svg, .djs-element",!0)}const DA={__init__:["hoverFix"],hoverFix:["type",Oy]};function LA(e){return!0}function wc(e){return pr(e)||FP(e)}var Dy=500;function Ly(e,t,n){var i=this;function r(A,B,D){if(!s(A,B)){var L,z,ie;D?z=t.getGraphics(D):(L=B.delegateTarget||B.target,L&&(z=L,D=t.get(z))),!(!z||!D)&&(ie=e.fire(A,{element:D,gfx:z,originalEvent:B}),ie===!1&&(B.stopPropagation(),B.preventDefault()))}}var o={};function a(A){return o[A]}function s(A,B){var D=u[A]||pr;return!D(B)}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":LA,"element.mousedown":wc,"element.mouseup":wc,"element.click":wc,"element.dblclick":wc};function l(A,B,D){var L=c[A];if(!L)throw new Error("unmapped DOM event name <"+A+">");return r(L,B,D)}var p="svg, .djs-element";function f(A,B,D,L){var z=o[D]=function(ie){r(D,ie)};L&&(u[D]=L),z.$delegate=On.bind(A,p,B,z)}function d(A,B,D){var L=a(D);L&&On.unbind(A,B,L.$delegate)}function m(A){F(c,function(B,D){f(A,D,B)})}function h(A){F(c,function(B,D){d(A,D,B)})}e.on("canvas.destroy",function(A){h(A.svg)}),e.on("canvas.init",function(A){m(A.svg)}),e.on(["shape.added","connection.added"],function(A){var B=A.element,D=A.gfx;e.fire("interactionEvents.createHit",{element:B,gfx:D})}),e.on(["shape.changed","connection.changed"],Dy,function(A){var B=A.element,D=A.gfx;e.fire("interactionEvents.updateHit",{element:B,gfx:D})}),e.on("interactionEvents.createHit",Dy,function(A){var B=A.element,D=A.gfx;i.createDefaultHit(B,D)}),e.on("interactionEvents.updateHit",function(A){var B=A.element,D=A.gfx;i.updateDefaultHit(B,D)});var v=C("djs-hit djs-hit-stroke"),y=C("djs-hit djs-hit-click-stroke"),g=C("djs-hit djs-hit-all"),b=C("djs-hit djs-hit-no-move"),x={all:g,"click-stroke":y,stroke:v,"no-move":b};function C(A,B){return B=V({stroke:"white",strokeWidth:15},B||{}),n.cls(A,["no-fill","no-border"],B)}function M(A,B){var D=x[B];if(!D)throw new Error("invalid hit type <"+B+">");return we(A,D),A}function k(A,B){$e(A,B)}this.removeHits=function(A){var B=Ds(".djs-hit",A);F(B,Kt)},this.createDefaultHit=function(A,B){var D=A.waypoints,L=A.isFrame,z;return D?this.createWaypointsHit(B,D):(z=L?"stroke":"all",this.createBoxHit(B,z,{width:A.width,height:A.height}))},this.createWaypointsHit=function(A,B){var D=aa(B);return M(D,"stroke"),k(A,D),D},this.createBoxHit=function(A,B,D){D=V({x:0,y:0},D);var L=Te("rect");return M(L,B),we(L,D),k(A,L),L},this.updateDefaultHit=function(A,B){var D=pt(".djs-hit",B);if(D)return A.waypoints?Ol(D,A.waypoints):we(D,{width:A.width,height:A.height}),D},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=f,this.unregisterEvent=d}Ly.$inject=["eventBus","elementRegistry","styles"];const Ec={__init__:["interactionEvents"],interactionEvents:["type",Ly]};function Oo(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)})}Oo.$inject=["eventBus","canvas"],Oo.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()})}},Oo.prototype.get=function(){return Array.from(this._selectedElements)},Oo.prototype.isSelected=function(e){return this._selectedElements.has(e)},Oo.prototype.select=function(e,t){var n=this.get();De(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?F(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Iy="hover",By="selected";function Ny(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,Iy)}),t.on("element.out",function(r){i(r.element,Iy)}),t.on("selection.changed",function(r){function o(u){i(u,By)}function a(u){n(u,By)}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)})}Ny.$inject=["canvas","eventBus"];function $y(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;De(u)?t.select(u):t.select(s.filter(IA))}}),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=mt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(pr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=gc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}$y.$inject=["eventBus","selection","canvas","elementRegistry"];function IA(e){return!e.hidden}const ni={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Ec],selection:["type",Oo],selectionVisuals:["type",Ny],selectionBehavior:["type",$y]};var BA=/^djs-cursor-.*$/;function Sc(e){var t=wt(document.body);t.removeMatching(BA),e&&t.add("djs-cursor-"+e)}function Fy(){Sc(null)}var NA=5e3;function jy(e,t){t=t||"element.click";function n(){return!1}return e.once(t,NA,n),function(){e.off(t,n)}}var $A=["c","C"],FA=["v","V"],jA=["d","D"],HA=["x","X"],zA=["y","Y"],Hy=["z","Z"];function GA(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function In(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Xt(e,t){return e=De(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Yp(e){return e.shiftKey}function VA(e){return In(e)&&Xt($A,e)}function WA(e){return In(e)&&Xt(FA,e)}function UA(e){return In(e)&&Xt(jA,e)}function YA(e){return In(e)&&Xt(HA,e)}function qA(e){return In(e)&&!Yp(e)&&Xt(Hy,e)}function KA(e){return In(e)&&(Xt(zA,e)||Xt(Hy,e)&&Yp(e))}var Do=Math.round,zy="djs-drag-active";function Gr(e){e.preventDefault()}function XA(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function ZA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Gy(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),C=t._container.getBoundingClientRect();return{x:x.x+(b.x-C.left)/x.scale,y:x.y+(b.y-C.top)/x.scale}}function s(b,x){x=x||o;var C=e.createEvent(V({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,C)===!1?!1:e.fire(x.prefix+"."+b,C)}function c(b){var x=b.filter(function(C){return i.get(C.id)});x.length&&n.select(x)}function u(b,x){var C=o.payload,M=o.displacement,k=o.globalStart,A=Hr(b),B=pi(A,k),D=o.localStart,L=a(A),z=pi(L,D);if(!o.active&&(x||ZA(B)>o.threshold)){if(V(C,{x:Do(D.x+M.x),y:Do(D.y+M.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return v();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&Sc(o.cursor),t.addMarker(t.getRootElement(),zy)}Cp(b),o.active&&(V(C,{x:Do(L.x+M.x),y:Do(L.y+M.y),dx:Do(z.x),dy:Do(z.y)},{originalEvent:b}),s("move"))}function l(b){var x,C=!0;o.active&&(b&&(o.payload.originalEvent=b,Cp(b)),C=s("end")),C===!1&&s("rejected"),x=y(C!==!0),s("ended",x)}function p(b){Xt("Escape",b)&&(Gr(b),v())}function f(b){var x;o.active&&(x=jy(e),setTimeout(x,400),Gr(b)),l(b)}function d(b){u(b)}function m(b){var x=o.payload;x.hoverGfx=b.gfx,x.hover=b.element,s("hover")}function h(b){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function v(b){var x;if(o){var C=o.active;C&&s("cancel"),x=y(b),C&&s("canceled",x)}}function y(b){var x,C;s("cleanup"),Fy(),o.trapClick?C=f:C=l,Ne.unbind(document,"mousemove",u),Ne.unbind(document,"dragstart",Gr),Ne.unbind(document,"selectstart",Gr),Ne.unbind(document,"mousedown",C,!0),Ne.unbind(document,"mouseup",C,!0),Ne.unbind(document,"keyup",p),Ne.unbind(document,"touchstart",d,!0),Ne.unbind(document,"touchcancel",v,!0),Ne.unbind(document,"touchmove",u,!0),Ne.unbind(document,"touchend",l,!0),e.off("element.hover",m),e.off("element.out",h),t.removeMarker(t.getRootElement(),zy);var M=o.payload.previousSelection;return b!==!1&&M&&!n.get().length&&c(M),x=o,o=null,x}function g(b,x,C,M){o&&v(!1),typeof x=="string"&&(M=C,C=x,x=null),M=V({},r,M||{});var k=M.data||{},A,B,D,L,z;if(M.trapClick?L=f:L=l,b?(A=To(b)||b,B=Hr(b),Cp(b),A.type==="dragstart"&&Gr(A)):(A=null,B={x:0,y:0}),D=a(B),x||(x=D),z=XA(A),o=V({prefix:C,data:k,payload:{},globalStart:B,displacement:pi(x,D),localStart:D,isTouch:z},M),M.manual||(z?(Ne.bind(document,"touchstart",d,!0),Ne.bind(document,"touchcancel",v,!0),Ne.bind(document,"touchmove",u,!0),Ne.bind(document,"touchend",l,!0)):(Ne.bind(document,"mousemove",u),Ne.bind(document,"dragstart",Gr),Ne.bind(document,"selectstart",Gr),Ne.bind(document,"mousedown",L,!0),Ne.bind(document,"mouseup",L,!0)),Ne.bind(document,"keyup",p),e.on("element.hover",m),e.on("element.out",h)),s("init")===!1)return v(),!1;M.autoActivate&&u(b,!0)}e.on("diagram.destroy",v),this.init=g,this.move=u,this.hover=m,this.out=h,this.end=l,this.cancel=v,this.context=function(){return o},this.setOptions=function(b){V(r,b)}}Gy.$inject=["eventBus","canvas","selection","elementRegistry"];const Hi={__depends__:[DA,ni],dragging:["type",Gy]};function Lo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}Lo.prototype.next=function(){return this._prefix+ ++this._counter};const QA=new Lo("ps");var JA=["marker-start","marker-mid","marker-end"],eM=["circle","ellipse","line","path","polygon","polyline","path","rect"];function fr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}fr.$inject=["elementRegistry","eventBus","canvas","styles"],fr.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},fr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},fr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=nm(n);return this._cloneMarkers($r(r),i),we(r,this._styles.cls(i,[])),$e(t,r),we(r,"data-preview-support-element-id",e.id),r},fr.prototype.addFrame=function(e,t){var n=Te("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return $e(t,n),we(n,"data-preview-support-element-id",e.id),n},fr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),rM(e)&&JA.forEach(function(r){if(we(e,r)){var o=tM(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},fr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,QA.next()].join("-"),a=pt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||nm(n);s.id=o,Qe(s).add(r);var c=pt(":scope > defs",e);c||(c=Te("defs"),$e(e,c)),$e(c,s);var u=iM(s.id);we(t,i,u)};function tM(e,t,n){var i=nM(we(e,t));return pt("marker#"+i,n||document)}function nM(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function iM(e){return"url(#"+e+")"}function rM(e){return eM.indexOf(e.nodeName)!==-1}const Io={__init__:["previewSupport"],previewSupport:["type",fr]};var oM="drop-ok",Vy="drop-not-ok",Wy="attach-ok",Uy="new-parent",Yy="create",aM=2e3;function qy(e,t,n,i,r){function o(c,u,l,p,f){if(!u)return!1;c=Ye(c,function(g){var b=g.labelTarget;return!g.parent&&!(Ge(g)&&c.indexOf(b)!==-1)});var d=mt(c,function(g){return!ft(g)}),m=!1,h=!1,v=!1;Xy(c)&&(m=r.allowed("shape.attach",{position:l,shape:d,target:u})),m||(Xy(c)?v=r.allowed("shape.create",{position:l,shape:d,source:p,target:u}):v=r.allowed("elements.create",{elements:c,position:l,target:u}));var y=f.connectionTarget;return v||m?(d&&p&&(h=r.allowed("connection.create",{source:y===p?d:p,target:y===p?p:d,hints:{targetParent:u,targetAttach:m}})),{attach:m,connect:h}):v===null||m===null?null:!1}function a(c,u){[Wy,oM,Vy,Uy].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,p=c.hover,f=u.source,d=u.hints||{};if(!p){u.canExecute=!1,u.target=null;return}Ky(c);var m={x:c.x,y:c.y},h=u.canExecute=p&&o(l,p,m,f,d);p&&h!==null&&(u.target=p,h&&h.attach?a(p,Wy):a(p,h?Uy:Vy))}),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,m=u.canExecute,h=m&&m.attach,v=m&&m.connect,y=u.hints||{};if(m===!1||!d)return!1;Ky(c);var g={x:c.x,y:c.y};v?p=i.appendShape(l,p,g,d,{attach:h,connection:v===!0?{}:v,connectionTarget:y.connectionTarget}):(f=i.createElements(f,g,d,V({},y,{attach:h})),p=mt(f,function(b){return!ft(b)})),V(u,{elements:f,shape:p}),V(c,{elements:f,shape:p})});function s(){var c=t.context();c&&c.prefix===Yy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],aM,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){De(u)||(u=[u]);var p=mt(u,function(m){return!ft(m)});if(p){l=V({elements:u,hints:{},shape:p},l||{}),F(u,function(m){Be(m.x)||(m.x=0),Be(m.y)||(m.y=0)});var f=Ye(u,function(m){return!m.hidden}),d=$t(f);F(u,function(m){ft(m)&&(m.waypoints=dn(m.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),V(m,{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2})}),t.init(c,Yy,{cursor:"grabbing",autoActivate:!0,data:{shape:p,elements:u,context:l}})}}}qy.$inject=["canvas","dragging","eventBus","modeling","rules"];function Ky(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 Xy(e){return e&&e.length===1&&!ft(e[0])}var sM=750;function Zy(e,t,n,i,r){function o(a){var s=Te("g");we(s,r.cls("djs-drag-group",["no-events"]));var c=Te("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection($r(l),u)):(l=n._createContainer("shape",c),n.drawShape($r(l),u),un(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",sM,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(),$e(p,l)),un(l,a.x,a.y)):Kt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Kt(c)})}Zy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Rc={__depends__:[Hi,Io,Si,ni],__init__:["create","createPreview"],create:["type",qy],createPreview:["type",Zy]};function qp(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)})}qp.$inject=["eventBus"],qp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||cM(0,0)};function cM(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;return n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null),n}const Ca={__init__:["mouse"],mouse:["type",qp]};var Qy=2e3;function Bn(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),uM(l)&&(u.priority=2,u.host=l.host.id),ft(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=lM(l)),Ge(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),F(["x","y","width","height"],function(f){Be(l[f])&&(u[f]=l[f])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",Qy,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Qy,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;V(u,{createElementsBehavior:!1})})}Bn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Bn.prototype.copy=function(e,t={}){var n,i;return De(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(De(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Bn.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})}}},Bn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Bn.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},Bn.prototype._getElementIdsFromTree=function(e){var t={};return F(e,function(n){F(n,function(i){i.id&&(t[i.id]=!0)})}),t},Bn.prototype._paste=function(e,t,n,i){F(e,function(o){Be(o.x)||(o.x=0),Be(o.y)||(o.y=0)});var r=$t(e);return F(e,function(o){ft(o)&&(o.waypoints=dn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),V(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,V({},i))},Bn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return F(e,function(o,a){o=di(o,"priority"),F(o,function(s){var c=V({},hi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(ft(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(Ge(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},Bn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(hi(e,["id"]));return t},Bn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(hi(e,["id"]));return t},Bn.prototype.createShape=function(e){var t=this._elementFactory.createShape(hi(e,["id"]));return t},Bn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(ft(e)&&(!n.has(e.source)||!n.has(e.target))||Ge(e)&&!n.has(e.labelTarget))},Bn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Ns(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 m={element:p,depth:f};r.push(m),o.set(p,m);return}if(d.depth<f){r=u(d,r);var h={element:d.element,depth:f};r.push(h),o.set(p,h)}}function u(p,f){var d=f.indexOf(p);return d!==-1&&f.splice(d,1),f}Nr(a,function(p,f,d){if(Ge(p))return;F(p.labels,function(v){c(v,d)});function m(v){v&&v.length&&F(v,function(y){F(y.labels,function(g){c(g,d)}),c(y,d)})}F([p.attachers,p.incoming,p.outgoing],m),c(p,d);var h=[];return p.children&&(h=p.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:p,children:h}),h}),e=dn(r,function(p){return p.element});var l=new Set(e);return r=dn(r,function(p){return p.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:p.descriptor,element:p.element,elements:e,elementsSet:l}),p}),r=di(r,function(p){return p.descriptor.priority}),e=dn(r,function(p){return p.element}),F(r,function(p){var f=p.depth;if(!n.hasRelations(p.element,e,l)){ev(p.element,e),l.delete(p.element);return}if(!s(p.element,e)){ev(p.element,e),l.delete(p.element);return}i[f]||(i[f]=[]),i[f].push(p.descriptor)}),i};function uM(e){return!!e.host}function lM(e){return dn(e.waypoints,function(t){return t=Jy(t),t.original&&(t.original=Jy(t.original)),t})}function Jy(e){return V({},e)}function ev(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const pM={__depends__:[kA,Rc,Ca,Si],__init__:["copyPaste"],copyPaste:["type",Bn]};function Kp(e,t,n){De(n)||(n=[n]),F(n,function(i){Tr(e[i])||(t[i]=e[i])})}var Xp=750;function tv(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Xp,function(c){var u=c.descriptor,l=c.element,p=ne(l);if(Ge(l))return u;var f=u.businessObject=i(p,!0),d=u.di=i(tt(l),!0);d.bpmnElement=f,Kp(f,u,"name"),Kp(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=ne(c);return c.default&&(l[c.default]={element:p,property:"default"}),c.host&&(ne(c).attachedToRef=ne(u[c.host])),hi(l,Tn(l,function(f,d,m){var h=d.element,v=d.property;return m===c.id&&(h.set(v,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(Ge(l)){l.businessObject=ne(u[l.labelTarget]),l.di=tt(u[l.labelTarget]);return}p=l.businessObject=i(p),f=l.di=i(f),f.bpmnElement=p,Kp(l,p,["isExpanded","name"]),l.type=p.$type}),t.on("copyPaste.copyElement",Xp,function(c){var u=c.descriptor,l=c.element;if(S(l,"bpmn:Participant")){var p=ne(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;S(u,"bpmn:SubProcess")&&F(da(l),p=>{l.push(p.annotation)})}),t.on("copyPaste.pasteElement",Xp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}tv.$inject=["bpmnFactory","eventBus","moddleCopy"];const fM=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],dM=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Pa(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return di(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Qt(r)&&r.$descriptor;if(a&&dM.includes(a))return o;if(a&&fM.includes(a)||a&&s&&!mt(s.properties,ao({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(S(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}Pa.$inject=["eventBus","bpmnFactory","moddle"],Pa.prototype.copyElement=function(e,t,n,i=!1){n&&!De(n)&&(n=[n]),n=n||Zp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(De(r)&&(n=r),F(n,o=>{let a;Mn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Yt(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Pa.prototype.copyProperty=function(e,t,n,i=!1){let r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(r===!1)return;if(r)return Qt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):De(e)?Tn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Qt(e)&&e.$type?this._moddle.getElementDescriptor(e).isGeneric?void 0:(r=this._bpmnFactory.create(e.$type),r.$parent=t,r=this.copyElement(e,r,null,i),r):e},Pa.prototype._copyId=function(e,t,n=!1){if(n)return e;if(!this._moddle.ids.assigned(e))return this._moddle.ids.claim(e,t),e};function Zp(e,t){return Tn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const nv={__depends__:[pM],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",tv],moddleCopy:["type",Pa]};var iv=Math.round;function Qp(e,t){this._modeling=e,this._eventBus=t}Qp.$inject=["modeling","eventBus"],Qp.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=iv(s+o/2),l=iv(c+a/2),p=i.replaceShape(e,V({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:p,hints:n}),p};function rv(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}rv.$inject=["selection","eventBus"];const hM={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",rv],replace:["type",Qp]};function mM(e,t,n){De(n)||(n=[n]),F(n,function(i){Tr(e[i])||(t[i]=e[i])})}var gM=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function yM(e,t){var n=e&&Mn(e,"collapsed")?e.collapsed:!Xe(e),i;return t&&(Mn(t,"collapsed")||Mn(t,"isExpanded"))?i=Mn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function ov(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,p=s.businessObject;if(Cc(p)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&yM(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),mM(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var m=Zp(p.$descriptor),h=Zp(f.$descriptor,!0),v=vM(m,h);V(f,ui(c,gM));var y=Ye(v,function(x){return x==="eventDefinitions"?av(s,c.eventDefinitionType):x==="loopCharacteristics"?!yn(f):Mn(f,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!yn(f):!0});if(f=n.copyElement(p,f,y),c.eventDefinitionType&&(av(f,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),S(p,"bpmn:Activity")){if(Cc(p))d.isExpanded=Xe(s);else if(c&&Mn(c,"isExpanded")){d.isExpanded=c.isExpanded;var g=t.getDefaultSize(f,{isExpanded:d.isExpanded});d.width=g.width,d.height=g.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Xe(s)&&!S(p,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Cc(p)&&!Cc(f)&&(u.moveChildren=!1),S(p,"bpmn:Participant")){c.isExpanded===!0?f.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=tn(s);tt(s).isHorizontal||(tt(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,We(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&We(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=p.default),c.host&&!S(p,"bpmn:BoundaryEvent")&&S(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}ov.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Cc(e){return S(e,"bpmn:SubProcess")}function av(e,t){var n=ne(e);return t&&n.get("eventDefinitions").some(function(i){return S(i,t)})}function vM(e,t){return e.filter(function(n){return t.includes(n)})}const sv={__depends__:[nv,hM,ni],bpmnReplace:["type",ov]};var bM=250;function Vr(e){this._eventBus=e,this._tools=[],this._active=null}Vr.$inject=["eventBus"],Vr.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)},Vr.prototype.isActive=function(e){return e&&this._active===e},Vr.prototype.length=function(e){return this._tools.length},Vr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Vr.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),F(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,bM,function(r){this._active&&(xM(r)||this.setActive(null))},this)};function xM(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Ir(t,'.group[data-group="tools"]')}const Pc={__depends__:[Hi],__init__:["toolManager"],toolManager:["type",Vr]};function _M(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 wM(e,t){var n=[],i=new Set(e);F(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;F(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 EM(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 Jp=Math.abs,SM=Math.round,zi={x:"width",y:"height"},cv="crosshair",dr={n:"top",w:"left",s:"bottom",e:"right"},RM=1500,Ac={n:"s",w:"e",s:"n",e:"w"},Mc=20;function ii(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",RM,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&lv(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,p=u.direction,f=u.movingShapes,d=u.resizingShapes,m=u.start;if(u.initialized){lv(c);var h={x:0,y:0};h[l]=SM(c["d"+l]),s.makeSpace(f,d,h,p,m),n.once("spaceTool.ended",function(v){s.activateSelection(v.originalEvent,!0,!0)})}})}ii.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],ii.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:cv,data:{context:{reactivate:n}},trapClick:!1})},ii.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:cv,data:{context:{}}})},ii.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},ii.prototype.init=function(e,t){var n=Jp(e.dx)>Jp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Jp(i)<5)return!1;i<0&&(i*=-1),Ea(e)&&(i*=-1);var o=_M(n,i),a=this._canvas.getRootElement();!gc(e)&&e.hover&&(a=e.hover);var s=[...sa(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=CM(c,n,o,r,u);return V(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),Sc("resize-"+(n==="x"?"ew":"ns")),!0},ii.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 m=d.label;m&&!s.has(m)&&(s.add(m),o.push(m))}function f(d){c.has(d)||(c.add(d),a.push(d))}return F(e,function(d){if(!(!d.parent||Ge(d))){if(ft(d)){l.push(d);return}var m=d[t],h=m+d[zi[t]];if(PM(d)&&(n>0&&Le(d)[t]>i||n<0&&Le(d)[t]<i)){u.push(d);return}if(n>0&&m>i||n<0&&h<i){p(d);return}if(m<i&&h>i&&r.allowed("shape.resize",{shape:d})){f(d);return}}}),F(o,function(d){var m=d.attachers;m&&F(m,function(h){p(h)})}),F(u,function(d){var m=d.host;(s.has(m)||c.has(m))&&p(d)}),F(l,function(d){var m=d.source,h=d.target,v=d.label;(s.has(m)||c.has(m))&&(s.has(h)||c.has(h))&&v&&p(v)}),{movingShapes:o,resizingShapes:a}},ii.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},ii.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function uv(e){return{top:e.top-Mc,right:e.right+Mc,bottom:e.bottom+Mc,left:e.left-Mc}}function lv(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Be(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Be(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Be(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Be(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function CM(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 F(a,function(f){var d=f.attachers,m=f.children,h=Oe(f),v=Ye(m,function(z){return!ft(z)&&!Ge(z)&&!l.has(z)&&!p.has(z)}),y=Ye(m,function(z){return!ft(z)&&!Ge(z)&&l.has(z)}),g,b,x,C=[],M=[],k,A,B,D;v.length&&(b=uv(Oe($t(v))),g=i-h[dr[n]]+b[dr[n]],n==="n"?s.bottom=u=Be(u)?Math.min(u,g):g:n==="w"?s.right=u=Be(u)?Math.min(u,g):g:n==="s"?s.top=c=Be(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Be(c)?Math.max(c,g):g)),y.length&&(x=uv(Oe($t(y))),g=i-x[dr[Ac[n]]]+h[dr[Ac[n]]],n==="n"?s.bottom=u=Be(u)?Math.min(u,g):g:n==="w"?s.right=u=Be(u)?Math.min(u,g):g:n==="s"?s.top=c=Be(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Be(c)?Math.max(c,g):g)),d&&d.length&&(d.forEach(function(z){l.has(z)?C.push(z):M.push(z)}),C.length&&(k=Oe($t(C.map(Le))),A=h[dr[Ac[n]]]-(k[dr[Ac[n]]]-i)),M.length&&(B=Oe($t(M.map(Le))),D=B[dr[n]]-(h[dr[n]]-i)),n==="n"?(g=Math.min(A||1/0,D||1/0),s.bottom=u=Be(u)?Math.min(u,g):g):n==="w"?(g=Math.min(A||1/0,D||1/0),s.right=u=Be(u)?Math.min(u,g):g):n==="s"?(g=Math.max(A||-1/0,D||-1/0),s.top=c=Be(c)?Math.max(c,g):g):n==="e"&&(g=Math.max(A||-1/0,D||-1/0),s.left=c=Be(c)?Math.max(c,g):g));var L=r&&r[f.id];L&&(n==="n"?(g=i+f[zi[t]]-L[zi[t]],s.bottom=u=Be(u)?Math.min(u,g):g):n==="w"?(g=i+f[zi[t]]-L[zi[t]],s.right=u=Be(u)?Math.min(u,g):g):n==="s"?(g=i-f[zi[t]]+L[zi[t]],s.top=c=Be(c)?Math.max(c,g):g):n==="e"&&(g=i-f[zi[t]]+L[zi[t]],s.left=c=Be(c)?Math.max(c,g):g))}),s}}function PM(e){return!!e.host}var ef="djs-dragging",pv="djs-resizing",AM=250,Tc=Math.max;function fv(e,t,n,i,r){function o(a,s){F(a,function(c){r.addDragger(c,s),n.addMarker(c,ef)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=Te("g");we(l,i.cls("djs-crosshair-group",["no-events"])),$e(s,l);var p=Te("path");we(p,"d",u.x),Qe(p).add("djs-crosshair"),$e(l,p);var f=Te("path");we(f,"d",u.y),Qe(f).add("djs-crosshair"),$e(l,f),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;un(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Kt(c)}),e.on("spaceTool.move",AM,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var f=n.getLayer("space");c=Te("path"),we(c,"d","M0,0 L0,0"),Qe(c).add("djs-crosshair"),$e(f,c),s.line=c;var d=Te("g");we(d,i.cls("djs-drag-group",["no-events"])),$e(n.getActiveLayer(),d),o(l,d);var m=new Set(l);F(p,function(M){m.add(M)});var h=new Set,v=s.movingConnections=[];m.forEach(function(M){F(M.outgoing,function(k){h.has(k)||!ft(k)||!m.has(k.target)||(h.add(k),v.push(k))})}),o(v,d),s.dragGroup=d}if(!s.frameGroup){var y=Te("g");we(y,i.cls("djs-frame-group",["no-events"])),$e(n.getActiveLayer(),y);var g=[];F(p,function(M){var k=r.addFrame(M,y),A=k.getBBox();g.push({element:k,initialBounds:A}),n.addMarker(M,pv)}),s.frameGroup=y,s.frames=g}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};we(c,{d:b[u]});var x={x:"y",y:"x"},C={x:a.dx,y:a.dy};C[x[s.axis]]=0,un(s.dragGroup,C.x,C.y),F(s.frames,function(M){var k=M.element,A=M.initialBounds,B,D;s.direction==="e"?we(k,{width:Tc(A.width+C.x,5)}):(B=Tc(A.width-C.x,5),we(k,{width:B,x:A.x+A.width-B})),s.direction==="s"?we(k,{height:Tc(A.height+C.y,5)}):(D=Tc(A.height-C.y,5),we(k,{height:D,y:A.y+A.height-D}))})}}),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;F(c,function(m){n.removeMarker(m,ef)}),F(u,function(m){n.removeMarker(m,ef)}),f&&(Kt(p),Kt(f)),F(l,function(m){n.removeMarker(m,pv)}),d&&Kt(d)})}fv.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const MM={__init__:["spaceToolPreview"],__depends__:[Hi,Si,Pc,Io,Ca],spaceTool:["type",ii],spaceToolPreview:["type",fv]};function kc(e,t){e.invoke(ii,this),this._canvas=t}kc.$inject=["injector","canvas"],_e(kc,ii),kc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=ro(yo(r.children.filter(u=>S(u,"bpmn:Artifact")),$t(o))));const s=[...e,...a];var c=ii.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(S(u,"bpmn:TextAnnotation")||TM(u)&&(t==="y"&&tn(u)||t==="x"&&!tn(u)))}),c};function TM(e){return S(e,"bpmn:Participant")&&!ne(e).processRef}const dv={__depends__:[MM],spaceTool:["type",kc]};function Rt(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Rt.$inject=["eventBus","injector"],Rt.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},Rt.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},Rt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Rt.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Rt.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},Rt.prototype.register=function(e,t){this._setHandler(e,t)},Rt.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},Rt.prototype.canUndo=function(){return!!this._getUndoAction()},Rt.prototype.canRedo=function(){return!!this._getRedoAction()},Rt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Rt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Rt.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},Rt.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},Rt.prototype._createId=function(){return this._uid++},Rt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Rt.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},Rt.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Rt.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:Cd("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Rt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=De(e)?e:[e],t.dirty=t.dirty.concat(e))},Rt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Rt.prototype._revertedAction=function(e){this._stackIdx--},Rt.prototype._getHandler=function(e){return this._handlerMap[e]},Rt.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const kM={commandStack:["type",Rt]};function hr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var OM=250,hv=1400;function tf(e,t,n){ee.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",hv,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=mv(a),o.validatedShapes=mv(s)}),i&&t.on("shape.move.start",OM,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",hv,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];F(s,function(u){F(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;hr(a.labels,function(s){n.removeShape(s,{nested:!0})})}),this.execute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.labelTarget;s&&(o.labelTargetIndex=Ll(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)})}_e(tf,ee),tf.$inject=["injector","eventBus","modeling"];function mv(e){var t=new Set(e);return Ye(e,function(n){return!t.has(n.labelTarget)})}const DM={__init__:["labelSupport"],labelSupport:["type",tf]};var LM=251,gv=1401,yv="attach-ok";function nf(e,t,n,i,r){ee.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",gv,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=IM(c),s.validatedShapes=BM(u)}),o&&t.on("shape.move.start",LM,function(a){var s=a.context,c=s.shapes,u=rf(c);F(u,function(l){o.makeDraggable(s,l,!0),F(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,yv),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,yv)}))}}),this.preExecuted("elements.move",gv,function(a){var s=a.context,c=s.closure,u=s.shapes,l=rf(u);F(l,function(p){c.add(p,c.topLevel[p.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Ye(c,function(p){var f=p.host;return NM(p)&&!$M(c,f)}),F(l,function(p){r.updateAttachment(p,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;F(s,function(c){F(c.attachers,function(u){F(u.outgoing.slice(),function(l){var p=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});p||r.removeConnection(l)}),F(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;hr(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&&F(u.attachers,function(l){var p=Ig(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&&F(p,function(d){var m=Ig(d,u,l);r.moveShape(d,m,d.parent),F(d.labels,function(h){r.moveShape(h,m,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;hr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}_e(nf,ee),nf.$inject=["injector","eventBus","canvas","rules","modeling"];function rf(e){return Vu(dn(e,function(t){return t.attachers||[]}))}function IM(e){var t=rf(e);return lw("id",e,t)}function BM(e){var t=oo(e,"id");return Ye(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function NM(e){return!!e.host}function $M(e,t){return e.indexOf(t)!==-1}const FM={__depends__:[Si],__init__:["attachSupport"],attachSupport:["type",nf]};function vv(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(lm(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)})}vv.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const of={__init__:["changeSupport"],changeSupport:["type",vv]};function ri(e){this._model=e}ri.$inject=["moddle"],ri.prototype._needsId=function(e){return We(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},ri.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;S(e,"bpmn:Activity")?t="Activity":S(e,"bpmn:Event")?t="Event":S(e,"bpmn:Gateway")?t="Gateway":We(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?t="Flow":t=(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},ri.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},ri.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},ri.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",V({bpmnElement:e,bounds:this.createDiBounds()},t))},ri.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},ri.prototype.createDiWaypoints=function(e){var t=this;return dn(e,function(n){return t.createDiWaypoint(n)})},ri.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ui(e,["x","y"]))},ri.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",V({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},ri.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",V({bpmnElement:e},t))};function Nn(e,t,n){ee.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var m=d.context,h=m.hints||{},v;!m.cropped&&h.createElementsBehavior!==!1&&(v=m.connection,v.waypoints=n.getCroppedWaypoints(v),m.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var m=d.context;i.updateParent(m.shape||m.connection,m.oldParent)}function a(d){var m=d.context,h=m.shape||m.connection,v=m.parent||m.newParent;i.updateParent(h,v)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$n(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],$n(a));function s(d){var m=d.context,h=m.oldRoot,v=h.children;F(v,function(y){S(y,"bpmn:BaseElement")&&i.updateParent(y)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var m=d.context.shape;S(m,"bpmn:BaseElement")&&i.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],$n(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],$n(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"],$n(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],$n(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],$n(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],$n(l)),this.executed("connection.reconnect",$n(function(d){var m=d.context,h=m.connection,v=m.oldSource,y=m.newSource,g=ne(h),b=ne(v),x=ne(y);g.conditionExpression&&!We(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=g.conditionExpression,delete g.conditionExpression),v!==y&&b.default===g&&(m.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",$n(function(d){var m=d.context,h=m.connection,v=m.oldSource,y=m.newSource,g=ne(h),b=ne(v),x=ne(y);m.oldConditionExpression&&(g.conditionExpression=m.oldConditionExpression),m.oldDefault&&(b.default=m.oldDefault,delete x.default)}));function p(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],$n(p)),this.reverted(["element.updateAttachment"],$n(p)),this.executed("element.updateLabel",$n(f)),this.reverted("element.updateLabel",$n(f));function f(d){const{element:m}=d.context,h=qn(m),v=tt(m),y=v&&v.get("label");sr(m)||yc(m)||(h&&!y?v.set("label",t.create("bpmndi:BPMNLabel")):!h&&y&&v.set("label",void 0))}}_e(Nn,ee),Nn.$inject=["eventBus","bpmnFactory","connectionDocking"],Nn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Nn.prototype.updateParent=function(e,t){if(!Ge(e)&&!(S(e,"bpmn:DataStoreReference")&&e.parent&&S(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=tt(e),o=n&&n.businessObject,a=tt(n);S(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),S(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),S(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),S(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Nn.prototype.updateBounds=function(e){var t=tt(e),n=HM(e);if(n){var i=pi(n,t.get("bounds"));V(n,{x:e.x+i.x,y:e.y+i.y})}var r=Ge(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),V(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Nn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;S(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Dt(i,e)),S(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Lt(r,e))}},Nn.prototype.updateDiConnection=function(e,t,n){var i=tt(e),r=tt(t),o=tt(n);i.sourceElement&&i.sourceElement.bpmnElement!==ne(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ne(n)&&(i.targetElement=n&&o)},Nn.prototype.updateDiParent=function(e,t){if(t&&!S(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Dt(n,e),e.$parent=null)}};function jM(e){for(;e&&!S(e,"bpmn:Definitions");)e=e.$parent;return e}Nn.prototype.getLaneSet=function(e){var t,n;return S(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(S(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)},Nn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((S(e,"bpmn:DataInput")||S(e,"bpmn:DataOutput"))&&(S(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(S(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(S(e,"bpmn:FlowElement")){if(t){if(S(t,"bpmn:Participant"))t=t.processRef;else if(S(t,"bpmn:Lane"))do t=t.$parent.$parent;while(S(t,"bpmn:Lane"))}i="flowElements"}else if(S(e,"bpmn:Artifact")){for(;t&&!S(t,"bpmn:Process")&&!S(t,"bpmn:SubProcess")&&!S(t,"bpmn:Collaboration");)if(S(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(S(e,"bpmn:MessageFlow"))i="messageFlows";else if(S(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=jM(e.$parent||t),e.$parent&&(Dt(o.get("rootElements"),r),r.$parent=null),t&&(Lt(o.get("rootElements"),r),r.$parent=o))}else S(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":S(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),Dt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Dt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Nn.prototype.updateConnectionWaypoints=function(e){var t=tt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Nn.prototype.updateConnection=function(e){var t=e.connection,n=ne(t),i=t.source,r=ne(i),o=t.target,a=ne(t.target),s;if(S(n,"bpmn:DataAssociation"))S(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):S(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=S(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Dt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Dt(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)},Nn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function $n(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;S(i,"bpmn:BaseElement")&&e(t)}}function HM(e){if(S(e,"bpmn:Activity")){var t=tt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function mr(e,t){Ni.call(this),this._bpmnFactory=e,this._moddle=t}_e(mr,Ni),mr.$inject=["bpmnFactory","moddle"],mr.prototype._baseCreate=Ni.prototype.create,mr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,V({type:"label",di:n},Fr,t))}return this.createElement(e,t)},mr.prototype.createElement=function(e,t){t=V({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!GM(r)){var o=V({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}S(i,"bpmn:Group")&&(t=V({isFrame:!0},t)),t=zM(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=af(r,t,"isExpanded")),We(i,["bpmn:Lane","bpmn:Participant"])&&(t=af(r,t,"isHorizontal")),S(i,"bpmn:SubProcess")&&(t.collapsed=!Xe(i,r)),S(i,"bpmn:ExclusiveGateway")&&(Mn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Yt(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Yt(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=V({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},mr.prototype.getDefaultSize=function(e,t){var n=ne(e);if(t=t||tt(e),S(n,"bpmn:SubProcess"))return Xe(n,t)?{width:350,height:200}:{width:100,height:80};if(S(n,"bpmn:Task"))return{width:100,height:80};if(S(n,"bpmn:Gateway"))return{width:50,height:50};if(S(n,"bpmn:Event"))return{width:36,height:36};if(S(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Xe(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return S(n,"bpmn:Lane")?{width:400,height:100}:S(n,"bpmn:DataObjectReference")?{width:36,height:50}:S(n,"bpmn:DataStoreReference")?{width:50,height:50}:S(n,"bpmn:TextAnnotation")?{width:100,height:40}:S(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},mr.prototype.createParticipantShape=function(e){return Qt(e)||(e={isExpanded:e}),e=V({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function zM(e,t,n){return F(n,function(i){t=af(e,t,i)}),t}function af(e,t,n){return t[n]===void 0?t:(e[n]=t[n],hi(t,[n]))}function GM(e){return We(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Oc(e,t){this._modeling=e,this._canvas=t}Oc.$inject=["modeling","canvas"],Oc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;F(n,function(r){var o={x:0,y:0};Yt(i.left)?o.x=i.left-r.x:Yt(i.right)?o.x=i.right-r.width-r.x:Yt(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Yt(i.top)?o.y=i.top-r.y:Yt(i.bottom)?o.y=i.bottom-r.height-r.y:Yt(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Oc.prototype.postExecute=function(e){};function Dc(e){this._modeling=e}Dc.$inject=["modeling"],Dc.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},Dc.prototype.postExecute=function(e){var t=e.hints||{};VM(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 VM(e,t){return Xi(e.outgoing,function(n){return n.target===t})}function Lc(e,t){this._canvas=e,this._layouter=t}Lc.$inject=["canvas","layouter"],Lc.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},Lc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Ic=Math.round;function sf(e){this._modeling=e}sf.$inject=["modeling"],sf.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;F(t,function(p){Be(p.x)||(p.x=0),Be(p.y)||(p.y=0)});var s=Ye(t,function(p){return!p.hidden}),c=$t(s);F(t,function(p){ft(p)&&(p.waypoints=dn(p.waypoints,function(f){return{x:Ic(f.x-c.x-c.width/2+r.x),y:Ic(f.y-c.y-c.height/2+r.y)}})),V(p,{x:Ic(p.x-c.x-c.width/2+r.x),y:Ic(p.y-c.y-c.height/2+r.y)})});var u=new Set(Ns(t)),l={};F(t,function(p){if(ft(p)){l[p.id]=Be(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=V({},o);u.has(p)||(f.autoResize=!1),Ge(p)&&(f=hi(f,["attach"])),l[p.id]=Be(i)?a.createShape(p,ui(p,["x","y","width","height"]),p.parent||n,i,f):a.createShape(p,ui(p,["x","y","width","height"]),p.parent||n,f)}),e.elements=ro(l)};var bv=Math.round;function gr(e){this._canvas=e}gr.$inject=["canvas"],gr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?V(t,n):V(t,{x:n.x-bv(t.width/2),y:n.y-bv(t.height/2)}),this._canvas.addShape(t,i,r),t},gr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Aa(e){gr.call(this,e)}_e(Aa,gr),Aa.$inject=["canvas"];var WM=gr.prototype.execute;Aa.prototype.execute=function(e){var t=e.shape;return YM(t),t.labelTarget=e.labelTarget,WM.call(this,e)};var UM=gr.prototype.revert;Aa.prototype.revert=function(e){return e.shape.labelTarget=null,UM.call(this,e)};function YM(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Ma(e,t){this._canvas=e,this._modeling=t}Ma.$inject=["canvas","modeling"],Ma.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;hr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),hr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Ma.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Ll(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Ma.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 cf(e,t){this._modeling=e,this._elementRegistry=t}cf.$inject=["modeling","elementRegistry"],cf.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;F(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;hr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),hr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),hr(n.children,function(i){ft(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=Ll(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 Bc(e){this._modeling=e}Bc.$inject=["modeling"];var xv={x:"y",y:"x"};Bc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(v,y){v.range.min=Math.min(y[i],v.range.min),v.range.max=Math.max(y[i]+y[r],v.range.max)}function a(v){return v[i]+v[r]/2}function s(v){return v.length-1}function c(v){return v.max-v.min}function u(v,y){var g={y:0};g[i]=v-a(y),g[i]&&(g[xv[i]]=0,t.moveElements([y],g,y.parent))}var l=n[0],p=s(n),f=n[p],d,m,h=0;F(n,function(v,y){var g,b,x;if(v.elements.length<2){y&&y!==n.length-1&&(o(v,v.elements[0]),h+=c(v.range));return}g=di(v.elements,i),b=g[0],y===p&&(b=g[s(g)]),x=a(b),v.range=null,F(g,function(C){if(u(x,C),v.range===null){v.range={min:C[i],max:C[i]+C[r]};return}o(v,C)}),y&&y!==n.length-1&&(h+=c(v.range))}),m=Math.abs(f.range.min-l.range.max),d=Math.round((m-h)/(n.length-1)),!(d<n.length-1)&&F(n,function(v,y){var g={},b;v===l||v===f||(b=n[y-1],v.range.max=0,F(v.elements,function(x,C){g[xv[i]]=0,g[i]=b.range.max-x[i]+d,v.range.min!==x[i]&&(g[i]+=x[i]-v.range.min),g[i]&&t.moveElements([x],g,x.parent),v.range.max=Math.max(x[i]+x[r],C?v.range.max:0)}))})},Bc.prototype.postExecute=function(e){};function Nc(e,t){this._layouter=e,this._canvas=t}Nc.$inject=["layouter","canvas"],Nc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return V(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Nc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function uf(){}uf.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=Dt(o.children,t),Lt(i.children,t,r),t.parent=i,F(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},uf.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Dt(n.children,t),Lt(i.children,t,r),t.parent=i,F(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 lf(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}lf.prototype.add=function(e,t){return this.addAll([e],t)},lf.prototype.addAll=function(e,t){var n=ES(e,!!t,this);return V(this,n),this};function ka(e){this._modeling=e}ka.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ka.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),F(a,function(p){o.moveShape(p,t,u[p.id]&&!l&&n,{recurse:!1,layout:!1})}),F(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&&gp(p,p.source,t),connectionEnd:d&&yp(p,p.target,t)})})},ka.prototype.getClosure=function(e){return new lf().addAll(e,!0)};function $c(e){this._helper=new ka(e)}$c.$inject=["modeling"],$c.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},$c.prototype.postExecute=function(e){var t=e.hints,n;t&&t.primaryShape&&(n=t.primaryShape,t.oldParent=n.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,n)};function Wr(e){this._modeling=e,this._helper=new ka(e)}Wr.$inject=["modeling"],Wr.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=ui(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Dt(o.children,t),Lt(i.children,t,r),V(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Wr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(F(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:yp(o,t,n)})}),F(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:gp(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Wr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Lt(n.children,t,i),V(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Wr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Wr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Oa(e){this._modeling=e}Oa.$inject=["modeling"],Oa.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return De(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Oa.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},a={};o.connectionStart&&(a.connectionStart=o.connectionStart),o.connectionEnd&&(a.connectionEnd=o.connectionEnd),o.layoutConnection!==!1&&(n&&(!i||o.docking==="source")&&(a.connectionStart=a.connectionStart||_v(De(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||_v(De(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Oa.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r};function _v(e){return e.original||e}function Gi(e,t){this._modeling=e,this._rules=t}Gi.$inject=["modeling","rules"],Gi.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(m,h,v){return i.allowed("connection.reconnect",{connection:v,source:m,target:h})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var 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();F(f,function(m){var h=m.source,v=c(h,s,m);v&&t.reconnectEnd(m,s,pc(m,s,l),a)}),F(d,function(m){var h=m.target,v=c(s,h,m);v&&t.reconnectStart(m,s,lc(m,s,l),a)})},Gi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Gi.prototype.execute=function(e){},Gi.prototype.revert=function(e){},Gi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Gi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Gi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Da(e){this._modeling=e}Da.$inject=["modeling"],Da.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Da.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(F(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:pc(o,n,i)})}),F(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:lc(o,n,i)})}))},Da.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function yr(e){this._modeling=e}yr.$inject=["modeling"],yr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),F(r,function(s){a[s.id]=KM(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(wM(i,r),t,n,o,i,r,a)},yr.prototype.execute=function(){},yr.prototype.revert=function(){},yr.prototype.moveShapes=function(e,t){var n=this;F(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},yr.prototype.resizeShapes=function(e,t,n){var i=this;F(e,function(r){var o=EM(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},yr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);F(e,function(l){var p=l.source,f=l.target,d=qM(l),m=Ev(n),h={},v=c.has(p)||u.has(p),y=c.has(f)||u.has(f);v&&y?(d=dn(d,function(g){return Sv(g,i,n)&&(g[m]=g[m]+t[m]),g.original&&Sv(g.original,i,n)&&(g.original[m]=g.original[m]+t[m]),g}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(v||y)&&(c.has(p)?h.connectionStart=gp(l,p,t):c.has(f)?h.connectionEnd=yp(l,f,t):u.has(p)?h.connectionStart=lc(l,p,a[p.id]):u.has(f)&&(h.connectionEnd=pc(l,f,a[f.id])),s._modeling.layoutConnection(l,h))})};function wv(e){return V({},e)}function qM(e){return dn(e.waypoints,function(t){return t=wv(t),t.original&&(t.original=wv(t.original)),t})}function Ev(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Sv(e,t,n){var i=Ev(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function KM(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Fc(e){this._modeling=e}Fc.$inject=["modeling"],Fc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Rv(n),t.collapsed=!t.collapsed;var i=Cv(n,t.collapsed);return[t].concat(i)},Fc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=Pv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function Rv(e){var t={};return F(e,function(n){t[n.id]=n.hidden,n.children&&(t=V({},t,Rv(n.children)))}),t}function Cv(e,t){var n=[];return F(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Cv(i.children,i.collapsed||t)))}),n}function Pv(e,t){var n=[];return F(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Pv(i.children,t)))}),n}function jc(e){this._modeling=e}jc.$inject=["modeling"],jc.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Av(i,t),Mv(n,t),t.host=n,t},jc.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Av(n,t),Mv(i,t,r),t};function Av(e,t){return Dt(e&&e.attachers,t)}function Mv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Lt(i,t,n)}}function pf(){}pf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},pf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function dt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}dt.$inject=["eventBus","elementFactory","commandStack"],dt.prototype.getHandlers=function(){return{"shape.append":Dc,"shape.create":gr,"shape.delete":Ta,"shape.move":Wr,"shape.resize":Da,"shape.replace":Gi,"shape.toggleCollapse":Fc,spaceTool:yr,"label.create":Aa,"connection.create":Lc,"connection.delete":Ma,"connection.move":uf,"connection.layout":Nc,"connection.updateWaypoints":pf,"connection.reconnect":Oa,"elements.create":sf,"elements.move":$c,"elements.delete":cf,"elements.distribute":Bc,"elements.align":Oc,"element.updateAttachment":jc}},dt.prototype.registerHandlers=function(e){F(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},dt.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)},dt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},dt.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)},dt.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)},dt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},dt.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},dt.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},dt.prototype.createElements=function(e,t,n,i,r){De(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},dt.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},dt.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},dt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},dt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},dt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},dt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},dt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},dt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},dt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},dt.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)},dt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},dt.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)},dt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,V(i,{docking:"source"}))},dt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,V(i,{docking:"target"}))},dt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},dt.prototype._create=function(e,t){return cR(t)?t:this._elementFactory.create(e,t)},dt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function La(e){this._elementRegistry=e}La.$inject=["elementRegistry"],La.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||XM(n,ls(i));return Tv(n,i),e.oldProperties=o,e.changed=r,r},La.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Tv(n,t),i},La.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return S(e,"bpmn:DataObject")?ZM(e,t):[]};function XM(e,t){return Tn(t,function(n,i){return n[i]=e.get(i),n},{})}function Tv(e,t){F(t,function(n,i){e.set(i,n)})}function ZM(e,t){return t.filter(function(n){return S(n,"bpmn:DataObjectReference")&&ne(n).dataObjectRef===e})}var Ia="default",Vi="id",kv="di",QM={width:0,height:0};function Ba(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Ba.$inject=["elementRegistry","moddle","modeling","textRenderer"],Ba.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,a=iT(e.properties),s=e.oldProperties||JM(t,a);return Ov(a,o)&&(r.unclaim(o[Vi]),i.updateId(t,a[Vi]),r.claim(a[Vi],o)),Ia in a&&(a[Ia]&&n.push(i.get(a[Ia].id)),o[Ia]&&n.push(i.get(o[Ia].id))),Dv(t,a),e.oldProperties=s,e.changed=n,n},Ba.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ne(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,QM)}},Ba.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Dv(t,i),Ov(n,r)&&(a.unclaim(n[Vi]),o.updateId(t,i[Vi]),a.claim(i[Vi],r)),e.changed};function Ov(e,t){return Vi in e&&e[Vi]!==t[Vi]}function JM(e,t){var n=ls(t),i=e.businessObject,r=tt(e);return Tn(n,function(o,a){return a!==kv?o[a]=i.get(a):o[a]=eT(r,ls(t.di)),o},{})}function eT(e,t){return Tn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Dv(e,t){var n=e.businessObject,i=tt(e);F(t,function(r,o){o!==kv?n.set(o,r):i&&tT(i,r)})}function tT(e,t){F(t,function(n,i){e.set(i,n)})}var nT=["default"];function iT(e){var t=V({},e);return nT.forEach(function(n){n in e&&(t[n]=ne(t[n]))}),t}function Hc(e,t){this._canvas=e,this._modeling=t}Hc.$inject=["canvas","modeling"],Hc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=tt(r);return t.setRootElement(n),t.removeRootElement(r),Lt(a.rootElements,i),i.$parent=a,Dt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Hc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=tt(n);return t.setRootElement(r),t.removeRootElement(n),Dt(a.rootElements,i),i.$parent=null,Lt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function ff(e,t){this._modeling=e,this._spaceTool=t}ff.$inject=["modeling","spaceTool"],ff.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=ei(i),a=o===i,s=a?i:i.parent,c=ur(s),u=tn(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+Jn,y:i.y,width:i.width-Jn,height:i.height}:{x:i.x,y:i.y+Jn,width:i.width,height:i.height-Jn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var p=[];Nr(o,function(x){return p.push(x),x.label&&p.push(x.label),x===i?[]:Ye(x.children,function(C){return C!==i})});var f,d,m,h,v;r==="top"?(f=-120,d=i.y,m=d+10,h="n",v="y"):r==="left"?(f=-120,d=i.x,m=d+10,h="w",v="x"):r==="bottom"?(f=120,d=i.y+i.height,m=d-10,h="s",v="y"):r==="right"&&(f=120,d=i.x+i.width,m=d-10,h="e",v="x");var y=t.calculateAdjustments(p,v,f,m),g=u?{x:0,y:f}:{x:f,y:0};t.makeSpace(y.movingShapes,y.resizingShapes,g,h,m);var b=u?{x:i.x+(a?Jn:0),y:d-(r==="top"?120:0),width:i.width-(a?Jn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Jn:0),width:120,height:i.height-(a?Jn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function df(e){this._modeling=e}df.$inject=["modeling"],df.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=ur(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=tn(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+Jn,y:n.y+f*c,width:n.width-Jn,height:u}:{x:n.x+f*c,y:n.y+Jn,width:u,height:n.height-Jn},f<o?t.resizeShape(r[f],l):(p={type:"bpmn:Lane",isHorizontal:a},t.createShape(p,l,n))};function Na(e,t){this._modeling=e,this._spaceTool=t}Na.$inject=["modeling","spaceTool"],Na.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Na.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=ZC(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Na.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Oe(e),r=Oe(t),o=pg(r,i),a=ei(e),s=[],c=[];Nr(a,function(m){return s.push(m),(S(m,"bpmn:Lane")||S(m,"bpmn:Participant"))&&c.push(m),m.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 $a="flowNodeRef",hf="lanes";function zc(){}zc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,p){var f=Oe(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=ei(l);return r[p.id]||(r[p.id]=oc(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=ei(l);if(!(!p||n.indexOf(p)!==-1)){var f=p.children.filter(function(d){return S(d,"bpmn:FlowNode")});f.forEach(s),n.push(p)}}),e.forEach(s),o.forEach(function(l){var p=l.businessObject,f=p.get(hf),d=f.slice(),m=u(l);i.push({flowNode:p,remove:d,add:m})}),t.forEach(function(l){var p=l.businessObject;l.parent||p.get($a).forEach(function(f){i.push({flowNode:f,remove:[p],add:[]})})}),i},zc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(hf);n.remove.forEach(function(o){Dt(r,o),Dt(o.get($a),i)}),n.add.forEach(function(o){Lt(r,o),Lt(o.get($a),i)})}),[]},zc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(hf);n.add.forEach(function(o){Dt(r,o),Dt(o.get($a),i)}),n.remove.forEach(function(o){Lt(r,o),Lt(o.get($a),i)})}),[]};var mf="categoryValueRef";function Fa(e,t){this._bpmnFactory=e,this._elementRegistry=t}Fa.$inject=["bpmnFactory","elementRegistry"],Fa.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(g,b,x){if(b){var C=a.get(g);C||(C={},a.set(g,C)),!(x&&C.present)&&(!x&&C.past||(x?C.present={categoryValue:b,root:gf(g)}:C.past={categoryValue:b}))}}function c(g){r.set(g,ne(g))}function u(){n.filter(function(g){return S(g,"bpmn:FlowElement")&&!Ge(g)&&g.parent}).forEach(c)}function l(g){var b=ne(g),x=b.get("categoryValueRef");return x||(x=ag(i,b),o.push(rT(g,x))),x}function p(g){return g.reduce(function(b,x){var C=gf(x),M=b.get(C);return M||(M=[],b.set(C,M)),M.push(x),b},new Map)}e=Array.from(e||[]);var f=p(e);t.length&&u(),e.forEach(c),n.filter(function(g){return S(g,"bpmn:Group")&&!Ge(g)&&g.parent}).forEach(function(g){var b=ne(g).get("categoryValueRef");if(!b){var x=gf(g),C=f.get(x)||[],M=yo(C,g),k=Object.keys(M).length>0;k&&(b=l(g))}s(g,b,!0)}),t.forEach(function(g){s(g.groupShape,g.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),m=Array.from(a.values()).reduce(function(g,b){return b.present&&g.add(b.present.categoryValue),b.past&&g.add(b.past.categoryValue),g},new Set),h=new Map,v=p(d);a.forEach(function(g,b){var x=g.present;if(x){var C=v.get(x.root)||[],M=yo(C,b);C.forEach(function(k){if(M[k.id]){var A=h.get(k);A||(A=new Set,h.set(k,A)),A.add(x.categoryValue)}})}});var y=d.reduce(function(g,b){var x=r.get(b),C=x.get(mf),M=new Set(C),k=h.get(b)||new Set,A=Array.from(k).filter(function(D){return!M.has(D)}),B=C.filter(function(D){return m.has(D)&&!k.has(D)});return(A.length||B.length)&&g.push({businessObject:x,categoryValuesToAdd:A,categoryValuesToRemove:B}),g},[]);return{flowElements:y,groups:o}},Fa.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),oT(t.groups),sT(t.flowElements),[]},Fa.prototype.revert=function(e){var t=e.updates;return cT(t.flowElements),aT(t.groups),[]};function rT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function oT(e){e.forEach(function(t){ne(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function aT(e){e.forEach(function(t){ne(t.groupShape).categoryValueRef=null})}function sT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(mf);t.categoryValuesToRemove.forEach(function(r){Dt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Lt(i,r,!0)})})}function cT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(mf);t.categoryValuesToAdd.forEach(function(r){Dt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Lt(i,r,!0)})})}function gf(e){for(;e.parent;)e=e.parent;return e}function Gc(e){this._moddle=e}Gc.$inject=["moddle"],Gc.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.claim(n,i):t.unclaim(n),[]},Gc.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element,r=e.claiming;return r?t.unclaim(n):t.claim(n,i),[]};var uT={fill:void 0,stroke:void 0};function yf(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(An(t)){var n=lT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}yf.$inject=["commandStack"],yf.prototype.postExecute=function(e){var t=e.elements,n=e.colors||uT,i=this,r={};"fill"in n&&V(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&V(r,{"border-color":this._normalizeColor(n.stroke)}),F(t,function(o){var a=ft(o)?ui(r,["border-color"]):r,s=tt(o);if(pT(a),Ge(o)){if(!s||!S(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!We(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function lT(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 pT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var fT={width:0,height:0};function Lv(e,t,n){function i(c,u){var l=c.label||c,p=c.labelTarget||c;return jR(l,u),[l,p]}function r(c){var u=c.element,l=u.businessObject,p=c.newLabel;if(!Ge(u)&&sr(u)&&!Us(u)&&!Iv(p)){var f=7,d=jl(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=qn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,p=c.newLabel,f=c.newBounds,d=c.hints||{};if(!(!Ge(l)&&!S(l,"bpmn:TextAnnotation"))){if(Ge(l)&&Iv(p)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var m=qn(u);typeof f>"u"&&(f=t.getExternalLabelBounds(l,m)),f&&e.resizeShape(l,f,fT)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Lv.$inject=["modeling","textRenderer","bpmnFactory"];function Iv(e){return!e||!e.trim()}function pn(e,t,n,i){dt.call(this,e,t,n),this._bpmnRules=i}_e(pn,dt),pn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],pn.prototype.getHandlers=function(){var e=dt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=La,e["element.updateProperties"]=Ba,e["canvas.updateRoot"]=Hc,e["lane.add"]=ff,e["lane.resize"]=Na,e["lane.split"]=df,e["lane.updateRefs"]=zc,e["group.updateRefs"]=Fa,e["id.updateClaim"]=Gc,e["element.setColor"]=yf,e["element.updateLabel"]=Lv,e},pn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},pn.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)},pn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},pn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},pn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},pn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},pn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},pn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},pn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},pn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},pn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},pn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Bv(){}Bv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Le(t.source||e.source),t.connectionEnd||Le(t.target||e.target)]};var Vc=20,dT=5,Wc=Math.round,Nv=20,hT={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function mT(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function gT(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function $v(e,t,n){var i=cn(t,e,dT),r=n.split(":")[0],o=Wc((t.x-e.x)/2+e.x),a=Wc((t.y-e.y)/2+e.y),s,c,u=gT(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=mT(i,r),c=l?"h:v":"v:h",p?l?(f=a===e.y,s={x:e.x+Vc*(/l/.test(r)?-1:1),y:f?a+Vc:a}):(f=o===e.x,s={x:f?o+Vc:o,y:e.y+Vc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:vf(e,s,c).concat(s),directions:c,turnNextDirections:f}}function yT(e,t,n){return $v(e,t,n)}function vT(e,t,n){var i=$v(t,e,Fv(n));return{waypoints:i.waypoints.slice().reverse(),directions:Fv(i.directions),turnNextDirections:i.turnNextDirections}}function bT(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=vf(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Fv(e){return e.split(":").reverse().join(":")}function xT(e,t,n){var i=Wc((t.x-e.x)/2+e.x),r=Wc((t.y-e.y)/2+e.y);if(n==="h:v")return[{x:t.x,y:e.y}];if(n==="v:h")return[{x:e.x,y:t.y}];if(n==="h:h")return[{x:i,y:e.y},{x:i,y:t.y}];if(n==="v:v")return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}function vf(e,t,n){if(n=n||"h:h",!MT(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Hv(n)){var i=yT(e,t,n),r=vT(e,t,n),o=bT(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return xT(e,t,n)}function _T(e,t,n){var i=vf(e,t,n);return i.unshift(e),i.push(t),Gv(i)}function wT(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=cw(o,"straight")[0]||"h:h",s=hT[a]||0,c=cn(e,t,s),u=AT(c,a);n=n||Le(e),i=i||Le(t);var l=u.split(":"),p=zv(n,e,l[0],TT(c)),f=zv(i,t,l[1],c);return _T(p,f,u)}function ET(e,t,n,i,r,o){De(n)&&(r=n,o=i,n=Le(e),i=Le(t)),o=V({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&RT(e,t,n,i,o),c||(c=o.connectionEnd&&PT(t,e,i,r),c)||(c=o.connectionStart&&CT(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:wT(e,t,n,i,o)}function ST(e,t,n){return e>=t&&e<=n}function jv(e,t,n){var i={x:"width",y:"height"};return ST(t[e],n[e],n[e]+n[i[e]])}function RT(e,t,n,i,r){var o={},a,s;return s=cn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?jv(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:jv(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 CT(e,t,n,i){return bf(e,t,n,i)}function PT(e,t,n,i){var r=i.slice().reverse();return r=bf(e,t,n,r),r?r.reverse():null}function bf(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!mt(l,function(p,f){var d=l[f-1];return d&&ua(p,d)<3})}function o(l,p,f){var d=Ii(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(fm(l[d],p,Nv)||fm(l[d],f,Nv))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=bf(e,t,n,u)),c&&Ii(c)?null:c}function AT(e,t){if(Hv(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 MT(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Hv(e){return e&&/t|r|b|l/.test(e)}function TT(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 zv(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 Gv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return Il(r,o,n,0)||t.push(n),t},[])}var kT=-10,OT=40,DT={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},LT={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},xf={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ja={top:"t",right:"r",bottom:"b",left:"l"};function Uc(e){this._elementRegistry=e}_e(Uc,Bv),Uc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=Vv(r&&r[0],n)),a||(a=Vv(r&&r[r.length-1],i)),(S(e,"bpmn:Association")||S(e,"bpmn:DataAssociation"))&&r&&!Wv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=ng(n,s)?DT:LT;return S(e,"bpmn:MessageFlow")?c=BT(n,i,l):(S(e,"bpmn:SequenceFlow")||Wv(n,i))&&(n===i?c={preferredLayouts:zT(n,e,l)}:S(n,"bpmn:BoundaryEvent")?c={preferredLayouts:GT(n,i,a,l)}:Ha(n)||Ha(i)?c={preferredLayouts:l.subProcess,preserveDocking:$T(n)}:S(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:S(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=V(c,t),u=Gv(ET(n,i,o,a,r,c))),u||[o,a]};function IT(e){var t=e.host;return cn(Le(e),t,kT)}function BT(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:NT(e,t)}}function NT(e,t){return S(t,"bpmn:Participant")?"source":S(e,"bpmn:Participant")?"target":Ha(t)?"source":Ha(e)||S(t,"bpmn:Event")?"target":S(e,"bpmn:Event")?"source":null}function $T(e){return Ha(e)?"target":"source"}function Vv(e,t){return e?e.original||e:Le(t)}function Wv(e,t){return S(t,"bpmn:Activity")&&S(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Ha(e){return S(e,"bpmn:SubProcess")&&Xe(e)}function Ur(e,t){return e===t}function FT(e,t){return t.indexOf(e)!==-1}function Bo(e){var t=/right|left/.exec(e);return t&&t[0]}function No(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Uv(e,t){return xf[e]===t}function jT(e,t){var n=Bo(e),i=xf[n];return t.indexOf(i)!==-1}function HT(e,t){var n=No(e),i=xf[n];return t.indexOf(i)!==-1}function Yv(e){return e==="right"||e==="left"}function zT(e,t,n){var i=t.waypoints,r=i&&i.length&&cn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function GT(e,t,n,i){var r=Le(e),o=Le(t),a=IT(e),s,c,u=Ur(e.host,t),l=FT(a,["top","right","bottom","left"]),p=cn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?VT(a,l,e,t,n,i):(s=WT(a,p,l,i.isHorizontal),c=UT(a,p,l,i.isHorizontal),[s+":"+c])}function VT(e,t,n,i,r,o){var a=t?e:o.isHorizontal?No(e):Bo(e),s=ja[a],c;return t?Yv(e)?c=qv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=qv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function qv(e,t,n,i){var r=OT;return!(_f(e,i,n,r)||_f(e,i,{x:n.x+n.width,y:n.y+n.height},r)||_f(e,i,Le(t),r))}function _f(e,t,n,i){return Math.abs(t[e]-n[e])<i}function WT(e,t,n,i){if(n)return ja[e];var r=No(e),o=Bo(e),a=No(t),s=Bo(t);if(i){if(Ur(r,a)||Uv(o,s))return ja[r]}else if(Ur(o,s)||Uv(r,a))return ja[o];return ja[i?o:r]}function UT(e,t,n,i){if(n)return Yv(e)?jT(e,t)||Ur(e,t)?"h":"v":HT(e,t)||Ur(e,t)?"v":"h";var r=No(e),o=Bo(e),a=No(t),s=Bo(t);return a&&!s?"v":s&&!a?"h":i?Ur(r,a)?"h":"v":Ur(o,s)?"v":"h"}Uc.$inject=["elementRegistry"];function Kv(e){return V({original:e.point.original||e.point},e.actual)}function vr(e,t){this._elementRegistry=e,this._graphicsFactory=t}vr.$inject=["elementRegistry","graphicsFactory"],vr.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(Kv(i)),o.push(Kv(r)),o},vr.prototype.getDockingPoint=function(e,t,n){var i=e.waypoints,r,o,a;return r=n?0:i.length-1,o=i[r],a=this._getIntersection(t,e,n),{point:o,actual:a||o,idx:r}},vr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return la(i,r,n)},vr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},vr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},vr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const wf={__init__:["modeling","bpmnUpdater"],__depends__:[pA,PA,MA,TA,sv,kM,DM,FM,ni,of,dv],bpmnFactory:["type",ri],bpmnUpdater:["type",Nn],elementFactory:["type",mr],modeling:["type",pn],layouter:["type",Uc],connectionDocking:["type",vr]};var YT=10,Xv=50,qT=250;function Ef(e,t,n,i){for(var r;r=KT(e,n,t);)n=i(t,n,r);return n}function Sf(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 KT(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=ZT(e);return mt(r,function(o){if(o===n)return!1;var a=cn(o,i,YT);return a==="intersect"})}function XT(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||Xv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||qT,c=t.reference||"start";o||(o=e2);function u(m,h){return r==="n"?c==="start"?Oe(m).top-Oe(h).bottom:c==="center"?Oe(m).top-Le(h).y:Oe(m).top-Oe(h).top:r==="w"?c==="start"?Oe(m).left-Oe(h).right:c==="center"?Oe(m).left-Le(h).x:Oe(m).left-Oe(h).left:r==="s"?c==="start"?Oe(h).top-Oe(m).bottom:c==="center"?Le(h).y-Oe(m).bottom:Oe(h).bottom-Oe(m).bottom:c==="start"?Oe(h).left-Oe(m).right:c==="center"?Le(h).x-Oe(m).right:Oe(h).right-Oe(m).right}var l=e.incoming.filter(o).map(function(m){var h=a(m),v=h<0?u(m.source,e):u(e,m.source);return{id:m.source.id,distance:v,weight:h}}),p=e.outgoing.filter(o).map(function(m){var h=a(m),v=h>0?u(e,m.target):u(m.target,e);return{id:m.target.id,distance:v,weight:h}}),f=l.concat(p).reduce(function(m,h){return m[h.id+"__weight_"+h.weight]=h,m},{}),d=Tn(f,function(m,h){var v=h.distance,y=h.weight;return v<0||v>s||(m[String(v)]||(m[String(v)]=0),m[String(v)]+=1*y,(!m.distance||m[m.distance]<m[String(v)])&&(m.distance=v)),m},{});return d.distance||i}function ZT(e){var t=Rf(e);return e.host&&(t=t.concat(Rf(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(Rf(i))},[]))),t}function Rf(e){return JT(e).concat(QT(e))}function QT(e){return e.incoming.map(function(t){return t.source})}function JT(e){return e.outgoing.map(function(t){return t.target})}function e2(){return!0}var t2=100;function Zv(e,t,n){e.on("autoPlace",t2,function(i){var r=i.shape,o=i.source;return n2(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}}Zv.$inject=["eventBus","modeling","canvas"];function n2(e,t,n){n||(n={});var i=n.defaultDistance||Xv,r=Le(e),o=Oe(e);return{x:o.right+i+t.width/2,y:r.y}}function Qv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Qv.$inject=["eventBus","selection"];const i2={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Zv],autoPlaceSelectionBehavior:["type",Qv]};function Jv(e,t,n){var i=ng(e,n);if(S(t,"bpmn:TextAnnotation"))return o2(e,t,i);if(We(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return a2(e,t,i);if(S(t,"bpmn:FlowNode"))return r2(e,t,i)}function r2(e,t,n){var i=Oe(e),r=Le(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=XT(e,{filter:function(d){return S(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;S(e,"bpmn:BoundaryEvent")&&(u=cn(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+eb(u,c,o)}:{x:r.x+eb(u,c,o),y:i.bottom+a+t.height/2},p={margin:s,minDistance:c},f=n?{y:p}:{x:p};return Ef(e,t,l,Sf(f))}function eb(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function o2(e,t,n){var i=Oe(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};ft(e)&&(r=Le(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return Ef(e,t,r,Sf(a))}function a2(e,t,n){var i=Oe(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 Ef(e,t,r,Sf(a))}function tb(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Jv(r,i,t)})}tb.$inject=["eventBus","elementRegistry"];const Yc={__depends__:[i2],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",tb]},nb=[eg,ga,wf,Yc];function s2(e={}){qd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new xo({container:t,moddleExtensions:e.moddleExtensions??ys,additionalModules:[...nb,...e.additionalModules??[]]})}var c2=new Lo("ov"),u2=500;function on(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=c2,this._overlayDefaults=V({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=l2(n.getContainer()),this._init()}on.$inject=["config.overlays","eventBus","canvas","elementRegistry"],on.prototype.get=function(e){if(An(e)&&(e={id:e}),An(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ye(t.overlays,ao({type:e.type})):t.overlays.slice():[]}else return e.type?Ye(this._overlays,ao({type:e.type})):e.id?this._overlays[e.id]:null},on.prototype.add=function(e,t,n){if(Qt(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=V({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},on.prototype.remove=function(e){var t=this.get(e)||[];De(t)||(t=[t]);var n=this;F(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(vi(i.html),vi(i.htmlContainer),delete i.htmlContainer,delete i.element,delete n._overlays[i.id]),r){var o=r.overlays.indexOf(i);o!==-1&&r.overlays.splice(o,1)}})},on.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},on.prototype.show=function(){qc(this._overlayRoot)},on.prototype.hide=function(){qc(this._overlayRoot,!1)},on.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ks(this._overlayRoot)},on.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=$t(t);i=o.x,r=o.y}ib(n,i,r),mn(e.html,"data-container-id",t.id)},on.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=$t(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=$t(i).height:s=i.height,o=t.bottom*-1+s}ib(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},on.prototype._createOverlayContainer=function(e){var t=bt('<div class="djs-overlays" />');_n(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},on.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";rb(this._overlayRoot,n)},on.prototype._getOverlayContainer=function(e,t){var n=mt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},on.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)),An(i)&&(i=bt(i)),o=this._getOverlayContainer(n),r=bt('<div class="djs-overlay" data-overlay-id="'+t+'">'),_n(r,{position:"absolute"}),r.appendChild(i),e.type&&wt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();qc(r,a===s),e.htmlContainer=r,o.overlays.push(e),o.html.appendChild(r),this._overlays[t]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},on.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&&(Yt(r)&&r>t.scale||Yt(o)&&o<t.scale))&&(c=!1),qc(a,c),this._updateOverlayScale(e,t)},on.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),Yt(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Yt(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Yt(a)&&(s="scale("+a+","+a+")"),rb(o,s)},on.prototype._updateOverlaysVisibilty=function(e){var t=this;F(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},on.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});F(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){vi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",u2,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(F(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&&wt(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 l2(e){var t=bt('<div class="djs-overlay-container" />');return _n(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function ib(e,t,n){_n(e,{left:t+"px",top:n+"px"})}function qc(e,t){e.style.display=t===!1?"none":""}function rb(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Kc={__init__:["overlays"],overlays:["type",on]};function Cf(e,t){t.invoke(ee,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}_e(Cf,ee),Cf.$inject=["canvas","injector"];const p2={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",Cf]};function za(e){return CSS.escape(e)}var f2={"&":"&","<":"<",">":">",'"':""","'":"'"};function ob(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return f2[t]})}var d2="bjs-breadcrumbs-shown";function ab(e,t,n){var i=bt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=wt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=ne(u),p=mt(a,function(f){return f===l});p&&s()});function s(c){c&&(a=h2(c));var u=a.flatMap(function(p){var f=n.findRoot(Ei(p))||n.findRoot(p.id);if(!f&&S(p,"bpmn:Process")){var d=t.find(function(v){var y=ne(v);return y&&y.get("processRef")===p});f=d&&n.findRoot(d.id)}if(!f)return[];var m=ob(p.name||p.id),h=bt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(f)}),h});i.innerHTML="";var l=u.length>1;o.toggle(d2,l),u.forEach(function(p){i.appendChild(p)})}e.on("root.set",function(c){s(c.element)})}ab.$inject=["eventBus","elementRegistry","canvas"];function h2(e){for(var t=ne(e),n=[],i=t;i;i=i.$parent)(S(i,"bpmn:SubProcess")||S(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function sb(e,t){var n=null,i=new m2;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,!(!S(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})}sb.$inject=["eventBus","canvas"];function m2(){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 cb={x:180,y:160};function Yr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Yr.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)})}},Yr.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;S(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),y2(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},Yr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=g2(e),i={x:n.x-cb.x,y:n.y-cb.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)})},Yr.prototype._moveToDiPlane=function(e,t){var n=ub(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Yr.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},Yr.$inject=["eventBus","moddle"];function ub(e){return S(e,"bpmndi:BPMNDiagram")?e:ub(e.$parent)}function g2(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=Oe(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),js(t)}function y2(e,t){var n=e.$parent;return!(!S(n,"bpmn:SubProcess")||n===t.bpmnElement||We(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Xc=250,v2='<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>',b2="bjs-drilldown-empty";function br(e,t,n,i,r){ee.call(this,t),this._canvas=e,this._eventBus=t,this._elementRegistry=n,this._overlays=i,this._translate=r;var o=this;this.executed("shape.toggleCollapse",Xc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Xc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Xc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],Xc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}_e(br,ee),br.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},br.prototype._canDrillDown=function(e){var t=this._canvas;return S(e,"bpmn:SubProcess")&&t.findRoot(Ei(e))},br.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ne(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;wt(i.html).toggle(b2,!r)}},br.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ne(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=bt('<button type="button" class="bjs-drilldown">'+v2+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(Ei(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},br.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},br.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const x2={__depends__:[Kc,of,p2],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",ab],drilldownCentering:["type",sb],drilldownOverlayBehavior:["type",br],subprocessCompatibility:["type",Yr]};function xr(e){St.call(this,e)}_e(xr,St),xr.prototype._modules=[eg,x2,Kc,ni,ga],xr.prototype._moddleExtensions={};var Zc="keyboard.keydown",_2="keyboard.keyup",w2=1e3,lb="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 wn(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(lb));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}wn.$inject=["config.keyboard","eventBus"],wn.prototype._keydownHandler=function(e){this._keyHandler(e,Zc)},wn.prototype._keyupHandler=function(e){this._keyHandler(e,_2)},wn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Zc,i),n&&e.preventDefault()}},wn.prototype._isEventIgnored=function(e){return!1},wn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(lb)),this.unbind(),e=this._node=this._target,Ne.bind(e,"keydown",this._keydownHandler),Ne.bind(e,"keyup",this._keyupHandler),this._fire("bind")},wn.prototype.getBinding=function(){return this._node},wn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ne.unbind(e,"keydown",this._keydownHandler),Ne.unbind(e,"keyup",this._keyupHandler)),this._node=null},wn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},wn.prototype.addListener=function(e,t,n){Jt(e)&&(n=t,t=e,e=w2),this._eventBus.on(n||Zc,e,t)},wn.prototype.removeListener=function(e,t){this._eventBus.off(t||Zc,e)},wn.prototype.hasModifier=GA,wn.prototype.isCmd=In,wn.prototype.isShift=Yp,wn.prototype.isKey=Xt;var E2=500;function $o(e,t){var n=this;e.on("editorActions.init",E2,function(i){var r=i.editorActions;n.registerBindings(t,r)})}$o.$inject=["eventBus","keyboard"],$o.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(qA(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(KA(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(VA(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(WA(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(UA(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(YA(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Xt(["+","Add","="],r)&&In(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Xt(["-","Subtract"],r)&&In(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Xt("0",r)&&In(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Xt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Pf={__init__:["keyboard","keyboardBindings"],keyboard:["type",wn],keyboardBindings:["type",$o]};var S2={moveSpeed:50,moveSpeedAccelerated:200};function pb(e,t,n){var i=this;this._config=V({},S2,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})}}pb.$inject=["config.keyboardMove","keyboard","canvas"];const fb={__depends__:[Pf],__init__:["keyboardMove"],keyboardMove:["type",pb]};var R2=15;function db(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=Hr(s),p=pi(l,c);if(!n.dragging&&C2(p)>R2&&(n.dragging=!0,u===0&&jy(e),Sc("grab")),n.dragging){var f=n.last||n.start;p=pi(l,f),t.scroll({dx:p.x,dy:p.y}),n.last=l}s.preventDefault()}function o(s){Ne.unbind(document,"mousemove",r),Ne.unbind(document,"mouseup",o),n=null,Fy()}function a(s){if(!Ir(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Hr(s)},Ne.bind(document,"mousemove",r),Ne.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}db.$inject=["eventBus","canvas"];function C2(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const hb={__init__:["moveCanvas"],moveCanvas:["type",db]};function mb(e,t){var n=Vl(e.min),i=Vl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function P2(e,t){return Math.max(e.min,Math.min(e.max,t))}var A2=Math.sign||function(e){return e>=0?1:-1},Af={min:.2,max:4},gb=10,M2=.1,T2=.75;function Ci(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Sn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||T2;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Ci.$inject=["config.zoomScroll","eventBus","canvas"],Ci.prototype.scroll=function(t){this._canvas.scroll(t)},Ci.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Ci.prototype.zoom=function(t,n){var i=mb(Af,gb*2);this._totalDelta+=t,Math.abs(this._totalDelta)>M2&&(this._zoom(t,n,i),this._totalDelta=0)},Ci.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Yg()&&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))*A2(t.deltaY)*o,this.zoom(a,c)}else r?a={dx:o*t.deltaY,dy:0}:a={dx:o*t.deltaX,dy:o*t.deltaY},this.scroll(a)}},Ci.prototype.stepZoom=function(t,n){var i=mb(Af,gb);this._zoom(t,n,i)},Ci.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Vl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(P2(Af,s),t)},Ci.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Ne[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Ci.prototype._init=function(e){this.toggle(e)};const yb={__init__:["zoomScroll"],zoomScroll:["type",Ci]};function Ga(e){xr.call(this,e)}_e(Ga,xr),Ga.prototype._navigationModules=[fb,hb,yb],Ga.prototype._modules=[].concat(xr.prototype._modules,Ga.prototype._navigationModules);function Mf(e){return e&&e[e.length-1]}function vb(e){return e.y}function bb(e){return e.x}var k2={left:bb,center:bb,right:function(e){return e.x+e.width},top:vb,middle:vb,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=Mf(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(F(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=di(a,function(f){return f.elements.length>1&&(s=!0),f.elements.length}),s)return o[e]=Mf(c).center,o;u=t[0],t=di(t,function(f){return f[i]+f[r]}),l=Mf(t),o[e]=p(u,l)}return o},Fo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ye(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),De(i)&&(r=i),!(r.length<2||!i)){var o=k2[t],a=di(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const O2={__init__:["alignElements"],alignElements:["type",Fo]},D2=new Lo;function jo(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}jo.$inject=["eventBus"],jo.prototype.schedule=function(e,t=D2.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},jo.prototype._schedule=function(e,t){const n=L2();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}},jo.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},jo.prototype._cancel=function(e){clearTimeout(e.executionId)};function L2(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const I2={scheduler:["type",jo]};var B2="djs-element-hidden",Qc=".entry",N2=1e3,xb=8,$2=300;function jt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}jt.$inject=["canvas","elementRegistry","eventBus","scheduler"],jt.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=De(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=De(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},jt.prototype._createContainer=function(){var e=bt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},jt.prototype.registerProvider=function(e,t){t||(t=e,e=N2),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},jt.prototype.getEntries=function(e){var t=this._getProviders(),n=De(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return F(t,function(r){if(Jt(r[n])){var o=r[n](e);Jt(o)?i=o(i):F(o,function(a,s){i[s]=a})}}),i},jt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=mn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},$2);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},jt.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(Jt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},jt.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))}},jt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},jt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;F(t,function(r,o){var a=r.group||"default",s=bt(r.html||'<div class="entry" draggable="true"></div>'),c;mn(s,"data-action",o),c=pt("[data-group="+za(a)+"]",n),c||(c=bt('<div class="group"></div>'),mn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&F2(s,r.className),r.title&&mn(s,"title",r.title),r.imageUrl&&(i=bt("<img>"),mn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),wt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},jt.prototype._createHtml=function(e){var t=this,n=bt('<div class="djs-context-pad"></div>');return On.bind(n,Qc,"click",function(i){t.trigger("click",i)}),On.bind(n,Qc,"dragstart",function(i){t.trigger("dragstart",i)}),On.bind(n,Qc,"mouseover",function(i){t.trigger("mouseover",i)}),On.bind(n,Qc,"mouseout",function(i){t.trigger("mouseout",i)}),Ne.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},jt.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()&&H2(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},jt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},jt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return De(e)!==De(n)?!1:De(e)?e.length===n.length&&kr(e,function(i){return n.includes(i)}):n===e},jt.prototype.isShown=function(){return this.isOpen()&&wt(this._current.html).has("open")},jt.prototype.show=function(){this.isOpen()&&(wt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},jt.prototype.hide=function(){this.isOpen()&&(wt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},jt.prototype._getPosition=function(e){if(!De(e)&&ft(e)){var t=this._canvas.viewbox(),n=j2(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+xb*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+xb*this._canvas.zoom(),top:s.top-a.top}},jt.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")},jt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=De(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,B2)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},jt.prototype._getTargetBounds=function(e){var t=this,n=De(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function F2(e,t){var n=wt(e);t=De(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function j2(e){return e.waypoints[e.waypoints.length-1]}function H2(e,t){return e=De(e)?e:[e],t=De(t)?t:[t],e.length===t.length&&kr(e,function(n){return t.includes(n)})}const _b={__depends__:[Ec,I2,Kc],contextPad:["type",jt]};var Jc,Ct,wb,_r,Eb,Sb,Rb,Tf,eu,Va,Cb,kf,Of,Df,tu={},nu=[],z2=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,iu=Array.isArray;function Wi(e,t){for(var n in t)e[n]=t[n];return e}function Lf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Pb(e,t,n){var i,r,o,a={};for(o in t)o=="key"?i=t[o]:o=="ref"?r=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?Jc.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return ru(e,a,i,r,null)}function ru(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++wb,__i:-1,__u:0};return r==null&&Ct.vnode!=null&&Ct.vnode(o),o}function ou(e){return e.children}function au(e,t){this.props=e,this.context=t}function qr(e,t){if(t==null)return e.__?qr(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"?qr(e):null}function G2(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Wi({},t);o.__v=t.__v+1,Ct.vnode&&Ct.vnode(o),If(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??qr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Ib(i,o,r),t.__e=t.__=null,o.__e!=n&&Ab(o)}}function Ab(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}),Ab(e)}function Mb(e){(!e.__d&&(e.__d=!0)&&_r.push(e)&&!su.__r++||Eb!=Ct.debounceRendering)&&((Eb=Ct.debounceRendering)||Sb)(su)}function su(){try{for(var e,t=1;_r.length;)_r.length>t&&_r.sort(Rb),e=_r.shift(),t=_r.length,G2(e)}finally{_r.length=su.__r=0}}function Tb(e,t,n,i,r,o,a,s,c,u,l){var p,f,d,m,h,v,y=i&&i.__k||nu,g=t.length;for(c=V2(n,t,y,c,g),p=0;p<g;p++)(d=n.__k[p])!=null&&(f=d.__i!=-1&&y[d.__i]||tu,d.__i=p,v=If(e,d,f,r,o,a,s,c,u,l),m=d.__e,d.ref&&f.ref!=d.ref&&(f.ref&&Bf(f.ref,null,d),l.push(d.ref,d.__c||m,d)),h==null&&m!=null&&(h=m),4&d.__u?(c=kb(d,c,e),f.__e&&(f.__e=null)):typeof d.type=="function"&&v!==void 0?c=v:m&&(c=m.nextSibling),d.__u&=-7);return n.__e=h,c}function V2(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]=ru(null,a,null,null,null):iu(a)?a=e.__k[o]=ru(ou,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=ru(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+f,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=W2(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=qr(s)),Nb(s,s));return i}function kb(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=kb(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=qr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function W2(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 Ob(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||z2.test(t)?n:n+"px"}function cu(e,t,n,i,r){var o,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||Ob(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Ob(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Cb,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?i?n[Va]=i[Va]:(n[Va]=kf,e.addEventListener(t,o?Df:Of,o)):e.removeEventListener(t,o?Df:Of,o);else{if(r=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Db(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[eu]==null)t[eu]=kf++;else if(t[eu]<n[Va])return;return n(Ct.event?Ct.event(t):t)}}}function If(e,t,n,i,r,o,a,s,c,u){var l,p,f,d,m,h,v,y,g,b,x,C,M,k,A,B,D=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=Ct.__b)&&l(t);e:if(typeof D=="function"){p=a.length;try{if(g=t.props,b=D.prototype&&D.prototype.render,x=(l=D.contextType)&&i[l.__c],C=l?x?x.props.value:l.__:i,n.__c?y=(f=t.__c=n.__c).__=f.__E:(b?t.__c=f=new D(g,C):(t.__c=f=new au(g,C),f.constructor=D,f.render=Y2),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&&D.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Wi({},f.__s)),Wi(f.__s,D.getDerivedStateFromProps(g,f.__s))),m=f.props,h=f.state,f.__v=t,d)b&&D.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),b&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(b&&D.getDerivedStateFromProps==null&&g!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(g,C),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(g,f.__s,C)===!1){t.__v!=n.__v&&(f.props=g,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(L){L&&(L.__=t)}),nu.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&a.push(f),s=qr(n);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(g,f.__s,C),b&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,v)})}if(f.context=C,f.props=g,f.__P=e,f.__e=!1,M=Ct.__r,k=0,b)f.state=f.__s,f.__d=!1,M&&M(t),l=f.render(f.props,f.state,f.context),nu.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,M&&M(t),l=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++k<25);f.state=f.__s,f.getChildContext!=null&&(i=Wi(Wi({},i),f.getChildContext())),b&&!d&&f.getSnapshotBeforeUpdate!=null&&(v=f.getSnapshotBeforeUpdate(m,h)),A=l!=null&&l.type===ou&&l.key==null?Bb(l.props.children):l,s=Tb(e,iu(A)?A:[A],t,n,i,r,o,a,s,c,u),f.base=t.__e,t.__u&=-161,f.__h.length&&a.push(f),y&&(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(B=o.length;B--;)Lf(o[B])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),L.then||Lb(t),Ct.__e(L,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=U2(n.__e,t,n,i,r,o,a,c,u);return(l=Ct.diffed)&&l(t),128&t.__u?void 0:s}function Lb(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Lb))}function Ib(e,t,n){for(var i=0;i<n.length;i++)Bf(n[i],n[++i],n[++i]);Ct.__c&&Ct.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Ct.__e(o,r.__v)}})}function Bb(e){return typeof e!="object"||e==null||e.__b>0?e:iu(e)?e.map(Bb):e.constructor!==void 0?null:Wi({},e)}function U2(e,t,n,i,r,o,a,s,c){var u,l,p,f,d,m,h,v=n.props||tu,y=t.props,g=t.type;if(g=="svg"?r="http://www.w3.org/2000/svg":g=="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==!!g&&(g?d.localName==g:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(g==null)return document.createTextNode(y);e=document.createElementNS(r,g,y.is&&y),s&&(Ct.__m&&Ct.__m(t,o),s=!1),o=null}if(g==null)v===y||s&&e.data==y||(e.data=y);else{if(o=g=="textarea"&&y.defaultValue!=null?null:o&&Jc.call(e.childNodes),!s&&o!=null)for(v={},u=0;u<e.attributes.length;u++)v[(d=e.attributes[u]).name]=d.value;for(u in v)d=v[u],u=="dangerouslySetInnerHTML"?p=d:u=="children"||u in y||u=="value"&&"defaultValue"in y||u=="checked"&&"defaultChecked"in y||cu(e,u,null,d,r);for(u in y)d=y[u],u=="children"?f=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?m=d:u=="checked"?h=d:s&&typeof d!="function"||v[u]===d||cu(e,u,d,v[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=""),Tb(t.type=="template"?e.content:e,iu(f)?f:[f],t,n,i,g=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&qr(n,0),s,c),o!=null)for(u=o.length;u--;)Lf(o[u]);s&&g!="textarea"||(u="value",g=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[u]||g=="progress"&&!m||g=="option"&&m!=v[u])&&cu(e,u,m,v[u],r),u="checked",h!=null&&h!=e[u]&&cu(e,u,h,v[u],r))}return e}function Bf(e,t,n){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(r){Ct.__e(r,n)}}function Nb(e,t,n){var i,r;if(Ct.unmount&&Ct.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Bf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Ct.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Nb(i[r],t,n||typeof e.type!="function");n||Lf(e.__e),e.__c=e.__=e.__e=void 0}function Y2(e,t,n){return this.constructor(e,n)}function $b(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Ct.__&&Ct.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],If(t,e=t.__k=Pb(ou,null,[e]),r||tu,tu,t.namespaceURI,r?null:t.firstChild?Jc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Ib(o,e,a),e.props.children=null}Jc=nu.slice,Ct={__e:function(e,t,n,i){for(var r,o,a;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&o.getDerivedStateFromError!=null&&(r.setState(o.getDerivedStateFromError(e)),a=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,i||{}),a=r.__d),a)return r.__E=r}catch(s){e=s}throw e}},wb=0,au.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Wi({},this.state),typeof e=="function"&&(e=e(Wi({},n),this.props)),e&&Wi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Mb(this))},au.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Mb(this))},au.prototype.render=ou,_r=[],Sb=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Rb=function(e,t){return e.__v.__b-t.__v.__b},su.__r=0,Tf=Math.random().toString(8),eu="__d"+Tf,Va="__a"+Tf,Cb=/(PointerCapture)$|Capture$/i,kf=0,Of=Db(!1),Df=Db(!0);var Fb=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,Fb(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},jb=new Map;function q2(e){var t=jb.get(this);return t||(t=new Map,jb.set(this,t)),(t=Fb(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(f){o===1&&(f||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,f,a):o===3&&(f||a)?(c.push(3,f,a),o=2):o===2&&a==="..."&&f?c.push(4,f,0):o===2&&a&&!f?c.push(5,0,!0,a):o>=5&&((a||!f&&o===5)&&(c.push(o,0,a,r),o=6),f&&(c.push(o,f,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var p=0;p<n[l].length;p++)i=n[l][p],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][p+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
|
|
11
|
+
`||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ht=q2.bind(Pb),Ho,Ht,Nf,Hb,Wa=0,zb=[],Zt=Ct,Gb=Zt.__b,Vb=Zt.__r,Wb=Zt.diffed,Ub=Zt.__c,Yb=Zt.unmount,qb=Zt.__;function uu(e,t){Zt.__h&&Zt.__h(Ht,e,Wa||t),Wa=0;var n=Ht.__H||(Ht.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function $f(e){return Wa=1,K2(Xb,e)}function K2(e,t,n){var i=uu(Ho++,2);if(i.t=e,!i.__c&&(i.__=[Xb(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 m=d.__[0];d.__=d.__N,d.__N=void 0,m!==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 lu(e,t){var n=uu(Ho++,3);!Zt.__s&&Hf(n.__H,t)&&(n.__=e,n.u=t,Ht.__H.__h.push(n))}function Ff(e,t){var n=uu(Ho++,4);!Zt.__s&&Hf(n.__H,t)&&(n.__=e,n.u=t,Ht.__h.push(n))}function pu(e){return Wa=5,Ui(function(){return{current:e}},[])}function Ui(e,t){var n=uu(Ho++,7);return Hf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Ua(e,t){return Wa=8,Ui(function(){return e},t)}function X2(){for(var e;e=zb.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(fu),t.__h.some(jf),t.__h=[]}catch(n){t.__h=[],Zt.__e(n,e.__v)}}}Zt.__b=function(e){Ht=null,Gb&&Gb(e)},Zt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),qb&&qb(e,t)},Zt.__r=function(e){Vb&&Vb(e),Ho=0;var t=(Ht=e.__c).__H;t&&(Nf===Ht?(t.__h=[],Ht.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(fu),t.__h.some(jf),t.__h=[],Ho=0)),Nf=Ht},Zt.diffed=function(e){Wb&&Wb(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(zb.push(t)!==1&&Hb===Zt.requestAnimationFrame||((Hb=Zt.requestAnimationFrame)||Z2)(X2)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Nf=Ht=null},Zt.__c=function(e,t){t.some(function(n){try{n.__h.some(fu),n.__h=n.__h.filter(function(i){return!i.__||jf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Zt.__e(i,n.__v)}}),Ub&&Ub(e,t)},Zt.unmount=function(e){Yb&&Yb(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{fu(i)}catch(r){t=r}}),n.__H=void 0,t&&Zt.__e(t,n.__v))};var Kb=typeof requestAnimationFrame=="function";function Z2(e){var t,n=function(){clearTimeout(i),Kb&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Kb&&(t=requestAnimationFrame(n))}function fu(e){var t=Ht,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ht=t}function jf(e){var t=Ht;e.__c=e.__(),Ht=t}function Hf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Xb(e,t){return typeof t=="function"?t(e):t}function Q2(e){const{navigationStack:t,setNavigationStack:n}=e,i=Ui(()=>t.length<=1?[]:t.slice(0,-1).map((a,s)=>({label:a.label,onClick:()=>n(c=>c.slice(0,s+1))})),[t,n]),r=t.length>0?()=>n([]):null,o=t.length>0?t[t.length-1].label:null;return ht`
|
|
12
12
|
<div class="djs-popup-breadcrumbs">
|
|
13
13
|
${r&&ht`
|
|
14
14
|
<button
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
</span>
|
|
42
42
|
`}
|
|
43
43
|
</div>
|
|
44
|
-
`}function
|
|
44
|
+
`}function Zb(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=Zb(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function du(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Zb(e))&&(i&&(i+=" "),i+=t);return i}function J2(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Ui(()=>ek(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return ht`
|
|
45
45
|
<div class="djs-popup-header">
|
|
46
46
|
<h3 class="djs-popup-title" title=${o}>${o}</h3>
|
|
47
47
|
${a.map(u=>ht`
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
${u.entries.map(l=>ht`
|
|
51
51
|
<li key=${l.id}>
|
|
52
52
|
<${s(l)?"button":"span"}
|
|
53
|
-
class=${
|
|
53
|
+
class=${tk(l,l===i)}
|
|
54
54
|
onClick=${p=>c(p,l)}
|
|
55
55
|
title=${l.title||l.label}
|
|
56
56
|
data-id=${l.id}
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
</ul>
|
|
71
71
|
`)}
|
|
72
72
|
</div>
|
|
73
|
-
`}function
|
|
73
|
+
`}function ek(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 tk(e,t){return du("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Qb(e,t){return`${e}-entry-${t.id}`}function nk(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 ht`
|
|
74
74
|
<li
|
|
75
75
|
class=${du("entry",{selected:i,disabled:n.disabled})}
|
|
76
76
|
data-id=${n.id}
|
|
77
|
-
id=${
|
|
77
|
+
id=${Qb(t,n)}
|
|
78
78
|
role="option"
|
|
79
79
|
aria-selected=${i||void 0}
|
|
80
80
|
aria-haspopup=${n.entries?"true":void 0}
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
</div>
|
|
132
132
|
`}
|
|
133
133
|
</li>
|
|
134
|
-
`}function
|
|
134
|
+
`}function ik(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,p=pu();Ff(()=>{if(!r||!r.current)return;const h=p.current;if(!h)return;const v=h.querySelector(".selected");v&&rk(v)},[t]);const f=()=>{r.current=!1},d=h=>{r.current||n(h)},m=()=>{r.current||n(null)};return ht`
|
|
135
135
|
<div
|
|
136
136
|
class="djs-popup-results"
|
|
137
137
|
ref=${p}
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
>
|
|
145
145
|
${i.map(h=>ht`
|
|
146
146
|
${h.name&&ht`
|
|
147
|
-
<div key=${h.id} id=${
|
|
147
|
+
<div key=${h.id} id=${Jb(o,h)} class="entry-header" title=${h.name}>
|
|
148
148
|
${h.name}
|
|
149
149
|
</div>
|
|
150
150
|
`}
|
|
@@ -152,15 +152,15 @@
|
|
|
152
152
|
class="djs-popup-group"
|
|
153
153
|
data-group=${h.id}
|
|
154
154
|
role="group"
|
|
155
|
-
aria-labelledby=${h.name?
|
|
155
|
+
aria-labelledby=${h.name?Jb(o,h):void 0}
|
|
156
156
|
>
|
|
157
|
-
${h.entries.map(
|
|
158
|
-
<${
|
|
159
|
-
key=${
|
|
157
|
+
${h.entries.map(v=>ht`
|
|
158
|
+
<${nk}
|
|
159
|
+
key=${v.id}
|
|
160
160
|
idPrefix=${o}
|
|
161
|
-
entry=${
|
|
162
|
-
selected=${
|
|
163
|
-
onMouseEnter=${()=>d(
|
|
161
|
+
entry=${v}
|
|
162
|
+
selected=${v===t}
|
|
163
|
+
onMouseEnter=${()=>d(v)}
|
|
164
164
|
onMouseLeave=${m}
|
|
165
165
|
...${l}
|
|
166
166
|
/>
|
|
@@ -168,8 +168,8 @@
|
|
|
168
168
|
</ul>
|
|
169
169
|
`)}
|
|
170
170
|
</div>
|
|
171
|
-
`}function
|
|
172
|
-
<${
|
|
171
|
+
`}function Jb(e,t){return`${e}-group-${t.id}`}function rk(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const ok=new Lo("djs-popup");function ak(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:m}=e,[h,v]=$f([]);lu(()=>{v([])},[f]);const[y,g]=$f(""),b=y.trim().length>0,x=Ui(()=>uk(f),[f]),C=Ui(()=>Yt(u)?x.length>5:!1,[u,x]),M=Ui(()=>{const W=h.length?h[h.length-1].entries:f;return C?b?p(x.filter(({searchable:Y})=>Y!==!1),y,{keys:["label","search","description"]}).map(({item:Y})=>Y):W.filter(({rank:Y=0})=>Y>=0):W},[C,b,x,y,p,h,f]),k=Ui(()=>b?M.length?[{id:"default",entries:M}]:[]:lk(M),[M,b]),[A,B]=$f(M[0]),D=pu(null),L=pu(!1),z=Ui(()=>ok.next(),[]),ie=`${z}-results`,ge=A&&Qb(z,A);lu(()=>{const W=D.current;W&&M.includes(W)?B(W):B(M[0]),D.current=null},[M]);const Ue=Ua(W=>{const Y=ck(k);let Ae=Y.indexOf(A)+W;Ae<0&&(Ae=Y.length-1),Ae>=Y.length&&(Ae=0),L.current=!0,B(Y[Ae])},[k,A]),je=Ua(W=>{W>0&&A&&A.entries&&(L.current=!0,v(Y=>[...Y,A])),W<0&&h.length>0&&(L.current=!0,D.current=h[h.length+W],v(Y=>Y.slice(0,W)))},[A,h]),K=Ua((W,Y,te)=>{if(!(!Y||Y.disabled))return Y.entries?(W.preventDefault(),je(1)):n(W,Y,te)},[n,je]),pe=Ua(W=>{if(W.key==="Enter"&&A){const Y=W.target;return!!Ir(Y,"a, button",!0)||A.disabled?void 0:K(W,A)}if(W.key==="Backspace"){const Y=W.target;if(!(El(Y,"input")&&Y.value!==""))return je(-1),W.preventDefault()}if(W.key==="ArrowUp")return Ue(-1),W.preventDefault();if(W.key==="ArrowDown")return Ue(1),W.preventDefault();if(W.key==="ArrowRight")return je(1),W.preventDefault();if(W.key==="ArrowLeft")return je(-1),W.preventDefault()},[A,Ue,je,K]),ce=Ua(W=>{El(W.target,"input")&&g(()=>W.target.value)},[g]);lu(()=>(d(),()=>{m()}),[]);const ye=!b&&h.length>0,Me=(a||r.length>0)&&!ye;return ht`
|
|
172
|
+
<${ex}
|
|
173
173
|
onClose=${t}
|
|
174
174
|
onKeyup=${ce}
|
|
175
175
|
onKeydown=${pe}
|
|
@@ -179,8 +179,8 @@
|
|
|
179
179
|
scale=${c}
|
|
180
180
|
navigationStack=${h}
|
|
181
181
|
>
|
|
182
|
-
${
|
|
183
|
-
<${
|
|
182
|
+
${Me&&ht`
|
|
183
|
+
<${J2}
|
|
184
184
|
headerEntries=${r}
|
|
185
185
|
onSelect=${n}
|
|
186
186
|
selectedEntry=${A}
|
|
@@ -189,9 +189,9 @@
|
|
|
189
189
|
/>
|
|
190
190
|
`}
|
|
191
191
|
${ye&&ht`
|
|
192
|
-
<${
|
|
192
|
+
<${Q2}
|
|
193
193
|
navigationStack=${h}
|
|
194
|
-
setNavigationStack=${
|
|
194
|
+
setNavigationStack=${v}
|
|
195
195
|
/>
|
|
196
196
|
`}
|
|
197
197
|
${f.length>0&&ht`
|
|
@@ -215,13 +215,13 @@
|
|
|
215
215
|
</div>
|
|
216
216
|
`}
|
|
217
217
|
|
|
218
|
-
${
|
|
218
|
+
${b&&ht`
|
|
219
219
|
<div class="djs-popup-search-count" aria-live="polite">
|
|
220
|
-
${
|
|
220
|
+
${M.length} ${M.length===1?"result":"results"} found
|
|
221
221
|
</div>
|
|
222
222
|
`}
|
|
223
223
|
|
|
224
|
-
<${
|
|
224
|
+
<${ik}
|
|
225
225
|
groupedEntries=${k}
|
|
226
226
|
selectedEntry=${A}
|
|
227
227
|
setSelectedEntry=${B}
|
|
@@ -254,14 +254,14 @@
|
|
|
254
254
|
`}
|
|
255
255
|
</div>
|
|
256
256
|
`}
|
|
257
|
-
${l&&
|
|
257
|
+
${l&&M.length===0&&ht`
|
|
258
258
|
<div class="djs-popup-no-results">${Jt(l)?l(y):l}</div>
|
|
259
259
|
`}
|
|
260
|
-
</${
|
|
261
|
-
`}function
|
|
260
|
+
</${ex}>
|
|
261
|
+
`}function ex(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=pu();return Ff(()=>{if(typeof s!="function")return;const u=c.current,l=s(u);u.style.left=`${l.x}px`,u.style.top=`${l.y}px`},[c.current,s]),Ff(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),lu(()=>{const u=p=>{if(p.key==="Escape")return p.preventDefault(),t()},l=p=>{if(!Ir(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)}},[]),ht`
|
|
262
262
|
<div
|
|
263
263
|
class=${du("djs-popup",r)}
|
|
264
|
-
style=${
|
|
264
|
+
style=${sk(e)}
|
|
265
265
|
onKeydown=${n}
|
|
266
266
|
onKeyup=${i}
|
|
267
267
|
ref=${c}
|
|
@@ -269,8 +269,8 @@
|
|
|
269
269
|
>
|
|
270
270
|
${o}
|
|
271
271
|
</div>
|
|
272
|
-
`}function
|
|
273
|
-
<${
|
|
272
|
+
`}function sk(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Yt(t)?n:void 0,maxWidth:Yt(t)?"unset":void 0,"transform-origin":"top left"}}function ck(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function uk(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function lk(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 pk="data-id",tx=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],fk=1e3;function Pt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Yt(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:r},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",o=>{const a=this.isOpen()&&this._current.target;o.element===a&&this.refresh()})}Pt.$inject=["config.popupMenu","eventBus","canvas","search"],Pt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=nx(n),s=Object.entries(i).map(([f,d])=>({id:f,...d})),c=e&&(f=>this._ensureVisible(f,e)),u=this._updateScale(this._current.container);$b(ht`
|
|
273
|
+
<${ak}
|
|
274
274
|
onClose=${f=>this.close(f)}
|
|
275
275
|
onSelect=${(f,d,m)=>this.trigger(f,d,m)}
|
|
276
276
|
position=${c}
|
|
@@ -284,7 +284,7 @@
|
|
|
284
284
|
searchFn=${this._search}
|
|
285
285
|
...${{...o}}
|
|
286
286
|
/>
|
|
287
|
-
`,this._current.container)},
|
|
287
|
+
`,this._current.container)},Pt.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var r=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(r===!1)return;this.isOpen()&&this.close();const{entries:o,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:o,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Pt.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:r}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:r},this._emit("refresh"),this._render()},Pt.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n),o=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:r,emptyPlaceholder:o,empty:!(Object.keys(i).length||Object.keys(r).length)}},Pt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Pt.prototype.reset=function(){const e=this._current.container;$b(null,e),vi(e)},Pt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Pt.prototype._onOpened=function(){this._emit("opened")},Pt.prototype._onClosed=function(){this._emit("closed")},Pt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=bt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Pt.prototype._bindAutoClose=function(){this._eventBus.once(tx,this.close,this)},Pt.prototype._unbindAutoClose=function(){this._eventBus.off(tx,this.close,this)},Pt.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,r=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),Yt(n)&&e<n&&(r=n),Yt(i)&&e>i&&(r=i)),r},Pt.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,a=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,a=t.y-i.height):r.x?(o=t.x-i.width,a=t.y):r.y&&t.y<i.height?(o=t.x,a=10):r.y&&(o=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:o,y:a}},Pt.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length?!0:this._getContext(e,t).empty},Pt.prototype.registerProvider=function(e,t,n){n||(n=t,t=fk),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Pt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Pt.prototype._getEntries=function(e,t){var n={};return F(t,function(i){if(!i.getPopupMenuEntries){F(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=hi(o,["id"])});return}var r=i.getPopupMenuEntries(e);Jt(r)?n=r(n):F(r,function(o,a){n[a]=o})}),n},Pt.prototype._getHeaderEntries=function(e,t){var n={};return F(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;F(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=hi(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Jt(r)?n=r(n):F(r,function(o,a){n[a]=o})}),n},Pt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Jt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Pt.prototype.isOpen=function(){return!!this._current},Pt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Ir(e.delegateTarget||e.target,".entry",!0),o=mn(r,pk);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Jt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Pt.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function nx(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=nx(r.entries,[...t,...ix(r.search)]):t.length&&(r.search=[...t,...ix(r.search)]),r})}function ix(e){return e?De(e)?e:[e]:[]}function dk(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=hk(o,r,i);return a?{item:o,tokens:a}:[]}).sort(mk(i))}function hk(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=De(s)?s.reduce((l,p)=>{const{tokens:f,matchedWords:d}=cx(p,t);return{tokens:[...l.tokens,f],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):cx(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function mk(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=gk(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=rx;continue}const s=yk(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=rx;continue}}return i}}function gk(e,t){return ox(t)-ox(e)}const rx=.5,zo={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function ox(e){const t=e.reduce((s,c)=>s+ax(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 ax(e){if(De(e))return Math.max(...e.map(ax));const t=Math.log(e.value.length);return e.match?(e.start?e.end?zo.FULL:e.wordEnd?zo.START_FULL_WORD:zo.START_WORD_PART:e.wordStart?zo.WORD_START:zo.WORD_PART)*t:zo.NO_MATCH*t}function sx(e=""){return De(e)?e.join(", "):e}function yk(e,t){return sx(e).localeCompare(sx(t))}function cx(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(vk),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,m=f===e.length,h=!!((u=s.groups)!=null&&u.all),v=d||/\s/.test(e.charAt(p-1)),y=m||/\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:v,wordEnd:y,start:d,end:m,all:h});const g=h?t:[l];for(const b of g)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 vk(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const ux={search:["value",dk]},zf={__depends__:[ux],__init__:["popupMenu"],popupMenu:["type",Pt]};var lx={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
|
|
288
288
|
<line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
|
|
289
289
|
<rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
290
290
|
<rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
@@ -312,8 +312,8 @@
|
|
|
312
312
|
<line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>
|
|
313
313
|
<rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
314
314
|
<rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
315
|
-
</svg>`},yk=900;function Go(e,t,n,i){e.registerProvider(yk,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Go.$inject=["contextPad","popupMenu","translate","canvas"],Go.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Go.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Go.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${ux.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);V(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Go.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 vk=["left","center","right","top","middle","bottom"];function Ya(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ya.$inject=["popupMenu","alignElements","translate","rules"],Ya.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Ya.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ya.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return F(vk,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:ux[o],action:function(){t.trigger(e,o),i.close()}}}),r};function hu(e){ti.call(this,e)}hu.$inject=["eventBus"],_e(hu,ti),hu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Ye(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Ns(n),n.length<2?!1:n})};const bk={__depends__:[M2,xb,zf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Go],alignElementsMenuProvider:["type",Ya],bpmnAlignElements:["type",hu]};function Yi(e,t,n,i){ee.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=Vu(ro(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=oo(s,function(p){return p.parent.id});F(l,function(p,f){De(u)&&(p=p.filter(function(d){return mt(u,ao({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)})}Yi.$inject=["eventBus","elementRegistry","modeling","rules"],_e(Yi,ee),Yi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Oe(Bt(e)),o=Oe(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),js(V({},o,a))},Yi.prototype._expand=function(e,t){typeof t=="string"&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var i=this._getOptimalBounds(e,t);if(xk(i,t)){var r=_k(ui(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Yi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Yi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Yi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function xk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function _k(e,t){var n="";return e=Oe(e),t=Oe(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function mu(e){e.invoke(Yi,this)}mu.$inject=["injector"],_e(mu,Yi),mu.prototype.resize=function(e,t,n){S(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function qa(e){ti.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}qa.$inject=["eventBus"],_e(qa,ti),qa.prototype.canResize=function(e,t){return!1};function gu(e,t){qa.call(this,e),this._modeling=t}_e(gu,qa),gu.$inject=["eventBus","modeling"],gu.prototype.canResize=function(e,t){if(S(t.di,"bpmndi:BPMNPlane")||!S(t,"bpmn:Participant")&&!S(t,"bpmn:Lane")&&!S(t,"bpmn:SubProcess"))return!1;var n=!0;return F(e,function(i){if(S(i,"bpmn:Lane")||Ge(i)){n=!1;return}}),n};const wk={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",mu],bpmnAutoResizeProvider:["type",gu]};function Vo(e,t,n){this._canvas=n,this._opts=V({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Vo.$inject=["config.autoScroll","eventBus","canvas"],Vo.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++)Ek(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 Ek(e,t,n){return t<e&&e<n}Vo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Vo.prototype.setOptions=function(e){this._opts=V({},this._opts,e)},Vo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Hr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const Sk={__depends__:[Hi],__init__:["autoScroll"],autoScroll:["type",Vo]};var lx="djs-bendpoint",px="djs-segment-dragger";function Rk(e,t){var n=Hr(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function Gf(e,t,n){var i=Rk(e,n),r=sp(t,i);return r}function Vf(e,t){var n=Me("g");Qe(n).add(lx),$e(e,n);var i=Me("circle");we(i,{cx:0,cy:0,r:4}),Qe(i).add("djs-visual"),$e(n,i);var r=Me("circle");return we(r,{cx:0,cy:0,r:10}),Qe(r).add("djs-hit"),$e(n,r),t&&Qe(n).add(t),n}function Ck(e,t,n,i){var r=Me("g");$e(e,r);var o=18,a=6,s=11,c=Ak(t,n,i),u=a+s,l=Me("rect");we(l,{x:-o/2,y:-a/2,width:o,height:a}),Qe(l).add("djs-visual"),$e(r,l);var p=Me("rect");return we(p,{x:-c/2,y:-u/2,width:c,height:u}),Qe(p).add("djs-hit"),$e(r,p),$m(r,i==="v"?90:0),r}function fx(e,t,n){var i=Me("g"),r=Bl(t,n),o=Ii(t,n);return $e(e,i),Ck(i,t,n,o),Qe(i).add(px),Qe(i).add(o==="h"?"horizontal":"vertical"),un(i,r.x,r.y),i}function Wf(e){return Math.abs(Math.round(e*2/3))}function Pk(e,t){var n=Tk(e,t);return dp(e,n)}function Ak(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Wf(n==="h"?i:r)}function Tk(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=Sg(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function dx(e,t,n,i,r){function o(v,x,C){var T=v.index,k=v.point,A,B,D,L,z,ie;return T<=0||v.bendpoint?!1:(A=x[T-1],B=x[T],D=Bl(A,B),L=Ii(A,B),z=Math.abs(k.x-D.x),ie=Math.abs(k.y-D.y),L&&z<=C&&ie<=C)}function a(v,x){var C=v.waypoints,T,k,A,B;return x.index<=0||x.bendpoint||(T={start:C[x.index-1],end:C[x.index]},k=Ii(T.start,T.end),!k)?null:(k==="h"?A=T.end.x-T.start.x:A=T.end.y-T.start.y,B=Wf(A)/2,B)}function s(v,x){var C=x.waypoints,T=Gf(t,C,v),k;if(T){k=a(x,T);var A;if(o(T,C,k)?A=r.start(v,x,T.index):A=i.start(v,x,T.index,!T.bendpoint),A!==!1)return!0}}function c(v,x,C){Ne.bind(v,x,function(T){n.triggerMouseEvent(x,T,C),T.stopPropagation()})}function u(v,x){var C=t.getLayer("overlays"),T=pt('.djs-bendpoints[data-element-id="'+za(v.id)+'"]',C);return!T&&x&&(T=Me("g"),we(T,{"data-element-id":v.id}),Qe(T).add("djs-bendpoints"),$e(C,T),c(T,"mousedown",v),c(T,"click",v),c(T,"dblclick",v)),T}function l(v,x){return pt('.djs-segment-dragger[data-segment-idx="'+v+'"]',x)}function p(v,x){x.waypoints.forEach(function(C,T){var k=Vf(v);$e(v,k),un(k,C.x,C.y)}),Vf(v,"floating")}function f(v,x){for(var C=x.waypoints,T,k,A,B=1;B<C.length;B++)T=C[B-1],k=C[B],Ii(T,k)&&(A=fx(v,T,k),we(A,{"data-segment-idx":B}),c(A,"mousemove",x))}function d(v){F(Ds("."+lx,v),function(x){Kt(x)})}function m(v){F(Ds("."+px,v),function(x){Kt(x)})}function h(v){var x=u(v);return x||(x=u(v,!0),p(x,v),f(x,v)),x}function b(v){var x=u(v);x&&(m(x),d(x),f(x,v),p(x,v))}function y(v,x){var C=pt(".floating",v),T=x.point;C&&(un(C,T.x,T.y),Qe(C).add("positioned"))}function g(v,x,C){var T=l(x.index,v),k=C[x.index-1],A=C[x.index],B=x.point,D=Bl(k,A),L=Ii(k,A),z,ie;T&&(z=Mk(T),ie={x:B.x-D.x,y:B.y-D.y},L==="v"&&(ie={x:ie.y,y:ie.x}),un(z,ie.x,ie.y))}e.on("connection.changed",function(v){b(v.element)}),e.on("connection.remove",function(v){var x=u(v.element);x&&Kt(x)}),e.on("element.marker.update",function(v){var x=v.element,C;x.waypoints&&(C=h(x),v.add?Qe(C).add(v.marker):Qe(C).remove(v.marker))}),e.on("element.mousemove",function(v){var x=v.element,C=x.waypoints,T,k;if(C){if(T=u(x,!0),k=Gf(t,C,v.originalEvent),!k)return;y(T,k),k.bendpoint||g(T,k,C)}}),e.on("element.mousedown",function(v){if(pr(v)){var x=v.originalEvent,C=v.element;if(C.waypoints)return s(x,C)}}),e.on("selection.changed",function(v){var x=v.newSelection,C=x[0];C&&C.waypoints&&h(C)}),e.on("element.hover",function(v){var x=v.element;x.waypoints&&h(x)}),e.on("element.out",function(v){var x=v.element;if(x.waypoints){var C=u(x);if(C){var T=pt(".floating",C);T&&Qe(T).remove("positioned")}}}),e.on("element.updateId",function(v){var x=v.element,C=v.newId;if(x.waypoints){var T=u(x);T&&we(T,{"data-element-id":C})}}),this.addHandles=h,this.updateHandles=b,this.getBendpointsContainer=u,this.getSegmentDragger=l}dx.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function Mk(e){return pt(".djs-visual",e)}var hx=Math.round,Kr="reconnectStart",Xr="reconnectEnd",Ka="updateWaypoints";function Uf(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,m;!u&&c===0?m=Kr:!u&&c===d.length-1?m=Xr:m=Ka;var h=m===Ka?"connection.updateWaypoints":"connection.reconnect",b=r.allowed(h,{connection:s,source:p,target:f});if(b===!1&&(b=r.allowed(h,{connection:s,source:f,target:p})),b!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:b,bendpointIndex:c,connection:s,source:p,target:f,insert:u,type:m}}})},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 m=f===Ka?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(m,{connection:c,source:f===Kr?p:u,target:f===Xr?p:l}),d){s.source=f===Kr?p:u,s.target=f===Xr?p:l;return}d===!1&&(d=s.allowed=r.allowed(m,{connection:c,source:f===Xr?p:l,target:f===Kr?p:u})),d&&(s.source=f===Xr?p:l,s.target=f===Kr?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!==Ka&&(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,m=s.target,h=s.type,b=s.hints||{},y={x:hx(a.x),y:hx(a.y)};if(!c)return!1;h===Ka?(p?f.splice(u,0,y):f[u]=y,b.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,YS(f),b)):(h===Kr?(b.docking="source",yu(s)&&(b.docking="target",b.newWaypoints=f.reverse())):h===Xr&&(b.docking="target",yu(s)&&(b.docking="source",b.newWaypoints=f.reverse())),o.reconnect(l,d,m,y,b))},this)}Uf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Uf.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function yu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Kr)return t&&i&&t===i&&n!==i;if(r===Xr)return t&&n&&t===n&&n!==i}var kk="reconnectStart",Ok="reconnectEnd",mx="updateWaypoints",Xa="connect-ok",vu="connect-not-ok",gx="connect-hover",yx="djs-updating",vx="djs-dragging",bx=1100;function xx(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=Vf(i.getLayer("overlays"));Qe(f).add("djs-dragging"),i.addMarker(c,vx),i.addMarker(c,yx)}),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,gx),u===mx)return;s?(i.removeMarker(c,vu),i.addMarker(c,Xa)):s===!1&&(i.removeMarker(c,Xa),i.addMarker(c,vu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],bx,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,gx),i.removeMarker(s,c?Xa:vu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,p=a.type,f=a.connection,d=f.source,m=f.target,h=f.waypoints.slice(),b={x:o.x,y:o.y},y=a.hints||{},g={};r&&(y.connectionStart&&(g.connectionStart=y.connectionStart),y.connectionEnd&&(g.connectionEnd=y.connectionEnd),p===kk?yu(a)?(g.connectionEnd=g.connectionEnd||b,g.source=m,g.target=l||d,h=h.reverse()):(g.connectionStart=g.connectionStart||b,g.source=l||d,g.target=m):p===Ok?yu(a)?(g.connectionStart=g.connectionStart||b,g.source=l||m,g.target=d,h=h.reverse()):(g.connectionEnd=g.connectionEnd||b,g.source=d,g.target=l||m):(g.noCropping=!0,g.noLayout=!0,h[c]=b),p===mx&&(h=e.cropWaypoints(f,h)),g.waypoints=h,r.drawPreview(a,s,g)),un(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],bx,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,Kt(c),i.removeMarker(s,yx),i.removeMarker(s,vx),u&&(i.removeMarker(u,Xa),i.removeMarker(u,l?Xa:vu)),r&&r.cleanUp(a)})}xx.$inject=["bendpointMove","injector","eventBus","canvas"];var _x="connect-hover",wx="djs-updating";function Ex(e,t,n){return Yf(e,t,e[t]+n)}function Yf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function Dk(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 Yf(t,i,s)}function Sx(e){return e==="x"?"y":"x"}function Rx(e,t,n){var i,r;return e.original?e.original:(i=Le(t),r=Sx(n),Yf(e,r,i[r]))}function Cx(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var m,h=n.getGraphics(f),b=d-1,y=d,g=f.waypoints,v=g[b],x=g[y],C=Gf(n,g,p),T,k,A;if(T=Ii(v,x),!!T)return k=T==="v"?"x":"y",b===0&&(v=Rx(v,f.source,k)),y===g.length-1&&(x=Rx(x,f.target,k)),C?A=C.point:A={x:(v.x+x.x)/2,y:(v.y+x.y)/2},m={connection:f,segmentStartIndex:b,segmentEndIndex:y,segmentStart:v,segmentEnd:x,axis:k,dragPosition:A},i.init(p,A,"connectionSegment.move",{cursor:k==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:m}})};function s(p,f){if(!a)return f;var d=p.waypoints,m;return p.waypoints=f,m=a.getCroppedWaypoints(p),p.waypoints=d,m}function c(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var m=p.newWaypoints,h=p.segmentStartIndex+f,b=m[h],y=p.segmentEndIndex+f,g=m[y],v=Sx(p.axis),x=Dk(d,b,g,v);un(p.draggerGfx,x.x,x.y)}function l(p,f){var d=0,m=p.filter(function(h,b){return Il(p[b-1],p[b+1],h)?(d=b<=f?d-1:d,!1):!0});return{waypoints:m,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,m=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=fx(m,f.segmentStart,f.segmentEnd),Qe(f.draggerGfx).add("djs-dragging"),n.addMarker(d,wx)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,m=f.segmentStartIndex,h=f.segmentEndIndex,b=f.segmentStart,y=f.segmentEnd,g=f.axis,v=f.originalWaypoints.slice(),x=Ex(b,g,p["d"+g]),C=Ex(y,g,p["d"+g]),T=v.length,k=0;v[m]=x,v[h]=C;var A,B;m<2&&(A=cn(d.source,x),m===1?A==="intersect"&&(v.shift(),v[0]=x,k--):A!=="intersect"&&(v.unshift(b),k++)),h>T-3&&(B=cn(d.target,C),h===T-2?B==="intersect"&&(v.pop(),v[v.length-1]=C):B!=="intersect"&&v.push(y)),f.newWaypoints=d.waypoints=s(d,v),u(f,k,p),f.newSegmentStartIndex=m+k,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,_x)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,_x)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&Kt(f.draggerGfx),n.removeMarker(d,wx)}),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,m=f.newWaypoints,h=f.newSegmentStartIndex;m=m.map(function(C){return{original:C.original,x:Math.round(C.x),y:Math.round(C.y)}});var b=l(m,h),y=b.waypoints,g=s(d,y),v=b.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+v}};o.updateWaypoints(d,g,x)})}Cx.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Lk=Math.abs,Px=Math.round;function Ik(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],Lk(r-e)<=n)return r}function Ax(e){return{x:e.x,y:e.y}}function Tx(e){return{x:e.x+e.width,y:e.y+e.height}}function oi(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Px(e.x+e.width/2),y:Px(e.y+e.height/2)}}function Wo(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function jt(e,t,n){if(typeof t!="string")throw new Error("axis must be in [x, y]");if(typeof n!="number"&&n!==!1)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return n===!1?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function Mx(e){return e.children||[]}var Bk=Math.abs,kx=Math.round,qf=10;function Ox(e){function t(o,a){if(De(o)){for(var s=o.length;s--;)if(Bk(o[s]-a)<=qf)return o[s]}else{o=+o;var c=a%o;if(c<qf)return a-c;if(c>o-qf)return a-c+o}return a}function n(o,a){if(o.waypoints)return Pk(a,o);if(o.width)return{x:kx(o.width/2+o.x),y:kx(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,m=a.axis;if(s)return s;var h=[u[p-1],l,f,u[d+1]];return p<2&&h.unshift(n(c.source,o)),d>u.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},F(h,function(b){b&&(b=b.original||b,m==="y"&&s.horizontal.push(b.y),m==="x"&&s.vertical.push(b.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;V(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&jt(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&jt(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},F(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);!ft(s)||!c||!c.x||!c.y||(jt(o,"x",c.x),jt(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,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 m=l-f,h=p-d;V(o,{dx:o.dx-m,dy:o.dy-h,x:o.x-m,y:o.y-h}),(m||s.vertical.indexOf(l)!==-1)&&jt(o,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&jt(o,"y",d)}})}Ox.$inject=["eventBus"];const Nk={__depends__:[Hi,Si],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",dx],bendpointMove:["type",Uf],bendpointMovePreview:["type",xx],connectionSegmentMove:["type",Cx],bendpointSnapping:["type",Ox]};function Dx(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),!io(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!io(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,m={connectionStart:Kf(s)?l:u,connectionEnd:Kf(s)?u:l};Qt(c)&&(d=c),s.connection=n.connect(p,f,d,m)}),this.start=function(a,s,c,u){Qt(c)||(u=c,c=Le(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}Dx.$inject=["eventBus","dragging","modeling","rules"];function Kf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var $k=1100,Fk=900,Lx="connect-ok",Ix="connect-not-ok";function Bx(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},m=f,h=d;Kf(o)&&(m=d,h=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:m,connectionEnd:h})}),t.on("connect.hover",Fk,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?Lx:Ix)}),t.on(["connect.out","connect.cleanup"],$k,function(r){var o=r.hover;o&&(n.removeMarker(o,Lx),n.removeMarker(o,Ix))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Bx.$inject=["injector","eventBus","canvas"];const Xf={__depends__:[ni,Si,Hi],__init__:["connectPreview"],connect:["type",Dx],connectPreview:["type",Bx]};var jk="djs-dragger";function qi(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}qi.$inject=["injector","canvas","graphicsFactory","elementFactory"],qi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,p=n.noCropping,f=n.noNoop,d,m=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ls(i),r||(r=e.getConnection=Hk(function(h,b,y){return m.getConnection(h,b,y)})),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?Le(o):c,a?Le(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)"})},qi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Le(n),o=t.connectionEnd||Le(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);$e(e,s)},qi.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&la(o,s,!0)||e,t=i&&la(a,s,!1)||t,[e,t]},qi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Kt(e.connectionPreviewGfx)},qi.prototype.getConnection=function(e){var t=zk(e);return this._elementFactory.createConnection(t)},qi.prototype.createConnectionPreviewGfx=function(){var e=Me("g");return we(e,{pointerEvents:"none"}),Qe(e).add(jk),$e(this._canvas.getActiveLayer(),e),e},qi.prototype.createNoopConnection=function(e,t){return aa([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function Hk(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 zk(e){return Qt(e)?e:{}}const Gk={__init__:["connectionPreview"],connectionPreview:["type",qi]},bu="complex-preview";class Nx{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(bu);n.filter(s=>!Vk(s)).forEach(s=>{let c;ft(s)?(c=this._graphicsFactory._createContainer("connection",Me("g")),this._graphicsFactory.drawConnection($r(c),s)):(c=this._graphicsFactory._createContainer("shape",Me("g")),this._graphicsFactory.drawShape($r(c),s),un(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);ft(s)?un(u,c.x,c.y):un(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",Me("g"));this._graphicsFactory.drawShape($r(u),s,{width:c.width,height:c.height}),un(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Ls(this._canvas.getLayer(bu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(bu)}hide(){this._canvas.hideLayer(bu)}}Nx.$inject=["canvas","graphicsFactory","previewSupport"];function Vk(e){return e.hidden}const Wk={__depends__:[Io],__init__:["complexPreview"],complexPreview:["type",Nx]},$x=Math.round;function xu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}xu.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(V({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;V(u,{x:l.x-$x(u.width/2),y:l.y-$x(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=>!io(d))})},xu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},xu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const Uk={__depends__:[Yc,Wk,wf],__init__:["appendPreview"],appendPreview:["type",xu]};var Fx=Math.min,jx=Math.max;function Zf(e){e.preventDefault()}function Za(e){e.stopPropagation()}function Yk(e){return e.nodeType===Node.TEXT_NODE}function qk(e){return[].slice.call(e)}function fi(e){this.container=e.container,this.parent=bt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=pt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Sn(this.autoResize,this),this.handlePaste=Sn(this.handlePaste,this)}fi.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=ui(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);V(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=ui(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return V(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&V(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Ne.bind(a,"keydown",this.keyHandler),Ne.bind(a,"mousedown",Za),Ne.bind(a,"paste",r.handlePaste),Ne.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ne.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},fi.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var r=this.autoResize(n);r&&this.resizeHandler(r)}},fi.prototype.insertText=function(e){e=Kk(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},fi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=qk(a.childNodes),c,u;if(Yk(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(m,h){h===f?m.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>f&&h<=d&&vi(m)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},fi.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},fi.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=bt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(m){Zf(m),Za(m),s=m.clientX,c=m.clientY;var h=t.getBoundingClientRect();u=h.width,l=h.height,Ne.bind(document,"mousemove",f),Ne.bind(document,"mouseup",d)},f=function(m){Zf(m),Za(m);var h=Fx(jx(u+m.clientX-s,i),o),b=Fx(jx(l+m.clientY-c,r),a);t.style.width=h+"px",t.style.height=b+"px",e.resizeHandler({width:u,height:l,dx:m.clientX-s,dy:m.clientY-c})},d=function(m){Zf(m),Za(m),Ne.unbind(document,"mousemove",f,!1),Ne.unbind(document,"mouseup",d,!1)};Ne.bind(n,"mousedown",p)}V(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},fi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ne.unbind(t,"keydown",this.keyHandler),Ne.unbind(t,"mousedown",Za),Ne.unbind(t,"input",this.autoResize),Ne.unbind(t,"paste",this.handlePaste),Ne.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),vi(n)),vi(e)},fi.prototype.getValue=function(){return this.content.innerText.trim()},fi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},fi.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function Kk(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
-
`)}function Fn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new fi({container:t.getContainer(),keyHandler:Sn(this._handleKey,this),resizeHandler:Sn(this._handleResize,this),focusoutHandler:Sn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Fn.$inject=["eventBus","canvas"],Fn.prototype.registerProvider=function(e){this._providers.push(e)},Fn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Fn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Fn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Fn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Fn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Fn.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()}},Fn.prototype.getValue=function(){return this._textbox.getValue()},Fn.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()},Fn.prototype._handleResize=function(e){this._fire("resize",e)},Fn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Fn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=mt(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 Hx={__depends__:[Ec],__init__:["directEditing"],directEditing:["type",Fn]};function Xk(e){return function(t){var n=t.target,i=ne(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===Xe(e);return!o||!a||!s||!c}}const Zk={task:{label:"Task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},"user-task":{label:"User task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},"service-task":{label:"Service task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},"send-task":{label:"Send task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},"receive-task":{label:"Receive task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},"manual-task":{label:"Manual task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},"rule-task":{label:"Business rule task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},"script-task":{label:"Script task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},"call-activity":{label:"Call activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},transaction:{label:"Transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},"event-subprocess":{label:"Event sub-process",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},"collapsed-subprocess":{label:"Sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},"expanded-subprocess":{label:"Sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},"collapsed-ad-hoc-subprocess":{label:"Ad-hoc sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},"expanded-ad-hoc-subprocess":{label:"Ad-hoc sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},"exclusive-gateway":{label:"Exclusive gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},"parallel-gateway":{label:"Parallel gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},"inclusive-gateway":{label:"Inclusive gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},"complex-gateway":{label:"Complex gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},"event-based-gateway":{label:"Event-based gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}},"data-store-reference":{label:"Data store reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}},"data-object-reference":{label:"Data object reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}},"expanded-pool":{label:"Expanded pool/participant",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},"collapsed-pool":{label:"Empty pool/participant",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}},"none-start-event":{label:"Start event",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},"none-intermediate-throwing":{label:"Intermediate throw event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},"none-boundary-event":{label:"Boundary event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:BoundaryEvent"}},"none-end-event":{label:"End event",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},"message-start":{label:"Message start event",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},"timer-start":{label:"Timer start event",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},"conditional-start":{label:"Conditional start event",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},"signal-start":{label:"Signal start event",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},"error-start":{label:"Error start event",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},"escalation-start":{label:"Escalation start event",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},"compensation-start":{label:"Compensation start event",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},"non-interrupting-message-start":{label:"Message start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},"non-interrupting-timer-start":{label:"Timer start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},"non-interrupting-conditional-start":{label:"Conditional start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},"non-interrupting-signal-start":{label:"Signal start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},"non-interrupting-escalation-start":{label:"Escalation start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}},"message-intermediate-catch":{label:"Message intermediate catch event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"message-intermediate-throw":{label:"Message intermediate throw event",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"timer-intermediate-catch":{label:"Timer intermediate catch event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},"escalation-intermediate-throw":{label:"Escalation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"conditional-intermediate-catch":{label:"Conditional intermediate catch event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},"link-intermediate-catch":{label:"Link intermediate catch event",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"link-intermediate-throw":{label:"Link intermediate throw event",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"compensation-intermediate-throw":{label:"Compensation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-intermediate-catch":{label:"Signal intermediate catch event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"signal-intermediate-throw":{label:"Signal intermediate throw event",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"message-boundary":{label:"Message boundary event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},"timer-boundary":{label:"Timer boundary event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},"escalation-boundary":{label:"Escalation boundary event",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},"conditional-boundary":{label:"Conditional boundary event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},"error-boundary":{label:"Error boundary event",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},"cancel-boundary":{label:"Cancel boundary event",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},"signal-boundary":{label:"Signal boundary event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},"compensation-boundary":{label:"Compensation boundary event",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},"non-interrupting-message-boundary":{label:"Message boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},"non-interrupting-timer-boundary":{label:"Timer boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},"non-interrupting-escalation-boundary":{label:"Escalation boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},"non-interrupting-conditional-boundary":{label:"Conditional boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},"non-interrupting-signal-boundary":{label:"Signal boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}},"message-end":{label:"Message end event",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"escalation-end":{label:"Escalation end event",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"error-end":{label:"Error end event",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},"cancel-end":{label:"Cancel end event",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},"compensation-end":{label:"Compensation end event",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-end":{label:"Signal end event",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"terminate-end":{label:"Terminate end event",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}};function J(e,t={}){var n=Zk[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var Qk=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing"),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-start"),J("timer-start"),J("conditional-start"),J("signal-start")],Jk=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing"),J("none-end-event",{actionName:"replace-with-none-end"})],eO=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-intermediate-catch"),J("message-intermediate-throw"),J("timer-intermediate-catch"),J("escalation-intermediate-throw"),J("conditional-intermediate-catch"),J("link-intermediate-catch"),J("link-intermediate-throw"),J("compensation-intermediate-throw"),J("signal-intermediate-catch"),J("signal-intermediate-throw")],tO=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-end"),J("escalation-end"),J("error-end"),J("cancel-end"),J("compensation-end"),J("signal-end"),J("terminate-end")],nO=[J("exclusive-gateway"),J("parallel-gateway"),J("inclusive-gateway"),J("complex-gateway"),J("event-based-gateway")],iO=[J("transaction"),J("event-subprocess"),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),J("collapsed-subprocess")],rO=[J("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),J("transaction"),J("event-subprocess"),J("collapsed-ad-hoc-subprocess")],zx=[J("transaction"),J("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),J("event-subprocess")],oO=zx,Gx=[J("task"),J("user-task"),J("service-task"),J("send-task"),J("receive-task"),J("manual-task"),J("rule-task"),J("script-task"),J("call-activity"),J("collapsed-subprocess"),J("expanded-subprocess"),J("collapsed-ad-hoc-subprocess"),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],aO=[J("data-store-reference")],sO=[J("data-object-reference")],cO=[J("message-boundary"),J("timer-boundary"),J("escalation-boundary"),J("conditional-boundary"),J("error-boundary"),J("cancel-boundary"),J("signal-boundary"),J("compensation-boundary"),J("non-interrupting-message-boundary"),J("non-interrupting-timer-boundary"),J("non-interrupting-escalation-boundary"),J("non-interrupting-conditional-boundary"),J("non-interrupting-signal-boundary")],uO=[J("message-start"),J("timer-start"),J("conditional-start"),J("signal-start"),J("error-start"),J("escalation-start"),J("compensation-start"),J("non-interrupting-message-start"),J("non-interrupting-timer-start"),J("non-interrupting-conditional-start"),J("non-interrupting-signal-start"),J("non-interrupting-escalation-start")],lO=[{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"}],pO=[J("expanded-pool"),J("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],fO={"bpmn:MessageEventDefinition":[J("message-start"),J("message-intermediate-catch"),J("message-intermediate-throw"),J("message-end")],"bpmn:TimerEventDefinition":[J("timer-start"),J("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[J("conditional-start"),J("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[J("signal-start"),J("signal-intermediate-catch"),J("signal-intermediate-throw"),J("signal-end")],"bpmn:ErrorEventDefinition":[J("error-start"),J("error-end")],"bpmn:EscalationEventDefinition":[J("escalation-start"),J("escalation-intermediate-throw"),J("escalation-end")],"bpmn:CompensateEventDefinition":[J("compensation-start"),J("compensation-intermediate-throw"),J("compensation-end")]};const Vx={"start-event-non-interrupting":`
|
|
315
|
+
</svg>`},bk=900;function Go(e,t,n,i){e.registerProvider(bk,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Go.$inject=["contextPad","popupMenu","translate","canvas"],Go.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Go.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Go.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${lx.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);V(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Go.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 xk=["left","center","right","top","middle","bottom"];function Ya(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ya.$inject=["popupMenu","alignElements","translate","rules"],Ya.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Ya.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ya.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return F(xk,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:lx[o],action:function(){t.trigger(e,o),i.close()}}}),r};function hu(e){ti.call(this,e)}hu.$inject=["eventBus"],_e(hu,ti),hu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Ye(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Ns(n),n.length<2?!1:n})};const _k={__depends__:[O2,_b,zf],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Go],alignElementsMenuProvider:["type",Ya],bpmnAlignElements:["type",hu]};function Yi(e,t,n,i){ee.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=Vu(ro(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=oo(s,function(p){return p.parent.id});F(l,function(p,f){De(u)&&(p=p.filter(function(d){return mt(u,ao({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)})}Yi.$inject=["eventBus","elementRegistry","modeling","rules"],_e(Yi,ee),Yi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Oe($t(e)),o=Oe(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),js(V({},o,a))},Yi.prototype._expand=function(e,t){typeof t=="string"&&(t=this._elementRegistry.get(t));var n=this._rules.allowed("element.autoResize",{elements:e,target:t});if(n){var i=this._getOptimalBounds(e,t);if(wk(i,t)){var r=Ek(ui(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Yi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Yi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Yi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function wk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function Ek(e,t){var n="";return e=Oe(e),t=Oe(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function mu(e){e.invoke(Yi,this)}mu.$inject=["injector"],_e(mu,Yi),mu.prototype.resize=function(e,t,n){S(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function qa(e){ti.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}qa.$inject=["eventBus"],_e(qa,ti),qa.prototype.canResize=function(e,t){return!1};function gu(e,t){qa.call(this,e),this._modeling=t}_e(gu,qa),gu.$inject=["eventBus","modeling"],gu.prototype.canResize=function(e,t){if(S(t.di,"bpmndi:BPMNPlane")||!S(t,"bpmn:Participant")&&!S(t,"bpmn:Lane")&&!S(t,"bpmn:SubProcess"))return!1;var n=!0;return F(e,function(i){if(S(i,"bpmn:Lane")||Ge(i)){n=!1;return}}),n};const Sk={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",mu],bpmnAutoResizeProvider:["type",gu]};function Vo(e,t,n){this._canvas=n,this._opts=V({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Vo.$inject=["config.autoScroll","eventBus","canvas"],Vo.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++)Rk(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 Rk(e,t,n){return t<e&&e<n}Vo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Vo.prototype.setOptions=function(e){this._opts=V({},this._opts,e)},Vo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Hr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const Ck={__depends__:[Hi],__init__:["autoScroll"],autoScroll:["type",Vo]};var px="djs-bendpoint",fx="djs-segment-dragger";function Pk(e,t){var n=Hr(t),i=e._container.getBoundingClientRect(),r;r={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(n.x-r.x)/o.scale,y:o.y+(n.y-r.y)/o.scale}}function Gf(e,t,n){var i=Pk(e,n),r=sp(t,i);return r}function Vf(e,t){var n=Te("g");Qe(n).add(px),$e(e,n);var i=Te("circle");we(i,{cx:0,cy:0,r:4}),Qe(i).add("djs-visual"),$e(n,i);var r=Te("circle");return we(r,{cx:0,cy:0,r:10}),Qe(r).add("djs-hit"),$e(n,r),t&&Qe(n).add(t),n}function Ak(e,t,n,i){var r=Te("g");$e(e,r);var o=18,a=6,s=11,c=Tk(t,n,i),u=a+s,l=Te("rect");we(l,{x:-o/2,y:-a/2,width:o,height:a}),Qe(l).add("djs-visual"),$e(r,l);var p=Te("rect");return we(p,{x:-c/2,y:-u/2,width:c,height:u}),Qe(p).add("djs-hit"),$e(r,p),Fm(r,i==="v"?90:0),r}function dx(e,t,n){var i=Te("g"),r=Bl(t,n),o=Ii(t,n);return $e(e,i),Ak(i,t,n,o),Qe(i).add(fx),Qe(i).add(o==="h"?"horizontal":"vertical"),un(i,r.x,r.y),i}function Wf(e){return Math.abs(Math.round(e*2/3))}function Mk(e,t){var n=kk(e,t);return dp(e,n)}function Tk(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Wf(n==="h"?i:r)}function kk(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=Rg(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function hx(e,t,n,i,r){function o(b,x,C){var M=b.index,k=b.point,A,B,D,L,z,ie;return M<=0||b.bendpoint?!1:(A=x[M-1],B=x[M],D=Bl(A,B),L=Ii(A,B),z=Math.abs(k.x-D.x),ie=Math.abs(k.y-D.y),L&&z<=C&&ie<=C)}function a(b,x){var C=b.waypoints,M,k,A,B;return x.index<=0||x.bendpoint||(M={start:C[x.index-1],end:C[x.index]},k=Ii(M.start,M.end),!k)?null:(k==="h"?A=M.end.x-M.start.x:A=M.end.y-M.start.y,B=Wf(A)/2,B)}function s(b,x){var C=x.waypoints,M=Gf(t,C,b),k;if(M){k=a(x,M);var A;if(o(M,C,k)?A=r.start(b,x,M.index):A=i.start(b,x,M.index,!M.bendpoint),A!==!1)return!0}}function c(b,x,C){Ne.bind(b,x,function(M){n.triggerMouseEvent(x,M,C),M.stopPropagation()})}function u(b,x){var C=t.getLayer("overlays"),M=pt('.djs-bendpoints[data-element-id="'+za(b.id)+'"]',C);return!M&&x&&(M=Te("g"),we(M,{"data-element-id":b.id}),Qe(M).add("djs-bendpoints"),$e(C,M),c(M,"mousedown",b),c(M,"click",b),c(M,"dblclick",b)),M}function l(b,x){return pt('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function p(b,x){x.waypoints.forEach(function(C,M){var k=Vf(b);$e(b,k),un(k,C.x,C.y)}),Vf(b,"floating")}function f(b,x){for(var C=x.waypoints,M,k,A,B=1;B<C.length;B++)M=C[B-1],k=C[B],Ii(M,k)&&(A=dx(b,M,k),we(A,{"data-segment-idx":B}),c(A,"mousemove",x))}function d(b){F(Ds("."+px,b),function(x){Kt(x)})}function m(b){F(Ds("."+fx,b),function(x){Kt(x)})}function h(b){var x=u(b);return x||(x=u(b,!0),p(x,b),f(x,b)),x}function v(b){var x=u(b);x&&(m(x),d(x),f(x,b),p(x,b))}function y(b,x){var C=pt(".floating",b),M=x.point;C&&(un(C,M.x,M.y),Qe(C).add("positioned"))}function g(b,x,C){var M=l(x.index,b),k=C[x.index-1],A=C[x.index],B=x.point,D=Bl(k,A),L=Ii(k,A),z,ie;M&&(z=Ok(M),ie={x:B.x-D.x,y:B.y-D.y},L==="v"&&(ie={x:ie.y,y:ie.x}),un(z,ie.x,ie.y))}e.on("connection.changed",function(b){v(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&Kt(x)}),e.on("element.marker.update",function(b){var x=b.element,C;x.waypoints&&(C=h(x),b.add?Qe(C).add(b.marker):Qe(C).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,C=x.waypoints,M,k;if(C){if(M=u(x,!0),k=Gf(t,C,b.originalEvent),!k)return;y(M,k),k.bendpoint||g(M,k,C)}}),e.on("element.mousedown",function(b){if(pr(b)){var x=b.originalEvent,C=b.element;if(C.waypoints)return s(x,C)}}),e.on("selection.changed",function(b){var x=b.newSelection,C=x[0];C&&C.waypoints&&h(C)}),e.on("element.hover",function(b){var x=b.element;x.waypoints&&h(x)}),e.on("element.out",function(b){var x=b.element;if(x.waypoints){var C=u(x);if(C){var M=pt(".floating",C);M&&Qe(M).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,C=b.newId;if(x.waypoints){var M=u(x);M&&we(M,{"data-element-id":C})}}),this.addHandles=h,this.updateHandles=v,this.getBendpointsContainer=u,this.getSegmentDragger=l}hx.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function Ok(e){return pt(".djs-visual",e)}var mx=Math.round,Kr="reconnectStart",Xr="reconnectEnd",Ka="updateWaypoints";function Uf(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,m;!u&&c===0?m=Kr:!u&&c===d.length-1?m=Xr:m=Ka;var h=m===Ka?"connection.updateWaypoints":"connection.reconnect",v=r.allowed(h,{connection:s,source:p,target:f});if(v===!1&&(v=r.allowed(h,{connection:s,source:f,target:p})),v!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:v,bendpointIndex:c,connection:s,source:p,target:f,insert:u,type:m}}})},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 m=f===Ka?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(m,{connection:c,source:f===Kr?p:u,target:f===Xr?p:l}),d){s.source=f===Kr?p:u,s.target=f===Xr?p:l;return}d===!1&&(d=s.allowed=r.allowed(m,{connection:c,source:f===Xr?p:l,target:f===Kr?p:u})),d&&(s.source=f===Xr?p:l,s.target=f===Kr?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!==Ka&&(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,m=s.target,h=s.type,v=s.hints||{},y={x:mx(a.x),y:mx(a.y)};if(!c)return!1;h===Ka?(p?f.splice(u,0,y):f[u]=y,v.bendpointMove={insert:p,bendpointIndex:u},f=this.cropWaypoints(l,f),o.updateWaypoints(l,KS(f),v)):(h===Kr?(v.docking="source",yu(s)&&(v.docking="target",v.newWaypoints=f.reverse())):h===Xr&&(v.docking="target",yu(s)&&(v.docking="source",v.newWaypoints=f.reverse())),o.reconnect(l,d,m,y,v))},this)}Uf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Uf.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function yu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Kr)return t&&i&&t===i&&n!==i;if(r===Xr)return t&&n&&t===n&&n!==i}var Dk="reconnectStart",Lk="reconnectEnd",gx="updateWaypoints",Xa="connect-ok",vu="connect-not-ok",yx="connect-hover",vx="djs-updating",bx="djs-dragging",xx=1100;function _x(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=Vf(i.getLayer("overlays"));Qe(f).add("djs-dragging"),i.addMarker(c,bx),i.addMarker(c,vx)}),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,yx),u===gx)return;s?(i.removeMarker(c,vu),i.addMarker(c,Xa)):s===!1&&(i.removeMarker(c,Xa),i.addMarker(c,vu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],xx,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,yx),i.removeMarker(s,c?Xa:vu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,p=a.type,f=a.connection,d=f.source,m=f.target,h=f.waypoints.slice(),v={x:o.x,y:o.y},y=a.hints||{},g={};r&&(y.connectionStart&&(g.connectionStart=y.connectionStart),y.connectionEnd&&(g.connectionEnd=y.connectionEnd),p===Dk?yu(a)?(g.connectionEnd=g.connectionEnd||v,g.source=m,g.target=l||d,h=h.reverse()):(g.connectionStart=g.connectionStart||v,g.source=l||d,g.target=m):p===Lk?yu(a)?(g.connectionStart=g.connectionStart||v,g.source=l||m,g.target=d,h=h.reverse()):(g.connectionEnd=g.connectionEnd||v,g.source=d,g.target=l||m):(g.noCropping=!0,g.noLayout=!0,h[c]=v),p===gx&&(h=e.cropWaypoints(f,h)),g.waypoints=h,r.drawPreview(a,s,g)),un(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],xx,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,p=a.waypoints;s.waypoints=p,Kt(c),i.removeMarker(s,vx),i.removeMarker(s,bx),u&&(i.removeMarker(u,Xa),i.removeMarker(u,l?Xa:vu)),r&&r.cleanUp(a)})}_x.$inject=["bendpointMove","injector","eventBus","canvas"];var wx="connect-hover",Ex="djs-updating";function Sx(e,t,n){return Yf(e,t,e[t]+n)}function Yf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function Ik(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 Yf(t,i,s)}function Rx(e){return e==="x"?"y":"x"}function Cx(e,t,n){var i,r;return e.original?e.original:(i=Le(t),r=Rx(n),Yf(e,r,i[r]))}function Px(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(p,f,d){var m,h=n.getGraphics(f),v=d-1,y=d,g=f.waypoints,b=g[v],x=g[y],C=Gf(n,g,p),M,k,A;if(M=Ii(b,x),!!M)return k=M==="v"?"x":"y",v===0&&(b=Cx(b,f.source,k)),y===g.length-1&&(x=Cx(x,f.target,k)),C?A=C.point:A={x:(b.x+x.x)/2,y:(b.y+x.y)/2},m={connection:f,segmentStartIndex:v,segmentEndIndex:y,segmentStart:b,segmentEnd:x,axis:k,dragPosition:A},i.init(p,A,"connectionSegment.move",{cursor:k==="x"?"resize-ew":"resize-ns",data:{connection:f,connectionGfx:h,context:m}})};function s(p,f){if(!a)return f;var d=p.waypoints,m;return p.waypoints=f,m=a.getCroppedWaypoints(p),p.waypoints=d,m}function c(p){r.update("connection",p.connection,p.connectionGfx)}function u(p,f,d){var m=p.newWaypoints,h=p.segmentStartIndex+f,v=m[h],y=p.segmentEndIndex+f,g=m[y],b=Rx(p.axis),x=Ik(d,v,g,b);un(p.draggerGfx,x.x,x.y)}function l(p,f){var d=0,m=p.filter(function(h,v){return Il(p[v-1],p[v+1],h)?(d=v<=f?d-1:d,!1):!0});return{waypoints:m,segmentOffset:d}}t.on("connectionSegment.move.start",function(p){var f=p.context,d=p.connection,m=n.getLayer("overlays");f.originalWaypoints=d.waypoints.slice(),f.draggerGfx=dx(m,f.segmentStart,f.segmentEnd),Qe(f.draggerGfx).add("djs-dragging"),n.addMarker(d,Ex)}),t.on("connectionSegment.move.move",function(p){var f=p.context,d=f.connection,m=f.segmentStartIndex,h=f.segmentEndIndex,v=f.segmentStart,y=f.segmentEnd,g=f.axis,b=f.originalWaypoints.slice(),x=Sx(v,g,p["d"+g]),C=Sx(y,g,p["d"+g]),M=b.length,k=0;b[m]=x,b[h]=C;var A,B;m<2&&(A=cn(d.source,x),m===1?A==="intersect"&&(b.shift(),b[0]=x,k--):A!=="intersect"&&(b.unshift(v),k++)),h>M-3&&(B=cn(d.target,C),h===M-2?B==="intersect"&&(b.pop(),b[b.length-1]=C):B!=="intersect"&&b.push(y)),f.newWaypoints=d.waypoints=s(d,b),u(f,k,p),f.newSegmentStartIndex=m+k,c(p)}),t.on("connectionSegment.move.hover",function(p){p.context.hover=p.hover,n.addMarker(p.hover,wx)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(p){var f=p.context.hover;f&&n.removeMarker(f,wx)}),t.on("connectionSegment.move.cleanup",function(p){var f=p.context,d=f.connection;f.draggerGfx&&Kt(f.draggerGfx),n.removeMarker(d,Ex)}),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,m=f.newWaypoints,h=f.newSegmentStartIndex;m=m.map(function(C){return{original:C.original,x:Math.round(C.x),y:Math.round(C.y)}});var v=l(m,h),y=v.waypoints,g=s(d,y),b=v.segmentOffset,x={segmentMove:{segmentStartIndex:f.segmentStartIndex,newSegmentStartIndex:h+b}};o.updateWaypoints(d,g,x)})}Px.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Bk=Math.abs,Ax=Math.round;function Nk(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],Bk(r-e)<=n)return r}function Mx(e){return{x:e.x,y:e.y}}function Tx(e){return{x:e.x+e.width,y:e.y+e.height}}function oi(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Ax(e.x+e.width/2),y:Ax(e.y+e.height/2)}}function Wo(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function zt(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 kx(e){return e.children||[]}var $k=Math.abs,Ox=Math.round,qf=10;function Dx(e){function t(o,a){if(De(o)){for(var s=o.length;s--;)if($k(o[s]-a)<=qf)return o[s]}else{o=+o;var c=a%o;if(c<qf)return a-c;if(c>o-qf)return a-c+o}return a}function n(o,a){if(o.waypoints)return Mk(a,o);if(o.width)return{x:Ox(o.width/2+o.x),y:Ox(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,m=a.axis;if(s)return s;var h=[u[p-1],l,f,u[d+1]];return p<2&&h.unshift(n(c.source,o)),d>u.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},F(h,function(v){v&&(v=v.original||v,m==="y"&&s.horizontal.push(v.y),m==="x"&&s.vertical.push(v.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;V(o,{dx:o.dx-p,dy:o.dy-f,x:u,y:l}),(p||a.vertical.indexOf(s)!==-1)&&zt(o,"x",u),(f||a.horizontal.indexOf(c)!==-1)&&zt(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:[]},F(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);!ft(s)||!c||!c.x||!c.y||(zt(o,"x",c.x),zt(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 m=l-f,h=p-d;V(o,{dx:o.dx-m,dy:o.dy-h,x:o.x-m,y:o.y-h}),(m||s.vertical.indexOf(l)!==-1)&&zt(o,"x",f),(h||s.horizontal.indexOf(p)!==-1)&&zt(o,"y",d)}})}Dx.$inject=["eventBus"];const Fk={__depends__:[Hi,Si],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",hx],bendpointMove:["type",Uf],bendpointMovePreview:["type",_x],connectionSegmentMove:["type",Px],bendpointSnapping:["type",Dx]};function Lx(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),!io(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!io(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,m={connectionStart:Kf(s)?l:u,connectionEnd:Kf(s)?u:l};Qt(c)&&(d=c),s.connection=n.connect(p,f,d,m)}),this.start=function(a,s,c,u){Qt(c)||(u=c,c=Le(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}Lx.$inject=["eventBus","dragging","modeling","rules"];function Kf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var jk=1100,Hk=900,Ix="connect-ok",Bx="connect-not-ok";function Nx(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},m=f,h=d;Kf(o)&&(m=d,h=f),i.drawPreview(o,a,{source:c||u,target:p||s,connectionStart:m,connectionEnd:h})}),t.on("connect.hover",Hk,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?Ix:Bx)}),t.on(["connect.out","connect.cleanup"],jk,function(r){var o=r.hover;o&&(n.removeMarker(o,Ix),n.removeMarker(o,Bx))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Nx.$inject=["injector","eventBus","canvas"];const Xf={__depends__:[ni,Si,Hi],__init__:["connectPreview"],connect:["type",Lx],connectPreview:["type",Nx]};var zk="djs-dragger";function qi(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}qi.$inject=["injector","canvas","graphicsFactory","elementFactory"],qi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,p=n.noCropping,f=n.noNoop,d,m=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ls(i),r||(r=e.getConnection=Gk(function(h,v,y){return m.getConnection(h,v,y)})),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?Le(o):c,a?Le(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)"})},qi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Le(n),o=t.connectionEnd||Le(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);$e(e,s)},qi.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return e=n&&la(o,s,!0)||e,t=i&&la(a,s,!1)||t,[e,t]},qi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Kt(e.connectionPreviewGfx)},qi.prototype.getConnection=function(e){var t=Vk(e);return this._elementFactory.createConnection(t)},qi.prototype.createConnectionPreviewGfx=function(){var e=Te("g");return we(e,{pointerEvents:"none"}),Qe(e).add(zk),$e(this._canvas.getActiveLayer(),e),e},qi.prototype.createNoopConnection=function(e,t){return aa([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function Gk(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 Vk(e){return Qt(e)?e:{}}const Wk={__init__:["connectionPreview"],connectionPreview:["type",qi]},bu="complex-preview";class $x{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(bu);n.filter(s=>!Uk(s)).forEach(s=>{let c;ft(s)?(c=this._graphicsFactory._createContainer("connection",Te("g")),this._graphicsFactory.drawConnection($r(c),s)):(c=this._graphicsFactory._createContainer("shape",Te("g")),this._graphicsFactory.drawShape($r(c),s),un(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);ft(s)?un(u,c.x,c.y):un(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",Te("g"));this._graphicsFactory.drawShape($r(u),s,{width:c.width,height:c.height}),un(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Ls(this._canvas.getLayer(bu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(bu)}hide(){this._canvas.hideLayer(bu)}}$x.$inject=["canvas","graphicsFactory","previewSupport"];function Uk(e){return e.hidden}const Yk={__depends__:[Io],__init__:["complexPreview"],complexPreview:["type",$x]},Fx=Math.round;function xu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}xu.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(V({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;V(u,{x:l.x-Fx(u.width/2),y:l.y-Fx(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=>!io(d))})},xu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},xu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const qk={__depends__:[Yc,Yk,wf],__init__:["appendPreview"],appendPreview:["type",xu]};var jx=Math.min,Hx=Math.max;function Zf(e){e.preventDefault()}function Za(e){e.stopPropagation()}function Kk(e){return e.nodeType===Node.TEXT_NODE}function Xk(e){return[].slice.call(e)}function fi(e){this.container=e.container,this.parent=bt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=pt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Sn(this.autoResize,this),this.handlePaste=Sn(this.handlePaste,this)}fi.prototype.create=function(e,t,n,i){var r=this,o=this.parent,a=this.content,s=this.container;i=this.options=i||{},t=this.style=t||{};var c=ui(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);V(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=ui(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return V(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&V(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,Ne.bind(a,"keydown",this.keyHandler),Ne.bind(a,"mousedown",Za),Ne.bind(a,"paste",r.handlePaste),Ne.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ne.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},fi.prototype.handlePaste=function(e){var t=this.options,n=this.style;e.preventDefault();var i;if(e.clipboardData?i=e.clipboardData.getData("text/plain"):i=window.clipboardData.getData("Text"),this.insertText(i),t.autoResize){var r=this.autoResize(n);r&&this.resizeHandler(r)}},fi.prototype.insertText=function(e){e=Zk(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},fi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=Xk(a.childNodes),c,u;if(Kk(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(m,h){h===f?m.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>f&&h<=d&&vi(m)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},fi.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},fi.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=bt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,p=function(m){Zf(m),Za(m),s=m.clientX,c=m.clientY;var h=t.getBoundingClientRect();u=h.width,l=h.height,Ne.bind(document,"mousemove",f),Ne.bind(document,"mouseup",d)},f=function(m){Zf(m),Za(m);var h=jx(Hx(u+m.clientX-s,i),o),v=jx(Hx(l+m.clientY-c,r),a);t.style.width=h+"px",t.style.height=v+"px",e.resizeHandler({width:u,height:l,dx:m.clientX-s,dy:m.clientY-c})},d=function(m){Zf(m),Za(m),Ne.unbind(document,"mousemove",f,!1),Ne.unbind(document,"mouseup",d,!1)};Ne.bind(n,"mousedown",p)}V(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},fi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ne.unbind(t,"keydown",this.keyHandler),Ne.unbind(t,"mousedown",Za),Ne.unbind(t,"input",this.autoResize),Ne.unbind(t,"paste",this.handlePaste),Ne.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),vi(n)),vi(e)},fi.prototype.getValue=function(){return this.content.innerText.trim()},fi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},fi.prototype.setSelection=function(e,t){var n=document.createRange();e===null?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)};function Zk(e){return e.replace(/\r\n|\r|\n/g,`
|
|
316
|
+
`)}function Fn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new fi({container:t.getContainer(),keyHandler:Sn(this._handleKey,this),resizeHandler:Sn(this._handleResize,this),focusoutHandler:Sn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Fn.$inject=["eventBus","canvas"],Fn.prototype.registerProvider=function(e){this._providers.push(e)},Fn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Fn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Fn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Fn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Fn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Fn.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()}},Fn.prototype.getValue=function(){return this._textbox.getValue()},Fn.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()},Fn.prototype._handleResize=function(e){this._fire("resize",e)},Fn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Fn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=mt(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 zx={__depends__:[Ec],__init__:["directEditing"],directEditing:["type",Fn]};function Qk(e){return function(t){var n=t.target,i=ne(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=!!n.triggeredByEvent==!!i.triggeredByEvent,c=n.isExpanded===void 0||n.isExpanded===Xe(e);return!o||!a||!s||!c}}const Jk={task:{label:"Task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},"user-task":{label:"User task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},"service-task":{label:"Service task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},"send-task":{label:"Send task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},"receive-task":{label:"Receive task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},"manual-task":{label:"Manual task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},"rule-task":{label:"Business rule task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},"script-task":{label:"Script task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},"call-activity":{label:"Call activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},transaction:{label:"Transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},"event-subprocess":{label:"Event sub-process",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},"collapsed-subprocess":{label:"Sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},"expanded-subprocess":{label:"Sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},"collapsed-ad-hoc-subprocess":{label:"Ad-hoc sub-process (collapsed)",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},"expanded-ad-hoc-subprocess":{label:"Ad-hoc sub-process (expanded)",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},"exclusive-gateway":{label:"Exclusive gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},"parallel-gateway":{label:"Parallel gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},"inclusive-gateway":{label:"Inclusive gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},"complex-gateway":{label:"Complex gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},"event-based-gateway":{label:"Event-based gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}},"data-store-reference":{label:"Data store reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}},"data-object-reference":{label:"Data object reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}},"expanded-pool":{label:"Expanded pool/participant",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},"collapsed-pool":{label:"Empty pool/participant",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}},"none-start-event":{label:"Start event",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},"none-intermediate-throwing":{label:"Intermediate throw event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},"none-boundary-event":{label:"Boundary event",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:BoundaryEvent"}},"none-end-event":{label:"End event",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},"message-start":{label:"Message start event",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},"timer-start":{label:"Timer start event",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},"conditional-start":{label:"Conditional start event",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},"signal-start":{label:"Signal start event",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},"error-start":{label:"Error start event",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},"escalation-start":{label:"Escalation start event",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},"compensation-start":{label:"Compensation start event",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},"non-interrupting-message-start":{label:"Message start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},"non-interrupting-timer-start":{label:"Timer start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},"non-interrupting-conditional-start":{label:"Conditional start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},"non-interrupting-signal-start":{label:"Signal start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},"non-interrupting-escalation-start":{label:"Escalation start event (non-interrupting)",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}},"message-intermediate-catch":{label:"Message intermediate catch event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"message-intermediate-throw":{label:"Message intermediate throw event",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"timer-intermediate-catch":{label:"Timer intermediate catch event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},"escalation-intermediate-throw":{label:"Escalation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"conditional-intermediate-catch":{label:"Conditional intermediate catch event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},"link-intermediate-catch":{label:"Link intermediate catch event",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"link-intermediate-throw":{label:"Link intermediate throw event",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition",eventDefinitionAttrs:{name:""}}},"compensation-intermediate-throw":{label:"Compensation intermediate throw event",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-intermediate-catch":{label:"Signal intermediate catch event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"signal-intermediate-throw":{label:"Signal intermediate throw event",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"message-boundary":{label:"Message boundary event",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},"timer-boundary":{label:"Timer boundary event",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},"escalation-boundary":{label:"Escalation boundary event",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},"conditional-boundary":{label:"Conditional boundary event",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},"error-boundary":{label:"Error boundary event",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},"cancel-boundary":{label:"Cancel boundary event",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},"signal-boundary":{label:"Signal boundary event",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},"compensation-boundary":{label:"Compensation boundary event",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},"non-interrupting-message-boundary":{label:"Message boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},"non-interrupting-timer-boundary":{label:"Timer boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},"non-interrupting-escalation-boundary":{label:"Escalation boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},"non-interrupting-conditional-boundary":{label:"Conditional boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},"non-interrupting-signal-boundary":{label:"Signal boundary event (non-interrupting)",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}},"message-end":{label:"Message end event",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},"escalation-end":{label:"Escalation end event",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},"error-end":{label:"Error end event",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},"cancel-end":{label:"Cancel end event",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},"compensation-end":{label:"Compensation end event",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},"signal-end":{label:"Signal end event",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},"terminate-end":{label:"Terminate end event",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}};function J(e,t={}){var n=Jk[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var eO=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing"),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-start"),J("timer-start"),J("conditional-start"),J("signal-start")],tO=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing"),J("none-end-event",{actionName:"replace-with-none-end"})],nO=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-intermediate-catch"),J("message-intermediate-throw"),J("timer-intermediate-catch"),J("escalation-intermediate-throw"),J("conditional-intermediate-catch"),J("link-intermediate-catch"),J("link-intermediate-throw"),J("compensation-intermediate-throw"),J("signal-intermediate-catch"),J("signal-intermediate-throw")],iO=[J("none-start-event",{actionName:"replace-with-none-start"}),J("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),J("none-end-event",{actionName:"replace-with-none-end"}),J("message-end"),J("escalation-end"),J("error-end"),J("cancel-end"),J("compensation-end"),J("signal-end"),J("terminate-end")],rO=[J("exclusive-gateway"),J("parallel-gateway"),J("inclusive-gateway"),J("complex-gateway"),J("event-based-gateway")],oO=[J("transaction"),J("event-subprocess"),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),J("collapsed-subprocess")],aO=[J("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),J("transaction"),J("event-subprocess"),J("collapsed-ad-hoc-subprocess")],Gx=[J("transaction"),J("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),J("event-subprocess")],sO=Gx,Vx=[J("task"),J("user-task"),J("service-task"),J("send-task"),J("receive-task"),J("manual-task"),J("rule-task"),J("script-task"),J("call-activity"),J("collapsed-subprocess"),J("expanded-subprocess"),J("collapsed-ad-hoc-subprocess"),J("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],cO=[J("data-store-reference")],uO=[J("data-object-reference")],lO=[J("message-boundary"),J("timer-boundary"),J("escalation-boundary"),J("conditional-boundary"),J("error-boundary"),J("cancel-boundary"),J("signal-boundary"),J("compensation-boundary"),J("non-interrupting-message-boundary"),J("non-interrupting-timer-boundary"),J("non-interrupting-escalation-boundary"),J("non-interrupting-conditional-boundary"),J("non-interrupting-signal-boundary")],pO=[J("message-start"),J("timer-start"),J("conditional-start"),J("signal-start"),J("error-start"),J("escalation-start"),J("compensation-start"),J("non-interrupting-message-start"),J("non-interrupting-timer-start"),J("non-interrupting-conditional-start"),J("non-interrupting-signal-start"),J("non-interrupting-escalation-start")],fO=[{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"}],dO=[J("expanded-pool"),J("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],hO={"bpmn:MessageEventDefinition":[J("message-start"),J("message-intermediate-catch"),J("message-intermediate-throw"),J("message-end")],"bpmn:TimerEventDefinition":[J("timer-start"),J("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[J("conditional-start"),J("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[J("signal-start"),J("signal-intermediate-catch"),J("signal-intermediate-throw"),J("signal-end")],"bpmn:ErrorEventDefinition":[J("error-start"),J("error-end")],"bpmn:EscalationEventDefinition":[J("escalation-start"),J("escalation-intermediate-throw"),J("escalation-end")],"bpmn:CompensateEventDefinition":[J("compensation-start"),J("compensation-intermediate-throw"),J("compensation-end")]};const Wx={"start-event-non-interrupting":`
|
|
317
317
|
<svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">
|
|
318
318
|
<g transform="translate(0 995.64)">
|
|
319
319
|
<path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>
|
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
<circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>
|
|
325
325
|
<circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>
|
|
326
326
|
</g>
|
|
327
|
-
</svg>`};function ai(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()}ai.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],ai.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},ai.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(De(e)||!n.allowed("shape.replace",{element:e}))return{};var a=Xk(e);return S(t,"bpmn:DataObjectReference")?this._createEntries(e,aO):S(t,"bpmn:DataStoreReference")&&!S(e.parent,"bpmn:Collaboration")?this._createEntries(e,sO):(S(t,"bpmn:Event")&&!S(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=fO[r]||[],!yn(t.$parent)&&S(t.$parent,"bpmn:SubProcess")&&(i=Ye(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),S(t,"bpmn:StartEvent")&&!S(t.$parent,"bpmn:SubProcess")?(o=Ye(Qk.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Participant")?(o=Ye(pO,function(c){return Xe(e)!==c.target.isExpanded}),this._createEntries(e,o)):S(t,"bpmn:StartEvent")&&yn(t.$parent)?(o=Ye(uO.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)):S(t,"bpmn:StartEvent")&&!yn(t.$parent)&&S(t.$parent,"bpmn:SubProcess")?(o=Ye(Jk.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:EndEvent")?(o=Ye(tO.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!S(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):S(t,"bpmn:BoundaryEvent")?(o=Ye(cO,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!S(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)):S(t,"bpmn:IntermediateCatchEvent")||S(t,"bpmn:IntermediateThrowEvent")?(o=Ye(eO.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Gateway")?(o=Ye(nO,a),this._createEntries(e,o)):S(t,"bpmn:Transaction")?(o=Ye(zx,a),this._createEntries(e,o)):yn(t)&&Xe(e)?(o=Ye(oO,a),this._createEntries(e,o)):S(t,"bpmn:AdHocSubProcess")&&Xe(e)?(o=Ye(rO,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&Xe(e)?(o=Ye(iO,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&!Xe(e)?(o=Ye(Gx,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):S(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,lO):S(t,"bpmn:FlowNode")?(o=Ye(Gx,a),this._createEntries(e,o)):{})},ai.prototype.getPopupMenuHeaderEntries=function(e){var t={};return S(e,"bpmn:Activity")&&!yn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),S(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),S(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Fg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},ai.prototype._createEntries=function(e,t){var n={},i=this;return F(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},ai.prototype._createSequenceFlowEntries=function(e,t){var n=ne(e),i={},r=this._modeling,o=this._moddle,a=this;return F(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(S(n.sourceRef,"bpmn:ExclusiveGateway")||S(n.sourceRef,"bpmn:InclusiveGateway")||S(n.sourceRef,"bpmn:ComplexGateway")||S(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&&S(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:S(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(S(n.sourceRef,"bpmn:ExclusiveGateway")||S(n.sourceRef,"bpmn:InclusiveGateway")||S(n.sourceRef,"bpmn:ComplexGateway")||S(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},ai.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}},ai.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&&S(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=ne(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"}}}},ai.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}}},ai.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}}},ai.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ne(e),i=this,r=jg(e),o=S(e,"bpmn:BoundaryEvent")?Vx["intermediate-event-non-interrupting"]:Vx["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 dO={__depends__:[zf,av,Yc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",ai]};function Qa(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 m=d.context,h=m.shape;if(!(!Ea(d)||!i.isOpen(h))){var b=i.getEntries(h);b.replace&&b.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}Qa.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Qa.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&V(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Qa.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return De(t)?kr(e,n=>t.includes(n)):t},Qa.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&V(l,m()),l;var p=e.businessObject;function f(v,x){r.start(v,x)}function d(v,x){n.removeElements([x])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(v){var x=5,C=t.getPad(v).html,T=C.getBoundingClientRect(),k={x:T.left,y:T.bottom+x};return k}function b(v,x,C,T){function k(D,L){var z=i.createShape(V({type:v},T));o.start(D,z,{source:L})}var A=s?function(D,L){var z=i.createShape(V({type:v},T));s.append(L,z)}:k,B=s?function(D,L){return u.create(L,v,T),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:C,action:{dragstart:k,click:A,hover:B}}}function y(v){return function(x,C){n.splitLane(C,v),t.open(C,!0)}}if(We(p,["bpmn:Lane","bpmn:Participant"])&&Xe(e)){var g=ur(e);V(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(v,x){n.addLane(x,"top")}}}}),g.length<2&&((tn(e)?e.height>=120:e.width>=120)&&V(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:y(2)}}}),(tn(e)?e.height>=180:e.width>=180)&&V(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:y(3)}}})),V(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(v,x){n.addLane(x,"bottom")}}}})}return S(p,"bpmn:FlowNode")&&(S(p,"bpmn:EventBasedGateway")?V(l,{"append.receive-task":b("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":b("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":b("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":b("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":b("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Wx(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?V(l,{"append.compensation-activity":b("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!S(p,"bpmn:EndEvent")&&!p.isForCompensation&&!Wx(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!yn(p)&&V(l,{"append.end-event":b("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":b("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":b("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":b("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||V(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(v,x){var C=V(h(x),{cursor:{x:v.x,y:v.y}});a.open(x,"bpmn-replace",C,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),S(p,"bpmn:SequenceFlow")&&V(l,{"append.text-annotation":b("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),S(p,"bpmn:MessageFlow")&&V(l,{"append.text-annotation":b("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),We(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(l,{"append.text-annotation":b("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}}}),S(p,"bpmn:TextAnnotation")&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),We(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),S(p,"bpmn:Group")&&V(l,{"append.text-annotation":b("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&V(l,m()),l};function Wx(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return F(o,function(a){a.$type===n&&(r=!0)}),i&&r}const hO={__depends__:[Uk,Hx,xb,ni,Xf,Rc,dO],__init__:["contextPadProvider"],contextPadProvider:["type",Qa]};var mO={horizontal:["x","width"],vertical:["y","height"]},Ux=5;function Ki(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return De(i)?i:i?n:[]})}Ki.$inject=["modeling","rules"],Ki.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Ki.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Ki.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(F(t,function(o){r=o(r,n,i)}),r):e},Ki.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=di(e,i);return F(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Ki.prototype._setOrientation=function(e){var t=mO[e];this._axis=t[0],this._dimension=t[1]},Ki.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Ki.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+Ux,max:t+n-Ux}};const gO={__init__:["distributeElements"],distributeElements:["type",Ki]};function _u(e){ti.call(this,e)}_u.$inject=["eventBus"],_e(_u,ti),_u.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ye(t,function(n){var i=We(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Ns(t),t.length<3?!1:t})};var Yx={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
327
|
+
</svg>`};function ai(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()}ai.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],ai.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},ai.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(De(e)||!n.allowed("shape.replace",{element:e}))return{};var a=Qk(e);return S(t,"bpmn:DataObjectReference")?this._createEntries(e,cO):S(t,"bpmn:DataStoreReference")&&!S(e.parent,"bpmn:Collaboration")?this._createEntries(e,uO):(S(t,"bpmn:Event")&&!S(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=hO[r]||[],!yn(t.$parent)&&S(t.$parent,"bpmn:SubProcess")&&(i=Ye(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),S(t,"bpmn:StartEvent")&&!S(t.$parent,"bpmn:SubProcess")?(o=Ye(eO.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Participant")?(o=Ye(dO,function(c){return Xe(e)!==c.target.isExpanded}),this._createEntries(e,o)):S(t,"bpmn:StartEvent")&&yn(t.$parent)?(o=Ye(pO.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)):S(t,"bpmn:StartEvent")&&!yn(t.$parent)&&S(t.$parent,"bpmn:SubProcess")?(o=Ye(tO.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:EndEvent")?(o=Ye(iO.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!S(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):S(t,"bpmn:BoundaryEvent")?(o=Ye(lO,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!S(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)):S(t,"bpmn:IntermediateCatchEvent")||S(t,"bpmn:IntermediateThrowEvent")?(o=Ye(nO.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Gateway")?(o=Ye(rO,a),this._createEntries(e,o)):S(t,"bpmn:Transaction")?(o=Ye(Gx,a),this._createEntries(e,o)):yn(t)&&Xe(e)?(o=Ye(sO,a),this._createEntries(e,o)):S(t,"bpmn:AdHocSubProcess")&&Xe(e)?(o=Ye(aO,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&Xe(e)?(o=Ye(oO,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&!Xe(e)?(o=Ye(Vx,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):S(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,fO):S(t,"bpmn:FlowNode")?(o=Ye(Vx,a),this._createEntries(e,o)):{})},ai.prototype.getPopupMenuHeaderEntries=function(e){var t={};return S(e,"bpmn:Activity")&&!yn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),S(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),S(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),jg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},ai.prototype._createEntries=function(e,t){var n={},i=this;return F(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},ai.prototype._createSequenceFlowEntries=function(e,t){var n=ne(e),i={},r=this._modeling,o=this._moddle,a=this;return F(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(S(n.sourceRef,"bpmn:ExclusiveGateway")||S(n.sourceRef,"bpmn:InclusiveGateway")||S(n.sourceRef,"bpmn:ComplexGateway")||S(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&&S(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:S(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(S(n.sourceRef,"bpmn:ExclusiveGateway")||S(n.sourceRef,"bpmn:InclusiveGateway")||S(n.sourceRef,"bpmn:ComplexGateway")||S(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},ai.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}},ai.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&&S(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=ne(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"}}}},ai.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}}},ai.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}}},ai.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ne(e),i=this,r=Hg(e),o=S(e,"bpmn:BoundaryEvent")?Wx["intermediate-event-non-interrupting"]:Wx["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 mO={__depends__:[zf,sv,Yc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",ai]};function Qa(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 m=d.context,h=m.shape;if(!(!Ea(d)||!i.isOpen(h))){var v=i.getEntries(h);v.replace&&v.replace.action.click(d,h)}}),n.on("contextPad.close",function(){f.cleanUp()})}Qa.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Qa.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&V(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Qa.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return De(t)?kr(e,n=>t.includes(n)):t},Qa.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&V(l,m()),l;var p=e.businessObject;function f(b,x){r.start(b,x)}function d(b,x){n.removeElements([x])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(b){var x=5,C=t.getPad(b).html,M=C.getBoundingClientRect(),k={x:M.left,y:M.bottom+x};return k}function v(b,x,C,M){function k(D,L){var z=i.createShape(V({type:b},M));o.start(D,z,{source:L})}var A=s?function(D,L){var z=i.createShape(V({type:b},M));s.append(L,z)}:k,B=s?function(D,L){return u.create(L,b,M),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:C,action:{dragstart:k,click:A,hover:B}}}function y(b){return function(x,C){n.splitLane(C,b),t.open(C,!0)}}if(We(p,["bpmn:Lane","bpmn:Participant"])&&Xe(e)){var g=ur(e);V(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(b,x){n.addLane(x,"top")}}}}),g.length<2&&((tn(e)?e.height>=120:e.width>=120)&&V(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:y(2)}}}),(tn(e)?e.height>=180:e.width>=180)&&V(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:y(3)}}})),V(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(b,x){n.addLane(x,"bottom")}}}})}return S(p,"bpmn:FlowNode")&&(S(p,"bpmn:EventBasedGateway")?V(l,{"append.receive-task":v("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":v("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Ux(p,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?V(l,{"append.compensation-activity":v("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!S(p,"bpmn:EndEvent")&&!p.isForCompensation&&!Ux(p,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!yn(p)&&V(l,{"append.end-event":v("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":v("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":v("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":v("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||V(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var C=V(h(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",C,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),S(p,"bpmn:SequenceFlow")&&V(l,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),S(p,"bpmn:MessageFlow")&&V(l,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),We(p,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(l,{"append.text-annotation":v("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}}}),S(p,"bpmn:TextAnnotation")&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:f,dragstart:f}}}),We(p,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:f,dragstart:f}}}),S(p,"bpmn:Group")&&V(l,{"append.text-annotation":v("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&V(l,m()),l};function Ux(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return F(o,function(a){a.$type===n&&(r=!0)}),i&&r}const gO={__depends__:[qk,zx,_b,ni,Xf,Rc,mO],__init__:["contextPadProvider"],contextPadProvider:["type",Qa]};var yO={horizontal:["x","width"],vertical:["y","height"]},Yx=5;function Ki(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return De(i)?i:i?n:[]})}Ki.$inject=["modeling","rules"],Ki.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Ki.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Ki.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(F(t,function(o){r=o(r,n,i)}),r):e},Ki.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=di(e,i);return F(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Ki.prototype._setOrientation=function(e){var t=yO[e];this._axis=t[0],this._dimension=t[1]},Ki.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Ki.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+Yx,max:t+n-Yx}};const vO={__init__:["distributeElements"],distributeElements:["type",Ki]};function _u(e){ti.call(this,e)}_u.$inject=["eventBus"],_e(_u,ti),_u.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ye(t,function(n){var i=We(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Ns(t),t.length<3?!1:t})};var qx={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
|
|
328
328
|
<polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
|
|
329
329
|
<rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
330
330
|
<rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
@@ -332,7 +332,7 @@
|
|
|
332
332
|
<polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>
|
|
333
333
|
<rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>
|
|
334
334
|
<rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>
|
|
335
|
-
</svg>`},yO=900;function Ja(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",yO,this)}Ja.$inject=["popupMenu","distributeElements","translate","rules"],Ja.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Ja.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ja.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:Yx.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Yx.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const vO={__depends__:[zf,gO],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",_u],distributeElementsMenuProvider:["type",Ja]};var qx="is not a registered action",bO="is already registered";function si(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}si.$inject=["eventBus","injector"],si.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=De(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&&(De(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)})},si.prototype.trigger=function(e,t){if(!this._actions[e])throw Qf(e,qx);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},si.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);F(e,function(i,r){n._registerAction(r,i)})},si.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Qf(e,bO);this._actions[e]=t},si.prototype.unregister=function(e){if(!this.isRegistered(e))throw Qf(e,qx);this._actions[e]=void 0},si.prototype.getActions=function(){return Object.keys(this._actions)},si.prototype.isRegistered=function(e){return!!this._actions[e]};function Qf(e,t){return new Error(e+" "+t)}const xO={__init__:["editorActions"],editorActions:["type",si]};function wu(e){e.invoke(si,this)}_e(wu,si),wu.$inject=["injector"],wu.prototype._registerDefaultActions=function(e){si.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 m=t.getRootElement(),h=n.filter(function(b){return b!==m});return i.select(h),h}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(m){var h=i.get(),b=m.type;h.length&&c.trigger(h,b)}),i&&u&&this._registerAction("alignElements",function(m){var h=i.get(),b=[],y=m.type;h.length&&(b=Ye(h,function(g){return!S(g,"bpmn:Lane")}),u.trigger(b,y))}),i&&f&&this._registerAction("setColor",function(m){var h=i.get();h.length&&f.setColor(h,m)}),i&&l&&this._registerAction("directEditing",function(){var m=i.get();m.length&&l.activate(m[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),h,b;S(m,"bpmn:Collaboration")?b=n.filter(function(y){return S(y.parent,"bpmn:Collaboration")}):b=n.filter(function(y){return y!==m&&!S(y.parent,"bpmn:SubProcess")}),h=Bt(b),f.moveElements(b,{x:-h.x,y:-h.y},m)}),i&&d&&this._registerAction("replaceElement",function(m){d.triggerEntry("replace","click",m)})};const _O={__depends__:[xO],editorActions:["type",wu]};function Kx(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;We(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}Kx.$inject=["eventBus"];function Zr(e,t){ee.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;An(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Zr.$inject=["eventBus","gridSnapping","modeling"],_e(Zr,ee),Zr.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},Zr.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},Zr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),V(e,o),e},Zr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),V(e,o),e};var wO=2e3;function Xx(e,t){e.on(["spaceTool.move","spaceTool.end"],wO,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)}})}Xx.$inject=["eventBus","gridSnapping"];const EO={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Zr],gridSnappingSpaceToolBehavior:["type",Xx]};var Eu=10;function Jf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var SO=1200,RO=800;function wr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",RO,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"],SO,function(o){var a=o.originalEvent;if(!(!r.active||a&&In(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=PO(o,u,e);p&&(l.offset=p);var f=CO(o,u);f&&V(l,f),Wo(o,u)||r.snapEvent(o,u,l)})}})}wr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);jt(e,t,i)},wr.prototype.getGridSpacing=function(){return Eu},wr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Jf(e,Eu);var i,r;return t&&t.min&&(i=t.min,Be(i)&&(i=Jf(i+n,Eu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Be(r)&&(r=Jf(r+n,Eu,"floor"),e=Math.min(e,r))),e-=n,e},wr.prototype.isActive=function(){return this.active},wr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},wr.prototype.toggleActive=function(){this.setActive(!this.active)},wr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function CO(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(Su(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,u=r.max;return c&&(Su(t)?Qx(s)?a.x.max=c.left:a.x.min=c.right:Zx(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(Su(t)?Qx(s)?a.x.min=u.left:a.x.max=u.right:Zx(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function PO(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Be(s[t])||(s||(s=o.snapOffset={}),Be(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Su(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function Su(e){return e==="x"}function Zx(e){return e.indexOf("n")!==-1}function Qx(e){return e.indexOf("w")!==-1}const AO={__depends__:[EO],__init__:["gridSnapping"],gridSnapping:["type",wr]};var TO=2e3;function Jx(e,t,n){e.on("autoPlace",TO,function(i){var r=i.source,o=Le(r),a=i.shape,s=Qv(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],S(a,"bpmn:TextAnnotation")&&(MO(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}Jx.$inject=["eventBus","gridSnapping","elementRegistry"];function MO(e){return e==="x"}var kO=1750;function e_(e,t,n){t.on(["create.start","shape.move.start"],kO,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!S(o,"bpmn:Participant")||!S(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}))}})}e_.$inject=["canvas","eventBus","gridSnapping"];var OO=3e3;function Ru(e,t,n){ee.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],OO,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||DO(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Ru.$inject=["eventBus","gridSnapping","modeling"],_e(Ru,ee),Ru.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=BO(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function DO(e){return e.length>3}function LO(e){return e==="h"}function IO(e){return e==="v"}function BO(e,t,n){var i=Ii(t,n),r={};return LO(i)&&(r.y=e.snapValue(t.y)),IO(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=V({},t,r),n=V({},n,r)),[t,n]}const NO={__depends__:[AO,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Jx],gridSnappingParticipantBehavior:["type",e_],gridSnappingLayoutConnectionBehavior:["type",Ru]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Kx]};var $O=30,t_=30;function es(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(S(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(S(r,"bpmn:Participant"))return Xe(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(S(r,"bpmn:SubProcess"))return Xe(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}es.$inject=["eventBus","interactionEvents"],es.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},es.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=tn(e)?{width:$O,height:e.height}:{width:e.width,height:t_};return this._interactionEvents.createBoxHit(t,"all",n),!0},es.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:t_}),!0};const FO={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",es]};function Cu(e){e.invoke($o,this)}_e(Cu,$o),Cu.$inject=["injector"],Cu.prototype.registerBindings=function(e,t){$o.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 jO={__depends__:[Pf],__init__:["keyboardBindings"],keyboardBindings:["type",Cu]};var HO={moveSpeed:1,moveSpeedAccelerated:10},zO=1500,n_="left",i_="up",r_="right",o_="down",GO={ArrowLeft:n_,Left:n_,ArrowUp:i_,Up:i_,ArrowRight:r_,Right:r_,ArrowDown:o_,Down:o_},VO={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 a_(e,t,n,i,r){var o=this;this._config=V({},HO,e||{}),t.addListener(zO,function(a){var s=a.keyEvent,c=GO[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=VO[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}a_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const WO={__depends__:[Pf,ni],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",a_]};var s_=10;function ts(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=HC(l,p,u),c.newBounds=GC(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:Oe(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=Sm(p),!UO(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)})}ts.prototype.canResize=function(e){var t=this._rules,n=ui(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},ts.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=V({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,c_(t,o),"resize",{autoActivate:!0,cursor:YO(o),data:{shape:t,context:r}})},ts.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:s_,height:s_},r=pg(t,e.childrenBoxPadding),VC(n,t,i,r)},ts.$inject=["eventBus","rules","modeling","dragging"];function UO(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function c_(e,t){var n=Le(e),i=Oe(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 YO(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 u_="djs-resizing",l_="resize-not-ok",qO=500;function p_(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,u_)),s.width>5&&we(c,{x:s.x,width:s.width}),s.height>5&&we(c,{y:s.y,height:s.height}),o.canExecute?Qe(c).remove(l_):Qe(c).add(l_)}function r(o){var a=o.shape,s=o.frame;s&&Kt(o.frame),t.removeMarker(a,u_)}e.on("resize.move",qO,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}p_.$inject=["eventBus","canvas","previewSupport"];var Pu=-6,Au=8,Tu=20,ns="djs-resizer",KO=["n","w","s","e","nw","ne","se","sw"];function Er(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&F(a,Sn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}Er.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){pr(o)&&i.activate(o,e,n)}Ne.bind(t,"mousedown",r),Ne.bind(t,"touchstart",r)},Er.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=XO(i),a=Me("g");Qe(a).add(ns),Qe(a).add(ns+"-"+e.id),Qe(a).add(ns+"-"+i),$e(r,a);var s=Me("rect");we(s,{x:-Au/2+o.x,y:-Au/2+o.y,width:Au,height:Au}),Qe(s).add(ns+"-visual"),$e(a,s);var c=Me("rect");return we(c,{x:-Tu/2+o.x,y:-Tu/2+o.y,width:Tu,height:Tu}),Qe(c).add(ns+"-hit"),$e(a,c),Gs(a,t,n),a},Er.prototype.createResizer=function(e,t){var n=c_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Er.prototype.addResizer=function(e){var t=this;ft(e)||F(KO,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Er.prototype.removeResizers=function(){var e=this._getResizersParent();Ls(e)},Er.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Er.$inject=["eventBus","canvas","selection","resize"];function XO(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Pu:e.indexOf("w")!==-1&&(t.x=Pu),e.indexOf("s")!==-1?t.y=-Pu:e.indexOf("n")!==-1&&(t.y=Pu),t}const f_={__depends__:[Si,Hi,Io],__init__:["resize","resizePreview","resizeHandles"],resize:["type",ts],resizePreview:["type",p_],resizeHandles:["type",Er]};var ZO=2e3;function is(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],ZO,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||We(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}is.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],is.prototype.activate=function(e){var t=qn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);V(n,i);var r={},o=n.style||{};return V(o,{backgroundColor:null,border:null}),(We(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||d_(e))&&V(r,{centerVertically:!0}),sr(e)&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),S(e,"bpmn:TextAnnotation")&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),V(n,{options:r,style:o}),n}},is.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(S(e,"bpmn:Lane")||eD(e)){var m=tn(e),h=m?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};V(o,h),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(JO(e)){var b=tn(e),y=b?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};V(o,y),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:b?null:"rotate(-90deg)"})}(We(e,["bpmn:Task","bpmn:CallActivity"])||d_(e))&&(V(o,{width:i.width,height:i.height}),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),QO(e)&&(V(o,{width:i.width,x:i.x}),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var g=1,v=i.width+2*g;if(n.labelTarget&&(V(o,{width:v,height:i.height+2*g,x:i.x-g,y:i.y-g}),V(d,{fontSize:u+"px",lineHeight:l})),sr(n)&&!Us(n)&&!Ge(n)){var x=jl(e),C=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),T=u,k=Fr.width*a+2*g;V(o,{width:k,height:T+2*g,x:C.x-k/2,y:C.y-T/2-g}),V(d,{fontSize:u+"px",lineHeight:l})}return S(e,"bpmn:TextAnnotation")&&(V(o,{width:i.width+2*g,height:i.height+2*g,x:i.x-g,y:i.y-g,minWidth:30*a,minHeight:10*a}),V(d,{textAlign:"left",paddingTop:wo*a+"px",paddingBottom:wo*a+"px",paddingLeft:wo*a+"px",paddingRight:wo*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},is.prototype.update=function(e,t,n,i){var r,o;S(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}),tD(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function d_(e){return S(e,"bpmn:SubProcess")&&!Xe(e)}function QO(e){return S(e,"bpmn:SubProcess")&&Xe(e)}function JO(e){return S(e,"bpmn:Participant")&&!Xe(e)}function eD(e){return S(e,"bpmn:Participant")&&Xe(e)}function tD(e){return!e||!e.trim()}var h_="djs-element-hidden",m_="djs-label-hidden";function g_(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,S(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Me("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=Me("path");we(p,{d:l,strokeWidth:2,stroke:nD(o)}),$e(s,p),$e(r,s),un(s,o.x,o.y)}S(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,h_):(S(o,"bpmn:Task")||S(o,"bpmn:CallActivity")||S(o,"bpmn:SubProcess")||S(o,"bpmn:Participant")||S(o,"bpmn:Lane"))&&t.addMarker(o,m_)}),e.on("directEditing.resize",function(c){if(S(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}});we(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,h_),t.removeMarker(o,m_)),o=void 0,a=void 0,s&&(Kt(s),s=void 0)})}g_.$inject=["eventBus","canvas","pathMap"];function nD(e,t){var n=tt(e);return n.get("stroke")||t||"black"}const iD={__depends__:[of,f_,Hx],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",is],labelEditingPreview:["type",g_]};var rD=500,oD=1e3;function Pi(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){GS(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){F(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],rD,function(o){var a=o.element,s=o.gfx,c=pt(".djs-outline",s);c&&i.updateOutline(a,c)})}Pi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=pt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),$e(t,n),this.updateOutline(e,n)),n},Pi.prototype._createOutlineGfx=function(){var e=Me("rect");return we(e,V({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Pi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Pi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&F(i,function(r){n=n||r.updateOutline(t,e)}),n||we(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Pi.prototype.updateConnectionOutline=function(e,t){var n=Bt(t);we(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Pi.prototype.registerProvider=function(e,t){t||(t=e,e=oD),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Pi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Pi.prototype.getOutline=function(e){var t,n=this._getProviders();return F(n,function(i){Jt(i.getOutline)&&(t=t||i.getOutline(e))}),t},Pi.$inject=["eventBus","styles","elementRegistry"];var Mu=6;function ed(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)})}ed.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ls(t);var n=e.length>1,i=this._canvas.getContainer();if(Qe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=aD(Bt(e)),o=Me("rect");we(o,V({rx:3},r)),Qe(o).add("djs-selection-outline"),$e(t,o)}},ed.$inject=["eventBus","canvas","selection"];function aD(e){return{x:e.x-Mu,y:e.y-Mu,width:e.width+Mu*2,height:e.height+Mu*2}}const td={__depends__:[ni],__init__:["outline","multiSelectionOutline"],outline:["type",Pi],multiSelectionOutline:["type",ed]},y_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],v_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},sD=15,ku=2;function b_(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(m=>We(m,y_));if(f.length===1){const m=f[0];Ge(m)?a(m,m.labelTarget):(d=m.labels)!=null&&d.length&&a(m.labels[0],m)}if(f.length===2){const m=f.find(Ge),h=f.find(b=>{var y;return(y=b.labels)==null?void 0:y.includes(m)});m&&h&&a(m,h)}}),e.on("shape.changed",function({element:p}){var f;!We(p,y_)||!l(p)||(Ge(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=aa([Le(f),Le(p)],v_),m=d.getAttribute("d"),b=r.isSelected(p)?c(p):u(p),y=la(b,m);if(!y)return;const v=r.isSelected(f)?c(f):u(f),x=la(v,m)||Le(f);xa(x,y)<sD||(Ol(d,[x,y]),$e(o,d))}function s(){Ds(`.${v_.class}`,o).forEach(Kt)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+Sr(f,"x")-ku,y:p.y+Sr(f,"y")-ku,width:Sr(f,"width")+ku*2,height:Sr(f,"height")+ku*2};return zl(d,Sr(f,"rx"))}if(f.cx){const d=Sr(f,"r"),m={x:p.x+Sr(f,"cx")-d,y:p.y+Sr(f,"cy")-d,width:d*2,height:d*2};return qm(m)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}b_.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function Sr(e,t){return parseFloat(we(e,t)||0)}const cD={__depends__:[ni,td],__init__:["labelLink"],labelLink:["type",b_]};var uD=new Lo("tt");function lD(e){var t=bt('<div class="djs-tooltip-container" />');return _n(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function pD(e,t,n){_n(e,{left:t+"px",top:n+"px"})}function nd(e,t){e.style.display=t===!1?"none":""}var x_="djs-tooltip",id="."+x_;function Cn(e,t){this._eventBus=e,this._canvas=t,this._ids=uD,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=lD(t.getContainer());var n=this;On.bind(this._tooltipRoot,id,"mousedown",function(i){i.stopPropagation()}),On.bind(this._tooltipRoot,id,"mouseover",function(i){n.trigger("mouseover",i)}),On.bind(this._tooltipRoot,id,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Cn.$inject=["eventBus","canvas"],Cn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=V({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Cn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(mn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Cn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Cn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Cn.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)}},Cn.prototype.remove=function(e){var t=this.get(e);t&&(vi(t.html),vi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Cn.prototype.show=function(){nd(this._tooltipRoot)},Cn.prototype.hide=function(){nd(this._tooltipRoot,!1)},Cn.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},Cn.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)),An(n)&&(n=bt(n)),i=bt('<div data-tooltip-id="'+t+'" class="'+x_+'">'),_n(i,{position:"absolute"}),i.appendChild(n),e.type&&wt(i).add("djs-tooltip-"+e.type),e.className&&wt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Cn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;pD(n,t.x,t.y)},Cn.prototype._updateTooltipVisibilty=function(e){F(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),nd(i,r))})},Cn.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 fD={__init__:["tooltips"],tooltips:["type",Cn]};var dD="flow elements must be children of pools/participants",hD="Data object must be placed within a pool/participant.";function __(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;S(s,"bpmn:Collaboration")&&(S(a,"bpmn:FlowNode")?i(r,n(dD)):S(a,"bpmn:DataObjectReference")&&i(r,n(hD)))})}__.$inject=["eventBus","tooltips","translate"];const mD={__depends__:[fD],__init__:["modelingFeedback"],modelingFeedback:["type",__]};var gD=500,yD=1250,vD=1500,Ou=Math.round;function bD(e){return{x:e.x+Ou(e.width/2),y:e.y+Ou(e.height/2)}}function w_(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",vD,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=xD(l),V(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",yD,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",gD,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=Ou(u.x),u.y=Ou(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(pr(s)){var c=Mo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Qt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Qe(s.target).has("djs-hit-no-move")){var p=bD(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}w_.$inject=["eventBus","dragging","modeling","selection","rules"];function xD(e){var t=oo(e,"id");return Ye(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var E_=499,rd="djs-dragging",S_="drop-ok",R_="drop-not-ok",C_="new-parent",P_="attach-ok";function A_(e,t,n,i){function r(c){var u=o(c),l=_D(u);return l}function o(c){var u=sa(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[P_,S_,R_,C_].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,rd),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",E_,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=Me("g");we(d,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();$e(m,d),u.dragGroup=d}f.forEach(function(h){i.addDragger(h,u.dragGroup)}),p?p=Vu([p,o(l)]):p=o(l),F(p,function(h){t.addMarker(h,rd)}),u.allDraggedElements=p,u.differentParents=wD(l)}),e.on("shape.move.move",E_,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,P_):u.canExecute&&f&&p.id!==f.id?a(p,C_):a(p,u.canExecute?S_:R_)),un(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;F(l,function(f){t.removeMarker(f,rd)}),p&&Kt(p)}),this.makeDraggable=s}A_.$inject=["eventBus","canvas","styles","previewSupport"];function _D(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ye(e,function(i){return ft(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function wD(e){return cw(oo(e,function(t){return t.parent&&t.parent.id}))!==1}const ED={__depends__:[Ec,ni,td,Si,Hi,Io],__init__:["move","movePreview"],move:["type",w_],movePreview:["type",A_]};var T_=".djs-palette-toggle",M_=".entry",SD=T_+", "+M_,od="djs-palette-",RD="shown",ad="open",k_="two-column",CD=1e3;function Ht(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",function(i){var r=i.tool;n.updateToolHighlight(r)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._rebuild()})}Ht.$inject=["eventBus","canvas"],Ht.prototype.registerProvider=function(e,t){t||(t=e,e=CD),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},Ht.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(AD,{})},Ht.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},Ht.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=bt(Ht.HTML_MARKUP);n.appendChild(i),wt(n).add(od+RD),On.bind(i,SD,"click",function(r){var o=r.delegateTarget;if(El(o,T_))return e.toggle();e.trigger("click",r)}),Ne.bind(i,"mousedown",function(r){r.stopPropagation()}),On.bind(i,M_,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Ht.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Ht.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=wt(n),a=wt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(k_,r),a.toggle(od+k_,r),"open"in e&&(o.toggle(ad,e.open),a.toggle(od+ad,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Ht.prototype._update=function(){var e=pt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ks(e),F(t,function(n,i){var r=n.group||"default",o=pt("[data-group="+za(r)+"]",e);o||(o=bt('<div class="group"></div>'),mn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=bt(a);if(o.appendChild(s),!n.separator&&(mn(s,"data-action",i),n.title&&mn(s,"title",n.title),n.className&&PD(s,n.className),n.imageUrl)){var c=bt("<img>");mn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},Ht.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=mn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},Ht.prototype.triggerEntry=function(e,t,n,i){var r=this._entries,o,a;if(o=r[e],!!o&&(a=o.action,this._eventBus.fire("palette.trigger",{entry:o,event:n})!==!1)){if(Jt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},Ht.prototype._layoutChanged=function(){this._toggleState({})},Ht.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},Ht.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Ht.prototype.open=function(){this._toggleState({open:!0})},Ht.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ht.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Ht.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=pt(".djs-palette-entries",this._container),this._toolsContainer=pt("[data-group=tools]",t)),n=this._toolsContainer,F(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=wt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Ht.prototype.isOpen=function(){return wt(this._container).has(ad)},Ht.prototype._getParentContainer=function(){return this._canvas.getContainer()},Ht.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function PD(e,t){var n=wt(e),i=De(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function AD(e,t){var n=t.getPaletteEntries();return Jt(n)?n(e):(F(n,function(i,r){e[r]=i}),e)}const TD={__init__:["palette"],palette:["type",Ht]};var O_="crosshair",D_="selected",MD="djs-dragging-active-lasso";function Rr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=Me("rect");we(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),$e(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&we(f,{x:d.x,y:d.y,width:d.width,height:d.height});var m=p.marked,h=p.lastMarked;if(m&&h){for(const b of h)m.has(b)||t.removeMarker(b,D_);for(const b of m)h.has(b)||t.addMarker(b,D_)}},remove:function(p){this.update(p),p.frame&&Kt(p.frame),u(!1)}};function u(p){Qe(t.getContainer()).toggle(MD,p)}function l(p){var f=i.getAll();return new Set(ro(yo(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=L_(p),f.add=gc(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=L_(p),m=l(d),h=f.initialMarked.union(m);f.lastMarked=f.marked,f.marked=h,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(gc(p))return s.activateLasso(p.originalEvent),!0})}Rr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Rr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:O_,data:{context:{}},keepSelection:!0})},Rr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:O_,data:{context:{}},keepSelection:!0})},Rr.prototype._select=function(e){this._selection.select(e)},Rr.prototype.select=function(e,t,n=[]){var i=ro(yo(e,t));this._select([...n,...i])},Rr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Rr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function L_(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 kD={__depends__:[Pc,Ca],__init__:["lassoTool"],lassoTool:["type",Rr]};var sd=1500,I_="grab";function Uo(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",sd,function(c){if(Ea(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(sd,function(c){if(!(!B_(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(sd,function(c){!B_(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!Ea(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Uo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Uo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:I_,data:{context:n||{}}})},Uo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:I_,data:{context:{reactivate:n}}})},Uo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Uo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function B_(e){return Xt("Space",e)}const OD={__depends__:[Pc,Ca],__init__:["handTool"],handTool:["type",Uo]};var N_="connect-ok",$_="connect-not-ok";function Yo(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?N_:$_))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?N_:$_)}),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})}Yo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Yo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Yo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Yo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Yo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const DD={__depends__:[Xf,Si,Hi,Pc,Ca],globalConnect:["type",Yo]};function cd(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)}cd.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],cd.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,m,h){function b(y){var g=n.createShape(V({type:p},h));t.start(y,g)}return{group:f,className:d,title:m,action:{dragstart:b,click:b}}}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 V(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 LD={__depends__:[TD,Rc,fv,kD,OD,DD,ga],__init__:["paletteProvider"],paletteProvider:["type",cd]};var ID=250;function ud(e,t,n,i,r){ee.call(this,e);function o(s){var c=s.canExecute.replacements;F(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);V(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var m=pt('[data-element-id="'+za(f.id)+'"]',s.dragGroup);m&&we(m,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;F(c,function(u,l){var p=pt('[data-element-id="'+za(l)+'"]',s.dragGroup);p&&we(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",ID,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}ud.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],_e(ud,ee);const BD={__depends__:[Io],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",ud]};var ND=1250,ld=40,$D=20,FD=10,F_=20,j_=["x","y"],jD=Math.abs;function H_(e){e.on(["connect.hover","connect.move","connect.end"],ND,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&In(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&HD(t,o,WD(o)),o&&VD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=oi(r),We(o,["bpmn:Event","bpmn:Gateway"])&&z_(t,oi(o)),We(o,["bpmn:Task","bpmn:SubProcess"])&&zD(t,o),S(a,"bpmn:BoundaryEvent")&&s===a.host&&GD(t)):G_(i,"bpmn:MessageFlow")?(S(r,"bpmn:Event")&&(n.connectionStart=oi(r)),S(o,"bpmn:Event")&&z_(t,oi(o))):n.connectionStart=n.initialConnectionStart)})}H_.$inject=["eventBus"];function HD(e,t,n){j_.forEach(function(i){var r=V_(i,t);e[i]<t[i]+n?jt(e,i,t[i]+n):e[i]>t[i]+r-n&&jt(e,i,t[i]+r-n)})}function zD(e,t){var n=oi(t);j_.forEach(function(i){UD(e,t,i)&&jt(e,i,n[i])})}function GD(e){var t=e.context,n=t.source,i=t.target;if(!YD(t)){var r=oi(n),o=cn(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;jD(c-r[s])<ld&&(c>r[s]?u=r[s]+ld:u=r[s]-ld,jt(e,s,u))})}}function z_(e,t){jt(e,"x",t.x),jt(e,"y",t.y)}function G_(e,t){return e&&e.type===t}function VD(e,t){return Xi(t,function(n){return G_(e,n)})}function V_(e,t){return e==="x"?t.width:t.height}function WD(e){return S(e,"bpmn:Task")?FD:$D}function UD(e,t,n){return e[n]>t[n]+F_&&e[n]<t[n]+V_(n,t)-F_}function YD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Cr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Cr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Cr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Cr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Cr.prototype.getSnapLocations=function(){return this._snapLocations},Cr.prototype.setSnapLocations=function(e){this._snapLocations=e},Cr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Du,n.initDefaults(this._defaultSnaps)),n};function Du(){this._snapValues={}}Du.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},Du.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&Ik(e[n],r[n],i)},Du.prototype.initDefaults=function(e){var t=this;F(e||{},function(n,i){F(n,function(r){t.add(i,r)})})};var qD=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"],qD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&In(r.originalEvent))&&!(Wo(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Ai.$inject=["elementRegistry","eventBus","snapping"],Ai.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Cr);var o;t.get(i.id)?o=oi(i,e):o={x:e.x+oi(i).x,y:e.y+oi(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),Ge(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},Ai.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return F(i,function(r){if(Ge(r)){Ge(t)&&e.add("mid",oi(r));return}if(ft(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);F(o,function(a){e.add("mid",a)});return}e.add("mid",oi(r))}),!Be(t.x)||!Be(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",oi(t)),e},Ai.prototype.getSnapTargets=function(e,t){return Mx(t).filter(function(n){return!KD(n)})};function KD(e){return!!e.hidden}var W_=1500;function qo(e,t){t.invoke(Ai,this),e.on(["create.move","create.end"],W_,JD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],W_,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Wo(n)&&XD(n,o)})}_e(qo,Ai),qo.$inject=["eventBus","injector"],qo.prototype.initSnap=function(e){var t=Ai.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return F(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Y_(o,i,e))}),F(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Y_(o,i,e))}),S(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},qo.prototype.addSnapTargetPoints=function(e,t,n){Ai.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);F(i,function(o){(QD(o)||ZD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Ax(o)),e.add("bottom-right",Tx(o)))});var r=this._elementRegistry;return F(t.incoming,function(o){if(r.get(t.id)){U_(i,o.source)||e.add("mid",Le(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),F(t.outgoing,function(o){if(r.get(t.id)){U_(i,o.target)||e.add("mid",Le(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),S(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},qo.prototype.getSnapTargets=function(e,t){return Ai.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!S(n,"bpmn:Lane")})};function XD(e,t){var n=Oe(t),i=cy(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Le(o),/top/.test(i)?jt(e,"y",n.top-a.y):/bottom/.test(i)&&jt(e,"y",n.bottom-a.y),/left/.test(i)?jt(e,"x",n.left-a.x):/right/.test(i)&&jt(e,"x",n.right-a.x)}function ZD(e,t){return e.every(function(n){return S(n,t)})}function QD(e){return S(e,"bpmn:SubProcess")&&Xe(e)?!0:S(e,"bpmn:Participant")}function JD(e){var t=e.context,n=t.createConstraints;if(n){var i=n.top,r=n.right,o=n.bottom,a=n.left;(a&&a>=e.x||r&&r<=e.x)&&jt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&jt(e,"y",e.y)}}function U_(e,t){return e.indexOf(t)!==-1}function Y_(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var eL=1250;function rs(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],eL,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&In(i.originalEvent))&&!Wo(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),iL(s)&&jt(i,"x",i.x),rL(s)&&jt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}rs.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Cr);var o=q_(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},rs.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return F(r,function(o){e.add("corner",Tx(o)),e.add("corner",Ax(o))}),e.add("corner",q_(t,i)),e},rs.$inject=["eventBus","snapping"],rs.prototype.getSnapTargets=function(e,t){return Mx(t).filter(function(n){return!tL(n,e)&&!ft(n)&&!nL(n)&&!Ge(n)})};function q_(e,t){var n=Le(e),i=Oe(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 tL(e,t){return e.host===t}function nL(e){return!!e.hidden}function iL(e){return e==="n"||e==="s"}function rL(e){return e==="e"||e==="w"}var oL=7,aL=1e3;function Pr(e){this._canvas=e,this._asyncHide=Uu(Sn(this.hide,this),aL)}Pr.$inject=["canvas"],Pr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Wo(e,"x"),y:Wo(e,"y")};F(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(F(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,oL),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),F(["x","y"],function(a){var s=o[a];Qt(s)&&jt(e,a,s.originValue)})},Pr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Me("path");return we(n,{d:"M0,0 L0,0"}),Qe(n).add("djs-snap-line"),$e(t,n),{update:function(i){Be(i)?e==="horizontal"?we(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):we(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):we(n,{display:"none"})}}},Pr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Pr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Pr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Pr.prototype.hide=function(){F(this._snapLines,function(e){e.update()})};const sL={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ai],resizeSnapping:["type",rs],snapping:["type",Pr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",H_],createMoveSnapping:["type",qo]};var K_=300;function Fe(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=pt(Fe.INPUT_SELECTOR,this._container),this._resultsContainer=pt(Fe.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Fe.$inject=["canvas","eventBus","selection","translate"],Fe.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:On.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Fe.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Fe.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Fe.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Fe.INPUT_SELECTOR,"keydown",function(n){Xt("ArrowUp",n)&&n.preventDefault(),Xt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Fe.INPUT_SELECTOR,"keyup",function(n){if(Xt("Escape",n))return e.close();if(Xt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Xt("ArrowUp",n))return e._scrollToDirection(!0);if(Xt("ArrowDown",n))return e._scrollToDirection();Xt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Fe.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){On.unbind(e.el,e.type,e.listener)})},Fe.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=pt(Fe.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Fe.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Fe.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},Fe.prototype._clearResults=function(){ks(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Fe.prototype._getCurrentResult=function(){return pt(Fe.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Fe.prototype._createResultNode=function(e,t){var n=bt(Fe.RESULT_HTML);return e.primaryTokens.length>0&&X_(n,e.primaryTokens,Fe.RESULT_PRIMARY_HTML),X_(n,e.secondaryTokens,Fe.RESULT_SECONDARY_HTML),mn(n,Fe.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Fe.prototype.registerProvider=function(e){this._searchProvider=e},Fe.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,wt(this._canvas.getContainer()).add("djs-search-open"),wt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Fe.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,wt(this._canvas.getContainer()).remove("djs-search-open"),wt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Fe.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Fe.prototype.isOpen=function(){return this._open},Fe.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&wt(t).remove(Fe.RESULT_SELECTED_CLASS);var n=mn(e,Fe.RESULT_ID_ATTRIBUTE),i=this._results[n].element;wt(e).add(Fe.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:K_}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Fe.prototype._select=function(e){var t=mn(e,Fe.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:K_}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Fe.prototype._getBoxHtml=function(){const e=bt(Fe.BOX_HTML),t=pt(Fe.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function X_(e,t,n){var i=cL(t),r=bt(n);r.innerHTML=i,e.appendChild(r)}function cL(e){var t="";return e.forEach(function(n){var i=rb(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Fe.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Fe.CONTAINER_SELECTOR=".djs-search-container",Fe.INPUT_SELECTOR=".djs-search-input input",Fe.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Fe.RESULT_SELECTOR=".djs-search-result",Fe.RESULT_SELECTED_CLASS="djs-search-result-selected",Fe.RESULT_SELECTED_SELECTOR="."+Fe.RESULT_SELECTED_CLASS,Fe.RESULT_ID_ATTRIBUTE="data-result-id",Fe.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Fe.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
335
|
+
</svg>`},bO=900;function Ja(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",bO,this)}Ja.$inject=["popupMenu","distributeElements","translate","rules"],Ja.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Ja.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ja.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu,r={"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:qx.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:qx.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const xO={__depends__:[zf,vO],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",_u],distributeElementsMenuProvider:["type",Ja]};var Kx="is not a registered action",_O="is already registered";function si(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}si.$inject=["eventBus","injector"],si.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=De(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&&(De(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)})},si.prototype.trigger=function(e,t){if(!this._actions[e])throw Qf(e,Kx);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},si.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);F(e,function(i,r){n._registerAction(r,i)})},si.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Qf(e,_O);this._actions[e]=t},si.prototype.unregister=function(e){if(!this.isRegistered(e))throw Qf(e,Kx);this._actions[e]=void 0},si.prototype.getActions=function(){return Object.keys(this._actions)},si.prototype.isRegistered=function(e){return!!this._actions[e]};function Qf(e,t){return new Error(e+" "+t)}const wO={__init__:["editorActions"],editorActions:["type",si]};function wu(e){e.invoke(si,this)}_e(wu,si),wu.$inject=["injector"],wu.prototype._registerDefaultActions=function(e){si.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 m=t.getRootElement(),h=n.filter(function(v){return v!==m});return i.select(h),h}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(m){var h=i.get(),v=m.type;h.length&&c.trigger(h,v)}),i&&u&&this._registerAction("alignElements",function(m){var h=i.get(),v=[],y=m.type;h.length&&(v=Ye(h,function(g){return!S(g,"bpmn:Lane")}),u.trigger(v,y))}),i&&f&&this._registerAction("setColor",function(m){var h=i.get();h.length&&f.setColor(h,m)}),i&&l&&this._registerAction("directEditing",function(){var m=i.get();m.length&&l.activate(m[0])}),p&&this._registerAction("find",function(){p.toggle()}),t&&f&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),h,v;S(m,"bpmn:Collaboration")?v=n.filter(function(y){return S(y.parent,"bpmn:Collaboration")}):v=n.filter(function(y){return y!==m&&!S(y.parent,"bpmn:SubProcess")}),h=$t(v),f.moveElements(v,{x:-h.x,y:-h.y},m)}),i&&d&&this._registerAction("replaceElement",function(m){d.triggerEntry("replace","click",m)})};const EO={__depends__:[wO],editorActions:["type",wu]};function Xx(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;We(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}Xx.$inject=["eventBus"];function Zr(e,t){ee.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(i){var r=i.context,o=r.hints||{},a=o.autoResize;if(a){var s=r.shape,c=r.newBounds;An(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Zr.$inject=["eventBus","gridSnapping","modeling"],_e(Zr,ee),Zr.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},Zr.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},Zr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),V(e,o),e},Zr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),V(e,o),e};var SO=2e3;function Zx(e,t){e.on(["spaceTool.move","spaceTool.end"],SO,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)}})}Zx.$inject=["eventBus","gridSnapping"];const RO={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Zr],gridSnappingSpaceToolBehavior:["type",Zx]};var Eu=10;function Jf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var CO=1200,PO=800;function wr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",PO,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"],CO,function(o){var a=o.originalEvent;if(!(!r.active||a&&In(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},p=MO(o,u,e);p&&(l.offset=p);var f=AO(o,u);f&&V(l,f),Wo(o,u)||r.snapEvent(o,u,l)})}})}wr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);zt(e,t,i)},wr.prototype.getGridSpacing=function(){return Eu},wr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Jf(e,Eu);var i,r;return t&&t.min&&(i=t.min,Be(i)&&(i=Jf(i+n,Eu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Be(r)&&(r=Jf(r+n,Eu,"floor"),e=Math.min(e,r))),e-=n,e},wr.prototype.isActive=function(){return this.active},wr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},wr.prototype.toggleActive=function(){this.setActive(!this.active)},wr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function AO(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(Su(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,u=r.max;return c&&(Su(t)?Jx(s)?a.x.max=c.left:a.x.min=c.right:Qx(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(Su(t)?Jx(s)?a.x.min=u.left:a.x.max=u.right:Qx(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function MO(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Be(s[t])||(s||(s=o.snapOffset={}),Be(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Su(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function Su(e){return e==="x"}function Qx(e){return e.indexOf("n")!==-1}function Jx(e){return e.indexOf("w")!==-1}const TO={__depends__:[RO],__init__:["gridSnapping"],gridSnapping:["type",wr]};var kO=2e3;function e_(e,t,n){e.on("autoPlace",kO,function(i){var r=i.source,o=Le(r),a=i.shape,s=Jv(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],S(a,"bpmn:TextAnnotation")&&(OO(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}e_.$inject=["eventBus","gridSnapping","elementRegistry"];function OO(e){return e==="x"}var DO=1750;function t_(e,t,n){t.on(["create.start","shape.move.start"],DO,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!S(o,"bpmn:Participant")||!S(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}))}})}t_.$inject=["canvas","eventBus","gridSnapping"];var LO=3e3;function Ru(e,t,n){ee.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],LO,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||IO(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Ru.$inject=["eventBus","gridSnapping","modeling"],_e(Ru,ee),Ru.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=$O(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function IO(e){return e.length>3}function BO(e){return e==="h"}function NO(e){return e==="v"}function $O(e,t,n){var i=Ii(t,n),r={};return BO(i)&&(r.y=e.snapValue(t.y)),NO(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=V({},t,r),n=V({},n,r)),[t,n]}const FO={__depends__:[TO,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",e_],gridSnappingParticipantBehavior:["type",t_],gridSnappingLayoutConnectionBehavior:["type",Ru]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Xx]};var jO=30,n_=30;function es(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(S(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(S(r,"bpmn:Participant"))return Xe(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(S(r,"bpmn:SubProcess"))return Xe(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}es.$inject=["eventBus","interactionEvents"],es.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},es.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=tn(e)?{width:jO,height:e.height}:{width:e.width,height:n_};return this._interactionEvents.createBoxHit(t,"all",n),!0},es.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:n_}),!0};const HO={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",es]};function Cu(e){e.invoke($o,this)}_e(Cu,$o),Cu.$inject=["injector"],Cu.prototype.registerBindings=function(e,t){$o.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 zO={__depends__:[Pf],__init__:["keyboardBindings"],keyboardBindings:["type",Cu]};var GO={moveSpeed:1,moveSpeedAccelerated:10},VO=1500,i_="left",r_="up",o_="right",a_="down",WO={ArrowLeft:i_,Left:i_,ArrowUp:r_,Up:r_,ArrowRight:o_,Right:o_,ArrowDown:a_,Down:a_},UO={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 s_(e,t,n,i,r){var o=this;this._config=V({},GO,e||{}),t.addListener(VO,function(a){var s=a.keyEvent,c=WO[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=UO[a](u),p=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});p&&n.moveElements(c,l)}}}s_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const YO={__depends__:[Pf,ni],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",s_]};var c_=10;function ts(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=GC(l,p,u),c.newBounds=WC(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:Oe(l)})}function s(c){var u=c.shape,l=c.canExecute,p=c.newBounds;if(l){if(p=Rm(p),!qO(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)})}ts.prototype.canResize=function(e){var t=this._rules,n=ui(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},ts.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=V({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,u_(t,o),"resize",{autoActivate:!0,cursor:KO(o),data:{shape:t,context:r}})},ts.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:c_,height:c_},r=fg(t,e.childrenBoxPadding),UC(n,t,i,r)},ts.$inject=["eventBus","rules","modeling","dragging"];function qO(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function u_(e,t){var n=Le(e),i=Oe(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 KO(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 l_="djs-resizing",p_="resize-not-ok",XO=500;function f_(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,l_)),s.width>5&&we(c,{x:s.x,width:s.width}),s.height>5&&we(c,{y:s.y,height:s.height}),o.canExecute?Qe(c).remove(p_):Qe(c).add(p_)}function r(o){var a=o.shape,s=o.frame;s&&Kt(o.frame),t.removeMarker(a,l_)}e.on("resize.move",XO,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}f_.$inject=["eventBus","canvas","previewSupport"];var Pu=-6,Au=8,Mu=20,ns="djs-resizer",ZO=["n","w","s","e","nw","ne","se","sw"];function Er(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&F(a,Sn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}Er.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){pr(o)&&i.activate(o,e,n)}Ne.bind(t,"mousedown",r),Ne.bind(t,"touchstart",r)},Er.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=QO(i),a=Te("g");Qe(a).add(ns),Qe(a).add(ns+"-"+e.id),Qe(a).add(ns+"-"+i),$e(r,a);var s=Te("rect");we(s,{x:-Au/2+o.x,y:-Au/2+o.y,width:Au,height:Au}),Qe(s).add(ns+"-visual"),$e(a,s);var c=Te("rect");return we(c,{x:-Mu/2+o.x,y:-Mu/2+o.y,width:Mu,height:Mu}),Qe(c).add(ns+"-hit"),$e(a,c),Gs(a,t,n),a},Er.prototype.createResizer=function(e,t){var n=u_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Er.prototype.addResizer=function(e){var t=this;ft(e)||F(ZO,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Er.prototype.removeResizers=function(){var e=this._getResizersParent();Ls(e)},Er.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Er.$inject=["eventBus","canvas","selection","resize"];function QO(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Pu:e.indexOf("w")!==-1&&(t.x=Pu),e.indexOf("s")!==-1?t.y=-Pu:e.indexOf("n")!==-1&&(t.y=Pu),t}const d_={__depends__:[Si,Hi,Io],__init__:["resize","resizePreview","resizeHandles"],resize:["type",ts],resizePreview:["type",f_],resizeHandles:["type",Er]};var JO=2e3;function is(e,t,n,i,r,o,a){this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(c){s(c.element,!0)}),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],function(){i.isActive()&&i.complete()}),e.on(["shape.remove","connection.remove"],JO,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||We(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}is.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],is.prototype.activate=function(e){var t=qn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);V(n,i);var r={},o=n.style||{};return V(o,{backgroundColor:null,border:null}),(We(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||h_(e))&&V(r,{centerVertically:!0}),sr(e)&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),S(e,"bpmn:TextAnnotation")&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),V(n,{options:r,style:o}),n}},is.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,p=s.fontSize*a,f=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(S(e,"bpmn:Lane")||nD(e)){var m=tn(e),h=m?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};V(o,h),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(tD(e)){var v=tn(e),y=v?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};V(o,y),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:v?null:"rotate(-90deg)"})}(We(e,["bpmn:Task","bpmn:CallActivity"])||h_(e))&&(V(o,{width:i.width,height:i.height}),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),eD(e)&&(V(o,{width:i.width,x:i.x}),V(d,{fontSize:p+"px",lineHeight:f,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var g=1,b=i.width+2*g;if(n.labelTarget&&(V(o,{width:b,height:i.height+2*g,x:i.x-g,y:i.y-g}),V(d,{fontSize:u+"px",lineHeight:l})),sr(n)&&!Us(n)&&!Ge(n)){var x=jl(e),C=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),M=u,k=Fr.width*a+2*g;V(o,{width:k,height:M+2*g,x:C.x-k/2,y:C.y-M/2-g}),V(d,{fontSize:u+"px",lineHeight:l})}return S(e,"bpmn:TextAnnotation")&&(V(o,{width:i.width+2*g,height:i.height+2*g,x:i.x-g,y:i.y-g,minWidth:30*a,minHeight:10*a}),V(d,{textAlign:"left",paddingTop:wo*a+"px",paddingBottom:wo*a+"px",paddingLeft:wo*a+"px",paddingRight:wo*a+"px",fontSize:p+"px",lineHeight:f})),{bounds:o,style:d}},is.prototype.update=function(e,t,n,i){var r,o;S(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}),iD(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function h_(e){return S(e,"bpmn:SubProcess")&&!Xe(e)}function eD(e){return S(e,"bpmn:SubProcess")&&Xe(e)}function tD(e){return S(e,"bpmn:Participant")&&!Xe(e)}function nD(e){return S(e,"bpmn:Participant")&&Xe(e)}function iD(e){return!e||!e.trim()}var m_="djs-element-hidden",g_="djs-label-hidden";function y_(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,S(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Te("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),p=i.path=Te("path");we(p,{d:l,strokeWidth:2,stroke:rD(o)}),$e(s,p),$e(r,s),un(s,o.x,o.y)}S(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,m_):(S(o,"bpmn:Task")||S(o,"bpmn:CallActivity")||S(o,"bpmn:SubProcess")||S(o,"bpmn:Participant")||S(o,"bpmn:Lane"))&&t.addMarker(o,g_)}),e.on("directEditing.resize",function(c){if(S(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}});we(i.path,{d:f})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,m_),t.removeMarker(o,g_)),o=void 0,a=void 0,s&&(Kt(s),s=void 0)})}y_.$inject=["eventBus","canvas","pathMap"];function rD(e,t){var n=tt(e);return n.get("stroke")||t||"black"}const oD={__depends__:[of,d_,zx],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",is],labelEditingPreview:["type",y_]};var aD=500,sD=1e3;function Pi(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){WS(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){F(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],aD,function(o){var a=o.element,s=o.gfx,c=pt(".djs-outline",s);c&&i.updateOutline(a,c)})}Pi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=pt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),$e(t,n),this.updateOutline(e,n)),n},Pi.prototype._createOutlineGfx=function(){var e=Te("rect");return we(e,V({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Pi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Pi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&F(i,function(r){n=n||r.updateOutline(t,e)}),n||we(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Pi.prototype.updateConnectionOutline=function(e,t){var n=$t(t);we(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Pi.prototype.registerProvider=function(e,t){t||(t=e,e=sD),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Pi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Pi.prototype.getOutline=function(e){var t,n=this._getProviders();return F(n,function(i){Jt(i.getOutline)&&(t=t||i.getOutline(e))}),t},Pi.$inject=["eventBus","styles","elementRegistry"];var Tu=6;function ed(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)})}ed.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ls(t);var n=e.length>1,i=this._canvas.getContainer();if(Qe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=cD($t(e)),o=Te("rect");we(o,V({rx:3},r)),Qe(o).add("djs-selection-outline"),$e(t,o)}},ed.$inject=["eventBus","canvas","selection"];function cD(e){return{x:e.x-Tu,y:e.y-Tu,width:e.width+Tu*2,height:e.height+Tu*2}}const td={__depends__:[ni],__init__:["outline","multiSelectionOutline"],outline:["type",Pi],multiSelectionOutline:["type",ed]},v_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],b_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},uD=15,ku=2;function x_(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(m=>We(m,v_));if(f.length===1){const m=f[0];Ge(m)?a(m,m.labelTarget):(d=m.labels)!=null&&d.length&&a(m.labels[0],m)}if(f.length===2){const m=f.find(Ge),h=f.find(v=>{var y;return(y=v.labels)==null?void 0:y.includes(m)});m&&h&&a(m,h)}}),e.on("shape.changed",function({element:p}){var f;!We(p,v_)||!l(p)||(Ge(p)?a(p,p.labelTarget):(f=p.labels)!=null&&f.length&&a(p.labels[0],p))});function a(p,f){const d=aa([Le(f),Le(p)],b_),m=d.getAttribute("d"),v=r.isSelected(p)?c(p):u(p),y=la(v,m);if(!y)return;const b=r.isSelected(f)?c(f):u(f),x=la(b,m)||Le(f);xa(x,y)<uD||(Ol(d,[x,y]),$e(o,d))}function s(){Ds(`.${b_.class}`,o).forEach(Kt)}function c(p){const f=i.getOutline(p);if(!f)return u(p);if(f.x){const d={x:p.x+Sr(f,"x")-ku,y:p.y+Sr(f,"y")-ku,width:Sr(f,"width")+ku*2,height:Sr(f,"height")+ku*2};return zl(d,Sr(f,"rx"))}if(f.cx){const d=Sr(f,"r"),m={x:p.x+Sr(f,"cx")-d,y:p.y+Sr(f,"cy")-d,width:d*2,height:d*2};return Km(m)}}function u(p){return n.getShapePath(p)}function l(p){return r.isSelected(p)}}x_.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function Sr(e,t){return parseFloat(we(e,t)||0)}const lD={__depends__:[ni,td],__init__:["labelLink"],labelLink:["type",x_]};var pD=new Lo("tt");function fD(e){var t=bt('<div class="djs-tooltip-container" />');return _n(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function dD(e,t,n){_n(e,{left:t+"px",top:n+"px"})}function nd(e,t){e.style.display=t===!1?"none":""}var __="djs-tooltip",id="."+__;function Cn(e,t){this._eventBus=e,this._canvas=t,this._ids=pD,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=fD(t.getContainer());var n=this;On.bind(this._tooltipRoot,id,"mousedown",function(i){i.stopPropagation()}),On.bind(this._tooltipRoot,id,"mouseover",function(i){n.trigger("mouseover",i)}),On.bind(this._tooltipRoot,id,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Cn.$inject=["eventBus","canvas"],Cn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=V({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Cn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(mn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Cn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Cn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Cn.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)}},Cn.prototype.remove=function(e){var t=this.get(e);t&&(vi(t.html),vi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Cn.prototype.show=function(){nd(this._tooltipRoot)},Cn.prototype.hide=function(){nd(this._tooltipRoot,!1)},Cn.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},Cn.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)),An(n)&&(n=bt(n)),i=bt('<div data-tooltip-id="'+t+'" class="'+__+'">'),_n(i,{position:"absolute"}),i.appendChild(n),e.type&&wt(i).add("djs-tooltip-"+e.type),e.className&&wt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Cn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;dD(n,t.x,t.y)},Cn.prototype._updateTooltipVisibilty=function(e){F(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),nd(i,r))})},Cn.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 hD={__init__:["tooltips"],tooltips:["type",Cn]};var mD="flow elements must be children of pools/participants",gD="Data object must be placed within a pool/participant.";function w_(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;S(s,"bpmn:Collaboration")&&(S(a,"bpmn:FlowNode")?i(r,n(mD)):S(a,"bpmn:DataObjectReference")&&i(r,n(gD)))})}w_.$inject=["eventBus","tooltips","translate"];const yD={__depends__:[hD],__init__:["modelingFeedback"],modelingFeedback:["type",w_]};var vD=500,bD=1250,xD=1500,Ou=Math.round;function _D(e){return{x:e.x+Ou(e.width/2),y:e.y+Ou(e.height/2)}}function E_(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",xD,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=wD(l),V(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",bD,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",vD,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=Ou(u.x),u.y=Ou(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(pr(s)){var c=To(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Qt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Qe(s.target).has("djs-hit-no-move")){var p=_D(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}E_.$inject=["eventBus","dragging","modeling","selection","rules"];function wD(e){var t=oo(e,"id");return Ye(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var S_=499,rd="djs-dragging",R_="drop-ok",C_="drop-not-ok",P_="new-parent",A_="attach-ok";function M_(e,t,n,i){function r(c){var u=o(c),l=ED(u);return l}function o(c){var u=sa(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),p=u.concat(l),f=[...new Set(p)];return f}function a(c,u){[A_,R_,C_,P_].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,rd),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",S_,function(c){var u=c.context,l=u.shapes,p=u.allDraggedElements,f=r(l);if(!u.dragGroup){var d=Te("g");we(d,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();$e(m,d),u.dragGroup=d}f.forEach(function(h){i.addDragger(h,u.dragGroup)}),p?p=Vu([p,o(l)]):p=o(l),F(p,function(h){t.addMarker(h,rd)}),u.allDraggedElements=p,u.differentParents=SD(l)}),e.on("shape.move.move",S_,function(c){var u=c.context,l=u.dragGroup,p=u.target,f=u.shape.parent,d=u.canExecute;p&&(d==="attach"?a(p,A_):u.canExecute&&f&&p.id!==f.id?a(p,P_):a(p,u.canExecute?R_:C_)),un(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;F(l,function(f){t.removeMarker(f,rd)}),p&&Kt(p)}),this.makeDraggable=s}M_.$inject=["eventBus","canvas","styles","previewSupport"];function ED(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ye(e,function(i){return ft(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function SD(e){return uw(oo(e,function(t){return t.parent&&t.parent.id}))!==1}const RD={__depends__:[Ec,ni,td,Si,Hi,Io],__init__:["move","movePreview"],move:["type",E_],movePreview:["type",M_]};var T_=".djs-palette-toggle",k_=".entry",CD=T_+", "+k_,od="djs-palette-",PD="shown",ad="open",O_="two-column",AD=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=AD),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(TD,{})},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=bt(Gt.HTML_MARKUP);n.appendChild(i),wt(n).add(od+PD),On.bind(i,CD,"click",function(r){var o=r.delegateTarget;if(El(o,T_))return e.toggle();e.trigger("click",r)}),Ne.bind(i,"mousedown",function(r){r.stopPropagation()}),On.bind(i,k_,"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=wt(n),a=wt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(O_,r),a.toggle(od+O_,r),"open"in e&&(o.toggle(ad,e.open),a.toggle(od+ad,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},Gt.prototype._update=function(){var e=pt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ks(e),F(t,function(n,i){var r=n.group||"default",o=pt("[data-group="+za(r)+"]",e);o||(o=bt('<div class="group"></div>'),mn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=bt(a);if(o.appendChild(s),!n.separator&&(mn(s,"data-action",i),n.title&&mn(s,"title",n.title),n.className&&MD(s,n.className),n.imageUrl)){var c=bt("<img>");mn(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=mn(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(Jt(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=pt(".djs-palette-entries",this._container),this._toolsContainer=pt("[data-group=tools]",t)),n=this._toolsContainer,F(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=wt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},Gt.prototype.isOpen=function(){return wt(this._container).has(ad)},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 MD(e,t){var n=wt(e),i=De(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function TD(e,t){var n=t.getPaletteEntries();return Jt(n)?n(e):(F(n,function(i,r){e[r]=i}),e)}const kD={__init__:["palette"],palette:["type",Gt]};var D_="crosshair",L_="selected",OD="djs-dragging-active-lasso";function Rr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(p){var f=t.getActiveLayer(),d=p.frame=Te("rect");we(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),$e(f,d),u(!0),this.update(p)},update:function(p){var f=p.frame,d=p.bbox;f&&d&&we(f,{x:d.x,y:d.y,width:d.width,height:d.height});var m=p.marked,h=p.lastMarked;if(m&&h){for(const v of h)m.has(v)||t.removeMarker(v,L_);for(const v of m)h.has(v)||t.addMarker(v,L_)}},remove:function(p){this.update(p),p.frame&&Kt(p.frame),u(!1)}};function u(p){Qe(t.getContainer()).toggle(OD,p)}function l(p){var f=i.getAll();return new Set(ro(yo(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=I_(p),f.add=gc(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=I_(p),m=l(d),h=f.initialMarked.union(m);f.lastMarked=f.marked,f.marked=h,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(gc(p))return s.activateLasso(p.originalEvent),!0})}Rr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Rr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:D_,data:{context:{}},keepSelection:!0})},Rr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:D_,data:{context:{}},keepSelection:!0})},Rr.prototype._select=function(e){this._selection.select(e)},Rr.prototype.select=function(e,t,n=[]){var i=ro(yo(e,t));this._select([...n,...i])},Rr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Rr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function I_(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 DD={__depends__:[Pc,Ca],__init__:["lassoTool"],lassoTool:["type",Rr]};var sd=1500,B_="grab";function Uo(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",sd,function(c){if(Ea(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(sd,function(c){if(!(!N_(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(sd,function(c){!N_(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!Ea(c)&&l&&e.once("hand.move.ended",function(p){a.activateHand(p.originalEvent,!0,!0)}),!1})}Uo.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Uo.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:B_,data:{context:n||{}}})},Uo.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:B_,data:{context:{reactivate:n}}})},Uo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Uo.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function N_(e){return Xt("Space",e)}const LD={__depends__:[Pc,Ca],__init__:["handTool"],handTool:["type",Uo]};var $_="connect-ok",F_="connect-not-ok";function Yo(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?$_:F_))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?$_:F_)}),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})}Yo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Yo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Yo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Yo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Yo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const ID={__depends__:[Xf,Si,Hi,Pc,Ca],globalConnect:["type",Yo]};function cd(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)}cd.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],cd.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,m,h){function v(y){var g=n.createShape(V({type:p},h));t.start(y,g)}return{group:f,className:d,title:m,action:{dragstart:v,click:v}}}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 V(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 BD={__depends__:[kD,Rc,dv,DD,LD,ID,ga],__init__:["paletteProvider"],paletteProvider:["type",cd]};var ND=250;function ud(e,t,n,i,r){ee.call(this,e);function o(s){var c=s.canExecute.replacements;F(c,function(u){var l=u.oldElementId,p={type:u.newElementType};if(!s.visualReplacements[l]){var f=t.get(l);V(p,{x:f.x,y:f.y});var d=n.createShape(p);i.addShape(d,f.parent);var m=pt('[data-element-id="'+za(f.id)+'"]',s.dragGroup);m&&we(m,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;F(c,function(u,l){var p=pt('[data-element-id="'+za(l)+'"]',s.dragGroup);p&&we(p,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",ND,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}ud.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],_e(ud,ee);const $D={__depends__:[Io],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",ud]};var FD=1250,ld=40,jD=20,HD=10,j_=20,H_=["x","y"],zD=Math.abs;function z_(e){e.on(["connect.hover","connect.move","connect.end"],FD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&In(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&GD(t,o,YD(o)),o&&UD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=oi(r),We(o,["bpmn:Event","bpmn:Gateway"])&&G_(t,oi(o)),We(o,["bpmn:Task","bpmn:SubProcess"])&&VD(t,o),S(a,"bpmn:BoundaryEvent")&&s===a.host&&WD(t)):V_(i,"bpmn:MessageFlow")?(S(r,"bpmn:Event")&&(n.connectionStart=oi(r)),S(o,"bpmn:Event")&&G_(t,oi(o))):n.connectionStart=n.initialConnectionStart)})}z_.$inject=["eventBus"];function GD(e,t,n){H_.forEach(function(i){var r=W_(i,t);e[i]<t[i]+n?zt(e,i,t[i]+n):e[i]>t[i]+r-n&&zt(e,i,t[i]+r-n)})}function VD(e,t){var n=oi(t);H_.forEach(function(i){qD(e,t,i)&&zt(e,i,n[i])})}function WD(e){var t=e.context,n=t.source,i=t.target;if(!KD(t)){var r=oi(n),o=cn(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;zD(c-r[s])<ld&&(c>r[s]?u=r[s]+ld:u=r[s]-ld,zt(e,s,u))})}}function G_(e,t){zt(e,"x",t.x),zt(e,"y",t.y)}function V_(e,t){return e&&e.type===t}function UD(e,t){return Xi(t,function(n){return V_(e,n)})}function W_(e,t){return e==="x"?t.width:t.height}function YD(e){return S(e,"bpmn:Task")?HD:jD}function qD(e,t,n){return e[n]>t[n]+j_&&e[n]<t[n]+W_(n,t)-j_}function KD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Cr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Cr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Cr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Cr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Cr.prototype.getSnapLocations=function(){return this._snapLocations},Cr.prototype.setSnapLocations=function(e){this._snapLocations=e},Cr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Du,n.initDefaults(this._defaultSnaps)),n};function Du(){this._snapValues={}}Du.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},Du.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&Nk(e[n],r[n],i)},Du.prototype.initDefaults=function(e){var t=this;F(e||{},function(n,i){F(n,function(r){t.add(i,r)})})};var XD=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"],XD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&In(r.originalEvent))&&!(Wo(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Ai.$inject=["elementRegistry","eventBus","snapping"],Ai.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Cr);var o;t.get(i.id)?o=oi(i,e):o={x:e.x+oi(i).x,y:e.y+oi(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),Ge(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},Ai.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return F(i,function(r){if(Ge(r)){Ge(t)&&e.add("mid",oi(r));return}if(ft(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);F(o,function(a){e.add("mid",a)});return}e.add("mid",oi(r))}),!Be(t.x)||!Be(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",oi(t)),e},Ai.prototype.getSnapTargets=function(e,t){return kx(t).filter(function(n){return!ZD(n)})};function ZD(e){return!!e.hidden}var U_=1500;function qo(e,t){t.invoke(Ai,this),e.on(["create.move","create.end"],U_,tL),e.on(["create.move","create.end","shape.move.move","shape.move.end"],U_,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!Wo(n)&&QD(n,o)})}_e(qo,Ai),qo.$inject=["eventBus","injector"],qo.prototype.initSnap=function(e){var t=Ai.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return F(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",q_(o,i,e))}),F(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",q_(o,i,e))}),S(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},qo.prototype.addSnapTargetPoints=function(e,t,n){Ai.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);F(i,function(o){(eL(o)||JD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Mx(o)),e.add("bottom-right",Tx(o)))});var r=this._elementRegistry;return F(t.incoming,function(o){if(r.get(t.id)){Y_(i,o.source)||e.add("mid",Le(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),F(t.outgoing,function(o){if(r.get(t.id)){Y_(i,o.target)||e.add("mid",Le(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),S(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},qo.prototype.getSnapTargets=function(e,t){return Ai.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!S(n,"bpmn:Lane")})};function QD(e,t){var n=Oe(t),i=uy(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Le(o),/top/.test(i)?zt(e,"y",n.top-a.y):/bottom/.test(i)&&zt(e,"y",n.bottom-a.y),/left/.test(i)?zt(e,"x",n.left-a.x):/right/.test(i)&&zt(e,"x",n.right-a.x)}function JD(e,t){return e.every(function(n){return S(n,t)})}function eL(e){return S(e,"bpmn:SubProcess")&&Xe(e)?!0:S(e,"bpmn:Participant")}function tL(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)&&zt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&zt(e,"y",e.y)}}function Y_(e,t){return e.indexOf(t)!==-1}function q_(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var nL=1250;function rs(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],nL,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&In(i.originalEvent))&&!Wo(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),oL(s)&&zt(i,"x",i.x),aL(s)&&zt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}rs.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Cr);var o=K_(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},rs.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return F(r,function(o){e.add("corner",Tx(o)),e.add("corner",Mx(o))}),e.add("corner",K_(t,i)),e},rs.$inject=["eventBus","snapping"],rs.prototype.getSnapTargets=function(e,t){return kx(t).filter(function(n){return!iL(n,e)&&!ft(n)&&!rL(n)&&!Ge(n)})};function K_(e,t){var n=Le(e),i=Oe(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 iL(e,t){return e.host===t}function rL(e){return!!e.hidden}function oL(e){return e==="n"||e==="s"}function aL(e){return e==="e"||e==="w"}var sL=7,cL=1e3;function Pr(e){this._canvas=e,this._asyncHide=Uu(Sn(this.hide,this),cL)}Pr.$inject=["canvas"],Pr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:Wo(e,"x"),y:Wo(e,"y")};F(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(F(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,sL),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),F(["x","y"],function(a){var s=o[a];Qt(s)&&zt(e,a,s.originValue)})},Pr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Te("path");return we(n,{d:"M0,0 L0,0"}),Qe(n).add("djs-snap-line"),$e(t,n),{update:function(i){Be(i)?e==="horizontal"?we(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):we(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):we(n,{display:"none"})}}},Pr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Pr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Pr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Pr.prototype.hide=function(){F(this._snapLines,function(e){e.update()})};const uL={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ai],resizeSnapping:["type",rs],snapping:["type",Pr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",z_],createMoveSnapping:["type",qo]};var X_=300;function Fe(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=pt(Fe.INPUT_SELECTOR,this._container),this._resultsContainer=pt(Fe.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Fe.$inject=["canvas","eventBus","selection","translate"],Fe.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:On.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Fe.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Fe.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Fe.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Fe.INPUT_SELECTOR,"keydown",function(n){Xt("ArrowUp",n)&&n.preventDefault(),Xt("ArrowDown",n)&&n.preventDefault()}),t(this._container,Fe.INPUT_SELECTOR,"keyup",function(n){if(Xt("Escape",n))return e.close();if(Xt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Xt("ArrowUp",n))return e._scrollToDirection(!0);if(Xt("ArrowDown",n))return e._scrollToDirection();Xt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Fe.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){On.unbind(e.el,e.type,e.listener)})},Fe.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=pt(Fe.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Fe.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Fe.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},Fe.prototype._clearResults=function(){ks(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Fe.prototype._getCurrentResult=function(){return pt(Fe.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Fe.prototype._createResultNode=function(e,t){var n=bt(Fe.RESULT_HTML);return e.primaryTokens.length>0&&Z_(n,e.primaryTokens,Fe.RESULT_PRIMARY_HTML),Z_(n,e.secondaryTokens,Fe.RESULT_SECONDARY_HTML),mn(n,Fe.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Fe.prototype.registerProvider=function(e){this._searchProvider=e},Fe.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,wt(this._canvas.getContainer()).add("djs-search-open"),wt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Fe.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,wt(this._canvas.getContainer()).remove("djs-search-open"),wt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Fe.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Fe.prototype.isOpen=function(){return this._open},Fe.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&wt(t).remove(Fe.RESULT_SELECTED_CLASS);var n=mn(e,Fe.RESULT_ID_ATTRIBUTE),i=this._results[n].element;wt(e).add(Fe.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:X_}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Fe.prototype._select=function(e){var t=mn(e,Fe.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:X_}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Fe.prototype._getBoxHtml=function(){const e=bt(Fe.BOX_HTML),t=pt(Fe.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Z_(e,t,n){var i=lL(t),r=bt(n);r.innerHTML=i,e.appendChild(r)}function lL(e){var t="";return e.forEach(function(n){var i=ob(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Fe.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Fe.CONTAINER_SELECTOR=".djs-search-container",Fe.INPUT_SELECTOR=".djs-search-input input",Fe.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Fe.RESULT_SELECTOR=".djs-search-result",Fe.RESULT_SELECTED_CLASS="djs-search-result-selected",Fe.RESULT_SELECTED_SELECTOR="."+Fe.RESULT_SELECTED_CLASS,Fe.RESULT_ID_ATTRIBUTE="data-result-id",Fe.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Fe.BOX_HTML=`<div class="djs-search-container djs-scrollable">
|
|
336
336
|
<div class="djs-search-input">
|
|
337
337
|
<svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
338
338
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
|
|
@@ -340,4 +340,4 @@
|
|
|
340
340
|
<input type="text" spellcheck="false" />
|
|
341
341
|
</div>
|
|
342
342
|
<div class="djs-search-results" />
|
|
343
|
-
</div>`,Fe.RESULT_HTML='<div class="djs-search-result"></div>',Fe.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Fe.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const
|
|
343
|
+
</div>`,Fe.RESULT_HTML='<div class="djs-search-result"></div>',Fe.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Fe.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const pL={__depends__:[ga,Kc,ni],searchPad:["type",Fe]};function pd(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}pd.$inject=["elementRegistry","searchPad","canvas","search"],pd.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Ge(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:qn(i),id:i.id})),e,{keys:["label","id"]}).map(fL)};function fL(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const dL={__depends__:[pL,ux],__init__:["bpmnSearch"],bpmnSearch:["type",pd]},hL="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",mL="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",gL={width:36,height:50},yL={width:50,height:50};function Q_(e,t,n){return Te("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ci=5;function Lu(e,t){this._styles=t,e.registerProvider(this)}Lu.$inject=["outline","styles"],Lu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(HR(e))return n=Te("rect"),we(n,V({x:-ci,y:-ci,rx:4,width:e.width+ci*2,height:e.height+ci*2},t)),n;if(!Ge(e))return S(e,"bpmn:Gateway")?(n=Te("rect"),V(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),we(n,V({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):We(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Te("rect"),we(n,V({x:-ci,y:-ci,rx:14,width:e.width+ci*2,height:e.height+ci*2},t))):S(e,"bpmn:EndEvent")?(n=Te("circle"),we(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ci+1},t))):S(e,"bpmn:Event")?(n=Te("circle"),we(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ci},t))):S(e,"bpmn:DataObjectReference")&&J_(e,"bpmn:DataObjectReference")?n=Q_(hL,{x:-6,y:-6},t):S(e,"bpmn:DataStoreReference")&&J_(e,"bpmn:DataStoreReference")&&(n=Q_(mL,{x:-6,y:-6},t)),n},Lu.prototype.updateOutline=function(e,t){if(!Ge(e))return We(e,["bpmn:SubProcess","bpmn:Group"])?(we(t,{width:e.width+ci*2,height:e.height+ci*2}),!0):!!We(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function J_(e,t){var n;return t==="bpmn:DataObjectReference"?n=gL:t==="bpmn:DataStoreReference"&&(n=yL),e.width===n.width&&e.height===n.height}const vL={__depends__:[td],__init__:["outlineProvider"],outlineProvider:["type",Lu]};var bL='<?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 Mi(e){xo.call(this,e)}_e(Mi,xo),Mi.Viewer=xr,Mi.NavigatedViewer=Ga,Mi.prototype.createDiagram=function(){return this.importXML(bL)},Mi.prototype._interactionModules=[fb,hb,yb],Mi.prototype._modelingModules=[_k,Yc,Ck,Sk,Fk,Xf,Wk,gO,nv,Rc,xO,EO,FO,HO,zO,YO,oD,lD,wf,yD,RD,BD,$D,d_,uL,dL,vL],Mi.prototype._modules=[].concat(xr.prototype._modules,Mi.prototype._interactionModules,Mi.prototype._modelingModules);const xL=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Nt.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Nt.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),p=al(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 Nt.onMounted(async()=>{a=new Mi({container:o.value,moddleExtensions:ys}),i.xml&&await s(i.xml),r("ready")}),Nt.watch(()=>i.xml,u=>{u&&a&&s(u)}),Nt.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(Nt.openBlock(),Nt.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);ae.ADDABLE_FLOW_NODE_TYPES=us,ae.APPLY_BPMN_OPS_SCHEMA=ow,ae.BPMN_MODDLE_EXTENSIONS=ys,ae.BWL_MODDLE_SCHEMA=xd,ae.BWL_NS=bd,ae.BWL_PREFIX=Hu,ae.BWL_SIDES=zu,ae.BpmnModelerView=xL,ae.EDITOR=j1,ae.FLOW_LABEL_INDENT=eh,ae.HEADLESS_BPMN_MODULES=nb,ae.HEADLESS_TEXT_METRICS=uo,ae.I18N_NS=NE,ae.I18N_PREFIX=Wd,ae.IR_FLOW_NODE_TYPES=Mr,ae.LABEL_FORK_MARGIN=ll,ae.SYMBOLIC_OP_KINDS=Ed,ae.SYMBOLIC_OP_SCHEMA=Sd,ae.UNDO_EPISODE_COMMAND=Gu,ae.applyBpmnOpBatch=Kh,ae.applyBpmnOps=Wh,ae.approximateTextWidth=lo,ae.auditBpmnGeometry=ph,ae.auditBpmnGeometryXml=u1,ae.auditGeometry=kt,ae.auditTargetsOf=Wn,ae.axisSegmentsOf=xn,ae.blackBoxNameRect=cl,ae.buildBpmnOpBatch=F1,ae.buildRegistryIndex=dh,ae.containerBoundarySegments=na,ae.createBpmnEditorController=H1,ae.createBpmnModdle=Ud,ae.createHeadlessBpmnModeler=s2,ae.crossedShapesOf=an,ae.crossingCost=Vn,ae.describeProcess=qh,ae.describeProcessXml=$1,ae.edgeCrossCount=ia,ae.edgeCrossingPairsOf=ws,ae.edgeCrossingStatsOf=oh,ae.executeAsUndoEpisode=wd,ae.followMovedEdgeLabels=Dh,ae.forwardThreePointCandidates=Ss,ae.geometryFindingKey=Et,ae.installHeadlessBpmnDom=qd,ae.isAddableFlowNodeType=vd,ae.isEdgeOverlapFinding=ul,ae.isIrFlowNodeType=yd,ae.labelRectsOf=ho,ae.lineCrossesLabel=Oi,ae.lineThroughLabel=nh,ae.lineThroughShapeLabel=uh,ae.loadBpmnXml=ol,ae.lowerOps=Vh,ae.oppositeOverlapCount=XE,ae.oppositeOverlapOf=Jd,ae.planBackEdgeBoundaryClearance=wh,ae.planCrossPoolRoute=bh,ae.planEdgeRepair=hl,ae.planLabelLineClearance=Oh,ae.planLabelPlacement=kh,ae.planMiddleSegmentShifts=mh,ae.planOppositeOverlapRepair=Sh,ae.planSegmentDetours=Es,ae.planShapeLabelClearance=Bh,ae.redockIntroducedDetachedEndpoints=$h,ae.repairIntroducedBoundaryHugging=Eh,ae.repairIntroducedCrossings=ml,ae.repairIntroducedEdgeCrossings=yh,ae.repairIntroducedFakeMerges=Ch,ae.repairIntroducedLabelLines=Lh,ae.repairIntroducedOppositeOverlaps=Th,ae.repairIntroducedShapeLabelLines=Nh,ae.repairIntroducedSharedSegmentLabels=Ih,ae.rerouteIntroducedCrossPoolEdges=xh,ae.resolverServicesOf=zh,ae.saveBpmnXml=$E,ae.sceneCrossingCost=rh,ae.sceneFromDefinitions=lh,ae.sceneFromRegistry=et,ae.sharedSegmentUnderLabel=_s,ae.sharedSpansOf=xs,ae.unreadableOverlapCount=Gn,ae.unreadableOverlapOf=po,ae.validateOps=Hh,ae.warningMessages=al,Object.defineProperty(ae,Symbol.toStringTag,{value:"Module"})}));
|