@g1cloud/bpmn-modeler-next 5.0.0-alpha.86 → 5.0.0-alpha.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
- (function(ee,ye){typeof exports=="object"&&typeof module<"u"?ye(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],ye):(ee=typeof globalThis<"u"?globalThis:ee||self,ye(ee.BpmnModeler={},ee.Vue))})(this,(function(ee,ye){"use strict";var yB=Object.defineProperty;var vB=(ee,ye,qr)=>ye in ee?yB(ee,ye,{enumerable:!0,configurable:!0,writable:!0,value:qr}):ee[ye]=qr;var So=(ee,ye,qr)=>vB(ee,typeof ye!="symbol"?ye+"":ye,qr);const qr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent"],Ls=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Xd(e){return qr.includes(e)}function Zd(e){return Ls.includes(e)}const Qd="http://g1project.net/spec/bpmn/bwl/1.0",mu="bwl",gu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],Jd={name:"bwl-hints",uri:Qd,prefix:mu,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:"AfterColumnHint",extends:["bpmn:FlowNode"],properties:[{name:"afterColumn",isAttr:!0,type:"String"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]}]},yu="bwl.undoEpisode",eh=new WeakSet;function j0(e){eh.has(e)||(e.register(yu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),eh.add(e))}function th(e,t){j0(e);const n={run:t};if(e.execute(yu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const nh=["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"],H0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},z0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},G0={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},V0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ).",properties:{id:{type:"string"},type:{type:"string",enum:[...Ls]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},W0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},U0={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},Y0={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},K0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},X0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},Z0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Q0={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},J0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...gu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function Rn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const eE={"participant.add":Rn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":Rn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":Rn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."},afterColumn:{type:"string",description:"열 지목 힌트 — 그 노드보다 **뒤(오른쪽) 열**에 둔다. 좌표가 아니라 관계다(실제 x 는 호스트가 산출하고 정렬·압축은 그 뒤에도 적용된다). 🔴 **쓸 자리는 하나다 — 시퀀스 유입이 없는 수신 노드**(메시지만 받는 노드). 그런 노드는 열을 정할 근거가 도구에 없어 풀 좌단에 남고, 시간축(x)상 뒤쪽인 프로세스가 앞쪽에 놓여 선이 먼 거리를 돌아온다. 시퀀스로 이어지는 노드에는 쓰지 마라 — 열은 상류가 이미 정한다. 참조가 해소되지 않으면 힌트가 없는 것과 같이 동작한다."}},required:["node"]}),"node.update":Rn("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:[...Ls]},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":Rn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":Rn("sequenceFlow.update",{description:"시퀀스 플로우 이름/조건/끝점 갱신. condition: null = 조건 제거. source/target = 끝점 재배선 — 중간 삽입은 기존 플로우를 지우지 말고 이것으로 한쪽 끝을 옮긴 뒤 새 플로우를 추가한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},condition:{description:"생략 = 보존, null = 제거.",anyOf:[{$ref:"#/$defs/irFlowCondition"},{type:"null"}]},source:{description:"새 출발 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"},target:{description:"새 도착 노드 id(생략 = 보존). 같은 배치에서 추가한 노드도 지목할 수 있다.",type:"string"}},required:["id"]}),"messageFlow.add":Rn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":Rn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":Rn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":Rn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":Rn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":Rn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":Rn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":Rn("annotation.update",{description:"주석 본문/방위 힌트 갱신. placement: null = 힌트 제거(휴리스틱 복귀). 주석 삭제는 element.remove.",properties:{id:{type:"string"},text:{type:"string"},placement:{description:"생략 = 보존, null = 힌트 제거.",anyOf:[{$ref:"#/$defs/bwlPlacement"},{type:"null"}]}},required:["id"]}),"group.add":Rn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":Rn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":Rn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},ih={anyOf:nh.map(e=>eE[e])},tE={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:z0,irParticipant:G0,irNode:V0,irFlowCondition:W0,irSequenceFlow:U0,irMessageFlow:Y0,irDataStore:q0,irDataAssociation:K0,irTextAnnotation:X0,irAssociation:Z0,irGroup:Q0,bwlPlacement:J0,nullableString:H0,symbolicOp:ih}};function vu(e){return Array.prototype.concat.apply([],e)}const Ea=Object.prototype.toString,nE=Object.prototype.hasOwnProperty;function Kr(e){return e===void 0}function rn(e){return e!==void 0}function Ro(e){return e==null}function Ie(e){return Ea.call(e)==="[object Array]"}function ln(e){return Ea.call(e)==="[object Object]"}function Fe(e){return Ea.call(e)==="[object Number]"}function un(e){const t=Ea.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Hn(e){return Ea.call(e)==="[object String]"}function iE(e){if(!Ie(e))throw new Error("must supply array")}function zn(e,t){return!Ro(e)&&nE.call(e,t)}function wt(e,t){const n=Ns(t);let i;return H(e,function(r,o){if(n(r,o))return i=r,!1}),i}function rh(e,t){const n=Ns(t);let i=Ie(e)?-1:void 0;return H(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Qe(e,t){const n=Ns(t);let i=[];return H(e,function(r,o){n(r,o)&&i.push(r)}),i}function H(e,t){let n,i;if(Kr(e))return;const r=Ie(e)?cE:sE;for(let o in e)if(zn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function rE(e,t){if(Kr(e))return[];iE(e);const n=Ns(t);return e.filter(function(i,r){return!n(i,r)})}function Gn(e,t,n){return H(e,function(i,r){n=t(n,i,r)}),n}function Xr(e,t){return!!Gn(e,function(n,i,r){return n&&t(i,r)},!0)}function hr(e,t){return!!wt(e,t)}function Cn(e,t){let n=[];return H(e,function(i,r){n.push(t(i,r))}),n}function Bs(e){return e&&Object.keys(e)||[]}function oE(e){return Bs(e).length}function Co(e){return Cn(e,t=>t)}function Ao(e,t,n={}){return t=bu(t),H(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function oh(e,...t){e=bu(e);let n={};return H(t,r=>Ao(r,e,n)),Cn(n,function(r,o){return r[0]})}const aE=oh;function Pi(e,t){t=bu(t);let n=[];return H(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)}),Cn(n,i=>i.v)}function Po(e){return function(t){return Xr(e,function(n,i){return t[i]===n})}}function bu(e){return un(e)?e:t=>t[e]}function Ns(e){return un(e)?e:t=>t===e}function sE(e){return e}function cE(e){return Number(e)}function xu(e,t){let n,i,r,o;function a(f){let p=Date.now(),d=f?0:o+t-p;if(d>0)return s(d);e.apply(r,i),c()}function s(f){n=setTimeout(a,f)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function l(){n&&a(!0),c()}function u(...f){o=Date.now(),i=f,r=this,n||s(t)}return u.flush=l,u.cancel=c,u}function $n(e,t){return e.bind(t)}function W(e,...t){return Object.assign(e,...t)}function lE(e,t,n){let i=e;return H(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];rn(a)&&Ro(s)&&(s=i[r]=isNaN(+a)?{}:[]),Kr(a)?Kr(n)?delete i[r]:i[r]=n:i=s}),e}function Si(e,t){let n={},i=Object(e);return H(t,function(r){r in i&&(n[r]=e[r])}),n}function Mi(e,t){let n={},i=Object(e);return H(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function _u(){}_u.prototype.get=function(e){return this.$model.properties.get(this,e)},_u.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function ah(e,t){this.model=e,this.properties=t}ah.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(_u.prototype);H(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}),H(a,$n(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var uE=W(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),sh=W(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 wu(e,t){var n=sh[e];return n?n(t):t}function Eu(e){return!!uE[e]}function ch(e){return!!sh[e]}function An(e,t){var n=e.split(/:/),i,r;if(n.length===1)i=e,r=t;else if(n.length===2)i=n[1],r=n[0];else throw new Error("expected <prefix:localName> or <localName>, got "+e);return e=(r?r+":":"")+i,{name:e,prefix:r,localName:i}}function ni(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}ni.prototype.build=function(){return Si(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},ni.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)},ni.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},ni.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=An(r[0],i),a=An(r[1],o.prefix).name,s=this.propertiesByName[a];if(s)this.replaceProperty(s,e,n);else throw new Error("refined property <"+a+"> not found");delete e.redefines},ni.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},ni.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},ni.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},ni.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},ni.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},ni.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")},ni.prototype.hasProperty=function(e){return this.propertiesByName[e]},ni.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(H(e.properties,$n(function(o){o=W({},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 mr(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,H(e,$n(this.registerPackage,this))}mr.prototype.getPackage=function(e){return this.packageMap[e]},mr.prototype.getPackages=function(){return this.packages},mr.prototype.registerPackage=function(e){e=W({},e);var t=this.packageMap;lh(t,e,"prefix"),lh(t,e,"uri"),H(e.types,$n(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},mr.prototype.registerType=function(e,t){e=W({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:W({},e.meta||{})});var n=An(e.name,t.prefix),i=n.name,r=Object.create(null);H(e.properties,$n(function(o){var a=An(o.name,n.prefix),s=a.name;Eu(o.type)||(o.type=An(o.type,a.prefix).name),W(o,{ns:a,name:s}),r[s]=o},this)),W(e,{ns:n,name:i,propertiesByName:r}),H(e.extends,$n(function(o){var a=An(o,n.prefix),s=this.typeMap[a.name];s.traits=s.traits||[],s.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},mr.prototype.mapTypes=function(e,t,n){var i=Eu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,l){var u=An(c,Eu(c)?"":e.prefix);r.mapTypes(u,t,l)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");H(i.superClass,n?a:s),t(i,!n),H(i.traits,a)},mr.prototype.getEffectiveDescriptor=function(e){var t=An(e),n=new ni(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},mr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function lh(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Zr(e){this.model=e}Zr.prototype.set=function(e,t,n){if(!Hn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;pE(n)?i?delete e[r]:delete e.$attrs[Su(t)]:i?r in e?e[r]=n:uh(e,i,n):e.$attrs[Su(t)]=n},Zr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Su(t)];var i=n.name;return!e[i]&&n.isMany&&uh(e,n,[]),e[i]},Zr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=W({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Zr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Zr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Zr.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 pE(e){return typeof e>"u"}function uh(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Su(e){return e.replace(/^:/,"")}function li(e,t={}){this.properties=new Zr(this),this.factory=new ah(this,this.properties),this.registry=new mr(e,this.properties),this.typeCache=Object.create(null),this.config=t}li.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},li.prototype.getType=function(e){var t=this.typeCache,n=Hn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},li.prototype.createAny=function(e,t,n){var i=An(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){lE(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}),H(n,function(a,s){ln(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},li.prototype.getPackage=function(e){return this.registry.getPackage(e)},li.prototype.getPackages=function(){return this.registry.getPackages()},li.prototype.getElementDescriptor=function(e){return e.$descriptor},li.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},li.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},li.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var ph=String.fromCharCode,fE=Object.prototype.hasOwnProperty,dE=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Sa={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Sa).forEach(function(e){Sa[e.toUpperCase()]=Sa[e]});function hE(e,t,n,i){return i?fE.call(Sa,i)?Sa[i]:"&"+i+";":ph(t||parseInt(n,16))}function Qr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(dE,hE):e}var fh="non-whitespace outside of root node";function gr(e){return new Error(e)}function mE(e){return"missing namespace for prefix <"+e+">"}function $s(e){return{get:e,enumerable:!0}}function gE(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var dh=Symbol("nameCache");function Ru(e){return e+"$uri"}function yE(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Ru(i)]=n;return t}function Fs(){return{line:0,column:0}}function vE(e){throw e}function hh(e){if(!this)return new hh(e);var t=e&&e.proxy,n,i,r,o,a=vE,s,c,l,u,f=Fs,p=!1,d=!1,m="",h=!1,y=!1,v=null,g=!1,b,x,C,M;function O(I){I instanceof Error||(I=gr(I)),v=I,a(I,f)}function P(I){s&&(I instanceof Error||(I=gr(I)),s(I,f))}this.on=function(I,z){if(typeof z!="function")throw gr("required args <name, cb>");switch(I){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":u=z;break;case"question":l=z;break;case"comment":c=z;break;default:throw gr("unsupported event: "+I)}return this},this.ns=function(I){if(typeof I>"u"&&(I={}),typeof I!="object")throw gr("required args <nsMap={}>");var z=Object.create(null),ce;for(ce in I)z[ce]=I[ce];return y=!0,M=z,this};function F(){b=y?[]:null,x=y?yE(M):null,C=[],f=Fs,g=!1,v=null,d=!1,m=""}this.parse=function(I){if(typeof I!="string")throw gr("required args <xml=string>");if(p)throw gr("parse during stream; call end() first");return F(),D(I),f=Fs,g=!1,v},this.write=function(I){if(typeof I!="string")throw gr("required args <xml=string>");return p||(F(),p=!0),v||(m=D(m+I,!0)||""),this},this.end=function(){return p||F(),p=!1,v||D(m),m="",f=Fs,g=!1,v},this.stop=function(){g=!0};function D(I,z=!1){var ce=null,ve=null,Ye,He=0,it=!1,X=!1,Q=0,ue=0,_e,q,V,ie,Pe,bt,k,w,E,G="",U=0,Z;function Re(ft,qt){var fn=ft.indexOf(":");if(fn===-1)return ft;var dn=x[ft.substring(0,fn)];return dn?qt===dn?ft.substr(fn+1):dn+ft.substr(fn):(P(mE(ft.substring(0,fn))),null)}function Ke(){if(Z!==null)return Z;var ft,qt,fn=y&&x.xmlns,dn=y&&h?[]:null,Ct=U,zt=G,kn=zt.length,Ur,Jn,Wi,ei,Gt,Yr={},Ui=new Set,ti,ot,dt;e:for(;Ct<kn;Ct++)if(ti=!1,ot=zt.charCodeAt(Ct),!(ot===32||ot<14&&ot>8)){for((ot<65||ot>122||ot>90&&ot<97)&&ot!==95&&ot!==58&&(P("illegal first char attribute name"),ti=!0),dt=Ct+1;dt<kn;dt++)if(ot=zt.charCodeAt(dt),!(ot>96&&ot<123||ot>64&&ot<91||ot>47&&ot<59||ot===46||ot===45||ot===95)){if(ot===32||ot<14&&ot>8){P("missing attribute value"),Ct=dt;continue e}if(ot===61)break;P("illegal attribute name char"),ti=!0}if(Gt=zt.substring(Ct,dt),Gt==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),ti=!0),ot=zt.charCodeAt(dt+1),ot===34)dt=zt.indexOf('"',Ct=dt+2),dt===-1&&(dt=zt.indexOf("'",Ct),dt!==-1&&(P("attribute value quote missmatch"),ti=!0));else if(ot===39)dt=zt.indexOf("'",Ct=dt+2),dt===-1&&(dt=zt.indexOf('"',Ct),dt!==-1&&(P("attribute value quote missmatch"),ti=!0));else for(P("missing attribute value quotes"),ti=!0,dt=dt+1;dt<kn&&(ot=zt.charCodeAt(dt+1),!(ot===32||ot<14&&ot>8));dt++);for(dt===-1&&(P("missing closing quotes"),dt=kn,ti=!0),ti||(Wi=zt.substring(Ct,dt)),Ct=dt;dt+1<kn&&(ot=zt.charCodeAt(dt+1),!(ot===32||ot<14&&ot>8));dt++)Ct===dt&&(P("illegal character after attribute end"),ti=!0);if(Ct=dt+1,ti)continue e;if(Ui.has(Gt)){P("attribute <"+Gt+"> already defined");continue}if(Ui.add(Gt),!y){Yr[Gt]=Wi;continue}if(h){if(Jn=Gt==="xmlns"?"xmlns":Gt.charCodeAt(0)===120&&Gt.substr(0,6)==="xmlns:"?Gt.substr(6):null,Jn!==null){if(ft=Qr(Wi),qt=Ru(Jn),ei=M[ft],!ei){if(Jn==="xmlns"||qt in x&&x[qt]!==ft)do ei="ns"+He++;while(typeof x[ei]<"u");else ei=Jn;M[ft]=ei}x[Jn]!==ei&&(Ur||(x=gE(x),Ur=!0),x[Jn]=ei,Jn==="xmlns"&&(x[Ru(ei)]=ft,fn=ei),x[qt]=ft),Yr[Gt]=Wi;continue}dn.push(Gt,Wi);continue}Gt=Re(Gt,fn),Gt!==null&&(Yr[Gt]=Wi)}if(h)for(Ct=0,kn=dn.length;Ct<kn;Ct++)Gt=Re(dn[Ct++],fn),Wi=dn[Ct],Gt!==null&&(Yr[Gt]=Wi);return Z=Yr}function lt(){for(var ft=/(\r\n|\r|\n)/g,qt=0,fn=0,dn=0,Ct=ue,zt,kn;Q>=dn&&(zt=ft.exec(I),!(!zt||(Ct=zt[0].length+zt.index,Ct>Q)));)qt+=1,dn=Ct;return Q==-1?(fn=Ct,kn=I.substring(ue)):ue===0?kn=I.substring(ue,Q):(fn=Q-dn,kn=ue==-1?I.substring(Q):I.substring(Q,ue+1)),{data:kn,line:qt,column:fn}}for(f=lt,t&&(E=Object.create({},{name:$s(function(){return k}),originalName:$s(function(){return w}),attrs:$s(Ke),ns:$s(function(){return x})}));ue!==-1;){if(I.charCodeAt(ue)===60?Q=ue:Q=I.indexOf("<",ue),Q===-1){if(z)return I.substring(ue);if(C.length)return O("unexpected end of file");if(!d)return O("missing start tag");ue<I.length&&I.substring(ue).trim()&&P(fh);return}if(d||(d=!0),ue!==Q){if(C.length){if(n&&(n(I.substring(ue,Q),Qr,f),g))return}else if(I.substring(ue,Q).trim()&&(P(fh),g))return}if(ie=I.charCodeAt(Q+1),ie===33){if(V=I.charCodeAt(Q+2),V===91&&I.substr(Q+3,6)==="CDATA["){if(ue=I.indexOf("]]>",Q),ue===-1)return z?I.substring(Q):O("unclosed cdata");if(o&&(o(I.substring(Q+9,ue),f),g))return;ue+=3;continue}if(V===45&&I.charCodeAt(Q+3)===45){if(ue=I.indexOf("-->",Q),ue===-1)return z?I.substring(Q):O("unclosed comment");if(c&&(c(I.substring(Q+4,ue),Qr,f),g))return;ue+=3;continue}}if(ie===63){if(ue=I.indexOf("?>",Q),ue===-1)return z?I.substring(Q):O("unclosed question");if(l&&(l(I.substring(Q,ue+2),f),g))return;ue+=2;continue}for(_e=Q+1;;_e++){if(Pe=I.charCodeAt(_e),isNaN(Pe))return z?I.substring(Q):(ue=-1,O("unclosed tag"));if(Pe===34)V=I.indexOf('"',_e+1),_e=V!==-1?V:_e;else if(Pe===39)V=I.indexOf("'",_e+1),_e=V!==-1?V:_e;else if(Pe===62){ue=_e;break}}if(ie===33){if(u&&(u(I.substring(Q,ue+1),Qr,f),g))return;ue+=1;continue}if(Z={},ie===47){if(it=!1,X=!0,!C.length)return O("missing open tag");if(_e=k=C.pop(),V=Q+2+_e.length,I.substring(Q+2,V)!==_e)return O("closing tag mismatch");for(;V<ue;V++)if(ie=I.charCodeAt(V),!(ie===32||ie>8&&ie<14))return O("close tag")}else{if(I.charCodeAt(ue-1)===47?(_e=k=I.substring(Q+1,ue-1),it=!0,X=!0):(_e=k=I.substring(Q+1,ue),it=!0,X=!1),!(ie>96&&ie<123||ie>64&&ie<91||ie===95||ie===58))return O("illegal first char nodeName");for(V=1,q=_e.length;V<q;V++)if(ie=_e.charCodeAt(V),!(ie>96&&ie<123||ie>64&&ie<91||ie>47&&ie<59||ie===45||ie===95||ie==46)){if(ie===32||ie<14&&ie>8){k=_e.substring(0,V),Z=null;break}return O("invalid nodeName")}X||C.push(k)}if(y){Ye=x,it&&(X||b.push(Ye),Z===null&&(h=_e.indexOf("xmlns",V)!==-1)&&(U=V,G=_e,Ke(),h=!1)),w=k,ve!==x&&(ce=x[dh],ce===void 0&&(ce=x[dh]=Object.create(null)),ve=x);var Ht=ce[k];if(Ht!==void 0)k=Ht;else{if(ie=k.indexOf(":"),ie!==-1){if(bt=x[k.substring(0,ie)],!bt)return O("missing namespace on <"+w+">");k=k.substr(ie+1)}else bt=x.xmlns;bt&&(k=bt+":"+k),ce[w]=k}}if(it&&(U=V,G=_e,i&&(t?i(E,Qr,X,f):i(k,Ke,Qr,X,f),g)))return;if(X){if(r&&(r(t?E:k,Qr,it,f),g))return;y&&(it?x=Ye:x=b.pop())}ue+=1}}}function mh(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Cu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},gh="property";function yh(e){return e.xml&&e.xml.serialize}function bE(e){const t=yh(e);return t!==gh&&(t||null)}function xE(e){return e.charAt(0).toUpperCase()+e.slice(1)}function vh(e,t){return mh(t)?e.prefix+":"+xE(e.localName):e.name}function _E(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 wE(e,t,n){const i=An(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=An(r);var a=n.getPackage(o.prefix);return _E(o,a)}function yr(e){return new Error(e)}function qi(e){return e.$descriptor}function EE(e){W(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw yr("expected element");var n=this.elementsById,i=qi(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 yr("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Ra(){}Ra.prototype.handleEnd=function(){},Ra.prototype.handleText=function(){},Ra.prototype.handleNode=function(){};function Au(){}Au.prototype=Object.create(Ra.prototype),Au.prototype.handleNode=function(){return this};function Mo(){}Mo.prototype=Object.create(Ra.prototype),Mo.prototype.handleText=function(e){this.body=(this.body||"")+e};function Ca(e,t){this.property=e,this.context=t}Ca.prototype=Object.create(Mo.prototype),Ca.prototype.handleNode=function(e){if(this.element)throw yr("expected no sub nodes");return this.element=this.createReference(e),this},Ca.prototype.handleEnd=function(){this.element.id=this.body},Ca.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Pu(e,t){this.element=t,this.propertyDesc=e}Pu.prototype=Object.create(Mo.prototype),Pu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=wu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function js(){}js.prototype=Object.create(Mo.prototype),js.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 Dn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Dn.prototype=Object.create(js.prototype),Dn.prototype.addReference=function(e){this.context.addReference(e)},Dn.prototype.handleText=function(e){var t=this.element,n=qi(t),i=n.bodyProperty;if(!i)throw yr("unexpected body text <"+e+">");Mo.prototype.handleText.call(this,e)},Dn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=qi(t),i=n.bodyProperty;i&&e!==void 0&&(e=wu(i.type,e),t.set(i.name,e))},Dn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=qi(n),r=this.context,o=new n({}),a=this.model,s;return H(t,function(c,l){var u=i.propertiesByName[l],f;u&&u.isReference?u.isMany?(f=c.split(" "),H(f,function(p){r.addReference({element:o,property:u.ns.name,id:p})})):r.addReference({element:o,property:u.ns.name,id:c}):(u?c=wu(u.type,c):l==="xmlns"?l=":"+l:(s=An(l,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+l+">",element:o,property:l,value:c})),o.set(l,c))}),o},Dn.prototype.getPropertyForNode=function(e){var t=e.name,n=An(t),i=this.type,r=this.model,o=qi(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const l=bE(s);if(l){const u=e.attributes[l];if(u){const f=wE(u,e.ns,r),p=r.getType(f);return W({},s,{effectiveType:qi(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const l=vh(n,c),u=r.getType(l);if(s=wt(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&u.hasType(f.type)}),s)return W({},s,{effectiveType:qi(u).name})}else if(s=wt(o.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw yr("unrecognized element <"+n.name+">")},Dn.prototype.toString=function(){return"ElementDescriptor["+qi(this.type).name+"]"},Dn.prototype.valueHandler=function(e,t){return new Pu(e,t)},Dn.prototype.referenceHandler=function(e){return new Ca(e,this.context)},Dn.prototype.handler=function(e){return e==="Element"?new To(this.model,e,this.context):new Dn(this.model,e,this.context)},Dn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,ch(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?(W(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Mu(e,t,n){Dn.call(this,e,t,n)}Mu.prototype=Object.create(Dn.prototype),Mu.prototype.createElement=function(e){var t=e.name,n=An(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&vh(n,o)||t;if(!r.hasType(a))throw yr("unexpected element <"+e.originalName+">");return Dn.prototype.createElement.call(this,e)};function To(e,t,n){this.model=e,this.context=n}To.prototype=Object.create(js.prototype),To.prototype.createElement=function(e){var t=e.name,n=An(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},To.prototype.handleChild=function(e){var t=new To(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},To.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Tu(e){e instanceof li&&(e={model:e}),W(this,{lax:!1},e)}Tu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Dn?(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 EE(W({},t,{rootHandler:i})),s=new hh({proxy:!0}),c=SE();i.context=a,c.push(i);function l(C,M,O){var P=M(),F=P.line,D=P.column,I=P.data;I.charAt(0)==="<"&&I.indexOf(" ")!==-1&&(I=I.slice(0,I.indexOf(" "))+">");var z="unparsable content "+(I?I+" ":"")+`detected
1
+ (function(ee,ye){typeof exports=="object"&&typeof module<"u"?ye(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],ye):(ee=typeof globalThis<"u"?globalThis:ee||self,ye(ee.BpmnModeler={},ee.Vue))})(this,(function(ee,ye){"use strict";var wB=Object.defineProperty;var EB=(ee,ye,qr)=>ye in ee?wB(ee,ye,{enumerable:!0,configurable:!0,writable:!0,value:qr}):ee[ye]=qr;var Eo=(ee,ye,qr)=>EB(ee,typeof ye!="symbol"?ye+"":ye,qr);const qr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent"],Is=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function Jd(e){return qr.includes(e)}function eh(e){return Is.includes(e)}const th="http://g1project.net/spec/bpmn/bwl/1.0",gu="bwl",yu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],nh={name:"bwl-hints",uri:th,prefix:gu,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:"AfterColumnHint",extends:["bpmn:FlowNode"],properties:[{name:"afterColumn",isAttr:!0,type:"String"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]}]},vu="bwl.undoEpisode",ih=new WeakSet;function G0(e){ih.has(e)||(e.register(vu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),ih.add(e))}function rh(e,t){G0(e);const n={run:t};if(e.execute(vu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const oh=["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:[...Is]},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},eE={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},tE={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},nE={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...yu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function An(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const iE={"participant.add":An("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":An("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":An("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."},afterColumn:{type:"string",description:"열 지목 힌트 — 그 노드보다 **뒤(오른쪽) 열**에 둔다. 좌표가 아니라 관계다(실제 x 는 호스트가 산출하고 정렬·압축은 그 뒤에도 적용된다). 🔴 **쓸 자리는 하나다 — 시퀀스 유입이 없는 수신 노드**(메시지만 받는 노드). 그런 노드는 열을 정할 근거가 도구에 없어 풀 좌단에 남고, 시간축(x)상 뒤쪽인 프로세스가 앞쪽에 놓여 선이 먼 거리를 돌아온다. 시퀀스로 이어지는 노드에는 쓰지 마라 — 열은 상류가 이미 정한다. 참조가 해소되지 않으면 힌트가 없는 것과 같이 동작한다."}},required:["node"]}),"node.update":An("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:[...Is]},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":An("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":An("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":An("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":An("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":An("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":An("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":An("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":An("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":An("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":An("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":An("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":An("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":An("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},ah={anyOf:oh.map(e=>iE[e])},rE={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:eE,irGroup:tE,bwlPlacement:nE,nullableString:V0,symbolicOp:ah}};function bu(e){return Array.prototype.concat.apply([],e)}const wa=Object.prototype.toString,oE=Object.prototype.hasOwnProperty;function Kr(e){return e===void 0}function rn(e){return e!==void 0}function So(e){return e==null}function Le(e){return wa.call(e)==="[object Array]"}function un(e){return wa.call(e)==="[object Object]"}function Fe(e){return wa.call(e)==="[object Number]"}function pn(e){const t=wa.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function zn(e){return wa.call(e)==="[object String]"}function aE(e){if(!Le(e))throw new Error("must supply array")}function Gn(e,t){return!So(e)&&oE.call(e,t)}function At(e,t){const n=Ns(t);let i;return H(e,function(r,o){if(n(r,o))return i=r,!1}),i}function sh(e,t){const n=Ns(t);let i=Le(e)?-1:void 0;return H(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Qe(e,t){const n=Ns(t);let i=[];return H(e,function(r,o){n(r,o)&&i.push(r)}),i}function H(e,t){let n,i;if(Kr(e))return;const r=Le(e)?pE:uE;for(let o in e)if(Gn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function sE(e,t){if(Kr(e))return[];aE(e);const n=Ns(t);return e.filter(function(i,r){return!n(i,r)})}function Vn(e,t,n){return H(e,function(i,r){n=t(n,i,r)}),n}function Xr(e,t){return!!Vn(e,function(n,i,r){return n&&t(i,r)},!0)}function hr(e,t){return!!At(e,t)}function Pn(e,t){let n=[];return H(e,function(i,r){n.push(t(i,r))}),n}function Bs(e){return e&&Object.keys(e)||[]}function cE(e){return Bs(e).length}function Ro(e){return Pn(e,t=>t)}function Co(e,t,n={}){return t=xu(t),H(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function ch(e,...t){e=xu(e);let n={};return H(t,r=>Co(r,e,n)),Pn(n,function(r,o){return r[0]})}const lE=ch;function Ai(e,t){t=xu(t);let n=[];return H(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),Pn(n,i=>i.v)}function Ao(e){return function(t){return Xr(e,function(n,i){return t[i]===n})}}function xu(e){return pn(e)?e:t=>t[e]}function Ns(e){return pn(e)?e:t=>t===e}function uE(e){return e}function pE(e){return Number(e)}function _u(e,t){let n,i,r,o;function a(f){let p=Date.now(),d=f?0:o+t-p;if(d>0)return s(d);e.apply(r,i),c()}function s(f){n=setTimeout(a,f)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function l(){n&&a(!0),c()}function u(...f){o=Date.now(),i=f,r=this,n||s(t)}return u.flush=l,u.cancel=c,u}function Fn(e,t){return e.bind(t)}function W(e,...t){return Object.assign(e,...t)}function fE(e,t,n){let i=e;return H(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];rn(a)&&So(s)&&(s=i[r]=isNaN(+a)?{}:[]),Kr(a)?Kr(n)?delete i[r]:i[r]=n:i=s}),e}function Ei(e,t){let n={},i=Object(e);return H(t,function(r){r in i&&(n[r]=e[r])}),n}function Pi(e,t){let n={},i=Object(e);return H(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function wu(){}wu.prototype.get=function(e){return this.$model.properties.get(this,e)},wu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function lh(e,t){this.model=e,this.properties=t}lh.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(wu.prototype);H(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}),H(a,Fn(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 dE=W(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),uh=W(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 Eu(e,t){var n=uh[e];return n?n(t):t}function Su(e){return!!dE[e]}function ph(e){return!!uh[e]}function Mn(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 ni(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}ni.prototype.build=function(){return Ei(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},ni.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)},ni.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},ni.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Mn(r[0],i),a=Mn(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},ni.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},ni.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},ni.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},ni.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},ni.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},ni.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")},ni.prototype.hasProperty=function(e){return this.propertiesByName[e]},ni.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(H(e.properties,Fn(function(o){o=W({},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 mr(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,H(e,Fn(this.registerPackage,this))}mr.prototype.getPackage=function(e){return this.packageMap[e]},mr.prototype.getPackages=function(){return this.packages},mr.prototype.registerPackage=function(e){e=W({},e);var t=this.packageMap;fh(t,e,"prefix"),fh(t,e,"uri"),H(e.types,Fn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},mr.prototype.registerType=function(e,t){e=W({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:W({},e.meta||{})});var n=Mn(e.name,t.prefix),i=n.name,r=Object.create(null);H(e.properties,Fn(function(o){var a=Mn(o.name,n.prefix),s=a.name;Su(o.type)||(o.type=Mn(o.type,a.prefix).name),W(o,{ns:a,name:s}),r[s]=o},this)),W(e,{ns:n,name:i,propertiesByName:r}),H(e.extends,Fn(function(o){var a=Mn(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},mr.prototype.mapTypes=function(e,t,n){var i=Su(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,l){var u=Mn(c,Su(c)?"":e.prefix);r.mapTypes(u,t,l)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");H(i.superClass,n?a:s),t(i,!n),H(i.traits,a)},mr.prototype.getEffectiveDescriptor=function(e){var t=Mn(e),n=new ni(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},mr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function fh(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Zr(e){this.model=e}Zr.prototype.set=function(e,t,n){if(!zn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;hE(n)?i?delete e[r]:delete e.$attrs[Ru(t)]:i?r in e?e[r]=n:dh(e,i,n):e.$attrs[Ru(t)]=n},Zr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Ru(t)];var i=n.name;return!e[i]&&n.isMany&&dh(e,n,[]),e[i]},Zr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=W({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Zr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Zr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Zr.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 hE(e){return typeof e>"u"}function dh(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Ru(e){return e.replace(/^:/,"")}function li(e,t={}){this.properties=new Zr(this),this.factory=new lh(this,this.properties),this.registry=new mr(e,this.properties),this.typeCache=Object.create(null),this.config=t}li.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},li.prototype.getType=function(e){var t=this.typeCache,n=zn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},li.prototype.createAny=function(e,t,n){var i=Mn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){fE(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}),H(n,function(a,s){un(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},li.prototype.getPackage=function(e){return this.registry.getPackage(e)},li.prototype.getPackages=function(){return this.registry.getPackages()},li.prototype.getElementDescriptor=function(e){return e.$descriptor},li.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},li.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},li.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var hh=String.fromCharCode,mE=Object.prototype.hasOwnProperty,gE=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Ea={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Ea).forEach(function(e){Ea[e.toUpperCase()]=Ea[e]});function yE(e,t,n,i){return i?mE.call(Ea,i)?Ea[i]:"&"+i+";":hh(t||parseInt(n,16))}function Qr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(gE,yE):e}var mh="non-whitespace outside of root node";function gr(e){return new Error(e)}function vE(e){return"missing namespace for prefix <"+e+">"}function $s(e){return{get:e,enumerable:!0}}function bE(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var gh=Symbol("nameCache");function Cu(e){return e+"$uri"}function xE(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Cu(i)]=n;return t}function Fs(){return{line:0,column:0}}function _E(e){throw e}function yh(e){if(!this)return new yh(e);var t=e&&e.proxy,n,i,r,o,a=_E,s,c,l,u,f=Fs,p=!1,d=!1,m="",h=!1,y=!1,v=null,g=!1,b,_,C,M;function O(B){B instanceof Error||(B=gr(B)),v=B,a(B,f)}function P(B){s&&(B instanceof Error||(B=gr(B)),s(B,f))}this.on=function(B,z){if(typeof z!="function")throw gr("required args <name, cb>");switch(B){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":u=z;break;case"question":l=z;break;case"comment":c=z;break;default:throw gr("unsupported event: "+B)}return this},this.ns=function(B){if(typeof B>"u"&&(B={}),typeof B!="object")throw gr("required args <nsMap={}>");var z=Object.create(null),ce;for(ce in B)z[ce]=B[ce];return y=!0,M=z,this};function F(){b=y?[]:null,_=y?xE(M):null,C=[],f=Fs,g=!1,v=null,d=!1,m=""}this.parse=function(B){if(typeof B!="string")throw gr("required args <xml=string>");if(p)throw gr("parse during stream; call end() first");return F(),I(B),f=Fs,g=!1,v},this.write=function(B){if(typeof B!="string")throw gr("required args <xml=string>");return p||(F(),p=!0),v||(m=I(m+B,!0)||""),this},this.end=function(){return p||F(),p=!1,v||I(m),m="",f=Fs,g=!1,v},this.stop=function(){g=!0};function I(B,z=!1){var ce=null,ve=null,qe,He=0,st=!1,X=!1,Q=0,ue=0,_e,q,V,ie,Me,Rt,k,w,E,G="",U=0,Z;function Ce(yt,qt){var dn=yt.indexOf(":");if(dn===-1)return yt;var hn=_[yt.substring(0,dn)];return hn?qt===hn?yt.substr(dn+1):hn+yt.substr(dn):(P(vE(yt.substring(0,dn))),null)}function Ke(){if(Z!==null)return Z;var yt,qt,dn=y&&_.xmlns,hn=y&&h?[]:null,Mt=U,Vt=G,Dn=Vt.length,Ur,ei,Vi,ti,Nt,Yr={},Ts=new Set,gn,pt,mt;e:for(;Mt<Dn;Mt++)if(gn=!1,pt=Vt.charCodeAt(Mt),!(pt===32||pt<14&&pt>8)){for((pt<65||pt>122||pt>90&&pt<97)&&pt!==95&&pt!==58&&(P("illegal first char attribute name"),gn=!0),mt=Mt+1;mt<Dn;mt++)if(pt=Vt.charCodeAt(mt),!(pt>96&&pt<123||pt>64&&pt<91||pt>47&&pt<59||pt===46||pt===45||pt===95)){if(pt===32||pt<14&&pt>8){P("missing attribute value"),Mt=mt;continue e}if(pt===61)break;P("illegal attribute name char"),gn=!0}if(Nt=Vt.substring(Mt,mt),Nt==="xmlns:xmlns"&&(P("illegal declaration of xmlns"),gn=!0),pt=Vt.charCodeAt(mt+1),pt===34)mt=Vt.indexOf('"',Mt=mt+2),mt===-1&&(mt=Vt.indexOf("'",Mt),mt!==-1&&(P("attribute value quote missmatch"),gn=!0));else if(pt===39)mt=Vt.indexOf("'",Mt=mt+2),mt===-1&&(mt=Vt.indexOf('"',Mt),mt!==-1&&(P("attribute value quote missmatch"),gn=!0));else for(P("missing attribute value quotes"),gn=!0,mt=mt+1;mt<Dn&&(pt=Vt.charCodeAt(mt+1),!(pt===32||pt<14&&pt>8));mt++);for(mt===-1&&(P("missing closing quotes"),mt=Dn,gn=!0),gn||(Vi=Vt.substring(Mt,mt)),Mt=mt;mt+1<Dn&&(pt=Vt.charCodeAt(mt+1),!(pt===32||pt<14&&pt>8));mt++)Mt===mt&&(P("illegal character after attribute end"),gn=!0);if(Mt=mt+1,gn)continue e;if(Ts.has(Nt)){P("attribute <"+Nt+"> already defined");continue}if(Ts.add(Nt),!y){Yr[Nt]=Vi;continue}if(h){if(ei=Nt==="xmlns"?"xmlns":Nt.charCodeAt(0)===120&&Nt.substr(0,6)==="xmlns:"?Nt.substr(6):null,ei!==null){if(yt=Qr(Vi),qt=Cu(ei),ti=M[yt],!ti){if(ei==="xmlns"||qt in _&&_[qt]!==yt)do ti="ns"+He++;while(typeof _[ti]<"u");else ti=ei;M[yt]=ti}_[ei]!==ti&&(Ur||(_=bE(_),Ur=!0),_[ei]=ti,ei==="xmlns"&&(_[Cu(ti)]=yt,dn=ti),_[qt]=yt),Yr[Nt]=Vi;continue}hn.push(Nt,Vi);continue}Nt=Ce(Nt,dn),Nt!==null&&(Yr[Nt]=Vi)}if(h)for(Mt=0,Dn=hn.length;Mt<Dn;Mt++)Nt=Ce(hn[Mt++],dn),Vi=hn[Mt],Nt!==null&&(Yr[Nt]=Vi);return Z=Yr}function ut(){for(var yt=/(\r\n|\r|\n)/g,qt=0,dn=0,hn=0,Mt=ue,Vt,Dn;Q>=hn&&(Vt=yt.exec(B),!(!Vt||(Mt=Vt[0].length+Vt.index,Mt>Q)));)qt+=1,hn=Mt;return Q==-1?(dn=Mt,Dn=B.substring(ue)):ue===0?Dn=B.substring(ue,Q):(dn=Q-hn,Dn=ue==-1?B.substring(Q):B.substring(Q,ue+1)),{data:Dn,line:qt,column:dn}}for(f=ut,t&&(E=Object.create({},{name:$s(function(){return k}),originalName:$s(function(){return w}),attrs:$s(Ke),ns:$s(function(){return _})}));ue!==-1;){if(B.charCodeAt(ue)===60?Q=ue:Q=B.indexOf("<",ue),Q===-1){if(z)return B.substring(ue);if(C.length)return O("unexpected end of file");if(!d)return O("missing start tag");ue<B.length&&B.substring(ue).trim()&&P(mh);return}if(d||(d=!0),ue!==Q){if(C.length){if(n&&(n(B.substring(ue,Q),Qr,f),g))return}else if(B.substring(ue,Q).trim()&&(P(mh),g))return}if(ie=B.charCodeAt(Q+1),ie===33){if(V=B.charCodeAt(Q+2),V===91&&B.substr(Q+3,6)==="CDATA["){if(ue=B.indexOf("]]>",Q),ue===-1)return z?B.substring(Q):O("unclosed cdata");if(o&&(o(B.substring(Q+9,ue),f),g))return;ue+=3;continue}if(V===45&&B.charCodeAt(Q+3)===45){if(ue=B.indexOf("-->",Q),ue===-1)return z?B.substring(Q):O("unclosed comment");if(c&&(c(B.substring(Q+4,ue),Qr,f),g))return;ue+=3;continue}}if(ie===63){if(ue=B.indexOf("?>",Q),ue===-1)return z?B.substring(Q):O("unclosed question");if(l&&(l(B.substring(Q,ue+2),f),g))return;ue+=2;continue}for(_e=Q+1;;_e++){if(Me=B.charCodeAt(_e),isNaN(Me))return z?B.substring(Q):(ue=-1,O("unclosed tag"));if(Me===34)V=B.indexOf('"',_e+1),_e=V!==-1?V:_e;else if(Me===39)V=B.indexOf("'",_e+1),_e=V!==-1?V:_e;else if(Me===62){ue=_e;break}}if(ie===33){if(u&&(u(B.substring(Q,ue+1),Qr,f),g))return;ue+=1;continue}if(Z={},ie===47){if(st=!1,X=!0,!C.length)return O("missing open tag");if(_e=k=C.pop(),V=Q+2+_e.length,B.substring(Q+2,V)!==_e)return O("closing tag mismatch");for(;V<ue;V++)if(ie=B.charCodeAt(V),!(ie===32||ie>8&&ie<14))return O("close tag")}else{if(B.charCodeAt(ue-1)===47?(_e=k=B.substring(Q+1,ue-1),st=!0,X=!0):(_e=k=B.substring(Q+1,ue),st=!0,X=!1),!(ie>96&&ie<123||ie>64&&ie<91||ie===95||ie===58))return O("illegal first char nodeName");for(V=1,q=_e.length;V<q;V++)if(ie=_e.charCodeAt(V),!(ie>96&&ie<123||ie>64&&ie<91||ie>47&&ie<59||ie===45||ie===95||ie==46)){if(ie===32||ie<14&&ie>8){k=_e.substring(0,V),Z=null;break}return O("invalid nodeName")}X||C.push(k)}if(y){qe=_,st&&(X||b.push(qe),Z===null&&(h=_e.indexOf("xmlns",V)!==-1)&&(U=V,G=_e,Ke(),h=!1)),w=k,ve!==_&&(ce=_[gh],ce===void 0&&(ce=_[gh]=Object.create(null)),ve=_);var Gt=ce[k];if(Gt!==void 0)k=Gt;else{if(ie=k.indexOf(":"),ie!==-1){if(Rt=_[k.substring(0,ie)],!Rt)return O("missing namespace on <"+w+">");k=k.substr(ie+1)}else Rt=_.xmlns;Rt&&(k=Rt+":"+k),ce[w]=k}}if(st&&(U=V,G=_e,i&&(t?i(E,Qr,X,f):i(k,Ke,Qr,X,f),g)))return;if(X){if(r&&(r(t?E:k,Qr,st,f),g))return;y&&(st?_=qe:_=b.pop())}ue+=1}}}function vh(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Au={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},bh="property";function xh(e){return e.xml&&e.xml.serialize}function wE(e){const t=xh(e);return t!==bh&&(t||null)}function EE(e){return e.charAt(0).toUpperCase()+e.slice(1)}function _h(e,t){return vh(t)?e.prefix+":"+EE(e.localName):e.name}function SE(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 RE(e,t,n){const i=Mn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=Mn(r);var a=n.getPackage(o.prefix);return SE(o,a)}function yr(e){return new Error(e)}function qi(e){return e.$descriptor}function CE(e){W(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw yr("expected element");var n=this.elementsById,i=qi(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 yr("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Sa(){}Sa.prototype.handleEnd=function(){},Sa.prototype.handleText=function(){},Sa.prototype.handleNode=function(){};function Pu(){}Pu.prototype=Object.create(Sa.prototype),Pu.prototype.handleNode=function(){return this};function Po(){}Po.prototype=Object.create(Sa.prototype),Po.prototype.handleText=function(e){this.body=(this.body||"")+e};function Ra(e,t){this.property=e,this.context=t}Ra.prototype=Object.create(Po.prototype),Ra.prototype.handleNode=function(e){if(this.element)throw yr("expected no sub nodes");return this.element=this.createReference(e),this},Ra.prototype.handleEnd=function(){this.element.id=this.body},Ra.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Mu(e,t){this.element=t,this.propertyDesc=e}Mu.prototype=Object.create(Po.prototype),Mu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Eu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function js(){}js.prototype=Object.create(Po.prototype),js.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 Ln(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}Ln.prototype=Object.create(js.prototype),Ln.prototype.addReference=function(e){this.context.addReference(e)},Ln.prototype.handleText=function(e){var t=this.element,n=qi(t),i=n.bodyProperty;if(!i)throw yr("unexpected body text <"+e+">");Po.prototype.handleText.call(this,e)},Ln.prototype.handleEnd=function(){var e=this.body,t=this.element,n=qi(t),i=n.bodyProperty;i&&e!==void 0&&(e=Eu(i.type,e),t.set(i.name,e))},Ln.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=qi(n),r=this.context,o=new n({}),a=this.model,s;return H(t,function(c,l){var u=i.propertiesByName[l],f;u&&u.isReference?u.isMany?(f=c.split(" "),H(f,function(p){r.addReference({element:o,property:u.ns.name,id:p})})):r.addReference({element:o,property:u.ns.name,id:c}):(u?c=Eu(u.type,c):l==="xmlns"?l=":"+l:(s=Mn(l,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+l+">",element:o,property:l,value:c})),o.set(l,c))}),o},Ln.prototype.getPropertyForNode=function(e){var t=e.name,n=Mn(t),i=this.type,r=this.model,o=qi(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const l=wE(s);if(l){const u=e.attributes[l];if(u){const f=RE(u,e.ns,r),p=r.getType(f);return W({},s,{effectiveType:qi(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const l=_h(n,c),u=r.getType(l);if(s=At(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&u.hasType(f.type)}),s)return W({},s,{effectiveType:qi(u).name})}else if(s=At(o.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw yr("unrecognized element <"+n.name+">")},Ln.prototype.toString=function(){return"ElementDescriptor["+qi(this.type).name+"]"},Ln.prototype.valueHandler=function(e,t){return new Mu(e,t)},Ln.prototype.referenceHandler=function(e){return new Ra(e,this.context)},Ln.prototype.handler=function(e){return e==="Element"?new Mo(this.model,e,this.context):new Ln(this.model,e,this.context)},Ln.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,ph(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?(W(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Tu(e,t,n){Ln.call(this,e,t,n)}Tu.prototype=Object.create(Ln.prototype),Tu.prototype.createElement=function(e){var t=e.name,n=Mn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&_h(n,o)||t;if(!r.hasType(a))throw yr("unexpected element <"+e.originalName+">");return Ln.prototype.createElement.call(this,e)};function Mo(e,t,n){this.model=e,this.context=n}Mo.prototype=Object.create(js.prototype),Mo.prototype.createElement=function(e){var t=e.name,n=Mn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},Mo.prototype.handleChild=function(e){var t=new Mo(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},Mo.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function ku(e){e instanceof li&&(e={model:e}),W(this,{lax:!1},e)}ku.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Ln?(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 CE(W({},t,{rootHandler:i})),s=new yh({proxy:!0}),c=AE();i.context=a,c.push(i);function l(C,M,O){var P=M(),F=P.line,I=P.column,B=P.data;B.charAt(0)==="<"&&B.indexOf(" ")!==-1&&(B=B.slice(0,B.indexOf(" "))+">");var z="unparsable content "+(B?B+" ":"")+`detected
2
2
  line: `+F+`
3
- column: `+D+`
4
- nested error: `+C.message;if(O)return a.addWarning({message:z,error:C}),!0;throw yr(z)}function u(C,M){return l(C,M,!0)}function f(){var C=a.elementsById,M=a.references,O,P;for(O=0;P=M[O];O++){var F=P.element,D=C[P.id],I=qi(F).propertiesByName[P.property];if(D||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),I.isMany){var z=F.get(I.name),ce=z.indexOf(P);ce===-1&&(ce=z.length),D?z[ce]=D:z.splice(ce,1)}else F.set(I.name,D)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,m=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function y(C){if(d.test(C)){var M=m.exec(C),O=M&&M[1];!O||h.test(O)||a.addWarning({message:"unsupported document encoding <"+O+">, falling back to UTF-8"})}}function v(C,M){var O=c.peek();try{c.push(O.handleNode(C))}catch(P){l(P,M,o)&&c.push(new Au)}}function g(C,M){try{c.peek().handleText(C)}catch(O){u(O,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(Cu).reduce(function(C,[M,O]){return C[O]=M,C},r.config&&r.config.nsMap||{}));return s.ns(x).on("openTag",function(C,M,O,P){var F=C.attrs||{},D=Object.keys(F).reduce(function(z,ce){var ve=M(F[ce]);return z[ce]=ve,z},{}),I={name:C.name,originalName:C.originalName,attributes:D,ns:C.ns};v(I,P)}).on("question",y).on("closeTag",p).on("cdata",g).on("text",function(C,M,O){b(M(C),O)}).on("error",l).on("warn",u),new Promise(function(C,M){var O;try{s.parse(e),f()}catch(z){O=z}var P=i.element;!O&&!P&&(O=yr("failed to parse document as <"+i.type.$descriptor.name+">"));var F=a.warnings,D=a.references,I=a.elementsById;return O?(O.warnings=F,M(O)):C({rootElement:P,elementsById:I,references:D,warnings:F})})},Tu.prototype.handler=function(e){return new Mu(this.model,e)};function SE(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var RE=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,CE=/<|>|'|"|&|\n\r|\n/g,bh=/<|>|&/g;function Ti(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}Ti.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},Ti.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},Ti.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},Ti.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)},Ti.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},Ti.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},Ti.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},Ti.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},Ti.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 AE(e){return e.charAt(0).toLowerCase()+e.slice(1)}function PE(e,t){return mh(t)?AE(e):e}function xh(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function _h(e){return Hn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function ME(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 TE(e,t){return t.isGeneric?W({localName:t.ns.localName},e):W({localName:PE(t.ns.localName,t.$pkg)},e)}function kE(e,t){return W({localName:t.ns.localName},e)}function OE(e){var t=e.$descriptor;return Qe(t.properties,function(n){var i=n.name;if(n.isVirtual||!zn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var DE={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},IE={"<":"lt",">":"gt","&":"amp"};function wh(e,t,n){return e=Hn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function LE(e){return wh(e,CE,DE)}function BE(e){return wh(e,bh,IE)}function NE(e){return Qe(e,function(t){return t.isAttr})}function $E(e){return Qe(e,function(t){return!t.isAttr})}function ku(e){this.tagName=e}ku.prototype.build=function(e){return this.element=e,this},ku.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Jr(){}Jr.prototype.serializeValue=Jr.prototype.serializeTo=function(e){e.append(this.escape?BE(this.value):this.value)},Jr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(bh)!==-1&&(this.escape=!0),this};function Ou(e){this.tagName=e}xh(Ou,Jr),Ou.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Dt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Dt.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=OE(e),this.parseAttributes(NE(r)),this.parseContainments($E(r))),this.parseGenericAttributes(e,i),this},Dt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return TE(t,e)},Dt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return kE(t,e)},Dt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Dt.prototype.nsAttributeName=function(e){var t;if(Hn(e)?t=An(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:W({localName:t.localName},n)},Dt.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}))},Dt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Jr().build({type:"String"},t));var n=e.$children;n&&H(n,i=>{this.body.push(new Dt(this).build(i))})},Dt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=An(t),o;if(r.prefix==="xmlns"&&(o={prefix:r.localName,uri:n}),!r.prefix&&r.localName==="xmlns"&&(o={uri:n}),!o)return{name:t,value:n};if(i&&i.getPackage(n))this.logNamespace(o,!0,!0);else{var a=this.logNamespaceUsed(o,!0);this.getNamespaces().logUsed(a)}},Dt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return H(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},Dt.prototype.parseGenericAttributes=function(e,t){var n=this;H(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)}})},Dt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;H(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Jr().build(r,o[0]));else if(ch(r.type))H(o,function(l){n.push(new Ou(t.addTagName(t.nsPropertyTagName(r))).build(r,l))});else if(a)H(o,function(l){n.push(new ku(t.addTagName(t.nsPropertyTagName(r))).build(l))});else{var c=yh(r);H(o,function(l){var u;c?c===gh?u=new Dt(t,r):u=new Hs(t,r,c):u=new Dt(t),n.push(u.build(l))})}})},Dt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new Ti(i):t=i),t},Dt.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},Dt.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},Dt.prototype.parseAttributes=function(e){var t=this,n=this.element;H(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];H(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},Dt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),_h(e)},Dt.prototype.addAttribute=function(e,t){var n=this.attrs;Hn(t)&&(t=LE(t));var i=rh(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)},Dt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=ME(n).concat(t)),H(t,function(i){e.append(" ").append(_h(i.name)).append('="').append(i.value).append('"')})},Dt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Jr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),H(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Hs(e,t,n){Dt.call(this,e,t),this.serialization=n}xh(Hs,Dt),Hs.prototype.parseNsAttributes=function(e){var t=Dt.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},Hs.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function FE(){this.value="",this.write=function(e){this.value+=e}}function jE(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 HE(e){e=W({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new FE,o=new jE(r,e.format);e.preamble&&o.append(RE);var a=new Dt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(zE(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function zE(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Cu)n[i]=Cu[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function zs(e,t){li.call(this,e,t)}zs.prototype=Object.create(li.prototype),zs.prototype.fromXML=function(e,t,n){Hn(t)||(n=t,t="bpmn:Definitions");var i=new Tu(W({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},zs.prototype.toXML=function(e,t){var n=new HE(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var GE="BPMN20",VE="http://www.omg.org/spec/BPMN/20100524/MODEL",WE="bpmn",UE=[],YE=[{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"}]}],qE=[{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"}]}],KE={tagAlias:"lowerCase",typePrefix:"t"},XE={name:GE,uri:VE,prefix:WE,associations:UE,types:YE,enumerations:qE,xml:KE},ZE="BPMNDI",QE="http://www.omg.org/spec/BPMN/20100524/DI",JE="bpmndi",e1=[{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"]}],t1=[{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"}]}],n1=[],i1={name:ZE,uri:QE,prefix:JE,types:e1,enumerations:t1,associations:n1},r1="DC",o1="http://www.omg.org/spec/DD/20100524/DC",a1="dc",s1=[{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}]}],c1=[],l1={name:r1,uri:o1,prefix:a1,types:s1,associations:c1},u1="DI",p1="http://www.omg.org/spec/DD/20100524/DI",f1="di",d1=[{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"}]}],h1=[],m1={tagAlias:"lowerCase"},g1={name:u1,uri:p1,prefix:f1,types:d1,associations:h1,xml:m1},y1="bpmn.io colors for BPMN",v1="http://bpmn.io/schema/bpmn/biocolor/1.0",b1="bioc",x1=[{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"}]}],_1=[],w1=[],E1={name:y1,uri:v1,prefix:b1,types:x1,enumerations:_1,associations:w1},S1="BPMN in Color",R1="http://www.omg.org/spec/BPMN/non-normative/color/1.0",C1="color",A1=[{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"}]}],P1=[],M1=[],T1={name:S1,uri:R1,prefix:C1,types:A1,enumerations:P1,associations:M1};const k1={bpmn:XE,bpmndi:i1,dc:l1,di:g1,bioc:E1,color:T1};function Eh(e,t){const n=W({},k1,e);return new zs(n,t)}const O1={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"}},D1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Sh="i18n",Gs={[Sh]:O1,[mu]:Jd};function Rh(){return Eh(Gs)}const Ch=Rh();async function ko(e){const{rootElement:t,warnings:n}=await Ch.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function I1(e){const{xml:t}=await Ch.toXML(e,{format:!0});return t}function Du(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const Oo={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},L1=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function B1(e){const t=Oo;return L1.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 Do(e,t){let n=0;for(const i of e)n+=t*B1(i);return n}function Ah(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&N1(e),$1(e),F1(e),j1(e)}function N1(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:Do(r,o),fontBoundingBoxAscent:o*Oo.ascentEm,fontBoundingBoxDescent:o*Oo.descentEm,actualBoundingBoxAscent:o*Oo.ascentEm,actualBoundingBoxDescent:o*Oo.descentEm}}};t.getContext=()=>n}function $1(e){if(e.SVGMatrix)return;class t{constructor(){So(this,"a",1);So(this,"b",0);So(this,"c",0);So(this,"d",1);So(this,"e",0);So(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 F1(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,l=0){const u=s*Math.PI/180,f=Math.cos(u),p=Math.sin(u);a.a=f,a.b=p,a.c=-p,a.d=f,a.e=c-f*c+p*l,a.f=l-p*c-f*l},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 j1(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:Do(n,12),height:14}})}const Vs=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),H1=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),z1=1,Iu=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),G1=2;function Tt(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 Ph=20,Ws=5,Mh=3,V1=8,Th=12,W1=Th*1.2;function Lu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>Do(o,Th))),r=n.length*W1;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const kh=1;function In(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 Io(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 In(e))for(const s of In(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>kh)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const l=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);l>=Ph&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function Bu(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Oh(e,t){const n=Io(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function U1(e,t){let n=0;for(const i of t)i.id!==e.id&&Oh(e,i)&&n++;return n}function ii(e,t){let n=0;for(const i of t)i.id!==e.id&&Io(e,i)&&n++;return n}const Dh=15,Ih=20;function Y1(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Ih||t.at>n[1]+Ih)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 Nu=20;function Us(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>kh)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Ph||n.push([r-Nu,o+Nu])}return n}function Ys(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of In(e)){const o=Y1(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Us(r,In(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const q1=10,K1=1,X1=(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 Z1(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,l=t.y-e.y;let u=0,f=1;const p=(d,m)=>{if(m===0)return d<=0;const h=d/m;if(m>0){if(h>f)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<f&&(f=h)}return!0};return p(r-e.x,c)&&p(e.x-a,-c)&&p(o-e.y,l)&&p(e.y-s,-l)&&f>u}function $u(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 Q1=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Lo=1;function Ki(e,t){const n=e.x+Lo,i=e.x+e.width-Lo,r=e.y+Lo,o=e.y+e.height-Lo;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 Aa(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 Lh(e,t){const n=e.label;if(!n)return null;if(In(e).some(i=>Ki(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(In(i).some(r=>Ki(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Aa(i).some(r=>Ki(n,r)))return i.id;return null}function yn(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(Z1(e.waypoints[o],e.waypoints[o+1],r,G1)){i.push(r);break}}return i}const Pa=(e,t,n)=>{const i=n.x-t.x,r=n.y-t.y,o=i*i+r*r,a=o===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*r)/o));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*r))},J1=(e,t,n,i)=>Nh(e,t,n,i)?0:Math.min(Pa(e,n,i),Pa(t,n,i),Pa(n,e,t),Pa(i,e,t)),Bh=(e,t)=>{let n=!1;for(let i=0,r=t.length-1;i<t.length;r=i++){const o=t[i],a=t[r];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n};function qs(e,t,n){const{x:i,y:r,width:o,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(o,a)/2;return Math.max(0,Pa({x:i+o/2,y:r+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+o/2,y:r},{x:i+o,y:r+a/2},{x:i+o/2,y:r+a},{x:i,y:r+a/2}]:[{x:i,y:r},{x:i+o,y:r},{x:i+o,y:r+a},{x:i,y:r+a}];if(Bh(e,s)||Bh(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,J1(e,t,s[l],s[(l+1)%s.length]));return c}function Nh(e,t,n,i){const r=(l,u,f)=>(u.x-l.x)*(f.y-l.y)-(u.y-l.y)*(f.x-l.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 $h=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Ma(e,t){let n=0;for(const i of t){if(i.id===e.id||$h(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++)Nh(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function ri(e,t){let n=0;for(const i of t)i.id===e.id||$h(e,i)||Ma(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Fh(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++)Ma(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Ks(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Ma(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 jh(e){const t=Ks(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),l=i.get(s);if(!c||!l)continue;const u=n(c.type),f=n(l.type);u==="solid"&&f==="solid"?r++:u==="dashed"&&f==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:eS(e)}}function eS(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(l=>l.id!==o.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function Hh(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!Iu.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 zh(e){var n;const t=(n=kt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=kt(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 Gh=e=>e?{members:e}:{},oi=e=>e.shapes.filter(t=>!t.container);function tS(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&&o.type!=="bpmn:Group"){if(o.container)return o.id;if(o.parent)return o.parent}}}function nS(e,t,n){if(e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height)return!0;const r=e.x+e.width/2,o=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&r>=a.x&&r<=a.x+a.width&&o>=a.y&&o<=a.y+a.height)}function Vh(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(In(i).some(r=>Ki(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Aa(i).some(r=>Ki(n,r)))return i.id;return null}function Bo(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 It(e){const t=[],n=e.shapes.filter(v=>!v.container);for(const v of e.edges)for(const g of yn(v,n))t.push({kind:"edge-crosses-shape",edge:v.id,shape:g.id});const i=e.shapes.filter(v=>v.container&&H1.has(v.type));if(i.length){const v=(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 yn(g,i))g.endpoints.includes(b.id)||g.endpoints.some(x=>v(b,x))||t.push({kind:"edge-crosses-subprocess",edge:g.id,subProcess:b.id})}for(const v of e.edges){if(v.waypoints.length<2)continue;const g=[[v.source,v.waypoints[0]],[v.target,v.waypoints[v.waypoints.length-1]]];for(const[b,x]of g){if(!b)continue;const C=e.shapes.find(F=>F.id===b);if(!C||C.container)continue;const M=Math.max(C.x-x.x,x.x-(C.x+C.width),0),O=Math.max(C.y-x.y,x.y-(C.y+C.height),0),P=Math.hypot(M,O);P>q1&&t.push({kind:"edge-endpoint-detached",edge:v.id,shape:b,distance:Math.round(P)})}}const r=e.shapes.filter(v=>v.type==="bpmn:Participant");for(let v=0;v<r.length;v++)for(let g=v+1;g<r.length;g++){const b=r[v],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,O)=>M.x<=O.x&&M.y<=O.y&&M.x+M.width>=O.x+O.width&&M.y+M.height>=O.y+O.height;t.push({kind:"pool-overlap",pools:[b.id,x.id],contained:C(b,x)||C(x,b)})}const o=n.filter(v=>!v.attached);for(let v=0;v<o.length;v++)for(let g=v+1;g<o.length;g++){const b=o[v],x=o[g];if(!$u(b,x,z1))continue;const C=b.id<x.id?[b.id,x.id]:[x.id,b.id];t.push({kind:"shape-overlap",shapes:C,identical:Q1(b,x)})}const a=e.shapes.filter(v=>v.type==="bpmn:Group"&&Array.isArray(v.members)&&v.members.length>0);for(let v=0;v<a.length;v++)for(let g=v+1;g<a.length;g++){const b=a[v],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<=Ws||M<=Ws)continue;const O=b.id<x.id?[b.id,x.id]:[x.id,b.id],P=new Set(x.members);if(b.members.some(D=>P.has(D))){const D=Hh(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:O,shapes:D});continue}const F=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:O,...F?{container:F}:{}})}const s=new Set(a.flatMap(v=>[...v.members])),c=v=>e.shapes.filter(g=>!g.container&&!Iu.has(g.type)&&g.x>=v.x&&g.y>=v.y&&g.x+g.width<=v.x+v.width&&g.y+g.height<=v.y+v.height);for(const v of a){const g=c(v);if(!g.length)continue;const b=new Set(v.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:v.id,shapes:x.map(C=>C.id).sort()}))}for(const v of a){const g=new Set(c(v).map(P=>P.id)),b=new Set(v.members),x=new Set([...g].filter(P=>!b.has(P)&&s.has(P)));if(!x.size)continue;let C=!1,M=!1,O=!1;for(const P of e.edges){if(P.type!=="bpmn:SequenceFlow"||!P.source||!P.target)continue;const F=x.has(P.source),D=x.has(P.target);!F&&D&&!g.has(P.source)?C=!0:F&&!D&&!g.has(P.target)?M=!0:F&&D&&(O=!0)}C&&M&&O&&t.push({kind:"group-overlap-unreadable",reason:"throughpass",group:v.id,shapes:[...x].sort()})}const l=e.shapes.filter(v=>v.type==="bpmn:Group");for(let v=0;v<l.length;v++)for(let g=v+1;g<l.length;g++)for(let b=g+1;b<l.length;b++){const x=[l[v],l[g],l[b]],C={x:Math.max(...x.map(P=>P.x)),y:Math.max(...x.map(P=>P.y)),right:Math.min(...x.map(P=>P.x+P.width)),bottom:Math.min(...x.map(P=>P.y+P.height))};if(C.right-C.x<=Ws||C.bottom-C.y<=Ws)continue;const M=Hh(e,[],C);if(!M.length)continue;const O=x.map(P=>P.id).sort();t.push({kind:"group-stack-unreadable",groups:O,shapes:M})}for(const v of e.shapes.filter(g=>g.type==="bpmn:Group"))for(const g of e.shapes){if(g.container||g.attached||Iu.has(g.type)||g.width<=0||g.height<=0)continue;const b=[["top",v.y,"h",v.x,v.x+v.width],["bottom",v.y+v.height,"h",v.x,v.x+v.width],["left",v.x,"v",v.y,v.y+v.height],["right",v.x+v.width,"v",v.y,v.y+v.height]];for(const[x,C,M,O,P]of b){const F=M==="h"?g.x:g.y,D=M==="h"?g.x+g.width:g.y+g.height;if(!(F<P&&O<D))continue;const I=M==="h"?g.y:g.x,z=M==="h"?g.y+g.height:g.x+g.width;if(!(I<C&&C<z))continue;const ce=Math.min(C-I,z-C);ce<V1||t.push({kind:"group-cuts-shape",group:v.id,shape:g.id,side:x,depth:ce})}}const u=e.shapes.filter(v=>v.container&&v.type!=="bpmn:Group"&&v.type!=="bpmn:Lane");for(const v of e.shapes.filter(g=>g.type==="bpmn:Group"))for(const g of u){const b=v.x<g.x+g.width&&g.x<v.x+v.width,x=v.y<g.y+g.height&&g.y<v.y+v.height,C=[["top",v.y,g.y,b],["bottom",v.y+v.height,g.y+g.height,b],["left",v.x,g.x,x],["right",v.x+v.width,g.x+g.width,x]];for(const[M,O,P,F]of C)F&&Math.abs(O-P)<=Mh&&t.push({kind:"group-on-container-boundary",group:v.id,container:g.id,side:M})}const f=e.shapes.filter(v=>v.type==="bpmn:Group");for(let v=0;v<f.length;v++)for(let g=v+1;g<f.length;g++){const b=f[v],x=f[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,O=[["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[P,F,D,I]of O)if(I&&Math.abs(F-D)<=Mh){t.push({kind:"group-on-group-boundary",groups:b.id<x.id?[b.id,x.id]:[x.id,b.id],axis:P});break}}for(let v=0;v<e.edges.length;v++)for(let g=v+1;g<e.edges.length;g++){const b=e.edges[v],x=e.edges[g],C=Io(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 v of e.edges){if(!v.label)continue;const g=Ys(v,e.edges);g&&t.push({kind:"label-on-shared-segment",edge:v.id,other:g.other,axis:g.axis})}for(const v of e.edges){if(!v.label)continue;const g=Lh(v,e);g&&t.push({kind:"label-over-line",edge:v.id,line:g})}const p=new Set(n.map(v=>v.id)),d=e.shapes.filter(v=>v.type==="bpmn:Participant"&&v.label);for(const v of[...n,...d.filter(g=>!p.has(g.id))]){if(!v.label)continue;const g=Vh(v,e);g&&t.push({kind:"label-over-line",edge:v.id,line:g})}const m=new Set(e.shapes.filter(v=>v.type==="bpmn:TextAnnotation").map(v=>v.id));for(const v of d)for(const{owner:g,rect:b}of Bo(e))g===v.id||m.has(g)||$u(v.label,b,Lo)&&t.push({kind:"pool-name-over-label",pool:v.id,label:g});const h=Bo(e);for(const v of n)if(v.type==="bpmn:TextAnnotation")for(const{owner:g,rect:b}of h)g!==v.id&&$u(v,b,Lo)&&t.push({kind:"annotation-over-label",annotation:v.id,label:g});const y=new Map(e.shapes.map(v=>[v.id,v]));for(const v of n){const g=v.parent??tS(v,e,y);if(!g)continue;const b=y.get(g);!b||!b.container||X1(b,v,K1)||v.type==="bpmn:TextAnnotation"&&!nS(v,b,e)||t.push({kind:"shape-outside-container",shape:v.id,container:b.id})}return t.sort((v,g)=>Tt(v).localeCompare(Tt(g)))}const kt=e=>typeof e=="object"&&e!==null?e:void 0,Vt=e=>typeof e=="number"?e:0,Xi=e=>{const t=kt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function iS(e){const t=kt(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=Xi(o);a&&n.push(a)}}return n}function rS(e){const t=kt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Xi(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Xi(t.targetRef);return n&&i?{source:n,target:i}:{}}function oS(e,t){const n=kt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Xi(n);return r?t.get(r):void 0}if(Vs.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Xi(n)}function Wh(e){var a,s,c,l,u;const t=[],n=[],i=((a=kt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=kt(e))==null?void 0:s.rootElements)??[]){const p=kt(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const m=kt(d),h=Xi(m),y=Xi(m==null?void 0:m.processRef);h&&y?r.set(y,h):h&&o.add(h)}}for(const f of i){const p=kt((c=kt(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const m of d){const h=kt(m);if(!h)continue;const y=kt(h.bpmnElement),v=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!v)continue;const g=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",b=kt(h.bounds);if(b){const C=h.isExpanded===!1&&g!=="bpmn:Participant",M=kt((l=kt(h.label))==null?void 0:l.bounds),O={id:v,type:g,x:Vt(b.x),y:Vt(b.y),width:Vt(b.width),height:Vt(b.height),container:Vs.has(g)&&!C,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:oS(y,r)}:{},...M?{label:{x:Vt(M.x),y:Vt(M.y),width:Vt(M.width),height:Vt(M.height)}}:{},...g==="bpmn:Group"?Gh(zh(y)):{}},P=h.isHorizontal!==!1,F=typeof(y==null?void 0:y.name)=="string"?y.name:"";o.has(v)&&P&&F&&(O.label=Lu(O,F)),t.push(O);continue}const x=h.waypoint;if(Array.isArray(x)){const C=kt((u=kt(h.label))==null?void 0:u.bounds);n.push({id:v,type:g,waypoints:x.map(M=>{var O,P;return{x:Vt((O=kt(M))==null?void 0:O.x),y:Vt((P=kt(M))==null?void 0:P.y)}}),endpoints:iS(y),...rS(y),...C?{label:{x:Vt(C.x),y:Vt(C.y),width:Vt(C.width),height:Vt(C.height)}}:{}})}}}return{shapes:t,edges:n}}function Uh(e){return It(Wh(e))}async function aS(e){const{definitions:t,warnings:n}=await ko(e);return{findings:Uh(t),warnings:n}}function tt(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=kt(o.label),y=Xi(o.source),v=Xi(o.target);n.push({id:o.id,type:a,waypoints:s.map(g=>({x:Vt(g.x),y:Vt(g.y)})),endpoints:[y,v].filter(g=>!!g),...y&&v?{source:y,target:v}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Vt(h.y),width:Vt(h.width),height:Vt(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=kt(o.businessObject),l=kt(o.label);let u=kt(o.parent);for(;u&&u.type==="bpmn:Lane";)u=kt(u.parent);const f=typeof(u==null?void 0:u.type)=="string"?u.type:"",p=u&&Vs.has(f)&&f!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Vt(o.width),height:Vt(o.height),container:Vs.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Vt(l.y),width:Vt(l.width),height:Vt(l.height)}}:{},...a==="bpmn:Group"?Gh(zh(c)):{}},m=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&m&&((i=kt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Lu(d,m)),t.push(d)}return{shapes:t,edges:n}}const sS={"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 cS(e,t){const n=sS[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Yh(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function qh(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 cS(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Yh(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Yh(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 Fu=20,lS=4,Rt=(e,t)=>Math.abs(e-t)<.5;function Xs(e,t,n,i=Fu){if(Rt(e.y,t.y)&&!Rt(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=l=>[{x:a,y:e.y},{x:a,y:l},{x:s,y:l},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(Rt(e.x,t.x)&&!Rt(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=l=>[{x:e.x,y:a},{x:l,y:a},{x:l,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function Kh(e,t,n,i=Fu){if(n.length<2)return null;if(Rt(e.y,t.y)&&!Rt(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,l=e.x<t.x?s:a,u=Math.min(...n.map(d=>d.y))-i,f=Math.max(...n.map(d=>d.y+d.height))+i,p=d=>[{x:c,y:e.y},{x:c,y:d},{x:l,y:d},{x:l,y:e.y}];return[p(u),p(f)]}if(Rt(e.x,t.x)&&!Rt(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,l=e.y<t.y?s:a,u=Math.min(...n.map(d=>d.x))-i,f=Math.max(...n.map(d=>d.x+d.width))+i,p=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:l},{x:e.x,y:l}];return[p(u),p(f)]}return null}function Xh(e,t,n=Fu){if(e.length!==4)return null;const[i,r,o,a]=e;if(Rt(i.y,r.y)&&Rt(r.x,o.x)&&Rt(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(Rt(i.x,r.x)&&Rt(r.y,o.y)&&Rt(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 Zs(e,t){if(e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,l=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[l,u]}const Zh=30,uS=[0,-25,25,-40,40];function pS(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+Zh:s-Zh,l=a?i.y+i.height:i.y,u=n.x+n.width/2,f=i.x+i.width/2;return uS.map(p=>[{x:u,y:s},{x:u,y:c},{x:f+p,y:c},{x:f+p,y:l}])}const ju=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],No=(e,t,n)=>yn({...e,waypoints:t},n).length;function Hu(e,t,n,i){let r=[...e.waypoints],o=No(e,r,t);if(o===0)return null;let a=!1;for(const f of Zs(e,t))if(No(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(In),c=f=>In({...e,waypoints:f}).some(p=>Us(p,s).length>0),l=pS(e,t).filter(f=>No(e,f,t)===0);if(l.length)return l.find(f=>!c(f))??l[0];const u=f=>!n||f.every(p=>p.x>=n.x&&p.x<=n.x+n.width&&p.y>=n.y&&p.y<=n.y+n.height);if(e.endpoints.length===2&&r.length>2){const f=t.find(d=>d.id===e.endpoints[0]),p=t.find(d=>d.id===e.endpoints[1]);if(f&&p&&Rt(f.y+f.height/2,p.y+p.height/2)){const d=[r[0],r[r.length-1]];if(Rt(d[0].y,d[1].y)&&!Rt(d[0].x,d[1].x)){const m=t.filter(g=>!e.endpoints.includes(g.id)&&yn({...e,waypoints:d},[g]).length>0),h=m.length>=2?Kh(d[0],d[1],m):null,v=(h?h.map(g=>[d[0],...g,d[1]]):m.length===1?(Xs(d[0],d[1],m[0])??[]).map(g=>[d[0],...g,d[1]]):m.length===0?[d]:[]).filter(g=>No(e,g,t)===0&&g.length<=r.length).sort((g,b)=>Number(u(b))-Number(u(g)));if(v.length)return v.find(g=>!c(g))??v[0]}}}for(let f=0;f+1<r.length;f++){const p=r[f],d=r[f+1],m=t.filter(v=>!e.endpoints.includes(v.id)&&yn({...e,waypoints:[p,d]},[v]).length>0);if(m.length<2)continue;const h=Kh(p,d,m);if(!h)continue;const y=h.map(v=>ju(r,f,v)).filter(v=>No(e,v,t)===0).sort((v,g)=>Number(u(g))-Number(u(v)));if(y.length)return y.find(v=>!c(v))??y[0]}for(let f=0;f<lS&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const m=r[d],h=r[d+1];for(const y of t){if(e.endpoints.includes(y.id)||yn({...e,waypoints:[m,h]},[y]).length===0)continue;const v=Xs(m,h,y),g=v?v.map(x=>ju(r,d,x)):Xh(r,y)??[];if(!g.length)continue;const b=[...g].sort((x,C)=>Number(u(C))-Number(u(x)));for(const x of b){const C=No(e,x,t);if(C<o){r=x,o=C,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function zu(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=tt(i),a=oi(o),s=new Set,c=It(o).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(Tt(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const f=o.edges.find(p=>p.id===u.edge);f&&l.set(u.edge,f)}for(const[u,f]of l){if(n&&!n.has(u))continue;const p=i.get(u);if(!p)continue;const d=p.parent,m=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=Hu(f,a,m,o.edges);if(!h){yn(f,a).some(b=>b.type==="bpmn:TextAnnotation")&&s.add(u);continue}const y=o.edges.filter(b=>b.id!==u),v=ii(f,y);ii({...f,waypoints:h},y)>v||r.updateWaypoints(p,h)}return s}const fS=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},Gu=(e,t)=>Ma(e,[t])>0;function Qh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=tt(i),a=oi(o);let s=o;const c=new Set(It(o).map(Tt));for(const[l,u]of Ks(o))if(!t.has(`${l}|${u}`))for(const[f,p]of[[l,u],[u,l]]){if(n.has(f))continue;const d=s.edges.find(F=>F.id===f),m=s.edges.find(F=>F.id===p);if(!d||!m)continue;const h=i.get(f);if(!h)continue;const y=h.parent,v=y&&typeof y.x=="number"&&typeof y.width=="number"?{x:y.x,y:y.y,width:y.width,height:y.height}:void 0,g=fS(m),b=[...Zs(d,a)??[]],x=Hu(d,[...a,...g],v,o.edges);x&&b.push(x);for(let F=0;F+1<d.waypoints.length;F++)for(const D of g)for(const I of Xs(d.waypoints[F],d.waypoints[F+1],D)??[])b.push(ju(d.waypoints,F,I));const C=s.edges.filter(F=>F.id!==f),M=F=>({...s,edges:s.edges.map(D=>D.id===f?{...D,waypoints:F}:D)}),O=F=>!v||F.every(D=>D.x>=v.x&&D.x<=v.x+v.width&&D.y>=v.y&&D.y<=v.y+v.height),P=b.find(F=>{const D={...d,waypoints:F};return Gu(D,m)||!O(F)||C.some(I=>I.id!==p&&!Gu(d,I)&&Gu(D,I))?!1:It(M(F)).every(I=>c.has(Tt(I)))});if(P){r.updateWaypoints(h,P),s=M(P);break}}}const dS=10;function Jh(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 em(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=Jh(i,n),a=Jh(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,l=s?a:o,u=n.filter(z=>z.id!==o.id&&z.id!==a.id&&z.y>=c.y+c.height&&z.y+z.height<=l.y).sort((z,ce)=>z.y-ce.y);if(!u.length)return null;const f=u[0],p=u[u.length-1],d=(c.y+c.height+f.y)/2,m=(p.y+p.height+l.y)/2,h=s?d:m,y=s?m:d,v=e.waypoints[0],g=e.waypoints[e.waypoints.length-1],b=oi(t),x=t.edges.filter(z=>z.id!==e.id),C=ri(e,x),M=yn(e,b).length;if(C===0&&M===0||M===0&&e.waypoints.length===2)return null;const O=Math.min(...u.map(z=>z.x)),P=Math.max(...u.map(z=>z.x+z.width)),F=(v.x+g.x)/2,D=z=>z.filter((ce,ve)=>ve===0||!(Rt(ce.x,z[ve-1].x)&&Rt(ce.y,z[ve-1].y)));let I;for(let z=O;z<=P;z+=dS){const ce=D([v,{x:v.x,y:h},{x:z,y:h},{x:z,y},{x:g.x,y},g]),ve={...e,waypoints:ce};if(yn(ve,b).length>0)continue;const Ye=ri(ve,x),He=Math.abs(z-F);(!I||Ye<I.cross||Ye===I.cross&&He<I.detour)&&(I={pts:ce,cross:Ye,detour:He})}return I&&(M>0?I.cross<=C:I.cross<C)?I.pts:null}function tm(e,t){const{elementRegistry:n}=e,i=e.modeling,r=tt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=tt(n),s=a.edges.find(u=>u.id===o.id);if(!s)continue;const c=em(s,a);if(!c)continue;const l=n.get(o.id);l&&i.updateWaypoints(l,c)}}const ki=[25,-25,40,-40],$o=35;function hS(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)-$o:Math.max(e.y+e.height,t.y+t.height)+$o;for(const l of[0,...ki])if(!(Math.abs(l)>=e.width/2-5))for(const u of[0,...ki]){if(Math.abs(u)>=t.width/2-5)continue;const f=n+l,p=i+u;r.push({pts:[{x:f,y:a},{x:f,y:c},{x:p,y:c},{x:p,y:s}],cost:Math.abs(u)+Math.abs(l)})}}return r}function Qs(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 hS(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,l=s?n.y:n.y+n.height,u=s?n.y-$o:n.y+n.height+$o,f=[];for(const g of[0,...ki]){if(Math.abs(g)>=i.width/2-5)continue;const b=o+g;f.push({pts:[{x:n.x,y:r},{x:b,y:r},{x:b,y:c}],cost:Math.abs(g)});for(const x of[0,...ki]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;f.push({pts:[{x:C,y:l},{x:C,y:u},{x:b,y:u},{x:b,y:c}],cost:Math.abs(g)+Math.abs(x)})}}const p=50,d=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const g of[0,...ki]){if(Math.abs(g)>=n.width/2-5)continue;const b=a+g;f.push({pts:[{x:b,y:m},{x:b,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(g)})}const h=60,y=s?i.y+i.height:i.y,v=s?i.y+i.height+$o:i.y-$o;for(const g of[0,...ki]){if(Math.abs(g)>=i.width/2-5)continue;const b=o+g;for(const x of[0,...ki]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;f.push({pts:[{x:C,y:m},{x:C,y:v},{x:b,y:v},{x:b,y}],cost:h+Math.abs(g)+Math.abs(x)})}}return f}const Js=30;function nm(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Rt(i.y,r.y)&&!Rt(i.x,r.x),a=Rt(i.x,r.x)&&!Rt(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)<Js||Math.abs(i.y-(s.y+s.height))<Js)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)<Js||Math.abs(i.x-(s.x+s.width))<Js)return!0}}return!1}const ec=40;function mS(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-ec,a=r.x+r.width+ec,s=r.y-ec,c=r.y+r.height+ec;for(let l=1;l<e.length-2;l++){const u=e[l],f=e[l+1],p={x:Math.min(u.x,f.x),y:Math.min(u.y,f.y)},d={x:Math.max(u.x,f.x),y:Math.max(u.y,f.y)};if(p.x<a&&d.x>o&&p.y<c&&d.y>s){i++;break}}}return i}function im(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=oi(t),o=t.edges.filter(M=>M.id!==e.id),a=ii(e,o),s=ri(e,o),c=M=>mS(M,t.shapes,e.endpoints)+(nm(M,n)?1:0),l=c(e.waypoints),u=M=>{if(!M)return;const O=M.x+M.width/2,P=M.y+M.height/2;return n.find(F=>F.type==="bpmn:Lane"&&O>=F.x&&O<=F.x+F.width&&P>=F.y&&P<=F.y+F.height)},f=u(i.get(e.endpoints[0]??"")),p=u(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,m=M=>{if(!d||!p)return!1;for(let O=1;O<M.length-2;O++){const P=M[O],F=M[O+1];if(Rt(P.y,F.y)&&!Rt(P.x,F.x)&&P.y>p.y&&P.y<p.y+p.height)return!0}return!1},h=m(e.waypoints),v=(M=>{if(!M)return;const O=M.x+M.width/2,P=M.y+M.height/2;return n.filter(F=>F.type==="bpmn:Participant"&&O>=F.x&&O<=F.x+F.width&&P>=F.y&&P<=F.y+F.height).sort((F,D)=>F.width*F.height-D.width*D.height)[0]})(i.get(e.endpoints[0]??"")),g=M=>{if(!v)return 0;let O=0;for(let P=1;P<M.length-1;P++){const F=M[P];(F.x<v.x||F.x>v.x+v.width||F.y<v.y||F.y>v.y+v.height)&&O++}return O},b=g(e.waypoints);if(!nm(e.waypoints,n)&&!(d&&!h)&&b===0)return null;const x=M=>M.reduce((O,P,F)=>F?O+Math.abs(P.x-M[F-1].x)+Math.abs(P.y-M[F-1].y):0,0);let C;for(const{pts:M,cost:O}of Qs(e,i)){const P={...e,waypoints:M};if(yn(P,r).length>0)continue;const F=ii(P,o);if(F>a)continue;const D=g(M);if(D>b)continue;const I=D<b&&F===0;if(!I&&ri(P,o)>s)continue;const z=c(M),ce=m(M);if(!I&&!(ce&&!h)&&z>=l)continue;const Ye=ce?0:1,He=x(M);(!C||D<C.out||D===C.out&&(Ye<C.lane||Ye===C.lane&&(F<C.opp||F===C.opp&&(z<C.sc||z===C.sc&&(O<C.cost||O===C.cost&&He<C.len)))))&&(C={pts:M,out:D,sc:z,lane:Ye,opp:F,cost:O,len:He})}return(C==null?void 0:C.pts)??null}function gS(e,t){const{elementRegistry:n}=e,i=e.modeling,r=tt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=tt(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=oi(a),l=a.edges.filter(d=>d.id!==o),u=yn(s,c).length,f=ii(s,l),p=ri(s,l);for(const d of Zs(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const m={...s,waypoints:d};if(yn(m,c).length>u||ii(m,l)>f||ri(m,l)>p)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function rm(e,t){const{elementRegistry:n}=e,i=e.modeling,r=tt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=tt(n),s=a.edges.find(u=>u.id===o);if(!s)continue;const c=im(s,a);if(!c)continue;const l=n.get(o);l&&i.updateWaypoints(l,c)}}function Vu(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=Rt(n[0].x,n[1].x)&&!Rt(n[0].y,n[1].y),s=Rt(n[n.length-1].x,n[n.length-2].x)&&!Rt(n[n.length-1].y,n[n.length-2].y);for(const c of ki){if(a&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}function yS(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,l=n.y+n.height/2,u=i.x+i.width/2,f=i.y+i.height/2,p=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,m=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,y=[];for(const v of[0,...ki])Math.abs(v)<i.width/2-5&&y.push({pts:[{x:p,y:l},{x:u+v,y:l},{x:u+v,y:h}],cost:Math.abs(v)}),Math.abs(v)<i.height/2-5&&y.push({pts:[{x:c,y:d},{x:c,y:f+v},{x:m,y:f+v}],cost:Math.abs(v)});return y}function Wu(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,l=a?i.y+i.height:i.y,u=(r+o)/2,f=[];for(const p of[0,...ki]){const d=u+p;d<=r||d>=o||f.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(p)})}return f}function om(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=oi(t),r=t.edges.filter(d=>d.id!==e.id),o=ii(e,r);if(o===0)return null;const a=ri(e,r);let s;const c=d=>d.reduce((m,h,y)=>y?m+Math.abs(h.x-d[y-1].x)+Math.abs(h.y-d[y-1].y):0,0),l=3,u=d=>{const m=d[0],h=d[d.length-1],y=Math.hypot(h.x-m.x,h.y-m.y);return y>=1&&c(d)/y>=l?1:0},f=u(e.waypoints),p=[...Qs(e,n),...Wu(e,n),...Vu(e,n)];for(const{pts:d,cost:m}of p){const h={...e,waypoints:d};if(yn(h,i).length>0)continue;const y=ii(h,r),v=ri(h,r),g=o-y+(f-u(d));if(y>=o||v-a>g)continue;const b=c(d);(!s||y<s.opposite||y===s.opposite&&(v<s.cross||v===s.cross&&(m<s.cost||m===s.cost&&b<s.len)))&&(s={pts:d,opposite:y,cross:v,cost:m,len:b})}return(s==null?void 0:s.pts)??null}function am(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=Io(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function vS(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=oi(t),r=t.edges.filter(p=>p.id!==e.id),o=am(e,r);if(o===0)return null;const a=ii(e,r),s=ri(e,r),c=p=>p.reduce((d,m,h)=>h?d+Math.abs(m.x-p[h-1].x)+Math.abs(m.y-p[h-1].y):0,0),l=2;let u;const f=[...Qs(e,n),...Wu(e,n),...yS(e,n),...Vu(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(yn(m,i).length>0)continue;const h=am(m,r);if(h>=o)continue;const y=ii(m,r);if(y-h>a-o)continue;const v=ri(m,r);if(v-s>(o-h)*l)continue;const g=c(p);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(v<u.cross||v===u.cross&&(d<u.cost||d===u.cost&&g<u.length))))&&(u={pts:p,fake:h,unreadable:y,cross:v,cost:d,length:g})}return(u==null?void 0:u.pts)??null}function sm(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=It(tt(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(Tt(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=tt(i),l=c.edges.find(p=>p.id===s);if(!l)continue;const u=vS(l,c);if(!u)continue;const f=i.get(s);f&&r.updateWaypoints(f,u)}}function cm(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 lm(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Io(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(u=>u&&(u===o||u===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:cm(e,n)&&cm(t,n)}function um(e,t,n){let i=0;for(const r of t)r.id!==e.id&&lm(e,r,n)&&i++;return i}function bS(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=oi(t),r=t.edges.filter(p=>p.id!==e.id),o=um(e,r,n);if(o===0)return null;const a=ii(e,r),s=ri(e,r),c=p=>p.reduce((d,m,h)=>h?d+Math.abs(m.x-p[h-1].x)+Math.abs(m.y-p[h-1].y):0,0),l=2;let u;const f=[...Qs(e,n),...Wu(e,n),...Vu(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(yn(m,i).length>0)continue;const h=um(m,r,n);if(h>=o)continue;const y=ii(m,r);if(y-h>a-o)continue;const v=ri(m,r);if(v-s>(o-h)*l)continue;const g=c(p);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(v<u.cross||v===u.cross&&(d<u.cost||d===u.cost&&g<u.length))))&&(u={pts:p,chain:h,unreadable:y,cross:v,cost:d,length:g})}return(u==null?void 0:u.pts)??null}function xS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=tt(i),a=new Map(o.shapes.map(l=>[l.id,l])),s=It(o).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(Tt(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,f]=l.edges.map(p=>o.edges.find(d=>d.id===p));if(!(!u||!f||!lm(u,f,a)))for(const p of l.edges)n.has(p)||c.add(p)}for(const l of[...c].sort()){const u=tt(i),f=u.edges.find(m=>m.id===l);if(!f)continue;const p=bS(f,u);if(!p)continue;const d=i.get(l);d&&r.updateWaypoints(d,p)}}function pm(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=tt(i),a=It(o).filter(u=>Bu(u)&&!t.has(Tt(u)));if(!a.length)return;const s=new Set;for(const u of a)if(Bu(u))for(const f of u.edges)n.has(f)||s.add(f);const c=u=>{var f;return((f=o.edges.find(p=>p.id===u))==null?void 0:f.type)??""},l=[...s].sort((u,f)=>{const p=c(u)==="bpmn:SequenceFlow"?0:1,d=c(f)==="bpmn:SequenceFlow"?0:1;return p!==d?p-d:u.localeCompare(f)});for(const u of l){const f=tt(i),p=f.edges.find(h=>h.id===u);if(!p)continue;const d=om(p,f);if(!d)continue;const m=i.get(u);m&&r.updateWaypoints(m,d)}}const _S=10,wS=(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 fm(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Ys(e,i))return null;const r=oi(t),o=i.flatMap(In);for(const a of In(e)){let s=[[a.lo,a.hi]];for(const[d,m]of Us(a,o))s=s.flatMap(([h,y])=>{const v=[];return d>h&&v.push([h,Math.min(y,d)]),m<y&&v.push([Math.max(h,m),y]),v.filter(([g,b])=>b>g)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,m])=>m-d>=c+_S*2);if(!l)continue;const u=(l[0]+l[1])/2,f=a.axis==="h"?{x:u,y:a.at-Dh}:{x:a.at+Vn+n.width/2,y:u},p={x:f.x-n.width/2,y:f.y-n.height/2,width:n.width,height:n.height};if(!Ys({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&wS(p,d)))return p}return null}const Vn=8;function dm(e,t){const n=e.label;if(!n)return null;const i=In(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=p=>{const d=p.axis==="h"?r:o,m=p.axis==="h"?o-p.at:r-p.at,h=d<p.lo?p.lo-d:d>p.hi?d-p.hi:0;return Math.hypot(m,h)},s=i.reduce((p,d)=>a(d)<a(p)?d:p,i[0]),c=[...i,...t.edges.filter(p=>p.id!==e.id).flatMap(In),...t.shapes.filter(p=>p.container).flatMap(Aa)],l=p=>!c.some(d=>Ki(p,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+Vn,f=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const p of[s.at+Vn,s.at-Vn-n.width])for(const d of f){const m=n.y+d;if(m<s.lo||m+n.height>s.hi)continue;const h={...n,x:p,y:m};if(l(h))return h}else for(const p of[s.at-Vn-n.height,s.at+Vn])for(const d of f){const m=n.x+d;if(m<s.lo||m+n.width>s.hi)continue;const h={...n,x:m,y:p};if(l(h))return h}return null}function hm(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=tt(n),o=new Set(It(r).map(Tt));for(const[a,s]of t){const c=s.wps,l=n.get(a),u=l==null?void 0:l.label;if(!u||!(l!=null&&l.waypoints)||l.waypoints.length!==c.length)continue;const f=l.waypoints[0].x-c[0].x,p=l.waypoints[0].y-c[0].y;if(!l.waypoints.every((b,x)=>b.x-c[x].x===f&&b.y-c[x].y===p))continue;const d=s.label.x+f-u.x,m=s.label.y+p-u.y;if(d===0&&m===0)continue;const h=r.edges.find(b=>b.id===a);if(!(h!=null&&h.label))continue;const y={...h.label,x:h.label.x+d,y:h.label.y+m},v={...r,edges:r.edges.map(b=>b.id===a?{...b,label:y}:b)},g=It(v);g.some(b=>!o.has(Tt(b)))||(i.moveElements([u],{x:d,y:m}),r=v,o=new Set(g.map(Tt)))}}function mm(e,t){const{elementRegistry:n}=e,i=e.modeling,r=tt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=dm(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 gm(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=tt(i),a=It(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Tt(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(p=>p.id===s.edge);if(!c)continue;const l=fm(c,o);if(!l)continue;const u=i.get(s.edge),f=u==null?void 0:u.label;f&&r.moveElements([f],{x:l.x-f.x,y:l.y-f.y})}}function ym(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(In),...t.shapes.filter(p=>p.container).flatMap(Aa)],r=i.filter(p=>Ki(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=Bo(t).filter(p=>p.owner!==e.id).map(p=>p.rect),s=(p,d)=>p.x<d.x+d.width&&d.x<p.x+p.width&&p.y<d.y+d.height&&d.y<p.y+p.height,c=p=>!i.some(d=>Ki(p,d))&&!o.some(d=>s(p,d))&&!a.some(d=>s(p,d)),l=[];for(const p of r)p.axis==="h"?l.push({...n,y:p.at-Vn-n.height},{...n,y:p.at+Vn}):l.push({...n,x:p.at-Vn-n.width},{...n,x:p.at+Vn});const u=e.x+e.width/2,f=e.y+e.height/2;return l.push({...n,x:u-n.width/2,y:e.y+e.height+Vn},{...n,x:u-n.width/2,y:e.y-Vn-n.height},{...n,x:e.x+e.width+Vn,y:f-n.height/2},{...n,x:e.x-Vn-n.width,y:f-n.height/2}),l.find(c)??null}function vm(e,t){const{elementRegistry:n}=e,i=e.modeling,r=tt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=ym(o,tt(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 ES(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,l)=>l[0]<c[0]?l:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function bm(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=tt(n),o=new Set(It(r).map(Tt));const a=[...new Set(It(r).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(Tt(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 l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let f=!1;for(const[h,y]of u){const v=h?r.shapes.find(b=>b.id===h):void 0;if(!v)continue;const g=ES(v,l[y]);g.x===l[y].x&&g.y===l[y].y||(l[y]=g,f=!0)}if(!f)continue;const p={...r,edges:r.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=It(p);if(d.some(h=>!o.has(Tt(h))))continue;const m=n.get(s);m&&(i.updateWaypoints(m,l),r=p,o=new Set(d.map(Tt)))}}const SS=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,xm=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),_m={"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}]},tc=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Uu=e=>typeof e=="string"&&e!=="";function RS(e){const t=[];function n(i,r,o,a){if(a===null){Uu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!tc(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Uu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a;if(!tc(i)||!Uu(i.kind)||!(i.kind in _m)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const s of _m[i.kind]){const c=s.path.endsWith("[]"),l=c?s.path.slice(0,-2):s.path,u=l.split(".");let f=i;for(const d of u.slice(0,-1)){if(!tc(f))break;f=f[d]}if(!tc(f))continue;const p=f[u[u.length-1]];if(!(p===void 0&&s.optional)&&!(p===null&&s.optional)){if(!c){n(r,s.path,p,s.shape);continue}if(!Array.isArray(p)){t.push({kind:"payload-invalid",opIndex:r,field:s.path});continue}p.forEach((d,m)=>n(r,`${l}[${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"&&!Zd(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 wm(e,t){const n=RS(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,m){if(!SS.test(d)){i.push({kind:"id-invalid",opIndex:p,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:p,id:d});return}r.set(d,{...m,opIndex:p})}e.forEach((p,d)=>{var m;switch(p.kind){case"participant.add":a(d,p.participant.id,{category:"participant",lanes:(p.participant.lanes??[]).map(h=>h.id)});for(const h of p.participant.lanes??[])a(d,h.id,{category:"lane"});break;case"node.add":a(d,p.node.id,{category:"flowNode",participant:p.node.participant});break;case"sequenceFlow.add":a(d,p.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,p.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,p.dataStore.id,{category:"dataStore"});for(const h of p.associations??[])h.id&&a(d,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":p.association.id&&a(d,p.association.id,{category:"dataAssociation"});break;case"association.add":p.association.id&&a(d,p.association.id,{category:"association"});break;case"annotation.add":a(d,p.annotation.id,{category:"annotation"}),(m=p.association)!=null&&m.id&&a(d,p.association.id,{category:"association"});break;case"group.add":a(d,p.group.id,{category:"group"});break;case"participant.update":if(p.lanes){o.set(p.id,p.lanes.map(h=>h.id));for(const h of p.lanes)t.categoryOf(h.id)===void 0&&a(d,h.id,{category:"lane"})}break}});const s=p=>{var d;return((d=r.get(p))==null?void 0:d.category)??t.categoryOf(p)},c=p=>{const d=r.get(p);return d?d.category==="participant"?p:d.participant:t.categoryOf(p)==="participant"?p:t.participantOf(p)};function l(p,d,m,h){const y=s(d);if(y===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:m});return}if(h&&!h.includes(y)){i.push({kind:"ref-category",opIndex:p,ref:d,role:m,expected:h.join("|"),actual:y});return}return y}const u=t.isCollaboration()||e.some(p=>p.kind==="participant.add");return e.forEach((p,d)=>{var m;switch(p.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:y}=p.node;if(h===void 0){(u||y!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:p.node.id});break}if(l(d,h,"participant",["participant"])===void 0)break;y!==void 0&&((((m=r.get(h))==null?void 0:m.lanes)??o.get(h)??t.lanesOf(h)).includes(y)||i.push({kind:"lane-unknown",opIndex:d,lane:y,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:y,target:v,name:g,condition:b}=p.flow,x=l(d,y,"source",["flowNode"]),C=l(d,v,"target",["flowNode"]);x&&C&&c(y)!==c(v)&&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:y,target:v}=p.flow,g=l(d,y,"source",["flowNode","participant"]),b=l(d,v,"target",["flowNode","participant"]);if(g&&b){const x=c(y),C=c(v);x!==void 0&&x===C&&i.push({kind:"message-flow-same-pool",opIndex:d,id:h})}break}case"dataStore.add":{for(const h of p.associations??[]){if([h.source,h.target].filter(g=>g===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const v=h.source===p.dataStore.id?h.target:h.source;l(d,v,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:y}=p.association,v=l(d,h,"source"),g=l(d,y,"target");if(v&&g){const b=new Set([v,g]);b.has("dataStore")&&b.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:y})}break}case"association.add":{const{id:h,source:y,target:v}=p.association,g=l(d,y,"source"),b=l(d,v,"target");g&&b&&g!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${y}->${v}`});break}case"annotation.add":{if(p.association){const{source:h,target:y}=p.association;if(h!==p.annotation.id&&y!==p.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:p.annotation.id});else{const v=h===p.annotation.id?y:h;l(d,v,"association")}}p.placement&&l(d,p.placement.anchor,"anchor");break}case"group.add":{for(const h of p.group.members??[]){const y=l(d,h,"member");y&&xm.has(y)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:y})}break}case"participant.update":{if(f(d,p.id,"participant")===void 0)break;if(p.lanes){const h=t.lanesOf(p.id),y=p.lanes.map(g=>g.id);for(const g of h)y.includes(g)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.id,lane:g});for(const g of y)t.categoryOf(g)!==void 0&&!h.includes(g)&&i.push({kind:"id-duplicate",opIndex:d,id:g});const v=y.filter(g=>h.includes(g));v.length===h.length&&v.some((g,b)=>g!==h[b])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:p.id})}break}case"node.update":{if(f(d,p.id,"flowNode")===void 0)break;if(p.lane!==void 0){const h=t.participantOf(p.id);(h?o.get(h)??t.lanesOf(h):[]).includes(p.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:p.lane,participant:h??""})}break}case"sequenceFlow.update":{if(f(d,p.id,"sequenceFlow")===void 0)break;if(p.name!==void 0&&p.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:p.id}),p.source!==void 0||p.target!==void 0){const h=p.source===void 0||l(d,p.source,"source",["flowNode"])!==void 0,y=p.target===void 0||l(d,p.target,"target",["flowNode"])!==void 0,v=t.endpointsOf(p.id),g=p.source??(v==null?void 0:v.source),b=p.target??(v==null?void 0:v.target);h&&y&&g!==void 0&&b!==void 0&&new Set([c(g),c(b),c(p.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:p.id})}break}case"messageFlow.update":f(d,p.id,"messageFlow");break;case"dataStore.update":f(d,p.id,"dataStore");break;case"annotation.update":{if(f(d,p.id,"annotation")===void 0)break;p.placement&&l(d,p.placement.anchor,"anchor");break}case"group.update":{if(f(d,p.id,"group")===void 0)break;for(const h of p.members??[]){const y=l(d,h,"member");y&&xm.has(y)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:y})}break}case"element.remove":{f(d,p.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:p.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function f(p,d,m){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:p,id:d});return}const h=t.categoryOf(d);if(h===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:"target"});return}if(m&&h!==m){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:m,actual:h});return}return h}}function Em(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 nc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const ic={"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]},vn=10,CS=300,AS=160,Sm=20,Rm=40,PS=10;function Yu(e,t,n,i,r){const o=n,a=(D,I)=>{const[z,ce]=ic[D];let ve={x:t.x+t.width/2+z*(t.width/2+o.width/2+I),y:t.y+t.height/2+ce*(t.height/2+o.height/2+I)};const Ye=i.x+vn+o.width/2,He=i.x+i.width-vn-o.width/2,it=i.y+vn+o.height/2,X=i.y+i.height-vn-o.height/2,Q={x:Math.min(He,Math.max(Ye,ve.x)),y:Math.min(X,Math.max(it,ve.y))};return(Q.x!==ve.x||Q.y!==ve.y)&&(ve=Math.abs(Q.x-(t.x+t.width/2))<(t.width+o.width)/2+vn&&Math.abs(Q.y-(t.y+t.height/2))<(t.height+o.height)/2+vn?{x:t.x+t.width+vn+o.width/2,y:Q.y}:Q),ve},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=tt(e),l=D=>{var z,ce;if(!r.selfId)return!1;const I=e.get(D);return!!I&&(((z=I.source)==null?void 0:z.id)===r.selfId||((ce=I.target)==null?void 0:ce.id)===r.selfId)},u=c.edges.filter(D=>!l(D.id)).flatMap(In),f=Bo(c).filter(D=>D.owner!==r.selfId).map(D=>D.rect),p=D=>({x0:D.x-o.width/2-vn,x1:D.x+o.width/2+vn,y0:D.y-o.height/2-vn,y1:D.y+o.height/2+vn}),d=D=>{const I=p(D);return s.some(z=>I.x0<z.x+z.width&&I.x1>z.x&&I.y0<z.y+z.height&&I.y1>z.y)},m=D=>{const I=p(D);return u.some(z=>z.axis==="h"?z.at>I.y0&&z.at<I.y1&&z.lo<I.x1&&z.hi>I.x0:z.at>I.x0&&z.at<I.x1&&z.lo<I.y1&&z.hi>I.y0)},h=D=>{const I=p(D);return f.some(z=>I.x0<z.x+z.width&&I.x1>z.x&&I.y0<z.y+z.height&&I.y1>z.y)},y=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}]),v=D=>{const I=p(D);return y.some(z=>z.axis==="h"?z.at>I.y0&&z.at<I.y1&&z.lo<I.x1&&z.hi>I.x0:z.at>I.x0&&z.at<I.x1&&z.lo<I.y1&&z.hi>I.y0)},g=D=>d(D)||m(D)||h(D)||v(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=He=>He.startsWith("top")?He.replace(/^top/,"bottom"):He.replace(/^bottom/,"top"),I=He=>He.endsWith("left")?He.replace(/left$/,"right"):He.replace(/right$/,"left"),z=r.placement.side,ce=[z,D(z),I(z),D(I(z)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ve=r.placement.offset??50;let Ye=a(z,ve);if(g(Ye)){const He=new Set;for(const it of ce){if(He.has(it))continue;He.add(it);const X=a(it,ve);if(b(X)&&!g(X)){Ye=X;break}}}return Ye}const x=r.from,C=i.x+vn+o.width/2,M=i.x+i.width-vn-o.width/2,O=i.y+vn+o.height/2,P=i.y+i.height-vn-o.height/2;let F={x:Math.min(M,Math.max(C,x.x)),y:Math.min(P,Math.max(O,x.y))};if(g(F)){const D=(t.width+o.width)/2+vn,z=[{x:F.x+D,y:F.y},{x:F.x-D,y:F.y},{x:F.x,y:F.y-o.height-vn},{x:F.x,y:F.y+o.height+vn}].filter(b).find(ce=>!g(ce));z&&(F=z)}return F}function Xt(e,t){return e.filter(n=>n.kind===t)}function Cm(e,t){var y0,v0,b0,x0,_0,w0,E0,S0,R0,C0,A0,P0,M0,T0,k0,O0,D0,I0,L0,B0,N0,$0,F0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),f=_=>o.get(_),p=_=>{const R=f(_);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=Xt(e,"participant.add"),y=Xt(e,"node.add"),v=Xt(e,"sequenceFlow.add"),g=Xt(e,"messageFlow.add"),b=Xt(e,"dataStore.add"),x=Xt(e,"dataAssociation.add"),C=Xt(e,"annotation.add"),M=Xt(e,"group.add"),O=new Map(y.map(_=>[_.node.id,_])),P=(_,R,A)=>{var j;const T=_.businessObject,B=(((j=T.extensionElements)==null?void 0:j.values)??[]).filter($=>$.$type!==R),L=A?[...B,i.create(R,A)]:B;if(!L.length){T.extensionElements&&n.updateProperties(_,{extensionElements:void 0});return}const N=i.create("bpmn:ExtensionElements",{values:L});L.forEach($=>{$.$parent=N}),n.updateProperties(_,{extensionElements:N})},F=_=>({anchor:_.anchor,side:_.side,..._.offset!==void 0?{offset:_.offset}:{}});for(const _ of Xt(e,"element.remove")){const R=f(_.id);R&&n.removeElements([R])}const D=_=>o.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=d(R))==null?void 0:A.id)===_}).sort((R,A)=>R.y-A.y);for(const _ of Xt(e,"participant.update")){const R=p(_.id);if(_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),!_.lanes)continue;const A=D(_.id);if(!A.length){n.splitLane(R,_.lanes.length),D(_.id).forEach((B,L)=>{const N=_.lanes[L];N&&n.updateProperties(B,{id:N.id,name:N.name})});continue}const T=new Set(A.map(B=>B.id));_.lanes.forEach((B,L)=>{if(T.has(B.id)){n.updateProperties(p(B.id),{name:B.name});return}const N=L===0?n.addLane(D(_.id)[0],"top"):n.addLane(p(_.lanes[L-1].id),"bottom");n.updateProperties(N,{id:B.id,name:B.name})})}const I=150,z=130,ce=80,ve=90,Ye=180,He=30,it=30,X=(_,R,A,T,B)=>{const L=A-R.width/2,N=T-R.height/2;return(_.children??[]).find(j=>!("waypoints"in j&&j.waypoints)&&j.type!=="bpmn:Lane"&&j.type!=="label"&&!(B!=null&&B.has(j.id))&&typeof j.x=="number"&&L<j.x+j.width+it&&L+R.width+it>j.x&&N<j.y+j.height&&N+R.height>j.y)},Q=new Set;for(const _ of h){Q.add(`pool:${_.participant.id}`);for(const R of _.participant.lanes??[])Q.add(R.id)}const ue=new Map;for(const _ of y){const R=_.node.lane??`pool:${_.node.participant??""}`;let A=ue.get(R);A||ue.set(R,A=new Set([0])),_.band!==void 0&&A.add(_.band)}const _e=new Map;for(const[_,R]of ue){if(!Q.has(_))continue;const A=[...R].sort((L,N)=>L-N),T=A.map((L,N)=>N===0?0:N%2===1?Math.ceil(N/2):-(N/2)),B=Math.min(...T);_e.set(_,new Map(A.map((L,N)=>[L,T[N]-B])))}{const _=new Map;for(const R of h)(R.participant.lanes??[]).forEach((A,T)=>_.set(A.id,T));for(const[R,A]of _e){if(!_.has(R)||A.size<2)continue;const T=_.get(R),B=A.get(0)??0,L=new Set;for(const ae of y){if(ae.node.lane!==R||(ae.band??0)!==0||!ae.node.type.endsWith("Gateway"))continue;const ge={in:new Set,out:new Set,cross:new Set};for(const de of v){const Se=de.flow.source===ae.node.id;if(!Se&&de.flow.target!==ae.node.id)continue;const pt=O.get(Se?de.flow.target:de.flow.source);if(!pt||pt.node.participant!==ae.node.participant||!pt.node.lane)continue;let Te,K=!1;if(pt.node.lane!==R){const le=_.get(pt.node.lane);if(le===void 0)continue;Te=le>T?"down":"up",K=!0}else{const le=A.get(pt.band??0)??B;Te=le>B?"down":le<B?"up":void 0}Te&&(ge[Se?"out":"in"].add(Te),K&&ge.cross.add(Te))}for(const de of["up","down"])ge.in.has(de)&&ge.out.has(de)&&ge.cross.has(de)&&L.add(de)}if(L.size!==1)continue;const[N]=L,j=Math.max(...A.values()),$=N==="down"?j:0;if(B===$)continue;const Y=[...A.entries()].filter(([ae])=>ae!==0).sort((ae,ge)=>ae[1]-ge[1]),se=[...Array(j+1).keys()].filter(ae=>ae!==$),xe=new Map([[0,$]]);Y.forEach(([ae],ge)=>xe.set(ae,se[ge])),_e.set(R,xe)}}const q=_=>{var R;return(((R=ue.get(_))==null?void 0:R.size)??0)>1},V=_=>_.band??(_.node.lane||!q(`pool:${_.node.participant??""}`)?void 0:0),ie=new Map,Pe=_=>ie.get(_.node.id)??V(_),bt=new Set,k=new Set;{const _=new Map;for(const T of v)_.set(T.flow.target,(_.get(T.flow.target)??0)+1);const R=T=>{const B=[],L=new Set([T]),N=[T];for(;N.length;){const j=N.shift();B.push(j);for(const $ of v)$.flow.source!==j||L.has($.flow.target)||(_.get($.flow.target)??0)!==1||(L.add($.flow.target),N.push($.flow.target))}return B},A=(T,B)=>{var L;return((L=_e.get(T))==null?void 0:L.get(B))??B};for(const T of y){if(!T.node.type.endsWith("Gateway"))continue;const B=T.node.lane??`pool:${T.node.participant??""}`,L=_e.get(B);if(!L||L.size<2)continue;const N=Pe(T);if(N===void 0||A(B,N)!==A(B,0))continue;const j=A(B,N),$=v.filter(de=>de.flow.source===T.node.id).map(de=>O.get(de.flow.target)).filter(de=>!!de&&(de.node.lane??`pool:${de.node.participant??""}`)===B),Y=$.filter(de=>{const Se=Pe(de);return Se!==void 0&&A(B,Se)===j&&(_.get(de.node.id)??0)===1}),se=$.some(de=>{const Se=Pe(de);return Se!==void 0&&A(B,Se)>j});if(Y.length!==1||!se)continue;const xe=new Set($.flatMap(de=>R(de.node.id)));if(!v.some(de=>de.flow.target===T.node.id&&xe.has(de.flow.source)))continue;const ge=new Map;for(const[de,Se]of L)ge.set(de,Se+1);ge.set(-1,0),_e.set(B,ge);for(const de of R(Y[0].node.id))O.has(de)&&(ie.set(de,-1),k.add(de));bt.add(T.node.id)}}const w=(_,R)=>{var A;return((A=_e.get(_))==null?void 0:A.get(R))??R},E=(_,R,A,T)=>{const B=_?f(_):R?f(R):void 0;if(!B)return!1;const L=_?B.y+Math.min(B.height/2,ve):B.y+ce;return Math.abs(L+w(_??`pool:${R??""}`,A)*I-T)<=I/2},G=new Map;for(const[_,R]of ue){let A=0;for(const T of R)A=Math.max(A,w(_,T));G.set(_,A)}const U=_=>Ye+I*_,Z=(_,R,A)=>{const T=u().children.filter(B=>!("waypoints"in B&&B.waypoints)&&B.id!==R&&typeof B.y=="number"&&B.y>=_);T.length&&n.moveElements(T,{x:0,y:A})},Re=(_,R,A)=>{const T=_.type==="bpmn:Participant"?_:void 0;if(!T||T.children.some(j=>j.type==="bpmn:Lane"))return;const B=A+R.height/2+He-T.y;if(T.height>=B)return;const L=B-T.height,N=T.y+T.height;n.resizeShape(T,{x:T.x,y:T.y,width:T.width,height:B}),Z(N,T.id,L)},Ke=(_,R)=>{const A=R-_.height;if(A<=0)return;const T=d(_)??_,B=[],L=$=>{B.push($);for(const Y of $.children??[])L(Y)};L(T);const N=_.y+_.height-10,j=l.calculateAdjustments(B,"y",A,N);l.makeSpace(j.movingShapes,j.resizingShapes,{x:0,y:A},"s",N)},lt=(_,R,A)=>{if(_){const N=p(_),j=U(R);if(N.height>=j)return;const $=j-N.height,Y=d(N),se=Y?Y.y+Y.height:N.y+N.height;Ke(N,j),Z(se,Y==null?void 0:Y.id,$);return}if(!A)return;const T=I*(R+1);if(A.height>=T)return;const B=T-A.height,L=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:T}),Z(L,A.id,B)},Ht=new Map;for(const _ of v)Ht.set(_.flow.target,(Ht.get(_.flow.target)??0)+1);const ft=_=>(Ht.get(_)??0)<=1,qt=(_,R,A)=>{if(!_)return!0;const T=f(_);return T?A-R.height/2>=T.y&&A+R.height/2<=T.y+T.height:!0},fn=h.map((_,R)=>({op:_,declared:R}));fn.sort((_,R)=>{const A=_.op.order??Number.POSITIVE_INFINITY,T=R.op.order??Number.POSITIVE_INFINITY;return A!==T?A-T:_.declared-R.declared});let dn=80;for(const _ of o.getAll())_.parent===u()&&"height"in _&&typeof _.y=="number"&&(dn=Math.max(dn,_.y+_.height+60));for(const{op:_}of fn){const R=_.participant,A=y.filter(ae=>ae.node.participant===R.id).length,T=((y0=R.lanes)==null?void 0:y0.length)??0,B=Math.max(1200,A*160+300),L=(R.lanes??[]).map(ae=>U(G.get(ae.id)??0)),N=L.reduce((ae,ge)=>ae+ge,0);T&&N<300&&(L[T-1]+=300-N);const j=Math.max(300,I*((G.get(`pool:${R.id}`)??0)+1)),$=R.blackBox||A+T===0?120:T?Math.max(300,N):j,Y=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:B,height:$,isExpanded:!0}),se=n.createShape(Y,{x:100+B/2,y:dn+$/2},u()),xe=R.lanes??[];if(xe.length&&n.splitLane(se,xe.length),xe.length){const ae=o.filter(ge=>{var de;return ge.type==="bpmn:Lane"&&((de=d(ge))==null?void 0:de.id)===R.id}).sort((ge,de)=>ge.y-de.y);if(ae.forEach((ge,de)=>{const Se=xe[de];Se&&n.updateProperties(ge,{id:Se.id,name:Se.name})}),L.some(ge=>ge!==se.height/T)){let ge=se.y;ae.forEach((de,Se)=>{const pt=L[Se];n.resizeShape(de,{x:de.x,y:ge,width:de.width,height:pt}),ge+=pt})}}dn=se.y+se.height+60}const Ct=_=>{var T;const R=O.get(_);if(R)return R.node.participant??"";const A=f(_);return A?A.type==="bpmn:Participant"?A.id:((T=d(A))==null?void 0:T.id)??"":""},zt=new Map,kn=_=>{let R=zt.get(_);return R||zt.set(_,R={nodes:[],flows:[]}),R};for(const _ of y)kn(_.node.participant??"").nodes.push(_);for(const _ of v)kn(Ct(_.flow.source)).flows.push(_);const Ur=_=>{var R;return i.create("bpmn:SequenceFlow",{id:_.id,name:_.name??((R=_.condition)==null?void 0:R.label)})},Jn=(_,R,A)=>r.createShape({type:nc(_.type),businessObject:i.create(nc(_.type),{id:_.id,name:_.name,...R!==void 0?{"bwl:band":R}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),Wi=[...fn.map(({op:_})=>_.participant.id).filter(_=>zt.has(_)),...[...zt.keys()].filter(_=>!h.some(R=>R.participant.id===_))],ei=_=>_.endsWith("Gateway");for(const _ of Wi){const R=zt.get(_),A=_?p(_):void 0,T=A?A.x+150:250;let B=A?A.y+80:120;const L=(K,le,re)=>{if(K){const fe=p(K);return fe.y+Math.min(fe.height/2,ve)+w(K,le??0)*I}return le!==void 0&&A?A.y+ce+w(`pool:${_}`,le)*I:re},N=(K,le,re)=>{if(K){const fe=p(K);return fe.y+Math.min(fe.height/2,ve)+le*I}return A?A.y+ce+le*I:re},j=K=>K.participant?p(K.participant):u(),$=(K,le,re,fe,ze,Ge,mt)=>{const Bt=re!==void 0||fe!==void 0,he=w(re??`pool:${_}`,fe??0);if((fe===void 0||E(re,_,fe,mt??Number.NaN))&&mt!==void 0&&qt(re,le,mt)&&!X(K,le,ze,mt))return{x:ze,y:mt};if(Bt)for(let pe=0;pe<4;pe++){const ke=N(re,he+pe,Ge);if(!X(K,le,ze,ke))return lt(re,he+pe,A),{x:ze,y:ke}}const me=L(re,fe,Ge);Bt?lt(re,he,A):Re(K,le,me);let J=ze;for(let pe=0;pe<64;pe++){const ke=X(K,le,J,me);if(!ke)break;J=ke.x+ke.width+z+le.width/2}return{x:J,y:me}},Y=new Set(R.flows.map(K=>K.flow.target)),se=new Map,xe=K=>{if(K===void 0)return;const le=o.get(K);if(!(!le||typeof le.x!="number"||typeof le.width!="number"))return le.x+le.width+z};for(const K of R.nodes){if(Y.has(K.node.id))continue;const le=Jn(K.node,K.band,K.afterColumn),re=V(K),fe=K.node.lane?`${K.node.lane}|${re??""}`:re!==void 0?`band:${re}`:"",ze=j(K.node),Ge=se.get(fe)??T,mt=xe(K.afterColumn),Bt=mt===void 0?Ge:Math.max(Ge,mt),he=$(ze,le,K.node.lane,re,Bt,B);n.createShape(le,he,ze),se.set(fe,he.x+le.width+z),!K.node.lane&&re===void 0&&(B+=160)}const ae=new Set,ge=new Map,de=new Map,Se=new Map;if(_&&Q.has(`pool:${_}`)){const K=new Map;for(const he of R.flows)K.set(he.flow.target,(K.get(he.flow.target)??0)+1);const le=he=>L(he.node.lane,Pe(he),Number.NaN),re=new Set,fe=he=>{var pe;const me=(pe=O.get(he))==null?void 0:pe.node.participant;if(me)return f(me);const J=f(he);if(J)return J.type==="bpmn:Participant"?J:d(J)},ze=he=>{const me=[],J=new Set([he]),pe=[he];for(;pe.length;){const ke=pe.shift(),Ue=O.get(ke);Ue&&me.push(Ue);for(const Ae of R.flows)Ae.flow.source!==ke||J.has(Ae.flow.target)||(K.get(Ae.flow.target)??0)!==1||(J.add(Ae.flow.target),pe.push(Ae.flow.target))}return me},Ge=he=>{if(!A)return;const me=new Set(he.map(ke=>ke.node.id));let J=!1,pe=!1;for(const ke of g){if(!me.has(ke.flow.source))continue;const Ue=fe(ke.flow.target);!Ue||Ue.id===A.id||(Ue.y<A.y?J=!0:pe=!0)}return J&&!pe?"up":pe&&!J?"down":void 0};for(const he of R.nodes){if(!ei(he.node.type))continue;const me=L(he.node.lane,V(he),Number.NaN);if(Number.isNaN(me))continue;const J=[];for(const Ae of R.flows){if(Ae.flow.source!==he.node.id)continue;const $e=O.get(Ae.flow.target);if(!$e||$e.node.lane!==he.node.lane||(K.get($e.node.id)??0)!==1)continue;const Ne=V($e);if(Ne===void 0)continue;const Ce=L($e.node.lane,Ne,Number.NaN);if(Number.isNaN(Ce))continue;const rt=ze($e.node.id),Oe=Ge(rt);Oe&&J.push({subtree:rt,band:Ne,row:Ce,dir:Oe})}if(!J.some(Ae=>Ae.dir==="up")||!J.some(Ae=>Ae.dir==="down")||!J.some(Ae=>Ae.dir==="up"&&J.some($e=>$e.dir==="down"&&$e.row<Ae.row)))continue;const ke=[...J].sort((Ae,$e)=>Ae.row-$e.row);[...J.filter(Ae=>Ae.dir==="up"),...J.filter(Ae=>Ae.dir==="down")].sort((Ae,$e)=>Ae.dir===$e.dir?Ae.row-$e.row:Ae.dir==="up"?-1:1).forEach((Ae,$e)=>{const Ne=ke[$e].band;if(Ne!==Ae.band){re.add(he.node.id);for(const Ce of Ae.subtree)V(Ce)===Ae.band&&ie.set(Ce.node.id,Ne)}})}const mt=he=>{if(!A)return;const me=new Set(he.map(ke=>ke.node.id));let J=!1,pe=!1;for(const ke of g){if(!me.has(ke.flow.target))continue;const Ue=fe(ke.flow.source);!Ue||Ue.id===A.id||(Ue.y<A.y?J=!0:pe=!0)}return J&&!pe?"up":pe&&!J?"down":void 0};for(const he of R.nodes){if(!ei(he.node.type))continue;const me=he.node.lane??`pool:${_}`,J=_e.get(me);if(!J||J.size<2)continue;const pe=J.get(0);if(pe===void 0)continue;const ke=Math.max(...J.values()),Ue=pe===ke&&pe!==0?"down":void 0;if(!Ue)continue;const Ae=[];for(const Oe of R.flows){if(Oe.flow.source!==he.node.id)continue;const xt=O.get(Oe.flow.target);if(!xt||xt.node.lane!==he.node.lane||(K.get(xt.node.id)??0)!==1)continue;const _t=Pe(xt);_t!==void 0&&Ae.push({t:xt,subtree:ze(xt.node.id),band:_t})}const $e=Ae.find(Oe=>(J.get(Oe.band)??Oe.band)===pe);if(!$e||mt($e.subtree)===Ue||Ge($e.subtree)===Ue)continue;const Ne=Ae.find(Oe=>Oe!==$e&&mt(Oe.subtree)===Ue);if(!Ne)continue;const Ce=$e.band,rt=Ne.band;for(const Oe of $e.subtree)Pe(Oe)===Ce&&ie.set(Oe.node.id,rt);for(const Oe of Ne.subtree)Pe(Oe)===rt&&ie.set(Oe.node.id,Ce);re.add(he.node.id)}for(const he of R.nodes){if(!ei(he.node.type))continue;const me=le(he);if(Number.isNaN(me)||C.some(Ae=>{var $e,Ne;return((($e=Ae.placement)==null?void 0:$e.anchor)??(Ae.association?Ae.association.source===Ae.annotation.id?Ae.association.target:Ae.association.source:void 0))===he.node.id&&((Ne=Ae.placement)==null?void 0:Ne.side.startsWith("bottom"))}))continue;let pe,ke=!1,Ue;for(const Ae of R.flows){if(Ae.flow.source!==he.node.id)continue;const $e=O.get(Ae.flow.target);if(!$e||!$e.node.lane&&V($e)===void 0)continue;const Ne=le($e);Number.isNaN(Ne)||(Math.abs(Ne-me)<.5&&(ke=!0),Ne>me?!pe||Ne>pe.row?pe={id:$e.node.id,row:Ne,count:1}:Ne===pe.row&&pe.count++:Ne<me&&$e.node.lane===he.node.lane&&(!Ue||Ne>Ue.row?Ue={op:$e,row:Ne,count:1}:Ne===Ue.row&&Ue.count++))}pe&&pe.count===1&&(K.get(pe.id)??0)===1&&!re.has(he.node.id)&&ae.add(pe.id),!ke&&Ue&&Ue.count===1&&(K.get(Ue.op.node.id)??0)===1&&!bt.has(he.node.id)&&ge.set(Ue.op.node.id,{lane:he.node.lane,band:Pe(he)})}const Bt=new Map;for(const he of g)Bt.set(he.flow.target,[...Bt.get(he.flow.target)??[],he]);for(const he of R.nodes){const me=Bt.get(he.node.id);if(!me||me.length!==1||!K.get(he.node.id)||!he.node.lane&&V(he)===void 0||k.has(he.node.id))continue;const J=(v0=O.get(me[0].flow.source))==null?void 0:v0.node.participant,pe=J?f(J):void 0;if(!pe||!A||pe.id===A.id)continue;const ke=he.node.lane??`pool:${_}`,Ue=_e.get(ke);if(!Ue)continue;const Ae=Ue.get(0)??0,$e=(Ue.get(Pe(he)??0)??Ae)-Ae;if($e===0)continue;const Ne=pe.y<A.y;if(Ne&&$e<0||!Ne&&$e>0)continue;let Ce;for(const[rt,Oe]of Ue){const xt=Oe-Ae;(Ne&&xt<0&&(!Ce||xt<Ce.row)||!Ne&&xt>0&&(!Ce||xt>Ce.row))&&(Ce={band:rt,row:xt})}Ce&&de.set(he.node.id,{lane:he.node.lane,band:Ce.band})}}const pt=new Set;let Te=0;for(;Te++<R.nodes.length+2;){for(let re=0;re<R.nodes.length+R.flows.length+2;re++){let fe=!1;for(const ze of R.flows){const Ge=ze.flow;if(pt.has(Ge.id))continue;const mt=f(Ge.source);if(!mt)continue;const Bt=f(Ge.target),he=O.get(Ge.target);if(!Bt&&he){const me=Jn(he.node,he.band),J=Pe(he);if(he.node.lane||J!==void 0){const pe=j(he.node),ke=mt,Ue=ke.x+(Se.get(Ge.source)??0)+ke.width+z,Ae=ge.get(Ge.target)??de.get(Ge.target),$e=$(pe,me,Ae?Ae.lane:he.node.lane,Ae?Ae.band:J,ae.has(Ge.target)?ke.x+ke.width/2:Ue,Number.NaN,Ae||!ft(Ge.target)?void 0:ke.y+ke.height/2),Ne=n.createShape(me,$e,pe);ae.has(Ge.target)&&Se.set(Ge.target,Ue-(Ne.x+Ne.width/2)),n.connect(mt,Ne,{type:"bpmn:SequenceFlow",businessObject:Ur(Ge)})}else s.append(mt,me,{connection:{type:"bpmn:SequenceFlow",businessObject:Ur(Ge)}})}else if(Bt)n.connect(mt,Bt,{type:"bpmn:SequenceFlow",businessObject:Ur(Ge)});else continue;pt.add(Ge.id),fe=!0}if(!fe)break}const K=R.nodes.filter(re=>!f(re.node.id));if(!K.length)break;const le=K[0];{const re=Jn(le.node,le.band),fe=j(le.node),ze=V(le);n.createShape(re,$(fe,re,le.node.lane,ze,T,B),fe),!le.node.lane&&ze===void 0&&(B+=160)}}}const Gt=40,Yr=5,Ui=10,ti=200,ot=new Set([...v.map(_=>_.flow.id),...g.map(_=>_.flow.id),...Xt(e,"sequenceFlow.update").map(_=>_.id),...Xt(e,"messageFlow.update").map(_=>_.id)].filter(_=>!!_)),dt=(_,R,A,T,B,L)=>{const N=new Set(_.map(K=>K.id)),j=Math.min(..._.map(K=>K.x))+R-Ui,$=Math.max(..._.map(K=>K.x+K.width))+R+ti+Ui,Y=Math.min(..._.map(K=>K.y+Math.min(0,...A)))-Ui,se=Math.max(..._.map(K=>K.y+K.height+Math.max(0,...A)))+Ui,xe=o.getAll().filter(K=>{if(K.type!=="bpmn:SequenceFlow"&&K.type!=="bpmn:MessageFlow")return!1;const le=K;return ot.has(le.id)||!le.waypoints||le.waypoints.length<2||[le.source,le.target].some(fe=>!fe||N.has(fe.id)||fe.x>=T)?!1:le.waypoints.some((fe,ze)=>{const Ge=le.waypoints[ze+1];return!!Ge&&Math.max(fe.x,Ge.x)>=j&&Math.min(fe.x,Ge.x)<=$&&Math.max(fe.y,Ge.y)>=Y&&Math.min(fe.y,Ge.y)<=se})});if(!xe.length)return 0;const ae=K=>{const le=new Map;for(const re of _)for(const fe of A){const ze={id:re.id,type:re.type,x:re.x+R+K,y:re.y+fe,width:re.width,height:re.height};for(const Ge of xe){let mt=1/0;for(let he=0;he+1<Ge.waypoints.length;he++)mt=Math.min(mt,qs(Ge.waypoints[he],Ge.waypoints[he+1],ze));const Bt=`${Ge.id}|${re.id}`;le.set(Bt,Math.min(le.get(Bt)??1/0,mt))}}return le},ge=[...ae(0)].filter(([,K])=>K<=Yr).map(([K])=>K);if(!ge.length)return 0;let de=0;for(let K=1;K<=ti;K++){const le=ae(K);if([...le.values()].every(re=>re>Yr)&&ge.every(re=>(le.get(re)??1/0)>=Ui)){de=K;break}}if(!de)return 0;const Se=Math.min(..._.map(K=>K.x))+R+de,pt=new Set(ge.map(K=>K.slice(0,K.indexOf("|"))));return xe.some(K=>K.type==="bpmn:SequenceFlow"&&pt.has(K.id)&&K.waypoints.some((le,re)=>{const fe=K.waypoints[re+1];if(!fe||Math.min(le.y,fe.y)>L||Math.max(le.y,fe.y)<L||le.y===fe.y)return!1;const ze=le.x+(L-le.y)*(fe.x-le.x)/(fe.y-le.y);return ze>B&&ze<Se}))?0:de},vo=(_,R=()=>!0)=>{const A=f(_);if(!A)return[];const T=[A],B=new Set([_]);for(let L=0;L<T.length;L++){const N=T[L].id;for(const j of v){const $=j.flow.target;if(j.flow.source!==N||B.has($)||!O.has($))continue;B.add($);const Y=f($);Y&&R(Y)&&T.push(Y)}}return T},nB=(_,R=()=>!0)=>{const A=f(_);if(!A)return[];const T=[A],B=new Set([_]);for(let L=0;L<T.length;L++){const N=T[L].id;for(const j of v){const $=j.flow.source;if(j.flow.target!==N||B.has($)||!O.has($))continue;B.add($);const Y=f($);Y&&R(Y)&&T.push(Y)}}return T},Yi=30,dr=_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number",ks=(_,R)=>{const A=new Set(_.flatMap(N=>N.subtree.map(j=>j.id)));for(const N of _){const j=(N.pool.children??[]).filter(dr).filter(Y=>!A.has(Y.id));if(N.subtree.some(Y=>j.some(se=>Y.x+R<se.x+se.width+Yi&&Y.x+R+Y.width+Yi>se.x&&Y.y<se.y+se.height&&Y.y+Y.height>se.y)))return null}const T=_.map(N=>N.pool.width),B=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 L=_.map(N=>{const $=Math.max(...N.subtree.map(Y=>Y.x+Y.width))+150-(N.pool.x+N.pool.width);return $>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:N.pool.width+$,height:N.pool.height}),$});return()=>{n.moveElements(_.flatMap(N=>N.subtree),{x:-R,y:0}),_.forEach((N,j)=>{L[j]>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:T[j],height:N.pool.height})});for(let N=0;N<3;N++){let j=0;for(const $ of B){const Y=$.x-$.label.x,se=$.y-$.label.y;Math.abs(Y)<=.5&&Math.abs(se)<=.5||(n.moveElements([$.label],{x:Y,y:se}),j++)}if(!j)break}}},qw=_=>{var B,L;const R=new Map,A=new Map;for(const N of o.getAll()){if(N.type!=="bpmn:Participant")continue;const j=N;(j.children??[]).length||(R.set(j.id,j),A.set(j.id,[]))}for(const N of o.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const j=N,$=(B=j.source)==null?void 0:B.id,Y=(L=j.target)==null?void 0:L.id;$&&Y&&A.has($)&&A.get($).push(Y),$&&Y&&A.has(Y)&&A.get(Y).push($)}const T=[];for(const[N,j]of A)j.length&&j.every($=>_.has($))&&T.push(R.get(N));return T},Kw=(_,R)=>{if(!_.length)return null;const A=new Set(_.map(N=>N.id)),T=o.getAll().filter(N=>N.type==="bpmn:Participant"&&!A.has(N.id));if(_.some(N=>T.some(j=>N.x+R<j.x+j.width+Yi&&N.x+R+N.width+Yi>j.x&&N.y<j.y+j.height&&N.y+N.height>j.y)))return null;const L=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 $ of L){const Y=$.x-$.label.x,se=$.y-$.label.y;Math.abs(Y)<=.5&&Math.abs(se)<=.5||(n.moveElements([$.label],{x:Y,y:se}),j++)}if(!j)break}}},Xw=()=>{let _=0;for(const R of o.getAll()){if(R.type!=="bpmn:DataInputAssociation"&&R.type!=="bpmn:DataOutputAssociation")continue;const A=R.waypoints??[];for(let T=1;T<A.length;T++)_+=Math.hypot(A[T].x-A[T-1].x,A[T].y-A[T-1].y)}return _},Zw=()=>{let _=0;for(const R of o.getAll()){if(R.type!=="bpmn:Association")continue;const A=R.waypoints??[];for(let T=1;T<A.length;T++)_+=Math.hypot(A[T].x-A[T-1].x,A[T].y-A[T-1].y)}return _},iB=_=>{const R=[];for(const A of o.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const T=A;if(_.has(T.id))continue;const L=[...T.incoming??[],...T.outgoing??[]].filter($=>$.type==="bpmn:Association").map($=>$.source===T?$.target:$.source);if(!L.length||L.some($=>$===void 0))continue;const N=$=>{if(!("waypoints"in $&&$.waypoints))return[$.id];const Y=$,se=[Y.source,Y.target];return se.some(xe=>!xe)?[]:se.map(xe=>xe.id)},j=L.flatMap($=>N($));j.length&&j.every($=>_.has($))&&R.push(T)}return R},Qw=()=>It(tt(o)).filter(_=>_.kind==="edge-crosses-shape").length,Jw=_=>{const R=(_.children??[]).filter(dr);let A=0;for(let T=0;T<R.length;T++)for(let B=T+1;B<R.length;B++){const L=R[T],N=R[B];L.x<N.x+N.width&&L.x+L.width>N.x&&L.y<N.y+N.height&&L.y+L.height>N.y&&A++}return A},ba=()=>{const _=tt(o),R=A=>A.length>=2&&(A.every(T=>Math.abs(T.x-A[0].x)<.01)||A.every(T=>Math.abs(T.y-A[0].y)<.01));return{messages:_.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:_.edges.filter(A=>R(A.waypoints)).length}},rB=_=>{const R=new Map;for(const T of o.getAll()){if(T.type!=="bpmn:MessageFlow")continue;const B=T;if(!B.waypoints||B.waypoints.length!==2)continue;const L=B.source,N=B.target;if(!L||!N)continue;const j=_.has(L.id);if(j===_.has(N.id))continue;const $=j?N:L,Y=d($);if(!Y||_.has($.id))continue;const se=R.get(Y.id);se?$.x<se.minX&&(se.minX=$.x):R.set(Y.id,{pool:Y,minX:$.x})}const A=[];for(const{pool:T,minX:B}of R.values()){const L=(T.children??[]).filter(N=>dr(N)&&!_.has(N.id)&&N.x>=B);L.length&&A.push({subtree:L,pool:T})}return A},e0=new Map;for(const _ of Xt(e,"sequenceFlow.update")){if(_.target===void 0)continue;const R=O.get(_.target);if(!R)continue;const A=f(_.target),T=f(_.id);if(!A||!T)continue;const B=_.source!==void 0?f(_.source):T.source,L=T.target;if(!B||!L||L.id===A.id)continue;const N=T.waypoints&&T.waypoints.length>=3&&Math.abs(T.waypoints[0].x-T.waypoints[1].x)<1&&Math.abs(T.waypoints[0].y-T.waypoints[1].y)>1?{x:T.waypoints[0].x,y:T.waypoints[0].y}:void 0,j=N?T.waypoints[1].y:void 0,$=N&&T.label?{x:T.label.x,y:T.label.y}:void 0,Y=$&&T.label&&Math.abs($.y+T.label.height/2-j)<=I/5&&$.x+T.label.width>N.x?$.x+T.label.width+6:void 0,se=(B.outgoing??[]).filter(Ce=>Ce.type==="bpmn:SequenceFlow"&&Ce.id!==T.id&&Ce.target&&!ot.has(Ce.id)),xe=new Set(se.map(Ce=>Ce.target.id)),ae=Ce=>{const rt={type:"bpmn:Task",x:Ce.x+2,y:Ce.y+2,width:Ce.width-4,height:Ce.height-4};return se.find(Oe=>(Oe.waypoints??[]).some((xt,_t)=>!!Oe.waypoints[_t+1]&&qs(xt,Oe.waypoints[_t+1],rt)===0))},ge=vo(_.target),de=new Set(ge.map(Ce=>Ce.id)),Se=Math.min(...ge.map(Ce=>Ce.x)),pt=Math.max(...ge.map(Ce=>Ce.x+Ce.width)),Te=B.x+B.width,K=A.y+A.height/2,le=dt(ge,Te+Gt-Se,[0,B.y+B.height/2-K,L.y+L.height/2-K],L.x,Te,B.y+B.height/2),re=Te+Gt+le,fe=(()=>{if(Y===void 0)return 0;const Ce=Te+Gt,rt=B.y+B.height/2-A.height/2,Oe={x:Ce,y:rt,width:pt-Se,height:A.height},xt=d(B);return((xt==null?void 0:xt.children)??[]).some(Kt=>dr(Kt)&&!de.has(Kt.id)&&Kt.id!==B.id&&Kt.id!==L.id&&Kt.type!=="bpmn:Group"&&Kt.type!=="bpmn:Participant"&&Kt.x<Oe.x+Oe.width&&Kt.x+Kt.width>Oe.x&&Kt.y<Oe.y+Oe.height&&Kt.y+Kt.height>Oe.y)||ae(Oe)?Math.max(0,Y-Ce):0})(),ze=pt-Se+Gt*2+le+fe-(L.x-Te);let Ge=[];if(ze>0){const Ce=d(A),rt=(Ce==null?void 0:Ce.children)??[],Oe=At=>At.type==="bpmn:Lane";Ge=(()=>{const At=new Set;for(const Et of rt)dr(Et)&&!de.has(Et.id)&&Et.id!==B.id&&Et.x>=L.x&&At.add(Et.id);const ut=[];for(const Et of rt){if(Et.type!=="bpmn:DataStoreReference"&&Et.type!=="bpmn:DataObjectReference")continue;const qe=Et,Nn=[...qe.incoming??[],...qe.outgoing??[]].filter(En=>En.type==="bpmn:DataInputAssociation"||En.type==="bpmn:DataOutputAssociation").map(En=>En.source===qe?En.target:En.source);Nn.length&&Nn.every(En=>En!==void 0&&At.has(En.id))&&ut.push(qe)}return ut})();const _t=rt.filter(At=>!("waypoints"in At&&At.waypoints)&&!Oe(At)&&!de.has(At.id)&&At.id!==B.id&&At.x>=L.x),Kt=Ce?[Ce,...rt.filter(At=>Oe(At))]:[];if(_t.length){const At=new Set(_t.map(Sn=>Sn.id)),ut=rB(At),Et=new Set(At);for(const Sn of ut)for(const On of Sn.subtree)Et.add(On.id);const qe=iB(Et),Pt=qw(At),Nn=new Set(At);for(const Sn of ut)for(const On of Sn.subtree)Nn.add(On.id);const En=ut.length?qw(Nn):Pt;n.createSpace(_t,Kt,{x:ze,y:0},"e",L.x-1);let wi=!1;if(ut.length){const Sn=ba(),On=ks(ut,ze);if(On){const Ut=En.length?Kw(En,ze):null,at=ba();at.messages>Sn.messages&&at.lines>=Sn.lines?wi=!0:(Ut==null||Ut(),On())}}if(!wi){for(const Sn of ut){const On=ba(),Ut=ks([Sn],ze);if(!Ut)continue;const at=ba();(at.messages<=On.messages||at.lines<On.lines)&&Ut()}if(Pt.length){const Sn=ba(),On=Kw(Pt,ze);if(On){const Ut=ba();(Ut.messages<=Sn.messages||Ut.lines<Sn.lines)&&On()}}}if(qe.length){const Sn=()=>new Set(It(tt(o)).map(Ut=>Tt(Ut))),On=Ut=>{const at=Zw(),hn=Sn(),mn=Ut.map(St=>({a:St,x:St.x,y:St.y})),Ei=o.filter(St=>St.type==="label").map(St=>({label:St,x:St.x,y:St.y}));n.moveElements(Ut,{x:ze,y:0});const wa=[...Sn()].filter(St=>!hn.has(St));if(Zw()<at&&wa.length===0)return!0;for(const{a:St,x:wo,y:Ot}of mn)(St.x!==wo||St.y!==Ot)&&n.moveElements([St],{x:wo-St.x,y:Ot-St.y});for(const St of Ei){const wo=St.x-St.label.x,Ot=St.y-St.label.y;(wo!==0||Ot!==0)&&n.moveElements([St.label],{x:wo,y:Ot})}return!1};if(!On(qe)&&qe.length>1)for(const Ut of qe)On([Ut])}}}const mt=R.node.lane!==void 0?f(R.node.lane):R.node.participant!==void 0?f(R.node.participant):void 0,Bt=Ce=>{if(!mt)return!0;const rt=Ce.y+Ce.height/2;return rt>=mt.y&&rt<=mt.y+mt.height},he=!Bt(B)&&Bt(L)?L:B,me=he.y+he.height/2,J=me-(A.y+A.height/2),pe=R.band!==void 0,ke=pe?[A]:ge,Ue=(R.band===void 0||E(R.node.lane,R.node.participant,R.band,me))&&ft(_.target)&&ke.every(Ce=>{var rt;return qt((rt=O.get(Ce.id))==null?void 0:rt.node.lane,Ce,Ce.y+Ce.height/2+J)}),Ae=Ce=>Math.abs(Ce.y+Ce.height/2-(A.y+A.height/2))<=I/2;if(Ue&&pe){const Ce=Math.abs(J)<=I/2?ge.filter(rt=>rt.id!==A.id&&Ae(rt)):[];if(n.moveElements(ge,{x:re-Se,y:0}),n.moveElements([A],{x:0,y:J}),Ce.length){const rt=()=>new Set(It(tt(o)).map(ut=>Tt(ut))),Oe=rt(),xt=o.filter(ut=>ut.type==="label").map(ut=>({label:ut,x:ut.x,y:ut.y}));n.moveElements(Ce,{x:0,y:J});const _t=rt(),Kt=[..._t].filter(ut=>!Oe.has(ut)).length,At=[...Oe].filter(ut=>!_t.has(ut)).length;if(Kt>At){n.moveElements(Ce,{x:0,y:-J});for(const ut of xt){const Et=ut.x-ut.label.x,qe=ut.y-ut.label.y;(Et!==0||qe!==0)&&n.moveElements([ut.label],{x:Et,y:qe})}}}}else n.moveElements(ge,{x:re-Se,y:Ue?J:0});const $e=d(A);if(!Ue&&R.node.lane===void 0&&R.band!==void 0&&$e){const Ce=$e.y+ce+w(`pool:${R.node.participant??""}`,R.band)*I,rt=Ce-(A.y+A.height/2);rt!==0&&!X($e,A,A.x+A.width/2,Ce,de)&&n.moveElements([A],{x:0,y:rt})}if($e){const Ce=($e.children??[]).filter(_t=>dr(_t)&&!de.has(_t.id)&&_t.type!=="bpmn:Group"&&_t.type!=="bpmn:Participant"),rt=(_t,Kt,At,ut,Et)=>_t.x+Kt<Et.x+Et.width+ut&&_t.x+Kt+_t.width+ut>Et.x&&_t.y+At<Et.y+Et.height+ut&&_t.y+At+_t.height+ut>Et.y,Oe=Ce.find(_t=>rt(A,0,0,0,_t)),xt=Oe?void 0:ae(A);if(Oe||xt){const _t=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],Kt=o.getAll().filter(at=>{if(!_t.includes(at.type))return!1;const hn=at;return ot.has(hn.id)||!hn.waypoints||hn.waypoints.length<2?!1:![hn.source,hn.target].some(mn=>!mn||de.has(mn.id))}),At=(at,hn,mn)=>{var Ei;return qt((Ei=O.get(at.id))==null?void 0:Ei.node.lane,at,at.y+mn+at.height/2)&&at.x+hn>=$e.x&&at.x+hn+at.width<=$e.x+$e.width&&at.y+mn>=$e.y&&at.y+mn+at.height<=$e.y+$e.height},ut=(at,hn)=>ge.every(mn=>At(mn,at,hn)&&!Ce.some(Ei=>rt(mn,at,hn,Ui,Ei))&&Kt.every(Ei=>{const wa={id:mn.id,type:mn.type,x:mn.x+at,y:mn.y+hn,width:mn.width,height:mn.height};for(let St=0;St+1<Ei.waypoints.length;St++)if(qs(Ei.waypoints[St],Ei.waypoints[St+1],wa)<Ui)return!1;return!0})),Et=A.y+A.height/2,qe=[j,L.y+L.height/2].filter(at=>at!==void 0&&Math.abs(at-Et)>=1),Pt=Oe&&xe.has(Oe.id)?Oe:xt==null?void 0:xt.target,Nn=Pt?Pt.x-A.x:0,En=Math.max(...ge.map(at=>at.x+at.width)),wi=[...Nn!==0?[Nn]:[],...le!==0?[-le]:[],0],Sn=Y===void 0?[]:wi.map(at=>Math.max(at,Y-A.x)),On=[...new Set([...Sn,...wi])].filter(at=>En+at+Gt<=L.x);let Ut;for(const at of qe){for(const hn of On)if(ut(hn,at-Et)){Ut={dx:hn,dy:at-Et};break}if(Ut)break}if(Ut){const at=Ot=>{const Eo=Ot;return[Eo.edge,Eo.other,...Array.isArray(Eo.edges)?Eo.edges:[]].some(Is=>typeof Is=="string"&&ot.has(Is))},hn=()=>new Set(It(tt(o)).filter(Ot=>!at(Ot)).map(Ot=>Tt(Ot))),mn=hn(),Ei=o.filter(Ot=>Ot.type==="label").map(Ot=>({label:Ot,x:Ot.x,y:Ot.y}));n.moveElements(ge,{x:Ut.dx,y:Ut.dy});const wa=hn(),St=[...wa].filter(Ot=>!mn.has(Ot)).length,wo=[...mn].filter(Ot=>!wa.has(Ot)).length;if(St>wo){n.moveElements(ge,{x:-Ut.dx,y:-Ut.dy});for(const Ot of Ei){const Eo=Ot.x-Ot.label.x,Is=Ot.y-Ot.label.y;(Eo!==0||Is!==0)&&n.moveElements([Ot.label],{x:Eo,y:Is})}}else N&&e0.set(T.id,{exit:N,channelY:j,label:$})}}}const Ne=Ge.length?d(Ge[0]):void 0;if(Ne){const Ce={assoc:Xw(),overlaps:Jw(Ne),crosses:Qw()},rt=Ge.map(qe=>({st:qe,x:qe.x})),Oe=o.filter(qe=>qe.type==="label").map(qe=>({label:qe,x:qe.x,y:qe.y})),xt=Math.min(...Ge.flatMap(qe=>[...qe.incoming??[],...qe.outgoing??[]].filter(Pt=>Pt.type==="bpmn:DataInputAssociation"||Pt.type==="bpmn:DataOutputAssociation").map(Pt=>(Pt.source===qe?Pt.target:Pt.source).x))),_t=new Set(Ge.map(qe=>qe.id)),Kt=(Ne.children??[]).filter(dr).filter(qe=>!_t.has(qe.id));let At=xt;for(const qe of[...Ge].sort((Pt,Nn)=>Pt.x-Nn.x)){let Pt=At;for(let Nn=0;Nn<100;Nn++){const En=Kt.find(wi=>Pt<wi.x+wi.width+Yi&&Pt+qe.width+Yi>wi.x&&qe.y<wi.y+wi.height&&qe.y+qe.height>wi.y);if(!En)break;Pt=En.x+En.width+Yi}Pt!==qe.x&&n.moveElements([qe],{x:Pt-qe.x,y:0}),At=Pt+qe.width+Yi}const ut=At+150-(Ne.x+Ne.width);ut>0&&n.resizeShape(Ne,{x:Ne.x,y:Ne.y,width:Ne.width+ut,height:Ne.height});const Et={assoc:Xw(),overlaps:Jw(Ne),crosses:Qw()};if(Et.assoc>=Ce.assoc||Et.overlaps>Ce.overlaps||Et.crosses>Ce.crosses){for(const{st:qe,x:Pt}of rt)qe.x!==Pt&&n.moveElements([qe],{x:Pt-qe.x,y:0});ut>0&&n.resizeShape(Ne,{x:Ne.x,y:Ne.y,width:Ne.width-ut,height:Ne.height});for(const qe of Oe){const Pt=qe.x-qe.label.x,Nn=qe.y-qe.label.y;(Pt!==0||Nn!==0)&&n.moveElements([qe.label],{x:Pt,y:Nn})}}}}const t0=(_,R)=>{const A=R.target===_,T=p(R.source),B=p(R.target),L=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(T,B,R.id?{type:L,businessObject:i.create(L,{id:R.id})}:{type:L})},n0=100,i0=_=>{for(const R of h){if(!R.participant.blackBox)continue;const A=f(R.participant.id);if(!A)continue;const T=[];for(const L of g){const N=L.flow.source===R.participant.id?L.flow.target:L.flow.target===R.participant.id?L.flow.source:void 0,j=N?f(N):void 0;j&&typeof j.x=="number"&&j.type!=="bpmn:Participant"&&T.push(j)}if(!T.length)continue;if(!_&&R.order===void 0){const L=(()=>{var j;const N=new Map;for(const $ of T){const Y=d($);if(!Y)continue;const se=N.get(Y.id);se?se.n+=1:N.set(Y.id,{shape:Y,n:1})}return(j=[...N.values()].sort(($,Y)=>Y.n-$.n)[0])==null?void 0:j.shape})();if(L){const N=Y=>Y.reduce((se,xe)=>se+xe,0)/Y.length,j=N(T.map(Y=>Y.y+Y.height/2))<L.y+L.height/2,$=o.filter(Y=>Y.type==="bpmn:Participant"&&Y.id!==R.participant.id&&Y.id!==L.id).filter(Y=>j?Y.y+Y.height<=L.y+5:Y.y>=L.y+L.height-5);if($.length){const Y=[...$.reduce((re,fe)=>re.set(fe.y,(re.get(fe.y)??0)+1),new Map)].sort((re,fe)=>fe[1]-re[1]||(j?fe[0]-re[0]:re[0]-fe[0]))[0][0],se=Math.min(A.width,CS),xe=AS,ae=T.map(re=>re.x+re.width/2),ge=Math.round(N(ae)-se/2),de=Math.max(...ae)+n0,Se=re=>({x:re,width:Math.max(se,de-re)}),pt=$.filter(re=>Math.min(re.y+re.height,Y+xe)-Math.max(re.y,Y)>0),Te=re=>{const fe=Se(re);return pt.some(ze=>ze.x<fe.x+fe.width&&fe.x<ze.x+ze.width)},K=re=>{const fe=Se(re);return ae.filter(ze=>ze>=fe.x+10&&ze<=fe.x+fe.width-10).length},le=(()=>{if(!Te(ge))return ge;const re=K(ge);return pt.flatMap(fe=>[fe.x+fe.width+Sm,fe.x-Sm-se]).map(fe=>Math.round(fe)).filter(fe=>!Te(fe)&&K(fe)>=re).sort((fe,ze)=>Math.abs(fe-ge)-Math.abs(ze-ge))[0]??ge})();if(le!==A.x||Y!==A.y||se!==A.width||xe!==A.height){const re=()=>new Set(It(tt(o)).map(he=>Tt(he))),fe=re(),ze={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:le,y:Y,width:se,height:xe});const Ge=re(),mt=[...Ge].filter(he=>!fe.has(he)).length,Bt=[...fe].filter(he=>!Ge.has(he)).length;mt>Bt&&n.resizeShape(A,ze)}}}}const B=Math.max(...T.map(L=>L.x+L.width/2))+n0;if(B>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:B-A.x,height:A.height}),!!_)for(const L of g){const N=f(L.flow.id),j=L.flow.source===R.participant.id?L.flow.target:L.flow.target===R.participant.id?L.flow.source:void 0,$=j?f(j):void 0;if(!N||!$||$.type==="bpmn:Participant")continue;const Y=$.x+$.width/2;if(Y<A.x+10||Y>A.x+A.width-10)continue;const se=A.y>$.y,xe=se?$.y+$.height:$.y,ae=se?A.y:A.y+A.height,ge=L.flow.source===R.participant.id?[{x:Y,y:ae},{x:Y,y:xe}]:[{x:Y,y:xe},{x:Y,y:ae}],de=tt(o),Se={...de.edges.find(pt=>pt.id===L.flow.id),waypoints:ge};yn(Se,oi(de)).length||n.updateWaypoints(N,ge)}}};i0(!1);for(const _ of g){const R=_.flow;n.connect(p(R.source),p(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const A=new Set([...v.map($=>$.flow.id),...g.map($=>$.flow.id)].filter($=>!!$)),T=o.filter($=>!!$.waypoints),B=($,Y)=>Math.abs(Y.x-$.x)<2?"L":Math.abs(Y.x-($.x+$.width))<2?"R":Math.abs(Y.y-$.y)<2?"T":Math.abs(Y.y-($.y+$.height))<2?"B":void 0,L=new Map,N=($,Y,se)=>{if(!$||!Y||typeof $.x!="number")return;const xe=B($,Y);if(!xe)return;let ae=L.get($.id);ae||L.set($.id,ae=new Map),ae.set(xe,[...ae.get(xe)??[],se])};for(const $ of T){const Y=$.waypoints;!Y||Y.length<2||(N($.source,Y[0],{id:$.id,dir:"out"}),N($.target,Y[Y.length-1],{id:$.id,dir:"in"}))}const j=new Set;for(const[$,Y]of L){const se=f($);if(!se||typeof se.x!="number"||![...Y.values()].some(K=>{const le=K.filter(re=>re.dir==="in");return K.length>=3&&le.length>=1&&K.some(re=>re.dir==="out")&&le.some(re=>A.has(re.id))}))continue;const ae=d(se);if(!ae||j.has(ae.id)||(ae.children??[]).some(K=>K.type==="bpmn:Lane"))continue;const ge=(b0=Y.get("T"))!=null&&b0.length?(x0=Y.get("B"))!=null&&x0.length?void 0:"B":"T";if(!ge||(ge==="T"?se.y-ae.y:ae.y+ae.height-(se.y+se.height))>=I)continue;const Se=(ae.children??[]).filter(K=>!("waypoints"in K&&K.waypoints)&&K.type!=="label"&&typeof K.x=="number"),pt=ae.y+ae.height;n.resizeShape(ae,{x:ae.x,y:ae.y,width:ae.width,height:ae.height+I});const Te=u().children.filter(K=>!("waypoints"in K&&K.waypoints)&&K.id!==ae.id&&typeof K.y=="number"&&K.y>=pt);Te.length&&n.moveElements(Te,{x:0,y:I}),ge==="T"&&Se.length&&n.moveElements(Se,{x:0,y:I}),j.add(ae.id)}}const Wd=20,r0=4,oB=2,aB=[10,30,80],xa=()=>{const _=tt(o);return{bad:It(_).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:Fh(_),straight:_.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},_a=_=>{const R=tt(o),A=R.edges.find(T=>T.id===_);return A?yn(A,oi(R)).length:0},uu=_=>_a(_)>0,pu=_=>tt(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==_&&R.waypoints.length===2).length,sB=(_,R,A)=>ks([{subtree:_,pool:R}],A),o0=(_,R)=>R.bad>_.bad||R.crossings>_.crossings&&R.straight<=_.straight&&R.bad>=_.bad,fu=(_,R)=>o0(_,R)||R.straight<_.straight,du=(_,R,A=()=>!0,T=o0)=>{const B=xa(),L=ks(_,R);if(!L)return!1;const N=xa();return T(B,N)||!A()?(L(),!1):!0},a0=(_,R,A,T=()=>!0)=>du([{subtree:_,pool:R}],A,T),bo=_=>{var R;return!!((R=O.get(_))!=null&&R.node.participant)},Os=new Map;for(const _ of g){if(!bo(_.flow.target))continue;const R=Os.get(_.flow.target)??[];R.push(_),Os.set(_.flow.target,R)}const hu=[...Os.keys()],Ud=new Set(v.map(_=>_.flow.target)),s0=_=>fn.findIndex(({op:R})=>R.participant.id===_);hu.sort((_,R)=>{var B,L;const A=Ud.has(_)?1:0,T=Ud.has(R)?1:0;return A!==T?A-T:s0((B=O.get(_))==null?void 0:B.node.participant)-s0((L=O.get(R))==null?void 0:L.node.participant)});const xo=_=>_.x+_.width/2,cB=_=>{const R=new Map;for(const B of o.getAll()){const L=B;if(!L.waypoints||!L.source||!L.target)continue;(R.get(L.source.id)??R.set(L.source.id,[]).get(L.source.id)).push(L.target.id)}const A=new Set([_]),T=[_];for(let B=0;B<T.length;B++)for(const L of R.get(T[B])??[])A.has(L)||(A.add(L),T.push(L));return A},lB=(_,R)=>{const A=cB(R);let T;for(const B of o.getAll()){const L=B;if(L.type!=="bpmn:MessageFlow"||!L.source||!L.target||L.target.id!==_||A.has(L.source.id))continue;const N=L.source;if(typeof N.x!="number"||N.type==="bpmn:Participant")continue;const j=xo(N);(T===void 0||j>T)&&(T=j)}return T},Yd=(_,R)=>{const A=f(_.flow.source);if(A)return A.type==="bpmn:Participant"?lB(A.id,R):xo(A)},c0=_=>{let R;for(const A of Os.get(_)??[]){const T=Yd(A,_);T!==void 0&&(!R||T>R.cx)&&(R={op:A,cx:T})}return R==null?void 0:R.op},uB=_=>{const R=c0(_),A=f(_),T=R?Yd(R,_):void 0;return A&&T!==void 0?T-xo(A):void 0},pB=_=>{const R=uB(_);return R!==void 0&&Math.abs(R)<Wd},l0=(_,R,A,T,B)=>{var L;for(let N=!0;N;){N=!1;for(const j of g){if(j.flow.id===A)continue;const $=R.has(j.flow.source),Y=R.has(j.flow.target);if($===Y||T($?j.flow.source:j.flow.target))continue;const se=$?j.flow.target:j.flow.source;if(B(se)||!bo(se))continue;const xe=f(j.flow.id);if(!(xe!=null&&xe.waypoints)||xe.waypoints.length!==2)continue;const ae=f(se),ge=(L=O.get(se))==null?void 0:L.node.participant;if(!ae||!ge)continue;const de=vo(se,Se=>Se.x>=ae.x).filter(Se=>!R.has(Se.id));if(!(!de.length||de.some(Se=>B(Se.id)))){for(const Se of de)R.add(Se.id);_.set(ge,[..._.get(ge)??[],...de]),N=!0}}}return[..._].map(([N,j])=>({subtree:j,pool:p(N)}))},u0=(_,R,A,T,B)=>l0(new Map([[R,[..._]]]),new Set(_.map(L=>L.id)),T,L=>L===A,L=>L===B),qd=_=>{const R=c0(_);if(!R)return null;const A=f(_),T=f(R.flow.source),B=Yd(R,_);if(!A||!T||B===void 0)return null;const L=B-xo(A);if(L>=Wd){const N=O.get(_).node.participant,j=vo(_,$=>$.x>=A.x);return{groups:u0(j,N,_,R.flow.id,R.flow.source),dx:L}}if(-L>=Wd&&bo(R.flow.source)){const N=O.get(R.flow.source).node.participant,j=vo(R.flow.source,$=>$.x>=T.x&&!pB($.id));return{groups:u0(j,N,R.flow.source,R.flow.id,_),dx:-L}}return null},p0=()=>hu.map(_=>({id:_,plan:qd(_)})).filter(_=>!!_.plan).sort((_,R)=>Math.min(..._.plan.groups.flatMap(A=>A.subtree.map(T=>T.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map(T=>T.x)))).map(_=>_.id);for(let _=0;_<3;_++){const R=xa(),A=[];for(const B of p0()){const L=qd(B);if(!L)continue;const N=ks(L.groups,L.dx);N&&A.push(N)}if(!A.length)break;if(!fu(R,xa()))continue;for(const B of A.reverse())B();let T=!1;for(const B of p0()){const L=qd(B);L&&du(L.groups,L.dx,()=>!0,fu)&&(T=!0)}if(!T)break}for(const _ of hu){if(Ud.has(_))continue;const R=O.get(_);if(!R||R.node.lane!==void 0)continue;const A=V(R);if(A===void 0)continue;const T=f(_),B=T?d(T):void 0;if(!T||!B)continue;const L=B.y+ce+w(`pool:${R.node.participant??""}`,A)*I,N=L-(T.y+T.height/2);N!==0&&!X(B,T,T.x+T.width/2,L)&&n.moveElements([T],{x:0,y:N})}for(const _ of hu.flatMap(R=>Os.get(R)??[])){if(!uu(_.flow.id))continue;const R=f(_.flow.target);if(!R)continue;const A=p(O.get(_.flow.target).node.participant),T=vo(_.flow.target,j=>j.x>=R.x),B=R.width+z,L=_a(_.flow.id),N=pu(_.flow.id);for(let j=1;j<=r0;j++){const $=()=>_a(_.flow.id)<L&&pu(_.flow.id)>=N;if(a0(T,A,B*j,$))break}}for(const _ of g){if(!uu(_.flow.id))continue;const R=f(_.flow.source),A=f(_.flow.target);if(!R||!A||R.type==="bpmn:Participant"||A.type==="bpmn:Participant")continue;const T=R.x+R.width/2;if(Math.abs(T-(A.x+A.width/2))>15)continue;const[B,L]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y],N=[...O.values()].map(j=>f(j.node.id)).filter(j=>!!j&&j.id!==R.id&&j.id!==A.id).filter(j=>j.x<=T&&T<=j.x+j.width&&j.y+j.height>B&&j.y<L).sort((j,$)=>j.x-$.x);for(const j of N){const $=(_0=O.get(j.id))==null?void 0:_0.node.participant,Y=$?f($):void 0;if(!Y)continue;const se=[...O.values()].filter(le=>le.node.participant===$).map(le=>le.node.id),xe=le=>le.map(re=>f(re)).filter(re=>!!re),ge=[nB(j.id,le=>{var re;return((re=O.get(le.id))==null?void 0:re.node.participant)===$}),xe(se)].filter(le=>le.length),de=j.width+z,Se=_a(_.flow.id),pt=pu(_.flow.id),Te=()=>_a(_.flow.id)<Se&&pu(_.flow.id)>=pt;let K=!1;for(const le of ge){for(let re=1;re<=r0;re++)if(a0(le,Y,de*re,Te)){K=!0;break}if(K)break}if(!uu(_.flow.id))break}}for(const _ of g){if(!uu(_.flow.id))continue;const R=f(_.flow.id);if(((w0=R==null?void 0:R.waypoints)==null?void 0:w0.length)!==2)continue;const A=f(_.flow.source),T=f(_.flow.target);if(!A||!T||A.type==="bpmn:Participant"||T.type==="bpmn:Participant"||!bo(_.flow.source)||!bo(_.flow.target)||Math.abs(xo(A)-xo(T))>oB)continue;const B=xo(A),L=R.waypoints.map(Se=>Se.y),[N,j]=[Math.min(...L),Math.max(...L)],$=oi(tt(o)).filter(Se=>Se.id!==A.id&&Se.id!==T.id&&Se.x<B&&B<Se.x+Se.width&&N<Se.y+Se.height&&Se.y<j);if(!$.length)continue;const Y=(E0=O.get(_.flow.source))==null?void 0:E0.node.participant,se=(S0=O.get(_.flow.target))==null?void 0:S0.node.participant;if(!Y||!se)continue;const xe=new Map;for(const[Se,pt,Te]of[[_.flow.source,A,Y],[_.flow.target,T,se]]){const K=xe.get(Te)??[],le=vo(Se,re=>re.x>=pt.x).filter(re=>!K.some(fe=>fe.id===re.id));xe.set(Te,[...K,...le])}const ae=new Set([...xe.values()].flat().map(Se=>Se.id)),ge=l0(xe,ae,_.flow.id,Se=>Se===_.flow.source||Se===_.flow.target,()=>!1),de=Math.max(...$.map(Se=>Se.x+Se.width));for(const Se of aB){const pt=de+Se-B;if(pt<=0)continue;if(du(ge,pt,()=>{var K,le;return _a(_.flow.id)===0&&((le=(K=f(_.flow.id))==null?void 0:K.waypoints)==null?void 0:le.length)===2},fu))break}}{const _=A=>A.y+A.height/2,R=[];for(const A of O.keys()){if(!bo(A))continue;const T=v.filter(N=>N.flow.target===A);if(T.length!==1)continue;const B=f(T[0].flow.source),L=f(A);!B||!L||!O.has(B.id)||Math.abs(_(B)-_(L))>1||L.x-(B.x+B.width)<=z+1||R.push({id:A,pred:B,node:L})}R.sort((A,T)=>A.node.x-T.node.x);for(const{id:A}of R){const T=O.get(A),B=f(A),L=f(v.find(ae=>ae.flow.target===A).flow.source);if(!B||!L)continue;const N=B.x-(L.x+L.width);if(N<=z+1)continue;const j=p(T.node.participant),$=vo(A,ae=>ae.x>=B.x),Y=xa(),se=sB($,j,-(N-z));if(!se)continue;const xe=xa();(xe.bad>Y.bad||xe.crossings>=Y.crossings||xe.straight<Y.straight)&&se()}}i0(!0);for(const _ of b){const R=_.associations??[],A=R.map(L=>L.source===_.dataStore.id?L.target:L.source).map(f).find(Boolean),T=A?d(A)??u():u(),B=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:dn+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:_.dataStore.id,name:_.dataStore.name})},B,T);for(const L of R)t0(_.dataStore.id,L)}for(const _ of x){const A=p(_.association.target).type==="bpmn:DataStoreReference"?_.association.target:_.association.source;t0(A,_.association)}let f0=0;const _o=10,d0=40,fB=(_,R)=>{const A=R.map($=>d($)).filter($=>!!$);for(const $ of A){const Y=_o,se=$.y,xe=$.y+$.height,ae=$.x,ge=$.x+$.width;if(Math.abs(_.y-se)<Y){const de=se+Y-_.y;_.y+=de,_.height-=de}if(Math.abs(_.y+_.height-xe)<Y&&(_.height=xe-Y-_.y),Math.abs(_.x-ae)<Y){const de=ae+Y-_.x;_.x+=de,_.width-=de}Math.abs(_.x+_.width-ge)<Y&&(_.width=ge-Y-_.x)}if(!A.length)return;const T=Math.min(...A.map($=>$.y)),B=Math.max(...A.map($=>$.y+$.height)),L=T-_.y,N=_.y+_.height-B,j=d0-_o;if(L>0!=N>0)if(L>0&&L<j){const $=L+_o;_.y+=$,_.height-=$}else N>0&&N<j&&(_.height-=N+_o)},dB=(_,R)=>{const A=_o,T=30,B=o.filter(L=>L.type==="bpmn:Group"&&L.id!==R);for(const L of B){const N=L.x,j=L.x+L.width,$=L.y,Y=L.y+L.height,se=_.y<Y&&$<_.y+_.height,xe=_.x<j&&N<_.x+_.width;if(se){if(Math.abs(_.x-j)<A){const ae=Math.min(j+A-_.x,T);ae>0&&_.width-ae>0&&(_.x+=ae,_.width-=ae)}if(Math.abs(_.x+_.width-N)<A){const ae=Math.min(_.x+_.width-(N-A),T);ae>0&&_.width-ae>0&&(_.width-=ae)}}if(xe){if(Math.abs(_.y-Y)<A){const ae=Math.min(Y+A-_.y,T);ae>0&&_.height-ae>0&&(_.y+=ae,_.height-=ae)}if(Math.abs(_.y+_.height-$)<A){const ae=Math.min(_.y+_.height-($-A),T);ae>0&&_.height-ae>0&&(_.height-=ae)}}}},Kd=(_,R)=>{const A=d0,T=Math.min(..._.map($=>$.x))-A,B=Math.min(..._.map($=>$.y))-A,L=Math.max(..._.map($=>$.x+$.width))+A,N=Math.max(..._.map($=>$.y+$.height))+A,j={x:T,y:B,width:L-T,height:N-B};return fB(j,_),dB(j,R),j};for(const _ of M){const R=(_.group.members??[]).map(f).filter(B=>!!B);let A;R.length?A=Kd(R,_.group.id):(A={x:300+f0*350,y:40,width:300,height:200},f0++);const T=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:_.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());_.group.name&&n.updateLabel(T,_.group.name),(R0=_.group.members)!=null&&R0.length&&P(T,"bwl:Members",{refs:_.group.members.join(" ")})}{const _=o.filter(B=>!!B.waypoints),R=new Map,A=(B,L)=>{!B||!L||(R.has(B)||R.set(B,new Set),R.get(B).add(L))};for(const B of _){const L=(C0=B.source)==null?void 0:C0.id,N=(A0=B.target)==null?void 0:A0.id;A(L,N),((P0=B.type)!=null&&P0.includes("DataOutputAssociation")||(M0=B.type)!=null&&M0.includes("DataInputAssociation")||B.type==="bpmn:Association")&&A(N,L)}const T=o.filter(B=>B.type==="bpmn:Group");for(const B of T){const N=(((T0=B.businessObject.extensionElements)==null?void 0:T0.values)??[]).find(Te=>Te.$type==="bwl:Members"),j=((N==null?void 0:N.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const $=new Set(j),Y=[...j];for(;Y.length;){const Te=Y.shift();for(const K of R.get(Te)??[])$.has(K)||($.add(K),Y.push(K))}const se=B.x,xe=B.x+B.width,ae=B.y,ge=B.y+B.height,de=Te=>v.filter(K=>K.flow.target===Te).length,Se=Te=>{var le;const K=((le=f(Te))==null?void 0:le.type)??"";if(K==="bpmn:StartEvent"&&de(Te)===0)return!1;if(K.endsWith("Gateway")){const re=v.filter(fe=>fe.flow.target===Te).map(fe=>fe.flow.source);if(re.length&&re.every(fe=>{var ze;return((ze=f(fe))==null?void 0:ze.type)==="bpmn:StartEvent"&&de(fe)===0}))return!1}return!0},pt=o.filter(Te=>dr(Te)).filter(Te=>Te.type!=="bpmn:Group"&&Te.type!=="bpmn:Participant"&&Te.type!=="bpmn:TextAnnotation"&&!$.has(Te.id)&&bo(Te.id)&&Se(Te.id)&&Te.x<xe&&Te.x+Te.width>se&&Te.y<ge&&Te.y+Te.height>ae);if(pt.length)for(const Te of[-1,1]){const K=pt.filter(me=>(me.x+me.width-se<=xe-me.x?-1:1)===Te);if(!K.length)continue;const le=[];for(const me of K){const J=le.find(pe=>pe.some(ke=>me.y<ke.y+ke.height&&me.y+me.height>ke.y));J?J.push(me):le.push([me])}const re=new Map;for(const me of le){let J=Te<0?se-_o:xe+_o;for(const pe of[...me].sort((ke,Ue)=>Te<0?Ue.x-ke.x:ke.x-Ue.x)){const ke=Te<0?Math.min(pe.x,J-pe.width):Math.max(pe.x,J);J=Te<0?ke-Yi:ke+pe.width+Yi,ke!==pe.x&&Math.sign(ke-pe.x)===Te&&re.set(pe.id,ke-pe.x)}}const fe=new Map,ze=me=>fe.get(me)===me||!fe.get(me)?me:ze(fe.get(me));for(const me of K)fe.set(me.id,me.id);for(const me of g){const J=re.has(me.flow.source)?me.flow.source:void 0,pe=re.has(me.flow.target)?me.flow.target:void 0;if(!J||!pe)continue;const ke=f(me.flow.id);((k0=ke==null?void 0:ke.waypoints)==null?void 0:k0.length)===2&&fe.set(ze(J),ze(pe))}const Ge=new Map;for(const me of K){if(!re.has(me.id))continue;const J=ze(me.id);Ge.set(J,[...Ge.get(J)??[],me])}const mt=[...Ge.values()].sort((me,J)=>Te<0?Math.min(...me.map(pe=>pe.x))-Math.min(...J.map(pe=>pe.x)):Math.max(...J.map(pe=>pe.x))-Math.max(...me.map(pe=>pe.x))),Bt=[];let he=!0;for(const me of mt){const J=me.map(Ue=>re.get(Ue.id)??0).reduce((Ue,Ae)=>Math.abs(Ae)>Math.abs(Ue)?Ae:Ue,0),pe=new Map;let ke=!0;for(const Ue of me){const Ae=d(Ue);if(!Ae){ke=!1;break}pe.has(Ae.id)||pe.set(Ae.id,{subtree:[],pool:Ae}),pe.get(Ae.id).subtree.push(Ue)}ke&&du([...pe.values()],J,()=>!0,fu)?Bt.push({shapes:me,dx:J}):he=!1}if(!he)for(const me of Bt.reverse())n.moveElements(me.shapes,{x:-me.dx,y:0})}}}{const _=new Set([...M.map(R=>R.group.id),...Xt(e,"group.update").map(R=>R.id)]);for(const R of o.filter(A=>A.type==="bpmn:Group")){if(_.has(R.id))continue;const T=(((O0=R.businessObject.extensionElements)==null?void 0:O0.values)??[]).find(j=>j.$type==="bwl:Members"),B=((T==null?void 0:T.refs)??"").split(" ").filter(Boolean).map(f).filter(j=>!!j);!B.length||!B.some(j=>{const $=m.get(j.id);return!$||$.x!==j.x||$.y!==j.y})||!B.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,Kd(B,R.id))}}{const R=new Map(Bo(tt(o)).map(j=>[j.owner,j.rect])),A=o.filter(j=>!!j.waypoints),T=new Map,B=(j,$)=>{!j||!$||(T.has(j)||T.set(j,new Set),T.get(j).add($))};for(const j of A){const $=(D0=j.source)==null?void 0:D0.id,Y=(I0=j.target)==null?void 0:I0.id;B($,Y),((L0=j.type)!=null&&L0.includes("DataOutputAssociation")||(B0=j.type)!=null&&B0.includes("DataInputAssociation")||j.type==="bpmn:Association")&&B(Y,$)}const L=j=>v.filter($=>$.flow.target===j).length,N=j=>{var Y;const $=((Y=f(j))==null?void 0:Y.type)??"";if($==="bpmn:StartEvent"&&L(j)===0)return!1;if($.endsWith("Gateway")){const se=v.filter(xe=>xe.flow.target===j).map(xe=>xe.flow.source);if(se.length&&se.every(xe=>{var ae;return((ae=f(xe))==null?void 0:ae.type)==="bpmn:StartEvent"&&L(xe)===0}))return!1}return!0};for(const j of o.filter($=>$.type==="bpmn:Group")){const Y=(((N0=j.businessObject.extensionElements)==null?void 0:N0.values)??[]).find(J=>J.$type==="bwl:Members"),se=((Y==null?void 0:Y.refs)??"").split(" ").filter(Boolean);if(!se.length)continue;const xe=se.map(f).filter(J=>!!J);if(!xe.length||!(M.some(J=>J.group.id===j.id)||Xt(e,"group.update").some(J=>J.id===j.id)||xe.some(J=>{const pe=m.get(J.id);return!pe||pe.x!==J.x||pe.y!==J.y})))continue;const ge=new Set(se),de=[...se];for(;de.length;){const J=de.shift();for(const pe of T.get(J)??[])ge.has(pe)||(ge.add(pe),de.push(pe))}const Se=j.x,pt=j.x+j.width,Te=j.y,K=j.y+j.height,le=J=>{const pe=R.get(J.id),ke={x:J.x,y:J.y,width:J.width,height:J.height};return pe?[ke,{x:pe.x,y:pe.y,width:pe.width,height:pe.height}]:[ke]},re=xe.flatMap(le),fe=Math.min(...re.map(J=>J.x)),ze=Math.max(...re.map(J=>J.x+J.width)),Ge=Math.min(...re.map(J=>J.y)),mt=Math.max(...re.map(J=>J.y+J.height)),Bt={L:fe-Se,R:pt-ze,T:Ge-Te,B:K-mt},he=o.filter(J=>dr(J)).filter(J=>J.type!=="bpmn:Group"&&J.type!=="bpmn:Participant"&&J.type!=="bpmn:TextAnnotation"&&!ge.has(J.id)&&N(J.id)&&J.x<pt&&J.x+J.width>Se&&J.y<K&&J.y+J.height>Te);if(!he.length)continue;const me={L:0,R:0,T:0,B:0};for(const J of he){const pe=le(J),ke=Math.min(...pe.map(Oe=>Oe.x)),Ue=Math.max(...pe.map(Oe=>Oe.x+Oe.width)),Ae=Math.min(...pe.map(Oe=>Oe.y)),$e=Math.max(...pe.map(Oe=>Oe.y+Oe.height)),Ne={L:Ue-Se,R:pt-ke,T:$e-Te,B:K-Ae},Ce=["L","R","T","B"].filter(Oe=>Ne[Oe]<=Bt[Oe]+.001);if(!Ce.length)continue;const rt=Ce.reduce((Oe,xt)=>Ne[xt]<Ne[Oe]?xt:Oe,Ce[0]);me[rt]=Math.max(me[rt],Math.min(Ne[rt]+10,Bt[rt]))}!me.L&&!me.R&&!me.T&&!me.B||n.resizeShape(j,{x:j.x+me.L,y:j.y+me.T,width:j.width-me.L-me.R,height:j.height-me.T-me.B})}}const h0=_=>{const R=_.waypoints;if(R!=null&&R.length){const T=R[Math.floor((R.length-1)/2)];return{x:T.x,y:T.y,width:0,height:0}}const A=_;return{x:A.x,y:A.y,width:A.width,height:A.height}};let Ds=0;const m0=12,g0=14,hB=15,mB=300,gB=_=>{const R=_.split(`
7
- `),A=Math.max(...R.map(L=>Do(L,m0))),T=Math.max(100,Math.min(mB,Math.ceil(A)+g0)),B=R.reduce((L,N)=>L+Math.max(1,Math.ceil((Do(N,m0)+g0)/T)),0);return{width:T,height:Math.max(30,B*hB+10)}};for(const _ of C){const R=_.association,A=(($0=_.placement)==null?void 0:$0.anchor)??(R?R.source===_.annotation.id?R.target:R.source:void 0),T=A?f(A):void 0,B=T?h0(T):void 0,L=gB(_.annotation.text??"");let N;if(B&&_.placement){const[se,xe]=ic[_.placement.side],ae=_.placement.offset??50;N={x:B.x+B.width/2+se*(B.width/2+L.width/2+ae),y:B.y+B.height/2+xe*(B.height/2+L.height/2+ae)}}else B?(N={x:B.x+B.width/2+180+Ds%3*260,y:B.y-110-Ds%2*95},Ds++):(N={x:300+Ds*260,y:60},Ds++);const j=T?d(T)??u():u(),$=j;B&&typeof $.x=="number"&&typeof $.width=="number"&&$.type==="bpmn:Participant"&&(N=Yu(o,B,L,$,_.placement?{placement:_.placement}:{from:N}));const Y=n.createShape({type:"bpmn:TextAnnotation",width:L.width,height:L.height,businessObject:i.create("bpmn:TextAnnotation",{id:_.annotation.id,text:_.annotation.text})},N,j);if(R){const se=xe=>xe===_.annotation.id?Y:p(xe);n.connect(se(R.source),se(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}_.placement&&P(Y,"bwl:Placement",F(_.placement))}for(const _ of Xt(e,"association.add")){const R=_.association;n.connect(p(R.source),p(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const _ of Xt(e,"node.update")){let R=p(_.id);if(_.type&&nc(_.type)!==R.type&&(R=c.replaceElement(R,{type:nc(_.type)})),_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.lane||_.band!==void 0){_.band!==void 0&&n.updateProperties(R,{"bwl:band":_.band});const A=R.y+R.height/2,T=d(R),B=_.lane?p(_.lane):((T==null?void 0:T.children)??[]).find(N=>N.type==="bpmn:Lane"&&A>=N.y&&A<=N.y+N.height);_.band!==void 0&&lt(B==null?void 0:B.id,_.band,T);const L=B?B.y+(_.band===void 0?B.height/2:Math.min(B.height/2,ve)+w(B.id,_.band)*I):_.band!==void 0&&T?T.y+ce+w(`pool:${T.id}`,_.band)*I:void 0;if(L!==void 0){const N=L-A;N!==0&&n.moveElements([R],{x:0,y:N})}}}for(const _ of Xt(e,"sequenceFlow.update")){const R=p(_.id);if(_.source!==void 0||_.target!==void 0){const A=R,T=_.source!==void 0?p(_.source):A.source,B=_.target!==void 0?p(_.target):A.target,L=$=>({x:$.x+$.width/2,y:$.y+$.height/2});n.reconnect(A,T,B,[L(T),L(B)]);const N=e0.get(A.id),j=B.y+B.height/2;if(N&&B.x>N.exit.x&&Math.abs(j-N.exit.y)>1){n.updateWaypoints(A,[N.exit,{x:N.exit.x,y:j},{x:B.x,y:j}]);const $=A.label;if($&&N.label){const se=Math.abs(N.label.y+$.height/2-N.channelY)<=I/5&&N.label.x+$.width>N.exit.x,xe=N.exit.x+6,ae=B.x-6-$.width,ge=se?ae>=xe?{x:Math.max(xe,Math.min(N.label.x,ae)),y:N.label.y+(j-N.channelY)}:void 0:N.label;ge&&(ge.x!==$.x||ge.y!==$.y)&&n.moveElements([$],{x:ge.x-$.x,y:ge.y-$.y})}}}_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.condition!==void 0&&n.updateProperties(R,{name:((F0=_.condition)==null?void 0:F0.label)??void 0})}for(const _ of Xt(e,"messageFlow.update"))_.name!==void 0&&n.updateProperties(p(_.id),{name:_.name??void 0});for(const _ of Xt(e,"dataStore.update"))_.name!==void 0&&n.updateProperties(p(_.id),{name:_.name??void 0});for(const _ of Xt(e,"annotation.update")){const R=p(_.id);if(_.text!==void 0&&n.updateProperties(R,{text:_.text}),_.placement===null)P(R,"bwl:Placement",null);else if(_.placement){const A=p(_.placement.anchor),T=h0(A),B=d(A)??u(),L=typeof B.x=="number"&&typeof B.width=="number"&&B.type==="bpmn:Participant",[N,j]=ic[_.placement.side],$=_.placement.offset??50,Y={x:T.x+T.width/2+N*(T.width/2+R.width/2+$),y:T.y+T.height/2+j*(T.height/2+R.height/2+$)},se=L?Yu(o,T,{width:R.width,height:R.height},B,{placement:_.placement,selfId:_.id}):Y;n.moveElements([R],{x:se.x-(R.x+R.width/2),y:se.y-(R.y+R.height/2)}),P(R,"bwl:Placement",F(_.placement))}}for(const _ of Xt(e,"group.update")){const R=p(_.id);if(_.name!==void 0&&n.updateLabel(R,_.name??""),_.members){const A=_.members.map(f).filter(T=>!!T);A.length&&n.resizeShape(R,Kd(A,_.id)),P(R,"bwl:Members",{refs:_.members.join(" ")})}}}function qu(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 MS(e,t,n){var u,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>It(p).filter(d=>!t.has(Tt(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=tt(i),c=o(s),l=[...new Set(c.flatMap(qu))].filter(p=>n.has(p)&&a(p));if(l.length)for(const p of l){const d=i.get(p);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let m=d.parent,h;for(;m;){if(m.type==="bpmn:Participant"){h=m;break}m=m.parent}if(!h){const ve=d.x+d.width/2,Ye=d.y+d.height/2;h=i.getAll().find(He=>{if(He.type!=="bpmn:Participant")return!1;const it=He;return typeof it.x=="number"&&typeof it.width=="number"&&ve>=it.x&&ve<=it.x+it.width&&Ye>=it.y&&Ye<=it.y+it.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const v=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(ve=>ve.$type==="bwl:Placement"),g=[...d.incoming??[],...d.outgoing??[]].find(ve=>ve.type==="bpmn:Association"),b=(v!=null&&v.anchor?i.get(v.anchor):void 0)??(g?((f=g.source)==null?void 0:f.id)===p?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},O={x:d.x+d.width/2,y:d.y+d.height/2},P=v==null?void 0:v.side,F=[];P&&P in ic&&F.push(Yu(i,C,M,h,{placement:{side:P,offset:(v==null?void 0:v.offset)??null},selfId:p}));for(const[ve,Ye]of[[-1,0],[1,0],[0,-1],[0,1]])for(let He=1;He<=PS;He++)F.push({x:O.x+ve*Rm*He,y:O.y+Ye*Rm*He});const D={...s,edges:s.edges.filter(ve=>ve.id!==(g==null?void 0:g.id))},I=o(D),z=I.filter(ve=>qu(ve).includes(p)).length;if(!z)continue;let ce;for(const ve of F){const Ye=ve.x-O.x,He=ve.y-O.y;if(!Ye&&!He||ve.x-M.width/2<h.x||ve.x+M.width/2>h.x+h.width||ve.y-M.height/2<h.y||ve.y+M.height/2>h.y+h.height)continue;const it={...D,shapes:D.shapes.map(_e=>_e.id===p?{..._e,x:_e.x+Ye,y:_e.y+He}:_e)},X=o(it),Q=X.filter(_e=>qu(_e).includes(p)).length;if(Q>=z||X.length>I.length)continue;const ue=Math.abs(Ye)+Math.abs(He);if((!ce||Q<ce.mine||Q===ce.mine&&(X.length<ce.all||X.length===ce.all&&ue<ce.dist))&&(ce={x:ve.x,y:ve.y,mine:Q,all:X.length,dist:ue}),ce.mine===0&&ce.all<I.length)break}ce&&r.moveElements([d],{x:ce.x-O.x,y:ce.y-O.y})}}const TS=60;function kS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>It(u).filter(f=>!t.has(Tt(f))),a=u=>u.filter(f=>f.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,f)=>f.x>=u.x&&f.y>=u.y&&f.x+f.width<=u.x+u.width&&f.y+f.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const p=new Set,d=new Set([u]);for(let h=0;h<4;h++){let y=!1;for(const v of n.shapes)v.type!=="bpmn:Group"||p.has(v.id)||[...d].some(g=>{const b=s.get(g);return b&&c(v,b)})&&(p.add(v.id),y=!0);for(const v of n.shapes)v.type!=="bpmn:Participant"||d.has(v.id)||[...p].some(g=>{const b=s.get(g);return b&&c(b,v)})&&(d.add(v.id),y=!0);if(!y)break}const m=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!p.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...p].some(y=>{const v=s.get(y);return v&&c(v,h)})).map(h=>h.id);return[...d,...p,...m]};for(let u=0;u<6;u++){const f=tt(i),p=o(f),d=a(p);if(!d.length)return;const m=new Map(f.shapes.map(x=>[x.id,x]));let h=null;for(const x of d){if(x.kind!=="pool-overlap")continue;const[C,M]=x.pools,O=m.get(C),P=m.get(M);if(!O||!P)continue;const[F,D]=O.x<=P.x?[O,P]:[P,O];if(x.contained)continue;const I=s.get(F.id),z=s.get(D.id),ce=I&&z?Math.max(z.x-(I.x+I.width),0):TS,ve=F.x+F.width+ce-D.x;if(ve<=0)continue;const Ye=l(D.id).filter(He=>i.get(He));Ye.length&&(!h||ve>h.dx)&&(h={movers:Ye,dx:ve})}if(!h)return;const y=h.movers.map(x=>i.get(x)).filter(x=>!!x&&typeof x.x=="number");if(!y.length)return;const v=p.length,g=d.length;r.moveElements(y,{x:h.dx,y:0});const b=o(tt(i));if(!(a(b).length<g&&b.length<=v)){r.moveElements(y,{x:-h.dx,y:0});return}}}function OS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>It(l).filter(u=>!t.has(Tt(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const f=n.shapes.filter(M=>M.id!==l.id&&M.type!=="bpmn:Group"&&a(l,M));if(!f.length)continue;const p=f.map(M=>i.get(M.id)).filter(M=>!!M&&typeof M.x=="number");if(p.length!==f.length)continue;const d=s(f),m=s(p),h=m.l+(l.x-d.l),y=m.t+(l.y-d.t),v=m.r+(l.x+l.width-d.r),g=m.b+(l.y+l.height-d.b),b={x:h,y,width:v-h,height:g-y};if(b.width<=0||b.height<=0||Math.abs(b.x-u.x)<1&&Math.abs(b.y-u.y)<1&&Math.abs(b.width-u.width)<1&&Math.abs(b.height-u.height)<1)continue;const x=o(tt(i)).length,C={x:u.x,y:u.y,width:u.width,height:u.height};r.resizeShape(u,b),o(tt(i)).length>x&&r.resizeShape(u,C)}}function Am(e,t,n=Cm){const i=Em(e),r=wm(t,qh(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=tt(i.elementRegistry),s=new Set(It(a).map(Tt)),c=new Set(a.edges.map(g=>g.id)),l=new Set(a.shapes.map(g=>g.id)),u=Ks(a),f=u.length,p=new Set(u.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{th(m,()=>{n(t,i),kS(i,s,a),OS(i,s,a),tm(i,c);const g=zu(i,s);Qh(i,p,c),pm(i,s,c),rm(i,c),gS(i,c),sm(i,s,c),xS(i,s,c),gm(i,s,c),mm(i,c),vm(i,l),MS(i,s,l),zu(i,s,g),bm(i,s),hm(i,d)})}catch(g){return{ok:!1,issues:[{kind:"lower-failed",message:g instanceof Error?g.message:String(g)}],findings:[],stats:o}}const h=tt(i.elementRegistry),y=It(h).filter(g=>!s.has(Tt(g))),v=jh(h);return{ok:!0,issues:[],findings:y,stats:{edgeCrossings:{before:f,after:v.pairs.length,pairs:v.pairs,solidPairs:v.solidPairs,dashedPairs:v.dashedPairs,mixedPairs:v.mixedPairs,crossPoolMessages:v.crossPoolMessages}}}}function DS(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function Pm(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Mm(e,t){const n=Pm(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Tm(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function IS(e){return typeof e=="string"&&gu.includes(e)}function Ri(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function km(e){const t=e.rootElements??[],n=t.find(X=>X.$type==="bpmn:Collaboration"),i=new Map(t.filter(X=>X.$type==="bpmn:Process").map(X=>[X.id,X])),r=[],o=[],a=[],s=[],c=[],l=[],u={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],p=[],d=[],m=[],h=[],y=[],v=[],g=new Set,b=new Set,x=X=>{X&&g.add(X)},C=X=>{g.add(X),b.add(X)},M=X=>{const Q=Tm(X,"bwl:Placement");if(!Q)return;const ue=typeof Q.anchor=="string"?Q.anchor:void 0;if(!ue||!IS(Q.side))return;const _e=typeof Q.offset=="number"?Q.offset:void 0;h.push({owner:X.id,anchor:ue,side:Q.side,..._e!==void 0?{offset:_e}:{}})},O=X=>{const Q=Tm(X,"bwl:Members"),ue=typeof(Q==null?void 0:Q.refs)=="string"?Q.refs.split(/\s+/).filter(Boolean):[];ue.length&&v.push({owner:X.id,refs:ue})},P=X=>{var Q;for(const ue of X)switch(x(ue.id),ue.$type){case"bpmn:TextAnnotation":C(ue.id),s.push({id:ue.id,text:typeof ue.text=="string"?ue.text:""}),M(ue);break;case"bpmn:Association":d.push({id:ue.id,type:ue.$type,source:Ri(ue.sourceRef),target:Ri(ue.targetRef)});break;case"bpmn:Group":{C(ue.id);const _e=(Q=ue.categoryValueRef)==null?void 0:Q.value;c.push({id:ue.id,...typeof _e=="string"&&_e?{name:_e}:{}}),O(ue);break}default:l.push({id:ue.id,type:ue.$type,reason:"type-outside-mvp"})}},F=X=>{for(const Q of X.flowElements??[])x(Q.id),l.push({id:Q.id,type:Q.$type,reason:"inside-container"}),(Q.flowElements??[]).length&&F(Q);for(const Q of X.artifacts??[])x(Q.id),l.push({id:Q.id,type:Q.$type,reason:"inside-container"})},D=(X,Q)=>{const ue=X.flowElements??[],_e=(X.laneSets??[]).flatMap(V=>V.lanes??[]),q=new Map;for(const V of _e){x(V.id);for(const ie of V.flowNodeRef??[]){const Pe=Ri(ie);Pe&&q.set(Pe,V.id)}}for(const V of ue){if(x(V.id),V.$type==="bpmn:SequenceFlow"){f.push({id:V.id,source:Ri(V.sourceRef),target:Ri(V.targetRef),...typeof V.name=="string"&&V.name?{name:V.name}:{}});continue}if(V.$type==="bpmn:DataStoreReference"){C(V.id),a.push({id:V.id,...V.name?{name:V.name}:{}});continue}const ie=DS(V.$type);if(!Xd(ie)){l.push({id:V.id,type:V.$type,reason:"type-outside-mvp"});continue}C(V.id);const Pe=ie==="boundaryEvent"?Ri(V.attachedToRef):void 0;o.push({id:V.id,type:ie,...V.name?{name:V.name}:{},...Q?{participant:Q}:{},...q.has(V.id)?{lane:q.get(V.id)}:{},...Pe?{attachedTo:Pe}:{}}),ie==="subProcess"&&F(V);const bt=Mm(V,"bwl:band");bt!==void 0&&(u.bands[V.id]=bt);const k=Pm(V,"bwl:afterColumn");typeof k=="string"&&k!==""&&y.push([V.id,k]);for(const w of V.dataOutputAssociations??[])x(w.id),m.push({id:w.id,type:w.$type,source:V.id,target:Ri(w.targetRef)});for(const w of V.dataInputAssociations??[])x(w.id),m.push({id:w.id,type:w.$type,source:Ri((w.sourceRef??[])[0]),target:V.id})}P(X.artifacts??[])};if(n){const X=new Set;for(const Q of n.participants??[]){C(Q.id);const ue=Ri(Q.processRef);ue&&X.add(ue);const _e=ue?i.get(ue):void 0,q=((_e==null?void 0:_e.laneSets)??[]).flatMap(bt=>bt.lanes??[]),V=q.map(bt=>({id:bt.id,...bt.name?{name:bt.name}:{}}));for(const bt of V)C(bt.id);const ie=!_e||(_e.flowElements??[]).length===0&&q.length===0&&(_e.artifacts??[]).length===0;r.push({id:Q.id,...Q.name?{name:Q.name}:{},...ie?{blackBox:!0}:{},...V.length?{lanes:V}:{}});const Pe=Mm(Q,"bwl:poolOrder");Pe!==void 0&&(u.poolOrders[Q.id]=Pe),_e&&D(_e,Q.id)}for(const Q of n.messageFlows??[])x(Q.id),p.push({id:Q.id,source:Ri(Q.sourceRef),target:Ri(Q.targetRef),...typeof Q.name=="string"&&Q.name?{name:Q.name}:{}});P(n.artifacts??[]);for(const[Q,ue]of i)!X.has(Q)&&(ue.flowElements??[]).length>0&&l.push({id:Q,type:ue.$type,reason:"unreachable-process"})}else for(const X of i.values())D(X);const I=[],z=[],ce=[],ve=[],Ye=(X,Q)=>!!X&&!!Q&&b.has(X)&&b.has(Q);for(const X of f){if(!Ye(X.source,X.target)){l.push({id:X.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}I.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),b.add(X.id)}for(const X of p){if(!Ye(X.source,X.target)){l.push({id:X.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}z.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),b.add(X.id)}for(const X of m){if(!Ye(X.source,X.target)){l.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}ve.push({...X.id?{id:X.id}:{},source:X.source,target:X.target}),X.id&&b.add(X.id)}for(const X of d){if(!Ye(X.source,X.target)){l.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}ce.push({...X.id?{id:X.id}:{},source:X.source,target:X.target})}const He=new Map(c.map(X=>[X.id,X]));for(const{owner:X,refs:Q}of v){const ue=Q.filter(q=>g.has(q)),_e=He.get(X);_e&&ue.length&&(_e.members=ue)}for(const X of h)g.has(X.anchor)&&(u.placements[X.owner]={anchor:X.anchor,side:X.side,...X.offset!==void 0?{offset:X.offset}:{}});for(const[X,Q]of y)g.has(Q)&&(u.afterColumns[X]=Q);return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:I,...z.length?{messageFlows:z}:{},...a.length?{dataStores:a}:{},...ve.length?{dataAssociations:ve}:{},...s.length?{annotations:s}:{},...ce.length?{associations:ce}:{},...c.length?{groups:c}:{}},hints:u,omitted:l}}async function LS(e){const{definitions:t,warnings:n}=await ko(e);return{...km(t),warnings:n}}const BS=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Ku(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function NS(e){return Ku(e.processRef)!==void 0}function $S(e){const t=new Set,n=r=>{const o=Ku(r);o&&t.add(o)},i=r=>{for(const o of r.flowElements??[]){n(o.sourceRef),n(o.targetRef),o.attachedToRef&&(n(o.attachedToRef),t.add(o.id));for(const a of o.dataOutputAssociations??[])t.add(o.id),n(a.targetRef);for(const a of o.dataInputAssociations??[]){t.add(o.id);for(const s of a.sourceRef??[])n(s)}(o.flowElements??[]).length&&i(o)}for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)};for(const r of e.rootElements??[])if(r.$type==="bpmn:Process")i(r);else if(r.$type==="bpmn:Collaboration"){for(const o of r.messageFlows??[])n(o.sourceRef),n(o.targetRef);for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)}return t}function FS(e){const t=[],n=i=>{for(const r of i.flowElements??[])BS.has(r.$type)&&t.push(r),(r.flowElements??[]).length&&n(r)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function jS(e){if(!e)return!0;const t=(e.laneSets??[]).flatMap(n=>n.lanes??[]);return(e.flowElements??[]).length===0&&t.length===0&&(e.artifacts??[]).length===0}function Xu(e){const t=[],n=e.rootElements??[],i=$S(e);for(const o of FS(e))i.has(o.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[o.id],params:{type:o.$type}});const r=n.find(o=>o.$type==="bpmn:Collaboration");if(r){const o=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of r.participants??[])NS(s)&&jS(o.get(Ku(s.processRef)))&&a.push(s.id);a.length&&t.push({ruleId:"CHK-POOL-1",severity:"info",targetKind:"participant",targetRefs:a,params:{count:a.length}})}return t}async function HS(e){const{definitions:t,warnings:n}=await ko(e);return{issues:Xu(t),warnings:n}}const zS=.5,GS=8,VS=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),Fo=e=>typeof e=="number"?e:Number(e??NaN),rc=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function WS(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const o of["sourceRef","targetRef","attachedToRef","processRef","default"])t[o]!==void 0&&n.push(`${o}=${rc(t[o])}`);if(String(e.$type)==="bpmn:Group"){const o=t.categoryValueRef,a=Array.isArray(o)?o:o==null?[]:[o];n.push(`cat=[${a.map(s=>`${rc(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(rc).sort().join(",")}]`);const r=t.conditionExpression;return r&&typeof r.body=="string"&&n.push(`cond=${r.body}`),n.join("|")}function US(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},r=a=>{const s=a;return s?[Fo(s.x),Fo(s.y),Fo(s.width),Fo(s.height)]:[]},o=a=>{if(Array.isArray(a))return a.forEach(o);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=rc(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,r(s.bounds));else{const f=Array.isArray(s.waypoint)?s.waypoint:[];i(l,f.flatMap(p=>[Fo(p.x),Fo(p.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,r(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&o(l)};return o(e.diagrams),{body:t,labels:n}}function Om(e){const t=US(e),n=new Map,i=new Set,r=o=>{if(Array.isArray(o))return o.forEach(r);if(!o||typeof o!="object"||i.has(o))return;i.add(o);const a=o,s=String(a.$type??"");if(s.startsWith("bpmndi:")||s.startsWith("dc:")||s.startsWith("di:"))return;const c=typeof a.id=="string"?a.id:"";c&&s.startsWith("bpmn:")&&!VS.has(s)&&n.set(c,{type:s,props:WS(a),geometry:(t.body.get(c)??[]).join(","),label:(t.labels.get(c)??[]).join(",")});for(const l of Object.values(a))(Array.isArray(l)||l&&typeof l=="object")&&r(l)};return r(e),n}function Dm(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),r=t===""?[]:t.split(",").map(Number);return i.length!==r.length?!0:i.some((o,a)=>Math.abs(o-r[a])>n)}function Im(e,t,n={}){const i=n.moveTolerance??zS,r=Om(e),o=Om(t),a=[],s=[],c=[];for(const[l,u]of o){const f=r.get(l);if(!f){a.push(l);continue}(f.type!==u.type||f.props!==u.props||Dm(f.geometry,u.geometry,i)||Dm(f.label,u.label,n.labelTolerance??GS))&&c.push(l)}for(const l of r.keys())o.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function YS(e,t,n={}){const[i,r]=await Promise.all([ko(e),ko(t)]);return{...Im(i.definitions,r.definitions,n),warnings:[...i.warnings,...r.warnings]}}function qS(e){return new Set([...e.added,...e.modified])}function KS(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Lm(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Am(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 XS=Symbol("bpmn-editor"),Zu={geometry:[],semantic:[]};function ZS(){const e=ye.ref(!1),t=ye.ref(!0),n=ye.ref(!1),i=ye.shallowRef(Zu),r=ye.shallowRef(void 0);let o,a;const s=()=>{if(!o){i.value=Zu;return}const p=It(tt(o.get("elementRegistry"))),d=o.getDefinitions();i.value={geometry:p,semantic:d?Xu(d):[]}},c=()=>{e.value=!0,s()};function l(p,d){p.get("canvas").getContainer().style.pointerEvents=d?"":"none";const m=p.get("keyboard");d?(a&&m.bind(a),a=void 0):a||(a=m.getBinding(),m.unbind())}function u(){if(!o)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return o}function f(){return o==null?void 0:o.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:s,changeScope:r,setChangeScope(p){r.value=p===void 0?void 0:new Set(p)},requestFocus(p){if(!o)return;const d=o.get("elementRegistry").get(p);d&&(o.get("canvas").scrollToElement(d,180),o.get("selection").select(d))},describeElement(p){const d=o==null?void 0:o.get("elementRegistry").get(p),m=d==null?void 0:d.businessObject;if(!m)return;const h=typeof m.name=="string"&&m.name.trim()!==""?m.name:m.text;return{name:typeof h=="string"&&h.trim()!==""?h.trim():void 0,type:typeof m.$type=="string"?m.$type:""}},attach(p){o&&this.detach(),o=p,o.get("eventBus").on("commandStack.changed",c),t.value||l(o,!1),s()},detach(){o==null||o.get("eventBus").off("commandStack.changed",c),o&&!t.value&&l(o,!0),a=void 0,o=void 0,i.value=Zu,r.value=void 0},setEditable(p){t.value=p,o&&l(o,p)},async applyAgentBatch(p,d){const m=u();n.value=!0;try{const h=await Lm(m,p,{currentVersion:d});return h.status==="applied"&&(e.value=!1),h}finally{n.value=!1}},async importXml(p){const{warnings:d}=await u().importXML(p);return e.value=!1,r.value=void 0,s(),{warnings:Du(d)}},async saveXml(){const{xml:p}=await u().saveXML({format:!0});return e.value=!1,p??""},undo:()=>{var p;return(p=f())==null?void 0:p.undo()},redo:()=>{var p;return(p=f())==null?void 0:p.redo()},canUndo:()=>{var p;return((p=f())==null?void 0:p.canUndo())??!1},canRedo:()=>{var p;return((p=f())==null?void 0:p.canRedo())??!1}}}function we(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function QS(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Qu={exports:{}},Bm;function JS(){if(Bm)return Qu.exports;Bm=1;var e=Qu.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 l=parseInt(a,n);return l!==1/0&&l>=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},Qu.exports}var eR=JS(),tR=QS(eR);function Oi(e){if(!(this instanceof Oi))return new Oi(e);e=e||[128,36,1],this._seed=e.length?tR.rack(e[0],e[1],e[2]):e}Oi.prototype.next=function(e){return this._seed(e||!0)},Oi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Oi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Oi.prototype.assigned=function(e){return this._seed.get(e)||!1},Oi.prototype.unclaim=function(e){delete this._seed.hats[e]},Oi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const on={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};on.td=on.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],on.option=on.optgroup=[1,'<select multiple="multiple">',"</select>"],on.thead=on.tbody=on.colgroup=on.caption=on.tfoot=[1,"<table>","</table>"],on.polyline=on.ellipse=on.polygon=on.circle=on.text=on.line=on.path=on.rect=on.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function Mt(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:f}=u;return f.remove(),f}let[r,o,a]=Object.hasOwn(on,i)?on[i]:on._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function nR(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 Ln(e,...t){const n=e.style;return H(t,function(i){i&&H(i,function(r,o){n[o]=r})}),e}function Pn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const iR=Object.prototype.toString;function Lt(e){return new vr(e)}function vr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}vr.prototype.add=function(e){return this.list.add(e),this},vr.prototype.remove=function(e){return iR.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},vr.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},vr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},vr.prototype.array=function(){return Array.from(this.list)},vr.prototype.has=vr.prototype.contains=function(e){return this.list.contains(e)};function oc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function eo(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function rR(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ac={},Nm;function oR(){if(Nm)return ac;Nm=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ac.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},ac.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},ac}var $m=oR(),aR=rR($m),je=nR({__proto__:null,default:aR},[$m]),Fm=["focus","blur"];function sR(e,t,n,i,r){return Fm.indexOf(n)!==-1&&(r=!0),je.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=eo(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function cR(e,t,n,i){return Fm.indexOf(t)!==-1&&(i=!0),je.unbind(e,t,n,i)}var Wn={bind:sR,unbind:cR};function Ju(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function ht(e,t){return t=t||document,t.querySelector(e)}function sc(e,t){return t=t||document,t.querySelectorAll(e)}function Di(e){e.parentNode&&e.parentNode.removeChild(e)}function lR(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function uR(e,t){return t.appendChild(lR(e,t))}function Ve(e,t){return uR(t,e),e}var ep=2,jm={"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":ep,"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":ep,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function pR(e,t){return jm[t]?e.style[t]:e.getAttributeNS(null,t)}function Hm(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=jm[i];r?(r===ep&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function fR(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Hm(e,r,t[r])}function Ee(e,t,n){if(typeof t=="string")if(n!==void 0)Hm(e,t,n);else return pR(e,t);else fR(e,t);return e}const dR=Object.prototype.toString;function nt(e){return new br(e)}function br(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}br.prototype.add=function(e){return this.list.add(e),this},br.prototype.remove=function(e){return dR.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},br.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},br.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},br.prototype.array=function(){return Array.from(this.list)},br.prototype.has=br.prototype.contains=function(e){return this.list.contains(e)};function cc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function zm(e){return e.cloneNode(!0)}var tp={svg:"http://www.w3.org/2000/svg"},Gm='<svg xmlns="'+tp.svg+'"';function hR(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(tp.svg)===-1&&(e=Gm+e.substring(4)):(e=Gm+">"+e+"</svg>",t=!0);var n=mR(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function mR(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=hR(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(tp.svg,e),t&&Ee(n,t),n}var np=null;function Vm(){return np===null&&(np=Me("svg")),np}function Wm(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function gR(e,t,n,i,r,o){var a=Vm().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Wm(a,e);case 6:return Wm(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Ta(e){return Vm().createSVGTransform()}var Um=/([&<>]{1})/g,yR=/([&<>\n\r"]{1})/g,vR={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function ip(e,t){function n(i,r){return vR[r]||r}return e.replace(t,n)}function Ym(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(ip(e.textContent,Um));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,'="',ip(o.value,yR),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Ym(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",ip(e.nodeValue,Um),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function bR(e){for(var t=e.firstChild,n=[];t;)Ym(t,n),t=t.nextSibling;return n.join("")}function qm(e,t){return bR(e)}function an(e){var t=e.parentNode;return t&&t.removeChild(e),e}function xR(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function _R(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(xR(e,i))}function ka(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),_R(n,t)),n.consolidate()}const wR=/^class[ {]/;function ER(e){return wR.test(e.toString())}function rp(e){return Array.isArray(e)}function op(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function lc(...e){e.length===1&&rp(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const SR=/constructor\s*[^(]*\(\s*([^)]*)\)/m,RR=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,CR=/\/\*([^*]*)\*\//m;function AR(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(ER(e)?SR:RR);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(CR);return(r&&r[1]||i).trim()})||[]}function Km(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(op(o,b))return o[b];if(op(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 l(b,x){if(typeof x>"u"&&(x={}),typeof b!="function")if(rp(b))b=lc(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const M=(b.$inject||AR(b)).map(O=>op(x,O)?x[O]:c(O));return{fn:b,dependencies:M}}function u(b){const{fn:x,dependencies:C}=l(b),M=Function.prototype.bind.call(x,null,...C);return new M}function f(b,x,C){const{fn:M,dependencies:O}=l(b,C);return M.apply(x,O)}function p(b){return lc(x=>b.get(x))}function d(b,x){if(x&&x.length){const C=Object.create(null),M=Object.create(null),O=[],P=[],F=[];let D,I,z,ce;for(let ve in r)D=r[ve],x.indexOf(ve)!==-1&&(D[2]==="private"?(I=O.indexOf(D[3]),I===-1?(z=D[3].createChild([],x),ce=p(z),O.push(D[3]),P.push(z),F.push(ce),C[ve]=[ce,ve,"private",z]):C[ve]=[F[I],ve,"private",P[I]]):C[ve]=[D[2],D[1]],M[ve]=!0),(D[2]==="factory"||D[2]==="type")&&D[1].$scope&&x.forEach(Ye=>{D[1].$scope.indexOf(Ye)!==-1&&(C[ve]=[D[2],D[1]],M[Ye]=!0)});x.forEach(ve=>{if(!M[ve])throw new Error('No provider for "'+ve+'". Cannot use provider from the parent!')}),b.unshift(C)}return new Km(b,a)}const m={factory:f,type:u,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 y(b){const x=b.__exports__;if(x){const C=b.__modules__,M=Object.keys(b).reduce((I,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&(I[z]=b[z]),I),Object.create(null)),O=(C||[]).concat(M),P=d(O),F=lc(function(I){return P.get(I)});x.forEach(function(I){r[I]=[F,I,"private",P]});const D=(b.__init__||[]).slice();return D.unshift(function(){P.init()}),b=Object.assign({},b,{__init__:D}),h(b,P)}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 O=M[0],P=M[1];r[C]=[m[O],PR(O,P),O]}),h(b,a)}function v(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(v,b),b.indexOf(x)!==-1)?b:b.concat(x)}function g(b){const x=b.reduce(v,[]).map(y);let C=!1;return function(){C||(C=!0,x.forEach(M=>M()))}}this.get=c,this.invoke=f,this.instantiate=u,this.createChild=d,this.init=g(e)}function PR(e,t){return e!=="value"&&rp(t)&&(t=lc(t.slice())),t}var MR=1e3;function Zi(e,t){var n=this;t=t||MR,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)})}Zi.prototype.canRender=function(e){},Zi.prototype.drawShape=function(e,t){},Zi.prototype.drawConnection=function(e,t){},Zi.prototype.getShapePath=function(e){},Zi.prototype.getConnectionPath=function(e){};function to(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function TR(e){return["M",e.x,e.y]}function ap(e){return["L",e.x,e.y]}function kR(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function OR(e,t){const n=e.length,i=[TR(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(ap(a));continue}const c=Math.min(t,sp(a.x-o.x,a.y-o.y),sp(s.x-a.x,s.y-a.y));if(!c){i.push(ap(a));continue}const l=uc(a,o,c),u=uc(a,o,c*.5),f=uc(a,s,c),p=uc(a,s,c*.5);i.push(ap(l)),i.push(kR(u,p,f))}return i}function uc(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=sp(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function sp(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function Oa(e,t,n){Fe(t)&&(n=t,t=null),t||(t={});const i=Me("path",t);return Fe(n)&&(i.dataset.cornerRadius=String(n)),cp(i,e)}function cp(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Ee(e,{d:to(OR(t,n))}),e}function pc(e){var t=new Set(e);return Qe(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function no(e,t,n){n=n||0,Ie(e)||(e=[e]),H(e,function(i,r){var o=t(i,r,n);Ie(o)&&o.length&&no(o,t,n+1)})}function lp(e,t,n){var i=new Set,r=new Set;return no(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 Da(e,t){return lp(e)}function DR(e,t,n){Kr(t)&&(t=!0),ln(t)&&(n=t,t=!0),n=n||{};var i=Ia(n.allShapes),r=Ia(n.allConnections),o=Ia(n.enclosedElements),a=Ia(n.enclosedConnections),s=Ia(n.topLevel,t&&Ao(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=o[u.id]=u),r[u.id]=u}function l(u){if(o[u.id]=u,u.waypoints)a[u.id]=r[u.id]=u;else return i[u.id]=u,H(u.incoming,c),H(u.outgoing,c),u.children}return no(e,l),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Zt(e,t){t=!!t,Ie(e)||(e=[e]);var n,i,r,o;return H(e,function(a){var s=a;a.waypoints&&!t&&(s=Zt(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+f>r||r===void 0)&&(r=c+f),(l+u>o||o===void 0)&&(o=l+u)}),{x:n,y:i,height:o-i,width:r-n}}function jo(e,t){var n={};return H(e,function(i){var r=i;r.waypoints&&(r=Zt(r)),!Fe(t.y)&&r.x>t.x&&(n[i.id]=i),!Fe(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Fe(t.width)&&Fe(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Fe(t.width)||!Fe(t.height))&&(n[i.id]=i)}),n}function Xm(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function Zm(e){return!!(e&&e.isFrame)}function Ia(e,t){return W({},e||{},t||{})}var IR=1;function xr(e,t){Zi.call(this,e,IR),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})}we(xr,Zi),xr.prototype.canRender=function(){return!0},xr.prototype.drawShape=function(t,n,i){var r=Me("rect");return Ee(r,{x:0,y:0,width:n.width||0,height:n.height||0}),Zm(n)?Ee(r,W({},this.FRAME_STYLE,i||{})):Ee(r,W({},this.SHAPE_STYLE,i||{})),Ve(t,r),r},xr.prototype.drawConnection=function(t,n,i){var r=Oa(n.waypoints,W({},this.CONNECTION_STYLE,i||{}));return Ve(t,r),r},xr.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 to(a)},xr.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 to(o)},xr.$inject=["eventBus","styles"];function LR(){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 W(o,{class:n})},this.style=function(n,i){!Ie(n)&&!i&&(i=n,n=[]);var r=Gn(n,function(o,a){return W(o,e[a]||{})},{});return i?W(r,i):r},this.computeStyle=function(n,i,r){return Ie(i)||(r=i,i=[]),t.style(i||[],W({},r,n||{}))}}const BR={__init__:["defaultRenderer"],defaultRenderer:["type",xr],styles:["type",LR]};function Wt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Yt(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 up(e,t){return!e||!t?-1:e.indexOf(t)}function La(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function pp(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=La(e,t);return Math.abs(r/o)<=i}var NR=2;function Qi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if($R(r,n))return o;return!1}function $R(e,t){const n=t[0];return Xr(t,function(i){return Math.abs(n[e]-i[e])<=NR})}function Qm(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 fp(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var FR=/,?([a-z]),?/gi,Jm=parseFloat,Qt=Math,_r=Qt.PI,Ii=Qt.min,Li=Qt.max,eg=Qt.pow,wr=Qt.abs,jR=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,HR=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,tg=Array.isArray||function(e){return e instanceof Array};function zR(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function GR(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 VR(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 zR(r,i)?(GR(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function WR(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(jR,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(HR,function(c,l){l&&a.push(+l)}),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=hp,n}function UR(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 YR(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 dp(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 hp(){return this.join(",").replace(FR,"$1")}function qR(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=hp,t}function ng(e,t,n,i,r,o,a,s,c){var l=1-c,u=eg(l,3),f=eg(l,2),p=c*c,d=p*c,m=u*e+f*3*c*n+l*3*c*c*r+d*a,h=u*t+f*3*c*i+l*3*c*c*o+d*s;return{x:fc(m),y:fc(h)}}function ig(e){var t=eC(...e);return dp(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Er(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function KR(e,t){return e=dp(e),t=dp(t),Er(t,e.x,e.y)||Er(t,e.x2,e.y)||Er(t,e.x,e.y2)||Er(t,e.x2,e.y2)||Er(e,t.x,t.y)||Er(e,t.x2,t.y)||Er(e,t.x,t.y2)||Er(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 rg(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 og(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,m=0;m<u;m++){var h=l*f[m]+l,y=rg(h,e,n,r,a),v=rg(h,t,i,o,s),g=y*y+v*v;d+=p[m]*Qt.sqrt(g)}return l*d}function XR(e,t,n,i,r,o,a,s){if(!(Li(e,n)<Ii(r,a)||Ii(e,n)>Li(r,a)||Li(t,i)<Ii(o,s)||Ii(t,i)>Li(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),l=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),u=(e-n)*(o-s)-(t-i)*(r-a);if(u){var f=fc(c/u),p=fc(l/u),d=+f.toFixed(2),m=+p.toFixed(2);if(!(d<+Ii(e,n).toFixed(2)||d>+Li(e,n).toFixed(2)||d<+Ii(r,a).toFixed(2)||d>+Li(r,a).toFixed(2)||m<+Ii(t,i).toFixed(2)||m>+Li(t,i).toFixed(2)||m<+Ii(o,s).toFixed(2)||m>+Li(o,s).toFixed(2)))return{x:f,y:p}}}}function fc(e){return Math.round(e*1e11)/1e11}function ZR(e,t,n){var i=ig(e),r=ig(t);if(!KR(i,r))return[];var o=og(...e),a=og(...t),s=sg(e)?1:~~(o/5)||1,c=sg(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),f={},p=[],d,m;for(d=0;d<s+1;d++){var h=ng(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=ng(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(m=0;m<c;m++){var y=l[d],v=l[d+1],g=u[m],b=u[m+1],x=wr(v.x-y.x)<.01?"y":"x",C=wr(b.x-g.x)<.01?"y":"x",M=XR(y.x,y.y,v.x,v.y,g.x,g.y,b.x,b.y),O;if(M){if(O=M.x.toFixed(9)+"#"+M.y.toFixed(9),f[O])continue;f[O]=!0;var P=y.t+wr((M[x]-y[x])/(v[x]-y[x]))*(v.t-y.t),F=g.t+wr((M[C]-g[C])/(b[C]-g[C]))*(b.t-g.t);P>=0&&P<=1&&F>=0&&F<=1&&p.push({x:M.x,y:M.y,t1:P,t2:F})}}return p}function ag(e,t,n){e=ug(e),t=ug(t);for(var i,r,o,a,s,c,l,u,f,p,d=n?0:[],m=0,h=e.length;m<h;m++){var y=e[m];if(y[0]=="M")i=s=y[1],r=c=y[2];else{y[0]=="C"?(f=[i,r,...y.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var v=0,g=t.length;v<g;v++){var b=t[v];if(b[0]=="M")o=l=b[1],a=u=b[2];else{b[0]=="C"?(p=[o,a,...b.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,l,u,l,u],o=l,a=u);var x=ZR(f,p);{for(var C=0,M=x.length;C<M;C++)x[C].segment1=m,x[C].segment2=v,x[C].bez1=f,x[C].bez2=p;d=d.concat(x)}}}}}return d}function QR(e){return tg(e)&&tg(e[0])}function JR(e){if(UR(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,l,u=a,f=e.length;u<f;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":r=+l[1]+n,o=+l[2]+i;default:for(var p=1,d=l.length;p<d;p++)c[p]=+l[p]+(p%2?n:i)}else for(var m=0,h=l.length;m<h;m++)c[m]=l[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=hp,t}function sg(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function dc(e,t,n,i){return[e,t,n,i,n,i]}function cg(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 lg(e,t,n,i,r,o,a,s,c,l){var u=_r*120/180,f=_r/180*(+r||0),p=[],d,m=VR(function(k,w,E){var G=k*Qt.cos(E)-w*Qt.sin(E),U=k*Qt.sin(E)+w*Qt.cos(E);return{x:G,y:U}});if(l)O=l[0],P=l[1],C=l[2],M=l[3];else{d=m(e,t,-f),e=d.x,t=d.y,d=m(s,c,-f),s=d.x,c=d.y;var h=(e-s)/2,y=(t-c)/2,v=h*h/(n*n)+y*y/(i*i);v>1&&(v=Qt.sqrt(v),n=v*n,i=v*i);var g=n*n,b=i*i,x=(o==a?-1:1)*Qt.sqrt(wr((g*b-g*y*y-b*h*h)/(g*y*y+b*h*h))),C=x*n*y/i+(e+s)/2,M=x*-i*h/n+(t+c)/2,O=Qt.asin(((t-M)/i).toFixed(9)),P=Qt.asin(((c-M)/i).toFixed(9));O=e<C?_r-O:O,P=s<C?_r-P:P,O<0&&(O=_r*2+O),P<0&&(P=_r*2+P),a&&O>P&&(O=O-_r*2),!a&&P>O&&(P=P-_r*2)}var F=P-O;if(wr(F)>u){var D=P,I=s,z=c;P=O+u*(a&&P>O?1:-1),s=C+n*Qt.cos(P),c=M+i*Qt.sin(P),p=lg(s,c,n,i,r,0,a,I,z,[P,D,C,M])}F=P-O;var ce=Qt.cos(O),ve=Qt.sin(O),Ye=Qt.cos(P),He=Qt.sin(P),it=Qt.tan(F/4),X=4/3*n*it,Q=4/3*i*it,ue=[e,t],_e=[e+X*ve,t-Q*ce],q=[s+X*He,c-Q*Ye],V=[s,c];if(_e[0]=2*ue[0]-_e[0],_e[1]=2*ue[1]-_e[1],l)return[_e,q,V].concat(p);p=[_e,q,V].concat(p).join().split(",");for(var ie=[],Pe=0,bt=p.length;Pe<bt;Pe++)ie[Pe]=Pe%2?m(p[Pe-1],p[Pe],f).y:m(p[Pe],p[Pe+1],f).x;return ie}function eC(e,t,n,i,r,o,a,s){for(var c=[],l=[[],[]],u,f,p,d,m,h,y,v,g=0;g<2;++g){if(g==0?(f=6*e-12*n+6*r,u=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,u=-3*t+9*i-9*o+3*s,p=3*i-3*t),wr(u)<1e-12){if(wr(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}y=f*f-4*p*u,v=Qt.sqrt(y),!(y<0)&&(m=(-f+v)/(2*u),0<m&&m<1&&c.push(m),h=(-f-v)/(2*u),0<h&&h<1&&c.push(h))}for(var b=c.length,x=b,C;b--;)d=c[b],C=1-d,l[0][b]=C*C*C*e+3*C*C*d*n+3*C*d*d*r+d*d*d*a,l[1][b]=C*C*C*t+3*C*C*d*i+3*C*d*d*o+d*d*d*s;return l[0][x]=e,l[1][x]=t,l[0][x+1]=a,l[1][x+1]=s,l[0].length=l[1].length=x+2,{x0:Ii(...l[0]),y0:Ii(...l[1]),x1:Li(...l[0]),y1:Li(...l[1])}}function ug(e){if(QR(e)||(e=WR(e)),YR(e))return e;for(var t=qR(JR(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,m){var h,y;if(!p)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(p[0]in{T:1,Q:1})&&(d.qx=d.qy=null),p[0]){case"M":d.X=p[1],d.Y=p[2];break;case"A":p=["C",...lg(d.x,d.y,...p.slice(1))];break;case"S":m=="C"||m=="S"?(h=d.x*2-d.bx,y=d.y*2-d.by):(h=d.x,y=d.y),p=["C",h,y,...p.slice(1)];break;case"T":m=="Q"||m=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),p=["C",...cg(d.x,d.y,d.qx,d.qy,p[1],p[2])];break;case"Q":d.qx=p[1],d.qy=p[2],p=["C",...cg(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...dc(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...dc(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...dc(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...dc(d.x,d.y,d.X,d.Y)];break}return p},r=function(p,d){if(p[d].length>7){p[d].shift();for(var m=p[d];m.length;)o[d]="A",p.splice(d++,0,["C",...m.splice(0,6)]);p.splice(d,1),l=t.length}},o=[],a="",s="",c=0,l=t.length;c<l;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 u=t[c],f=u.length;n.x=u[f-2],n.y=u[f-1],n.bx=Jm(u[f-4])||n.x,n.by=Jm(u[f-3])||n.y}return t}function gt(e){return ln(e)&&zn(e,"waypoints")}function Xe(e){return ln(e)&&zn(e,"labelTarget")}function tC(e){return ln(e)&&Ro(e.parent)}function pg(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Ji(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function De(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function hc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function nC(e){return Ji({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function iC(e){for(var t=e.waypoints,n=t.reduce(function(l,u,f){var p=t[f-1];if(p){var d=l[l.length-1],m=d&&d.endLength||0,h=aC(p,u);l.push({start:p,end:u,startLength:m,endLength:m+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.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 gt(e)?iC(e):nC(e)}function bn(e,t,n){n=n||0,ln(n)||(n={x:n,y:n});var i=De(e),r=De(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,l=o?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function Ba(e,t,n){var i=rC(e,t);return i.length===1||i.length===2&&La(i[0],i[1])<1?Ji(i[0]):i.length>1?(i=Pi(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Ji(i[n?0:i.length-1])):null}function rC(e,t){return ag(e,t)}function oC(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],La(n,r)===0||pp(i,r,n)?e.splice(t,1):t++;return e}function aC(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function mc(e,t){return Math.round(e*t)/t}function fg(e){return Fe(e)?e+"px":e}function sC(e){for(;e.parent;)e=e.parent;return e}function cC(e){e=W({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Ln(n,{position:"relative",overflow:"hidden",width:fg(e.width),height:fg(e.height)}),t.appendChild(n),n}function dg(e,t,n){const i=Me("g");nt(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const lC="base",hg=0,uC=1,pC={shape:["x","y","width","height"],connection:["waypoints"]};function Be(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||{})}Be.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Be.prototype._init=function(e){const t=this._eventBus,n=this._container=cC(e),i=this._svg=Me("svg");Ee(i,{width:"100%",height:"100%"}),Pn(i,"tabindex",0),e.autoFocus&&t.on("element.hover",()=>{this.restoreFocus()}),t.on("element.mousedown",500,o=>{this.focus()}),i.addEventListener("focusin",()=>{this._setFocused(!0)}),i.addEventListener("focusout",()=>{this._setFocused(!1)}),i.addEventListener("mouseover",()=>{this._eventBus.fire("canvas.mouseover")}),i.addEventListener("mouseout",()=>{this._eventBus.fire("canvas.mouseout")}),Ve(n,i);const r=this._viewport=dg(i,"viewport");e.deferUpdate&&(this._viewboxChanged=xu(this._viewboxChanged,300)),this._restoreFocus=xu(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)},Be.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},Be.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Be.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Xm(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Be.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Be.prototype.restoreFocus=function(){this._restoreFocus()},Be.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Be.prototype.isFocused=function(){return this._focused},Be.prototype.getDefaultLayer=function(){return this.getLayer(lC,hg)},Be.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},Be.prototype._getChildIndex=function(e){return Gn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Be.prototype._createLayer=function(e,t){typeof t>"u"&&(t=uC);const n=this._getChildIndex(t);return{group:dg(this._viewport,"layer-"+e,n),index:t,visible:!0}},Be.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},Be.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&&(an(n),t.visible=!1),n},Be.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],an(t.group))},Be.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Be.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(sC(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Be.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Be.prototype._findPlaneForRoot=function(e){return wt(this._planes,function(t){return t.rootElement===e})},Be.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Be.prototype._resolveElements=function(e){return Ie(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Be.prototype.getContainer=function(){return this._container},Be.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&&(H([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),nt(r).add(t)):(e.markers.delete(t),nt(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Be.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Be.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Be.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Be.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Be.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Be.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,hg);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Be.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},Be.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},Be.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)},Be.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})},Be.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})},Be.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=pC[e];if(!Xr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Be.prototype._setParent=function(e,t,n){Yt(t.children,e,n),e.parent=t},Be.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},Be.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Be.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Be.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),Wt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Be.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Be.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Be.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Be.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Be.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Be.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,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);ka(t,u)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=ka(t),r=a?a.matrix:gR(),s=mc(r.a,1e3),c=mc(-r.e||0,1e3),l=mc(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:l?l/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},Be.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=W({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),mg(t,n)}),{x:n.e,y:n.f}},Be.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=Zt(o),s=De(a),c=this.viewbox(),l=this.zoom();let u,f;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const p=De(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,f=a.y-c.y;else{const m=Math.max(0,s.right-p.right),h=Math.min(0,s.left-p.left),y=Math.max(0,s.bottom-p.bottom),v=Math.min(0,s.top-p.top);u=m||h,f=y||v}this.scroll({dx:-u*l,dy:-f*l})},Be.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)}),mc(i.a,1e3)};function mg(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Be.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},Be.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const f=c.a;return t?(a=W(o,t),s=a.matrixTransform(c.inverse()),l=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),u=c.multiply(l)):u=r.scale(e),mg(this._viewport,u),u},Be.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Be.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}},Be.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Ho="data-element-id";function ai(e){this._elements={},this._eventBus=e}ai.$inject=["eventBus"],ai.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Ee(t,Ho,i),n&&Ee(n,Ho,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},ai.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Ee(i.gfx,Ho,""),i.secondaryGfx&&Ee(i.secondaryGfx,Ho,""),delete t[n])},ai.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)},ai.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Ee(t,Ho,i),t},ai.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Ee(e,Ho);var n=this._elements[t];return n&&n.element},ai.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},ai.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}},ai.prototype.getAll=function(){return this.filter(function(e){return e})},ai.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)})},ai.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},ai.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 fC(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 dC(e){return e.__refs_collection===!0}function hC(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function gg(e,t,n){var i=fC(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 mC(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 ui(e,t){if(!(this instanceof ui))return new ui(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}ui.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?gg(this,t,e):mC(this,t,e)},ui.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return dC(n)||gg(this,t,e),n},ui.prototype.ensureBound=function(e,t){hC(e,t)||this.bind(e,t)},ui.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},ui.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var mp=new ui({name:"children",enumerable:!0,collection:!0},{name:"parent"}),yg=new ui({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),vg=new ui({name:"attachers",collection:!0},{name:"host"}),bg=new ui({name:"outgoing",collection:!0},{name:"source"}),xg=new ui({name:"incoming",collection:!0},{name:"target"});function zo(){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)}}),mp.bind(this,"parent"),yg.bind(this,"labels"),bg.bind(this,"outgoing"),xg.bind(this,"incoming")}function Na(){zo.call(this),mp.bind(this,"children"),vg.bind(this,"host"),vg.bind(this,"attachers")}we(Na,zo);function _g(){zo.call(this),mp.bind(this,"children")}we(_g,Na);function wg(){Na.call(this),yg.bind(this,"labelTarget")}we(wg,Na);function Eg(){zo.call(this),bg.bind(this,"source"),xg.bind(this,"target")}we(Eg,zo);var gC={connection:Eg,shape:Na,label:wg,root:_g};function yC(e,t){var n=gC[e];if(!n)throw new Error("unknown type: <"+e+">");return W(new n,t)}function vC(e){return e instanceof zo}function er(){this._uid=12}er.prototype.createRoot=function(e){return this.create("root",e)},er.prototype.createLabel=function(e){return this.create("label",e)},er.prototype.createShape=function(e){return this.create("shape",e)},er.prototype.createConnection=function(e){return this.create("connection",e)},er.prototype.create=function(e,t){return t=W({},t||{}),t.id||(t.id=e+"_"+this._uid++),yC(e,t)};var gc="__fn",Sg=1e3,bC=Array.prototype.slice;function Un(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Un.prototype.on=function(e,t,n,i){if(e=Ie(e)?e:[e],un(t)&&(i=n,n=t,t=Sg),!Fe(t))throw new Error("priority must be a number");var r=n;i&&(r=$n(n,i),r[gc]=n[gc]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Un.prototype.once=function(e,t,n,i){var r=this;if(un(t)&&(i=n,n=t,t=Sg),!Fe(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[gc]=n,this.on(e,t,o)},Un.prototype.off=function(e,t){e=Ie(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Un.prototype.createEvent=function(e){var t=new $a;return t.init(e),t},Un.prototype.fire=function(e,t){var n,i,r,o;if(o=bC.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 $a?n=t:n=this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return r===void 0&&n.defaultPrevented&&(r=!1),r}},Un.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Un.prototype._destroy=function(){this._listeners={}},Un.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Un.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=xC(n.callback,t),i!==void 0&&(e.returnValue=i,e.stopPropagation()),i===!1&&e.preventDefault()}catch(r){if(!this.handleError(r))throw console.error("unhandled error in event listener",r),r}return i},Un.prototype._addListener=function(e,t){var n=this._getListeners(e),i;if(!n){this._setListeners(e,t);return}for(;n;){if(n.priority<t.priority){t.next=n,i?i.next=t:this._setListeners(e,t);return}i=n,n=n.next}i.next=t},Un.prototype._getListeners=function(e){return this._listeners[e]},Un.prototype._setListeners=function(e,t){this._listeners[e]=t},Un.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[gc]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function $a(){}$a.prototype.stopPropagation=function(){this.cancelBubble=!0},$a.prototype.preventDefault=function(){this.defaultPrevented=!0},$a.prototype.init=function(e){W(this,e||{})};function xC(e,t){return e.apply(null,t)}function io(e){return e.childNodes[0]}function _C(e){return e.parentNode.childNodes[1]}function yc(e,t,n,i,r){var o=Ta();o.setTranslate(t,n);var a=Ta();a.setRotate(i||0,0,0);var s=Ta();s.setScale(1,1),ka(e,[o,a,s])}function xn(e,t,n){var i=Ta();i.setTranslate(t,n),ka(e,i)}function Rg(e,t){var n=Ta();n.setRotate(t,0,0),ka(e,n)}function si(e,t){this._eventBus=e,this._elementRegistry=t}si.$inject=["eventBus","elementRegistry"],si.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=_C(t),n||(n=Me("g"),nt(n).add("djs-children"),Ve(t.parentNode,n))):n=t,n},si.prototype._clear=function(e){var t=io(e);return oc(t),t},si.prototype._createContainer=function(e,t,n,i){var r=Me("g");nt(r).add("djs-group"),typeof n<"u"?wC(r,t,t.childNodes[n]):Ve(t,r);var o=Me("g");nt(o).add("djs-element"),nt(o).add("djs-"+e),i&&nt(o).add("djs-frame"),Ve(r,o);var a=Me("g");return nt(a).add("djs-visual"),Ve(o,a),o},si.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,Zm(t))},si.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Gn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),H(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;H(o,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},si.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},si.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},si.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},si.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},si.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),xn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Ee(n,"display","none"):Ee(n,"display","block")}},si.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);an(t.parentNode)};function wC(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const EC={__depends__:[BR],__init__:["canvas"],canvas:["type",Be],elementRegistry:["type",ai],elementFactory:["type",er],eventBus:["type",Un],graphicsFactory:["type",si]};function SC(e){var t=new Km(e);return t.init(),t}function RC(e){e=e||{};var t={config:["value",e]},n=[t,EC].concat(e.modules||[]);return SC(n)}function Sr(e,t){this._injector=t||RC(e),this.get("eventBus").fire("diagram.init")}Sr.prototype.get=function(e,t){return this._injector.get(e,t)},Sr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Sr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Sr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function Mn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Fn(e,t){return e.$instanceOf(t)}function CC(e){return wt(e.rootElements,function(t){return Fn(t,"bpmn:Process")||Fn(t,"bpmn:Collaboration")})}function AC(e){var t={},n=[],i={};function r(q,V){return function(ie){q(ie,V)}}function o(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,V){var ie=q.gfx;if(ie)throw new Error(`already rendered ${Mn(q)}`);return e.element(q,i[q.id],V)}function c(q,V){return e.root(q,i[q.id],V)}function l(q,V){try{var ie=i[q.id]&&s(q,V);return o(q),ie}catch(Pe){u(Pe.message,{element:q,error:Pe}),console.error(`failed to import ${Mn(q)}`,Pe)}}function u(q,V){e.error(q,V)}var f=this.registerDi=function(V){var ie=V.bpmnElement;ie?i[ie.id]?u(`multiple DI elements defined for ${Mn(ie)}`,{element:ie}):i[ie.id]=V:u(`no bpmnElement referenced in ${Mn(V)}`,{element:V})};function p(q){d(q.plane)}function d(q){f(q),H(q.planeElement,m)}function m(q){f(q)}this.handleDefinitions=function(V,ie){var Pe=V.diagrams;if(ie&&Pe.indexOf(ie)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ie&&Pe&&Pe.length&&(ie=Pe[0]),!ie)throw new Error("no diagram to display");i={},p(ie);var bt=ie.plane;if(!bt)throw new Error(`no plane for ${Mn(ie)}`);var k=bt.bpmnElement;if(!k)if(k=CC(V),k)u(`correcting missing bpmnElement on ${Mn(bt)} to ${Mn(k)}`),bt.bpmnElement=k,f(bt);else throw new Error("no process or collaboration to display");var w=c(k,bt);if(Fn(k,"bpmn:Process")||Fn(k,"bpmn:SubProcess"))y(k,w);else if(Fn(k,"bpmn:Collaboration"))ue(k,w),v(V.rootElements,w);else throw new Error(`unsupported bpmnElement for ${Mn(bt)}: ${Mn(k)}`);h(n)};var h=this.handleDeferred=function(){for(var V;n.length;)V=n.shift(),V()};function y(q,V){it(q,V),F(q.ioSpecification,V),P(q.artifacts,V),o(q)}function v(q,V){var ie=Qe(q,function(Pe){return!a(Pe)&&Fn(Pe,"bpmn:Process")&&Pe.laneSets});ie.forEach(r(y,V))}function g(q,V){l(q,V)}function b(q,V){H(q,r(g,V))}function x(q,V){l(q,V)}function C(q,V){l(q,V)}function M(q,V){l(q,V)}function O(q,V){l(q,V)}function P(q,V){H(q,function(ie){Fn(ie,"bpmn:Association")?n.push(function(){O(ie,V)}):O(ie,V)})}function F(q,V){q&&(H(q.dataInputs,r(C,V)),H(q.dataOutputs,r(M,V)))}var D=this.handleSubProcess=function(V,ie){it(V,ie),P(V.artifacts,ie)};function I(q,V){var ie=l(q,V);Fn(q,"bpmn:SubProcess")&&D(q,ie||V),Fn(q,"bpmn:Activity")&&F(q.ioSpecification,V),n.push(function(){H(q.dataInputAssociations,r(x,V)),H(q.dataOutputAssociations,r(x,V))})}function z(q,V){l(q,V)}function ce(q,V){l(q,V)}function ve(q,V){n.push(function(){var ie=l(q,V);q.childLaneSet&&Ye(q.childLaneSet,ie||V),_e(q)})}function Ye(q,V){H(q.lanes,r(ve,V))}function He(q,V){H(q,r(Ye,V))}function it(q,V){X(q.flowElements,V),q.laneSets&&He(q.laneSets,V)}function X(q,V){H(q,function(ie){Fn(ie,"bpmn:SequenceFlow")?n.push(function(){z(ie,V)}):Fn(ie,"bpmn:BoundaryEvent")?n.unshift(function(){I(ie,V)}):Fn(ie,"bpmn:FlowNode")?I(ie,V):Fn(ie,"bpmn:DataObject")||(Fn(ie,"bpmn:DataStoreReference")||Fn(ie,"bpmn:DataObjectReference")?ce(ie,V):u(`unrecognized flowElement ${Mn(ie)} in context ${Mn(V&&V.businessObject)}`,{element:ie,context:V}))})}function Q(q,V){var ie=l(q,V),Pe=q.processRef;Pe&&y(Pe,ie||V)}function ue(q,V){H(q.participants,r(Q,V)),n.push(function(){b(q.messageFlows,V)}),P(q.artifacts,V)}function _e(q){H(q.flowNodeRef,function(V){var ie=V.get("lanes");ie&&ie.push(q)})}}function S(e,t){var n=oe(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Ze(e,t){return hr(t,function(n){return S(e,n)})}function oe(e){return e&&e.businessObject||e}function st(e){return e&&e.di}function PC(e,t,n){var i,r,o,a,s=[];function c(l,u){var f={root:function(h,y){return i.add(h,y)},element:function(h,y,v){return i.add(h,y,v)},error:function(h,y){s.push({message:h,context:y})}},p=new AC(f);u=u||l.diagrams&&l.diagrams[0];var d=MC(l,u);if(!d)throw new Error("no diagram to display");H(d,function(h){p.handleDefinitions(l,h)});var m=u.plane.bpmnElement.id;o.setRootElement(o.findRoot(m+"_plane")||o.findRoot(m))}return new Promise(function(l,u){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}),l({warnings:s})}catch(f){return f.warnings=s,u(f)}})}function MC(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!S(n,"bpmn:Process")&&!S(n,"bpmn:Collaboration")&&(i=TC(n));var r;S(i,"bpmn:Collaboration")?r=i:r=wt(e.rootElements,function(l){if(S(l,"bpmn:Collaboration"))return wt(l.participants,function(u){return u.processRef===i})});var o=[i];r&&(o=Cn(r.participants,function(l){return l.processRef}),o.push(r));var a=Cg(o),s=[t],c=[n];return H(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function Cg(e){var t=[];return H(e,function(n){n&&(t.push(n),t=t.concat(Cg(n.flowElements)))}),t}function TC(e){for(var t=e;t;){if(S(t,"bpmn:Process"))return t;t=t.$parent}}var kC='<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>',Ag=kC,Pg={verticalAlign:"middle"},Mg={color:"#404040"},OC={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},DC={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},IC={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"},LC='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Ag+'</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>',Bi;function BC(){Bi=Mt(LC),Ln(Bi,OC),Ln(ht("svg",Bi),Pg),Ln(ht(".backdrop",Bi),DC),Ln(ht(".notice",Bi),IC),Ln(ht(".link",Bi),Mg,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function NC(){Bi||(BC(),Wn.bind(Bi,".backdrop","click",function(e){document.body.removeChild(Bi)})),document.body.appendChild(Bi)}const vc=5,Tg="djs-outline-hidden";function Nt(e){e=W({},FC,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),HC(this._container)}we(Nt,Sr),Nt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(p){throw this._emit("import.parse.complete",{error:p}),p}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;o=o.concat(l),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:u,references:c,warnings:o}))||s;const f=await this.importDefinitions(s,n);return o=o.concat(f.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),bc(s,o),s=$C(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Nt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Nt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw bc(o,[]),o}if(typeof t=="string"&&(i=jC(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw bc(o,[]),o}try{this.clear()}catch(o){throw bc(o,[]),o}const{warnings:r}=await PC(this,n,i);return{warnings:r}},Nt.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},Nt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=ht(":scope > defs",i._svg),a=qm(r),s=o?"<defs>"+qm(o)+"</defs>":"",c=i.getContainer();Lt(c).add(Tg);let l;try{l=r.getBBox()}finally{Lt(c).remove(Tg)}const u=l.x-vc,f=l.y-vc,p=l.width+vc*2,d=l.height+vc*2;t=`<?xml version="1.0" encoding="utf-8"?>
3
+ column: `+I+`
4
+ nested error: `+C.message;if(O)return a.addWarning({message:z,error:C}),!0;throw yr(z)}function u(C,M){return l(C,M,!0)}function f(){var C=a.elementsById,M=a.references,O,P;for(O=0;P=M[O];O++){var F=P.element,I=C[P.id],B=qi(F).propertiesByName[P.property];if(I||a.addWarning({message:"unresolved reference <"+P.id+">",element:P.element,property:P.property,value:P.id}),B.isMany){var z=F.get(B.name),ce=z.indexOf(P);ce===-1&&(ce=z.length),I?z[ce]=I:z.splice(ce,1)}else F.set(B.name,I)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,m=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function y(C){if(d.test(C)){var M=m.exec(C),O=M&&M[1];!O||h.test(O)||a.addWarning({message:"unsupported document encoding <"+O+">, falling back to UTF-8"})}}function v(C,M){var O=c.peek();try{c.push(O.handleNode(C))}catch(P){l(P,M,o)&&c.push(new Pu)}}function g(C,M){try{c.peek().handleText(C)}catch(O){u(O,M)}}function b(C,M){C.trim()&&g(C,M)}var _=r.getPackages().reduce(function(C,M){return C[M.uri]=M.prefix,C},Object.entries(Au).reduce(function(C,[M,O]){return C[O]=M,C},r.config&&r.config.nsMap||{}));return s.ns(_).on("openTag",function(C,M,O,P){var F=C.attrs||{},I=Object.keys(F).reduce(function(z,ce){var ve=M(F[ce]);return z[ce]=ve,z},{}),B={name:C.name,originalName:C.originalName,attributes:I,ns:C.ns};v(B,P)}).on("question",y).on("closeTag",p).on("cdata",g).on("text",function(C,M,O){b(M(C),O)}).on("error",l).on("warn",u),new Promise(function(C,M){var O;try{s.parse(e),f()}catch(z){O=z}var P=i.element;!O&&!P&&(O=yr("failed to parse document as <"+i.type.$descriptor.name+">"));var F=a.warnings,I=a.references,B=a.elementsById;return O?(O.warnings=F,M(O)):C({rootElement:P,elementsById:B,references:I,warnings:F})})},ku.prototype.handler=function(e){return new Tu(this.model,e)};function AE(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var PE=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,ME=/<|>|'|"|&|\n\r|\n/g,wh=/<|>|&/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 TE(e){return e.charAt(0).toLowerCase()+e.slice(1)}function kE(e,t){return vh(t)?TE(e):e}function Eh(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Sh(e){return zn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function OE(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 DE(e,t){return t.isGeneric?W({localName:t.ns.localName},e):W({localName:kE(t.ns.localName,t.$pkg)},e)}function LE(e,t){return W({localName:t.ns.localName},e)}function IE(e){var t=e.$descriptor;return Qe(t.properties,function(n){var i=n.name;if(n.isVirtual||!Gn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var BE={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},NE={"<":"lt",">":"gt","&":"amp"};function Rh(e,t,n){return e=zn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function $E(e){return Rh(e,ME,BE)}function FE(e){return Rh(e,wh,NE)}function jE(e){return Qe(e,function(t){return t.isAttr})}function HE(e){return Qe(e,function(t){return!t.isAttr})}function Ou(e){this.tagName=e}Ou.prototype.build=function(e){return this.element=e,this},Ou.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Jr(){}Jr.prototype.serializeValue=Jr.prototype.serializeTo=function(e){e.append(this.escape?FE(this.value):this.value)},Jr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(wh)!==-1&&(this.escape=!0),this};function Du(e){this.tagName=e}Eh(Du,Jr),Du.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function It(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}It.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=IE(e),this.parseAttributes(jE(r)),this.parseContainments(HE(r))),this.parseGenericAttributes(e,i),this},It.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return DE(t,e)},It.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return LE(t,e)},It.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},It.prototype.nsAttributeName=function(e){var t;if(zn(e)?t=Mn(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}:W({localName:t.localName},n)},It.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}))},It.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Jr().build({type:"String"},t));var n=e.$children;n&&H(n,i=>{this.body.push(new It(this).build(i))})},It.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=Mn(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)}},It.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return H(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},It.prototype.parseGenericAttributes=function(e,t){var n=this;H(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)}})},It.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;H(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Jr().build(r,o[0]));else if(ph(r.type))H(o,function(l){n.push(new Du(t.addTagName(t.nsPropertyTagName(r))).build(r,l))});else if(a)H(o,function(l){n.push(new Ou(t.addTagName(t.nsPropertyTagName(r))).build(l))});else{var c=xh(r);H(o,function(l){var u;c?c===bh?u=new It(t,r):u=new Hs(t,r,c):u=new It(t),n.push(u.build(l))})}})},It.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},It.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},It.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},It.prototype.parseAttributes=function(e){var t=this,n=this.element;H(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];H(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},It.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Sh(e)},It.prototype.addAttribute=function(e,t){var n=this.attrs;zn(t)&&(t=$E(t));var i=sh(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)},It.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=OE(n).concat(t)),H(t,function(i){e.append(" ").append(Sh(i.name)).append('="').append(i.value).append('"')})},It.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Jr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),H(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Hs(e,t,n){It.call(this,e,t),this.serialization=n}Eh(Hs,It),Hs.prototype.parseNsAttributes=function(e){var t=It.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},Hs.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function zE(){this.value="",this.write=function(e){this.value+=e}}function GE(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 VE(e){e=W({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new zE,o=new GE(r,e.format);e.preamble&&o.append(PE);var a=new It,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(WE(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function WE(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Au)n[i]=Au[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 zs(e,t){li.call(this,e,t)}zs.prototype=Object.create(li.prototype),zs.prototype.fromXML=function(e,t,n){zn(t)||(n=t,t="bpmn:Definitions");var i=new ku(W({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},zs.prototype.toXML=function(e,t){var n=new VE(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var UE="BPMN20",YE="http://www.omg.org/spec/BPMN/20100524/MODEL",qE="bpmn",KE=[],XE=[{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"}]}],ZE=[{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"}]}],QE={tagAlias:"lowerCase",typePrefix:"t"},JE={name:UE,uri:YE,prefix:qE,associations:KE,types:XE,enumerations:ZE,xml:QE},e1="BPMNDI",t1="http://www.omg.org/spec/BPMN/20100524/DI",n1="bpmndi",i1=[{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"]}],r1=[{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"}]}],o1=[],a1={name:e1,uri:t1,prefix:n1,types:i1,enumerations:r1,associations:o1},s1="DC",c1="http://www.omg.org/spec/DD/20100524/DC",l1="dc",u1=[{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}]}],p1=[],f1={name:s1,uri:c1,prefix:l1,types:u1,associations:p1},d1="DI",h1="http://www.omg.org/spec/DD/20100524/DI",m1="di",g1=[{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"}]}],y1=[],v1={tagAlias:"lowerCase"},b1={name:d1,uri:h1,prefix:m1,types:g1,associations:y1,xml:v1},x1="bpmn.io colors for BPMN",_1="http://bpmn.io/schema/bpmn/biocolor/1.0",w1="bioc",E1=[{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"}]}],S1=[],R1=[],C1={name:x1,uri:_1,prefix:w1,types:E1,enumerations:S1,associations:R1},A1="BPMN in Color",P1="http://www.omg.org/spec/BPMN/non-normative/color/1.0",M1="color",T1=[{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"}]}],k1=[],O1=[],D1={name:A1,uri:P1,prefix:M1,types:T1,enumerations:k1,associations:O1};const L1={bpmn:JE,bpmndi:a1,dc:f1,di:b1,bioc:C1,color:D1};function Ch(e,t){const n=W({},L1,e);return new zs(n,t)}const I1={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"}},B1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Ah="i18n",Gs={[Ah]:I1,[gu]:nh};function Ph(){return Ch(Gs)}const Mh=Ph();async function To(e){const{rootElement:t,warnings:n}=await Mh.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function N1(e){const{xml:t}=await Mh.toXML(e,{format:!0});return t}function Lu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ko={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},$1=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function F1(e){const t=ko;return $1.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 Oo(e,t){let n=0;for(const i of e)n+=t*F1(i);return n}function Th(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&j1(e),H1(e),z1(e),G1(e)}function j1(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:Oo(r,o),fontBoundingBoxAscent:o*ko.ascentEm,fontBoundingBoxDescent:o*ko.descentEm,actualBoundingBoxAscent:o*ko.ascentEm,actualBoundingBoxDescent:o*ko.descentEm}}};t.getContext=()=>n}function H1(e){if(e.SVGMatrix)return;class t{constructor(){Eo(this,"a",1);Eo(this,"b",0);Eo(this,"c",0);Eo(this,"d",1);Eo(this,"e",0);Eo(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 z1(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,l=0){const u=s*Math.PI/180,f=Math.cos(u),p=Math.sin(u);a.a=f,a.b=p,a.c=-p,a.d=f,a.e=c-f*c+p*l,a.f=l-p*c-f*l},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 G1(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:Oo(n,12),height:14}})}const Vs=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),V1=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),W1=1,Iu=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),U1=2;function Tt(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 kh=20,Ws=5,Oh=3,Y1=8,Dh=12,q1=Dh*1.2;function Bu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>Oo(o,Dh))),r=n.length*q1;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Lh=1;function In(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 Do(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 In(e))for(const s of In(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Lh)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const l=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);l>=kh&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function Nu(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Ih(e,t){const n=Do(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function K1(e,t){let n=0;for(const i of t)i.id!==e.id&&Ih(e,i)&&n++;return n}function ii(e,t){let n=0;for(const i of t)i.id!==e.id&&Do(e,i)&&n++;return n}const Bh=15,Nh=20;function X1(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Nh||t.at>n[1]+Nh)return null;const i=t.axis==="v"?[e.y,e.y+e.height]:[e.x,e.x+e.width],r=Math.max(i[0],t.lo),o=Math.min(i[1],t.hi);return o>r?[r,o]:null}const $u=20;function Us(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Lh)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<kh||n.push([r-$u,o+$u])}return n}function Ys(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of In(e)){const o=X1(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Us(r,In(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const Z1=10,Q1=1,J1=(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 eS(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,l=t.y-e.y;let u=0,f=1;const p=(d,m)=>{if(m===0)return d<=0;const h=d/m;if(m>0){if(h>f)return!1;h>u&&(u=h)}else{if(h<u)return!1;h<f&&(f=h)}return!0};return p(r-e.x,c)&&p(e.x-a,-c)&&p(o-e.y,l)&&p(e.y-s,-l)&&f>u}function Fu(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 tS=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Lo=1;function Ki(e,t){const n=e.x+Lo,i=e.x+e.width-Lo,r=e.y+Lo,o=e.y+e.height-Lo;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 Ca(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 $h(e,t){const n=e.label;if(!n)return null;if(In(e).some(i=>Ki(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(In(i).some(r=>Ki(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Ca(i).some(r=>Ki(n,r)))return i.id;return null}function vn(e,t){const n=new Set(e.endpoints),i=[];for(const r of t)if(!n.has(r.id)){for(let o=0;o+1<e.waypoints.length;o++)if(eS(e.waypoints[o],e.waypoints[o+1],r,U1)){i.push(r);break}}return i}const Aa=(e,t,n)=>{const i=n.x-t.x,r=n.y-t.y,o=i*i+r*r,a=o===0?0:Math.max(0,Math.min(1,((e.x-t.x)*i+(e.y-t.y)*r)/o));return Math.hypot(e.x-(t.x+a*i),e.y-(t.y+a*r))},nS=(e,t,n,i)=>jh(e,t,n,i)?0:Math.min(Aa(e,n,i),Aa(t,n,i),Aa(n,e,t),Aa(i,e,t)),Fh=(e,t)=>{let n=!1;for(let i=0,r=t.length-1;i<t.length;r=i++){const o=t[i],a=t[r];o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(n=!n)}return n};function qs(e,t,n){const{x:i,y:r,width:o,height:a}=n;if(/Event$/.test(n.type)){const l=Math.min(o,a)/2;return Math.max(0,Aa({x:i+o/2,y:r+a/2},e,t)-l)}const s=/Gateway$/.test(n.type)?[{x:i+o/2,y:r},{x:i+o,y:r+a/2},{x:i+o/2,y:r+a},{x:i,y:r+a/2}]:[{x:i,y:r},{x:i+o,y:r},{x:i+o,y:r+a},{x:i,y:r+a}];if(Fh(e,s)||Fh(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,nS(e,t,s[l],s[(l+1)%s.length]));return c}function jh(e,t,n,i){const r=(l,u,f)=>(u.x-l.x)*(f.y-l.y)-(u.y-l.y)*(f.x-l.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 Hh=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Pa(e,t){let n=0;for(const i of t){if(i.id===e.id||Hh(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++)jh(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function ri(e,t){let n=0;for(const i of t)i.id===e.id||Hh(e,i)||Pa(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function zh(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++)Pa(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Ks(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Pa(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 Gh(e){const t=Ks(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),l=i.get(s);if(!c||!l)continue;const u=n(c.type),f=n(l.type);u==="solid"&&f==="solid"?r++:u==="dashed"&&f==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:iS(e)}}function iS(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(l=>l.id!==o.id&&l.id!==a.id&&l.y>s&&l.y+l.height<c)&&i++}return i}function Vh(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!Iu.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 Wh(e){var n;const t=(n=Dt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=Dt(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 Uh=e=>e?{members:e}:{},oi=e=>e.shapes.filter(t=>!t.container);function rS(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&&o.type!=="bpmn:Group"){if(o.container)return o.id;if(o.parent)return o.parent}}}function oS(e,t,n){if(e.x<t.x+t.width&&t.x<e.x+e.width&&e.y<t.y+t.height&&t.y<e.y+e.height)return!0;const r=e.x+e.width/2,o=e.y+e.height/2;return n.shapes.some(a=>a.container&&a.id!==t.id&&a.id!==e.id&&a.type!=="bpmn:Group"&&r>=a.x&&r<=a.x+a.width&&o>=a.y&&o<=a.y+a.height)}function Yh(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(In(i).some(r=>Ki(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Ca(i).some(r=>Ki(n,r)))return i.id;return null}function Io(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 Ot(e){const t=[],n=e.shapes.filter(v=>!v.container);for(const v of e.edges)for(const g of vn(v,n))t.push({kind:"edge-crosses-shape",edge:v.id,shape:g.id});const i=e.shapes.filter(v=>v.container&&V1.has(v.type));if(i.length){const v=(g,b)=>{const _=e.shapes.find(C=>C.id===b);return!!_&&_.x>=g.x&&_.y>=g.y&&_.x+_.width<=g.x+g.width&&_.y+_.height<=g.y+g.height};for(const g of e.edges)for(const b of vn(g,i))g.endpoints.includes(b.id)||g.endpoints.some(_=>v(b,_))||t.push({kind:"edge-crosses-subprocess",edge:g.id,subProcess:b.id})}for(const v of e.edges){if(v.waypoints.length<2)continue;const g=[[v.source,v.waypoints[0]],[v.target,v.waypoints[v.waypoints.length-1]]];for(const[b,_]of g){if(!b)continue;const C=e.shapes.find(F=>F.id===b);if(!C||C.container)continue;const M=Math.max(C.x-_.x,_.x-(C.x+C.width),0),O=Math.max(C.y-_.y,_.y-(C.y+C.height),0),P=Math.hypot(M,O);P>Z1&&t.push({kind:"edge-endpoint-detached",edge:v.id,shape:b,distance:Math.round(P)})}}const r=e.shapes.filter(v=>v.type==="bpmn:Participant");for(let v=0;v<r.length;v++)for(let g=v+1;g<r.length;g++){const b=r[v],_=r[g];if(b.x+b.width<=_.x||_.x+_.width<=b.x||b.y+b.height<=_.y||_.y+_.height<=b.y)continue;const C=(M,O)=>M.x<=O.x&&M.y<=O.y&&M.x+M.width>=O.x+O.width&&M.y+M.height>=O.y+O.height;t.push({kind:"pool-overlap",pools:[b.id,_.id],contained:C(b,_)||C(_,b)})}const o=n.filter(v=>!v.attached);for(let v=0;v<o.length;v++)for(let g=v+1;g<o.length;g++){const b=o[v],_=o[g];if(!Fu(b,_,W1))continue;const C=b.id<_.id?[b.id,_.id]:[_.id,b.id];t.push({kind:"shape-overlap",shapes:C,identical:tS(b,_)})}const a=e.shapes.filter(v=>v.type==="bpmn:Group"&&Array.isArray(v.members)&&v.members.length>0);for(let v=0;v<a.length;v++)for(let g=v+1;g<a.length;g++){const b=a[v],_=a[g],C=Math.min(b.x+b.width,_.x+_.width)-Math.max(b.x,_.x),M=Math.min(b.y+b.height,_.y+_.height)-Math.max(b.y,_.y);if(C<=Ws||M<=Ws)continue;const O=b.id<_.id?[b.id,_.id]:[_.id,b.id],P=new Set(_.members);if(b.members.some(I=>P.has(I))){const I=Vh(e,a,{x:Math.max(b.x,_.x),y:Math.max(b.y,_.y),right:Math.min(b.x+b.width,_.x+_.width),bottom:Math.min(b.y+b.height,_.y+_.height)});I.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:O,shapes:I});continue}const F=b.x<=_.x&&b.y<=_.y&&b.x+b.width>=_.x+_.width&&b.y+b.height>=_.y+_.height?b.id:_.x<=b.x&&_.y<=b.y&&_.x+_.width>=b.x+b.width&&_.y+_.height>=b.y+b.height?_.id:void 0;t.push({kind:"group-overlap-unintended",groups:O,...F?{container:F}:{}})}const s=new Set(a.flatMap(v=>[...v.members])),c=v=>e.shapes.filter(g=>!g.container&&!Iu.has(g.type)&&g.x>=v.x&&g.y>=v.y&&g.x+g.width<=v.x+v.width&&g.y+g.height<=v.y+v.height);for(const v of a){const g=c(v);if(!g.length)continue;const b=new Set(v.members),_=g.filter(C=>!b.has(C.id));_.some(C=>s.has(C.id))&&(_.length*2<g.length||t.push({kind:"group-overlap-unreadable",reason:"minority",group:v.id,shapes:_.map(C=>C.id).sort()}))}for(const v of a){const g=new Set(c(v).map(P=>P.id)),b=new Set(v.members),_=new Set([...g].filter(P=>!b.has(P)&&s.has(P)));if(!_.size)continue;let C=!1,M=!1,O=!1;for(const P of e.edges){if(P.type!=="bpmn:SequenceFlow"||!P.source||!P.target)continue;const F=_.has(P.source),I=_.has(P.target);!F&&I&&!g.has(P.source)?C=!0:F&&!I&&!g.has(P.target)?M=!0:F&&I&&(O=!0)}C&&M&&O&&t.push({kind:"group-overlap-unreadable",reason:"throughpass",group:v.id,shapes:[..._].sort()})}const l=e.shapes.filter(v=>v.type==="bpmn:Group");for(let v=0;v<l.length;v++)for(let g=v+1;g<l.length;g++)for(let b=g+1;b<l.length;b++){const _=[l[v],l[g],l[b]],C={x:Math.max(..._.map(P=>P.x)),y:Math.max(..._.map(P=>P.y)),right:Math.min(..._.map(P=>P.x+P.width)),bottom:Math.min(..._.map(P=>P.y+P.height))};if(C.right-C.x<=Ws||C.bottom-C.y<=Ws)continue;const M=Vh(e,[],C);if(!M.length)continue;const O=_.map(P=>P.id).sort();t.push({kind:"group-stack-unreadable",groups:O,shapes:M})}for(const v of e.shapes.filter(g=>g.type==="bpmn:Group"))for(const g of e.shapes){if(g.container||g.attached||Iu.has(g.type)||g.width<=0||g.height<=0)continue;const b=[["top",v.y,"h",v.x,v.x+v.width],["bottom",v.y+v.height,"h",v.x,v.x+v.width],["left",v.x,"v",v.y,v.y+v.height],["right",v.x+v.width,"v",v.y,v.y+v.height]];for(const[_,C,M,O,P]of b){const F=M==="h"?g.x:g.y,I=M==="h"?g.x+g.width:g.y+g.height;if(!(F<P&&O<I))continue;const B=M==="h"?g.y:g.x,z=M==="h"?g.y+g.height:g.x+g.width;if(!(B<C&&C<z))continue;const ce=Math.min(C-B,z-C);ce<Y1||t.push({kind:"group-cuts-shape",group:v.id,shape:g.id,side:_,depth:ce})}}const u=e.shapes.filter(v=>v.container&&v.type!=="bpmn:Group"&&v.type!=="bpmn:Lane");for(const v of e.shapes.filter(g=>g.type==="bpmn:Group"))for(const g of u){const b=v.x<g.x+g.width&&g.x<v.x+v.width,_=v.y<g.y+g.height&&g.y<v.y+v.height,C=[["top",v.y,g.y,b],["bottom",v.y+v.height,g.y+g.height,b],["left",v.x,g.x,_],["right",v.x+v.width,g.x+g.width,_]];for(const[M,O,P,F]of C)F&&Math.abs(O-P)<=Oh&&t.push({kind:"group-on-container-boundary",group:v.id,container:g.id,side:M})}const f=e.shapes.filter(v=>v.type==="bpmn:Group");for(let v=0;v<f.length;v++)for(let g=v+1;g<f.length;g++){const b=f[v],_=f[g],C=b.x<_.x+_.width&&_.x<b.x+b.width,M=b.y<_.y+_.height&&_.y<b.y+b.height,O=[["x",b.x+b.width,_.x,M],["x",_.x+_.width,b.x,M],["y",b.y+b.height,_.y,C],["y",_.y+_.height,b.y,C]];for(const[P,F,I,B]of O)if(B&&Math.abs(F-I)<=Oh){t.push({kind:"group-on-group-boundary",groups:b.id<_.id?[b.id,_.id]:[_.id,b.id],axis:P});break}}for(let v=0;v<e.edges.length;v++)for(let g=v+1;g<e.edges.length;g++){const b=e.edges[v],_=e.edges[g],C=Do(b,_);if(!C)continue;const M=b.id<_.id?[b.id,_.id]:[_.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 v of e.edges){if(!v.label)continue;const g=Ys(v,e.edges);g&&t.push({kind:"label-on-shared-segment",edge:v.id,other:g.other,axis:g.axis})}for(const v of e.edges){if(!v.label)continue;const g=$h(v,e);g&&t.push({kind:"label-over-line",edge:v.id,line:g})}const p=new Set(n.map(v=>v.id)),d=e.shapes.filter(v=>v.type==="bpmn:Participant"&&v.label);for(const v of[...n,...d.filter(g=>!p.has(g.id))]){if(!v.label)continue;const g=Yh(v,e);g&&t.push({kind:"label-over-line",edge:v.id,line:g})}const m=new Set(e.shapes.filter(v=>v.type==="bpmn:TextAnnotation").map(v=>v.id));for(const v of d)for(const{owner:g,rect:b}of Io(e))g===v.id||m.has(g)||Fu(v.label,b,Lo)&&t.push({kind:"pool-name-over-label",pool:v.id,label:g});const h=Io(e);for(const v of n)if(v.type==="bpmn:TextAnnotation")for(const{owner:g,rect:b}of h)g!==v.id&&Fu(v,b,Lo)&&t.push({kind:"annotation-over-label",annotation:v.id,label:g});const y=new Map(e.shapes.map(v=>[v.id,v]));for(const v of n){const g=v.parent??rS(v,e,y);if(!g)continue;const b=y.get(g);!b||!b.container||J1(b,v,Q1)||v.type==="bpmn:TextAnnotation"&&!oS(v,b,e)||t.push({kind:"shape-outside-container",shape:v.id,container:b.id})}return t.sort((v,g)=>Tt(v).localeCompare(Tt(g)))}const Dt=e=>typeof e=="object"&&e!==null?e:void 0,Wt=e=>typeof e=="number"?e:0,Xi=e=>{const t=Dt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function aS(e){const t=Dt(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=Xi(o);a&&n.push(a)}}return n}function sS(e){const t=Dt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Xi(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Xi(t.targetRef);return n&&i?{source:n,target:i}:{}}function cS(e,t){const n=Dt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Xi(n);return r?t.get(r):void 0}if(Vs.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Xi(n)}function qh(e){var a,s,c,l,u;const t=[],n=[],i=((a=Dt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=Dt(e))==null?void 0:s.rootElements)??[]){const p=Dt(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const m=Dt(d),h=Xi(m),y=Xi(m==null?void 0:m.processRef);h&&y?r.set(y,h):h&&o.add(h)}}for(const f of i){const p=Dt((c=Dt(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const m of d){const h=Dt(m);if(!h)continue;const y=Dt(h.bpmnElement),v=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!v)continue;const g=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",b=Dt(h.bounds);if(b){const C=h.isExpanded===!1&&g!=="bpmn:Participant",M=Dt((l=Dt(h.label))==null?void 0:l.bounds),O={id:v,type:g,x:Wt(b.x),y:Wt(b.y),width:Wt(b.width),height:Wt(b.height),container:Vs.has(g)&&!C,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:cS(y,r)}:{},...M?{label:{x:Wt(M.x),y:Wt(M.y),width:Wt(M.width),height:Wt(M.height)}}:{},...g==="bpmn:Group"?Uh(Wh(y)):{}},P=h.isHorizontal!==!1,F=typeof(y==null?void 0:y.name)=="string"?y.name:"";o.has(v)&&P&&F&&(O.label=Bu(O,F)),t.push(O);continue}const _=h.waypoint;if(Array.isArray(_)){const C=Dt((u=Dt(h.label))==null?void 0:u.bounds);n.push({id:v,type:g,waypoints:_.map(M=>{var O,P;return{x:Wt((O=Dt(M))==null?void 0:O.x),y:Wt((P=Dt(M))==null?void 0:P.y)}}),endpoints:aS(y),...sS(y),...C?{label:{x:Wt(C.x),y:Wt(C.y),width:Wt(C.width),height:Wt(C.height)}}:{}})}}}return{shapes:t,edges:n}}function Kh(e){return Ot(qh(e))}async function lS(e){const{definitions:t,warnings:n}=await To(e);return{findings:Kh(t),warnings:n}}function tt(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=Dt(o.label),y=Xi(o.source),v=Xi(o.target);n.push({id:o.id,type:a,waypoints:s.map(g=>({x:Wt(g.x),y:Wt(g.y)})),endpoints:[y,v].filter(g=>!!g),...y&&v?{source:y,target:v}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Wt(h.y),width:Wt(h.width),height:Wt(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=Dt(o.businessObject),l=Dt(o.label);let u=Dt(o.parent);for(;u&&u.type==="bpmn:Lane";)u=Dt(u.parent);const f=typeof(u==null?void 0:u.type)=="string"?u.type:"",p=u&&Vs.has(f)&&f!=="bpmn:Group"&&typeof u.id=="string"?u.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Wt(o.width),height:Wt(o.height),container:Vs.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...l&&typeof l.x=="number"?{label:{x:l.x,y:Wt(l.y),width:Wt(l.width),height:Wt(l.height)}}:{},...a==="bpmn:Group"?Uh(Wh(c)):{}},m=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&m&&((i=Dt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Bu(d,m)),t.push(d)}return{shapes:t,edges:n}}const uS={"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 pS(e,t){const n=uS[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function Xh(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function Zh(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 pS(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&Xh(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?Xh(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 ju=20,fS=4,Pt=(e,t)=>Math.abs(e-t)<.5;function Xs(e,t,n,i=ju){if(Pt(e.y,t.y)&&!Pt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=l=>[{x:a,y:e.y},{x:a,y:l},{x:s,y:l},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(Pt(e.x,t.x)&&!Pt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=l=>[{x:e.x,y:a},{x:l,y:a},{x:l,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function Qh(e,t,n,i=ju){if(n.length<2)return null;if(Pt(e.y,t.y)&&!Pt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),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,l=e.x<t.x?s:a,u=Math.min(...n.map(d=>d.y))-i,f=Math.max(...n.map(d=>d.y+d.height))+i,p=d=>[{x:c,y:e.y},{x:c,y:d},{x:l,y:d},{x:l,y:e.y}];return[p(u),p(f)]}if(Pt(e.x,t.x)&&!Pt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),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,l=e.y<t.y?s:a,u=Math.min(...n.map(d=>d.x))-i,f=Math.max(...n.map(d=>d.x+d.width))+i,p=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:l},{x:e.x,y:l}];return[p(u),p(f)]}return null}function Jh(e,t,n=ju){if(e.length!==4)return null;const[i,r,o,a]=e;if(Pt(i.y,r.y)&&Pt(r.x,o.x)&&Pt(o.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(Pt(i.x,r.x)&&Pt(r.y,o.y)&&Pt(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function Zs(e,t){if(e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,l=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],u=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[l,u]}const em=30,dS=[0,-25,25,-40,40];function hS(e,t){if(e.type!=="bpmn:MessageFlow"||e.endpoints.length!==2)return[];const n=t.find(p=>p.id===e.endpoints[0]),i=t.find(p=>p.id===e.endpoints[1]);if(!n||!i)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(i.y<n.y+n.height&&i.y+i.height>n.y)return[];const a=o<r,s=a?n.y+n.height:n.y,c=a?s+em:s-em,l=a?i.y+i.height:i.y,u=n.x+n.width/2,f=i.x+i.width/2;return dS.map(p=>[{x:u,y:s},{x:u,y:c},{x:f+p,y:c},{x:f+p,y:l}])}const Hu=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],Bo=(e,t,n)=>vn({...e,waypoints:t},n).length;function zu(e,t,n,i){let r=[...e.waypoints],o=Bo(e,r,t);if(o===0)return null;let a=!1;for(const f of Zs(e,t))if(Bo(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(In),c=f=>In({...e,waypoints:f}).some(p=>Us(p,s).length>0),l=hS(e,t).filter(f=>Bo(e,f,t)===0);if(l.length)return l.find(f=>!c(f))??l[0];const u=f=>!n||f.every(p=>p.x>=n.x&&p.x<=n.x+n.width&&p.y>=n.y&&p.y<=n.y+n.height);if(e.endpoints.length===2&&r.length>2){const f=t.find(d=>d.id===e.endpoints[0]),p=t.find(d=>d.id===e.endpoints[1]);if(f&&p&&Pt(f.y+f.height/2,p.y+p.height/2)){const d=[r[0],r[r.length-1]];if(Pt(d[0].y,d[1].y)&&!Pt(d[0].x,d[1].x)){const m=t.filter(g=>!e.endpoints.includes(g.id)&&vn({...e,waypoints:d},[g]).length>0),h=m.length>=2?Qh(d[0],d[1],m):null,v=(h?h.map(g=>[d[0],...g,d[1]]):m.length===1?(Xs(d[0],d[1],m[0])??[]).map(g=>[d[0],...g,d[1]]):m.length===0?[d]:[]).filter(g=>Bo(e,g,t)===0&&g.length<=r.length).sort((g,b)=>Number(u(b))-Number(u(g)));if(v.length)return v.find(g=>!c(g))??v[0]}}}for(let f=0;f+1<r.length;f++){const p=r[f],d=r[f+1],m=t.filter(v=>!e.endpoints.includes(v.id)&&vn({...e,waypoints:[p,d]},[v]).length>0);if(m.length<2)continue;const h=Qh(p,d,m);if(!h)continue;const y=h.map(v=>Hu(r,f,v)).filter(v=>Bo(e,v,t)===0).sort((v,g)=>Number(u(g))-Number(u(v)));if(y.length)return y.find(v=>!c(v))??y[0]}for(let f=0;f<fS&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const m=r[d],h=r[d+1];for(const y of t){if(e.endpoints.includes(y.id)||vn({...e,waypoints:[m,h]},[y]).length===0)continue;const v=Xs(m,h,y),g=v?v.map(_=>Hu(r,d,_)):Jh(r,y)??[];if(!g.length)continue;const b=[...g].sort((_,C)=>Number(u(C))-Number(u(_)));for(const _ of b){const C=Bo(e,_,t);if(C<o){r=_,o=C,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function Gu(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=tt(i),a=oi(o),s=new Set,c=Ot(o).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(Tt(u)));if(!c.length)return s;const l=new Map;for(const u of c){if(u.kind!=="edge-crosses-shape"||l.has(u.edge))continue;const f=o.edges.find(p=>p.id===u.edge);f&&l.set(u.edge,f)}for(const[u,f]of l){if(n&&!n.has(u))continue;const p=i.get(u);if(!p)continue;const d=p.parent,m=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=zu(f,a,m,o.edges);if(!h){vn(f,a).some(b=>b.type==="bpmn:TextAnnotation")&&s.add(u);continue}const y=o.edges.filter(b=>b.id!==u),v=ii(f,y);ii({...f,waypoints:h},y)>v||r.updateWaypoints(p,h)}return s}const mS=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},Vu=(e,t)=>Pa(e,[t])>0;function tm(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=tt(i),a=oi(o);let s=o;const c=new Set(Ot(o).map(Tt));for(const[l,u]of Ks(o))if(!t.has(`${l}|${u}`))for(const[f,p]of[[l,u],[u,l]]){if(n.has(f))continue;const d=s.edges.find(F=>F.id===f),m=s.edges.find(F=>F.id===p);if(!d||!m)continue;const h=i.get(f);if(!h)continue;const y=h.parent,v=y&&typeof y.x=="number"&&typeof y.width=="number"?{x:y.x,y:y.y,width:y.width,height:y.height}:void 0,g=mS(m),b=[...Zs(d,a)??[]],_=zu(d,[...a,...g],v,o.edges);_&&b.push(_);for(let F=0;F+1<d.waypoints.length;F++)for(const I of g)for(const B of Xs(d.waypoints[F],d.waypoints[F+1],I)??[])b.push(Hu(d.waypoints,F,B));const C=s.edges.filter(F=>F.id!==f),M=F=>({...s,edges:s.edges.map(I=>I.id===f?{...I,waypoints:F}:I)}),O=F=>!v||F.every(I=>I.x>=v.x&&I.x<=v.x+v.width&&I.y>=v.y&&I.y<=v.y+v.height),P=b.find(F=>{const I={...d,waypoints:F};return Vu(I,m)||!O(F)||C.some(B=>B.id!==p&&!Vu(d,B)&&Vu(I,B))?!1:Ot(M(F)).every(B=>c.has(Tt(B)))});if(P){r.updateWaypoints(h,P),s=M(P);break}}}const gS=10;function nm(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 im(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=nm(i,n),a=nm(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,l=s?a:o,u=n.filter(z=>z.id!==o.id&&z.id!==a.id&&z.y>=c.y+c.height&&z.y+z.height<=l.y).sort((z,ce)=>z.y-ce.y);if(!u.length)return null;const f=u[0],p=u[u.length-1],d=(c.y+c.height+f.y)/2,m=(p.y+p.height+l.y)/2,h=s?d:m,y=s?m:d,v=e.waypoints[0],g=e.waypoints[e.waypoints.length-1],b=oi(t),_=t.edges.filter(z=>z.id!==e.id),C=ri(e,_),M=vn(e,b).length;if(C===0&&M===0||M===0&&e.waypoints.length===2)return null;const O=Math.min(...u.map(z=>z.x)),P=Math.max(...u.map(z=>z.x+z.width)),F=(v.x+g.x)/2,I=z=>z.filter((ce,ve)=>ve===0||!(Pt(ce.x,z[ve-1].x)&&Pt(ce.y,z[ve-1].y)));let B;for(let z=O;z<=P;z+=gS){const ce=I([v,{x:v.x,y:h},{x:z,y:h},{x:z,y},{x:g.x,y},g]),ve={...e,waypoints:ce};if(vn(ve,b).length>0)continue;const qe=ri(ve,_),He=Math.abs(z-F);(!B||qe<B.cross||qe===B.cross&&He<B.detour)&&(B={pts:ce,cross:qe,detour:He})}return B&&(M>0?B.cross<=C:B.cross<C)?B.pts:null}function rm(e,t){const{elementRegistry:n}=e,i=e.modeling,r=tt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=tt(n),s=a.edges.find(u=>u.id===o.id);if(!s)continue;const c=im(s,a);if(!c)continue;const l=n.get(o.id);l&&i.updateWaypoints(l,c)}}const Ti=[25,-25,40,-40],No=35;function yS(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)-No:Math.max(e.y+e.height,t.y+t.height)+No;for(const l of[0,...Ti])if(!(Math.abs(l)>=e.width/2-5))for(const u of[0,...Ti]){if(Math.abs(u)>=t.width/2-5)continue;const f=n+l,p=i+u;r.push({pts:[{x:f,y:a},{x:f,y:c},{x:p,y:c},{x:p,y:s}],cost:Math.abs(u)+Math.abs(l)})}}return r}function Qs(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 yS(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,l=s?n.y:n.y+n.height,u=s?n.y-No:n.y+n.height+No,f=[];for(const g of[0,...Ti]){if(Math.abs(g)>=i.width/2-5)continue;const b=o+g;f.push({pts:[{x:n.x,y:r},{x:b,y:r},{x:b,y:c}],cost:Math.abs(g)});for(const _ of[0,...Ti]){if(Math.abs(_)>=n.width/2-5)continue;const C=a+_;f.push({pts:[{x:C,y:l},{x:C,y:u},{x:b,y:u},{x:b,y:c}],cost:Math.abs(g)+Math.abs(_)})}}const p=50,d=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const g of[0,...Ti]){if(Math.abs(g)>=n.width/2-5)continue;const b=a+g;f.push({pts:[{x:b,y:m},{x:b,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(g)})}const h=60,y=s?i.y+i.height:i.y,v=s?i.y+i.height+No:i.y-No;for(const g of[0,...Ti]){if(Math.abs(g)>=i.width/2-5)continue;const b=o+g;for(const _ of[0,...Ti]){if(Math.abs(_)>=n.width/2-5)continue;const C=a+_;f.push({pts:[{x:C,y:m},{x:C,y:v},{x:b,y:v},{x:b,y}],cost:h+Math.abs(g)+Math.abs(_)})}}return f}const Js=30;function om(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Pt(i.y,r.y)&&!Pt(i.x,r.x),a=Pt(i.x,r.x)&&!Pt(i.y,r.y);if(!(!o&&!a))for(const s of t)if(o){const c=Math.min(i.x,r.x);if(Math.max(i.x,r.x)<=s.x||c>=s.x+s.width)continue;if(Math.abs(i.y-s.y)<Js||Math.abs(i.y-(s.y+s.height))<Js)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)<Js||Math.abs(i.x-(s.x+s.width))<Js)return!0}}return!1}const ec=40;function vS(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-ec,a=r.x+r.width+ec,s=r.y-ec,c=r.y+r.height+ec;for(let l=1;l<e.length-2;l++){const u=e[l],f=e[l+1],p={x:Math.min(u.x,f.x),y:Math.min(u.y,f.y)},d={x:Math.max(u.x,f.x),y:Math.max(u.y,f.y)};if(p.x<a&&d.x>o&&p.y<c&&d.y>s){i++;break}}}return i}function am(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=oi(t),o=t.edges.filter(M=>M.id!==e.id),a=ii(e,o),s=ri(e,o),c=M=>vS(M,t.shapes,e.endpoints)+(om(M,n)?1:0),l=c(e.waypoints),u=M=>{if(!M)return;const O=M.x+M.width/2,P=M.y+M.height/2;return n.find(F=>F.type==="bpmn:Lane"&&O>=F.x&&O<=F.x+F.width&&P>=F.y&&P<=F.y+F.height)},f=u(i.get(e.endpoints[0]??"")),p=u(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,m=M=>{if(!d||!p)return!1;for(let O=1;O<M.length-2;O++){const P=M[O],F=M[O+1];if(Pt(P.y,F.y)&&!Pt(P.x,F.x)&&P.y>p.y&&P.y<p.y+p.height)return!0}return!1},h=m(e.waypoints),v=(M=>{if(!M)return;const O=M.x+M.width/2,P=M.y+M.height/2;return n.filter(F=>F.type==="bpmn:Participant"&&O>=F.x&&O<=F.x+F.width&&P>=F.y&&P<=F.y+F.height).sort((F,I)=>F.width*F.height-I.width*I.height)[0]})(i.get(e.endpoints[0]??"")),g=M=>{if(!v)return 0;let O=0;for(let P=1;P<M.length-1;P++){const F=M[P];(F.x<v.x||F.x>v.x+v.width||F.y<v.y||F.y>v.y+v.height)&&O++}return O},b=g(e.waypoints);if(!om(e.waypoints,n)&&!(d&&!h)&&b===0)return null;const _=M=>M.reduce((O,P,F)=>F?O+Math.abs(P.x-M[F-1].x)+Math.abs(P.y-M[F-1].y):0,0);let C;for(const{pts:M,cost:O}of Qs(e,i)){const P={...e,waypoints:M};if(vn(P,r).length>0)continue;const F=ii(P,o);if(F>a)continue;const I=g(M);if(I>b)continue;const B=I<b&&F===0;if(!B&&ri(P,o)>s)continue;const z=c(M),ce=m(M);if(!B&&!(ce&&!h)&&z>=l)continue;const qe=ce?0:1,He=_(M);(!C||I<C.out||I===C.out&&(qe<C.lane||qe===C.lane&&(F<C.opp||F===C.opp&&(z<C.sc||z===C.sc&&(O<C.cost||O===C.cost&&He<C.len)))))&&(C={pts:M,out:I,sc:z,lane:qe,opp:F,cost:O,len:He})}return(C==null?void 0:C.pts)??null}function bS(e,t){const{elementRegistry:n}=e,i=e.modeling,r=tt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=tt(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=oi(a),l=a.edges.filter(d=>d.id!==o),u=vn(s,c).length,f=ii(s,l),p=ri(s,l);for(const d of Zs(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const m={...s,waypoints:d};if(vn(m,c).length>u||ii(m,l)>f||ri(m,l)>p)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function sm(e,t){const{elementRegistry:n}=e,i=e.modeling,r=tt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=tt(n),s=a.edges.find(u=>u.id===o);if(!s)continue;const c=am(s,a);if(!c)continue;const l=n.get(o);l&&i.updateWaypoints(l,c)}}function Wu(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],r=t.get(e.endpoints[0]??""),o=t.get(e.endpoints[1]??""),a=Pt(n[0].x,n[1].x)&&!Pt(n[0].y,n[1].y),s=Pt(n[n.length-1].x,n[n.length-2].x)&&!Pt(n[n.length-1].y,n[n.length-2].y);for(const c of Ti){if(a&&r&&Math.abs(c)<r.width/2-5){const l=n.map(u=>({...u}));l[0].x+=c,l[1].x+=c,i.push({pts:l,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const l=n.map(u=>({...u}));l[l.length-1].x+=c,l[l.length-2].x+=c,i.push({pts:l,cost:Math.abs(c)})}}return i}function xS(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,l=n.y+n.height/2,u=i.x+i.width/2,f=i.y+i.height/2,p=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,m=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,y=[];for(const v of[0,...Ti])Math.abs(v)<i.width/2-5&&y.push({pts:[{x:p,y:l},{x:u+v,y:l},{x:u+v,y:h}],cost:Math.abs(v)}),Math.abs(v)<i.height/2-5&&y.push({pts:[{x:c,y:d},{x:c,y:f+v},{x:m,y:f+v}],cost:Math.abs(v)});return y}function Uu(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,l=a?i.y+i.height:i.y,u=(r+o)/2,f=[];for(const p of[0,...Ti]){const d=u+p;d<=r||d>=o||f.push({pts:[{x:d,y:c},{x:d,y:l}],cost:Math.abs(p)})}return f}function cm(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=oi(t),r=t.edges.filter(d=>d.id!==e.id),o=ii(e,r);if(o===0)return null;const a=ri(e,r);let s;const c=d=>d.reduce((m,h,y)=>y?m+Math.abs(h.x-d[y-1].x)+Math.abs(h.y-d[y-1].y):0,0),l=3,u=d=>{const m=d[0],h=d[d.length-1],y=Math.hypot(h.x-m.x,h.y-m.y);return y>=1&&c(d)/y>=l?1:0},f=u(e.waypoints),p=[...Qs(e,n),...Uu(e,n),...Wu(e,n)];for(const{pts:d,cost:m}of p){const h={...e,waypoints:d};if(vn(h,i).length>0)continue;const y=ii(h,r),v=ri(h,r),g=o-y+(f-u(d));if(y>=o||v-a>g)continue;const b=c(d);(!s||y<s.opposite||y===s.opposite&&(v<s.cross||v===s.cross&&(m<s.cost||m===s.cost&&b<s.len)))&&(s={pts:d,opposite:y,cross:v,cost:m,len:b})}return(s==null?void 0:s.pts)??null}function lm(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=Do(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function _S(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=oi(t),r=t.edges.filter(p=>p.id!==e.id),o=lm(e,r);if(o===0)return null;const a=ii(e,r),s=ri(e,r),c=p=>p.reduce((d,m,h)=>h?d+Math.abs(m.x-p[h-1].x)+Math.abs(m.y-p[h-1].y):0,0),l=2;let u;const f=[...Qs(e,n),...Uu(e,n),...xS(e,n),...Wu(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(vn(m,i).length>0)continue;const h=lm(m,r);if(h>=o)continue;const y=ii(m,r);if(y-h>a-o)continue;const v=ri(m,r);if(v-s>(o-h)*l)continue;const g=c(p);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(v<u.cross||v===u.cross&&(d<u.cost||d===u.cost&&g<u.length))))&&(u={pts:p,fake:h,unreadable:y,cross:v,cost:d,length:g})}return(u==null?void 0:u.pts)??null}function um(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Ot(tt(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(Tt(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=tt(i),l=c.edges.find(p=>p.id===s);if(!l)continue;const u=_S(l,c);if(!u)continue;const f=i.get(s);f&&r.updateWaypoints(f,u)}}function pm(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 fm(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Do(e,t))==null?void 0:l.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(u=>u&&(u===o||u===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:pm(e,n)&&pm(t,n)}function dm(e,t,n){let i=0;for(const r of t)r.id!==e.id&&fm(e,r,n)&&i++;return i}function wS(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=oi(t),r=t.edges.filter(p=>p.id!==e.id),o=dm(e,r,n);if(o===0)return null;const a=ii(e,r),s=ri(e,r),c=p=>p.reduce((d,m,h)=>h?d+Math.abs(m.x-p[h-1].x)+Math.abs(m.y-p[h-1].y):0,0),l=2;let u;const f=[...Qs(e,n),...Uu(e,n),...Wu(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(vn(m,i).length>0)continue;const h=dm(m,r,n);if(h>=o)continue;const y=ii(m,r);if(y-h>a-o)continue;const v=ri(m,r);if(v-s>(o-h)*l)continue;const g=c(p);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(v<u.cross||v===u.cross&&(d<u.cost||d===u.cost&&g<u.length))))&&(u={pts:p,chain:h,unreadable:y,cross:v,cost:d,length:g})}return(u==null?void 0:u.pts)??null}function ES(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=tt(i),a=new Map(o.shapes.map(l=>[l.id,l])),s=Ot(o).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(Tt(l)));if(!s.length)return;const c=new Set;for(const l of s){if(l.kind!=="edge-overlap-opposite")continue;const[u,f]=l.edges.map(p=>o.edges.find(d=>d.id===p));if(!(!u||!f||!fm(u,f,a)))for(const p of l.edges)n.has(p)||c.add(p)}for(const l of[...c].sort()){const u=tt(i),f=u.edges.find(m=>m.id===l);if(!f)continue;const p=wS(f,u);if(!p)continue;const d=i.get(l);d&&r.updateWaypoints(d,p)}}function hm(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=tt(i),a=Ot(o).filter(u=>Nu(u)&&!t.has(Tt(u)));if(!a.length)return;const s=new Set;for(const u of a)if(Nu(u))for(const f of u.edges)n.has(f)||s.add(f);const c=u=>{var f;return((f=o.edges.find(p=>p.id===u))==null?void 0:f.type)??""},l=[...s].sort((u,f)=>{const p=c(u)==="bpmn:SequenceFlow"?0:1,d=c(f)==="bpmn:SequenceFlow"?0:1;return p!==d?p-d:u.localeCompare(f)});for(const u of l){const f=tt(i),p=f.edges.find(h=>h.id===u);if(!p)continue;const d=cm(p,f);if(!d)continue;const m=i.get(u);m&&r.updateWaypoints(m,d)}}const SS=10,RS=(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 mm(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Ys(e,i))return null;const r=oi(t),o=i.flatMap(In);for(const a of In(e)){let s=[[a.lo,a.hi]];for(const[d,m]of Us(a,o))s=s.flatMap(([h,y])=>{const v=[];return d>h&&v.push([h,Math.min(y,d)]),m<y&&v.push([Math.max(h,m),y]),v.filter(([g,b])=>b>g)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,m])=>m-d>=c+SS*2);if(!l)continue;const u=(l[0]+l[1])/2,f=a.axis==="h"?{x:u,y:a.at-Bh}:{x:a.at+Wn+n.width/2,y:u},p={x:f.x-n.width/2,y:f.y-n.height/2,width:n.width,height:n.height};if(!Ys({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&RS(p,d)))return p}return null}const Wn=8;function gm(e,t){const n=e.label;if(!n)return null;const i=In(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=p=>{const d=p.axis==="h"?r:o,m=p.axis==="h"?o-p.at:r-p.at,h=d<p.lo?p.lo-d:d>p.hi?d-p.hi:0;return Math.hypot(m,h)},s=i.reduce((p,d)=>a(d)<a(p)?d:p,i[0]),c=[...i,...t.edges.filter(p=>p.id!==e.id).flatMap(In),...t.shapes.filter(p=>p.container).flatMap(Ca)],l=p=>!c.some(d=>Ki(p,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+Wn,f=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const p of[s.at+Wn,s.at-Wn-n.width])for(const d of f){const m=n.y+d;if(m<s.lo||m+n.height>s.hi)continue;const h={...n,x:p,y:m};if(l(h))return h}else for(const p of[s.at-Wn-n.height,s.at+Wn])for(const d of f){const m=n.x+d;if(m<s.lo||m+n.width>s.hi)continue;const h={...n,x:m,y:p};if(l(h))return h}return null}function ym(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=tt(n),o=new Set(Ot(r).map(Tt));for(const[a,s]of t){const c=s.wps,l=n.get(a),u=l==null?void 0:l.label;if(!u||!(l!=null&&l.waypoints)||l.waypoints.length!==c.length)continue;const f=l.waypoints[0].x-c[0].x,p=l.waypoints[0].y-c[0].y;if(!l.waypoints.every((b,_)=>b.x-c[_].x===f&&b.y-c[_].y===p))continue;const d=s.label.x+f-u.x,m=s.label.y+p-u.y;if(d===0&&m===0)continue;const h=r.edges.find(b=>b.id===a);if(!(h!=null&&h.label))continue;const y={...h.label,x:h.label.x+d,y:h.label.y+m},v={...r,edges:r.edges.map(b=>b.id===a?{...b,label:y}:b)},g=Ot(v);g.some(b=>!o.has(Tt(b)))||(i.moveElements([u],{x:d,y:m}),r=v,o=new Set(g.map(Tt)))}}function vm(e,t){const{elementRegistry:n}=e,i=e.modeling,r=tt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=gm(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 bm(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=tt(i),a=Ot(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(Tt(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(p=>p.id===s.edge);if(!c)continue;const l=mm(c,o);if(!l)continue;const u=i.get(s.edge),f=u==null?void 0:u.label;f&&r.moveElements([f],{x:l.x-f.x,y:l.y-f.y})}}function xm(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(In),...t.shapes.filter(p=>p.container).flatMap(Ca)],r=i.filter(p=>Ki(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=Io(t).filter(p=>p.owner!==e.id).map(p=>p.rect),s=(p,d)=>p.x<d.x+d.width&&d.x<p.x+p.width&&p.y<d.y+d.height&&d.y<p.y+p.height,c=p=>!i.some(d=>Ki(p,d))&&!o.some(d=>s(p,d))&&!a.some(d=>s(p,d)),l=[];for(const p of r)p.axis==="h"?l.push({...n,y:p.at-Wn-n.height},{...n,y:p.at+Wn}):l.push({...n,x:p.at-Wn-n.width},{...n,x:p.at+Wn});const u=e.x+e.width/2,f=e.y+e.height/2;return l.push({...n,x:u-n.width/2,y:e.y+e.height+Wn},{...n,x:u-n.width/2,y:e.y-Wn-n.height},{...n,x:e.x+e.width+Wn,y:f-n.height/2},{...n,x:e.x-Wn-n.width,y:f-n.height/2}),l.find(c)??null}function _m(e,t){const{elementRegistry:n}=e,i=e.modeling,r=tt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=xm(o,tt(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 CS(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,l)=>l[0]<c[0]?l:c);return{x:Math.round(s[1].x),y:Math.round(s[1].y)}}function wm(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=tt(n),o=new Set(Ot(r).map(Tt));const a=[...new Set(Ot(r).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(Tt(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 l=c.waypoints.map(h=>({...h})),u=[[c.endpoints[0],0],[c.endpoints[1],l.length-1]];let f=!1;for(const[h,y]of u){const v=h?r.shapes.find(b=>b.id===h):void 0;if(!v)continue;const g=CS(v,l[y]);g.x===l[y].x&&g.y===l[y].y||(l[y]=g,f=!0)}if(!f)continue;const p={...r,edges:r.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=Ot(p);if(d.some(h=>!o.has(Tt(h))))continue;const m=n.get(s);m&&(i.updateWaypoints(m,l),r=p,o=new Set(d.map(Tt)))}}const AS=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Em=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Sm={"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}]},tc=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Yu=e=>typeof e=="string"&&e!=="";function PS(e){const t=[];function n(i,r,o,a){if(a===null){Yu(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!tc(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)Yu(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a;if(!tc(i)||!Yu(i.kind)||!(i.kind in Sm)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const s of Sm[i.kind]){const c=s.path.endsWith("[]"),l=c?s.path.slice(0,-2):s.path,u=l.split(".");let f=i;for(const d of u.slice(0,-1)){if(!tc(f))break;f=f[d]}if(!tc(f))continue;const p=f[u[u.length-1]];if(!(p===void 0&&s.optional)&&!(p===null&&s.optional)){if(!c){n(r,s.path,p,s.shape);continue}if(!Array.isArray(p)){t.push({kind:"payload-invalid",opIndex:r,field:s.path});continue}p.forEach((d,m)=>n(r,`${l}[${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"&&!eh(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 Rm(e,t){const n=PS(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,m){if(!AS.test(d)){i.push({kind:"id-invalid",opIndex:p,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:p,id:d});return}r.set(d,{...m,opIndex:p})}e.forEach((p,d)=>{var m;switch(p.kind){case"participant.add":a(d,p.participant.id,{category:"participant",lanes:(p.participant.lanes??[]).map(h=>h.id)});for(const h of p.participant.lanes??[])a(d,h.id,{category:"lane"});break;case"node.add":a(d,p.node.id,{category:"flowNode",participant:p.node.participant});break;case"sequenceFlow.add":a(d,p.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,p.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,p.dataStore.id,{category:"dataStore"});for(const h of p.associations??[])h.id&&a(d,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":p.association.id&&a(d,p.association.id,{category:"dataAssociation"});break;case"association.add":p.association.id&&a(d,p.association.id,{category:"association"});break;case"annotation.add":a(d,p.annotation.id,{category:"annotation"}),(m=p.association)!=null&&m.id&&a(d,p.association.id,{category:"association"});break;case"group.add":a(d,p.group.id,{category:"group"});break;case"participant.update":if(p.lanes){o.set(p.id,p.lanes.map(h=>h.id));for(const h of p.lanes)t.categoryOf(h.id)===void 0&&a(d,h.id,{category:"lane"})}break}});const s=p=>{var d;return((d=r.get(p))==null?void 0:d.category)??t.categoryOf(p)},c=p=>{const d=r.get(p);return d?d.category==="participant"?p:d.participant:t.categoryOf(p)==="participant"?p:t.participantOf(p)};function l(p,d,m,h){const y=s(d);if(y===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:m});return}if(h&&!h.includes(y)){i.push({kind:"ref-category",opIndex:p,ref:d,role:m,expected:h.join("|"),actual:y});return}return y}const u=t.isCollaboration()||e.some(p=>p.kind==="participant.add");return e.forEach((p,d)=>{var m;switch(p.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:y}=p.node;if(h===void 0){(u||y!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:p.node.id});break}if(l(d,h,"participant",["participant"])===void 0)break;y!==void 0&&((((m=r.get(h))==null?void 0:m.lanes)??o.get(h)??t.lanesOf(h)).includes(y)||i.push({kind:"lane-unknown",opIndex:d,lane:y,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:y,target:v,name:g,condition:b}=p.flow,_=l(d,y,"source",["flowNode"]),C=l(d,v,"target",["flowNode"]);_&&C&&c(y)!==c(v)&&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:y,target:v}=p.flow,g=l(d,y,"source",["flowNode","participant"]),b=l(d,v,"target",["flowNode","participant"]);if(g&&b){const _=c(y),C=c(v);_!==void 0&&_===C&&i.push({kind:"message-flow-same-pool",opIndex:d,id:h})}break}case"dataStore.add":{for(const h of p.associations??[]){if([h.source,h.target].filter(g=>g===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const v=h.source===p.dataStore.id?h.target:h.source;l(d,v,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:y}=p.association,v=l(d,h,"source"),g=l(d,y,"target");if(v&&g){const b=new Set([v,g]);b.has("dataStore")&&b.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:y})}break}case"association.add":{const{id:h,source:y,target:v}=p.association,g=l(d,y,"source"),b=l(d,v,"target");g&&b&&g!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${y}->${v}`});break}case"annotation.add":{if(p.association){const{source:h,target:y}=p.association;if(h!==p.annotation.id&&y!==p.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:p.annotation.id});else{const v=h===p.annotation.id?y:h;l(d,v,"association")}}p.placement&&l(d,p.placement.anchor,"anchor");break}case"group.add":{for(const h of p.group.members??[]){const y=l(d,h,"member");y&&Em.has(y)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:y})}break}case"participant.update":{if(f(d,p.id,"participant")===void 0)break;if(p.lanes){const h=t.lanesOf(p.id),y=p.lanes.map(g=>g.id);for(const g of h)y.includes(g)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.id,lane:g});for(const g of y)t.categoryOf(g)!==void 0&&!h.includes(g)&&i.push({kind:"id-duplicate",opIndex:d,id:g});const v=y.filter(g=>h.includes(g));v.length===h.length&&v.some((g,b)=>g!==h[b])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:p.id})}break}case"node.update":{if(f(d,p.id,"flowNode")===void 0)break;if(p.lane!==void 0){const h=t.participantOf(p.id);(h?o.get(h)??t.lanesOf(h):[]).includes(p.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:p.lane,participant:h??""})}break}case"sequenceFlow.update":{if(f(d,p.id,"sequenceFlow")===void 0)break;if(p.name!==void 0&&p.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:p.id}),p.source!==void 0||p.target!==void 0){const h=p.source===void 0||l(d,p.source,"source",["flowNode"])!==void 0,y=p.target===void 0||l(d,p.target,"target",["flowNode"])!==void 0,v=t.endpointsOf(p.id),g=p.source??(v==null?void 0:v.source),b=p.target??(v==null?void 0:v.target);h&&y&&g!==void 0&&b!==void 0&&new Set([c(g),c(b),c(p.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:p.id})}break}case"messageFlow.update":f(d,p.id,"messageFlow");break;case"dataStore.update":f(d,p.id,"dataStore");break;case"annotation.update":{if(f(d,p.id,"annotation")===void 0)break;p.placement&&l(d,p.placement.anchor,"anchor");break}case"group.update":{if(f(d,p.id,"group")===void 0)break;for(const h of p.members??[]){const y=l(d,h,"member");y&&Em.has(y)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:y})}break}case"element.remove":{f(d,p.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:p.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function f(p,d,m){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:p,id:d});return}const h=t.categoryOf(d);if(h===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:"target"});return}if(m&&h!==m){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:m,actual:h});return}return h}}function Cm(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 nc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const ic={"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]},bn=10,MS=300,TS=160,Am=20,Pm=40,kS=10;function qu(e,t,n,i,r){const o=n,a=(I,B)=>{const[z,ce]=ic[I];let ve={x:t.x+t.width/2+z*(t.width/2+o.width/2+B),y:t.y+t.height/2+ce*(t.height/2+o.height/2+B)};const qe=i.x+bn+o.width/2,He=i.x+i.width-bn-o.width/2,st=i.y+bn+o.height/2,X=i.y+i.height-bn-o.height/2,Q={x:Math.min(He,Math.max(qe,ve.x)),y:Math.min(X,Math.max(st,ve.y))};return(Q.x!==ve.x||Q.y!==ve.y)&&(ve=Math.abs(Q.x-(t.x+t.width/2))<(t.width+o.width)/2+bn&&Math.abs(Q.y-(t.y+t.height/2))<(t.height+o.height)/2+bn?{x:t.x+t.width+bn+o.width/2,y:Q.y}:Q),ve},s=(i.children??[]).filter(I=>!("waypoints"in I&&I.waypoints)&&I.type!=="bpmn:Lane"&&I.type!=="label"&&typeof I.x=="number"&&I.id!==r.selfId),c=tt(e),l=I=>{var z,ce;if(!r.selfId)return!1;const B=e.get(I);return!!B&&(((z=B.source)==null?void 0:z.id)===r.selfId||((ce=B.target)==null?void 0:ce.id)===r.selfId)},u=c.edges.filter(I=>!l(I.id)).flatMap(In),f=Io(c).filter(I=>I.owner!==r.selfId).map(I=>I.rect),p=I=>({x0:I.x-o.width/2-bn,x1:I.x+o.width/2+bn,y0:I.y-o.height/2-bn,y1:I.y+o.height/2+bn}),d=I=>{const B=p(I);return s.some(z=>B.x0<z.x+z.width&&B.x1>z.x&&B.y0<z.y+z.height&&B.y1>z.y)},m=I=>{const B=p(I);return u.some(z=>z.axis==="h"?z.at>B.y0&&z.at<B.y1&&z.lo<B.x1&&z.hi>B.x0:z.at>B.x0&&z.at<B.x1&&z.lo<B.y1&&z.hi>B.y0)},h=I=>{const B=p(I);return f.some(z=>B.x0<z.x+z.width&&B.x1>z.x&&B.y0<z.y+z.height&&B.y1>z.y)},y=c.shapes.filter(I=>I.type==="bpmn:Group").flatMap(I=>[{axis:"h",at:I.y,lo:I.x,hi:I.x+I.width},{axis:"h",at:I.y+I.height,lo:I.x,hi:I.x+I.width},{axis:"v",at:I.x,lo:I.y,hi:I.y+I.height},{axis:"v",at:I.x+I.width,lo:I.y,hi:I.y+I.height}]),v=I=>{const B=p(I);return y.some(z=>z.axis==="h"?z.at>B.y0&&z.at<B.y1&&z.lo<B.x1&&z.hi>B.x0:z.at>B.x0&&z.at<B.x1&&z.lo<B.y1&&z.hi>B.y0)},g=I=>d(I)||m(I)||h(I)||v(I),b=I=>I.x-o.width/2>=i.x&&I.x+o.width/2<=i.x+i.width&&I.y-o.height/2>=i.y&&I.y+o.height/2<=i.y+i.height;if(r.placement){const I=He=>He.startsWith("top")?He.replace(/^top/,"bottom"):He.replace(/^bottom/,"top"),B=He=>He.endsWith("left")?He.replace(/left$/,"right"):He.replace(/right$/,"left"),z=r.placement.side,ce=[z,I(z),B(z),I(B(z)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ve=r.placement.offset??50;let qe=a(z,ve);if(g(qe)){const He=new Set;for(const st of ce){if(He.has(st))continue;He.add(st);const X=a(st,ve);if(b(X)&&!g(X)){qe=X;break}}}return qe}const _=r.from,C=i.x+bn+o.width/2,M=i.x+i.width-bn-o.width/2,O=i.y+bn+o.height/2,P=i.y+i.height-bn-o.height/2;let F={x:Math.min(M,Math.max(C,_.x)),y:Math.min(P,Math.max(O,_.y))};if(g(F)){const I=(t.width+o.width)/2+bn,z=[{x:F.x+I,y:F.y},{x:F.x-I,y:F.y},{x:F.x,y:F.y-o.height-bn},{x:F.x,y:F.y+o.height+bn}].filter(b).find(ce=>!g(ce));z&&(F=z)}return F}function Xt(e,t){return e.filter(n=>n.kind===t)}function Mm(e,t){var x0,_0,w0,E0,S0,R0,C0,A0,P0,M0,T0,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:l}=t,u=()=>a.getRootElement(),f=x=>o.get(x),p=x=>{const R=f(x);if(!R)throw new Error(`하강 참조 해소 실패: ${x}`);return R},d=x=>{let R=x.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},m=new Map;for(const x of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))m.set(x.id,{x:x.x,y:x.y});const h=Xt(e,"participant.add"),y=Xt(e,"node.add"),v=Xt(e,"sequenceFlow.add"),g=Xt(e,"messageFlow.add"),b=Xt(e,"dataStore.add"),_=Xt(e,"dataAssociation.add"),C=Xt(e,"annotation.add"),M=Xt(e,"group.add"),O=new Map(y.map(x=>[x.node.id,x])),P=(x,R,A)=>{var j;const T=x.businessObject,L=(((j=T.extensionElements)==null?void 0:j.values)??[]).filter($=>$.$type!==R),D=A?[...L,i.create(R,A)]:L;if(!D.length){T.extensionElements&&n.updateProperties(x,{extensionElements:void 0});return}const N=i.create("bpmn:ExtensionElements",{values:D});D.forEach($=>{$.$parent=N}),n.updateProperties(x,{extensionElements:N})},F=x=>({anchor:x.anchor,side:x.side,...x.offset!==void 0?{offset:x.offset}:{}});for(const x of Xt(e,"element.remove")){const R=f(x.id);R&&n.removeElements([R])}const I=x=>o.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=d(R))==null?void 0:A.id)===x}).sort((R,A)=>R.y-A.y);for(const x of Xt(e,"participant.update")){const R=p(x.id);if(x.name!==void 0&&n.updateProperties(R,{name:x.name??void 0}),!x.lanes)continue;const A=I(x.id);if(!A.length){n.splitLane(R,x.lanes.length),I(x.id).forEach((L,D)=>{const N=x.lanes[D];N&&n.updateProperties(L,{id:N.id,name:N.name})});continue}const T=new Set(A.map(L=>L.id));x.lanes.forEach((L,D)=>{if(T.has(L.id)){n.updateProperties(p(L.id),{name:L.name});return}const N=D===0?n.addLane(I(x.id)[0],"top"):n.addLane(p(x.lanes[D-1].id),"bottom");n.updateProperties(N,{id:L.id,name:L.name})})}const B=150,z=130,ce=80,ve=90,qe=180,He=30,st=30,X=(x,R,A,T,L)=>{const D=A-R.width/2,N=T-R.height/2;return(x.children??[]).find(j=>!("waypoints"in j&&j.waypoints)&&j.type!=="bpmn:Lane"&&j.type!=="label"&&!(L!=null&&L.has(j.id))&&typeof j.x=="number"&&D<j.x+j.width+st&&D+R.width+st>j.x&&N<j.y+j.height&&N+R.height>j.y)},Q=new Set;for(const x of h){Q.add(`pool:${x.participant.id}`);for(const R of x.participant.lanes??[])Q.add(R.id)}const ue=new Map;for(const x of y){const R=x.node.lane??`pool:${x.node.participant??""}`;let A=ue.get(R);A||ue.set(R,A=new Set([0])),x.band!==void 0&&A.add(x.band)}const _e=new Map;for(const[x,R]of ue){if(!Q.has(x))continue;const A=[...R].sort((D,N)=>D-N),T=A.map((D,N)=>N===0?0:N%2===1?Math.ceil(N/2):-(N/2)),L=Math.min(...T);_e.set(x,new Map(A.map((D,N)=>[D,T[N]-L])))}{const x=new Map;for(const R of h)(R.participant.lanes??[]).forEach((A,T)=>x.set(A.id,T));for(const[R,A]of _e){if(!x.has(R)||A.size<2)continue;const T=x.get(R),L=A.get(0)??0,D=new Set;for(const ae of y){if(ae.node.lane!==R||(ae.band??0)!==0||!ae.node.type.endsWith("Gateway"))continue;const ge={in:new Set,out:new Set,cross:new Set};for(const de of v){const Re=de.flow.source===ae.node.id;if(!Re&&de.flow.target!==ae.node.id)continue;const ft=O.get(Re?de.flow.target:de.flow.source);if(!ft||ft.node.participant!==ae.node.participant||!ft.node.lane)continue;let ke,K=!1;if(ft.node.lane!==R){const le=x.get(ft.node.lane);if(le===void 0)continue;ke=le>T?"down":"up",K=!0}else{const le=A.get(ft.band??0)??L;ke=le>L?"down":le<L?"up":void 0}ke&&(ge[Re?"out":"in"].add(ke),K&&ge.cross.add(ke))}for(const de of["up","down"])ge.in.has(de)&&ge.out.has(de)&&ge.cross.has(de)&&D.add(de)}if(D.size!==1)continue;const[N]=D,j=Math.max(...A.values()),$=N==="down"?j:0;if(L===$)continue;const Y=[...A.entries()].filter(([ae])=>ae!==0).sort((ae,ge)=>ae[1]-ge[1]),se=[...Array(j+1).keys()].filter(ae=>ae!==$),be=new Map([[0,$]]);Y.forEach(([ae],ge)=>be.set(ae,se[ge])),_e.set(R,be)}}const q=x=>{var R;return(((R=ue.get(x))==null?void 0:R.size)??0)>1},V=x=>x.band??(x.node.lane||!q(`pool:${x.node.participant??""}`)?void 0:0),ie=new Map,Me=x=>ie.get(x.node.id)??V(x),Rt=new Set,k=new Set;{const x=new Map;for(const T of v)x.set(T.flow.target,(x.get(T.flow.target)??0)+1);const R=T=>{const L=[],D=new Set([T]),N=[T];for(;N.length;){const j=N.shift();L.push(j);for(const $ of v)$.flow.source!==j||D.has($.flow.target)||(x.get($.flow.target)??0)!==1||(D.add($.flow.target),N.push($.flow.target))}return L},A=(T,L)=>{var D;return((D=_e.get(T))==null?void 0:D.get(L))??L};for(const T of y){if(!T.node.type.endsWith("Gateway"))continue;const L=T.node.lane??`pool:${T.node.participant??""}`,D=_e.get(L);if(!D||D.size<2)continue;const N=Me(T);if(N===void 0||A(L,N)!==A(L,0))continue;const j=A(L,N),$=v.filter(de=>de.flow.source===T.node.id).map(de=>O.get(de.flow.target)).filter(de=>!!de&&(de.node.lane??`pool:${de.node.participant??""}`)===L),Y=$.filter(de=>{const Re=Me(de);return Re!==void 0&&A(L,Re)===j&&(x.get(de.node.id)??0)===1}),se=$.some(de=>{const Re=Me(de);return Re!==void 0&&A(L,Re)>j});if(Y.length!==1||!se)continue;const be=new Set($.flatMap(de=>R(de.node.id)));if(!v.some(de=>de.flow.target===T.node.id&&be.has(de.flow.source)))continue;const ge=new Map;for(const[de,Re]of D)ge.set(de,Re+1);ge.set(-1,0),_e.set(L,ge);for(const de of R(Y[0].node.id))O.has(de)&&(ie.set(de,-1),k.add(de));Rt.add(T.node.id)}}const w=(x,R)=>{var A;return((A=_e.get(x))==null?void 0:A.get(R))??R},E=(x,R,A,T)=>{const L=x?f(x):R?f(R):void 0;if(!L)return!1;const D=x?L.y+Math.min(L.height/2,ve):L.y+ce;return Math.abs(D+w(x??`pool:${R??""}`,A)*B-T)<=B/2},G=new Map;for(const[x,R]of ue){let A=0;for(const T of R)A=Math.max(A,w(x,T));G.set(x,A)}const U=x=>qe+B*x,Z=(x,R,A)=>{const T=u().children.filter(L=>!("waypoints"in L&&L.waypoints)&&L.id!==R&&typeof L.y=="number"&&L.y>=x);T.length&&n.moveElements(T,{x:0,y:A})},Ce=(x,R,A)=>{const T=x.type==="bpmn:Participant"?x:void 0;if(!T||T.children.some(j=>j.type==="bpmn:Lane"))return;const L=A+R.height/2+He-T.y;if(T.height>=L)return;const D=L-T.height,N=T.y+T.height;n.resizeShape(T,{x:T.x,y:T.y,width:T.width,height:L}),Z(N,T.id,D)},Ke=(x,R)=>{const A=R-x.height;if(A<=0)return;const T=d(x)??x,L=[],D=$=>{L.push($);for(const Y of $.children??[])D(Y)};D(T);const N=x.y+x.height-10,j=l.calculateAdjustments(L,"y",A,N);l.makeSpace(j.movingShapes,j.resizingShapes,{x:0,y:A},"s",N)},ut=(x,R,A)=>{if(x){const N=p(x),j=U(R);if(N.height>=j)return;const $=j-N.height,Y=d(N),se=Y?Y.y+Y.height:N.y+N.height;Ke(N,j),Z(se,Y==null?void 0:Y.id,$);return}if(!A)return;const T=B*(R+1);if(A.height>=T)return;const L=T-A.height,D=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:T}),Z(D,A.id,L)},Gt=new Map;for(const x of v)Gt.set(x.flow.target,(Gt.get(x.flow.target)??0)+1);const yt=x=>(Gt.get(x)??0)<=1,qt=(x,R,A)=>{if(!x)return!0;const T=f(x);return T?A-R.height/2>=T.y&&A+R.height/2<=T.y+T.height:!0},dn=h.map((x,R)=>({op:x,declared:R}));dn.sort((x,R)=>{const A=x.op.order??Number.POSITIVE_INFINITY,T=R.op.order??Number.POSITIVE_INFINITY;return A!==T?A-T:x.declared-R.declared});let hn=80;for(const x of o.getAll())x.parent===u()&&"height"in x&&typeof x.y=="number"&&(hn=Math.max(hn,x.y+x.height+60));for(const{op:x}of dn){const R=x.participant,A=y.filter(ae=>ae.node.participant===R.id).length,T=((x0=R.lanes)==null?void 0:x0.length)??0,L=Math.max(1200,A*160+300),D=(R.lanes??[]).map(ae=>U(G.get(ae.id)??0)),N=D.reduce((ae,ge)=>ae+ge,0);T&&N<300&&(D[T-1]+=300-N);const j=Math.max(300,B*((G.get(`pool:${R.id}`)??0)+1)),$=R.blackBox||A+T===0?120:T?Math.max(300,N):j,Y=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,...x.order!==void 0?{"bwl:poolOrder":x.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:L,height:$,isExpanded:!0}),se=n.createShape(Y,{x:100+L/2,y:hn+$/2},u()),be=R.lanes??[];if(be.length&&n.splitLane(se,be.length),be.length){const ae=o.filter(ge=>{var de;return ge.type==="bpmn:Lane"&&((de=d(ge))==null?void 0:de.id)===R.id}).sort((ge,de)=>ge.y-de.y);if(ae.forEach((ge,de)=>{const Re=be[de];Re&&n.updateProperties(ge,{id:Re.id,name:Re.name})}),D.some(ge=>ge!==se.height/T)){let ge=se.y;ae.forEach((de,Re)=>{const ft=D[Re];n.resizeShape(de,{x:de.x,y:ge,width:de.width,height:ft}),ge+=ft})}}hn=se.y+se.height+60}const Mt=x=>{var T;const R=O.get(x);if(R)return R.node.participant??"";const A=f(x);return A?A.type==="bpmn:Participant"?A.id:((T=d(A))==null?void 0:T.id)??"":""},Vt=new Map,Dn=x=>{let R=Vt.get(x);return R||Vt.set(x,R={nodes:[],flows:[]}),R};for(const x of y)Dn(x.node.participant??"").nodes.push(x);for(const x of v)Dn(Mt(x.flow.source)).flows.push(x);const Ur=x=>{var R;return i.create("bpmn:SequenceFlow",{id:x.id,name:x.name??((R=x.condition)==null?void 0:R.label)})},ei=(x,R,A)=>r.createShape({type:nc(x.type),businessObject:i.create(nc(x.type),{id:x.id,name:x.name,...R!==void 0?{"bwl:band":R}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),Vi=[...dn.map(({op:x})=>x.participant.id).filter(x=>Vt.has(x)),...[...Vt.keys()].filter(x=>!h.some(R=>R.participant.id===x))],ti=x=>x.endsWith("Gateway");for(const x of Vi){const R=Vt.get(x),A=x?p(x):void 0,T=A?A.x+150:250;let L=A?A.y+80:120;const D=(K,le,re)=>{if(K){const fe=p(K);return fe.y+Math.min(fe.height/2,ve)+w(K,le??0)*B}return le!==void 0&&A?A.y+ce+w(`pool:${x}`,le)*B:re},N=(K,le,re)=>{if(K){const fe=p(K);return fe.y+Math.min(fe.height/2,ve)+le*B}return A?A.y+ce+le*B:re},j=K=>K.participant?p(K.participant):u(),$=(K,le,re,fe,ze,Ge,xt)=>{const $t=re!==void 0||fe!==void 0,he=w(re??`pool:${x}`,fe??0);if((fe===void 0||E(re,x,fe,xt??Number.NaN))&&xt!==void 0&&qt(re,le,xt)&&!X(K,le,ze,xt))return{x:ze,y:xt};if($t)for(let pe=0;pe<4;pe++){const Oe=N(re,he+pe,Ge);if(!X(K,le,ze,Oe))return ut(re,he+pe,A),{x:ze,y:Oe}}const me=D(re,fe,Ge);$t?ut(re,he,A):Ce(K,le,me);let J=ze;for(let pe=0;pe<64;pe++){const Oe=X(K,le,J,me);if(!Oe)break;J=Oe.x+Oe.width+z+le.width/2}return{x:J,y:me}},Y=new Set(R.flows.map(K=>K.flow.target)),se=new Map,be=K=>{if(K===void 0)return;const le=o.get(K);if(!(!le||typeof le.x!="number"||typeof le.width!="number"))return le.x+le.width+z};for(const K of R.nodes){if(Y.has(K.node.id))continue;const le=ei(K.node,K.band,K.afterColumn),re=V(K),fe=K.node.lane?`${K.node.lane}|${re??""}`:re!==void 0?`band:${re}`:"",ze=j(K.node),Ge=se.get(fe)??T,xt=be(K.afterColumn),$t=xt===void 0?Ge:Math.max(Ge,xt),he=$(ze,le,K.node.lane,re,$t,L);n.createShape(le,he,ze),se.set(fe,he.x+le.width+z),!K.node.lane&&re===void 0&&(L+=160)}const ae=new Set,ge=new Map,de=new Map,Re=new Map;if(x&&Q.has(`pool:${x}`)){const K=new Map;for(const he of R.flows)K.set(he.flow.target,(K.get(he.flow.target)??0)+1);const le=he=>D(he.node.lane,Me(he),Number.NaN),re=new Set,fe=he=>{var pe;const me=(pe=O.get(he))==null?void 0:pe.node.participant;if(me)return f(me);const J=f(he);if(J)return J.type==="bpmn:Participant"?J:d(J)},ze=he=>{const me=[],J=new Set([he]),pe=[he];for(;pe.length;){const Oe=pe.shift(),Ye=O.get(Oe);Ye&&me.push(Ye);for(const Pe of R.flows)Pe.flow.source!==Oe||J.has(Pe.flow.target)||(K.get(Pe.flow.target)??0)!==1||(J.add(Pe.flow.target),pe.push(Pe.flow.target))}return me},Ge=he=>{if(!A)return;const me=new Set(he.map(Oe=>Oe.node.id));let J=!1,pe=!1;for(const Oe of g){if(!me.has(Oe.flow.source))continue;const Ye=fe(Oe.flow.target);!Ye||Ye.id===A.id||(Ye.y<A.y?J=!0:pe=!0)}return J&&!pe?"up":pe&&!J?"down":void 0};for(const he of R.nodes){if(!ti(he.node.type))continue;const me=D(he.node.lane,V(he),Number.NaN);if(Number.isNaN(me))continue;const J=[];for(const Pe of R.flows){if(Pe.flow.source!==he.node.id)continue;const $e=O.get(Pe.flow.target);if(!$e||$e.node.lane!==he.node.lane||(K.get($e.node.id)??0)!==1)continue;const Ne=V($e);if(Ne===void 0)continue;const Se=D($e.node.lane,Ne,Number.NaN);if(Number.isNaN(Se))continue;const it=ze($e.node.id),Ae=Ge(it);Ae&&J.push({subtree:it,band:Ne,row:Se,dir:Ae})}if(!J.some(Pe=>Pe.dir==="up")||!J.some(Pe=>Pe.dir==="down")||!J.some(Pe=>Pe.dir==="up"&&J.some($e=>$e.dir==="down"&&$e.row<Pe.row)))continue;const Oe=[...J].sort((Pe,$e)=>Pe.row-$e.row);[...J.filter(Pe=>Pe.dir==="up"),...J.filter(Pe=>Pe.dir==="down")].sort((Pe,$e)=>Pe.dir===$e.dir?Pe.row-$e.row:Pe.dir==="up"?-1:1).forEach((Pe,$e)=>{const Ne=Oe[$e].band;if(Ne!==Pe.band){re.add(he.node.id);for(const Se of Pe.subtree)V(Se)===Pe.band&&ie.set(Se.node.id,Ne)}})}const xt=he=>{if(!A)return;const me=new Set(he.map(Oe=>Oe.node.id));let J=!1,pe=!1;for(const Oe of g){if(!me.has(Oe.flow.target))continue;const Ye=fe(Oe.flow.source);!Ye||Ye.id===A.id||(Ye.y<A.y?J=!0:pe=!0)}return J&&!pe?"up":pe&&!J?"down":void 0};for(const he of R.nodes){if(!ti(he.node.type))continue;const me=he.node.lane??`pool:${x}`,J=_e.get(me);if(!J||J.size<2)continue;const pe=J.get(0);if(pe===void 0)continue;const Oe=Math.max(...J.values()),Ye=pe===Oe&&pe!==0?"down":void 0;if(!Ye)continue;const Pe=[];for(const Ae of R.flows){if(Ae.flow.source!==he.node.id)continue;const vt=O.get(Ae.flow.target);if(!vt||vt.node.lane!==he.node.lane||(K.get(vt.node.id)??0)!==1)continue;const gt=Me(vt);gt!==void 0&&Pe.push({t:vt,subtree:ze(vt.node.id),band:gt})}const $e=Pe.find(Ae=>(J.get(Ae.band)??Ae.band)===pe);if(!$e||xt($e.subtree)===Ye||Ge($e.subtree)===Ye)continue;const Ne=Pe.find(Ae=>Ae!==$e&&xt(Ae.subtree)===Ye);if(!Ne)continue;const Se=$e.band,it=Ne.band;for(const Ae of $e.subtree)Me(Ae)===Se&&ie.set(Ae.node.id,it);for(const Ae of Ne.subtree)Me(Ae)===it&&ie.set(Ae.node.id,Se);re.add(he.node.id)}for(const he of R.nodes){if(!ti(he.node.type))continue;const me=le(he);if(Number.isNaN(me)||C.some(Pe=>{var $e,Ne;return((($e=Pe.placement)==null?void 0:$e.anchor)??(Pe.association?Pe.association.source===Pe.annotation.id?Pe.association.target:Pe.association.source:void 0))===he.node.id&&((Ne=Pe.placement)==null?void 0:Ne.side.startsWith("bottom"))}))continue;let pe,Oe=!1,Ye;for(const Pe of R.flows){if(Pe.flow.source!==he.node.id)continue;const $e=O.get(Pe.flow.target);if(!$e||!$e.node.lane&&V($e)===void 0)continue;const Ne=le($e);Number.isNaN(Ne)||(Math.abs(Ne-me)<.5&&(Oe=!0),Ne>me?!pe||Ne>pe.row?pe={id:$e.node.id,row:Ne,count:1}:Ne===pe.row&&pe.count++:Ne<me&&$e.node.lane===he.node.lane&&(!Ye||Ne>Ye.row?Ye={op:$e,row:Ne,count:1}:Ne===Ye.row&&Ye.count++))}pe&&pe.count===1&&(K.get(pe.id)??0)===1&&!re.has(he.node.id)&&ae.add(pe.id),!Oe&&Ye&&Ye.count===1&&(K.get(Ye.op.node.id)??0)===1&&!Rt.has(he.node.id)&&ge.set(Ye.op.node.id,{lane:he.node.lane,band:Me(he)})}const $t=new Map;for(const he of g)$t.set(he.flow.target,[...$t.get(he.flow.target)??[],he]);for(const he of R.nodes){const me=$t.get(he.node.id);if(!me||me.length!==1||!K.get(he.node.id)||!he.node.lane&&V(he)===void 0||k.has(he.node.id))continue;const J=(_0=O.get(me[0].flow.source))==null?void 0:_0.node.participant,pe=J?f(J):void 0;if(!pe||!A||pe.id===A.id)continue;const Oe=he.node.lane??`pool:${x}`,Ye=_e.get(Oe);if(!Ye)continue;const Pe=Ye.get(0)??0,$e=(Ye.get(Me(he)??0)??Pe)-Pe;if($e===0)continue;const Ne=pe.y<A.y;if(Ne&&$e<0||!Ne&&$e>0)continue;let Se;for(const[it,Ae]of Ye){const vt=Ae-Pe;(Ne&&vt<0&&(!Se||vt<Se.row)||!Ne&&vt>0&&(!Se||vt>Se.row))&&(Se={band:it,row:vt})}Se&&de.set(he.node.id,{lane:he.node.lane,band:Se.band})}}const ft=new Set;let ke=0;for(;ke++<R.nodes.length+2;){for(let re=0;re<R.nodes.length+R.flows.length+2;re++){let fe=!1;for(const ze of R.flows){const Ge=ze.flow;if(ft.has(Ge.id))continue;const xt=f(Ge.source);if(!xt)continue;const $t=f(Ge.target),he=O.get(Ge.target);if(!$t&&he){const me=ei(he.node,he.band),J=Me(he);if(he.node.lane||J!==void 0){const pe=j(he.node),Oe=xt,Ye=Oe.x+(Re.get(Ge.source)??0)+Oe.width+z,Pe=ge.get(Ge.target)??de.get(Ge.target),$e=$(pe,me,Pe?Pe.lane:he.node.lane,Pe?Pe.band:J,ae.has(Ge.target)?Oe.x+Oe.width/2:Ye,Number.NaN,Pe||!yt(Ge.target)?void 0:Oe.y+Oe.height/2),Ne=n.createShape(me,$e,pe);ae.has(Ge.target)&&Re.set(Ge.target,Ye-(Ne.x+Ne.width/2)),n.connect(xt,Ne,{type:"bpmn:SequenceFlow",businessObject:Ur(Ge)})}else s.append(xt,me,{connection:{type:"bpmn:SequenceFlow",businessObject:Ur(Ge)}})}else if($t)n.connect(xt,$t,{type:"bpmn:SequenceFlow",businessObject:Ur(Ge)});else continue;ft.add(Ge.id),fe=!0}if(!fe)break}const K=R.nodes.filter(re=>!f(re.node.id));if(!K.length)break;const le=K[0];{const re=ei(le.node,le.band),fe=j(le.node),ze=V(le);n.createShape(re,$(fe,re,le.node.lane,ze,T,L),fe),!le.node.lane&&ze===void 0&&(L+=160)}}}const Nt=40,Yr=x=>{const R=()=>new Set(Ot(tt(o)).map(Y=>Tt(Y))),A=R(),T=x.waypoints.map(Y=>({x:Y.x,y:Y.y})),L=x.label,D=L&&{x:L.x,y:L.y};n.layoutConnection(x,{waypoints:[]});const N=R(),j=[...N].filter(Y=>!A.has(Y)).length,$=[...A].filter(Y=>!N.has(Y)).length;j<=$||(n.updateWaypoints(x,T),L&&D&&(L.x!==D.x||L.y!==D.y)&&n.moveElements([L],{x:D.x-L.x,y:D.y-L.y}))},Ts=5,gn=10,pt=200,mt=new Set([...v.map(x=>x.flow.id),...g.map(x=>x.flow.id),...Xt(e,"sequenceFlow.update").map(x=>x.id),...Xt(e,"messageFlow.update").map(x=>x.id)].filter(x=>!!x)),oB=(x,R,A,T,L,D)=>{const N=new Set(x.map(K=>K.id)),j=Math.min(...x.map(K=>K.x))+R-gn,$=Math.max(...x.map(K=>K.x+K.width))+R+pt+gn,Y=Math.min(...x.map(K=>K.y+Math.min(0,...A)))-gn,se=Math.max(...x.map(K=>K.y+K.height+Math.max(0,...A)))+gn,be=o.getAll().filter(K=>{if(K.type!=="bpmn:SequenceFlow"&&K.type!=="bpmn:MessageFlow")return!1;const le=K;return mt.has(le.id)||!le.waypoints||le.waypoints.length<2||[le.source,le.target].some(fe=>!fe||N.has(fe.id)||fe.x>=T)?!1:le.waypoints.some((fe,ze)=>{const Ge=le.waypoints[ze+1];return!!Ge&&Math.max(fe.x,Ge.x)>=j&&Math.min(fe.x,Ge.x)<=$&&Math.max(fe.y,Ge.y)>=Y&&Math.min(fe.y,Ge.y)<=se})});if(!be.length)return 0;const ae=K=>{const le=new Map;for(const re of x)for(const fe of A){const ze={id:re.id,type:re.type,x:re.x+R+K,y:re.y+fe,width:re.width,height:re.height};for(const Ge of be){let xt=1/0;for(let he=0;he+1<Ge.waypoints.length;he++)xt=Math.min(xt,qs(Ge.waypoints[he],Ge.waypoints[he+1],ze));const $t=`${Ge.id}|${re.id}`;le.set($t,Math.min(le.get($t)??1/0,xt))}}return le},ge=[...ae(0)].filter(([,K])=>K<=Ts).map(([K])=>K);if(!ge.length)return 0;let de=0;for(let K=1;K<=pt;K++){const le=ae(K);if([...le.values()].every(re=>re>Ts)&&ge.every(re=>(le.get(re)??1/0)>=gn)){de=K;break}}if(!de)return 0;const Re=Math.min(...x.map(K=>K.x))+R+de,ft=new Set(ge.map(K=>K.slice(0,K.indexOf("|"))));return be.some(K=>K.type==="bpmn:SequenceFlow"&&ft.has(K.id)&&K.waypoints.some((le,re)=>{const fe=K.waypoints[re+1];if(!fe||Math.min(le.y,fe.y)>D||Math.max(le.y,fe.y)<D||le.y===fe.y)return!1;const ze=le.x+(D-le.y)*(fe.x-le.x)/(fe.y-le.y);return ze>L&&ze<Re}))?0:de},vo=(x,R=()=>!0)=>{const A=f(x);if(!A)return[];const T=[A],L=new Set([x]);for(let D=0;D<T.length;D++){const N=T[D].id;for(const j of v){const $=j.flow.target;if(j.flow.source!==N||L.has($)||!O.has($))continue;L.add($);const Y=f($);Y&&R(Y)&&T.push(Y)}}return T},aB=(x,R=()=>!0)=>{const A=f(x);if(!A)return[];const T=[A],L=new Set([x]);for(let D=0;D<T.length;D++){const N=T[D].id;for(const j of v){const $=j.flow.source;if(j.flow.target!==N||L.has($)||!O.has($))continue;L.add($);const Y=f($);Y&&R(Y)&&T.push(Y)}}return T},Wi=30,dr=x=>!("waypoints"in x&&x.waypoints)&&x.type!=="bpmn:Lane"&&x.type!=="label"&&typeof x.x=="number",ks=(x,R)=>{const A=new Set(x.flatMap(N=>N.subtree.map(j=>j.id)));for(const N of x){const j=(N.pool.children??[]).filter(dr).filter(Y=>!A.has(Y.id));if(N.subtree.some(Y=>j.some(se=>Y.x+R<se.x+se.width+Wi&&Y.x+R+Y.width+Wi>se.x&&Y.y<se.y+se.height&&Y.y+Y.height>se.y)))return null}const T=x.map(N=>N.pool.width),L=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));n.moveElements(x.flatMap(N=>N.subtree),{x:R,y:0});const D=x.map(N=>{const $=Math.max(...N.subtree.map(Y=>Y.x+Y.width))+150-(N.pool.x+N.pool.width);return $>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:N.pool.width+$,height:N.pool.height}),$});return()=>{n.moveElements(x.flatMap(N=>N.subtree),{x:-R,y:0}),x.forEach((N,j)=>{D[j]>0&&n.resizeShape(N.pool,{x:N.pool.x,y:N.pool.y,width:T[j],height:N.pool.height})});for(let N=0;N<3;N++){let j=0;for(const $ of L){const Y=$.x-$.label.x,se=$.y-$.label.y;Math.abs(Y)<=.5&&Math.abs(se)<=.5||(n.moveElements([$.label],{x:Y,y:se}),j++)}if(!j)break}}},Zw=x=>{var L,D;const R=new Map,A=new Map;for(const N of o.getAll()){if(N.type!=="bpmn:Participant")continue;const j=N;(j.children??[]).length||(R.set(j.id,j),A.set(j.id,[]))}for(const N of o.getAll()){if(N.type!=="bpmn:MessageFlow")continue;const j=N,$=(L=j.source)==null?void 0:L.id,Y=(D=j.target)==null?void 0:D.id;$&&Y&&A.has($)&&A.get($).push(Y),$&&Y&&A.has(Y)&&A.get(Y).push($)}const T=[];for(const[N,j]of A)j.length&&j.every($=>x.has($))&&T.push(R.get(N));return T},Qw=(x,R)=>{if(!x.length)return null;const A=new Set(x.map(N=>N.id)),T=o.getAll().filter(N=>N.type==="bpmn:Participant"&&!A.has(N.id));if(x.some(N=>T.some(j=>N.x+R<j.x+j.width+Wi&&N.x+R+N.width+Wi>j.x&&N.y<j.y+j.height&&N.y+N.height>j.y)))return null;const D=o.filter(N=>N.type==="label").map(N=>({label:N,x:N.x,y:N.y}));return n.moveElements(x,{x:R,y:0}),()=>{n.moveElements(x,{x:-R,y:0});for(let N=0;N<3;N++){let j=0;for(const $ of D){const Y=$.x-$.label.x,se=$.y-$.label.y;Math.abs(Y)<=.5&&Math.abs(se)<=.5||(n.moveElements([$.label],{x:Y,y:se}),j++)}if(!j)break}}},Jw=()=>{let x=0;for(const R of o.getAll()){if(R.type!=="bpmn:DataInputAssociation"&&R.type!=="bpmn:DataOutputAssociation")continue;const A=R.waypoints??[];for(let T=1;T<A.length;T++)x+=Math.hypot(A[T].x-A[T-1].x,A[T].y-A[T-1].y)}return x},e0=()=>{let x=0;for(const R of o.getAll()){if(R.type!=="bpmn:Association")continue;const A=R.waypoints??[];for(let T=1;T<A.length;T++)x+=Math.hypot(A[T].x-A[T-1].x,A[T].y-A[T-1].y)}return x},sB=x=>{const R=[];for(const A of o.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const T=A;if(x.has(T.id))continue;const D=[...T.incoming??[],...T.outgoing??[]].filter($=>$.type==="bpmn:Association").map($=>$.source===T?$.target:$.source);if(!D.length||D.some($=>$===void 0))continue;const N=$=>{if(!("waypoints"in $&&$.waypoints))return[$.id];const Y=$,se=[Y.source,Y.target];return se.some(be=>!be)?[]:se.map(be=>be.id)},j=D.flatMap($=>N($));j.length&&j.every($=>x.has($))&&R.push(T)}return R},t0=()=>Ot(tt(o)).filter(x=>x.kind==="edge-crosses-shape").length,n0=x=>{const R=(x.children??[]).filter(dr);let A=0;for(let T=0;T<R.length;T++)for(let L=T+1;L<R.length;L++){const D=R[T],N=R[L];D.x<N.x+N.width&&D.x+D.width>N.x&&D.y<N.y+N.height&&D.y+D.height>N.y&&A++}return A},va=()=>{const x=tt(o),R=A=>A.length>=2&&(A.every(T=>Math.abs(T.x-A[0].x)<.01)||A.every(T=>Math.abs(T.y-A[0].y)<.01));return{messages:x.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:x.edges.filter(A=>R(A.waypoints)).length}},cB=x=>{const R=new Map;for(const T of o.getAll()){if(T.type!=="bpmn:MessageFlow")continue;const L=T;if(!L.waypoints||L.waypoints.length!==2)continue;const D=L.source,N=L.target;if(!D||!N)continue;const j=x.has(D.id);if(j===x.has(N.id))continue;const $=j?N:D,Y=d($);if(!Y||x.has($.id))continue;const se=R.get(Y.id);se?$.x<se.minX&&(se.minX=$.x):R.set(Y.id,{pool:Y,minX:$.x})}const A=[];for(const{pool:T,minX:L}of R.values()){const D=(T.children??[]).filter(N=>dr(N)&&!x.has(N.id)&&N.x>=L);D.length&&A.push({subtree:D,pool:T})}return A},i0=new Map;for(const x of Xt(e,"sequenceFlow.update")){if(x.target===void 0)continue;const R=O.get(x.target);if(!R)continue;const A=f(x.target),T=f(x.id);if(!A||!T)continue;const L=x.source!==void 0?f(x.source):T.source,D=T.target;if(!L||!D||D.id===A.id)continue;const N=T.waypoints&&T.waypoints.length>=3&&Math.abs(T.waypoints[0].x-T.waypoints[1].x)<1&&Math.abs(T.waypoints[0].y-T.waypoints[1].y)>1?{x:T.waypoints[0].x,y:T.waypoints[0].y}:void 0,j=N?T.waypoints[1].y:void 0,$=N&&T.label?{x:T.label.x,y:T.label.y}:void 0,Y=$&&T.label&&Math.abs($.y+T.label.height/2-j)<=B/5&&$.x+T.label.width>N.x?$.x+T.label.width+6:void 0,se=(L.outgoing??[]).filter(Se=>Se.type==="bpmn:SequenceFlow"&&Se.id!==T.id&&Se.target&&!mt.has(Se.id)),be=new Set(se.map(Se=>Se.target.id)),ae=Se=>{const it={type:"bpmn:Task",x:Se.x+2,y:Se.y+2,width:Se.width-4,height:Se.height-4};return se.find(Ae=>(Ae.waypoints??[]).some((vt,gt)=>!!Ae.waypoints[gt+1]&&qs(vt,Ae.waypoints[gt+1],it)===0))},ge=vo(x.target),de=new Set(ge.map(Se=>Se.id)),Re=Math.min(...ge.map(Se=>Se.x)),ft=Math.max(...ge.map(Se=>Se.x+Se.width)),ke=L.x+L.width,K=A.y+A.height/2,le=oB(ge,ke+Nt-Re,[0,L.y+L.height/2-K,D.y+D.height/2-K],D.x,ke,L.y+L.height/2),re=ke+Nt+le,fe=(()=>{if(Y===void 0)return 0;const Se=ke+Nt,it=L.y+L.height/2-A.height/2,Ae={x:Se,y:it,width:ft-Re,height:A.height},vt=d(L);return((vt==null?void 0:vt.children)??[]).some(ht=>dr(ht)&&!de.has(ht.id)&&ht.id!==L.id&&ht.id!==D.id&&ht.type!=="bpmn:Group"&&ht.type!=="bpmn:Participant"&&ht.x<Ae.x+Ae.width&&ht.x+ht.width>Ae.x&&ht.y<Ae.y+Ae.height&&ht.y+ht.height>Ae.y)||ae(Ae)?Math.max(0,Y-Se):0})(),ze=ft-Re+Nt*2+le+fe-(D.x-ke);let Ge=[];if(ze>0){const Se=d(A),it=(Se==null?void 0:Se.children)??[],Ae=rt=>rt.type==="bpmn:Lane";Ge=(()=>{const rt=new Set;for(const _t of it)dr(_t)&&!de.has(_t.id)&&_t.id!==L.id&&_t.x>=D.x&&rt.add(_t.id);const Je=[];for(const _t of it){if(_t.type!=="bpmn:DataStoreReference"&&_t.type!=="bpmn:DataObjectReference")continue;const Ve=_t,Sn=[...Ve.incoming??[],...Ve.outgoing??[]].filter(Kt=>Kt.type==="bpmn:DataInputAssociation"||Kt.type==="bpmn:DataOutputAssociation").map(Kt=>Kt.source===Ve?Kt.target:Kt.source);Sn.length&&Sn.every(Kt=>Kt!==void 0&&rt.has(Kt.id))&&Je.push(Ve)}return Je})();const gt=it.filter(rt=>!("waypoints"in rt&&rt.waypoints)&&!Ae(rt)&&!de.has(rt.id)&&rt.id!==L.id&&rt.x>=D.x),ht=Se?[Se,...it.filter(rt=>Ae(rt))]:[];if(gt.length){const rt=new Set(gt.map(Rn=>Rn.id)),Je=cB(rt),_t=new Set(rt);for(const Rn of Je)for(const Cn of Rn.subtree)_t.add(Cn.id);const Ve=sB(_t),Ct=Zw(rt),Sn=new Set(rt);for(const Rn of Je)for(const Cn of Rn.subtree)Sn.add(Cn.id);const Kt=Je.length?Zw(Sn):Ct;n.createSpace(gt,ht,{x:ze,y:0},"e",D.x-1);let wi=!1;if(Je.length){const Rn=va(),Cn=ks(Je,ze);if(Cn){const yn=Kt.length?Qw(Kt,ze):null,Ui=va();Ui.messages>Rn.messages&&Ui.lines>=Rn.lines?wi=!0:(yn==null||yn(),Cn())}}if(!wi){for(const Rn of Je){const Cn=va(),yn=ks([Rn],ze);if(!yn)continue;const Ui=va();(Ui.messages<=Cn.messages||Ui.lines<Cn.lines)&&yn()}if(Ct.length){const Rn=va(),Cn=Qw(Ct,ze);if(Cn){const yn=va();(yn.messages<=Rn.messages||yn.lines<Rn.lines)&&Cn()}}}if(Ve.length){const Rn=()=>new Set(Ot(tt(o)).map(yn=>Tt(yn))),Cn=yn=>{const Ui=e0(),Zd=Rn(),Qd=yn.map(at=>({a:at,x:at.x,y:at.y})),Yi=o.filter(at=>at.type==="label").map(at=>({label:at,x:at.x,y:at.y}));n.moveElements(yn,{x:ze,y:0});const dt=[...Rn()].filter(at=>!Zd.has(at));if(e0()<Ui&&dt.length===0)return!0;for(const{a:at,x:Lt,y:$n}of Qd)(at.x!==Lt||at.y!==$n)&&n.moveElements([at],{x:Lt-at.x,y:$n-at.y});for(const at of Yi){const Lt=at.x-at.label.x,$n=at.y-at.label.y;(Lt!==0||$n!==0)&&n.moveElements([at.label],{x:Lt,y:$n})}return!1};if(!Cn(Ve)&&Ve.length>1)for(const yn of Ve)Cn([yn])}}}const xt=R.node.lane!==void 0?f(R.node.lane):R.node.participant!==void 0?f(R.node.participant):void 0,$t=Se=>{if(!xt)return!0;const it=Se.y+Se.height/2;return it>=xt.y&&it<=xt.y+xt.height},he=!$t(L)&&$t(D)?D:L,me=he.y+he.height/2,J=me-(A.y+A.height/2),pe=R.band!==void 0,Oe=pe?[A]:ge,Ye=(R.band===void 0||E(R.node.lane,R.node.participant,R.band,me))&&yt(x.target)&&Oe.every(Se=>{var it;return qt((it=O.get(Se.id))==null?void 0:it.node.lane,Se,Se.y+Se.height/2+J)}),Pe=Se=>Math.abs(Se.y+Se.height/2-(A.y+A.height/2))<=B/2;if(Ye&&pe){const Se=Math.abs(J)<=B/2?ge.filter(it=>it.id!==A.id&&Pe(it)):[];if(n.moveElements(ge,{x:re-Re,y:0}),n.moveElements([A],{x:0,y:J}),Se.length){const it=()=>new Set(Ot(tt(o)).map(Je=>Tt(Je))),Ae=it(),vt=o.filter(Je=>Je.type==="label").map(Je=>({label:Je,x:Je.x,y:Je.y}));n.moveElements(Se,{x:0,y:J});const gt=it(),ht=[...gt].filter(Je=>!Ae.has(Je)).length,rt=[...Ae].filter(Je=>!gt.has(Je)).length;if(ht>rt){n.moveElements(Se,{x:0,y:-J});for(const Je of vt){const _t=Je.x-Je.label.x,Ve=Je.y-Je.label.y;(_t!==0||Ve!==0)&&n.moveElements([Je.label],{x:_t,y:Ve})}}}}else n.moveElements(ge,{x:re-Re,y:Ye?J:0});const $e=d(A);if(!Ye&&R.node.lane===void 0&&R.band!==void 0&&$e){const Se=$e.y+ce+w(`pool:${R.node.participant??""}`,R.band)*B,it=Se-(A.y+A.height/2);it!==0&&!X($e,A,A.x+A.width/2,Se,de)&&n.moveElements([A],{x:0,y:it})}if($e){const Se=($e.children??[]).filter(gt=>dr(gt)&&!de.has(gt.id)&&gt.type!=="bpmn:Group"&&gt.type!=="bpmn:Participant"),it=(gt,ht,rt,Je,_t)=>gt.x+ht<_t.x+_t.width+Je&&gt.x+ht+gt.width+Je>_t.x&&gt.y+rt<_t.y+_t.height+Je&&gt.y+rt+gt.height+Je>_t.y,Ae=Se.find(gt=>it(A,0,0,0,gt)),vt=Ae?void 0:ae(A);if(Ae||vt){const gt=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],ht=o.getAll().filter(dt=>{if(!gt.includes(dt.type))return!1;const at=dt;return mt.has(at.id)||!at.waypoints||at.waypoints.length<2?!1:![at.source,at.target].some(Lt=>!Lt||de.has(Lt.id))}),rt=(dt,at,Lt)=>{var $n;return qt(($n=O.get(dt.id))==null?void 0:$n.node.lane,dt,dt.y+Lt+dt.height/2)&&dt.x+at>=$e.x&&dt.x+at+dt.width<=$e.x+$e.width&&dt.y+Lt>=$e.y&&dt.y+Lt+dt.height<=$e.y+$e.height},Je=(dt,at)=>ge.every(Lt=>rt(Lt,dt,at)&&!Se.some($n=>it(Lt,dt,at,gn,$n))&&ht.every($n=>{const mu={id:Lt.id,type:Lt.type,x:Lt.x+dt,y:Lt.y+at,width:Lt.width,height:Lt.height};for(let _a=0;_a+1<$n.waypoints.length;_a++)if(qs($n.waypoints[_a],$n.waypoints[_a+1],mu)<gn)return!1;return!0})),_t=A.y+A.height/2,Ve=[j,D.y+D.height/2].filter(dt=>dt!==void 0&&Math.abs(dt-_t)>=1),Ct=Ae&&be.has(Ae.id)?Ae:vt==null?void 0:vt.target,Sn=Ct?Ct.x-A.x:0,Kt=Math.max(...ge.map(dt=>dt.x+dt.width)),wi=[...Sn!==0?[Sn]:[],...le!==0?[-le]:[],0],Rn=Y===void 0?[]:wi.map(dt=>Math.max(dt,Y-A.x)),Cn=dt=>Kt+dt+Nt<=D.x,yn=[...new Set([...Rn,...wi])].filter(Cn),Ui=Ae&&be.has(Ae.id)?[Ae.x+Ae.width+Nt-A.x]:[],Zd=Y===void 0?[]:Ui.map(dt=>Math.max(dt,Y-A.x)),Qd=[...new Set([...Zd,...Ui])].filter(dt=>Cn(dt)&&!yn.includes(dt));let Yi;for(const dt of[yn,Qd]){for(const at of Ve){for(const Lt of dt)if(Je(Lt,at-_t)){Yi={dx:Lt,dy:at-_t};break}if(Yi)break}if(Yi)break}if(Yi){const dt=ln=>{const wo=ln;return[wo.edge,wo.other,...Array.isArray(wo.edges)?wo.edges:[]].some(Ls=>typeof Ls=="string"&&mt.has(Ls))},at=()=>new Set(Ot(tt(o)).filter(ln=>!dt(ln)).map(ln=>Tt(ln))),Lt=at(),$n=o.filter(ln=>ln.type==="label").map(ln=>({label:ln,x:ln.x,y:ln.y}));n.moveElements(ge,{x:Yi.dx,y:Yi.dy});const mu=at(),_a=[...mu].filter(ln=>!Lt.has(ln)).length,_B=[...Lt].filter(ln=>!mu.has(ln)).length;if(_a>_B){n.moveElements(ge,{x:-Yi.dx,y:-Yi.dy});for(const ln of $n){const wo=ln.x-ln.label.x,Ls=ln.y-ln.label.y;(wo!==0||Ls!==0)&&n.moveElements([ln.label],{x:wo,y:Ls})}}else N&&i0.set(T.id,{exit:N,channelY:j,label:$})}}}{const Se=new Set(ge.map(ht=>ht.id)),it=new Set(v.map(ht=>ht.flow.id)),Ae=20,vt=ht=>{const rt=ht.source,Je=ht.target,_t=Math.min(rt.x,Je.x)-Ae,Ve=Math.max(rt.x+rt.width,Je.x+Je.width)+Ae,Ct=Math.min(rt.y,Je.y)-Ae,Sn=Math.max(rt.y+rt.height,Je.y+Je.height)+Ae;return ht.waypoints.some(Kt=>Kt.x<_t||Kt.x>Ve||Kt.y<Ct||Kt.y>Sn)},gt=new Map;for(const ht of ge)for(const rt of[...ht.incoming??[],...ht.outgoing??[]])rt.id!==x.id&&it.has(rt.id)&&!(Se.has(rt.source.id)&&Se.has(rt.target.id))&&gt.set(rt.id,rt);for(const ht of gt.values())vt(ht)&&Yr(ht)}const Ne=Ge.length?d(Ge[0]):void 0;if(Ne){const Se={assoc:Jw(),overlaps:n0(Ne),crosses:t0()},it=Ge.map(Ve=>({st:Ve,x:Ve.x})),Ae=o.filter(Ve=>Ve.type==="label").map(Ve=>({label:Ve,x:Ve.x,y:Ve.y})),vt=Math.min(...Ge.flatMap(Ve=>[...Ve.incoming??[],...Ve.outgoing??[]].filter(Ct=>Ct.type==="bpmn:DataInputAssociation"||Ct.type==="bpmn:DataOutputAssociation").map(Ct=>(Ct.source===Ve?Ct.target:Ct.source).x))),gt=new Set(Ge.map(Ve=>Ve.id)),ht=(Ne.children??[]).filter(dr).filter(Ve=>!gt.has(Ve.id));let rt=vt;for(const Ve of[...Ge].sort((Ct,Sn)=>Ct.x-Sn.x)){let Ct=rt;for(let Sn=0;Sn<100;Sn++){const Kt=ht.find(wi=>Ct<wi.x+wi.width+Wi&&Ct+Ve.width+Wi>wi.x&&Ve.y<wi.y+wi.height&&Ve.y+Ve.height>wi.y);if(!Kt)break;Ct=Kt.x+Kt.width+Wi}Ct!==Ve.x&&n.moveElements([Ve],{x:Ct-Ve.x,y:0}),rt=Ct+Ve.width+Wi}const Je=rt+150-(Ne.x+Ne.width);Je>0&&n.resizeShape(Ne,{x:Ne.x,y:Ne.y,width:Ne.width+Je,height:Ne.height});const _t={assoc:Jw(),overlaps:n0(Ne),crosses:t0()};if(_t.assoc>=Se.assoc||_t.overlaps>Se.overlaps||_t.crosses>Se.crosses){for(const{st:Ve,x:Ct}of it)Ve.x!==Ct&&n.moveElements([Ve],{x:Ct-Ve.x,y:0});Je>0&&n.resizeShape(Ne,{x:Ne.x,y:Ne.y,width:Ne.width-Je,height:Ne.height});for(const Ve of Ae){const Ct=Ve.x-Ve.label.x,Sn=Ve.y-Ve.label.y;(Ct!==0||Sn!==0)&&n.moveElements([Ve.label],{x:Ct,y:Sn})}}}}const r0=(x,R)=>{const A=R.target===x,T=p(R.source),L=p(R.target),D=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(T,L,R.id?{type:D,businessObject:i.create(D,{id:R.id})}:{type:D})},o0=100,a0=x=>{for(const R of h){if(!R.participant.blackBox)continue;const A=f(R.participant.id);if(!A)continue;const T=[];for(const D of g){const N=D.flow.source===R.participant.id?D.flow.target:D.flow.target===R.participant.id?D.flow.source:void 0,j=N?f(N):void 0;j&&typeof j.x=="number"&&j.type!=="bpmn:Participant"&&T.push(j)}if(!T.length)continue;if(!x&&R.order===void 0){const D=(()=>{var j;const N=new Map;for(const $ of T){const Y=d($);if(!Y)continue;const se=N.get(Y.id);se?se.n+=1:N.set(Y.id,{shape:Y,n:1})}return(j=[...N.values()].sort(($,Y)=>Y.n-$.n)[0])==null?void 0:j.shape})();if(D){const N=Y=>Y.reduce((se,be)=>se+be,0)/Y.length,j=N(T.map(Y=>Y.y+Y.height/2))<D.y+D.height/2,$=o.filter(Y=>Y.type==="bpmn:Participant"&&Y.id!==R.participant.id&&Y.id!==D.id).filter(Y=>j?Y.y+Y.height<=D.y+5:Y.y>=D.y+D.height-5);if($.length){const Y=[...$.reduce((re,fe)=>re.set(fe.y,(re.get(fe.y)??0)+1),new Map)].sort((re,fe)=>fe[1]-re[1]||(j?fe[0]-re[0]:re[0]-fe[0]))[0][0],se=Math.min(A.width,MS),be=TS,ae=T.map(re=>re.x+re.width/2),ge=Math.round(N(ae)-se/2),de=Math.max(...ae)+o0,Re=re=>({x:re,width:Math.max(se,de-re)}),ft=$.filter(re=>Math.min(re.y+re.height,Y+be)-Math.max(re.y,Y)>0),ke=re=>{const fe=Re(re);return ft.some(ze=>ze.x<fe.x+fe.width&&fe.x<ze.x+ze.width)},K=re=>{const fe=Re(re);return ae.filter(ze=>ze>=fe.x+10&&ze<=fe.x+fe.width-10).length},le=(()=>{if(!ke(ge))return ge;const re=K(ge);return ft.flatMap(fe=>[fe.x+fe.width+Am,fe.x-Am-se]).map(fe=>Math.round(fe)).filter(fe=>!ke(fe)&&K(fe)>=re).sort((fe,ze)=>Math.abs(fe-ge)-Math.abs(ze-ge))[0]??ge})();if(le!==A.x||Y!==A.y||se!==A.width||be!==A.height){const re=()=>new Set(Ot(tt(o)).map(he=>Tt(he))),fe=re(),ze={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:le,y:Y,width:se,height:be});const Ge=re(),xt=[...Ge].filter(he=>!fe.has(he)).length,$t=[...fe].filter(he=>!Ge.has(he)).length;xt>$t&&n.resizeShape(A,ze)}}}}const L=Math.max(...T.map(D=>D.x+D.width/2))+o0;if(L>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:L-A.x,height:A.height}),!!x)for(const D of g){const N=f(D.flow.id),j=D.flow.source===R.participant.id?D.flow.target:D.flow.target===R.participant.id?D.flow.source:void 0,$=j?f(j):void 0;if(!N||!$||$.type==="bpmn:Participant")continue;const Y=$.x+$.width/2;if(Y<A.x+10||Y>A.x+A.width-10)continue;const se=A.y>$.y,be=se?$.y+$.height:$.y,ae=se?A.y:A.y+A.height,ge=D.flow.source===R.participant.id?[{x:Y,y:ae},{x:Y,y:be}]:[{x:Y,y:be},{x:Y,y:ae}],de=tt(o),Re={...de.edges.find(ft=>ft.id===D.flow.id),waypoints:ge};vn(Re,oi(de)).length||n.updateWaypoints(N,ge)}}};a0(!1);for(const x of g){const R=x.flow;n.connect(p(R.source),p(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const A=new Set([...v.map($=>$.flow.id),...g.map($=>$.flow.id)].filter($=>!!$)),T=o.filter($=>!!$.waypoints),L=($,Y)=>Math.abs(Y.x-$.x)<2?"L":Math.abs(Y.x-($.x+$.width))<2?"R":Math.abs(Y.y-$.y)<2?"T":Math.abs(Y.y-($.y+$.height))<2?"B":void 0,D=new Map,N=($,Y,se)=>{if(!$||!Y||typeof $.x!="number")return;const be=L($,Y);if(!be)return;let ae=D.get($.id);ae||D.set($.id,ae=new Map),ae.set(be,[...ae.get(be)??[],se])};for(const $ of T){const Y=$.waypoints;!Y||Y.length<2||(N($.source,Y[0],{id:$.id,dir:"out"}),N($.target,Y[Y.length-1],{id:$.id,dir:"in"}))}const j=new Set;for(const[$,Y]of D){const se=f($);if(!se||typeof se.x!="number"||![...Y.values()].some(K=>{const le=K.filter(re=>re.dir==="in");return K.length>=3&&le.length>=1&&K.some(re=>re.dir==="out")&&le.some(re=>A.has(re.id))}))continue;const ae=d(se);if(!ae||j.has(ae.id)||(ae.children??[]).some(K=>K.type==="bpmn:Lane"))continue;const ge=(w0=Y.get("T"))!=null&&w0.length?(E0=Y.get("B"))!=null&&E0.length?void 0:"B":"T";if(!ge||(ge==="T"?se.y-ae.y:ae.y+ae.height-(se.y+se.height))>=B)continue;const Re=(ae.children??[]).filter(K=>!("waypoints"in K&&K.waypoints)&&K.type!=="label"&&typeof K.x=="number"),ft=ae.y+ae.height;n.resizeShape(ae,{x:ae.x,y:ae.y,width:ae.width,height:ae.height+B});const ke=u().children.filter(K=>!("waypoints"in K&&K.waypoints)&&K.id!==ae.id&&typeof K.y=="number"&&K.y>=ft);ke.length&&n.moveElements(ke,{x:0,y:B}),ge==="T"&&Re.length&&n.moveElements(Re,{x:0,y:B}),j.add(ae.id)}}const Ud=20,s0=4,lB=2,uB=[10,30,80],ba=()=>{const x=tt(o);return{bad:Ot(x).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:zh(x),straight:x.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},xa=x=>{const R=tt(o),A=R.edges.find(T=>T.id===x);return A?vn(A,oi(R)).length:0},uu=x=>xa(x)>0,pu=x=>tt(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==x&&R.waypoints.length===2).length,pB=(x,R,A)=>ks([{subtree:x,pool:R}],A),c0=(x,R)=>R.bad>x.bad||R.crossings>x.crossings&&R.straight<=x.straight&&R.bad>=x.bad,fu=(x,R)=>c0(x,R)||R.straight<x.straight,du=(x,R,A=()=>!0,T=c0)=>{const L=ba(),D=ks(x,R);if(!D)return!1;const N=ba();return T(L,N)||!A()?(D(),!1):!0},l0=(x,R,A,T=()=>!0)=>du([{subtree:x,pool:R}],A,T),bo=x=>{var R;return!!((R=O.get(x))!=null&&R.node.participant)},Os=new Map;for(const x of g){if(!bo(x.flow.target))continue;const R=Os.get(x.flow.target)??[];R.push(x),Os.set(x.flow.target,R)}const hu=[...Os.keys()],Yd=new Set(v.map(x=>x.flow.target)),u0=x=>dn.findIndex(({op:R})=>R.participant.id===x);hu.sort((x,R)=>{var L,D;const A=Yd.has(x)?1:0,T=Yd.has(R)?1:0;return A!==T?A-T:u0((L=O.get(x))==null?void 0:L.node.participant)-u0((D=O.get(R))==null?void 0:D.node.participant)});const xo=x=>x.x+x.width/2,fB=x=>{const R=new Map;for(const L of o.getAll()){const D=L;if(!D.waypoints||!D.source||!D.target)continue;(R.get(D.source.id)??R.set(D.source.id,[]).get(D.source.id)).push(D.target.id)}const A=new Set([x]),T=[x];for(let L=0;L<T.length;L++)for(const D of R.get(T[L])??[])A.has(D)||(A.add(D),T.push(D));return A},dB=(x,R)=>{const A=fB(R);let T;for(const L of o.getAll()){const D=L;if(D.type!=="bpmn:MessageFlow"||!D.source||!D.target||D.target.id!==x||A.has(D.source.id))continue;const N=D.source;if(typeof N.x!="number"||N.type==="bpmn:Participant")continue;const j=xo(N);(T===void 0||j>T)&&(T=j)}return T},qd=(x,R)=>{const A=f(x.flow.source);if(A)return A.type==="bpmn:Participant"?dB(A.id,R):xo(A)},p0=x=>{let R;for(const A of Os.get(x)??[]){const T=qd(A,x);T!==void 0&&(!R||T>R.cx)&&(R={op:A,cx:T})}return R==null?void 0:R.op},hB=x=>{const R=p0(x),A=f(x),T=R?qd(R,x):void 0;return A&&T!==void 0?T-xo(A):void 0},mB=x=>{const R=hB(x);return R!==void 0&&Math.abs(R)<Ud},f0=(x,R,A,T,L)=>{var D;for(let N=!0;N;){N=!1;for(const j of g){if(j.flow.id===A)continue;const $=R.has(j.flow.source),Y=R.has(j.flow.target);if($===Y||T($?j.flow.source:j.flow.target))continue;const se=$?j.flow.target:j.flow.source;if(L(se)||!bo(se))continue;const be=f(j.flow.id);if(!(be!=null&&be.waypoints)||be.waypoints.length!==2)continue;const ae=f(se),ge=(D=O.get(se))==null?void 0:D.node.participant;if(!ae||!ge)continue;const de=vo(se,Re=>Re.x>=ae.x).filter(Re=>!R.has(Re.id));if(!(!de.length||de.some(Re=>L(Re.id)))){for(const Re of de)R.add(Re.id);x.set(ge,[...x.get(ge)??[],...de]),N=!0}}}return[...x].map(([N,j])=>({subtree:j,pool:p(N)}))},d0=(x,R,A,T,L)=>f0(new Map([[R,[...x]]]),new Set(x.map(D=>D.id)),T,D=>D===A,D=>D===L),Kd=x=>{const R=p0(x);if(!R)return null;const A=f(x),T=f(R.flow.source),L=qd(R,x);if(!A||!T||L===void 0)return null;const D=L-xo(A);if(D>=Ud){const N=O.get(x).node.participant,j=vo(x,$=>$.x>=A.x);return{groups:d0(j,N,x,R.flow.id,R.flow.source),dx:D}}if(-D>=Ud&&bo(R.flow.source)){const N=O.get(R.flow.source).node.participant,j=vo(R.flow.source,$=>$.x>=T.x&&!mB($.id));return{groups:d0(j,N,R.flow.source,R.flow.id,x),dx:-D}}return null},h0=()=>hu.map(x=>({id:x,plan:Kd(x)})).filter(x=>!!x.plan).sort((x,R)=>Math.min(...x.plan.groups.flatMap(A=>A.subtree.map(T=>T.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map(T=>T.x)))).map(x=>x.id);for(let x=0;x<3;x++){const R=ba(),A=[];for(const L of h0()){const D=Kd(L);if(!D)continue;const N=ks(D.groups,D.dx);N&&A.push(N)}if(!A.length)break;if(!fu(R,ba()))continue;for(const L of A.reverse())L();let T=!1;for(const L of h0()){const D=Kd(L);D&&du(D.groups,D.dx,()=>!0,fu)&&(T=!0)}if(!T)break}for(const x of hu){if(Yd.has(x))continue;const R=O.get(x);if(!R||R.node.lane!==void 0)continue;const A=V(R);if(A===void 0)continue;const T=f(x),L=T?d(T):void 0;if(!T||!L)continue;const D=L.y+ce+w(`pool:${R.node.participant??""}`,A)*B,N=D-(T.y+T.height/2);N!==0&&!X(L,T,T.x+T.width/2,D)&&n.moveElements([T],{x:0,y:N})}for(const x of hu.flatMap(R=>Os.get(R)??[])){if(!uu(x.flow.id))continue;const R=f(x.flow.target);if(!R)continue;const A=p(O.get(x.flow.target).node.participant),T=vo(x.flow.target,j=>j.x>=R.x),L=R.width+z,D=xa(x.flow.id),N=pu(x.flow.id);for(let j=1;j<=s0;j++){const $=()=>xa(x.flow.id)<D&&pu(x.flow.id)>=N;if(l0(T,A,L*j,$))break}}for(const x of g){if(!uu(x.flow.id))continue;const R=f(x.flow.source),A=f(x.flow.target);if(!R||!A||R.type==="bpmn:Participant"||A.type==="bpmn:Participant")continue;const T=R.x+R.width/2;if(Math.abs(T-(A.x+A.width/2))>15)continue;const[L,D]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y],N=[...O.values()].map(j=>f(j.node.id)).filter(j=>!!j&&j.id!==R.id&&j.id!==A.id).filter(j=>j.x<=T&&T<=j.x+j.width&&j.y+j.height>L&&j.y<D).sort((j,$)=>j.x-$.x);for(const j of N){const $=(S0=O.get(j.id))==null?void 0:S0.node.participant,Y=$?f($):void 0;if(!Y)continue;const se=[...O.values()].filter(le=>le.node.participant===$).map(le=>le.node.id),be=le=>le.map(re=>f(re)).filter(re=>!!re),ge=[aB(j.id,le=>{var re;return((re=O.get(le.id))==null?void 0:re.node.participant)===$}),be(se)].filter(le=>le.length),de=j.width+z,Re=xa(x.flow.id),ft=pu(x.flow.id),ke=()=>xa(x.flow.id)<Re&&pu(x.flow.id)>=ft;let K=!1;for(const le of ge){for(let re=1;re<=s0;re++)if(l0(le,Y,de*re,ke)){K=!0;break}if(K)break}if(!uu(x.flow.id))break}}for(const x of g){if(!uu(x.flow.id))continue;const R=f(x.flow.id);if(((R0=R==null?void 0:R.waypoints)==null?void 0:R0.length)!==2)continue;const A=f(x.flow.source),T=f(x.flow.target);if(!A||!T||A.type==="bpmn:Participant"||T.type==="bpmn:Participant"||!bo(x.flow.source)||!bo(x.flow.target)||Math.abs(xo(A)-xo(T))>lB)continue;const L=xo(A),D=R.waypoints.map(Re=>Re.y),[N,j]=[Math.min(...D),Math.max(...D)],$=oi(tt(o)).filter(Re=>Re.id!==A.id&&Re.id!==T.id&&Re.x<L&&L<Re.x+Re.width&&N<Re.y+Re.height&&Re.y<j);if(!$.length)continue;const Y=(C0=O.get(x.flow.source))==null?void 0:C0.node.participant,se=(A0=O.get(x.flow.target))==null?void 0:A0.node.participant;if(!Y||!se)continue;const be=new Map;for(const[Re,ft,ke]of[[x.flow.source,A,Y],[x.flow.target,T,se]]){const K=be.get(ke)??[],le=vo(Re,re=>re.x>=ft.x).filter(re=>!K.some(fe=>fe.id===re.id));be.set(ke,[...K,...le])}const ae=new Set([...be.values()].flat().map(Re=>Re.id)),ge=f0(be,ae,x.flow.id,Re=>Re===x.flow.source||Re===x.flow.target,()=>!1),de=Math.max(...$.map(Re=>Re.x+Re.width));for(const Re of uB){const ft=de+Re-L;if(ft<=0)continue;if(du(ge,ft,()=>{var K,le;return xa(x.flow.id)===0&&((le=(K=f(x.flow.id))==null?void 0:K.waypoints)==null?void 0:le.length)===2},fu))break}}{const x=A=>A.y+A.height/2,R=[];for(const A of O.keys()){if(!bo(A))continue;const T=v.filter(N=>N.flow.target===A);if(T.length!==1)continue;const L=f(T[0].flow.source),D=f(A);!L||!D||!O.has(L.id)||Math.abs(x(L)-x(D))>1||D.x-(L.x+L.width)<=z+1||R.push({id:A,pred:L,node:D})}R.sort((A,T)=>A.node.x-T.node.x);for(const{id:A}of R){const T=O.get(A),L=f(A),D=f(v.find(ae=>ae.flow.target===A).flow.source);if(!L||!D)continue;const N=L.x-(D.x+D.width);if(N<=z+1)continue;const j=p(T.node.participant),$=vo(A,ae=>ae.x>=L.x),Y=ba(),se=pB($,j,-(N-z));if(!se)continue;const be=ba();(be.bad>Y.bad||be.crossings>=Y.crossings||be.straight<Y.straight)&&se()}}a0(!0);for(const x of b){const R=x.associations??[],A=R.map(D=>D.source===x.dataStore.id?D.target:D.source).map(f).find(Boolean),T=A?d(A)??u():u(),L=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:hn+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:x.dataStore.id,name:x.dataStore.name})},L,T);for(const D of R)r0(x.dataStore.id,D)}for(const x of _){const A=p(x.association.target).type==="bpmn:DataStoreReference"?x.association.target:x.association.source;r0(A,x.association)}let m0=0;const _o=10,g0=40,gB=(x,R)=>{const A=R.map($=>d($)).filter($=>!!$);for(const $ of A){const Y=_o,se=$.y,be=$.y+$.height,ae=$.x,ge=$.x+$.width;if(Math.abs(x.y-se)<Y){const de=se+Y-x.y;x.y+=de,x.height-=de}if(Math.abs(x.y+x.height-be)<Y&&(x.height=be-Y-x.y),Math.abs(x.x-ae)<Y){const de=ae+Y-x.x;x.x+=de,x.width-=de}Math.abs(x.x+x.width-ge)<Y&&(x.width=ge-Y-x.x)}if(!A.length)return;const T=Math.min(...A.map($=>$.y)),L=Math.max(...A.map($=>$.y+$.height)),D=T-x.y,N=x.y+x.height-L,j=g0-_o;if(D>0!=N>0)if(D>0&&D<j){const $=D+_o;x.y+=$,x.height-=$}else N>0&&N<j&&(x.height-=N+_o)},yB=(x,R)=>{const A=_o,T=30,L=o.filter(D=>D.type==="bpmn:Group"&&D.id!==R);for(const D of L){const N=D.x,j=D.x+D.width,$=D.y,Y=D.y+D.height,se=x.y<Y&&$<x.y+x.height,be=x.x<j&&N<x.x+x.width;if(se){if(Math.abs(x.x-j)<A){const ae=Math.min(j+A-x.x,T);ae>0&&x.width-ae>0&&(x.x+=ae,x.width-=ae)}if(Math.abs(x.x+x.width-N)<A){const ae=Math.min(x.x+x.width-(N-A),T);ae>0&&x.width-ae>0&&(x.width-=ae)}}if(be){if(Math.abs(x.y-Y)<A){const ae=Math.min(Y+A-x.y,T);ae>0&&x.height-ae>0&&(x.y+=ae,x.height-=ae)}if(Math.abs(x.y+x.height-$)<A){const ae=Math.min(x.y+x.height-($-A),T);ae>0&&x.height-ae>0&&(x.height-=ae)}}}},Xd=(x,R)=>{const A=g0,T=Math.min(...x.map($=>$.x))-A,L=Math.min(...x.map($=>$.y))-A,D=Math.max(...x.map($=>$.x+$.width))+A,N=Math.max(...x.map($=>$.y+$.height))+A,j={x:T,y:L,width:D-T,height:N-L};return gB(j,x),yB(j,R),j};for(const x of M){const R=(x.group.members??[]).map(f).filter(L=>!!L);let A;R.length?A=Xd(R,x.group.id):(A={x:300+m0*350,y:40,width:300,height:200},m0++);const T=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:x.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());x.group.name&&n.updateLabel(T,x.group.name),(P0=x.group.members)!=null&&P0.length&&P(T,"bwl:Members",{refs:x.group.members.join(" ")})}{const x=o.filter(L=>!!L.waypoints),R=new Map,A=(L,D)=>{!L||!D||(R.has(L)||R.set(L,new Set),R.get(L).add(D))};for(const L of x){const D=(M0=L.source)==null?void 0:M0.id,N=(T0=L.target)==null?void 0:T0.id;A(D,N),((k0=L.type)!=null&&k0.includes("DataOutputAssociation")||(O0=L.type)!=null&&O0.includes("DataInputAssociation")||L.type==="bpmn:Association")&&A(N,D)}const T=o.filter(L=>L.type==="bpmn:Group");for(const L of T){const N=(((D0=L.businessObject.extensionElements)==null?void 0:D0.values)??[]).find(ke=>ke.$type==="bwl:Members"),j=((N==null?void 0:N.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const $=new Set(j),Y=[...j];for(;Y.length;){const ke=Y.shift();for(const K of R.get(ke)??[])$.has(K)||($.add(K),Y.push(K))}const se=L.x,be=L.x+L.width,ae=L.y,ge=L.y+L.height,de=ke=>v.filter(K=>K.flow.target===ke).length,Re=ke=>{var le;const K=((le=f(ke))==null?void 0:le.type)??"";if(K==="bpmn:StartEvent"&&de(ke)===0)return!1;if(K.endsWith("Gateway")){const re=v.filter(fe=>fe.flow.target===ke).map(fe=>fe.flow.source);if(re.length&&re.every(fe=>{var ze;return((ze=f(fe))==null?void 0:ze.type)==="bpmn:StartEvent"&&de(fe)===0}))return!1}return!0},ft=o.filter(ke=>dr(ke)).filter(ke=>ke.type!=="bpmn:Group"&&ke.type!=="bpmn:Participant"&&ke.type!=="bpmn:TextAnnotation"&&!$.has(ke.id)&&bo(ke.id)&&Re(ke.id)&&ke.x<be&&ke.x+ke.width>se&&ke.y<ge&&ke.y+ke.height>ae);if(ft.length)for(const ke of[-1,1]){const K=ft.filter(me=>(me.x+me.width-se<=be-me.x?-1:1)===ke);if(!K.length)continue;const le=[];for(const me of K){const J=le.find(pe=>pe.some(Oe=>me.y<Oe.y+Oe.height&&me.y+me.height>Oe.y));J?J.push(me):le.push([me])}const re=new Map;for(const me of le){let J=ke<0?se-_o:be+_o;for(const pe of[...me].sort((Oe,Ye)=>ke<0?Ye.x-Oe.x:Oe.x-Ye.x)){const Oe=ke<0?Math.min(pe.x,J-pe.width):Math.max(pe.x,J);J=ke<0?Oe-Wi:Oe+pe.width+Wi,Oe!==pe.x&&Math.sign(Oe-pe.x)===ke&&re.set(pe.id,Oe-pe.x)}}const fe=new Map,ze=me=>fe.get(me)===me||!fe.get(me)?me:ze(fe.get(me));for(const me of K)fe.set(me.id,me.id);for(const me of g){const J=re.has(me.flow.source)?me.flow.source:void 0,pe=re.has(me.flow.target)?me.flow.target:void 0;if(!J||!pe)continue;const Oe=f(me.flow.id);((L0=Oe==null?void 0:Oe.waypoints)==null?void 0:L0.length)===2&&fe.set(ze(J),ze(pe))}const Ge=new Map;for(const me of K){if(!re.has(me.id))continue;const J=ze(me.id);Ge.set(J,[...Ge.get(J)??[],me])}const xt=[...Ge.values()].sort((me,J)=>ke<0?Math.min(...me.map(pe=>pe.x))-Math.min(...J.map(pe=>pe.x)):Math.max(...J.map(pe=>pe.x))-Math.max(...me.map(pe=>pe.x))),$t=[];let he=!0;for(const me of xt){const J=me.map(Ye=>re.get(Ye.id)??0).reduce((Ye,Pe)=>Math.abs(Pe)>Math.abs(Ye)?Pe:Ye,0),pe=new Map;let Oe=!0;for(const Ye of me){const Pe=d(Ye);if(!Pe){Oe=!1;break}pe.has(Pe.id)||pe.set(Pe.id,{subtree:[],pool:Pe}),pe.get(Pe.id).subtree.push(Ye)}Oe&&du([...pe.values()],J,()=>!0,fu)?$t.push({shapes:me,dx:J}):he=!1}if(!he)for(const me of $t.reverse())n.moveElements(me.shapes,{x:-me.dx,y:0})}}}{const x=new Set([...M.map(R=>R.group.id),...Xt(e,"group.update").map(R=>R.id)]);for(const R of o.filter(A=>A.type==="bpmn:Group")){if(x.has(R.id))continue;const T=(((I0=R.businessObject.extensionElements)==null?void 0:I0.values)??[]).find(j=>j.$type==="bwl:Members"),L=((T==null?void 0:T.refs)??"").split(" ").filter(Boolean).map(f).filter(j=>!!j);!L.length||!L.some(j=>{const $=m.get(j.id);return!$||$.x!==j.x||$.y!==j.y})||!L.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,Xd(L,R.id))}}{const R=new Map(Io(tt(o)).map(j=>[j.owner,j.rect])),A=o.filter(j=>!!j.waypoints),T=new Map,L=(j,$)=>{!j||!$||(T.has(j)||T.set(j,new Set),T.get(j).add($))};for(const j of A){const $=(B0=j.source)==null?void 0:B0.id,Y=(N0=j.target)==null?void 0:N0.id;L($,Y),(($0=j.type)!=null&&$0.includes("DataOutputAssociation")||(F0=j.type)!=null&&F0.includes("DataInputAssociation")||j.type==="bpmn:Association")&&L(Y,$)}const D=j=>v.filter($=>$.flow.target===j).length,N=j=>{var Y;const $=((Y=f(j))==null?void 0:Y.type)??"";if($==="bpmn:StartEvent"&&D(j)===0)return!1;if($.endsWith("Gateway")){const se=v.filter(be=>be.flow.target===j).map(be=>be.flow.source);if(se.length&&se.every(be=>{var ae;return((ae=f(be))==null?void 0:ae.type)==="bpmn:StartEvent"&&D(be)===0}))return!1}return!0};for(const j of o.filter($=>$.type==="bpmn:Group")){const Y=(((j0=j.businessObject.extensionElements)==null?void 0:j0.values)??[]).find(J=>J.$type==="bwl:Members"),se=((Y==null?void 0:Y.refs)??"").split(" ").filter(Boolean);if(!se.length)continue;const be=se.map(f).filter(J=>!!J);if(!be.length||!(M.some(J=>J.group.id===j.id)||Xt(e,"group.update").some(J=>J.id===j.id)||be.some(J=>{const pe=m.get(J.id);return!pe||pe.x!==J.x||pe.y!==J.y})))continue;const ge=new Set(se),de=[...se];for(;de.length;){const J=de.shift();for(const pe of T.get(J)??[])ge.has(pe)||(ge.add(pe),de.push(pe))}const Re=j.x,ft=j.x+j.width,ke=j.y,K=j.y+j.height,le=J=>{const pe=R.get(J.id),Oe={x:J.x,y:J.y,width:J.width,height:J.height};return pe?[Oe,{x:pe.x,y:pe.y,width:pe.width,height:pe.height}]:[Oe]},re=be.flatMap(le),fe=Math.min(...re.map(J=>J.x)),ze=Math.max(...re.map(J=>J.x+J.width)),Ge=Math.min(...re.map(J=>J.y)),xt=Math.max(...re.map(J=>J.y+J.height)),$t={L:fe-Re,R:ft-ze,T:Ge-ke,B:K-xt},he=o.filter(J=>dr(J)).filter(J=>J.type!=="bpmn:Group"&&J.type!=="bpmn:Participant"&&J.type!=="bpmn:TextAnnotation"&&!ge.has(J.id)&&N(J.id)&&J.x<ft&&J.x+J.width>Re&&J.y<K&&J.y+J.height>ke);if(!he.length)continue;const me={L:0,R:0,T:0,B:0};for(const J of he){const pe=le(J),Oe=Math.min(...pe.map(Ae=>Ae.x)),Ye=Math.max(...pe.map(Ae=>Ae.x+Ae.width)),Pe=Math.min(...pe.map(Ae=>Ae.y)),$e=Math.max(...pe.map(Ae=>Ae.y+Ae.height)),Ne={L:Ye-Re,R:ft-Oe,T:$e-ke,B:K-Pe},Se=["L","R","T","B"].filter(Ae=>Ne[Ae]<=$t[Ae]+.001);if(!Se.length)continue;const it=Se.reduce((Ae,vt)=>Ne[vt]<Ne[Ae]?vt:Ae,Se[0]);me[it]=Math.max(me[it],Math.min(Ne[it]+10,$t[it]))}!me.L&&!me.R&&!me.T&&!me.B||n.resizeShape(j,{x:j.x+me.L,y:j.y+me.T,width:j.width-me.L-me.R,height:j.height-me.T-me.B})}}const y0=x=>{const R=x.waypoints;if(R!=null&&R.length){const T=R[Math.floor((R.length-1)/2)];return{x:T.x,y:T.y,width:0,height:0}}const A=x;return{x:A.x,y:A.y,width:A.width,height:A.height}};let Ds=0;const v0=12,b0=14,vB=15,bB=300,xB=x=>{const R=x.split(`
7
+ `),A=Math.max(...R.map(D=>Oo(D,v0))),T=Math.max(100,Math.min(bB,Math.ceil(A)+b0)),L=R.reduce((D,N)=>D+Math.max(1,Math.ceil((Oo(N,v0)+b0)/T)),0);return{width:T,height:Math.max(30,L*vB+10)}};for(const x of C){const R=x.association,A=((H0=x.placement)==null?void 0:H0.anchor)??(R?R.source===x.annotation.id?R.target:R.source:void 0),T=A?f(A):void 0,L=T?y0(T):void 0,D=xB(x.annotation.text??"");let N;if(L&&x.placement){const[se,be]=ic[x.placement.side],ae=x.placement.offset??50;N={x:L.x+L.width/2+se*(L.width/2+D.width/2+ae),y:L.y+L.height/2+be*(L.height/2+D.height/2+ae)}}else L?(N={x:L.x+L.width/2+180+Ds%3*260,y:L.y-110-Ds%2*95},Ds++):(N={x:300+Ds*260,y:60},Ds++);const j=T?d(T)??u():u(),$=j;L&&typeof $.x=="number"&&typeof $.width=="number"&&$.type==="bpmn:Participant"&&(N=qu(o,L,D,$,x.placement?{placement:x.placement}:{from:N}));const Y=n.createShape({type:"bpmn:TextAnnotation",width:D.width,height:D.height,businessObject:i.create("bpmn:TextAnnotation",{id:x.annotation.id,text:x.annotation.text})},N,j);if(R){const se=be=>be===x.annotation.id?Y:p(be);n.connect(se(R.source),se(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}x.placement&&P(Y,"bwl:Placement",F(x.placement))}for(const x of Xt(e,"association.add")){const R=x.association;n.connect(p(R.source),p(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const x of Xt(e,"node.update")){let R=p(x.id);if(x.type&&nc(x.type)!==R.type&&(R=c.replaceElement(R,{type:nc(x.type)})),x.name!==void 0&&n.updateProperties(R,{name:x.name??void 0}),x.lane||x.band!==void 0){x.band!==void 0&&n.updateProperties(R,{"bwl:band":x.band});const A=R.y+R.height/2,T=d(R),L=x.lane?p(x.lane):((T==null?void 0:T.children)??[]).find(N=>N.type==="bpmn:Lane"&&A>=N.y&&A<=N.y+N.height);x.band!==void 0&&ut(L==null?void 0:L.id,x.band,T);const D=L?L.y+(x.band===void 0?L.height/2:Math.min(L.height/2,ve)+w(L.id,x.band)*B):x.band!==void 0&&T?T.y+ce+w(`pool:${T.id}`,x.band)*B:void 0;if(D!==void 0){const N=D-A;N!==0&&n.moveElements([R],{x:0,y:N})}}}for(const x of Xt(e,"sequenceFlow.update")){const R=p(x.id);if(x.source!==void 0||x.target!==void 0){const A=R,T=x.source!==void 0?p(x.source):A.source,L=x.target!==void 0?p(x.target):A.target,D=$=>({x:$.x+$.width/2,y:$.y+$.height/2});n.reconnect(A,T,L,[D(T),D(L)]);const N=i0.get(A.id),j=L.y+L.height/2;if(N&&L.x>N.exit.x&&Math.abs(j-N.exit.y)>1){n.updateWaypoints(A,[N.exit,{x:N.exit.x,y:j},{x:L.x,y:j}]);const $=A.label;if($&&N.label){const se=Math.abs(N.label.y+$.height/2-N.channelY)<=B/5&&N.label.x+$.width>N.exit.x,be=N.exit.x+6,ae=L.x-6-$.width,ge=se?ae>=be?{x:Math.max(be,Math.min(N.label.x,ae)),y:N.label.y+(j-N.channelY)}:void 0:N.label;ge&&(ge.x!==$.x||ge.y!==$.y)&&n.moveElements([$],{x:ge.x-$.x,y:ge.y-$.y})}}else Math.abs(j-(T.y+T.height/2))>1&&Yr(A)}x.name!==void 0&&n.updateProperties(R,{name:x.name??void 0}),x.condition!==void 0&&n.updateProperties(R,{name:((z0=x.condition)==null?void 0:z0.label)??void 0})}for(const x of Xt(e,"messageFlow.update"))x.name!==void 0&&n.updateProperties(p(x.id),{name:x.name??void 0});for(const x of Xt(e,"dataStore.update"))x.name!==void 0&&n.updateProperties(p(x.id),{name:x.name??void 0});for(const x of Xt(e,"annotation.update")){const R=p(x.id);if(x.text!==void 0&&n.updateProperties(R,{text:x.text}),x.placement===null)P(R,"bwl:Placement",null);else if(x.placement){const A=p(x.placement.anchor),T=y0(A),L=d(A)??u(),D=typeof L.x=="number"&&typeof L.width=="number"&&L.type==="bpmn:Participant",[N,j]=ic[x.placement.side],$=x.placement.offset??50,Y={x:T.x+T.width/2+N*(T.width/2+R.width/2+$),y:T.y+T.height/2+j*(T.height/2+R.height/2+$)},se=D?qu(o,T,{width:R.width,height:R.height},L,{placement:x.placement,selfId:x.id}):Y;n.moveElements([R],{x:se.x-(R.x+R.width/2),y:se.y-(R.y+R.height/2)}),P(R,"bwl:Placement",F(x.placement))}}for(const x of Xt(e,"group.update")){const R=p(x.id);if(x.name!==void 0&&n.updateLabel(R,x.name??""),x.members){const A=x.members.map(f).filter(T=>!!T);A.length&&n.resizeShape(R,Xd(A,x.id)),P(R,"bwl:Members",{refs:x.members.join(" ")})}}}function Ku(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 OS(e,t,n){var u,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>Ot(p).filter(d=>!t.has(Tt(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=tt(i),c=o(s),l=[...new Set(c.flatMap(Ku))].filter(p=>n.has(p)&&a(p));if(l.length)for(const p of l){const d=i.get(p);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let m=d.parent,h;for(;m;){if(m.type==="bpmn:Participant"){h=m;break}m=m.parent}if(!h){const ve=d.x+d.width/2,qe=d.y+d.height/2;h=i.getAll().find(He=>{if(He.type!=="bpmn:Participant")return!1;const st=He;return typeof st.x=="number"&&typeof st.width=="number"&&ve>=st.x&&ve<=st.x+st.width&&qe>=st.y&&qe<=st.y+st.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const v=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(ve=>ve.$type==="bwl:Placement"),g=[...d.incoming??[],...d.outgoing??[]].find(ve=>ve.type==="bpmn:Association"),b=(v!=null&&v.anchor?i.get(v.anchor):void 0)??(g?((f=g.source)==null?void 0:f.id)===p?g.target:g.source:void 0);if(!b)continue;const _=b.waypoints,C=_!=null&&_.length?{x:_[Math.floor((_.length-1)/2)].x,y:_[Math.floor((_.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},O={x:d.x+d.width/2,y:d.y+d.height/2},P=v==null?void 0:v.side,F=[];P&&P in ic&&F.push(qu(i,C,M,h,{placement:{side:P,offset:(v==null?void 0:v.offset)??null},selfId:p}));for(const[ve,qe]of[[-1,0],[1,0],[0,-1],[0,1]])for(let He=1;He<=kS;He++)F.push({x:O.x+ve*Pm*He,y:O.y+qe*Pm*He});const I={...s,edges:s.edges.filter(ve=>ve.id!==(g==null?void 0:g.id))},B=o(I),z=B.filter(ve=>Ku(ve).includes(p)).length;if(!z)continue;let ce;for(const ve of F){const qe=ve.x-O.x,He=ve.y-O.y;if(!qe&&!He||ve.x-M.width/2<h.x||ve.x+M.width/2>h.x+h.width||ve.y-M.height/2<h.y||ve.y+M.height/2>h.y+h.height)continue;const st={...I,shapes:I.shapes.map(_e=>_e.id===p?{..._e,x:_e.x+qe,y:_e.y+He}:_e)},X=o(st),Q=X.filter(_e=>Ku(_e).includes(p)).length;if(Q>=z||X.length>B.length)continue;const ue=Math.abs(qe)+Math.abs(He);if((!ce||Q<ce.mine||Q===ce.mine&&(X.length<ce.all||X.length===ce.all&&ue<ce.dist))&&(ce={x:ve.x,y:ve.y,mine:Q,all:X.length,dist:ue}),ce.mine===0&&ce.all<B.length)break}ce&&r.moveElements([d],{x:ce.x-O.x,y:ce.y-O.y})}}const DS=60;function LS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>Ot(u).filter(f=>!t.has(Tt(f))),a=u=>u.filter(f=>f.kind==="pool-overlap"),s=new Map(n.shapes.map(u=>[u.id,u])),c=(u,f)=>f.x>=u.x&&f.y>=u.y&&f.x+f.width<=u.x+u.width&&f.y+f.height<=u.y+u.height,l=u=>{if(!s.get(u))return[u];const p=new Set,d=new Set([u]);for(let h=0;h<4;h++){let y=!1;for(const v of n.shapes)v.type!=="bpmn:Group"||p.has(v.id)||[...d].some(g=>{const b=s.get(g);return b&&c(v,b)})&&(p.add(v.id),y=!0);for(const v of n.shapes)v.type!=="bpmn:Participant"||d.has(v.id)||[...p].some(g=>{const b=s.get(g);return b&&c(b,v)})&&(d.add(v.id),y=!0);if(!y)break}const m=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!p.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...p].some(y=>{const v=s.get(y);return v&&c(v,h)})).map(h=>h.id);return[...d,...p,...m]};for(let u=0;u<6;u++){const f=tt(i),p=o(f),d=a(p);if(!d.length)return;const m=new Map(f.shapes.map(_=>[_.id,_]));let h=null;for(const _ of d){if(_.kind!=="pool-overlap")continue;const[C,M]=_.pools,O=m.get(C),P=m.get(M);if(!O||!P)continue;const[F,I]=O.x<=P.x?[O,P]:[P,O];if(_.contained)continue;const B=s.get(F.id),z=s.get(I.id),ce=B&&z?Math.max(z.x-(B.x+B.width),0):DS,ve=F.x+F.width+ce-I.x;if(ve<=0)continue;const qe=l(I.id).filter(He=>i.get(He));qe.length&&(!h||ve>h.dx)&&(h={movers:qe,dx:ve})}if(!h)return;const y=h.movers.map(_=>i.get(_)).filter(_=>!!_&&typeof _.x=="number");if(!y.length)return;const v=p.length,g=d.length;r.moveElements(y,{x:h.dx,y:0});const b=o(tt(i));if(!(a(b).length<g&&b.length<=v)){r.moveElements(y,{x:-h.dx,y:0});return}}}function IS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>Ot(l).filter(u=>!t.has(Tt(u))),a=(l,u)=>u.x>=l.x&&u.y>=l.y&&u.x+u.width<=l.x+l.width&&u.y+u.height<=l.y+l.height,s=l=>({l:Math.min(...l.map(u=>u.x)),t:Math.min(...l.map(u=>u.y)),r:Math.max(...l.map(u=>u.x+u.width)),b:Math.max(...l.map(u=>u.y+u.height))}),c=n.shapes.filter(l=>{var u;return l.type==="bpmn:Group"&&!((u=l.members)!=null&&u.length)});if(c.length)for(const l of c){const u=i.get(l.id);if(!u||typeof u.x!="number")continue;const f=n.shapes.filter(M=>M.id!==l.id&&M.type!=="bpmn:Group"&&a(l,M));if(!f.length)continue;const p=f.map(M=>i.get(M.id)).filter(M=>!!M&&typeof M.x=="number");if(p.length!==f.length)continue;const d=s(f),m=s(p),h=m.l+(l.x-d.l),y=m.t+(l.y-d.t),v=m.r+(l.x+l.width-d.r),g=m.b+(l.y+l.height-d.b),b={x:h,y,width:v-h,height:g-y};if(b.width<=0||b.height<=0||Math.abs(b.x-u.x)<1&&Math.abs(b.y-u.y)<1&&Math.abs(b.width-u.width)<1&&Math.abs(b.height-u.height)<1)continue;const _=o(tt(i)).length,C={x:u.x,y:u.y,width:u.width,height:u.height};r.resizeShape(u,b),o(tt(i)).length>_&&r.resizeShape(u,C)}}function Tm(e,t,n=Mm){const i=Cm(e),r=Rm(t,Zh(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=tt(i.elementRegistry),s=new Set(Ot(a).map(Tt)),c=new Set(a.edges.map(g=>g.id)),l=new Set(a.shapes.map(g=>g.id)),u=Ks(a),f=u.length,p=new Set(u.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{rh(m,()=>{n(t,i),LS(i,s,a),IS(i,s,a),rm(i,c);const g=Gu(i,s);tm(i,p,c),hm(i,s,c),sm(i,c),bS(i,c),um(i,s,c),ES(i,s,c),bm(i,s,c),vm(i,c),_m(i,l),OS(i,s,l),Gu(i,s,g),wm(i,s),ym(i,d)})}catch(g){return{ok:!1,issues:[{kind:"lower-failed",message:g instanceof Error?g.message:String(g)}],findings:[],stats:o}}const h=tt(i.elementRegistry),y=Ot(h).filter(g=>!s.has(Tt(g))),v=Gh(h);return{ok:!0,issues:[],findings:y,stats:{edgeCrossings:{before:f,after:v.pairs.length,pairs:v.pairs,solidPairs:v.solidPairs,dashedPairs:v.dashedPairs,mixedPairs:v.mixedPairs,crossPoolMessages:v.crossPoolMessages}}}}function BS(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function km(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Om(e,t){const n=km(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Dm(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function NS(e){return typeof e=="string"&&yu.includes(e)}function Si(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Lm(e){const t=e.rootElements??[],n=t.find(X=>X.$type==="bpmn:Collaboration"),i=new Map(t.filter(X=>X.$type==="bpmn:Process").map(X=>[X.id,X])),r=[],o=[],a=[],s=[],c=[],l=[],u={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],p=[],d=[],m=[],h=[],y=[],v=[],g=new Set,b=new Set,_=X=>{X&&g.add(X)},C=X=>{g.add(X),b.add(X)},M=X=>{const Q=Dm(X,"bwl:Placement");if(!Q)return;const ue=typeof Q.anchor=="string"?Q.anchor:void 0;if(!ue||!NS(Q.side))return;const _e=typeof Q.offset=="number"?Q.offset:void 0;h.push({owner:X.id,anchor:ue,side:Q.side,..._e!==void 0?{offset:_e}:{}})},O=X=>{const Q=Dm(X,"bwl:Members"),ue=typeof(Q==null?void 0:Q.refs)=="string"?Q.refs.split(/\s+/).filter(Boolean):[];ue.length&&v.push({owner:X.id,refs:ue})},P=X=>{var Q;for(const ue of X)switch(_(ue.id),ue.$type){case"bpmn:TextAnnotation":C(ue.id),s.push({id:ue.id,text:typeof ue.text=="string"?ue.text:""}),M(ue);break;case"bpmn:Association":d.push({id:ue.id,type:ue.$type,source:Si(ue.sourceRef),target:Si(ue.targetRef)});break;case"bpmn:Group":{C(ue.id);const _e=(Q=ue.categoryValueRef)==null?void 0:Q.value;c.push({id:ue.id,...typeof _e=="string"&&_e?{name:_e}:{}}),O(ue);break}default:l.push({id:ue.id,type:ue.$type,reason:"type-outside-mvp"})}},F=X=>{for(const Q of X.flowElements??[])_(Q.id),l.push({id:Q.id,type:Q.$type,reason:"inside-container"}),(Q.flowElements??[]).length&&F(Q);for(const Q of X.artifacts??[])_(Q.id),l.push({id:Q.id,type:Q.$type,reason:"inside-container"})},I=(X,Q)=>{const ue=X.flowElements??[],_e=(X.laneSets??[]).flatMap(V=>V.lanes??[]),q=new Map;for(const V of _e){_(V.id);for(const ie of V.flowNodeRef??[]){const Me=Si(ie);Me&&q.set(Me,V.id)}}for(const V of ue){if(_(V.id),V.$type==="bpmn:SequenceFlow"){f.push({id:V.id,source:Si(V.sourceRef),target:Si(V.targetRef),...typeof V.name=="string"&&V.name?{name:V.name}:{}});continue}if(V.$type==="bpmn:DataStoreReference"){C(V.id),a.push({id:V.id,...V.name?{name:V.name}:{}});continue}const ie=BS(V.$type);if(!Jd(ie)){l.push({id:V.id,type:V.$type,reason:"type-outside-mvp"});continue}C(V.id);const Me=ie==="boundaryEvent"?Si(V.attachedToRef):void 0;o.push({id:V.id,type:ie,...V.name?{name:V.name}:{},...Q?{participant:Q}:{},...q.has(V.id)?{lane:q.get(V.id)}:{},...Me?{attachedTo:Me}:{}}),ie==="subProcess"&&F(V);const Rt=Om(V,"bwl:band");Rt!==void 0&&(u.bands[V.id]=Rt);const k=km(V,"bwl:afterColumn");typeof k=="string"&&k!==""&&y.push([V.id,k]);for(const w of V.dataOutputAssociations??[])_(w.id),m.push({id:w.id,type:w.$type,source:V.id,target:Si(w.targetRef)});for(const w of V.dataInputAssociations??[])_(w.id),m.push({id:w.id,type:w.$type,source:Si((w.sourceRef??[])[0]),target:V.id})}P(X.artifacts??[])};if(n){const X=new Set;for(const Q of n.participants??[]){C(Q.id);const ue=Si(Q.processRef);ue&&X.add(ue);const _e=ue?i.get(ue):void 0,q=((_e==null?void 0:_e.laneSets)??[]).flatMap(Rt=>Rt.lanes??[]),V=q.map(Rt=>({id:Rt.id,...Rt.name?{name:Rt.name}:{}}));for(const Rt of V)C(Rt.id);const ie=!_e||(_e.flowElements??[]).length===0&&q.length===0&&(_e.artifacts??[]).length===0;r.push({id:Q.id,...Q.name?{name:Q.name}:{},...ie?{blackBox:!0}:{},...V.length?{lanes:V}:{}});const Me=Om(Q,"bwl:poolOrder");Me!==void 0&&(u.poolOrders[Q.id]=Me),_e&&I(_e,Q.id)}for(const Q of n.messageFlows??[])_(Q.id),p.push({id:Q.id,source:Si(Q.sourceRef),target:Si(Q.targetRef),...typeof Q.name=="string"&&Q.name?{name:Q.name}:{}});P(n.artifacts??[]);for(const[Q,ue]of i)!X.has(Q)&&(ue.flowElements??[]).length>0&&l.push({id:Q,type:ue.$type,reason:"unreachable-process"})}else for(const X of i.values())I(X);const B=[],z=[],ce=[],ve=[],qe=(X,Q)=>!!X&&!!Q&&b.has(X)&&b.has(Q);for(const X of f){if(!qe(X.source,X.target)){l.push({id:X.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}B.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),b.add(X.id)}for(const X of p){if(!qe(X.source,X.target)){l.push({id:X.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}z.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),b.add(X.id)}for(const X of m){if(!qe(X.source,X.target)){l.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}ve.push({...X.id?{id:X.id}:{},source:X.source,target:X.target}),X.id&&b.add(X.id)}for(const X of d){if(!qe(X.source,X.target)){l.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}ce.push({...X.id?{id:X.id}:{},source:X.source,target:X.target})}const He=new Map(c.map(X=>[X.id,X]));for(const{owner:X,refs:Q}of v){const ue=Q.filter(q=>g.has(q)),_e=He.get(X);_e&&ue.length&&(_e.members=ue)}for(const X of h)g.has(X.anchor)&&(u.placements[X.owner]={anchor:X.anchor,side:X.side,...X.offset!==void 0?{offset:X.offset}:{}});for(const[X,Q]of y)g.has(Q)&&(u.afterColumns[X]=Q);return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:B,...z.length?{messageFlows:z}:{},...a.length?{dataStores:a}:{},...ve.length?{dataAssociations:ve}:{},...s.length?{annotations:s}:{},...ce.length?{associations:ce}:{},...c.length?{groups:c}:{}},hints:u,omitted:l}}async function $S(e){const{definitions:t,warnings:n}=await To(e);return{...Lm(t),warnings:n}}const FS=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function Xu(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function jS(e){return Xu(e.processRef)!==void 0}function HS(e){const t=new Set,n=r=>{const o=Xu(r);o&&t.add(o)},i=r=>{for(const o of r.flowElements??[]){n(o.sourceRef),n(o.targetRef),o.attachedToRef&&(n(o.attachedToRef),t.add(o.id));for(const a of o.dataOutputAssociations??[])t.add(o.id),n(a.targetRef);for(const a of o.dataInputAssociations??[]){t.add(o.id);for(const s of a.sourceRef??[])n(s)}(o.flowElements??[]).length&&i(o)}for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)};for(const r of e.rootElements??[])if(r.$type==="bpmn:Process")i(r);else if(r.$type==="bpmn:Collaboration"){for(const o of r.messageFlows??[])n(o.sourceRef),n(o.targetRef);for(const o of r.artifacts??[])n(o.sourceRef),n(o.targetRef)}return t}function zS(e){const t=[],n=i=>{for(const r of i.flowElements??[])FS.has(r.$type)&&t.push(r),(r.flowElements??[]).length&&n(r)};for(const i of e.rootElements??[])i.$type==="bpmn:Process"&&n(i);return t}function GS(e){if(!e)return!0;const t=(e.laneSets??[]).flatMap(n=>n.lanes??[]);return(e.flowElements??[]).length===0&&t.length===0&&(e.artifacts??[]).length===0}function Zu(e){const t=[],n=e.rootElements??[],i=HS(e);for(const o of zS(e))i.has(o.id)||t.push({ruleId:"CHK-FLOW-1",severity:"warning",targetKind:"flowNode",targetRefs:[o.id],params:{type:o.$type}});const r=n.find(o=>o.$type==="bpmn:Collaboration");if(r){const o=new Map(n.filter(s=>s.$type==="bpmn:Process").map(s=>[s.id,s])),a=[];for(const s of r.participants??[])jS(s)&&GS(o.get(Xu(s.processRef)))&&a.push(s.id);a.length&&t.push({ruleId:"CHK-POOL-1",severity:"info",targetKind:"participant",targetRefs:a,params:{count:a.length}})}return t}async function VS(e){const{definitions:t,warnings:n}=await To(e);return{issues:Zu(t),warnings:n}}const WS=.5,US=8,YS=new Set(["bpmn:Definitions","bpmn:Collaboration","bpmn:Process","bpmn:LaneSet","bpmn:ExtensionElements","bpmn:Documentation","bpmn:Relationship","bpmn:Property","bpmn:Category","bpmn:CategoryValue"]),$o=e=>typeof e=="number"?e:Number(e??NaN),rc=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function qS(e){const t=e,n=[],i=typeof t.name=="string"?t.name:typeof t.text=="string"?t.text:"";n.push(`n=${i.replace(/\s+/g," ").trim()}`);for(const o of["sourceRef","targetRef","attachedToRef","processRef","default"])t[o]!==void 0&&n.push(`${o}=${rc(t[o])}`);if(String(e.$type)==="bpmn:Group"){const o=t.categoryValueRef,a=Array.isArray(o)?o:o==null?[]:[o];n.push(`cat=[${a.map(s=>`${rc(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(rc).sort().join(",")}]`);const r=t.conditionExpression;return r&&typeof r.body=="string"&&n.push(`cond=${r.body}`),n.join("|")}function KS(e){const t=new Map,n=new Map,i=(a,s)=>{a&&t.set(a,[...t.get(a)??[],...s])},r=a=>{const s=a;return s?[$o(s.x),$o(s.y),$o(s.width),$o(s.height)]:[]},o=a=>{if(Array.isArray(a))return a.forEach(o);if(!a||typeof a!="object")return;const s=a,c=String(s.$type??"");if(c==="bpmndi:BPMNShape"||c==="bpmndi:BPMNEdge"){const l=rc(s.bpmnElement);if(c==="bpmndi:BPMNShape")i(l,r(s.bounds));else{const f=Array.isArray(s.waypoint)?s.waypoint:[];i(l,f.flatMap(p=>[$o(p.x),$o(p.y)]))}const u=s.label;u!=null&&u.bounds&&l&&n.set(l,r(u.bounds).slice(0,2));return}for(const l of Object.values(s))(Array.isArray(l)||l&&typeof l=="object"&&"$type"in l)&&o(l)};return o(e.diagrams),{body:t,labels:n}}function Im(e){const t=KS(e),n=new Map,i=new Set,r=o=>{if(Array.isArray(o))return o.forEach(r);if(!o||typeof o!="object"||i.has(o))return;i.add(o);const a=o,s=String(a.$type??"");if(s.startsWith("bpmndi:")||s.startsWith("dc:")||s.startsWith("di:"))return;const c=typeof a.id=="string"?a.id:"";c&&s.startsWith("bpmn:")&&!YS.has(s)&&n.set(c,{type:s,props:qS(a),geometry:(t.body.get(c)??[]).join(","),label:(t.labels.get(c)??[]).join(",")});for(const l of Object.values(a))(Array.isArray(l)||l&&typeof l=="object")&&r(l)};return r(e),n}function Bm(e,t,n){if(e===t)return!1;const i=e===""?[]:e.split(",").map(Number),r=t===""?[]:t.split(",").map(Number);return i.length!==r.length?!0:i.some((o,a)=>Math.abs(o-r[a])>n)}function Nm(e,t,n={}){const i=n.moveTolerance??WS,r=Im(e),o=Im(t),a=[],s=[],c=[];for(const[l,u]of o){const f=r.get(l);if(!f){a.push(l);continue}(f.type!==u.type||f.props!==u.props||Bm(f.geometry,u.geometry,i)||Bm(f.label,u.label,n.labelTolerance??US))&&c.push(l)}for(const l of r.keys())o.has(l)||s.push(l);return{added:a.sort(),removed:s.sort(),modified:c.sort()}}async function XS(e,t,n={}){const[i,r]=await Promise.all([To(e),To(t)]);return{...Nm(i.definitions,r.definitions,n),warnings:[...i.warnings,...r.warnings]}}function ZS(e){return new Set([...e.added,...e.modified])}function QS(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function $m(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Tm(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 JS=Symbol("bpmn-editor"),Qu={geometry:[],semantic:[]};function eR(){const e=ye.ref(!1),t=ye.ref(!0),n=ye.ref(!1),i=ye.shallowRef(Qu),r=ye.shallowRef(void 0);let o,a;const s=()=>{if(!o){i.value=Qu;return}const p=Ot(tt(o.get("elementRegistry"))),d=o.getDefinitions();i.value={geometry:p,semantic:d?Zu(d):[]}},c=()=>{e.value=!0,s()};function l(p,d){p.get("canvas").getContainer().style.pointerEvents=d?"":"none";const m=p.get("keyboard");d?(a&&m.bind(a),a=void 0):a||(a=m.getBinding(),m.unbind())}function u(){if(!o)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return o}function f(){return o==null?void 0:o.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,issues:i,revalidate:s,changeScope:r,setChangeScope(p){r.value=p===void 0?void 0:new Set(p)},requestFocus(p){if(!o)return;const d=o.get("elementRegistry").get(p);d&&(o.get("canvas").scrollToElement(d,180),o.get("selection").select(d))},describeElement(p){const d=o==null?void 0:o.get("elementRegistry").get(p),m=d==null?void 0:d.businessObject;if(!m)return;const h=typeof m.name=="string"&&m.name.trim()!==""?m.name:m.text;return{name:typeof h=="string"&&h.trim()!==""?h.trim():void 0,type:typeof m.$type=="string"?m.$type:""}},attach(p){o&&this.detach(),o=p,o.get("eventBus").on("commandStack.changed",c),t.value||l(o,!1),s()},detach(){o==null||o.get("eventBus").off("commandStack.changed",c),o&&!t.value&&l(o,!0),a=void 0,o=void 0,i.value=Qu,r.value=void 0},setEditable(p){t.value=p,o&&l(o,p)},async applyAgentBatch(p,d){const m=u();n.value=!0;try{const h=await $m(m,p,{currentVersion:d});return h.status==="applied"&&(e.value=!1),h}finally{n.value=!1}},async importXml(p){const{warnings:d}=await u().importXML(p);return e.value=!1,r.value=void 0,s(),{warnings:Lu(d)}},async saveXml(){const{xml:p}=await u().saveXML({format:!0});return e.value=!1,p??""},undo:()=>{var p;return(p=f())==null?void 0:p.undo()},redo:()=>{var p;return(p=f())==null?void 0:p.redo()},canUndo:()=>{var p;return((p=f())==null?void 0:p.canUndo())??!1},canRedo:()=>{var p;return((p=f())==null?void 0:p.canRedo())??!1}}}function we(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function tR(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ju={exports:{}},Fm;function nR(){if(Fm)return Ju.exports;Fm=1;var e=Ju.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 l=parseInt(a,n);return l!==1/0&&l>=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},Ju.exports}var iR=nR(),rR=tR(iR);function ki(e){if(!(this instanceof ki))return new ki(e);e=e||[128,36,1],this._seed=e.length?rR.rack(e[0],e[1],e[2]):e}ki.prototype.next=function(e){return this._seed(e||!0)},ki.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},ki.prototype.claim=function(e,t){this._seed.set(e,t||!0)},ki.prototype.assigned=function(e){return this._seed.get(e)||!1},ki.prototype.unclaim=function(e){delete this._seed.hats[e]},ki.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const on={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};on.td=on.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],on.option=on.optgroup=[1,'<select multiple="multiple">',"</select>"],on.thead=on.tbody=on.colgroup=on.caption=on.tfoot=[1,"<table>","</table>"],on.polyline=on.ellipse=on.polygon=on.circle=on.text=on.line=on.path=on.rect=on.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function kt(e,t=globalThis.document){var l;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(l=/<([\w:]+)/.exec(e))==null?void 0:l[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const u=t.createElement("html");u.innerHTML=e;const{lastChild:f}=u;return f.remove(),f}let[r,o,a]=Object.hasOwn(on,i)?on[i]:on._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:u}=s;return u.remove(),u}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function oR(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 Bn(e,...t){const n=e.style;return H(t,function(i){i&&H(i,function(r,o){n[o]=r})}),e}function Tn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const aR=Object.prototype.toString;function Bt(e){return new vr(e)}function vr(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}vr.prototype.add=function(e){return this.list.add(e),this},vr.prototype.remove=function(e){return aR.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},vr.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},vr.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},vr.prototype.array=function(){return Array.from(this.list)},vr.prototype.has=vr.prototype.contains=function(e){return this.list.contains(e)};function oc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function eo(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function sR(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ac={},jm;function cR(){if(jm)return ac;jm=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return ac.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},ac.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},ac}var Hm=cR(),lR=sR(Hm),je=oR({__proto__:null,default:lR},[Hm]),zm=["focus","blur"];function uR(e,t,n,i,r){return zm.indexOf(n)!==-1&&(r=!0),je.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=eo(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function pR(e,t,n,i){return zm.indexOf(t)!==-1&&(i=!0),je.unbind(e,t,n,i)}var Un={bind:uR,unbind:pR};function ep(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function bt(e,t){return t=t||document,t.querySelector(e)}function sc(e,t){return t=t||document,t.querySelectorAll(e)}function Oi(e){e.parentNode&&e.parentNode.removeChild(e)}function fR(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function dR(e,t){return t.appendChild(fR(e,t))}function We(e,t){return dR(t,e),e}var tp=2,Gm={"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":tp,"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":tp,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function hR(e,t){return Gm[t]?e.style[t]:e.getAttributeNS(null,t)}function Vm(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Gm[i];r?(r===tp&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function mR(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Vm(e,r,t[r])}function Ee(e,t,n){if(typeof t=="string")if(n!==void 0)Vm(e,t,n);else return hR(e,t);else mR(e,t);return e}const gR=Object.prototype.toString;function ot(e){return new br(e)}function br(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}br.prototype.add=function(e){return this.list.add(e),this},br.prototype.remove=function(e){return gR.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},br.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},br.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},br.prototype.array=function(){return Array.from(this.list)},br.prototype.has=br.prototype.contains=function(e){return this.list.contains(e)};function cc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Wm(e){return e.cloneNode(!0)}var np={svg:"http://www.w3.org/2000/svg"},Um='<svg xmlns="'+np.svg+'"';function yR(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(np.svg)===-1&&(e=Um+e.substring(4)):(e=Um+">"+e+"</svg>",t=!0);var n=vR(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function vR(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=yR(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(np.svg,e),t&&Ee(n,t),n}var ip=null;function Ym(){return ip===null&&(ip=Te("svg")),ip}function qm(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function bR(e,t,n,i,r,o){var a=Ym().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return qm(a,e);case 6:return qm(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Ma(e){return Ym().createSVGTransform()}var Km=/([&<>]{1})/g,xR=/([&<>\n\r"]{1})/g,_R={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function rp(e,t){function n(i,r){return _R[r]||r}return e.replace(t,n)}function Xm(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(rp(e.textContent,Km));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,'="',rp(o.value,xR),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Xm(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",rp(e.nodeValue,Km),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function wR(e){for(var t=e.firstChild,n=[];t;)Xm(t,n),t=t.nextSibling;return n.join("")}function Zm(e,t){return wR(e)}function an(e){var t=e.parentNode;return t&&t.removeChild(e),e}function ER(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function SR(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(ER(e,i))}function Ta(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),SR(n,t)),n.consolidate()}const RR=/^class[ {]/;function CR(e){return RR.test(e.toString())}function op(e){return Array.isArray(e)}function ap(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function lc(...e){e.length===1&&op(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const AR=/constructor\s*[^(]*\(\s*([^)]*)\)/m,PR=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,MR=/\/\*([^*]*)\*\//m;function TR(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(CR(e)?AR:PR);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(MR);return(r&&r[1]||i).trim()})||[]}function Qm(e,t){const n=t||{get:function(b,_){if(i.push(b),_===!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 _=i.join(" -> ");return i.length=0,new Error(_?`${b} (Resolving: ${_})`:b)};function c(b,_){if(!r[b]&&b.includes(".")){const C=b.split(".");let M=c(C.shift());for(;C.length;)M=M[C.shift()];return M}if(ap(o,b))return o[b];if(ap(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,_)}function l(b,_){if(typeof _>"u"&&(_={}),typeof b!="function")if(op(b))b=lc(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const M=(b.$inject||TR(b)).map(O=>ap(_,O)?_[O]:c(O));return{fn:b,dependencies:M}}function u(b){const{fn:_,dependencies:C}=l(b),M=Function.prototype.bind.call(_,null,...C);return new M}function f(b,_,C){const{fn:M,dependencies:O}=l(b,C);return M.apply(_,O)}function p(b){return lc(_=>b.get(_))}function d(b,_){if(_&&_.length){const C=Object.create(null),M=Object.create(null),O=[],P=[],F=[];let I,B,z,ce;for(let ve in r)I=r[ve],_.indexOf(ve)!==-1&&(I[2]==="private"?(B=O.indexOf(I[3]),B===-1?(z=I[3].createChild([],_),ce=p(z),O.push(I[3]),P.push(z),F.push(ce),C[ve]=[ce,ve,"private",z]):C[ve]=[F[B],ve,"private",P[B]]):C[ve]=[I[2],I[1]],M[ve]=!0),(I[2]==="factory"||I[2]==="type")&&I[1].$scope&&_.forEach(qe=>{I[1].$scope.indexOf(qe)!==-1&&(C[ve]=[I[2],I[1]],M[qe]=!0)});_.forEach(ve=>{if(!M[ve])throw new Error('No provider for "'+ve+'". Cannot use provider from the parent!')}),b.unshift(C)}return new Qm(b,a)}const m={factory:f,type:u,value:function(b){return b}};function h(b,_){const C=b.__init__||[];return function(){C.forEach(M=>{typeof M=="string"?_.get(M):_.invoke(M)})}}function y(b){const _=b.__exports__;if(_){const C=b.__modules__,M=Object.keys(b).reduce((B,z)=>(z!=="__exports__"&&z!=="__modules__"&&z!=="__init__"&&z!=="__depends__"&&(B[z]=b[z]),B),Object.create(null)),O=(C||[]).concat(M),P=d(O),F=lc(function(B){return P.get(B)});_.forEach(function(B){r[B]=[F,B,"private",P]});const I=(b.__init__||[]).slice();return I.unshift(function(){P.init()}),b=Object.assign({},b,{__init__:I}),h(b,P)}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 O=M[0],P=M[1];r[C]=[m[O],kR(O,P),O]}),h(b,a)}function v(b,_){return b.indexOf(_)!==-1||(b=(_.__depends__||[]).reduce(v,b),b.indexOf(_)!==-1)?b:b.concat(_)}function g(b){const _=b.reduce(v,[]).map(y);let C=!1;return function(){C||(C=!0,_.forEach(M=>M()))}}this.get=c,this.invoke=f,this.instantiate=u,this.createChild=d,this.init=g(e)}function kR(e,t){return e!=="value"&&op(t)&&(t=lc(t.slice())),t}var OR=1e3;function Zi(e,t){var n=this;t=t||OR,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)})}Zi.prototype.canRender=function(e){},Zi.prototype.drawShape=function(e,t){},Zi.prototype.drawConnection=function(e,t){},Zi.prototype.getShapePath=function(e){},Zi.prototype.getConnectionPath=function(e){};function to(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function DR(e){return["M",e.x,e.y]}function sp(e){return["L",e.x,e.y]}function LR(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function IR(e,t){const n=e.length,i=[DR(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(sp(a));continue}const c=Math.min(t,cp(a.x-o.x,a.y-o.y),cp(s.x-a.x,s.y-a.y));if(!c){i.push(sp(a));continue}const l=uc(a,o,c),u=uc(a,o,c*.5),f=uc(a,s,c),p=uc(a,s,c*.5);i.push(sp(l)),i.push(LR(u,p,f))}return i}function uc(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=cp(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function cp(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ka(e,t,n){Fe(t)&&(n=t,t=null),t||(t={});const i=Te("path",t);return Fe(n)&&(i.dataset.cornerRadius=String(n)),lp(i,e)}function lp(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Ee(e,{d:to(IR(t,n))}),e}function pc(e){var t=new Set(e);return Qe(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function no(e,t,n){n=n||0,Le(e)||(e=[e]),H(e,function(i,r){var o=t(i,r,n);Le(o)&&o.length&&no(o,t,n+1)})}function up(e,t,n){var i=new Set,r=new Set;return no(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 Oa(e,t){return up(e)}function BR(e,t,n){Kr(t)&&(t=!0),un(t)&&(n=t,t=!0),n=n||{};var i=Da(n.allShapes),r=Da(n.allConnections),o=Da(n.enclosedElements),a=Da(n.enclosedConnections),s=Da(n.topLevel,t&&Co(e,function(u){return u.id}));function c(u){s[u.source.id]&&s[u.target.id]&&(s[u.id]=[u]),i[u.source.id]&&i[u.target.id]&&(a[u.id]=o[u.id]=u),r[u.id]=u}function l(u){if(o[u.id]=u,u.waypoints)a[u.id]=r[u.id]=u;else return i[u.id]=u,H(u.incoming,c),H(u.outgoing,c),u.children}return no(e,l),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Zt(e,t){t=!!t,Le(e)||(e=[e]);var n,i,r,o;return H(e,function(a){var s=a;a.waypoints&&!t&&(s=Zt(a.waypoints,!0));var c=s.x,l=s.y,u=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(l<i||i===void 0)&&(i=l),(c+f>r||r===void 0)&&(r=c+f),(l+u>o||o===void 0)&&(o=l+u)}),{x:n,y:i,height:o-i,width:r-n}}function Fo(e,t){var n={};return H(e,function(i){var r=i;r.waypoints&&(r=Zt(r)),!Fe(t.y)&&r.x>t.x&&(n[i.id]=i),!Fe(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Fe(t.width)&&Fe(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Fe(t.width)||!Fe(t.height))&&(n[i.id]=i)}),n}function Jm(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function eg(e){return!!(e&&e.isFrame)}function Da(e,t){return W({},e||{},t||{})}var NR=1;function xr(e,t){Zi.call(this,e,NR),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})}we(xr,Zi),xr.prototype.canRender=function(){return!0},xr.prototype.drawShape=function(t,n,i){var r=Te("rect");return Ee(r,{x:0,y:0,width:n.width||0,height:n.height||0}),eg(n)?Ee(r,W({},this.FRAME_STYLE,i||{})):Ee(r,W({},this.SHAPE_STYLE,i||{})),We(t,r),r},xr.prototype.drawConnection=function(t,n,i){var r=ka(n.waypoints,W({},this.CONNECTION_STYLE,i||{}));return We(t,r),r},xr.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 to(a)},xr.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 to(o)},xr.$inject=["eventBus","styles"];function $R(){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 W(o,{class:n})},this.style=function(n,i){!Le(n)&&!i&&(i=n,n=[]);var r=Vn(n,function(o,a){return W(o,e[a]||{})},{});return i?W(r,i):r},this.computeStyle=function(n,i,r){return Le(i)||(r=i,i=[]),t.style(i||[],W({},r,n||{}))}}const FR={__init__:["defaultRenderer"],defaultRenderer:["type",xr],styles:["type",$R]};function Ut(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Yt(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 pp(e,t){return!e||!t?-1:e.indexOf(t)}function La(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function fp(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=La(e,t);return Math.abs(r/o)<=i}var jR=2;function Qi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(HR(r,n))return o;return!1}function HR(e,t){const n=t[0];return Xr(t,function(i){return Math.abs(n[e]-i[e])<=jR})}function tg(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 dp(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var zR=/,?([a-z]),?/gi,ng=parseFloat,Qt=Math,_r=Qt.PI,Di=Qt.min,Li=Qt.max,ig=Qt.pow,wr=Qt.abs,GR=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,VR=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,rg=Array.isArray||function(e){return e instanceof Array};function WR(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function UR(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 YR(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 WR(r,i)?(UR(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function qR(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(GR,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(VR,function(c,l){l&&a.push(+l)}),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=mp,n}function KR(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 XR(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 hp(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 mp(){return this.join(",").replace(zR,"$1")}function ZR(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=mp,t}function og(e,t,n,i,r,o,a,s,c){var l=1-c,u=ig(l,3),f=ig(l,2),p=c*c,d=p*c,m=u*e+f*3*c*n+l*3*c*c*r+d*a,h=u*t+f*3*c*i+l*3*c*c*o+d*s;return{x:fc(m),y:fc(h)}}function ag(e){var t=iC(...e);return hp(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function Er(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function QR(e,t){return e=hp(e),t=hp(t),Er(t,e.x,e.y)||Er(t,e.x2,e.y)||Er(t,e.x,e.y2)||Er(t,e.x2,e.y2)||Er(e,t.x,t.y)||Er(e,t.x2,t.y)||Er(e,t.x,t.y2)||Er(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 sg(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 cg(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var l=c/2,u=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,m=0;m<u;m++){var h=l*f[m]+l,y=sg(h,e,n,r,a),v=sg(h,t,i,o,s),g=y*y+v*v;d+=p[m]*Qt.sqrt(g)}return l*d}function JR(e,t,n,i,r,o,a,s){if(!(Li(e,n)<Di(r,a)||Di(e,n)>Li(r,a)||Li(t,i)<Di(o,s)||Di(t,i)>Li(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),l=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),u=(e-n)*(o-s)-(t-i)*(r-a);if(u){var f=fc(c/u),p=fc(l/u),d=+f.toFixed(2),m=+p.toFixed(2);if(!(d<+Di(e,n).toFixed(2)||d>+Li(e,n).toFixed(2)||d<+Di(r,a).toFixed(2)||d>+Li(r,a).toFixed(2)||m<+Di(t,i).toFixed(2)||m>+Li(t,i).toFixed(2)||m<+Di(o,s).toFixed(2)||m>+Li(o,s).toFixed(2)))return{x:f,y:p}}}}function fc(e){return Math.round(e*1e11)/1e11}function eC(e,t,n){var i=ag(e),r=ag(t);if(!QR(i,r))return[];var o=cg(...e),a=cg(...t),s=ug(e)?1:~~(o/5)||1,c=ug(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),f={},p=[],d,m;for(d=0;d<s+1;d++){var h=og(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=og(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(m=0;m<c;m++){var y=l[d],v=l[d+1],g=u[m],b=u[m+1],_=wr(v.x-y.x)<.01?"y":"x",C=wr(b.x-g.x)<.01?"y":"x",M=JR(y.x,y.y,v.x,v.y,g.x,g.y,b.x,b.y),O;if(M){if(O=M.x.toFixed(9)+"#"+M.y.toFixed(9),f[O])continue;f[O]=!0;var P=y.t+wr((M[_]-y[_])/(v[_]-y[_]))*(v.t-y.t),F=g.t+wr((M[C]-g[C])/(b[C]-g[C]))*(b.t-g.t);P>=0&&P<=1&&F>=0&&F<=1&&p.push({x:M.x,y:M.y,t1:P,t2:F})}}return p}function lg(e,t,n){e=dg(e),t=dg(t);for(var i,r,o,a,s,c,l,u,f,p,d=n?0:[],m=0,h=e.length;m<h;m++){var y=e[m];if(y[0]=="M")i=s=y[1],r=c=y[2];else{y[0]=="C"?(f=[i,r,...y.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var v=0,g=t.length;v<g;v++){var b=t[v];if(b[0]=="M")o=l=b[1],a=u=b[2];else{b[0]=="C"?(p=[o,a,...b.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,l,u,l,u],o=l,a=u);var _=eC(f,p);{for(var C=0,M=_.length;C<M;C++)_[C].segment1=m,_[C].segment2=v,_[C].bez1=f,_[C].bez2=p;d=d.concat(_)}}}}}return d}function tC(e){return rg(e)&&rg(e[0])}function nC(e){if(KR(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,l,u=a,f=e.length;u<f;u++){if(l=e[u],s=l[0],t[u]=c=new Array(l.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=l[1],c[2]=l[2],c[3]=l[3],c[4]=l[4],c[5]=l[5],c[6]=+l[6]+n,c[7]=+l[7]+i;break;case"V":c[1]=+l[1]+i;break;case"H":c[1]=+l[1]+n;break;case"M":r=+l[1]+n,o=+l[2]+i;default:for(var p=1,d=l.length;p<d;p++)c[p]=+l[p]+(p%2?n:i)}else for(var m=0,h=l.length;m<h;m++)c[m]=l[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=mp,t}function ug(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function dc(e,t,n,i){return[e,t,n,i,n,i]}function pg(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 fg(e,t,n,i,r,o,a,s,c,l){var u=_r*120/180,f=_r/180*(+r||0),p=[],d,m=YR(function(k,w,E){var G=k*Qt.cos(E)-w*Qt.sin(E),U=k*Qt.sin(E)+w*Qt.cos(E);return{x:G,y:U}});if(l)O=l[0],P=l[1],C=l[2],M=l[3];else{d=m(e,t,-f),e=d.x,t=d.y,d=m(s,c,-f),s=d.x,c=d.y;var h=(e-s)/2,y=(t-c)/2,v=h*h/(n*n)+y*y/(i*i);v>1&&(v=Qt.sqrt(v),n=v*n,i=v*i);var g=n*n,b=i*i,_=(o==a?-1:1)*Qt.sqrt(wr((g*b-g*y*y-b*h*h)/(g*y*y+b*h*h))),C=_*n*y/i+(e+s)/2,M=_*-i*h/n+(t+c)/2,O=Qt.asin(((t-M)/i).toFixed(9)),P=Qt.asin(((c-M)/i).toFixed(9));O=e<C?_r-O:O,P=s<C?_r-P:P,O<0&&(O=_r*2+O),P<0&&(P=_r*2+P),a&&O>P&&(O=O-_r*2),!a&&P>O&&(P=P-_r*2)}var F=P-O;if(wr(F)>u){var I=P,B=s,z=c;P=O+u*(a&&P>O?1:-1),s=C+n*Qt.cos(P),c=M+i*Qt.sin(P),p=fg(s,c,n,i,r,0,a,B,z,[P,I,C,M])}F=P-O;var ce=Qt.cos(O),ve=Qt.sin(O),qe=Qt.cos(P),He=Qt.sin(P),st=Qt.tan(F/4),X=4/3*n*st,Q=4/3*i*st,ue=[e,t],_e=[e+X*ve,t-Q*ce],q=[s+X*He,c-Q*qe],V=[s,c];if(_e[0]=2*ue[0]-_e[0],_e[1]=2*ue[1]-_e[1],l)return[_e,q,V].concat(p);p=[_e,q,V].concat(p).join().split(",");for(var ie=[],Me=0,Rt=p.length;Me<Rt;Me++)ie[Me]=Me%2?m(p[Me-1],p[Me],f).y:m(p[Me],p[Me+1],f).x;return ie}function iC(e,t,n,i,r,o,a,s){for(var c=[],l=[[],[]],u,f,p,d,m,h,y,v,g=0;g<2;++g){if(g==0?(f=6*e-12*n+6*r,u=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,u=-3*t+9*i-9*o+3*s,p=3*i-3*t),wr(u)<1e-12){if(wr(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}y=f*f-4*p*u,v=Qt.sqrt(y),!(y<0)&&(m=(-f+v)/(2*u),0<m&&m<1&&c.push(m),h=(-f-v)/(2*u),0<h&&h<1&&c.push(h))}for(var b=c.length,_=b,C;b--;)d=c[b],C=1-d,l[0][b]=C*C*C*e+3*C*C*d*n+3*C*d*d*r+d*d*d*a,l[1][b]=C*C*C*t+3*C*C*d*i+3*C*d*d*o+d*d*d*s;return l[0][_]=e,l[1][_]=t,l[0][_+1]=a,l[1][_+1]=s,l[0].length=l[1].length=_+2,{x0:Di(...l[0]),y0:Di(...l[1]),x1:Li(...l[0]),y1:Li(...l[1])}}function dg(e){if(tC(e)||(e=qR(e)),XR(e))return e;for(var t=ZR(nC(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,m){var h,y;if(!p)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(p[0]in{T:1,Q:1})&&(d.qx=d.qy=null),p[0]){case"M":d.X=p[1],d.Y=p[2];break;case"A":p=["C",...fg(d.x,d.y,...p.slice(1))];break;case"S":m=="C"||m=="S"?(h=d.x*2-d.bx,y=d.y*2-d.by):(h=d.x,y=d.y),p=["C",h,y,...p.slice(1)];break;case"T":m=="Q"||m=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),p=["C",...pg(d.x,d.y,d.qx,d.qy,p[1],p[2])];break;case"Q":d.qx=p[1],d.qy=p[2],p=["C",...pg(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...dc(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...dc(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...dc(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...dc(d.x,d.y,d.X,d.Y)];break}return p},r=function(p,d){if(p[d].length>7){p[d].shift();for(var m=p[d];m.length;)o[d]="A",p.splice(d++,0,["C",...m.splice(0,6)]);p.splice(d,1),l=t.length}},o=[],a="",s="",c=0,l=t.length;c<l;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 u=t[c],f=u.length;n.x=u[f-2],n.y=u[f-1],n.bx=ng(u[f-4])||n.x,n.by=ng(u[f-3])||n.y}return t}function wt(e){return un(e)&&Gn(e,"waypoints")}function Xe(e){return un(e)&&Gn(e,"labelTarget")}function rC(e){return un(e)&&So(e.parent)}function hg(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Ji(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function De(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function hc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function oC(e){return Ji({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function aC(e){for(var t=e.waypoints,n=t.reduce(function(l,u,f){var p=t[f-1];if(p){var d=l[l.length-1],m=d&&d.endLength||0,h=lC(p,u);l.push({start:p,end:u,startLength:m,endLength:m+h,length:h})}return l},[]),i=n.reduce(function(l,u){return l+u.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 Ie(e){return wt(e)?aC(e):oC(e)}function xn(e,t,n){n=n||0,un(n)||(n={x:n,y:n});var i=De(e),r=De(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,l=o?"top":s?"bottom":null,u=c?"left":a?"right":null;return u&&l?l+"-"+u:u||l||"intersect"}function Ia(e,t,n){var i=sC(e,t);return i.length===1||i.length===2&&La(i[0],i[1])<1?Ji(i[0]):i.length>1?(i=Ai(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Ji(i[n?0:i.length-1])):null}function sC(e,t){return lg(e,t)}function cC(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],La(n,r)===0||fp(i,r,n)?e.splice(t,1):t++;return e}function lC(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function mc(e,t){return Math.round(e*t)/t}function mg(e){return Fe(e)?e+"px":e}function uC(e){for(;e.parent;)e=e.parent;return e}function pC(e){e=W({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),Bn(n,{position:"relative",overflow:"hidden",width:mg(e.width),height:mg(e.height)}),t.appendChild(n),n}function gg(e,t,n){const i=Te("g");ot(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const fC="base",yg=0,dC=1,hC={shape:["x","y","width","height"],connection:["waypoints"]};function Be(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||{})}Be.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Be.prototype._init=function(e){const t=this._eventBus,n=this._container=pC(e),i=this._svg=Te("svg");Ee(i,{width:"100%",height:"100%"}),Tn(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")}),We(n,i);const r=this._viewport=gg(i,"viewport");e.deferUpdate&&(this._viewboxChanged=_u(this._viewboxChanged,300)),this._restoreFocus=_u(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)},Be.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},Be.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Be.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=Jm(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Be.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Be.prototype.restoreFocus=function(){this._restoreFocus()},Be.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Be.prototype.isFocused=function(){return this._focused},Be.prototype.getDefaultLayer=function(){return this.getLayer(fC,yg)},Be.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},Be.prototype._getChildIndex=function(e){return Vn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Be.prototype._createLayer=function(e,t){typeof t>"u"&&(t=dC);const n=this._getChildIndex(t);return{group:gg(this._viewport,"layer-"+e,n),index:t,visible:!0}},Be.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},Be.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&&(an(n),t.visible=!1),n},Be.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],an(t.group))},Be.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Be.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(uC(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Be.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Be.prototype._findPlaneForRoot=function(e){return At(this._planes,function(t){return t.rootElement===e})},Be.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Be.prototype._resolveElements=function(e){return Le(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Be.prototype.getContainer=function(){return this._container},Be.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&&(H([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),ot(r).add(t)):(e.markers.delete(t),ot(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Be.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Be.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Be.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Be.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Be.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Be.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,yg);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Be.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},Be.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},Be.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)},Be.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})},Be.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})},Be.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=hC[e];if(!Xr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Be.prototype._setParent=function(e,t,n){Yt(t.children,e,n),e.parent=t},Be.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},Be.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Be.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Be.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),Ut(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Be.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Be.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Be.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Be.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Be.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Be.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,l;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const u=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);Ta(t,u)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=Ta(t),r=a?a.matrix:bR(),s=mc(r.a,1e3),c=mc(-r.e||0,1e3),l=mc(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:l?l/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},Be.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=W({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),vg(t,n)}),{x:n.e,y:n.f}},Be.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=Zt(o),s=De(a),c=this.viewbox(),l=this.zoom();let u,f;c.y+=t.top/l,c.x+=t.left/l,c.width-=(t.right+t.left)/l,c.height-=(t.bottom+t.top)/l;const p=De(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,f=a.y-c.y;else{const m=Math.max(0,s.right-p.right),h=Math.min(0,s.left-p.left),y=Math.max(0,s.bottom-p.bottom),v=Math.min(0,s.top-p.top);u=m||h,f=y||v}this.scroll({dx:-u*l,dy:-f*l})},Be.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)}),mc(i.a,1e3)};function vg(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Be.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},Be.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,l,u;c=i.getCTM();const f=c.a;return t?(a=W(o,t),s=a.matrixTransform(c.inverse()),l=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),u=c.multiply(l)):u=r.scale(e),vg(this._viewport,u),u},Be.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Be.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}},Be.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var jo="data-element-id";function ai(e){this._elements={},this._eventBus=e}ai.$inject=["eventBus"],ai.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Ee(t,jo,i),n&&Ee(n,jo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},ai.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Ee(i.gfx,jo,""),i.secondaryGfx&&Ee(i.secondaryGfx,jo,""),delete t[n])},ai.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)},ai.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Ee(t,jo,i),t},ai.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Ee(e,jo);var n=this._elements[t];return n&&n.element},ai.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},ai.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}},ai.prototype.getAll=function(){return this.filter(function(e){return e})},ai.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)})},ai.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},ai.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 mC(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 gC(e){return e.__refs_collection===!0}function yC(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function bg(e,t,n){var i=mC(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 vC(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 ui(e,t){if(!(this instanceof ui))return new ui(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}ui.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?bg(this,t,e):vC(this,t,e)},ui.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return gC(n)||bg(this,t,e),n},ui.prototype.ensureBound=function(e,t){yC(e,t)||this.bind(e,t)},ui.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},ui.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var gp=new ui({name:"children",enumerable:!0,collection:!0},{name:"parent"}),xg=new ui({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),_g=new ui({name:"attachers",collection:!0},{name:"host"}),wg=new ui({name:"outgoing",collection:!0},{name:"source"}),Eg=new ui({name:"incoming",collection:!0},{name:"target"});function Ho(){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)}}),gp.bind(this,"parent"),xg.bind(this,"labels"),wg.bind(this,"outgoing"),Eg.bind(this,"incoming")}function Ba(){Ho.call(this),gp.bind(this,"children"),_g.bind(this,"host"),_g.bind(this,"attachers")}we(Ba,Ho);function Sg(){Ho.call(this),gp.bind(this,"children")}we(Sg,Ba);function Rg(){Ba.call(this),xg.bind(this,"labelTarget")}we(Rg,Ba);function Cg(){Ho.call(this),wg.bind(this,"source"),Eg.bind(this,"target")}we(Cg,Ho);var bC={connection:Cg,shape:Ba,label:Rg,root:Sg};function xC(e,t){var n=bC[e];if(!n)throw new Error("unknown type: <"+e+">");return W(new n,t)}function _C(e){return e instanceof Ho}function er(){this._uid=12}er.prototype.createRoot=function(e){return this.create("root",e)},er.prototype.createLabel=function(e){return this.create("label",e)},er.prototype.createShape=function(e){return this.create("shape",e)},er.prototype.createConnection=function(e){return this.create("connection",e)},er.prototype.create=function(e,t){return t=W({},t||{}),t.id||(t.id=e+"_"+this._uid++),xC(e,t)};var gc="__fn",Ag=1e3,wC=Array.prototype.slice;function Yn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Yn.prototype.on=function(e,t,n,i){if(e=Le(e)?e:[e],pn(t)&&(i=n,n=t,t=Ag),!Fe(t))throw new Error("priority must be a number");var r=n;i&&(r=Fn(n,i),r[gc]=n[gc]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Yn.prototype.once=function(e,t,n,i){var r=this;if(pn(t)&&(i=n,n=t,t=Ag),!Fe(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[gc]=n,this.on(e,t,o)},Yn.prototype.off=function(e,t){e=Le(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Yn.prototype.createEvent=function(e){var t=new Na;return t.init(e),t},Yn.prototype.fire=function(e,t){var n,i,r,o;if(o=wC.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 Na?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}},Yn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Yn.prototype._destroy=function(){this._listeners={}},Yn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Yn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=EC(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},Yn.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},Yn.prototype._getListeners=function(e){return this._listeners[e]},Yn.prototype._setListeners=function(e,t){this._listeners[e]=t},Yn.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[gc]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function Na(){}Na.prototype.stopPropagation=function(){this.cancelBubble=!0},Na.prototype.preventDefault=function(){this.defaultPrevented=!0},Na.prototype.init=function(e){W(this,e||{})};function EC(e,t){return e.apply(null,t)}function io(e){return e.childNodes[0]}function SC(e){return e.parentNode.childNodes[1]}function yc(e,t,n,i,r){var o=Ma();o.setTranslate(t,n);var a=Ma();a.setRotate(i||0,0,0);var s=Ma();s.setScale(1,1),Ta(e,[o,a,s])}function _n(e,t,n){var i=Ma();i.setTranslate(t,n),Ta(e,i)}function Pg(e,t){var n=Ma();n.setRotate(t,0,0),Ta(e,n)}function si(e,t){this._eventBus=e,this._elementRegistry=t}si.$inject=["eventBus","elementRegistry"],si.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=SC(t),n||(n=Te("g"),ot(n).add("djs-children"),We(t.parentNode,n))):n=t,n},si.prototype._clear=function(e){var t=io(e);return oc(t),t},si.prototype._createContainer=function(e,t,n,i){var r=Te("g");ot(r).add("djs-group"),typeof n<"u"?RC(r,t,t.childNodes[n]):We(t,r);var o=Te("g");ot(o).add("djs-element"),ot(o).add("djs-"+e),i&&ot(o).add("djs-frame"),We(r,o);var a=Te("g");return ot(a).add("djs-visual"),We(o,a),o},si.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,eg(t))},si.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Vn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),H(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;H(o,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},si.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},si.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},si.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},si.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},si.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),_n(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Ee(n,"display","none"):Ee(n,"display","block")}},si.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);an(t.parentNode)};function RC(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const CC={__depends__:[FR],__init__:["canvas"],canvas:["type",Be],elementRegistry:["type",ai],elementFactory:["type",er],eventBus:["type",Yn],graphicsFactory:["type",si]};function AC(e){var t=new Qm(e);return t.init(),t}function PC(e){e=e||{};var t={config:["value",e]},n=[t,CC].concat(e.modules||[]);return AC(n)}function Sr(e,t){this._injector=t||PC(e),this.get("eventBus").fire("diagram.init")}Sr.prototype.get=function(e,t){return this._injector.get(e,t)},Sr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},Sr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Sr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function kn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function jn(e,t){return e.$instanceOf(t)}function MC(e){return At(e.rootElements,function(t){return jn(t,"bpmn:Process")||jn(t,"bpmn:Collaboration")})}function TC(e){var t={},n=[],i={};function r(q,V){return function(ie){q(ie,V)}}function o(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,V){var ie=q.gfx;if(ie)throw new Error(`already rendered ${kn(q)}`);return e.element(q,i[q.id],V)}function c(q,V){return e.root(q,i[q.id],V)}function l(q,V){try{var ie=i[q.id]&&s(q,V);return o(q),ie}catch(Me){u(Me.message,{element:q,error:Me}),console.error(`failed to import ${kn(q)}`,Me)}}function u(q,V){e.error(q,V)}var f=this.registerDi=function(V){var ie=V.bpmnElement;ie?i[ie.id]?u(`multiple DI elements defined for ${kn(ie)}`,{element:ie}):i[ie.id]=V:u(`no bpmnElement referenced in ${kn(V)}`,{element:V})};function p(q){d(q.plane)}function d(q){f(q),H(q.planeElement,m)}function m(q){f(q)}this.handleDefinitions=function(V,ie){var Me=V.diagrams;if(ie&&Me.indexOf(ie)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ie&&Me&&Me.length&&(ie=Me[0]),!ie)throw new Error("no diagram to display");i={},p(ie);var Rt=ie.plane;if(!Rt)throw new Error(`no plane for ${kn(ie)}`);var k=Rt.bpmnElement;if(!k)if(k=MC(V),k)u(`correcting missing bpmnElement on ${kn(Rt)} to ${kn(k)}`),Rt.bpmnElement=k,f(Rt);else throw new Error("no process or collaboration to display");var w=c(k,Rt);if(jn(k,"bpmn:Process")||jn(k,"bpmn:SubProcess"))y(k,w);else if(jn(k,"bpmn:Collaboration"))ue(k,w),v(V.rootElements,w);else throw new Error(`unsupported bpmnElement for ${kn(Rt)}: ${kn(k)}`);h(n)};var h=this.handleDeferred=function(){for(var V;n.length;)V=n.shift(),V()};function y(q,V){st(q,V),F(q.ioSpecification,V),P(q.artifacts,V),o(q)}function v(q,V){var ie=Qe(q,function(Me){return!a(Me)&&jn(Me,"bpmn:Process")&&Me.laneSets});ie.forEach(r(y,V))}function g(q,V){l(q,V)}function b(q,V){H(q,r(g,V))}function _(q,V){l(q,V)}function C(q,V){l(q,V)}function M(q,V){l(q,V)}function O(q,V){l(q,V)}function P(q,V){H(q,function(ie){jn(ie,"bpmn:Association")?n.push(function(){O(ie,V)}):O(ie,V)})}function F(q,V){q&&(H(q.dataInputs,r(C,V)),H(q.dataOutputs,r(M,V)))}var I=this.handleSubProcess=function(V,ie){st(V,ie),P(V.artifacts,ie)};function B(q,V){var ie=l(q,V);jn(q,"bpmn:SubProcess")&&I(q,ie||V),jn(q,"bpmn:Activity")&&F(q.ioSpecification,V),n.push(function(){H(q.dataInputAssociations,r(_,V)),H(q.dataOutputAssociations,r(_,V))})}function z(q,V){l(q,V)}function ce(q,V){l(q,V)}function ve(q,V){n.push(function(){var ie=l(q,V);q.childLaneSet&&qe(q.childLaneSet,ie||V),_e(q)})}function qe(q,V){H(q.lanes,r(ve,V))}function He(q,V){H(q,r(qe,V))}function st(q,V){X(q.flowElements,V),q.laneSets&&He(q.laneSets,V)}function X(q,V){H(q,function(ie){jn(ie,"bpmn:SequenceFlow")?n.push(function(){z(ie,V)}):jn(ie,"bpmn:BoundaryEvent")?n.unshift(function(){B(ie,V)}):jn(ie,"bpmn:FlowNode")?B(ie,V):jn(ie,"bpmn:DataObject")||(jn(ie,"bpmn:DataStoreReference")||jn(ie,"bpmn:DataObjectReference")?ce(ie,V):u(`unrecognized flowElement ${kn(ie)} in context ${kn(V&&V.businessObject)}`,{element:ie,context:V}))})}function Q(q,V){var ie=l(q,V),Me=q.processRef;Me&&y(Me,ie||V)}function ue(q,V){H(q.participants,r(Q,V)),n.push(function(){b(q.messageFlows,V)}),P(q.artifacts,V)}function _e(q){H(q.flowNodeRef,function(V){var ie=V.get("lanes");ie&&ie.push(q)})}}function S(e,t){var n=oe(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Ze(e,t){return hr(t,function(n){return S(e,n)})}function oe(e){return e&&e.businessObject||e}function ct(e){return e&&e.di}function kC(e,t,n){var i,r,o,a,s=[];function c(l,u){var f={root:function(h,y){return i.add(h,y)},element:function(h,y,v){return i.add(h,y,v)},error:function(h,y){s.push({message:h,context:y})}},p=new TC(f);u=u||l.diagrams&&l.diagrams[0];var d=OC(l,u);if(!d)throw new Error("no diagram to display");H(d,function(h){p.handleDefinitions(l,h)});var m=u.plane.bpmnElement.id;o.setRootElement(o.findRoot(m+"_plane")||o.findRoot(m))}return new Promise(function(l,u){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}),l({warnings:s})}catch(f){return f.warnings=s,u(f)}})}function OC(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!S(n,"bpmn:Process")&&!S(n,"bpmn:Collaboration")&&(i=DC(n));var r;S(i,"bpmn:Collaboration")?r=i:r=At(e.rootElements,function(l){if(S(l,"bpmn:Collaboration"))return At(l.participants,function(u){return u.processRef===i})});var o=[i];r&&(o=Pn(r.participants,function(l){return l.processRef}),o.push(r));var a=Mg(o),s=[t],c=[n];return H(e.diagrams,function(l){if(l.plane){var u=l.plane.bpmnElement;a.indexOf(u)!==-1&&c.indexOf(u)===-1&&(s.push(l),c.push(u))}}),s}}function Mg(e){var t=[];return H(e,function(n){n&&(t.push(n),t=t.concat(Mg(n.flowElements)))}),t}function DC(e){for(var t=e;t;){if(S(t,"bpmn:Process"))return t;t=t.$parent}}var LC='<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>',Tg=LC,kg={verticalAlign:"middle"},Og={color:"#404040"},IC={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},BC={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},NC={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"},$C='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Tg+'</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>',Ii;function FC(){Ii=kt($C),Bn(Ii,IC),Bn(bt("svg",Ii),kg),Bn(bt(".backdrop",Ii),BC),Bn(bt(".notice",Ii),NC),Bn(bt(".link",Ii),Og,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function jC(){Ii||(FC(),Un.bind(Ii,".backdrop","click",function(e){document.body.removeChild(Ii)})),document.body.appendChild(Ii)}const vc=5,Dg="djs-outline-hidden";function Ft(e){e=W({},zC,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),VC(this._container)}we(Ft,Sr),Ft.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(p){throw this._emit("import.parse.complete",{error:p}),p}let s=a.rootElement;const c=a.references,l=a.warnings,u=a.elementsById;o=o.concat(l),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:u,references:c,warnings:o}))||s;const f=await this.importDefinitions(s,n);return o=o.concat(f.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),bc(s,o),s=HC(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},Ft.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},Ft.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw bc(o,[]),o}if(typeof t=="string"&&(i=GC(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw bc(o,[]),o}try{this.clear()}catch(o){throw bc(o,[]),o}const{warnings:r}=await kC(this,n,i);return{warnings:r}},Ft.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},Ft.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=bt(":scope > defs",i._svg),a=Zm(r),s=o?"<defs>"+Zm(o)+"</defs>":"",c=i.getContainer();Bt(c).add(Dg);let l;try{l=r.getBBox()}finally{Bt(c).remove(Dg)}const u=l.x-vc,f=l.y-vc,p=l.width+vc*2,d=l.height+vc*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="`+p+'" height="'+d+'" viewBox="'+u+" "+f+" "+p+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Nt.prototype._setDefinitions=function(e){this._definitions=e},Nt.prototype.getModules=function(){return this._modules},Nt.prototype.clear=function(){this.getDefinitions()&&Sr.prototype.clear.call(this)},Nt.prototype.destroy=function(){Sr.prototype.destroy.call(this),Di(this._container)},Nt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Nt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Nt.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=ht(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Nt.prototype.getDefinitions=function(){return this._definitions},Nt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Nt.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=W(Mi(n,["additionalModules"]),{canvas:W({},n.canvas,{container:e}),modules:a});Sr.call(this,s),n&&n.container&&this.attachTo(n.container)},Nt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Nt.prototype._createContainer=function(e){const t=Mt('<div class="bjs-container"></div>');return Ln(t,{width:kg(e.width),height:kg(e.height),position:e.position}),t},Nt.prototype._createModdle=function(e){const t=W({},this._moddleExtensions,e.moddleExtensions);return new Eh(t)},Nt.prototype._modules=[];function bc(e,t){return e.warnings=t,e}function $C(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 FC={width:"100%",height:"100%",position:"relative"};function kg(e){return e+(Fe(e)?"px":"")}function jC(e,t){return t&&wt(e.diagrams,function(n){return n.id===t})||null}function HC(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Ag+"</a>",i=Mt(n);Ln(ht("svg",i),Pg),Ln(i,Mg,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),je.bind(i,"click",function(r){NC(),r.preventDefault()})}function Go(e){Nt.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)}we(Go,Nt),Go.prototype._createModdle=function(e){var t=Nt.prototype._createModdle.call(this,e);return t.ids=new Oi([32,36,1]),t},Go.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 et(e,t){return S(e,"bpmn:CallActivity")?!1:S(e,"bpmn:SubProcess")?(t=t||st(e),t&&S(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):S(e,"bpmn:Participant")?!!oe(e).processRef:!0}function pn(e){if(!(!S(e,"bpmn:Participant")&&!S(e,"bpmn:Lane"))){var t=st(e).isHorizontal;return t===void 0?!0:t}}function zC(e){return e&&oe(e).isInterrupting!==!1}function Tn(e){return e&&!!oe(e).triggeredByEvent}function Vo(e,t){var n=oe(e).eventDefinitions;return hr(n,function(i){return S(i,t)})}function GC(e){return Vo(e,"bpmn:ErrorEventDefinition")}function VC(e){return Vo(e,"bpmn:EscalationEventDefinition")}function WC(e){return Vo(e,"bpmn:CompensateEventDefinition")}var ro={width:90,height:20},Og=15;function Rr(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 xc(e){return Xe(e.label)}function UC(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=YC(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-=Og:a+=Og,{x:a,y:s}}function YC(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 gp(e){return e.waypoints?UC(e.waypoints):S(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+ro.height/2}:{x:e.x+e.width/2,y:e.y+e.height+ro.height/2}}function qC(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(ro.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=gp(t),i=ro),W({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Dg(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 KC(e){var t=e.categoryValueRef;return t&&t.value||""}function ci(e){var t=e.businessObject,n=Dg(t);if(n)return n==="categoryValueRef"?KC(t):t[n]||""}function XC(e,t){var n=e.businessObject,i=Dg(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function ZC(e){return Xe(e)&&Rr(e.labelTarget)}var Wo=7;function Ig(e){let t=[];return H(e.incoming,n=>{S(n,"bpmn:Association")&&S(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),H(e.outgoing,n=>{S(n,"bpmn:Association")&&S(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function Fa(e){const t=new Map;return H(lp(e),n=>{H(Ig(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 yp="hsl(225, 10%, 15%)",QC="white";function Ni(e,t){return hr(e.eventDefinitions,function(n){return n.$type===t})}function JC(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function eA(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function Je(e,t,n){var i=st(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||QC}function be(e,t,n){var i=st(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||yp}function ja(e,t,n,i){var r=st(e),o=r.get("label");return i||o&&o.get("color:color")||t||be(e,n)}function Lg(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 to(r)}function vp(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 to(a)}function tA(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 to(s)}function nA(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 to(o)}function Ha(e,t={}){return{width:pi(e,t),height:Yn(e,t)}}function pi(e,t={}){return zn(t,"width")?t.width:e.width}function Yn(e,t={}){return zn(t,"height")?t.height:e.height}var iA=new Oi,rA=10,_c=3,oA=1.5,wc=10,aA=4,Uo=.95,sA=1,cA=.25;function oo(e,t,n,i,r,o,a){Zi.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(k){return n.computeStyle(k,{strokeLinecap:"round",strokeLinejoin:"round",stroke:yp,strokeWidth:2,fill:"white"})}function f(k){return n.computeStyle(k,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:yp,strokeWidth:2})}function p(k,w){var{ref:E={x:0,y:0},scale:G=1,element:U,parentGfx:Z=r._svg}=w,Re=Me("marker",{id:k,viewBox:"0 0 20 20",refX:E.x,refY:E.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});Ve(Re,U);var Ke=ht(":scope > defs",Z);Ke||(Ke=Me("defs"),Ve(Z,Ke)),Ve(Ke,Re)}function d(k,w,E,G){var U=iA.nextPrefixed("marker-");return m(k,U,w,E,G),"url(#"+U+")"}function m(k,w,E,G,U){if(E==="sequenceflow-end"){var Z=Me("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:U,stroke:U,strokeWidth:1})});p(w,{element:Z,ref:{x:11,y:10},scale:.5,parentGfx:k})}if(E==="messageflow-start"){var Re=Me("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(w,{element:Re,ref:{x:6,y:6},parentGfx:k})}if(E==="messageflow-end"){var Ke=Me("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(w,{element:Ke,ref:{x:8.5,y:5},parentGfx:k})}if(E==="association-start"){var lt=Me("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(w,{element:lt,ref:{x:1,y:10},scale:.5,parentGfx:k})}if(E==="association-end"){var Ht=Me("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(w,{element:Ht,ref:{x:11,y:10},scale:.5,parentGfx:k})}if(E==="conditional-flow-marker"){var ft=Me("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:U})});p(w,{element:ft,ref:{x:-1,y:10},scale:.5,parentGfx:k})}if(E==="conditional-default-flow-marker"){var qt=Me("path",{d:"M 6 4 L 10 16",...u({stroke:U,fill:"none"})});p(w,{element:qt,ref:{x:0,y:10},scale:.5,parentGfx:k})}}function h(k,w,E,G,U={}){ln(G)&&(U=G,G=0),G=G||0,U=u(U);var Z=w/2,Re=E/2,Ke=Me("circle",{cx:Z,cy:Re,r:Math.round((w+E)/4-G),...U});return Ve(k,Ke),Ke}function y(k,w,E,G,U,Z){ln(U)&&(Z=U,U=0),U=U||0,Z=u(Z);var Re=Me("rect",{x:U,y:U,width:w-U*2,height:E-U*2,rx:G,ry:G,...Z});return Ve(k,Re),Re}function v(k,w,E,G){var U=w/2,Z=E/2,Re=[{x:U,y:0},{x:w,y:Z},{x:U,y:E},{x:0,y:Z}],Ke=Re.map(function(Ht){return Ht.x+","+Ht.y}).join(" ");G=u(G);var lt=Me("polygon",{...G,points:Ke});return Ve(k,lt),lt}function g(k,w,E,G){E=f(E);var U=Oa(w,E,G);return Ve(k,U),U}function b(k,w,E){return g(k,w,E,5)}function x(k,w,E){E=f(E);var G=Me("path",{...E,d:w});return Ve(k,G),G}function C(k,w,E,G){return x(w,E,W({"data-marker":k},G))}function M(k){return bt[k]}function O(k){return function(w,E,G){return M(k)(w,E,G)}}var P={"bpmn:MessageEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.235,my:.315}}),Z=G?be(w,c,E.stroke):Je(w,s,E.fill),Re=G?Je(w,s,E.fill):be(w,c,E.stroke),Ke=x(k,U,{fill:Z,stroke:Re,strokeWidth:1});return Ke},"bpmn:TimerEventDefinition":function(k,w,E={}){var G=E.width||w.width,U=E.height||w.height,Z=E.width?1:2,Re=h(k,G,U,.2*U,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:Z}),Ke=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}});x(k,Ke,{stroke:be(w,c,E.stroke),strokeWidth:Z});for(var lt=0;lt<12;lt++){var Ht=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}}),ft=G/2,qt=U/2;x(k,Ht,{strokeWidth:1,stroke:be(w,c,E.stroke),transform:"rotate("+lt*30+","+qt+","+ft+")"})}return Re},"bpmn:EscalationEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.2}}),Z=G?be(w,c,E.stroke):Je(w,s,E.fill);return x(k,U,{fill:Z,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(k,w,E={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.222}});return x(k,G,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.57,my:.263}}),Z=G?be(w,c,E.stroke):Je(w,s,E.fill);return x(k,U,{fill:Z,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.2,my:.722}}),Z=G?be(w,c,E.stroke):Je(w,s,E.fill);return x(k,U,{fill:Z,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.638,my:-.055}}),Z=G?be(w,c,E.stroke):"none",Re=x(k,U,{fill:Z,stroke:be(w,c,E.stroke),strokeWidth:1});return Rg(Re,45),Re},"bpmn:CompensateEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.22,my:.5}}),Z=G?be(w,c,E.stroke):Je(w,s,E.fill);return x(k,U,{fill:Z,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.2}}),Z=G?be(w,c,E.stroke):Je(w,s,E.fill);return x(k,U,{strokeWidth:1,fill:Z,stroke:be(w,c,E.stroke)})},"bpmn:MultipleEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.211,my:.36}}),Z=G?be(w,c,E.stroke):Je(w,s,E.fill);return x(k,U,{fill:Z,stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(k,w,E={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.458,my:.194}});return x(k,G,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(k,w,E={}){var G=h(k,w.width,w.height,8,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:4});return G}};function F(k,w,E={},G){var U=oe(k),Z=JC(U),Re=G||k;return U.get("eventDefinitions")&&U.get("eventDefinitions").length>1?U.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](w,Re,E,Z):P["bpmn:MultipleEventDefinition"](w,Re,E,Z):Ni(U,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](w,Re,E,Z):Ni(U,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](w,Re,E,Z):Ni(U,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](w,Re,E,Z):Ni(U,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](w,Re,E,Z):Ni(U,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](w,Re,E,Z):Ni(U,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](w,Re,E,Z):Ni(U,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](w,Re,E,Z):Ni(U,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](w,Re,E,Z):Ni(U,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](w,Re,E,Z):Ni(U,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](w,Re,E,Z):null}var D={ParticipantMultiplicityMarker:function(k,w,E={}){var G=pi(w,E),U=Yn(w,E),Z=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",k,Z,{strokeWidth:2,fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke)})},SubProcessMarker:function(k,w,E={}){var G=y(k,14,14,0,{strokeWidth:1,fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke)});xn(G,w.width/2-7.5,w.height-20);var U=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2-7.5)/w.width,my:(w.height-20)/w.height}});C("sub-process",k,U,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke)})},ParallelMarker:function(k,w,E){var G=pi(w,E),U=Yn(w,E),Z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.parallel)/G,my:(U-20)/U}});C("parallel",k,Z,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke)})},SequentialMarker:function(k,w,E){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+E.seq)/w.width,my:(w.height-19)/w.height}});C("sequential",k,G,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke)})},CompensationMarker:function(k,w,E){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+E.compensation)/w.width,my:(w.height-13)/w.height}});C("compensation",k,G,{strokeWidth:1,fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke)})},LoopMarker:function(k,w,E){var G=pi(w,E),U=Yn(w,E),Z=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.loop)/G,my:(U-7)/U}});C("loop",k,Z,{strokeWidth:1.5,fill:"none",stroke:be(w,c,E.stroke),strokeMiterlimit:.5})},AdhocMarker:function(k,w,E){var G=pi(w,E),U=Yn(w,E),Z=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.adhoc)/G,my:(U-15)/U}});C("adhoc",k,Z,{strokeWidth:1,fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke)})}};function I(k,w,E,G){D[k](w,E,G)}function z(k,w,E=[],G={}){G={fill:G.fill,stroke:G.stroke,width:pi(w,G),height:Yn(w,G)};var U=oe(w),Z=E.includes("SubProcessMarker");Z?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")&&E.push("CompensationMarker"),S(U,"bpmn:AdHocSubProcess")&&(E.push("AdhocMarker"),Z||W(G,{compensation:G.compensation-18}));var Re=U.get("loopCharacteristics"),Ke=Re&&Re.get("isSequential");Re&&(W(G,{compensation:G.compensation-18}),E.includes("AdhocMarker")&&W(G,{seq:-23,loop:-18,parallel:-24}),Ke===void 0&&E.push("LoopMarker"),Ke===!1&&E.push("ParallelMarker"),Ke===!0&&E.push("SequentialMarker")),E.includes("CompensationMarker")&&E.length===1&&W(G,{compensation:-8}),H(E,function(lt){I(lt,k,w,G)})}function ce(k,w,E={}){E=W({size:{width:100}},E);var G=o.createText(w||"",E);return nt(G).add("djs-label"),Ve(k,G),G}function ve(k,w,E,G={}){var U=oe(w),Z=Ha({x:w.x,y:w.y,width:w.width,height:w.height},G);return ce(k,U.name,{align:E,box:Z,padding:7,style:{fill:ja(w,l,c,G.stroke)}})}function Ye(k,w,E={}){var G={width:w.width,height:w.height,x:w.width/2+w.x,y:w.height/2+w.y};return ce(k,ci(w),{box:G,style:W({},o.getExternalStyle(),{fill:ja(w,l,c,E.stroke)})})}function He(k,w,E,G={}){var U=pn(E),Z=ce(k,w,{box:{height:30,width:U?Yn(E,G):pi(E,G)},align:"center-middle",style:{fill:ja(E,l,c,G.stroke)}});if(U){var Re=-1*Yn(E,G);yc(Z,0,-Re,270)}}function it(k,w,E={}){var{width:G,height:U}=Ha(w,E);return y(k,G,U,wc,{...E,fill:Je(w,s,E.fill),fillOpacity:Uo,stroke:be(w,c,E.stroke)})}function X(k,w,E={}){var G=oe(w),U=Je(w,s,E.fill),Z=be(w,c,E.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(E.markerEnd=d(k,"association-end",U,Z)),G.get("associationDirection")==="Both"&&(E.markerStart=d(k,"association-start",U,Z)),E=ct(E,["markerStart","markerEnd"]),b(k,w.waypoints,{...E,stroke:Z,strokeDasharray:"0, 5"})}function Q(k,w,E={}){var G=Je(w,s,E.fill),U=be(w,c,E.stroke),Z=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}}),Re=x(k,Z,{fill:G,fillOpacity:Uo,stroke:U}),Ke=oe(w);if(eA(Ke)){var lt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.33,my:(w.height-18)/w.height}});x(k,lt,{strokeWidth:2,fill:G,stroke:U})}return Re}function ue(k,w,E={}){return h(k,w.width,w.height,{fillOpacity:Uo,...E,fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke)})}function _e(k,w,E={}){return v(k,w.width,w.height,{fill:Je(w,s,E.fill),fillOpacity:Uo,stroke:be(w,c,E.stroke)})}function q(k,w,E={}){var G=y(k,pi(w,E),Yn(w,E),0,{fill:Je(w,s,E.fill),fillOpacity:E.fillOpacity||Uo,stroke:be(w,c,E.stroke),strokeWidth:1.5}),U=oe(w);if(S(U,"bpmn:Lane")){var Z=U.get("name");He(k,Z,w,E)}return G}function V(k,w,E={}){var G=it(k,w,E),U=et(w);if(Tn(w)&&(Ee(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!U)){var Z=oe(w).flowElements||[],Re=Z.filter(Ke=>S(Ke,"bpmn:StartEvent"));Re.length===1&&ie(Re[0],k,E,w)}return ve(k,w,U?"center-top":"center-middle",E),U?z(k,w,void 0,E):z(k,w,["SubProcessMarker"],E),G}function ie(k,w,E,G){var U=22,Z={fill:Je(G,s,E.fill),stroke:be(G,c,E.stroke),width:U,height:U},Re=oe(k).isInterrupting,Ke=Re?0:3,lt=Re?1:1.2,Ht=20,ft=(U-Ht)/2,qt="translate("+ft+","+ft+")";h(w,Ht,Ht,{fill:Z.fill,stroke:Z.stroke,strokeWidth:lt,strokeDasharray:Ke,transform:qt}),F(k,w,Z,G)}function Pe(k,w,E={}){var G=it(k,w,E);return ve(k,w,"center-middle",E),z(k,w,void 0,E),G}var bt=this.handlers={"bpmn:AdHocSubProcess":function(k,w,E={}){return et(w)?E=ct(E,["fill","stroke","width","height"]):E=ct(E,["fill","stroke"]),V(k,w,E)},"bpmn:Association":function(k,w,E={}){return E=ct(E,["fill","stroke"]),X(k,w,E)},"bpmn:BoundaryEvent":function(k,w,E={}){var{renderIcon:G=!0}=E;E=ct(E,["fill","stroke"]);var U=oe(w),Z=U.get("cancelActivity");E={strokeWidth:1.5,fill:Je(w,s,E.fill),fillOpacity:sA,stroke:be(w,c,E.stroke)},Z||(E.strokeDasharray="6");var Re=ue(k,w,E);return h(k,w.width,w.height,_c,{...E,fill:"none"}),G&&F(w,k,E),Re},"bpmn:BusinessRuleTask":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=Pe(k,w,E),U=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),Z=x(k,U);Ee(Z,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1});var Re=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ke=x(k,Re);return Ee(Ke,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(k,w,E={}){return E=ct(E,["fill","stroke"]),V(k,w,{strokeWidth:5,...E})},"bpmn:ComplexGateway":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=_e(k,w,E),U=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.26}});return x(k,U,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=Q(k,w,E);return x(k,G,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1}),U},"bpmn:DataInputAssociation":function(k,w,E={}){return E=ct(E,["fill","stroke"]),X(k,w,{...E,markerEnd:d(k,"association-end",Je(w,s,E.fill),be(w,c,E.stroke))})},"bpmn:DataObject":function(k,w,E={}){return E=ct(E,["fill","stroke"]),Q(k,w,E)},"bpmn:DataObjectReference":O("bpmn:DataObject"),"bpmn:DataOutput":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=Q(k,w,E);return x(k,G,{strokeWidth:1,fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke)}),U},"bpmn:DataOutputAssociation":function(k,w,E={}){return E=ct(E,["fill","stroke"]),X(k,w,{...E,markerEnd:d(k,"association-end",Je(w,s,E.fill),be(w,c,E.stroke))})},"bpmn:DataStoreReference":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:0,my:.133}});return x(k,G,{fill:Je(w,s,E.fill),fillOpacity:Uo,stroke:be(w,c,E.stroke),strokeWidth:2})},"bpmn:EndEvent":function(k,w,E={}){var{renderIcon:G=!0}=E;E=ct(E,["fill","stroke"]);var U=ue(k,w,{...E,strokeWidth:4});return G&&F(w,k,E),U},"bpmn:EventBasedGateway":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=oe(w),U=_e(k,w,E);h(k,w.width,w.height,w.height*.2,{fill:Je(w,"none",E.fill),stroke:be(w,c,E.stroke),strokeWidth:1});var Z=G.get("eventGatewayType"),Re=!!G.get("instantiate");function Ke(){var Ht=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:w.width,containerHeight:w.height,position:{mx:.36,my:.44}});x(k,Ht,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:2})}if(Z==="Parallel"){var lt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}});x(k,lt,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1})}else Z==="Exclusive"&&(Re||h(k,w.width,w.height,w.height*.26,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1}),Ke());return U},"bpmn:ExclusiveGateway":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=_e(k,w,E),U=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.32,my:.3}}),Z=st(w);return Z.get("isMarkerVisible")&&x(k,U,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(k,w,E={}){return E=ct(E,["fill","stroke"]),_e(k,w,E)},"bpmn:Group":function(k,w,E={}){return E=ct(E,["fill","stroke","width","height"]),y(k,w.width,w.height,wc,{stroke:be(w,c,E.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:pi(w,E),height:Yn(w,E)})},"bpmn:InclusiveGateway":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=_e(k,w,E);return h(k,w.width,w.height,w.height*.24,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(k,w,E={}){var{renderIcon:G=!0}=E;E=ct(E,["fill","stroke"]);var U=ue(k,w,{...E,strokeWidth:1.5});return h(k,w.width,w.height,_c,{fill:"none",stroke:be(w,c,E.stroke),strokeWidth:1.5}),G&&F(w,k,E),U},"bpmn:IntermediateCatchEvent":O("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":O("bpmn:IntermediateEvent"),"bpmn:Lane":function(k,w,E={}){return E=ct(E,["fill","stroke","width","height"]),q(k,w,{...E,fillOpacity:cA})},"bpmn:ManualTask":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=Pe(k,w,E),U=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(k,U,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=oe(w),U=st(w),Z=Je(w,s,E.fill),Re=be(w,c,E.stroke),Ke=b(k,w.waypoints,{markerEnd:d(k,"messageflow-end",Z,Re),markerStart:d(k,"messageflow-start",Z,Re),stroke:Re,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var lt=Ke.getPointAtLength(Ke.getTotalLength()/2),Ht=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:lt.x,y:lt.y}}),ft={strokeWidth:1};U.get("messageVisibleKind")==="initiating"?(ft.fill=Z,ft.stroke=Re):(ft.fill=Re,ft.stroke=Z);var qt=x(k,Ht,ft),fn=G.get("messageRef"),dn=fn.get("name"),Ct=ce(k,dn,{align:"center-top",fitBox:!0,style:{fill:Re}}),zt=qt.getBBox(),kn=Ct.getBBox(),Ur=lt.x-kn.width/2,Jn=lt.y+zt.height/2+rA;yc(Ct,Ur,Jn,0)}return Ke},"bpmn:ParallelGateway":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=_e(k,w,E),U=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.2}});return x(k,U,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:Participant":function(k,w,E={}){E=ct(E,["fill","stroke","width","height"]);var G=q(k,w,E),U=et(w),Z=pn(w),Re=oe(w),Ke=Re.get("name");if(U){var lt=Z?[{x:30,y:0},{x:30,y:Yn(w,E)}]:[{x:0,y:30},{x:pi(w,E),y:30}];g(k,lt,{stroke:be(w,c,E.stroke),strokeWidth:oA}),He(k,Ke,w,E)}else{var Ht=Ha(w,E);Z||(Ht.height=pi(w,E),Ht.width=Yn(w,E));var ft=ce(k,Ke,{box:Ht,align:"center-middle",style:{fill:ja(w,l,c,E.stroke)}});if(!Z){var qt=-1*Yn(w,E);yc(ft,0,-qt,270)}}return Re.get("participantMultiplicity")&&I("ParticipantMultiplicityMarker",k,w,E),G},"bpmn:ReceiveTask":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=oe(w),U=Pe(k,w,E),Z;return G.get("instantiate")?(h(k,28,28,20*.22,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),Z=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):Z=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(k,Z,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),U},"bpmn:ScriptTask":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=Pe(k,w,E),U=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(k,U,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=Pe(k,w,E),U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(k,U,{fill:be(w,c,E.stroke),stroke:Je(w,s,E.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=Je(w,s,E.fill),U=be(w,c,E.stroke),Z=b(k,w.waypoints,{markerEnd:d(k,"sequenceflow-end",G,U),stroke:U}),Re=oe(w),{source:Ke}=w;if(Ke){var lt=oe(Ke);Re.get("conditionExpression")&&S(lt,"bpmn:Activity")&&Ee(Z,{markerStart:d(k,"conditional-flow-marker",G,U)}),lt.get("default")&&(S(lt,"bpmn:Gateway")||S(lt,"bpmn:Activity"))&&lt.get("default")===Re&&Ee(Z,{markerStart:d(k,"conditional-default-flow-marker",G,U)})}return Z},"bpmn:ServiceTask":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=Pe(k,w,E);h(k,10,10,{fill:Je(w,s,E.fill),stroke:"none",transform:"translate(6, 6)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(k,U,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),h(k,10,10,{fill:Je(w,s,E.fill),stroke:"none",transform:"translate(11, 10)"});var Z=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(k,Z,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(k,w,E={}){var{renderIcon:G=!0}=E;E=ct(E,["fill","stroke"]);var U=oe(w);U.get("isInterrupting")||(E={...E,strokeDasharray:"6"});var Z=ue(k,w,E);return G&&F(w,k,E),Z},"bpmn:SubProcess":function(k,w,E={}){return et(w)?E=ct(E,["fill","stroke","width","height"]):E=ct(E,["fill","stroke"]),V(k,w,E)},"bpmn:Task":function(k,w,E={}){return E=ct(E,["fill","stroke"]),Pe(k,w,E)},"bpmn:TextAnnotation":function(k,w,E={}){E=ct(E,["fill","stroke"]);var{width:G,height:U}=Ha(w,E),Z=y(k,G,U,0,0,{fill:"none",stroke:"none"}),Re=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:0,my:0}});x(k,Re,{stroke:be(w,c,E.stroke)});var Ke=oe(w),lt=Ke.get("text")||"";return ce(k,lt,{align:"left-top",box:Ha(w,E),padding:Wo,style:{fill:ja(w,l,c,E.stroke)}}),Z},"bpmn:Transaction":function(k,w,E={}){et(w)?E=ct(E,["fill","stroke","width","height"]):E=ct(E,["fill","stroke"]);var G=V(k,w,{strokeWidth:1.5,...E}),U=n.style(["no-fill","no-events"],{stroke:be(w,c,E.stroke),strokeWidth:1.5}),Z=et(w);return Z||(E={}),y(k,pi(w,E),Yn(w,E),wc-_c,_c,U),G},"bpmn:UserTask":function(k,w,E={}){E=ct(E,["fill","stroke"]);var G=Pe(k,w,E),U=15,Z=12,Re=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:Z}});x(k,Re,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:.5});var Ke=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:Z}});x(k,Ke,{fill:Je(w,s,E.fill),stroke:be(w,c,E.stroke),strokeWidth:.5});var lt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:Z}});return x(k,lt,{fill:be(w,c,E.stroke),stroke:be(w,c,E.stroke),strokeWidth:.5}),G},label:function(k,w,E={}){return Ye(k,w,E)}};this._drawPath=x,this._renderer=M}we(oo,Zi),oo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],oo.prototype.canRender=function(e){return S(e,"bpmn:BaseElement")},oo.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},oo.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},oo.prototype.getShapePath=function(e){return Xe(e)?vp(e,aA):S(e,"bpmn:Event")?Lg(e):S(e,"bpmn:Activity")?vp(e,wc):S(e,"bpmn:Gateway")?tA(e):nA(e)};function ct(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var lA=0,uA={width:150,height:50};function pA(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function fA(e){return ln(e)?W({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var bp=null;function dA(){return bp||(bp=document.createElement("canvas").getContext("2d")),bp}function hA(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(Bg(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Bg(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function mA(e,t){var n=dA();if(!n)return{width:0,height:0};n.font=hA(t),"letterSpacing"in n&&(n.letterSpacing=Bg(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 gA(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=mA(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return yA(e,r,i,o);r=bA(r,o.width,t)}}function yA(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 Ng="­";function vA(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===Ng)&&r.pop();break}var a=r[r.length-1];return a&&a===Ng&&(r[r.length-1]="-"),r.join("")}function bA(e,t,n){var i=Math.max(e.length*(n/t),1),r=vA(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ec(e){this._config=W({},{size:uA,padding:lA,style:{},align:"center-top"},e||{})}Ec.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ec.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ec.prototype.layoutText=function(e,t){for(var n=W({},this._config.size,t.box),i=W({},this._config.style,t.style),r=pA(t.align||this._config.align),o=fA(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=xA(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(gA(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Gn(l,function(y,v,g){return y+(s||v.height)},0)+o.top+o.bottom,p=Gn(l,function(y,v,g){return v.width>y?v.width:y},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||l[0].height)/4;var m=Me("text");Ee(m,i),H(l,function(y){var v;switch(d+=s||y.height,r.horizontal){case"left":v=o.left;break;case"right":v=(a?p:u)-o.right-y.width;break;default:v=Math.max(((a?p:u)-y.width)/2+o.left,0)}var g=Me("tspan");Ee(g,{x:v,y:d}),g.textContent=y.text,Ve(m,g)});var h={width:p,height:f};return{dimensions:h,element:m}};function xA(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var _A=12,wA=1.2,EA=40;function $g(e){var t=W({fontFamily:"Arial, sans-serif",fontSize:_A,fontWeight:"normal",lineHeight:wA},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=W({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ec({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,ro.width),height:30},l=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.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(EA,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,W({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}$g.$inject=["config.textRenderer"];function SA(){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,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var f=PA(i.d,{mx:r,my:o,e:a});return f}}var RA=/\{([^{}]+)\}/g,CA=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function AA(e,t,n){var i=n;return t.replace(CA,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 PA(e,t){return String(e).replace(RA,function(n,i){return AA(n,i,t)})}const MA={__init__:["bpmnRenderer"],bpmnRenderer:["type",oo],textRenderer:["type",$g],pathMap:["type",SA]};function TA(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const za={translate:["value",TA]};function Sc(e,t,n){return W({id:e.id,type:e.$type,businessObject:e,di:t},n)}function kA(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 Fg(e,t,n){return new Error(`element ${Mn(t)} referenced by ${Mn(e)}#${n} not yet drawn`)}function tr(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}tr.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],tr.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(Sc(e,t,a)),this._canvas.addRootElement(i)}else if(S(t,"bpmndi:BPMNShape")){var s=!et(e,t),c=DA(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Sc(e,t,{collapsed:s,hidden:r,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),S(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),S(e,"bpmn:Lane")&&(o=0),S(e,"bpmn:DataStoreReference")&&(OA(n,Le(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(S(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Sc(e,t,{hidden:r,source:u,target:f,waypoints:kA(t,u,f)})),S(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${Mn(t)} for element ${Mn(e)}`);return Rr(e)&&ci(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},tr.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Mn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Fg(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},tr.prototype.addLabel=function(e,t,n){var i,r,o;return i=qC(t,n),r=ci(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Sc(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!ci(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)},tr.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?Fg(e,i,t+"Ref"):new Error(`${Mn(e)}#${t} Ref not specified`)},tr.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},tr.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},tr.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function OA(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 DA(e){return S(e,"bpmn:Group")}const jg={__depends__:[MA,{__depends__:[za],bpmnImporter:["type",tr]}]};function Ga(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ci(e,t){return{x:e.x-t.x,y:e.y-t.y}}function xp(e){return Math.log(e)/Math.log(10)}var IA=1e3;function ne(e){this._eventBus=e}ne.$inject=["eventBus"];function LA(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}ne.prototype.on=function(e,t,n,i,r,o){if((un(t)||Fe(t))&&(o=r,r=i,i=n,n=t,t=null),un(n)&&(o=r,r=i,i=n,n=IA),ln(r)&&(o=r,r=!1),!un(i))throw new Error("handlerFn must be a function");Ie(e)||(e=[e]);var a=this._eventBus;H(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?LA(i,o):i,o)})},ne.prototype.canExecute=nr("canExecute"),ne.prototype.preExecute=nr("preExecute"),ne.prototype.preExecuted=nr("preExecuted"),ne.prototype.execute=nr("execute"),ne.prototype.executed=nr("executed"),ne.prototype.postExecute=nr("postExecute"),ne.prototype.postExecuted=nr("postExecuted"),ne.prototype.revert=nr("revert"),ne.prototype.reverted=nr("reverted");function nr(e){return function(n,i,r,o,a){(un(n)||Fe(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var _p=["top","bottom","left","right"],Rc=10;function wp(e,t){ne.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,l=o.hints||{};l.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(xc(r)&&!gt(r)){var o=$A(r);o&&i(r,o)}}function i(r,o){var a=Le(r),s=r.label,c=Le(s);if(s.parent){var l=De(r),u;switch(o){case"top":u={x:a.x,y:l.top-Rc-s.height/2};break;case"left":u={x:l.left-Rc-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Rc+s.height/2};break;case"right":u={x:l.right+Rc+s.width/2,y:a.y};break}var f=Ci(u,c);t.moveShape(s,f)}}}we(wp,ne),wp.$inject=["eventBus","modeling"];function BA(e){var t=e.host,n=Le(e),i=bn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=_p.filter(function(a){return r.indexOf(a)===-1});return o}function NA(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 Hg(t,i)});return n}function $A(e){var t=Le(e.label),n=Le(e),i=Hg(n,t);if(FA(i)){var r=NA(e);if(e.host){var o=BA(e);r=r.concat(o)}var a=_p.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?bn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Hg(e,t){return bn(t,e,5)}function FA(e){return _p.indexOf(e)!==-1}function Ep(e){ne.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)}we(Ep,ne),Ep.$inject=["eventBus"];var jA=1500;function Sp(e,t,n){e.invoke(ne,this),this.preExecute("elements.delete",jA,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=Qe(r,l=>S(l,"bpmn:Participant")||S(l,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>S(l,"bpmn:Artifact"))),c=new Set;return H(o,l=>{const u=new Set(Co(jo(Array.from(s),Zt(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}we(Sp,ne),Sp.$inject=["injector","eventBus","canvas"];function Rp(e,t){e.invoke(ne,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Qe(r.incoming.concat(r.outgoing),function(a){return S(a,"bpmn:Association")});H(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}we(Rp,ne),Rp.$inject=["injector","modeling"];function Yo(e,t){for(Hn(t)&&(t=[t]);e=e.parent;)if(Ze(e,t))return e;return null}function zg(e,t){var n=Yo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Yo(e,i),n)return pn(n);if(Ze(e,i))return pn(e);var r;for(r=oe(e);r&&!S(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=oe(a);return s&&s.get("processRef")===r});return o?pn(o):!0}var Gg=500;function Cc(e,t){t.invoke(ne,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Gg,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Vg(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",Gg,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Vg(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Cc.$inject=["bpmnReplace","injector"],we(Cc,ne),Cc.prototype._replaceShape=function(e,t){var n=HA(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function HA(e){var t=oe(e),n=t.eventDefinitions;return n&&n[0]}function Vg(e,t){return!Xe(e)&&Ze(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Cp(e,t){ne.call(this,e);function n(i){return Qe(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")&&H(o.outgoing,function(a){var s=a.target,c=n(s);S(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Cp.$inject=["eventBus","modeling"],we(Cp,ne);function Wg(e){return e.create("bpmn:Category")}function zA(e){return e.create("bpmn:CategoryValue")}function Ug(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=zA(e)),n.$parent||(n.$parent=Wg(e)),n}function GA(e,t,n){return Yt(t.get("categoryValue"),e),e.$parent=t,Yt(n.get("rootElements"),t),t.$parent=n,e}function VA(e){var t=e.$parent;return t&&(Wt(t.get("categoryValue"),e),e.$parent=null),e}function WA(e){var t=e.$parent;return t&&(Wt(t.get("rootElements"),e),e.$parent=null),e}var UA=500;function Ap(e,t,n){n.invoke(ne,this);function i(c){return t.filter(function(l){return S(l,"bpmn:Group")&&!l.labelTarget}).map(oe).filter(function(l){return l!==c})}function r(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function o(c,l){return i(l).some(function(u){var f=u.get("categoryValueRef");return f&&f.$parent===c})}function a(c,l){c&&l&&GA(c,l,e.getDefinitions())}function s(c,l,u){l&&!o(l,u)&&WA(l),c&&!r(c,u)&&VA(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!S(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!S(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,oe(l))},!0),this.executed(["shape.move","shape.resize"],UA,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,oe(l))},!0),this.executed("group.updateRefs",function(c){Yg(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){Yg(c).forEach(function(l){s(l.categoryValue,l.category,oe(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,oe(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Ap.$inject=["bpmnjs","elementRegistry","injector"],we(Ap,ne);function Yg(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Pp(e,t,n){ne.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(y){const v=y.source,g=y.target;qo(v)&&Va(g)&&u(g)}function r(y){const v=y.connection,g=y.source,b=y.target;qo(g)&&Ac(b)&&(l(b),p(g,[v]))}function o(y){const v=y.newTarget,g=y.oldSource,b=y.oldTarget;if(b!==v){const x=g;Va(b)&&u(b),qo(x)&&Ac(v)&&l(v)}}function a(y){const{element:v}=y;Va(v)?(f(v),d(v)):Ac(v)&&m(v)}function s(y){const{newData:v,oldShape:g}=y;if(qo(y.oldShape)&&v.eventDefinitionType!=="bpmn:CompensateEventDefinition"||v.type!=="bpmn:BoundaryEvent"){const b=g.outgoing.find(({target:x})=>Va(x));b&&b.target&&(y._connectionTarget=b.target)}else if(!qo(y.oldShape)&&v.eventDefinitionType==="bpmn:CompensateEventDefinition"&&v.type==="bpmn:BoundaryEvent"){const b=g.outgoing.find(({target:x})=>Ac(x));b&&b.target&&(y._connectionTarget=b.target),h(g)}}function c(y){const{_connectionTarget:v,newShape:g}=y;v&&t.connect(g,v)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function f(y){for(const v of y.incoming)n.canConnect(v.source,y)||t.removeConnection(v);for(const v of y.outgoing)n.canConnect(y,v.target)||t.removeConnection(v)}function p(y,v){y.outgoing.filter(x=>S(x,"bpmn:Association")).filter(x=>Va(x.target)&&!v.includes(x)).forEach(x=>t.removeConnection(x))}function d(y){const v=y.attachers.slice();v.length&&t.removeElements(v)}function m(y){const v=y.incoming.filter(g=>qo(g.source));t.removeElements(v)}function h(y){const v=y.outgoing.filter(g=>S(g,"bpmn:SequenceFlow"));t.removeElements(v)}}we(Pp,ne),Pp.$inject=["eventBus","modeling","bpmnRules"];function Va(e){const t=oe(e);return t&&t.get("isForCompensation")}function qo(e){return e&&S(e,"bpmn:BoundaryEvent")&&Vo(e,"bpmn:CompensateEventDefinition")}function Ac(e){return e&&S(e,"bpmn:Activity")&&!Tn(e)}function Mp(e){e.invoke(ne,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=Yo(i,"bpmn:Participant"))})}Mp.$inject=["injector"],we(Mp,ne);function Tp(e,t){ne.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}})}Tp.$inject=["eventBus","bpmnFactory"],we(Tp,ne);var kp=20,Op=20,qg=30,Pc=2e3;function Dp(e,t,n){ne.call(this,t),t.on(["create.start","shape.move.start"],Pc,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(f){return!S(f,"bpmn:Group")&&!Xe(f)&&!gt(f)});if(c.length){var l=Zt(c),u=YA(a,l);W(a,u),o.createConstraints=qA(a,l)}}}),t.on("create.start",Pc,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}S(a,"bpmn:Participant")&&S(s,"bpmn:Process")&&(t.on("element.hover",Pc,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var r=e.getRootElement();return S(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Pc,function(r){var o=r.elements,a=r.parent,s=KA(o),c;s&&S(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=oe(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=oe(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)&&oe(s).set("processRef",oe(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,l=o.participant;a&&(!l||c===l)&&oe(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 l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}Dp.$inject=["canvas","eventBus","modeling"],we(Dp,ne);function YA(e,t){t={width:t.width+kp*2+qg,height:t.height+Op*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 qA(e,t){return t=De(t),{bottom:t.top+e.height/2-Op,left:t.right-e.width/2+kp,top:t.bottom-e.height/2+Op,right:t.left+e.width/2-kp-qg}}function KA(e){return wt(e,function(t){return S(t,"bpmn:Participant")})}var Kg="__targetRef_placeholder";function Ip(e,t){ne.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Xg(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Xg(o));function n(a,s,c){var l=a.get("dataInputAssociations");return wt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=wt(c,function(u){return u.name===Kg});return!l&&s&&(l=t.create("bpmn:Property",{name:Kg}),Yt(c,l)),l}function r(a,s){var c=i(a);c&&(n(a,c,s)||Wt(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,f=u&&u.businessObject,p=s.newTarget,d=p&&p.businessObject,m=s.oldTarget||s.target,h=m&&m.businessObject,y=c.businessObject,v;h&&h!==f&&r(h,l),d&&d!==f&&r(d,l),f?(v=i(f,!0),y.targetRef=v):y.targetRef=null}}Ip.$inject=["eventBus","bpmnFactory"],we(Ip,ne);function Xg(e){return function(t){var n=t.context,i=n.connection;if(S(i,"bpmn:DataInputAssociation"))return e(t)}}function Mc(e){this._bpmnUpdater=e}Mc.$inject=["bpmnUpdater"],Mc.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),[]},Mc.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 Lp(e,t,n,i){ne.call(this,i),t.registerHandler("dataStore.updateContainment",Mc);function r(){return n.filter(function(s){return S(s,"bpmn:Participant")&&oe(s).processRef})[0]}function o(s){return s.children.filter(function(c){return S(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||r(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:st(s),newSemanticParent:u.processRef||u,newDiParent:st(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(f){return S(f,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(f){return!S(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&S(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,f=l.parent;if(!S(u,"bpmn:Collaboration")&&S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&S(f,"bpmn:Collaboration")){var p=S(u,"bpmn:Participant")?u:ZA(u,"bpmn:Participant");a(l,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();Ze(l,["bpmn:Participant","bpmn:SubProcess"])&&S(u,"bpmn:Collaboration")&&o(u).filter(function(f){return XA(f,l)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,f=o(l);f.forEach(function(p){S(u,"bpmn:Process")&&a(p,u)})})}Lp.$inject=["canvas","commandStack","elementRegistry","eventBus"],we(Lp,ne);function XA(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 ZA(e,t){for(;e.parent;){if(S(e.parent,t))return e.parent;e=e.parent}}var Tc=Math.max,kc=Math.min,QA=20;function Zg(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function JA(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 eP(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 Oc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Fe(r)&&(i=(/top|left/.test(e)?kc:Tc)(i,r)),Fe(o)&&(i=(/top|left/.test(e)?Tc:kc)(i,o)),i}function tP(e,t){if(!t)return e;var n=De(e);return hc({top:Oc("top",n,t),right:Oc("right",n,t),bottom:Oc("bottom",n,t),left:Oc("left",n,t)})}function nP(e,t,n,i){var r=De(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?De(i):o,s={top:kc(o.top,a.top),left:kc(o.left,a.left),bottom:Tc(o.bottom,a.bottom),right:Tc(o.right,a.right)};return hc(s)}function Wa(e,t){return typeof e<"u"?e:QA}function iP(e,t){var n,i,r,o;return typeof t=="object"?(n=Wa(t.left),i=Wa(t.right),r=Wa(t.top),o=Wa(t.bottom)):n=i=r=o=Wa(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function rP(e){return!(e.waypoints||e.type==="label")}function Qg(e,t){var n;if(e.length===void 0?n=Qe(e.children,rP):n=e,n.length)return iP(Zt(n),t)}var Cr=Math.abs;function oP(e,t){return Zg(De(t),De(e))}var aP=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],fi=30;function Dc(e,t){return t=t||[],e.children.filter(function(n){S(n,"bpmn:Lane")&&(Dc(n,t),t.push(n))}),t}function Ar(e){return e.children.filter(function(t){return S(t,"bpmn:Lane")})}function di(e){return Yo(e,aP)||e}function sP(e,t){var n=di(e),i=S(n,"bpmn:Process")?[]:[n],r=Dc(n,i),o=De(e),a=De(t),s=oP(e,t),c=[],l=pn(e);return r.forEach(function(u){if(u!==e){var f=l?0:s.top,p=l?s.right:0,d=l?0:s.bottom,m=l?s.left:0,h=De(u);s.top&&(Cr(h.bottom-o.top)<10&&(d=a.top-h.bottom),Cr(h.top-o.top)<5&&(f=a.top-h.top)),s.left&&(Cr(h.right-o.left)<10&&(p=a.left-h.right),Cr(h.left-o.left)<5&&(m=a.left-h.left)),s.bottom&&(Cr(h.top-o.bottom)<10&&(f=a.bottom-h.top),Cr(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(Cr(h.left-o.right)<10&&(m=a.right-h.left),Cr(h.right-o.right)<5&&(p=a.right-h.right)),(f||p||d||m)&&c.push({shape:u,newBounds:eP(u,{top:f,right:p,bottom:d,left:m})})}}),c}var cP=500;function Bp(e,t){ne.call(this,e);function n(i,r){var o=pn(i),a=Ar(r),s=[],c=[],l=[],u=[];if(no(a,function(y){return o?y.y>i.y?c.push(y):s.push(y):y.x>i.x?u.push(y):l.push(y),y.children}),!!a.length){var f;o?c.length&&s.length?f=i.height/2:f=i.height:u.length&&l.length?f=i.width/2:f=i.width;var p,d,m,h;s.length&&(p=t.calculateAdjustments(s,"y",f,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:f},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-f,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-f},"n")),l.length&&(m=t.calculateAdjustments(l,"x",f,i.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:f,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-f,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",cP,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))})}Bp.$inject=["eventBus","spaceTool"],we(Bp,ne);var Jg=500;function Ic(e,t){t.invoke(ne,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Jg,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return ey(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",Jg,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;ey(a,uP(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Ic.$inject=["bpmnReplace","injector"],we(Ic,ne),Ic.prototype._replaceShape=function(e){var t=lP(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function lP(e){var t=oe(e),n=t.eventDefinitions;return n&&n[0]}function ey(e,t){return!Xe(e)&&S(e,"bpmn:BoundaryEvent")&&!t}function uP(e,t){return e.indexOf(t)!==-1}var Lc=Math.round,pP=Math.max;function fP(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 dP(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var ty=10;function hP(e,t){var n,i;for(n=0;i=e[n];n++)if(La(i,t)<=ty)return{point:e[n],bendpoint:!0,index:n};return null}function mP(e,t){var n=ag(fP(t,ty),dP(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=pP(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Lc(i.x+r.x)/2,y:Lc(i.y+r.y)/2},index:i.segment2}:{point:{x:Lc(i.x),y:Lc(i.y)},index:i.segment2}:null}function Np(e,t){return hP(e,t)||mP(e,t)}function $p(e,t,n){ne.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,f,p,d,m,h=r.outgoing.slice(),y=r.incoming.slice(),v;Fe(a.width)?v=Le(a):v=a;var g=Np(s,v);if(g){if(c=s.slice(0,g.index),l=s.slice(g.index+(g.bendpoint?1:0)),!c.length||!l.length)return;u=g.bendpoint?s[g.index]:v,(c.length===1||!ny(r,c[c.length-1]))&&c.push(iy(u)),(l.length===1||!ny(r,l[0]))&&l.unshift(iy(u))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||v),d=o),t.canConnect(r,p,o)&&(d?m=n.connect(r,p,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||v),m=o));var b=[].concat(d&&Qe(y,function(x){return x.source===d.source})||[],m&&Qe(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 l=Le(c),u={x:l.x+s.x,y:l.y+s.y},f=wt(o.children,function(p){var d=t.canInsert(a,p);return d&&Np(p.waypoints,u)});f&&(r.targetFlow=f,r.position=u)}},!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)}we($p,ne),$p.$inject=["eventBus","bpmnRules","modeling"];function ny(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 iy(e){return W({},e)}function Fp(e,t){ne.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)&&Ko(r)){var c=[];S(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==r&&Ko(l)):c=a.incoming.filter(l=>l!==r&&Ko(l)&&S(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(S(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(Ko).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Ko).forEach(function(s){const c=a.incoming.filter(Ko).filter(function(l){return l.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}Fp.$inject=["eventBus","modeling"],we(Fp,ne);function Ko(e){return S(e,"bpmn:SequenceFlow")}var Bc=1500,ry=2e3;function oy(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"],Bc,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;S(a,"bpmn:Lane")&&!Ze(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=di(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Ze(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"],Bc,function(i){var r=i.hover;S(r,"bpmn:Lane")&&(i.hover=di(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Bc,function(i){var r=i.context,o=i.hover,a=r.type;S(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=di(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Bc,function(i){var r=i.context,o=r.start;S(o,"bpmn:Lane")&&(r.start=di(o)||o)}),t.on("shape.move.start",ry,function(i){var r=i.shape;S(r,"bpmn:Lane")&&(i.shape=di(r)||r)}),t.on("spaceTool.move",ry,function(i){var r=i.hover;r&&S(r,"bpmn:Lane")&&(i.hover=di(r))})}oy.$inject=["elementRegistry","eventBus","canvas"];var ay=770;function jp(e,t,n,i){n.invoke(ne,this);function r(s,c){var l=oe(s),u=c.categoryValue||l.categoryValueRef;u||(u=Ug(e,l));var f=c.category||u.$parent||Wg(e);l.categoryValueRef=u,u.$parent=f,c.categoryValue=u,c.category=f}function o(s,c){var l=oe(s),u=c.categoryValue||l.categoryValueRef,f=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=f,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;S(l,"bpmn:Group")&&r(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;S(l,"bpmn:Group")&&o(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=oe(l);if(!(!S(l,"bpmn:Group")||l.labelTarget)){var f=c.categoryValue=u.categoryValueRef;f&&(c.category=f.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!S(l,"bpmn:Group")||l.labelTarget)){var u=c.category,f=c.categoryValue,p=oe(l);f&&(p.categoryValueRef=f,f.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!S(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!oe(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!S(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!oe(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||oe(l).categoryValueRef||r(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||o(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",ay,function(s){var c=s.descriptor,l=s.element;if(!(!S(l,"bpmn:Group")||l.labelTarget)){var u=oe(l);if(u.categoryValueRef){var f=u.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",ay,function(s){var c=s.descriptor,l=c.businessObject,u=c.categoryValue,f=c.category;u&&(u=l.categoryValueRef=a(u)),f&&(u.$parent=a(f)),delete c.category,delete c.categoryValue})}jp.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],we(jp,ne);function Hp(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 sy(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=Hp(i,r,o,a),l=Hp(i,r,o,s),u;c&&l?cy(c,o)>cy(l,o)?u=l:u=c:u=c||l,i.original=u}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)})}sy.$inject=["eventBus"];function cy(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function zp(e){ne.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=oe(i),o=st(i);if(Ze(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}zp.$inject=["eventBus"],we(zp,ne);function ly(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function uy(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function gP(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 yP(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 Gp(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=yP([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 py(e,t){var n=Gp(e,t),i={x:n.x-e.x,y:n.y-e.y};return ly(i)}function Ua(e,t){return ly({x:e.x-t.x,y:e.y-t.y})}var fy=Math.sqrt,dy=Math.min,vP=Math.max,hy=Math.abs;function my(e){return Math.pow(e,2)}function Ya(e,t){return fy(my(e.x-t.x)+my(e.y-t.y))}function bP(e,t){var n=0,i,r,o,a,s,c,l,u,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],yy(i,r)?l=[i]:(o=Ya(e,i),a=Ya(e,r),c=dy(o,a),l=xP(i,r,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:yy(i,l[0])?n:n+1}),l.length===2&&(s=wP(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Ya(i,s)/Ya(i,r)}),f=Ya(u.position,e),(!d||p>f)&&(d=u,p=f)}return d}function xP(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,l=r*a+o*s,u=a*a+s*s-i*i,f=l/c,p=u/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var m=fy(d),h=-f+m,y=-f-m,v={x:e.x-r*h,y:e.y-o*h};if(d===0)return[v];var g={x:e.x-r*y,y:e.y-o*y};return[v,g].filter(function(b){return _P(b,e,t)})}function _P(e,t,n){return gy(e.x,t.x,n.x)&&gy(e.y,t.y,n.y)}function gy(e,t,n){return e>=dy(t,n)-Nc&&e<=vP(t,n)+Nc}function wP(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Nc=.1;function yy(e,t){return hy(e.x-t.x)<=Nc&&hy(e.y-t.y)<=Nc}function EP(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,l=i.bendpointMove.bendpointIndex,u;if(o===0)return r;if(r>=l&&(u=c?r+1:r-1),r<l&&(u=r,c&&n.type!=="bendpoint"&&l-1===r)){var f=by(t,l);f<n.relativeLocation&&u++}return u}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 vy(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=bP(e,n),c=s.segmentIndex,l=EP(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=xy(n,c),f=xy(t,l),p=s.position,d=RP(u,p),m=SP(u,f);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,v=n[y];if(t.indexOf(v)!==-1)return a;if(h===0){var g=t[y];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&&y!==0&&y<n.length-1&&(d=by(n,y))}var b={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},x=gP({x:e.x-p.x,y:e.y-p.y},m);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:Ji(b),delta:Ji({x:r,y:o})}}function by(e,t){var n=Ua(e[t-1],e[t]),i=Ua(e[t],e[t+1]),r=n/(n+i);return r}function SP(e,t){var n=uy(e),i=uy(t);return i-n}function xy(e,t){return[e[t],e[t+1]]}function RP(e,t){var n=Ua(e[0],e[1]),i=Ua(e[0],t);return n===0?0:i/n}function CP(e,t,n,i){var r=Le(e);return vy(r,t,n,i).delta}function qa(e,t,n){var i=Ga(t),r=Ga(n),o=Ci(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Ji({x:r.x+a.x,y:r.y+a.y})}function _y(e,t,n){var i=Ga(e),r=Ga(t),o=Ga(n),a=Ci(e,i),s=Ci(i,r),c=AP(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:o.x+l.x,y:o.y+l.y};return Ji({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function AP(e,t,n){var i=De(t),r=De(n);if(PP(i,r))return null;var o=bn(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=bn(n,s),c!==o?null:a}function PP(e,t){return MP(e,t)||TP(e,t)}function MP(e,t){return e.right!==t.right&&e.left!==t.left}function TP(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var wy="name",Ey="text";function Vp(e,t,n,i){ne.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{oe(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(wy in l&&t.updateLabel(c,l[wy]),Ey in l&&S(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Ey]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;Xe(l)||!Rr(l)||ci(l)&&t.updateLabel(l,ci(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,l=c.label,u=W({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),CP(l,f,p,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,f;!u||!u.parent||(f=o(a),t.moveShape(u,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=oe(c);u&&Rr(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!Xe(c)||l.autoResize)){var u=s.newBounds,f=i.getDimensions(ci(c)||"",{box:u,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=u.y!==c.y,m=c.y+c.height;s.newBounds={width:u.width,height:p,x:u.x,y:d?m-p:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(xc(c)){var f=c.label,p=Le(f),d=DP(u),m=OP(p,d),h=kP(m,u,l);t.moveShape(f,h)}})}we(Vp,ne),Vp.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function kP(e,t,n){var i=qa(e,t,n);return Ji(Ci(i,e))}function OP(e,t){if(t.length){var n=IP(e,t);return Gp(e,n)}}function DP(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 IP(e,t){var n=t.map(function(r){return{line:r,distance:py(e,r)}}),i=Pi(n,"distance");return i[0].line}function LP(e,t,n,i){return vy(e,t,n,i).point}function Wp(e,t){ne.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=W({},o.hints),c=o.newWaypoints||a.waypoints,l=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),LP(r,c,l,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 l=c.waypoints[c.waypoints.length-1],u=n(i,l),f=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,f)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),f=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,f)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],f={x:u.x+c.x,y:u.y+c.y},p=[].concat(l.waypoints.slice(0,-1),[f]);t.updateWaypoints(l,p)}),a.forEach(function(l){var u=l.waypoints[0],f={x:u.x+c.x,y:u.y+c.y},p=[].concat([f],l.waypoints.slice(1));t.updateWaypoints(l,p)})})}we(Wp,ne),Wp.$inject=["eventBus","modeling"];function $c(e,t,n){var i=jc(e),r=Ry(i,t),o=i[0];return r.length?r[r.length-1]:qa(o.original||o,n,t)}function Fc(e,t,n){var i=jc(e),r=Ry(i,t),o=i[i.length-1];return r.length?r[0]:qa(o.original||o,n,t)}function Up(e,t,n){var i=jc(e),r=Sy(t,n),o=i[0];return qa(o.original||o,r,t)}function Yp(e,t,n){var i=jc(e),r=Sy(t,n),o=i[i.length-1];return qa(o.original||o,r,t)}function Sy(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function jc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Ry(e,t){var n=Cn(e,NP);return Qe(n,function(i){return BP(i,t)})}function BP(e,t){return bn(t,e,1)==="intersect"}function NP(e){return e.original||e}function qp(e,t){ne.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if($P(i,r)){var o=FP(i);o.incoming.forEach(function(a){var s=Fc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=$c(a,r,i);t.reconnectStart(a,r,s)})}},!0)}qp.$inject=["eventBus","modeling"],we(qp,ne);function $P(e,t){return S(e,"bpmn:Participant")&&et(e)&&S(t,"bpmn:Participant")&&!et(t)}function FP(e){var t=Da([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 jP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Cy(e){const t=oe(e);if(!S(t,"bpmn:BoundaryEvent")&&!(S(t,"bpmn:StartEvent")&&Tn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:jP.some(i=>S(n[0],i))}function Ay(e){return S(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Kp(e,t){e.invoke(ne,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Cy(r))return;const a=Ay(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=oe(i).get(a),l=oe(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}Kp.$inject=["injector","modeling"],we(Kp,ne);function Xp(e,t){ne.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=st(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}we(Xp,ne),Xp.$inject=["eventBus","modeling"];function Zp(e,t,n){ne.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=HP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}we(Zp,ne),Zp.$inject=["eventBus","bpmnRules","modeling"];function Xo(e){return e.original||e}function HP(e,t){var n=Hp(Xo(e[e.length-2]),Xo(e[e.length-1]),Xo(t[1]),Xo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Xo(e[0]),Xo(t[t.length-1])]}function Qp(e,t){ne.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)}Qp.$inject=["eventBus","modeling"],we(Qp,ne);function Jp(e,t,n,i){ne.call(this,e);var r=i.get("dragging",!1);function o(c){var l=c.source,u=c.target,f=c.parent;if(f){var p,d;S(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(p="bpmn:MessageFlow")),S(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(l,u,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,f=l.newSource||u.source,p=l.newTarget||u.target,d,m;d=n.canConnect(f,p),!(!d||d.type===u.type)&&(m=t.connect(f,p,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=m,r&&s(u,m))}function s(c,l){var u=r.context(),f=u&&u.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;H(u,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,f=l.element,p=f.businessObject,d;u.default&&(d=wt(f.outgoing,Po({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}we(Jp,ne),Jp.$inject=["eventBus","modeling","bpmnRules","injector"];function Hc(e,t,n,i,r,o){i.invoke(ne,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=Gn(l,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];H(s.closure.topLevel,function(p){Tn(p)?u=u.concat(p.children):u=u.concat(p)}),u.length===1&&l&&(c=l);var f=t.canReplace(u,c);f&&this._replaceElements(u,f.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,f;u&&u.length&&(f=t.canReplace(u,l),this._replaceElements(u,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(l,{id:c.id})})}we(Hc,ne),Hc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;H(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)},Hc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var zP=1500,GP={width:140,height:120},ef={width:300,height:60},tf={width:60,height:300},zc={width:300,height:150},Gc={width:150,height:300},Py={width:140,height:120},My={width:100,height:40};function Ty(e){e.on("resize.start",zP,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=qP(i,r,o)),S(i,"bpmn:SubProcess")&&et(i)&&(n.minDimensions=Py),S(i,"bpmn:TextAnnotation")&&(n.minDimensions=My)})}Ty.$inject=["eventBus"];var Pr=Math.abs,VP=Math.min,WP=Math.max;function ky(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Zo(e,t,n){return ky(e,t,n,VP)}function Qo(e,t,n){return ky(e,t,n,WP)}var UP={top:20,left:50,right:20,bottom:20},YP={top:50,left:20,right:20,bottom:20};function qP(e,t,n){var i=di(e),r=!0,o=!0,a=Dc(i,[i]),s=De(e),c={},l={},u=pn(e),f=u?ef:tf;/n/.test(t)?l.top=s.bottom-f.height:/e/.test(t)?l.right=s.left+f.width:/s/.test(t)?l.bottom=s.top+f.height:/w/.test(t)&&(l.left=s.right-f.width),a.forEach(function(m){var h=De(m);u?(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&&Pr(s.top-h.bottom)<10&&Qo(c,"top",h.top+f.height),Pr(s.top-h.top)<5&&Zo(l,"top",h.bottom-f.height)),/e/.test(t)&&(n&&Pr(s.right-h.left)<10&&Zo(c,"right",h.right-f.width),Pr(s.right-h.right)<5&&Qo(l,"right",h.left+f.width)),/s/.test(t)&&(n&&Pr(s.bottom-h.top)<10&&Zo(c,"bottom",h.bottom-f.height),Pr(s.bottom-h.bottom)<5&&Qo(l,"bottom",h.top+f.height)),/w/.test(t)&&(n&&Pr(s.left-h.right)<10&&Qo(c,"left",h.left+f.width),Pr(s.left-h.left)<5&&Zo(l,"left",h.right-f.width))});var p=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(S(m,"bpmn:FlowElement")||S(m,"bpmn:Artifact"))}),d=u?UP:YP;return p.forEach(function(m){var h=De(m);/n/.test(t)&&(!u||r)&&Zo(l,"top",h.top-d.top),/e/.test(t)&&(u||o)&&Qo(l,"right",h.right+d.right),/s/.test(t)&&(!u||o)&&Qo(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||r)&&Zo(l,"left",h.left-d.left)}),{min:l,max:c}}function Oy(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Jo(e){return e.originalEvent||e.srcEvent}function nf(e){Oy(e),Oy(Jo(e))}function ao(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 Dy(){return/mac/i.test(navigator.platform)}function Iy(e,t){return(Jo(e)||e).button===t}function Mr(e){return Iy(e,0)}function KP(e){return Iy(e,1)}function Ka(e){var t=Jo(e)||e;return Mr(e)?Dy()?t.metaKey:t.ctrlKey:!1}function Vc(e){var t=Jo(e)||e;return Mr(e)&&t.shiftKey}var Ly=1001;function By(e,t){e.on("resize.start",Ly+500,function(n){var i=n.context,r=i.shape;(S(r,"bpmn:Lane")||S(r,"bpmn:Participant"))&&(i.balanced=!Ka(n))}),e.on("resize.end",Ly,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=pg(a),t.resizeLane(r,a,i.balanced)),!1})}By.$inject=["eventBus","modeling"];var XP=500;function rf(e,t,n,i,r){n.invoke(ne,this);function o(u){return Ze(u,["bpmn:ReceiveTask","bpmn:SendTask"])||ZP(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var f=e.getDefinitions(),p=f.get("rootElements");return!!wt(p,Po({id:u.id}))}function s(u){if(S(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(S(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(S(u,"bpmn:MessageEventDefinition"))return"messageRef";if(S(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(Ze(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var f=u.get("eventDefinitions"),p=f[0];return p.get(s(p))}function l(u,f){if(Ze(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",f);var p=u.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var f=u.shape||u.element;if(o(f)){var p=oe(f),d=c(p),m;d&&!a(d)&&(m=e.getDefinitions().get("rootElements"),Yt(m,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var f=u.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");Wt(p,f)}},!0),t.on("copyPaste.copyElement",function(u){var f=u.descriptor,p=u.element;if(!(p.labelTarget||!o(p))){var d=oe(p),m=c(d);m&&(f.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",XP,function(u){var f=u.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),l(p,d),delete f.referencedRootElement)})}rf.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],we(rf,ne);function ZP(e,t){return Ie(t)||(t=[t]),hr(t,function(n){return Vo(e,n)})}var Ny=Math.max;function $y(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return H(n,function(a){var s=a.id;S(a,"bpmn:Participant")&&(o[s]=JP(a,i,r)),S(a,"bpmn:Lane")&&(o[s]=pn(a)?ef:tf),S(a,"bpmn:SubProcess")&&et(a)&&(o[s]=Py),S(a,"bpmn:TextAnnotation")&&(o[s]=My),S(a,"bpmn:Group")&&(o[s]=GP)}),o})}$y.$inject=["eventBus"];function QP(e){return e==="x"}function JP(e,t,n){var i=pn(e);if(!nM(e))return i?zc:Gc;var r=QP(t),o={};return r?i?o=zc:o={width:tM(e,n,r),height:Gc.height}:i?o={width:zc.width,height:eM(e,n,r)}:o=Gc,o}function eM(e,t,n){var i;return i=iM(e,t,n),Ny(zc.height,i)}function tM(e,t,n){var i;return i=rM(e,t,n),Ny(Gc.width,i)}function nM(e){return!!Ar(e).length}function iM(e,t,n){var i=Ar(e),r;return r=of(i,t,n),e.height-r.height+ef.height}function rM(e,t,n){var i=Ar(e),r;return r=of(i,t,n),e.width-r.width+tf.width}function of(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=Ar(r),o.length?of(o,t,n):r}var Fy="_plane";function jy(e){var t=e.id;return oM(t)}function $i(e){var t=e.id;return S(e,"bpmn:SubProcess")?Hy(t):t}function so(e){return Hy(e)}function Wc(e){var t=st(e);return S(t,"bpmndi:BPMNPlane")}function Hy(e){return e+Fy}function oM(e){return e.replace(new RegExp(Fy+"$"),"")}var zy=400,aM=600,Gy={x:180,y:160};function ir(e,t,n,i,r,o,a){ne.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(f){return S(f,"bpmn:SubProcess")&&!et(f)}function l(f){var p=f.shape,d=f.newRootElement,m=oe(p);d=s._addDiagram(d||m),f.newRootElement=e.addRootElement(d)}function u(f){var p=f.shape,d=oe(p);s._removeDiagram(d);var m=f.newRootElement=a.get($i(d));e.removeRootElement(m)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;H(p,function(d){if(c(d)){var m=a.get($i(d));if(!(!m||!d.children||!d.children.length)){var h=Vy(d);s._showRecursively(h),s._moveChildrenToShape(h,m)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!S(p,"bpmn:SubProcess")||!et(p)||H(Fa([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get($i(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement($i(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,m=e.findRoot($i(p));if(!(!d||!m)){var h=d.children;n.moveElements(h,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(S(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,y=d.id;if(h!==y){if(Wc(p)){a.updateId(p,so(y)),a.updateId(h,y);return}var v=a.get(so(h));v&&a.updateId(so(h),so(y))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(S(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,y=d.id;if(h!==y){if(Wc(p)){a.updateId(p,so(h)),a.updateId(y,h);return}var v=a.get(so(y));v&&a.updateId(v,so(h))}}},!0),t.on("element.changed",function(f){var p=f.element;if(Wc(p)){var d=p,m=a.get(jy(d));!m||m===d||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",zy,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(et(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",zy,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(et(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",aM,function(f){var p=f.shape;if(S(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(et(p))s._moveChildrenToShape(d.children.slice(),p),H(Fa(p.children),h=>{n.moveShape(h.annotation,{x:0,y:0},p.parent),H(h.associations,y=>{n.moveConnection(y,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var m=Vy(p);s._moveChildrenToShape(m,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var m=$i(p),h=a.get(m);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,m=f.elements,h=d.parent,y=S(st(h),"bpmndi:BPMNPlane");if(y){var v=jy(h),g=wt(m,function(b){return b.id===v});g&&(p.parent=g.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}we(ir,ne),ir.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=Zt(i),o;if(!t.x)o={x:Gy.x-r.x,y:Gy.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})}},ir.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Ig(e).map(i=>i.annotation));n.size&&H(Fa(e.children),i=>{n.has(i.annotation)&&H(i.associations,r=>{t.removeConnection(r)})})},ir.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},ir.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},ir.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:$i(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},ir.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=wt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},ir.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function sM(e){var t=[];return H(Fa(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Vy(e){return e.children.slice().concat(sM(e.children)).concat(cM(e))}function cM(e){return lp(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function af(e,t){e.invoke(ne,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"))||!et(r))){var o=lM(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}af.$inject=["injector","modeling"],we(af,ne);function lM(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function sf(e,t){ne.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,ci(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,l=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}we(sf,ne),sf.$inject=["eventBus","textRenderer"];function cf(e,t){ne.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(et(i))return;var r=Da(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();H(s,function(l){o(l,!0)}),H(c,function(l){o(l,!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)}we(cf,ne),cf.$inject=["eventBus","modeling"];var lf=500;function uf(e,t,n){ne.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,l=s,u,f;return u=uM(c).concat([a]),f=Qg(u),f?(l.width=Math.max(f.width,l.width),l.height=Math.max(f.height,l.height),l.x=f.x+(f.width-l.width)/2,l.y=f.y+(f.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}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"],lf,function(a){var s=a.context,c=s.shape;S(c,"bpmn:SubProcess")&&(c.collapsed?st(c).isExpanded=!1:(i(c.children),st(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],lf,function(a){var s=a.context,c=s.shape;c.collapsed?st(c).isExpanded=!1:st(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],lf,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=o(s,c):l=r(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}we(uf,ne),uf.$inject=["eventBus","elementFactory","modeling"];function uM(e){return e.filter(function(t){return!t.hidden})}function pf(e,t,n,i){t.invoke(ne,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Xe(a)||(S(a,"bpmn:Participant")&&et(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)})}we(pf,ne),pf.$inject=["canvas","injector","moddle","modeling"];function ff(e,t){ne.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;pM(r,o)&&t.updateProperties(o,{default:null})})}we(ff,ne),ff.$inject=["eventBus","modeling"];function pM(e,t){if(!S(e,"bpmn:SequenceFlow"))return!1;var n=oe(t),i=oe(e);return n.get("default")===i}var fM=500,dM=5e3,Wy=["shape.create","shape.delete","shape.move","shape.resize"],Uy=[...Wy,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function df(e,t){ne.call(this,e);var n;function i(){return n=n||new hM,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(Uy,dM,function(){i()}),this.postExecuted(Uy,fM,function(){o()}),this.preExecute(Wy,function(a){var s=a.context,c=s.shape,l=r();!c||c.labelTarget||(S(c,"bpmn:Lane")&&l.addLane(c),S(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}df.$inject=["eventBus","modeling"],we(df,ne);function hM(){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 mM=500,gM=5e3,Yy=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],qy=[...Yy,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function hf(e,t){ne.call(this,e);var n;function i(){return n=n||new yM,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(qy,gM,function(){i()}),this.postExecuted(qy,mM,function(){o()}),this.preExecute(Yy,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)})}hf.$inject=["eventBus","modeling"],we(hf,ne);function yM(){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 mf(e,t){ne.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)vM(o)&&!xM(o)&&t.updateProperties(o,{isForCompensation:void 0})})}we(mf,ne),mf.$inject=["eventBus","modeling"];function vM(e){const t=oe(e);return t&&t.isForCompensation}function bM(e){return e&&S(e,"bpmn:BoundaryEvent")&&Vo(e,"bpmn:CompensateEventDefinition")}function xM(e){return e.incoming.filter(n=>bM(n.source)).length>0}const _M={__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",wp],appendBehavior:["type",Ep],associationBehavior:["type",Rp],attachEventBehavior:["type",Cc],artifactBehavior:["type",Sp],boundaryEventBehavior:["type",Cp],categoryRootElementReferenceBehavior:["type",Ap],compensateBoundaryEventBehaviour:["type",Pp],createBehavior:["type",Mp],createDataObjectBehavior:["type",Tp],createParticipantBehavior:["type",Dp],dataInputAssociationBehavior:["type",Ip],dataStoreBehavior:["type",Lp],deleteLaneBehavior:["type",Bp],detachEventBehavior:["type",Ic],dropOnFlowBehavior:["type",$p],eventBasedGatewayBehavior:["type",Fp],fixHoverBehavior:["type",oy],groupBehavior:["type",jp],importDockingFix:["type",sy],isHorizontalFix:["type",zp],labelBehavior:["type",Vp],layoutConnectionBehavior:["type",Wp],messageFlowBehavior:["type",qp],nonInterruptingBehavior:["type",Kp],removeElementBehavior:["type",Zp],removeEmbeddedLabelBoundsBehavior:["type",Xp],removeParticipantBehavior:["type",Qp],replaceConnectionBehavior:["type",Jp],replaceElementBehaviour:["type",Hc],resizeBehavior:["type",Ty],resizeLaneBehavior:["type",By],rootElementReferenceBehavior:["type",rf],spaceToolBehavior:["type",$y],subProcessPlaneBehavior:["type",ir],subProcessStartEventBehavior:["type",af],textAnnotationBehavior:["type",sf],toggleCollapseConnectionBehaviour:["type",cf],toggleElementCollapseBehaviour:["type",uf],unclaimIdBehavior:["type",pf],unsetDefaultFlowBehavior:["type",ff],updateFlowNodeRefsBehavior:["type",df],updateCategoryValueRefsBehavior:["type",hf],setCompensationActivityAfterPasteBehavior:["type",mf]};function gf(e){this._commandStack=e.get("commandStack",!1)}gf.$inject=["injector"],gf.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const Fi={__init__:["rules"],rules:["type",gf]};function hi(e){ne.call(this,e),this.init()}hi.$inject=["eventBus"],we(hi,ne),hi.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)})},hi.prototype.init=function(){};function Ky(e,t){var n=bn(e,t,-15);return n!=="intersect"?n:null}function _n(e){hi.call(this,e)}we(_n,hi),_n.$inject=["eventBus"],_n.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return wM(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 Yc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Yc(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 cv(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return gt(i)&&!qc(t,i)?!1:Xr(t,function(r){return gt(r)?Yc(r.source,r.target,r):r.host?Xa(r,r.host,null,n):xf(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 nv(a)&&!n.includes(a.host)})?!1:Xa(n,t,null,i)||av(n,t,i)||sv(n,t)||qc(n,t)}),this.addRule("shape.create",function(e){return xf(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Xa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return dv(n,t)})},_n.prototype.canConnectMessageFlow=pv,_n.prototype.canConnectSequenceFlow=fv,_n.prototype.canConnectDataAssociation=_f,_n.prototype.canConnectAssociation=lv,_n.prototype.canConnectCompensationAssociation=uv,_n.prototype.canMove=sv,_n.prototype.canAttach=Xa,_n.prototype.canReplace=av,_n.prototype.canDrop=ea,_n.prototype.canInsert=qc,_n.prototype.canCreate=xf,_n.prototype.canConnect=Yc,_n.prototype.canResize=cv,_n.prototype.canCopy=dv;function wM(e){return yf(e)?null:Ze(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function yf(e){return!e||Xe(e)}function Xy(e){do{if(S(e,"bpmn:Process"))return oe(e);if(S(e,"bpmn:Participant"))return oe(e).processRef||oe(e)}while(e=e.parent)}function vf(e){return S(e,"bpmn:TextAnnotation")}function bf(e){return S(e,"bpmn:Group")&&!e.labelTarget}function Zy(e){return S(e,"bpmn:BoundaryEvent")&&ji(e,"bpmn:CompensateEventDefinition")}function Uc(e){return oe(e).isForCompensation}function EM(e,t){var n=Xy(e),i=Xy(t);return n===i}function SM(e){return S(e,"bpmn:InteractionNode")&&!S(e,"bpmn:BoundaryEvent")&&(!S(e,"bpmn:Event")||S(e,"bpmn:ThrowEvent")&&ev(e,"bpmn:MessageEventDefinition"))}function RM(e){return S(e,"bpmn:InteractionNode")&&!Uc(e)&&(!S(e,"bpmn:Event")||S(e,"bpmn:CatchEvent")&&ev(e,"bpmn:MessageEventDefinition"))&&!(S(e,"bpmn:BoundaryEvent")&&!ji(e,"bpmn:MessageEventDefinition"))}function Qy(e){for(var t=e;t=t.parent;){if(S(t,"bpmn:FlowElementsContainer"))return oe(t);if(S(t,"bpmn:Participant"))return oe(t).processRef}return null}function Jy(e,t){var n=Qy(e),i=Qy(t);return n===i}function ji(e,t){var n=oe(e);return!!wt(n.eventDefinitions||[],function(i){return S(i,t)})}function ev(e,t){var n=oe(e);return(n.eventDefinitions||[]).every(function(i){return S(i,t)})}function CM(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:EndEvent")&&!Tn(e)&&!(S(e,"bpmn:IntermediateThrowEvent")&&ji(e,"bpmn:LinkEventDefinition"))&&!Zy(e)&&!Uc(e)}function AM(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:StartEvent")&&!S(e,"bpmn:BoundaryEvent")&&!Tn(e)&&!(S(e,"bpmn:IntermediateCatchEvent")&&ji(e,"bpmn:LinkEventDefinition"))&&!Uc(e)}function PM(e){return S(e,"bpmn:ReceiveTask")||S(e,"bpmn:IntermediateCatchEvent")&&(ji(e,"bpmn:MessageEventDefinition")||ji(e,"bpmn:TimerEventDefinition")||ji(e,"bpmn:ConditionalEventDefinition")||ji(e,"bpmn:SignalEventDefinition"))}function MM(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function tv(e,t){var n=MM(t);return n.indexOf(e)!==-1}function Yc(e,t,n){if(yf(e)||yf(t))return null;if(!S(n,"bpmn:DataAssociation")){if(pv(e,t))return{type:"bpmn:MessageFlow"};if(fv(e,t))return{type:"bpmn:SequenceFlow"}}var i=_f(e,t);return i||(uv(e,t)?{type:"bpmn:Association",associationDirection:"One"}:lv(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function ea(e,t){return Xe(e)||bf(e)?!0:S(t,"bpmn:Participant")&&!et(t)?!1:S(e,"bpmn:Participant")?S(t,"bpmn:Process")||S(t,"bpmn:Collaboration"):Ze(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")&&!TM(e)?!1:S(e,"bpmn:FlowElement")&&!S(e,"bpmn:DataStoreReference")?S(t,"bpmn:FlowElementsContainer")?et(t):Ze(t,["bpmn:Participant","bpmn:Lane"]):S(e,"bpmn:DataStoreReference")&&S(t,"bpmn:Collaboration")?hr(oe(t).get("participants"),function(n){return!!n.get("processRef")}):Ze(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ze(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 TM(e){return oe(e).cancelActivity&&(iv(e)||rv(e))}function nv(e){return!Xe(e)&&S(e,"bpmn:BoundaryEvent")}function kM(e){return S(e,"bpmn:Lane")}function OM(e){return nv(e)||S(e,"bpmn:IntermediateThrowEvent")&&iv(e)?!0:S(e,"bpmn:IntermediateCatchEvent")&&rv(e)}function iv(e){var t=oe(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function rv(e){return ov(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function ov(e,t){return t.some(function(n){return ji(e,n)})}function DM(e){return S(e,"bpmn:ReceiveTask")&&wt(e.incoming,function(t){return S(t.source,"bpmn:EventBasedGateway")})}function Xa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Xe(r)||!OM(r)||Tn(t)||!S(t,"bpmn:Activity")||Uc(t)||i&&!Ky(i,t)||DM(t)?!1:"attach"}function av(e,t,n){if(!t)return!1;var i={replacements:[]};return H(e,function(r){Tn(t)||S(r,"bpmn:StartEvent")&&r.type!=="label"&&ea(r,t)&&(zC(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(GC(r)||VC(r)||WC(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),ov(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")||ji(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(S(r,"bpmn:EndEvent")&&ea(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),S(r,"bpmn:BoundaryEvent")&&Xa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function sv(e,t){return hr(e,kM)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return ea(n,t)})}function xf(e,t,n,i){return t?Xe(e)||bf(e)?!0:ea(e,t)||qc(e,t):!1}function cv(e,t,n){return S(e,"bpmn:SubProcess")?et(e)&&(!t||t.width>=100&&t.height>=80):S(e,"bpmn:Lane")||S(e,"bpmn:Participant")?!0:vf(e)?n?n==="e"||n==="w":!0:bf(e)?!0:Xe(e)?n?n==="e"||n==="w":!0:!1}function IM(e,t){var n=vf(e),i=vf(t);return(n||i)&&n!==i}function lv(e,t){return tv(t,e)||tv(e,t)?!1:IM(e,t)?!0:!!_f(e,t)}function uv(e,t){return Jy(e,t)&&Zy(e)&&S(t,"bpmn:Activity")&&!BM(t,e)&&!Tn(t)}function pv(e,t){return mv(e)&&!mv(t)?!1:SM(e)&&RM(t)&&!EM(e,t)}function fv(e,t){return CM(e)&&AM(t)&&Jy(e,t)&&!(S(e,"bpmn:EventBasedGateway")&&!PM(t))}function _f(e,t){return Ze(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ze(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Ze(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ze(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function qc(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:Ze(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Xe(t)&&S(e,"bpmn:FlowNode")&&!S(e,"bpmn:BoundaryEvent")&&ea(e,t.parent)}function wf(e,t){return e&&t&&e.indexOf(t)!==-1}function dv(e,t){return Xe(t)?!0:!(S(t,"bpmn:Lane")&&!wf(e,t.parent)||S(t,"bpmn:MessageFlow")&&!LM(e,t))}function LM(e,t){var n=hv(t.source),i=hv(t.target);return wf(e,n)&&wf(e,i)}function hv(e){for(;e;e=e.parent)if(S(e,"bpmn:Participant"))return e;return null}function mv(e){return Yo(e,"bpmn:Process")||Yo(e,"bpmn:Collaboration")}function BM(e,t){return e.attachers.includes(t)}const NM={__depends__:[Fi],__init__:["bpmnRules"],bpmnRules:["type",_n]};var $M=2e3;function gv(e,t){e.on("saveXML.start",$M,n);function n(){var i=t.getRootElements();H(i,function(r){var o=st(r),a,s;a=Da([r]),a=Qe(a,function(c){return c!==r&&!c.labelTarget}),s=Cn(a,st),o.set("planeElement",s)})}}gv.$inject=["eventBus","canvas"];const FM={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",gv]};function Kc(e){ne.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)})}Kc.prototype.getOrdering=function(e,t){return null},we(Kc,ne);function Ef(e,t){Kc.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=wt(n,function(c){return Ze(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 l=s;l&&!Ze(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}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 l=s.children.indexOf(a),u=rh(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}Ef.$inject=["eventBus","canvas"],we(Ef,Kc);const jM={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Ef]};function Za(){}Za.prototype.get=function(){return this._data},Za.prototype.set=function(e){this._data=e},Za.prototype.clear=function(){var e=this._data;return delete this._data,e},Za.prototype.isEmpty=function(){return!this._data};const HM={clipboard:["type",Za]};var yv=1500;function vv(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),l=c&&e.get(c);c&&l&&(a.stopPropagation(),r.hover({element:l,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",yv,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",yv,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=ao(a),c=document.elementFromPoint(s.x,s.y),zM(c)}}vv.$inject=["elementRegistry","eventBus","injector"];function zM(e){return eo(e,"svg, .djs-element",!0)}const GM={__init__:["hoverFix"],hoverFix:["type",vv]};function VM(e){return!0}function Xc(e){return Mr(e)||KP(e)}var bv=500;function xv(e,t,n){var i=this;function r(P,F,D){if(!s(P,F)){var I,z,ce;D?z=t.getGraphics(D):(I=F.delegateTarget||F.target,I&&(z=I,D=t.get(z))),!(!z||!D)&&(ce=e.fire(P,{element:D,gfx:z,originalEvent:F}),ce===!1&&(F.stopPropagation(),F.preventDefault()))}}var o={};function a(P){return o[P]}function s(P,F){var D=l[P]||Mr;return!D(F)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":VM,"element.mousedown":Xc,"element.mouseup":Xc,"element.click":Xc,"element.dblclick":Xc};function u(P,F,D){var I=c[P];if(!I)throw new Error("unmapped DOM event name <"+P+">");return r(I,F,D)}var f="svg, .djs-element";function p(P,F,D,I){var z=o[D]=function(ce){r(D,ce)};I&&(l[D]=I),z.$delegate=Wn.bind(P,f,F,z)}function d(P,F,D){var I=a(D);I&&Wn.unbind(P,F,I.$delegate)}function m(P){H(c,function(F,D){p(P,D,F)})}function h(P){H(c,function(F,D){d(P,D,F)})}e.on("canvas.destroy",function(P){h(P.svg)}),e.on("canvas.init",function(P){m(P.svg)}),e.on(["shape.added","connection.added"],function(P){var F=P.element,D=P.gfx;e.fire("interactionEvents.createHit",{element:F,gfx:D})}),e.on(["shape.changed","connection.changed"],bv,function(P){var F=P.element,D=P.gfx;e.fire("interactionEvents.updateHit",{element:F,gfx:D})}),e.on("interactionEvents.createHit",bv,function(P){var F=P.element,D=P.gfx;i.createDefaultHit(F,D)}),e.on("interactionEvents.updateHit",function(P){var F=P.element,D=P.gfx;i.updateDefaultHit(F,D)});var y=C("djs-hit djs-hit-stroke"),v=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":v,stroke:y,"no-move":b};function C(P,F){return F=W({stroke:"white",strokeWidth:15},F||{}),n.cls(P,["no-fill","no-border"],F)}function M(P,F){var D=x[F];if(!D)throw new Error("invalid hit type <"+F+">");return Ee(P,D),P}function O(P,F){Ve(P,F)}this.removeHits=function(P){var F=sc(".djs-hit",P);H(F,an)},this.createDefaultHit=function(P,F){var D=P.waypoints,I=P.isFrame,z;return D?this.createWaypointsHit(F,D):(z=I?"stroke":"all",this.createBoxHit(F,z,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,F){var D=Oa(F);return M(D,"stroke"),O(P,D),D},this.createBoxHit=function(P,F,D){D=W({x:0,y:0},D);var I=Me("rect");return M(I,F),Ee(I,D),O(P,I),I},this.updateDefaultHit=function(P,F){var D=ht(".djs-hit",F);if(D)return P.waypoints?cp(D,P.waypoints):Ee(D,{width:P.width,height:P.height}),D},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}xv.$inject=["eventBus","elementRegistry","styles"];const Zc={__init__:["interactionEvents"],interactionEvents:["type",xv]};function ta(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)})}ta.$inject=["eventBus","canvas"],ta.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()})}},ta.prototype.get=function(){return Array.from(this._selectedElements)},ta.prototype.isSelected=function(e){return this._selectedElements.has(e)},ta.prototype.select=function(e,t){var n=this.get();Ie(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?H(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var _v="hover",wv="selected";function Ev(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,_v)}),t.on("element.out",function(r){i(r.element,_v)}),t.on("selection.changed",function(r){function o(l){i(l,wv)}function a(l){n(l,wv)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let l of s)c.has(l)||o(l);for(let l of c)s.has(l)||a(l)})}Ev.$inject=["canvas","eventBus"];function Sv(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},l=c.autoSelect;if(a){if(l===!1)return;Ie(l)?t.select(l):t.select(s.filter(WM))}}),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=wt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Mr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Vc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Sv.$inject=["eventBus","selection","canvas","elementRegistry"];function WM(e){return!e.hidden}const mi={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Zc],selection:["type",ta],selectionVisuals:["type",Ev],selectionBehavior:["type",Sv]};var UM=/^djs-cursor-.*$/;function Qc(e){var t=Lt(document.body);t.removeMatching(UM),e&&t.add("djs-cursor-"+e)}function Rv(){Qc(null)}var YM=5e3;function Cv(e,t){t=t||"element.click";function n(){return!1}return e.once(t,YM,n),function(){e.off(t,n)}}var qM=["c","C"],KM=["v","V"],XM=["d","D"],ZM=["x","X"],QM=["y","Y"],Av=["z","Z"];function JM(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function qn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function sn(e,t){return e=Ie(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Sf(e){return e.shiftKey}function eT(e){return qn(e)&&sn(qM,e)}function tT(e){return qn(e)&&sn(KM,e)}function nT(e){return qn(e)&&sn(XM,e)}function iT(e){return qn(e)&&sn(ZM,e)}function rT(e){return qn(e)&&!Sf(e)&&sn(Av,e)}function oT(e){return qn(e)&&(sn(QM,e)||sn(Av,e)&&Sf(e))}var na=Math.round,Pv="djs-drag-active";function co(e){e.preventDefault()}function aT(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function sT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Mv(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(W({},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 l(b,x){var C=o.payload,M=o.displacement,O=o.globalStart,P=ao(b),F=Ci(P,O),D=o.localStart,I=a(P),z=Ci(I,D);if(!o.active&&(x||sT(F)>o.threshold)){if(W(C,{x:na(D.x+M.x),y:na(D.y+M.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return y();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&Qc(o.cursor),t.addMarker(t.getRootElement(),Pv)}nf(b),o.active&&(W(C,{x:na(I.x+M.x),y:na(I.y+M.y),dx:na(z.x),dy:na(z.y)},{originalEvent:b}),s("move"))}function u(b){var x,C=!0;o.active&&(b&&(o.payload.originalEvent=b,nf(b)),C=s("end")),C===!1&&s("rejected"),x=v(C!==!0),s("ended",x)}function f(b){sn("Escape",b)&&(co(b),y())}function p(b){var x;o.active&&(x=Cv(e),setTimeout(x,400),co(b)),u(b)}function d(b){l(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 y(b){var x;if(o){var C=o.active;C&&s("cancel"),x=v(b),C&&s("canceled",x)}}function v(b){var x,C;s("cleanup"),Rv(),o.trapClick?C=p:C=u,je.unbind(document,"mousemove",l),je.unbind(document,"dragstart",co),je.unbind(document,"selectstart",co),je.unbind(document,"mousedown",C,!0),je.unbind(document,"mouseup",C,!0),je.unbind(document,"keyup",f),je.unbind(document,"touchstart",d,!0),je.unbind(document,"touchcancel",y,!0),je.unbind(document,"touchmove",l,!0),je.unbind(document,"touchend",u,!0),e.off("element.hover",m),e.off("element.out",h),t.removeMarker(t.getRootElement(),Pv);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&&y(!1),typeof x=="string"&&(M=C,C=x,x=null),M=W({},r,M||{});var O=M.data||{},P,F,D,I,z;if(M.trapClick?I=p:I=u,b?(P=Jo(b)||b,F=ao(b),nf(b),P.type==="dragstart"&&co(P)):(P=null,F={x:0,y:0}),D=a(F),x||(x=D),z=aT(P),o=W({prefix:C,data:O,payload:{},globalStart:F,displacement:Ci(x,D),localStart:D,isTouch:z},M),M.manual||(z?(je.bind(document,"touchstart",d,!0),je.bind(document,"touchcancel",y,!0),je.bind(document,"touchmove",l,!0),je.bind(document,"touchend",u,!0)):(je.bind(document,"mousemove",l),je.bind(document,"dragstart",co),je.bind(document,"selectstart",co),je.bind(document,"mousedown",I,!0),je.bind(document,"mouseup",I,!0)),je.bind(document,"keyup",f),e.on("element.hover",m),e.on("element.out",h)),s("init")===!1)return y(),!1;M.autoActivate&&l(b,!0)}e.on("diagram.destroy",y),this.init=g,this.move=l,this.hover=m,this.out=h,this.end=u,this.cancel=y,this.context=function(){return o},this.setOptions=function(b){W(r,b)}}Mv.$inject=["eventBus","canvas","selection","elementRegistry"];const rr={__depends__:[GM,mi],dragging:["type",Mv]};function ia(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}ia.prototype.next=function(){return this._prefix+ ++this._counter};const cT=new ia("ps");var lT=["marker-start","marker-mid","marker-end"],uT=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Tr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Tr.$inject=["elementRegistry","eventBus","canvas","styles"],Tr.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")},Tr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Tr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=zm(n);return this._cloneMarkers(io(r),i),Ee(r,this._styles.cls(i,[])),Ve(t,r),Ee(r,"data-preview-support-element-id",e.id),r},Tr.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 Ve(t,n),Ee(n,"data-preview-support-element-id",e.id),n},Tr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),hT(e)&&lT.forEach(function(r){if(Ee(e,r)){var o=pT(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},Tr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,cT.next()].join("-"),a=ht("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||zm(n);s.id=o,nt(s).add(r);var c=ht(":scope > defs",e);c||(c=Me("defs"),Ve(e,c)),Ve(c,s);var l=dT(s.id);Ee(t,i,l)};function pT(e,t,n){var i=fT(Ee(e,t));return ht("marker#"+i,n||document)}function fT(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function dT(e){return"url(#"+e+")"}function hT(e){return uT.indexOf(e.nodeName)!==-1}const ra={__init__:["previewSupport"],previewSupport:["type",Tr]};var mT="drop-ok",Tv="drop-not-ok",kv="attach-ok",Ov="new-parent",Dv="create",gT=2e3;function Iv(e,t,n,i,r){function o(c,l,u,f,p){if(!l)return!1;c=Qe(c,function(g){var b=g.labelTarget;return!g.parent&&!(Xe(g)&&c.indexOf(b)!==-1)});var d=wt(c,function(g){return!gt(g)}),m=!1,h=!1,y=!1;Bv(c)&&(m=r.allowed("shape.attach",{position:u,shape:d,target:l})),m||(Bv(c)?y=r.allowed("shape.create",{position:u,shape:d,source:f,target:l}):y=r.allowed("elements.create",{elements:c,position:u,target:l}));var v=p.connectionTarget;return y||m?(d&&f&&(h=r.allowed("connection.create",{source:v===f?d:f,target:v===f?f:d,hints:{targetParent:l,targetAttach:m}})),{attach:m,connect:h}):y===null||m===null?null:!1}function a(c,l){[kv,mT,Tv,Ov].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,f=c.hover,p=l.source,d=l.hints||{};if(!f){l.canExecute=!1,l.target=null;return}Lv(c);var m={x:c.x,y:c.y},h=l.canExecute=f&&o(u,f,m,p,d);f&&h!==null&&(l.target=f,h&&h.attach?a(f,kv):a(f,h?Ov:Tv))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,f=l.shape,p=l.elements,d=l.target,m=l.canExecute,h=m&&m.attach,y=m&&m.connect,v=l.hints||{};if(m===!1||!d)return!1;Lv(c);var g={x:c.x,y:c.y};y?f=i.appendShape(u,f,g,d,{attach:h,connection:y===!0?{}:y,connectionTarget:v.connectionTarget}):(p=i.createElements(p,g,d,W({},v,{attach:h})),f=wt(p,function(b){return!gt(b)})),W(l,{elements:p,shape:f}),W(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===Dv&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],gT,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Ie(l)||(l=[l]);var f=wt(l,function(m){return!gt(m)});if(f){u=W({elements:l,hints:{},shape:f},u||{}),H(l,function(m){Fe(m.x)||(m.x=0),Fe(m.y)||(m.y=0)});var p=Qe(l,function(m){return!m.hidden}),d=Zt(p);H(l,function(m){gt(m)&&(m.waypoints=Cn(m.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),W(m,{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2})}),t.init(c,Dv,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:l,context:u}})}}}Iv.$inject=["canvas","dragging","eventBus","modeling","rules"];function Lv(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 Bv(e){return e&&e.length===1&&!gt(e[0])}var yT=750;function Nv(e,t,n,i,r){function o(a){var s=Me("g");Ee(s,r.cls("djs-drag-group",["no-events"]));var c=Me("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(io(u),l)):(u=n._createContainer("shape",c),n.drawShape(io(u),l),xn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",yT,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=o(l));var f;s?(u.parentNode||(f=e.getActiveLayer(),Ve(f,u)),xn(u,a.x,a.y)):an(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&an(c)})}Nv.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Jc={__depends__:[rr,ra,Fi,mi],__init__:["create","createPreview"],create:["type",Iv],createPreview:["type",Nv]};function Rf(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)})}Rf.$inject=["eventBus"],Rf.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||vT(0,0)};function vT(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 Qa={__init__:["mouse"],mouse:["type",Rf]};var $v=2e3;function Kn(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 l=c.descriptor,u=c.element,f=c.elementsSet;l.priority=1,l.id=u.id,f.has(u.parent)&&(l.parent=u.parent.id),bT(u)&&(l.priority=2,l.host=u.host.id),gt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=xT(u)),Xe(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),H(["x","y","width","height"],function(p){Fe(u[p])&&(l[p]=u[p])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.elementsCopied",$v,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",$v,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;W(l,{createElementsBehavior:!1})})}Kn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Kn.prototype.copy=function(e,t={}){var n,i;return Ie(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Ie(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Kn.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})}}},Kn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Kn.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},Kn.prototype._getElementIdsFromTree=function(e){var t={};return H(e,function(n){H(n,function(i){i.id&&(t[i.id]=!0)})}),t},Kn.prototype._paste=function(e,t,n,i){H(e,function(o){Fe(o.x)||(o.x=0),Fe(o.y)||(o.y=0)});var r=Zt(e);return H(e,function(o){gt(o)&&(o.waypoints=Cn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),W(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,W({},i))},Kn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return H(e,function(o,a){o=Pi(o,"priority"),H(o,function(s){var c=W({},Mi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(gt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(Xe(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),r.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),r.push(l)})}),r},Kn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Mi(e,["id"]));return t},Kn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Mi(e,["id"]));return t},Kn.prototype.createShape=function(e){var t=this._elementFactory.createShape(Mi(e,["id"]));return t},Kn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(gt(e)&&(!n.has(e.source)||!n.has(e.target))||Xe(e)&&!n.has(e.labelTarget))},Kn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=pc(e);function s(f,p){return t.allowed("element.copy",{element:f,elements:p})}function c(f,p){var d=o.get(f);if(!d){var m={element:f,depth:p};r.push(m),o.set(f,m);return}if(d.depth<p){r=l(d,r);var h={element:d.element,depth:p};r.push(h),o.set(f,h)}}function l(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}no(a,function(f,p,d){if(Xe(f))return;H(f.labels,function(y){c(y,d)});function m(y){y&&y.length&&H(y,function(v){H(v.labels,function(g){c(g,d)}),c(v,d)})}H([f.attachers,f.incoming,f.outgoing],m),c(f,d);var h=[];return f.children&&(h=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:h}),h}),e=Cn(r,function(f){return f.element});var u=new Set(e);return r=Cn(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:u}),f}),r=Pi(r,function(f){return f.descriptor.priority}),e=Cn(r,function(f){return f.element}),H(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,u)){jv(f.element,e),u.delete(f.element);return}if(!s(f.element,e)){jv(f.element,e),u.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function bT(e){return!!e.host}function xT(e){return Cn(e.waypoints,function(t){return t=Fv(t),t.original&&(t.original=Fv(t.original)),t})}function Fv(e){return W({},e)}function jv(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const _T={__depends__:[HM,Jc,Qa,Fi],__init__:["copyPaste"],copyPaste:["type",Kn]};function Cf(e,t,n){Ie(n)||(n=[n]),H(n,function(i){Kr(e[i])||(t[i]=e[i])})}var Af=750;function Hv(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",Af,function(c){var l=c.descriptor,u=c.element,f=oe(u);if(Xe(u))return l;var p=l.businessObject=i(f,!0),d=l.di=i(st(u),!0);d.bpmnElement=p,Cf(p,l,"name"),Cf(d,l,"isExpanded"),f.default&&(l.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,l){c[r]=l}function s(c,l,u){var f=oe(c);return c.default&&(u[c.default]={element:f,property:"default"}),c.host&&(oe(c).attachedToRef=oe(l[c.host])),Mi(u,Gn(u,function(p,d,m){var h=d.element,y=d.property;return m===c.id&&(h.set(y,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,f=u.businessObject,p=u.di;if(Xe(u)){u.businessObject=oe(l[u.labelTarget]),u.di=st(l[u.labelTarget]);return}f=u.businessObject=i(f),p=u.di=i(p),p.bpmnElement=f,Cf(u,f,["isExpanded","name"]),u.type=f.$type}),t.on("copyPaste.copyElement",Af,function(c){var l=c.descriptor,u=c.element;if(S(u,"bpmn:Participant")){var f=oe(u);f.processRef&&(l.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;S(l,"bpmn:SubProcess")&&H(Fa(u),f=>{u.push(f.annotation)})}),t.on("copyPaste.pasteElement",Af,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}Hv.$inject=["bpmnFactory","eventBus","moddleCopy"];const wT=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],ET=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Ja(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 Pi(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=ln(r)&&r.$descriptor;if(a&&ET.includes(a))return o;if(a&&wT.includes(a)||a&&s&&!wt(s.properties,Po({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})}Ja.$inject=["eventBus","bpmnFactory","moddle"],Ja.prototype.copyElement=function(e,t,n,i=!1){n&&!Ie(n)&&(n=[n]),n=n||Pf(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Ie(r)&&(n=r),H(n,o=>{let a;zn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!rn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Ja.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 ln(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):Ie(e)?Gn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):ln(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},Ja.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 Pf(e,t){return Gn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const zv={__depends__:[_T],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Hv],moddleCopy:["type",Ja]};var Gv=Math.round;function Mf(e,t){this._modeling=e,this._eventBus=t}Mf.$inject=["modeling","eventBus"],Mf.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,l=Gv(s+o/2),u=Gv(c+a/2),f=i.replaceShape(e,W({},t,{x:l,y:u,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function Vv(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Vv.$inject=["selection","eventBus"];const ST={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Vv],replace:["type",Mf]};function RT(e,t,n){Ie(n)||(n=[n]),H(n,function(i){Kr(e[i])||(t[i]=e[i])})}var CT=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function AT(e,t){var n=e&&zn(e,"collapsed")?e.collapsed:!et(e),i;return t&&(zn(t,"collapsed")||zn(t,"isExpanded"))?i=zn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Wv(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,f=s.businessObject;if(el(f)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&AT(s,c))return i.toggleCollapse(s),s;var p=e.create(u),d={type:u,businessObject:p};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),RT(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var m=Pf(f.$descriptor),h=Pf(p.$descriptor,!0),y=PT(m,h);W(p,Si(c,CT));var v=Qe(y,function(x){return x==="eventDefinitions"?Uv(s,c.eventDefinitionType):x==="loopCharacteristics"?!Tn(p):zn(p,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!Tn(p):!0});if(p=n.copyElement(f,p,v),c.eventDefinitionType&&(Uv(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),S(f,"bpmn:Activity")){if(el(f))d.isExpanded=et(s);else if(c&&zn(c,"isExpanded")){d.isExpanded=c.isExpanded;var g=t.getDefaultSize(p,{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}et(s)&&!S(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(el(f)&&!el(p)&&(l.moveChildren=!1),S(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var b=pn(s);st(s).isHorizontal||(st(d).isHorizontal=b),d.width=b?s.width:t.getDefaultSize(d).width,d.height=b?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,Ze(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Ze(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!S(f,"bpmn:BoundaryEvent")&&S(p,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...l,targetElement:c})}this.replaceElement=a}Wv.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function el(e){return S(e,"bpmn:SubProcess")}function Uv(e,t){var n=oe(e);return t&&n.get("eventDefinitions").some(function(i){return S(i,t)})}function PT(e,t){return e.filter(function(n){return t.includes(n)})}const Yv={__depends__:[zv,ST,mi],bpmnReplace:["type",Wv]};var MT=250;function lo(e){this._eventBus=e,this._tools=[],this._active=null}lo.$inject=["eventBus"],lo.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)},lo.prototype.isActive=function(e){return e&&this._active===e},lo.prototype.length=function(e){return this._tools.length},lo.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},lo.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),H(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,MT,function(r){this._active&&(TT(r)||this.setActive(null))},this)};function TT(e){var t=e.originalEvent&&e.originalEvent.target;return t&&eo(t,'.group[data-group="tools"]')}const tl={__depends__:[rr],__init__:["toolManager"],toolManager:["type",lo]};function kT(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 OT(e,t){var n=[],i=new Set(e);H(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;H(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function DT(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 Tf=Math.abs,IT=Math.round,or={x:"width",y:"height"},qv="crosshair",kr={n:"top",w:"left",s:"bottom",e:"right"},LT=1500,nl={n:"s",w:"e",s:"n",e:"w"},il=20;function gi(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",LT,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&Xv(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,f=l.direction,p=l.movingShapes,d=l.resizingShapes,m=l.start;if(l.initialized){Xv(c);var h={x:0,y:0};h[u]=IT(c["d"+u]),s.makeSpace(p,d,h,f,m),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}gi.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],gi.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:qv,data:{context:{reactivate:n}},trapClick:!1})},gi.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:qv,data:{context:{}}})},gi.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},gi.prototype.init=function(e,t){var n=Tf(e.dx)>Tf(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Tf(i)<5)return!1;i<0&&(i*=-1),Ka(e)&&(i*=-1);var o=kT(n,i),a=this._canvas.getRootElement();!Vc(e)&&e.hover&&(a=e.hover);var s=[...Da(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),u=BT(c,n,o,r,l);return W(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),Qc("resize-"+(n==="x"?"ew":"ns")),!0},gi.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,l=[],u=[];function f(d){s.has(d)||(s.add(d),o.push(d));var m=d.label;m&&!s.has(m)&&(s.add(m),o.push(m))}function p(d){c.has(d)||(c.add(d),a.push(d))}return H(e,function(d){if(!(!d.parent||Xe(d))){if(gt(d)){u.push(d);return}var m=d[t],h=m+d[or[t]];if(NT(d)&&(n>0&&Le(d)[t]>i||n<0&&Le(d)[t]<i)){l.push(d);return}if(n>0&&m>i||n<0&&h<i){f(d);return}if(m<i&&h>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),H(o,function(d){var m=d.attachers;m&&H(m,function(h){f(h)})}),H(l,function(d){var m=d.host;(s.has(m)||c.has(m))&&f(d)}),H(u,function(d){var m=d.source,h=d.target,y=d.label;(s.has(m)||c.has(m))&&(s.has(h)||c.has(h))&&y&&f(y)}),{movingShapes:o,resizingShapes:a}},gi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},gi.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Kv(e){return{top:e.top-il,right:e.right+il,bottom:e.bottom+il,left:e.left-il}}function Xv(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Fe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Fe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Fe(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Fe(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function BT(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(o),f=new Set(a);return H(a,function(p){var d=p.attachers,m=p.children,h=De(p),y=Qe(m,function(z){return!gt(z)&&!Xe(z)&&!u.has(z)&&!f.has(z)}),v=Qe(m,function(z){return!gt(z)&&!Xe(z)&&u.has(z)}),g,b,x,C=[],M=[],O,P,F,D;y.length&&(b=Kv(De(Zt(y))),g=i-h[kr[n]]+b[kr[n]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,g):g:n==="w"?s.right=l=Fe(l)?Math.min(l,g):g:n==="s"?s.top=c=Fe(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Fe(c)?Math.max(c,g):g)),v.length&&(x=Kv(De(Zt(v))),g=i-x[kr[nl[n]]]+h[kr[nl[n]]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,g):g:n==="w"?s.right=l=Fe(l)?Math.min(l,g):g:n==="s"?s.top=c=Fe(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Fe(c)?Math.max(c,g):g)),d&&d.length&&(d.forEach(function(z){u.has(z)?C.push(z):M.push(z)}),C.length&&(O=De(Zt(C.map(Le))),P=h[kr[nl[n]]]-(O[kr[nl[n]]]-i)),M.length&&(F=De(Zt(M.map(Le))),D=F[kr[n]]-(h[kr[n]]-i)),n==="n"?(g=Math.min(P||1/0,D||1/0),s.bottom=l=Fe(l)?Math.min(l,g):g):n==="w"?(g=Math.min(P||1/0,D||1/0),s.right=l=Fe(l)?Math.min(l,g):g):n==="s"?(g=Math.max(P||-1/0,D||-1/0),s.top=c=Fe(c)?Math.max(c,g):g):n==="e"&&(g=Math.max(P||-1/0,D||-1/0),s.left=c=Fe(c)?Math.max(c,g):g));var I=r&&r[p.id];I&&(n==="n"?(g=i+p[or[t]]-I[or[t]],s.bottom=l=Fe(l)?Math.min(l,g):g):n==="w"?(g=i+p[or[t]]-I[or[t]],s.right=l=Fe(l)?Math.min(l,g):g):n==="s"?(g=i-p[or[t]]+I[or[t]],s.top=c=Fe(c)?Math.max(c,g):g):n==="e"&&(g=i-p[or[t]]+I[or[t]],s.left=c=Fe(c)?Math.max(c,g):g))}),s}}function NT(e){return!!e.host}var kf="djs-dragging",Zv="djs-resizing",$T=250,rl=Math.max;function Qv(e,t,n,i,r){function o(a,s){H(a,function(c){r.addDragger(c,s),n.addMarker(c,kf)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=Me("g");Ee(u,i.cls("djs-crosshair-group",["no-events"])),Ve(s,u);var f=Me("path");Ee(f,"d",l.x),nt(f).add("djs-crosshair"),Ve(u,f);var p=Me("path");Ee(p,"d",l.y),nt(p).add("djs-crosshair"),Ve(u,p),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;xn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&an(c)}),e.on("spaceTool.move",$T,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=Me("path"),Ee(c,"d","M0,0 L0,0"),nt(c).add("djs-crosshair"),Ve(p,c),s.line=c;var d=Me("g");Ee(d,i.cls("djs-drag-group",["no-events"])),Ve(n.getActiveLayer(),d),o(u,d);var m=new Set(u);H(f,function(M){m.add(M)});var h=new Set,y=s.movingConnections=[];m.forEach(function(M){H(M.outgoing,function(O){h.has(O)||!gt(O)||!m.has(O.target)||(h.add(O),y.push(O))})}),o(y,d),s.dragGroup=d}if(!s.frameGroup){var v=Me("g");Ee(v,i.cls("djs-frame-group",["no-events"])),Ve(n.getActiveLayer(),v);var g=[];H(f,function(M){var O=r.addFrame(M,v),P=O.getBBox();g.push({element:O,initialBounds:P}),n.addMarker(M,Zv)}),s.frameGroup=v,s.frames=g}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Ee(c,{d:b[l]});var x={x:"y",y:"x"},C={x:a.dx,y:a.dy};C[x[s.axis]]=0,xn(s.dragGroup,C.x,C.y),H(s.frames,function(M){var O=M.element,P=M.initialBounds,F,D;s.direction==="e"?Ee(O,{width:rl(P.width+C.x,5)}):(F=rl(P.width-C.x,5),Ee(O,{width:F,x:P.x+P.width-F})),s.direction==="s"?Ee(O,{height:rl(P.height+C.y,5)}):(D=rl(P.height-C.y,5),Ee(O,{height:D,y:P.y+P.height-D}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;H(c,function(m){n.removeMarker(m,kf)}),H(l,function(m){n.removeMarker(m,kf)}),p&&(an(f),an(p)),H(u,function(m){n.removeMarker(m,Zv)}),d&&an(d)})}Qv.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const FT={__init__:["spaceToolPreview"],__depends__:[rr,Fi,tl,ra,Qa],spaceTool:["type",gi],spaceToolPreview:["type",Qv]};function ol(e,t){e.invoke(gi,this),this._canvas=t}ol.$inject=["injector","canvas"],we(ol,gi),ol.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Co(jo(r.children.filter(l=>S(l,"bpmn:Artifact")),Zt(o))));const s=[...e,...a];var c=gi.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(S(l,"bpmn:TextAnnotation")||jT(l)&&(t==="y"&&pn(l)||t==="x"&&!pn(l)))}),c};function jT(e){return S(e,"bpmn:Participant")&&!oe(e).processRef}const Jv={__depends__:[FT],spaceTool:["type",ol]};function $t(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)}$t.$inject=["eventBus","injector"],$t.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()},$t.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},$t.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},$t.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()}},$t.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()}},$t.prototype.register=function(e,t){this._setHandler(e,t)},$t.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)},$t.prototype.canUndo=function(){return!!this._getUndoAction()},$t.prototype.canRedo=function(){return!!this._getRedoAction()},$t.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},$t.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},$t.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)})},$t.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},$t.prototype._createId=function(){return this._uid++},$t.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},$t.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()},$t.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)},$t.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:oh("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},$t.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Ie(e)?e:[e],t.dirty=t.dirty.concat(e))},$t.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},$t.prototype._revertedAction=function(e){this._stackIdx--},$t.prototype._getHandler=function(e){return this._handlerMap[e]},$t.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 HT={commandStack:["type",$t]};function Or(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 zT=250,eb=1400;function Of(e,t,n){ne.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",eb,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=tb(a),o.validatedShapes=tb(s)}),i&&t.on("shape.move.start",zT,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",eb,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];H(s,function(l){H(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;Or(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=up(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&&(Yt(s.labels,a,c),a.labelTarget=s)})}we(Of,ne),Of.$inject=["injector","eventBus","modeling"];function tb(e){var t=new Set(e);return Qe(e,function(n){return!t.has(n.labelTarget)})}const GT={__init__:["labelSupport"],labelSupport:["type",Of]};var VT=251,nb=1401,ib="attach-ok";function Df(e,t,n,i,r){ne.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",nb,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=WT(c),s.validatedShapes=UT(l)}),o&&t.on("shape.move.start",VT,function(a){var s=a.context,c=s.shapes,l=If(c);H(l,function(u){o.makeDraggable(s,u,!0),H(u.labels,function(f){o.makeDraggable(s,f,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,ib),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,ib)}))}}),this.preExecuted("elements.move",nb,function(a){var s=a.context,c=s.closure,l=s.shapes,u=If(l);H(u,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=Qe(c,function(f){var p=f.host;return YT(f)&&!qT(c,p)}),H(u,function(f){r.updateAttachment(f,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;H(s,function(c){H(c.attachers,function(l){H(l.outgoing.slice(),function(u){var f=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});f||r.removeConnection(u)}),H(l.incoming.slice(),function(u){var f=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});f||r.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&r.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;Or(c.attachers,function(u){var f=i.allowed("elements.move",{target:l,shapes:[u]});f==="attach"?r.updateAttachment(u,l):r.removeShape(u)}),l.attachers.length&&H(l.attachers,function(u){var f=_y(u,c,l);r.moveShape(u,f,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&H(f,function(d){var m=_y(d,l,u);r.moveShape(d,m,d.parent),H(d.labels,function(h){r.moveShape(h,m,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Or(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}we(Df,ne),Df.$inject=["injector","eventBus","canvas","rules","modeling"];function If(e){return vu(Cn(e,function(t){return t.attachers||[]}))}function WT(e){var t=If(e);return aE("id",e,t)}function UT(e){var t=Ao(e,"id");return Qe(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function YT(e){return!!e.host}function qT(e,t){return e.indexOf(t)!==-1}const KT={__depends__:[Fi],__init__:["attachSupport"],attachSupport:["type",Df]};function rb(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(Xm(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)})}rb.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Lf={__init__:["changeSupport"],changeSupport:["type",rb]};function yi(e){this._model=e}yi.$inject=["moddle"],yi.prototype._needsId=function(e){return Ze(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"])},yi.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":Ze(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))},yi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},yi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},yi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",W({bpmnElement:e,bounds:this.createDiBounds()},t))},yi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},yi.prototype.createDiWaypoints=function(e){var t=this;return Cn(e,function(n){return t.createDiWaypoint(n)})},yi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Si(e,["x","y"]))},yi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",W({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},yi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",W({bpmnElement:e},t))};function Xn(e,t,n){ne.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var m=d.context,h=m.hints||{},y;!m.cropped&&h.createElementsBehavior!==!1&&(y=m.connection,y.waypoints=n.getCroppedWaypoints(y),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,y=m.parent||m.newParent;i.updateParent(h,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Zn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Zn(a));function s(d){var m=d.context,h=m.oldRoot,y=h.children;H(y,function(v){S(v,"bpmn:BaseElement")&&i.updateParent(v)})}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"],Zn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Zn(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 l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Zn(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Zn(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Zn(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Zn(u)),this.executed("connection.reconnect",Zn(function(d){var m=d.context,h=m.connection,y=m.oldSource,v=m.newSource,g=oe(h),b=oe(y),x=oe(v);g.conditionExpression&&!Ze(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=g.conditionExpression,delete g.conditionExpression),y!==v&&b.default===g&&(m.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",Zn(function(d){var m=d.context,h=m.connection,y=m.oldSource,v=m.newSource,g=oe(h),b=oe(y),x=oe(v);m.oldConditionExpression&&(g.conditionExpression=m.oldConditionExpression),m.oldDefault&&(b.default=m.oldDefault,delete x.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Zn(f)),this.reverted(["element.updateAttachment"],Zn(f)),this.executed("element.updateLabel",Zn(p)),this.reverted("element.updateLabel",Zn(p));function p(d){const{element:m}=d.context,h=ci(m),y=st(m),v=y&&y.get("label");Rr(m)||Wc(m)||(h&&!v?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&v&&y.set("label",void 0))}}we(Xn,ne),Xn.$inject=["eventBus","bpmnFactory","connectionDocking"],Xn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Xn.prototype.updateParent=function(e,t){if(!Xe(e)&&!(S(e,"bpmn:DataStoreReference")&&e.parent&&S(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=st(e),o=n&&n.businessObject,a=st(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)}},Xn.prototype.updateBounds=function(e){var t=st(e),n=ZT(e);if(n){var i=Ci(n,t.get("bounds"));W(n,{x:e.x+i.x,y:e.y+i.y})}var r=Xe(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),W(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Xn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;S(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Wt(i,e)),S(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Yt(r,e))}},Xn.prototype.updateDiConnection=function(e,t,n){var i=st(e),r=st(t),o=st(n);i.sourceElement&&i.sourceElement.bpmnElement!==oe(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==oe(n)&&(i.targetElement=n&&o)},Xn.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):(Wt(n,e),e.$parent=null)}};function XT(e){for(;e&&!S(e,"bpmn:Definitions");)e=e.$parent;return e}Xn.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)},Xn.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=XT(e.$parent||t),e.$parent&&(Wt(o.get("rootElements"),r),r.$parent=null),t&&(Yt(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),Wt(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Wt(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Xn.prototype.updateConnectionWaypoints=function(e){var t=st(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Xn.prototype.updateConnection=function(e){var t=e.connection,n=oe(t),i=t.source,r=oe(i),o=t.target,a=oe(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&&(Wt(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Wt(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},Xn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Zn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;S(i,"bpmn:BaseElement")&&e(t)}}function ZT(e){if(S(e,"bpmn:Activity")){var t=st(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Dr(e,t){er.call(this),this._bpmnFactory=e,this._moddle=t}we(Dr,er),Dr.$inject=["bpmnFactory","moddle"],Dr.prototype._baseCreate=er.prototype.create,Dr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,W({type:"label",di:n},ro,t))}return this.createElement(e,t)},Dr.prototype.createElement=function(e,t){t=W({},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(!JT(r)){var o=W({},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=W({isFrame:!0},t)),t=QT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Bf(r,t,"isExpanded")),Ze(i,["bpmn:Lane","bpmn:Participant"])&&(t=Bf(r,t,"isHorizontal")),S(i,"bpmn:SubProcess")&&(t.collapsed=!et(i,r)),S(i,"bpmn:ExclusiveGateway")&&(zn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),rn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),rn(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=W({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},Dr.prototype.getDefaultSize=function(e,t){var n=oe(e);if(t=t||st(e),S(n,"bpmn:SubProcess"))return et(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 et(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}},Dr.prototype.createParticipantShape=function(e){return ln(e)||(e={isExpanded:e}),e=W({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function QT(e,t,n){return H(n,function(i){t=Bf(e,t,i)}),t}function Bf(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Mi(t,[n]))}function JT(e){return Ze(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function al(e,t){this._modeling=e,this._canvas=t}al.$inject=["modeling","canvas"],al.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;H(n,function(r){var o={x:0,y:0};rn(i.left)?o.x=i.left-r.x:rn(i.right)?o.x=i.right-r.width-r.x:rn(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:rn(i.top)?o.y=i.top-r.y:rn(i.bottom)?o.y=i.bottom-r.height-r.y:rn(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},al.prototype.postExecute=function(e){};function sl(e){this._modeling=e}sl.$inject=["modeling"],sl.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},sl.prototype.postExecute=function(e){var t=e.hints||{};e2(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 e2(e,t){return hr(e.outgoing,function(n){return n.target===t})}function cl(e,t){this._canvas=e,this._layouter=t}cl.$inject=["canvas","layouter"],cl.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},cl.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ll=Math.round;function Nf(e){this._modeling=e}Nf.$inject=["modeling"],Nf.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;H(t,function(f){Fe(f.x)||(f.x=0),Fe(f.y)||(f.y=0)});var s=Qe(t,function(f){return!f.hidden}),c=Zt(s);H(t,function(f){gt(f)&&(f.waypoints=Cn(f.waypoints,function(p){return{x:ll(p.x-c.x-c.width/2+r.x),y:ll(p.y-c.y-c.height/2+r.y)}})),W(f,{x:ll(f.x-c.x-c.width/2+r.x),y:ll(f.y-c.y-c.height/2+r.y)})});var l=new Set(pc(t)),u={};H(t,function(f){if(gt(f)){u[f.id]=Fe(i)?a.createConnection(u[f.source.id],u[f.target.id],i,f,f.parent||n,o):a.createConnection(u[f.source.id],u[f.target.id],f,f.parent||n,o);return}var p=W({},o);l.has(f)||(p.autoResize=!1),Xe(f)&&(p=Mi(p,["attach"])),u[f.id]=Fe(i)?a.createShape(f,Si(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,Si(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=Co(u)};var ob=Math.round;function Ir(e){this._canvas=e}Ir.$inject=["canvas"],Ir.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?W(t,n):W(t,{x:n.x-ob(t.width/2),y:n.y-ob(t.height/2)}),this._canvas.addShape(t,i,r),t},Ir.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function es(e){Ir.call(this,e)}we(es,Ir),es.$inject=["canvas"];var t2=Ir.prototype.execute;es.prototype.execute=function(e){var t=e.shape;return i2(t),t.labelTarget=e.labelTarget,t2.call(this,e)};var n2=Ir.prototype.revert;es.prototype.revert=function(e){return e.shape.labelTarget=null,n2.call(this,e)};function i2(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function ts(e,t){this._canvas=e,this._modeling=t}ts.$inject=["canvas","modeling"],ts.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Or(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Or(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},ts.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=up(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},ts.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Yt(n.children,t,i),this._canvas.addConnection(t,n),t};function $f(e,t){this._modeling=e,this._elementRegistry=t}$f.$inject=["modeling","elementRegistry"],$f.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;H(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function ns(e,t){this._canvas=e,this._modeling=t}ns.$inject=["canvas","modeling"],ns.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Or(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Or(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Or(n.children,function(i){gt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},ns.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=up(i.children,n),t.removeShape(n),n},ns.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Yt(i.children,n,r),t.addShape(n,i),n};function ul(e){this._modeling=e}ul.$inject=["modeling"];var ab={x:"y",y:"x"};ul.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(y,v){y.range.min=Math.min(v[i],y.range.min),y.range.max=Math.max(v[i]+v[r],y.range.max)}function a(y){return y[i]+y[r]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,v){var g={y:0};g[i]=y-a(v),g[i]&&(g[ab[i]]=0,t.moveElements([v],g,v.parent))}var u=n[0],f=s(n),p=n[f],d,m,h=0;H(n,function(y,v){var g,b,x;if(y.elements.length<2){v&&v!==n.length-1&&(o(y,y.elements[0]),h+=c(y.range));return}g=Pi(y.elements,i),b=g[0],v===f&&(b=g[s(g)]),x=a(b),y.range=null,H(g,function(C){if(l(x,C),y.range===null){y.range={min:C[i],max:C[i]+C[r]};return}o(y,C)}),v&&v!==n.length-1&&(h+=c(y.range))}),m=Math.abs(p.range.min-u.range.max),d=Math.round((m-h)/(n.length-1)),!(d<n.length-1)&&H(n,function(y,v){var g={},b;y===u||y===p||(b=n[v-1],y.range.max=0,H(y.elements,function(x,C){g[ab[i]]=0,g[i]=b.range.max-x[i]+d,y.range.min!==x[i]&&(g[i]+=x[i]-y.range.min),g[i]&&t.moveElements([x],g,x.parent),y.range.max=Math.max(x[i]+x[r],C?y.range.max:0)}))})},ul.prototype.postExecute=function(e){};function pl(e,t){this._layouter=e,this._canvas=t}pl.$inject=["layouter","canvas"],pl.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return W(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},pl.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Ff(){}Ff.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=Wt(o.children,t),Yt(i.children,t,r),t.parent=i,H(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},Ff.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Wt(n.children,t),Yt(i.children,t,r),t.parent=i,H(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 jf(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}jf.prototype.add=function(e,t){return this.addAll([e],t)},jf.prototype.addAll=function(e,t){var n=DR(e,!!t,this);return W(this,n),this};function is(e){this._modeling=e}is.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},is.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;r&&r.parent===n&&(u=!0),H(a,function(f){o.moveShape(f,t,l[f.id]&&!u&&n,{recurse:!1,layout:!1})}),H(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,l[f.id]&&!u&&n):o.layoutConnection(f,{connectionStart:p&&Up(f,f.source,t),connectionEnd:d&&Yp(f,f.target,t)})})},is.prototype.getClosure=function(e){return new jf().addAll(e,!0)};function fl(e){this._helper=new is(e)}fl.$inject=["modeling"],fl.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},fl.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 uo(e){this._modeling=e,this._helper=new is(e)}uo.$inject=["modeling"],uo.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=Si(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Wt(o.children,t),Yt(i.children,t,r),W(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},uo.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(H(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:Yp(o,t,n)})}),H(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Up(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},uo.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Yt(n.children,t,i),W(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},uo.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},uo.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function rs(e){this._modeling=e}rs.$inject=["modeling"],rs.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 Ie(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},rs.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||sb(Ie(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||sb(Ie(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},rs.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 sb(e){return e.original||e}function ar(e,t){this._modeling=e,this._rules=t}ar.$inject=["modeling","rules"],ar.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,y){return i.allowed("connection.reconnect",{connection:y,source:m,target:h})}var l={x:o.x,y:o.y},u={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,l,r.parent,a),r.host&&n.updateAttachment(s,r.host);var f;a.moveChildren!==!1&&(f=r.children.slice(),n.moveElements(f,{x:0,y:0},s,a));var p=r.incoming.slice(),d=r.outgoing.slice();H(p,function(m){var h=m.source,y=c(h,s,m);y&&t.reconnectEnd(m,s,Fc(m,s,u),a)}),H(d,function(m){var h=m.target,y=c(s,h,m);y&&t.reconnectStart(m,s,$c(m,s,u),a)})},ar.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},ar.prototype.execute=function(e){},ar.prototype.revert=function(e){},ar.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},ar.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},ar.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function os(e){this._modeling=e}os.$inject=["modeling"],os.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},W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},os.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(H(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Fc(o,n,i)})}),H(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:$c(o,n,i)})}))},os.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Lr(e){this._modeling=e}Lr.$inject=["modeling"],Lr.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),H(r,function(s){a[s.id]=o2(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(OT(i,r),t,n,o,i,r,a)},Lr.prototype.execute=function(){},Lr.prototype.revert=function(){},Lr.prototype.moveShapes=function(e,t){var n=this;H(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Lr.prototype.resizeShapes=function(e,t,n){var i=this;H(e,function(r){var o=DT(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Lr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),l=new Set(o);H(e,function(u){var f=u.source,p=u.target,d=r2(u),m=lb(n),h={},y=c.has(f)||l.has(f),v=c.has(p)||l.has(p);y&&v?(d=Cn(d,function(g){return ub(g,i,n)&&(g[m]=g[m]+t[m]),g.original&&ub(g.original,i,n)&&(g.original[m]=g.original[m]+t[m]),g}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(y||v)&&(c.has(f)?h.connectionStart=Up(u,f,t):c.has(p)?h.connectionEnd=Yp(u,p,t):l.has(f)?h.connectionStart=$c(u,f,a[f.id]):l.has(p)&&(h.connectionEnd=Fc(u,p,a[p.id])),s._modeling.layoutConnection(u,h))})};function cb(e){return W({},e)}function r2(e){return Cn(e.waypoints,function(t){return t=cb(t),t.original&&(t.original=cb(t.original)),t})}function lb(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function ub(e,t,n){var i=lb(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function o2(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function dl(e){this._modeling=e}dl.$inject=["modeling"],dl.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=pb(n),t.collapsed=!t.collapsed;var i=fb(n,t.collapsed);return[t].concat(i)},dl.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=db(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function pb(e){var t={};return H(e,function(n){t[n.id]=n.hidden,n.children&&(t=W({},t,pb(n.children)))}),t}function fb(e,t){var n=[];return H(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(fb(i.children,i.collapsed||t)))}),n}function db(e,t){var n=[];return H(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(db(i.children,t)))}),n}function hl(e){this._modeling=e}hl.$inject=["modeling"],hl.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=hb(i,t),mb(n,t),t.host=n,t},hl.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,hb(n,t),mb(i,t,r),t};function hb(e,t){return Wt(e&&e.attachers,t)}function mb(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Yt(i,t,n)}}function Hf(){}Hf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Hf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function yt(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}yt.$inject=["eventBus","elementFactory","commandStack"],yt.prototype.getHandlers=function(){return{"shape.append":sl,"shape.create":Ir,"shape.delete":ns,"shape.move":uo,"shape.resize":os,"shape.replace":ar,"shape.toggleCollapse":dl,spaceTool:Lr,"label.create":es,"connection.create":cl,"connection.delete":ts,"connection.move":Ff,"connection.layout":pl,"connection.updateWaypoints":Hf,"connection.reconnect":rs,"elements.create":Nf,"elements.move":fl,"elements.delete":$f,"elements.distribute":ul,"elements.align":al,"element.updateAttachment":hl}},yt.prototype.registerHandlers=function(e){H(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},yt.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)},yt.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},yt.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)},yt.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)},yt.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},yt.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},yt.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},yt.prototype.createElements=function(e,t,n,i,r){Ie(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},yt.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},yt.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},yt.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},yt.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},yt.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},yt.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},yt.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},yt.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},yt.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},yt.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)},yt.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},yt.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)},yt.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,W(i,{docking:"source"}))},yt.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,W(i,{docking:"target"}))},yt.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},yt.prototype._create=function(e,t){return vC(t)?t:this._elementFactory.create(e,t)},yt.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function as(e){this._elementRegistry=e}as.$inject=["elementRegistry"],as.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||a2(n,Bs(i));return gb(n,i),e.oldProperties=o,e.changed=r,r},as.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return gb(n,t),i},as.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return S(e,"bpmn:DataObject")?s2(e,t):[]};function a2(e,t){return Gn(t,function(n,i){return n[i]=e.get(i),n},{})}function gb(e,t){H(t,function(n,i){e.set(i,n)})}function s2(e,t){return t.filter(function(n){return S(n,"bpmn:DataObjectReference")&&oe(n).dataObjectRef===e})}var ss="default",sr="id",yb="di",c2={width:0,height:0};function cs(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}cs.$inject=["elementRegistry","moddle","modeling","textRenderer"],cs.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=d2(e.properties),s=e.oldProperties||l2(t,a);return vb(a,o)&&(r.unclaim(o[sr]),i.updateId(t,a[sr]),r.claim(a[sr],o)),ss in a&&(a[ss]&&n.push(i.get(a[ss].id)),o[ss]&&n.push(i.get(o[ss].id))),bb(t,a),e.oldProperties=s,e.changed=n,n},cs.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&oe(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,c2)}},cs.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 bb(t,i),vb(n,r)&&(a.unclaim(n[sr]),o.updateId(t,i[sr]),a.claim(i[sr],r)),e.changed};function vb(e,t){return sr in e&&e[sr]!==t[sr]}function l2(e,t){var n=Bs(t),i=e.businessObject,r=st(e);return Gn(n,function(o,a){return a!==yb?o[a]=i.get(a):o[a]=u2(r,Bs(t.di)),o},{})}function u2(e,t){return Gn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function bb(e,t){var n=e.businessObject,i=st(e);H(t,function(r,o){o!==yb?n.set(o,r):i&&p2(i,r)})}function p2(e,t){H(t,function(n,i){e.set(i,n)})}var f2=["default"];function d2(e){var t=W({},e);return f2.forEach(function(n){n in e&&(t[n]=oe(t[n]))}),t}function ml(e,t){this._canvas=e,this._modeling=t}ml.$inject=["canvas","modeling"],ml.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=st(r);return t.setRootElement(n),t.removeRootElement(r),Yt(a.rootElements,i),i.$parent=a,Wt(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},ml.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=st(n);return t.setRootElement(r),t.removeRootElement(n),Wt(a.rootElements,i),i.$parent=null,Yt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function zf(e,t){this._modeling=e,this._spaceTool=t}zf.$inject=["modeling","spaceTool"],zf.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=di(i),a=o===i,s=a?i:i.parent,c=Ar(s),l=pn(i);if(l?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var u=l?{x:i.x+fi,y:i.y,width:i.width-fi,height:i.height}:{x:i.x,y:i.y+fi,width:i.width,height:i.height-fi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var f=[];no(o,function(x){return f.push(x),x.label&&f.push(x.label),x===i?[]:Qe(x.children,function(C){return C!==i})});var p,d,m,h,y;r==="top"?(p=-120,d=i.y,m=d+10,h="n",y="y"):r==="left"?(p=-120,d=i.x,m=d+10,h="w",y="x"):r==="bottom"?(p=120,d=i.y+i.height,m=d-10,h="s",y="y"):r==="right"&&(p=120,d=i.x+i.width,m=d-10,h="e",y="x");var v=t.calculateAdjustments(f,y,p,m),g=l?{x:0,y:p}:{x:p,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,g,h,m);var b=l?{x:i.x+(a?fi:0),y:d-(r==="top"?120:0),width:i.width-(a?fi:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?fi:0),width:120,height:i.height-(a?fi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},b,s)};function Gf(e){this._modeling=e}Gf.$inject=["modeling"],Gf.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Ar(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=pn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,f,p;for(p=0;p<i;p++)p===i-1?l=s-c*p:l=c,u=a?{x:n.x+fi,y:n.y+p*c,width:n.width-fi,height:l}:{x:n.x+p*c,y:n.y+fi,width:l,height:n.height-fi},p<o?t.resizeShape(r[p],u):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,u,n))};function ls(e,t){this._modeling=e,this._spaceTool=t}ls.$inject=["modeling","spaceTool"],ls.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},ls.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=sP(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},ls.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=De(e),r=De(t),o=Zg(r,i),a=di(e),s=[],c=[];no(a,function(m){return s.push(m),(S(m,"bpmn:Lane")||S(m,"bpmn:Participant"))&&c.push(m),m.children});var l,u,f,p,d;(o.bottom||o.top)&&(l=o.bottom||o.top,u=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",p,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},f)),(o.left||o.right)&&(l=o.right||o.left,u=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-l:l,d=n.calculateAdjustments(c,"x",p,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},f))};var us="flowNodeRef",Vf="lanes";function gl(){}gl.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,f){var p=De(f),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(u){n.indexOf(u)===-1&&(o.push(u),n.push(u))}function c(u){var f=di(u);return r[f.id]||(r[f.id]=Dc(f)),r[f.id]}function l(u){if(!u.parent)return[];var f=c(u);return f.filter(function(p){return a(u,p)}).map(function(p){return p.businessObject})}return t.forEach(function(u){var f=di(u);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return S(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(u){var f=u.businessObject,p=f.get(Vf),d=p.slice(),m=l(u);i.push({flowNode:f,remove:d,add:m})}),t.forEach(function(u){var f=u.businessObject;u.parent||f.get(us).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},gl.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(Vf);n.remove.forEach(function(o){Wt(r,o),Wt(o.get(us),i)}),n.add.forEach(function(o){Yt(r,o),Yt(o.get(us),i)})}),[]},gl.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Vf);n.add.forEach(function(o){Wt(r,o),Wt(o.get(us),i)}),n.remove.forEach(function(o){Yt(r,o),Yt(o.get(us),i)})}),[]};var Wf="categoryValueRef";function ps(e,t){this._bpmnFactory=e,this._elementRegistry=t}ps.$inject=["bpmnFactory","elementRegistry"],ps.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:Uf(g)}:C.past={categoryValue:b}))}}function c(g){r.set(g,oe(g))}function l(){n.filter(function(g){return S(g,"bpmn:FlowElement")&&!Xe(g)&&g.parent}).forEach(c)}function u(g){var b=oe(g),x=b.get("categoryValueRef");return x||(x=Ug(i,b),o.push(h2(g,x))),x}function f(g){return g.reduce(function(b,x){var C=Uf(x),M=b.get(C);return M||(M=[],b.set(C,M)),M.push(x),b},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&l(),e.forEach(c),n.filter(function(g){return S(g,"bpmn:Group")&&!Xe(g)&&g.parent}).forEach(function(g){var b=oe(g).get("categoryValueRef");if(!b){var x=Uf(g),C=p.get(x)||[],M=jo(C,g),O=Object.keys(M).length>0;O&&(b=u(g))}s(g,b,!0)}),t.forEach(function(g){s(g.groupShape,g.categoryValue,!1)}),o.length&&l();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,y=f(d);a.forEach(function(g,b){var x=g.present;if(x){var C=y.get(x.root)||[],M=jo(C,b);C.forEach(function(O){if(M[O.id]){var P=h.get(O);P||(P=new Set,h.set(O,P)),P.add(x.categoryValue)}})}});var v=d.reduce(function(g,b){var x=r.get(b),C=x.get(Wf),M=new Set(C),O=h.get(b)||new Set,P=Array.from(O).filter(function(D){return!M.has(D)}),F=C.filter(function(D){return m.has(D)&&!O.has(D)});return(P.length||F.length)&&g.push({businessObject:x,categoryValuesToAdd:P,categoryValuesToRemove:F}),g},[]);return{flowElements:v,groups:o}},ps.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),m2(t.groups),y2(t.flowElements),[]},ps.prototype.revert=function(e){var t=e.updates;return v2(t.flowElements),g2(t.groups),[]};function h2(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function m2(e){e.forEach(function(t){oe(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function g2(e){e.forEach(function(t){oe(t.groupShape).categoryValueRef=null})}function y2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Wf);t.categoryValuesToRemove.forEach(function(r){Wt(i,r)}),t.categoryValuesToAdd.forEach(function(r){Yt(i,r,!0)})})}function v2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Wf);t.categoryValuesToAdd.forEach(function(r){Wt(i,r)}),t.categoryValuesToRemove.forEach(function(r){Yt(i,r,!0)})})}function Uf(e){for(;e.parent;)e=e.parent;return e}function yl(e){this._moddle=e}yl.$inject=["moddle"],yl.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),[]},yl.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 b2={fill:void 0,stroke:void 0};function Yf(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Hn(t)){var n=x2(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||b2,i=this,r={};"fill"in n&&W(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&W(r,{"border-color":this._normalizeColor(n.stroke)}),H(t,function(o){var a=gt(o)?Si(r,["border-color"]):r,s=st(o);if(_2(a),Xe(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(!Ze(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function x2(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 _2(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var w2={width:0,height:0};function xb(e,t,n){function i(c,l){var u=c.label||c,f=c.labelTarget||c;return XC(u,l),[u,f]}function r(c){var l=c.element,u=l.businessObject,f=c.newLabel;if(!Xe(l)&&Rr(l)&&!xc(l)&&!_b(f)){var p=7,d=gp(l);d={x:d.x,y:d.y+p},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function o(c){return c.oldLabel=ci(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!Xe(u)&&!S(u,"bpmn:TextAnnotation"))){if(Xe(u)&&_b(f)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var m=ci(l);typeof p>"u"&&(p=t.getExternalLabelBounds(u,m)),p&&e.resizeShape(u,p,w2)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}xb.$inject=["modeling","textRenderer","bpmnFactory"];function _b(e){return!e||!e.trim()}function wn(e,t,n,i){yt.call(this,e,t,n),this._bpmnRules=i}we(wn,yt),wn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],wn.prototype.getHandlers=function(){var e=yt.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=as,e["element.updateProperties"]=cs,e["canvas.updateRoot"]=ml,e["lane.add"]=zf,e["lane.resize"]=ls,e["lane.split"]=Gf,e["lane.updateRefs"]=gl,e["group.updateRefs"]=ps,e["id.updateClaim"]=yl,e["element.setColor"]=Yf,e["element.updateLabel"]=xb,e},wn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},wn.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)},wn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},wn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},wn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},wn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},wn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},wn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},wn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},wn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},wn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},wn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},wn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},wn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function wb(){}wb.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Le(t.source||e.source),t.connectionEnd||Le(t.target||e.target)]};var vl=20,E2=5,bl=Math.round,Eb=20,S2={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function R2(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function C2(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Sb(e,t,n){var i=bn(t,e,E2),r=n.split(":")[0],o=bl((t.x-e.x)/2+e.x),a=bl((t.y-e.y)/2+e.y),s,c,l=C2(r,i),u=/h|r|l/.test(r),f=!1,p=!1;return l?(s=u?{x:o,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(f=R2(i,r),c=u?"h:v":"v:h",f?u?(p=a===e.y,s={x:e.x+vl*(/l/.test(r)?-1:1),y:p?a+vl:a}):(p=o===e.x,s={x:p?o+vl:o,y:e.y+vl*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:qf(e,s,c).concat(s),directions:c,turnNextDirections:p}}function A2(e,t,n){return Sb(e,t,n)}function P2(e,t,n){var i=Sb(t,e,Rb(n));return{waypoints:i.waypoints.slice().reverse(),directions:Rb(i.directions),turnNextDirections:i.turnNextDirections}}function M2(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=qf(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Rb(e){return e.split(":").reverse().join(":")}function T2(e,t,n){var i=bl((t.x-e.x)/2+e.x),r=bl((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 qf(e,t,n){if(n=n||"h:h",!F2(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Ab(n)){var i=A2(e,t,n),r=P2(e,t,n),o=M2(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return T2(e,t,n)}function k2(e,t,n){var i=qf(e,t,n);return i.unshift(e),i.push(t),Mb(i)}function O2(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=rE(o,"straight")[0]||"h:h",s=S2[a]||0,c=bn(e,t,s),l=$2(c,a);n=n||Le(e),i=i||Le(t);var u=l.split(":"),f=Pb(n,e,u[0],j2(c)),p=Pb(i,t,u[1],c);return k2(f,p,l)}function D2(e,t,n,i,r,o){Ie(n)&&(r=n,o=i,n=Le(e),i=Le(t)),o=W({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&L2(e,t,n,i,o),c||(c=o.connectionEnd&&N2(t,e,i,r),c)||(c=o.connectionStart&&B2(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:O2(e,t,n,i,o)}function I2(e,t,n){return e>=t&&e<=n}function Cb(e,t,n){var i={x:"width",y:"height"};return I2(t[e],n[e],n[e]+n[i[e]])}function L2(e,t,n,i,r){var o={},a,s;return s=bn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Cb(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:Cb(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 B2(e,t,n,i){return Kf(e,t,n,i)}function N2(e,t,n,i){var r=i.slice().reverse();return r=Kf(e,t,n,r),r?r.reverse():null}function Kf(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!wt(u,function(f,p){var d=u[p-1];return d&&La(f,d)<3})}function o(u,f,p){var d=Qi(f,u);switch(d){case"v":return{x:p.x,y:u.y};case"h":return{x:u.x,y:p.y}}return{x:u.x,y:u.y}}function a(u,f,p){var d;for(d=u.length-2;d!==0;d--)if(Qm(u[d],f,Eb)||Qm(u[d],p,Eb))return u.slice(d);return u}if(r(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=o(c[1],s,n),l=a(c,e,t),l!==c&&(c=Kf(e,t,n,l)),c&&Qi(c)?null:c}function $2(e,t){if(Ab(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 F2(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Ab(e){return e&&/t|r|b|l/.test(e)}function j2(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 Pb(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 Mb(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return pp(r,o,n,0)||t.push(n),t},[])}var H2=-10,z2=40,G2={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},V2={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"},fs={top:"t",right:"r",bottom:"b",left:"l"};function xl(e){this._elementRegistry=e}we(xl,wb),xl.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,l;if(o||(o=Tb(r&&r[0],n)),a||(a=Tb(r&&r[r.length-1],i)),(S(e,"bpmn:Association")||S(e,"bpmn:DataAssociation"))&&r&&!kb(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=zg(n,s)?G2:V2;return S(e,"bpmn:MessageFlow")?c=U2(n,i,u):(S(e,"bpmn:SequenceFlow")||kb(n,i))&&(n===i?c={preferredLayouts:Q2(n,e,u)}:S(n,"bpmn:BoundaryEvent")?c={preferredLayouts:J2(n,i,a,u)}:ds(n)||ds(i)?c={preferredLayouts:u.subProcess,preserveDocking:q2(n)}:S(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:S(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=W(c,t),l=Mb(D2(n,i,o,a,r,c))),l||[o,a]};function W2(e){var t=e.host;return bn(Le(e),t,H2)}function U2(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:Y2(e,t)}}function Y2(e,t){return S(t,"bpmn:Participant")?"source":S(e,"bpmn:Participant")?"target":ds(t)?"source":ds(e)||S(t,"bpmn:Event")?"target":S(e,"bpmn:Event")?"source":null}function q2(e){return ds(e)?"target":"source"}function Tb(e,t){return e?e.original||e:Le(t)}function kb(e,t){return S(t,"bpmn:Activity")&&S(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function ds(e){return S(e,"bpmn:SubProcess")&&et(e)}function po(e,t){return e===t}function K2(e,t){return t.indexOf(e)!==-1}function oa(e){var t=/right|left/.exec(e);return t&&t[0]}function aa(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ob(e,t){return Xf[e]===t}function X2(e,t){var n=oa(e),i=Xf[n];return t.indexOf(i)!==-1}function Z2(e,t){var n=aa(e),i=Xf[n];return t.indexOf(i)!==-1}function Db(e){return e==="right"||e==="left"}function Q2(e,t,n){var i=t.waypoints,r=i&&i.length&&bn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function J2(e,t,n,i){var r=Le(e),o=Le(t),a=W2(e),s,c,l=po(e.host,t),u=K2(a,["top","right","bottom","left"]),f=bn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?ek(a,u,e,t,n,i):(s=tk(a,f,u,i.isHorizontal),c=nk(a,f,u,i.isHorizontal),[s+":"+c])}function ek(e,t,n,i,r,o){var a=t?e:o.isHorizontal?aa(e):oa(e),s=fs[a],c;return t?Db(e)?c=Ib("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Ib("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Ib(e,t,n,i){var r=z2;return!(Zf(e,i,n,r)||Zf(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Zf(e,i,Le(t),r))}function Zf(e,t,n,i){return Math.abs(t[e]-n[e])<i}function tk(e,t,n,i){if(n)return fs[e];var r=aa(e),o=oa(e),a=aa(t),s=oa(t);if(i){if(po(r,a)||Ob(o,s))return fs[r]}else if(po(o,s)||Ob(r,a))return fs[o];return fs[i?o:r]}function nk(e,t,n,i){if(n)return Db(e)?X2(e,t)||po(e,t)?"h":"v":Z2(e,t)||po(e,t)?"v":"h";var r=aa(e),o=oa(e),a=aa(t),s=oa(t);return a&&!s?"v":s&&!a?"h":i?po(r,a)?"h":"v":po(o,s)?"v":"h"}xl.$inject=["elementRegistry"];function Lb(e){return W({original:e.point.original||e.point},e.actual)}function Br(e,t){this._elementRegistry=e,this._graphicsFactory=t}Br.$inject=["elementRegistry","graphicsFactory"],Br.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(Lb(i)),o.push(Lb(r)),o},Br.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}},Br.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Ba(i,r,n)},Br.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Br.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Br.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Qf={__init__:["modeling","bpmnUpdater"],__depends__:[_M,NM,FM,jM,Yv,HT,GT,KT,mi,Lf,Jv],bpmnFactory:["type",yi],bpmnUpdater:["type",Xn],elementFactory:["type",Dr],modeling:["type",wn],layouter:["type",xl],connectionDocking:["type",Br]};var ik=10,Bb=50,rk=250;function Jf(e,t,n,i){for(var r;r=ok(e,n,t);)n=i(t,n,r);return n}function ed(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,l=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-l+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+l+c)}}),r}}function ok(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=sk(e);return wt(r,function(o){if(o===n)return!1;var a=bn(o,i,ik);return a==="intersect"})}function ak(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||Bb,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||rk,c=t.reference||"start";o||(o=uk);function l(m,h){return r==="n"?c==="start"?De(m).top-De(h).bottom:c==="center"?De(m).top-Le(h).y:De(m).top-De(h).top:r==="w"?c==="start"?De(m).left-De(h).right:c==="center"?De(m).left-Le(h).x:De(m).left-De(h).left:r==="s"?c==="start"?De(h).top-De(m).bottom:c==="center"?Le(h).y-De(m).bottom:De(h).bottom-De(m).bottom:c==="start"?De(h).left-De(m).right:c==="center"?Le(h).x-De(m).right:De(h).right-De(m).right}var u=e.incoming.filter(o).map(function(m){var h=a(m),y=h<0?l(m.source,e):l(e,m.source);return{id:m.source.id,distance:y,weight:h}}),f=e.outgoing.filter(o).map(function(m){var h=a(m),y=h>0?l(e,m.target):l(m.target,e);return{id:m.target.id,distance:y,weight:h}}),p=u.concat(f).reduce(function(m,h){return m[h.id+"__weight_"+h.weight]=h,m},{}),d=Gn(p,function(m,h){var y=h.distance,v=h.weight;return y<0||y>s||(m[String(y)]||(m[String(y)]=0),m[String(y)]+=1*v,(!m.distance||m[m.distance]<m[String(y)])&&(m.distance=y)),m},{});return d.distance||i}function sk(e){var t=td(e);return e.host&&(t=t.concat(td(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(td(i))},[]))),t}function td(e){return lk(e).concat(ck(e))}function ck(e){return e.incoming.map(function(t){return t.source})}function lk(e){return e.outgoing.map(function(t){return t.target})}function uk(){return!0}var pk=100;function Nb(e,t,n){e.on("autoPlace",pk,function(i){var r=i.shape,o=i.source;return fk(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}}Nb.$inject=["eventBus","modeling","canvas"];function fk(e,t,n){n||(n={});var i=n.defaultDistance||Bb,r=Le(e),o=De(e);return{x:o.right+i+t.width/2,y:r.y}}function $b(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}$b.$inject=["eventBus","selection"];const dk={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Nb],autoPlaceSelectionBehavior:["type",$b]};function Fb(e,t,n){var i=zg(e,n);if(S(t,"bpmn:TextAnnotation"))return mk(e,t,i);if(Ze(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return gk(e,t,i);if(S(t,"bpmn:FlowNode"))return hk(e,t,i)}function hk(e,t,n){var i=De(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=ak(e,{filter:function(d){return S(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,l=o.baseOrientation;S(e,"bpmn:BoundaryEvent")&&(l=bn(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+jb(l,c,o)}:{x:r.x+jb(l,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return Jf(e,t,u,ed(p))}function jb(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function mk(e,t,n){var i=De(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};gt(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 Jf(e,t,r,ed(a))}function gk(e,t,n){var i=De(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 Jf(e,t,r,ed(a))}function Hb(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Fb(r,i,t)})}Hb.$inject=["eventBus","elementRegistry"];const _l={__depends__:[dk],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Hb]},zb=[jg,za,Qf,_l];function yk(e={}){Ah(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Go({container:t,moddleExtensions:e.moddleExtensions??Gs,additionalModules:[...zb,...e.additionalModules??[]]})}const Gb={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","edge-overlap-opposite":"겹침","edge-overlap-mixed":"겹침","edge-overlap-unrelated":"겹침","shape-overlap":"겹침","shape-outside-container":"소속","label-on-shared-segment":"라벨","label-over-line":"라벨","annotation-over-label":"라벨","pool-name-over-label":"라벨","group-overlap-unintended":"그룹","group-overlap-unreadable":"그룹","group-stack-unreadable":"그룹","group-on-container-boundary":"그룹","group-on-group-boundary":"그룹","group-cuts-shape":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},vk={이:["이","가"],을:["을","를"],와:["과","와"]};function bk(e,t){const[n,i]=vk[t],r=e.at(-1)??"",o=r.charCodeAt(0);return o>=44032&&o<=55203?e+((o-44032)%28===0?i:n):r>="0"&&r<="9"?e+("013678".includes(r)?n:i):e+`${n}(${i})`}const xk={"bpmn:StartEvent":"시작 이벤트","bpmn:EndEvent":"종료 이벤트","bpmn:IntermediateCatchEvent":"중간 이벤트","bpmn:IntermediateThrowEvent":"중간 이벤트","bpmn:BoundaryEvent":"경계 이벤트","bpmn:Task":"작업","bpmn:UserTask":"작업","bpmn:ServiceTask":"작업","bpmn:SendTask":"작업","bpmn:ReceiveTask":"작업","bpmn:ManualTask":"작업","bpmn:ScriptTask":"작업","bpmn:BusinessRuleTask":"작업","bpmn:CallActivity":"작업","bpmn:SubProcess":"서브프로세스","bpmn:ExclusiveGateway":"게이트웨이","bpmn:ParallelGateway":"게이트웨이","bpmn:InclusiveGateway":"게이트웨이","bpmn:EventBasedGateway":"게이트웨이","bpmn:ComplexGateway":"게이트웨이","bpmn:Participant":"풀","bpmn:Lane":"레인","bpmn:TextAnnotation":"주석","bpmn:Group":"그룹","bpmn:DataStoreReference":"데이터 저장소","bpmn:DataObjectReference":"데이터 객체","bpmn:SequenceFlow":"연결선","bpmn:MessageFlow":"메시지 연결선","bpmn:Association":"연관선"},_k="요소";function nd(e){return(e&&xk[e.type])??_k}const Vb=20;function wk(e){const t=e.replace(/\s+/g," ").trim();return t.length>Vb?`${t.slice(0,Vb)}…`:t}function wl(e,t,n,i=""){const r=e(t),o=(r==null?void 0:r.name)===void 0?void 0:wk(r.name),a=o===void 0?i+nd(r):o,s=o===void 0?a:`「${o}」`;return n?s+bk(a,n).slice(a.length):s}function Ek(e,t,n,i,r){const[o,a]=[e(t),e(n)],s=(o==null?void 0:o.name)===void 0&&(a==null?void 0:a.name)===void 0&&nd(o)===nd(a);return[wl(e,t,i),wl(e,n,r,s?"다른 ":"")]}function Sk(e){switch(e.kind){case"shape-overlap":return e.identical?"error":"warning";case"shape-outside-container":return"error";case"edge-endpoint-detached":return"error";case"pool-overlap":return e.contained?"error":"warning";case"group-cuts-shape":return"error";default:return"warning"}}function Rk(e){switch(e.kind){case"edge-crosses-shape":return[e.edge,e.shape];case"edge-crosses-subprocess":return[e.edge,e.subProcess];case"edge-endpoint-detached":return[e.edge,e.shape];case"shape-overlap":return[...e.shapes];case"shape-outside-container":return[e.shape,e.container];case"edge-overlap-opposite":case"edge-overlap-mixed":case"edge-overlap-unrelated":return[...e.edges];case"label-on-shared-segment":return[e.edge,e.other];case"label-over-line":return[e.edge,e.line];case"annotation-over-label":return[e.annotation,e.label];case"group-overlap-unintended":return e.container?[e.container,...e.groups.filter(t=>t!==e.container)]:[...e.groups];case"group-overlap-unreadable":return e.reason==="orphan"?[...e.groups,...e.shapes]:[e.group,...e.shapes];case"group-stack-unreadable":return[...e.groups,...e.shapes];case"group-on-container-boundary":return[e.group,e.container];case"group-on-group-boundary":return[...e.groups];case"group-cuts-shape":return[e.group,e.shape];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const Wb={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function Ck(e,t){const n=(r,o)=>wl(t,r,o),i=(r,o,a,s)=>Ek(t,r,o,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[r,o]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${r} ${o} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${r} ${o} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[r,o]=i(e.edge,e.other,void 0,"와");return`${r}의 라벨이 ${o} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[r,o]=i(e.groups[0],e.groups[1],"와","이");return`${r} ${o} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${Wb[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${Wb[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[r,o]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${r} ${o} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${r} ${o} 겹칩니다.`}}}function Ak(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${wl(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const Ub="기타",id={error:0,warning:1,info:2};function Yb(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${Tt(i)}`,source:"geometry",code:i.kind,severity:Sk(i),targetRefs:Rk(i),category:Gb[i.kind]??Ub,message:Ck(i,t)});for(const i of e.semantic)n.push({key:`s:${i.ruleId}|${i.targetRefs.join(",")}`,source:"semantic",code:i.ruleId,severity:i.severity,targetRefs:[...i.targetRefs],category:Gb[i.ruleId]??Ub,message:Ak(i,t)});return n}function qb(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function sa(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function rd(e,t){if(t===void 0||e.length===0)return!1;const n=sa(e[0],t);return e.some(i=>sa(i,t)!==n)}function Kb(e,t){const n=rd(e,t);return e.slice().sort((i,r)=>(n?Number(sa(r,t))-Number(sa(i,t)):0)||id[i.severity]-id[r.severity])}var Pk=new ia("ov"),Mk=500;function gn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=Pk,this._overlayDefaults=W({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=Tk(n.getContainer()),this._init()}gn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],gn.prototype.get=function(e){if(Hn(e)&&(e={id:e}),Hn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Qe(t.overlays,Po({type:e.type})):t.overlays.slice():[]}else return e.type?Qe(this._overlays,Po({type:e.type})):e.id?this._overlays[e.id]:null},gn.prototype.add=function(e,t,n){if(ln(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=W({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},gn.prototype.remove=function(e){var t=this.get(e)||[];Ie(t)||(t=[t]);var n=this;H(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(Di(i.html),Di(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)}})},gn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},gn.prototype.show=function(){El(this._overlayRoot)},gn.prototype.hide=function(){El(this._overlayRoot,!1)},gn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],oc(this._overlayRoot)},gn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Zt(t);i=o.x,r=o.y}Xb(n,i,r),Pn(e.html,"data-container-id",t.id)},gn.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=Zt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Zt(i).height:s=i.height,o=t.bottom*-1+s}Xb(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},gn.prototype._createOverlayContainer=function(e){var t=Mt('<div class="djs-overlays" />');Ln(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},gn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Zb(this._overlayRoot,n)},gn.prototype._getOverlayContainer=function(e,t){var n=wt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},gn.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)),Hn(i)&&(i=Mt(i)),o=this._getOverlayContainer(n),r=Mt('<div class="djs-overlay" data-overlay-id="'+t+'">'),Ln(r,{position:"absolute"}),r.appendChild(i),e.type&&Lt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();El(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())},gn.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&&(rn(r)&&r>t.scale||rn(o)&&o<t.scale))&&(c=!1),El(a,c),this._updateOverlayScale(e,t)},gn.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),rn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),rn(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),rn(a)&&(s="scale("+a+","+a+")"),Zb(o,s)},gn.prototype._updateOverlaysVisibilty=function(e){var t=this;H(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},gn.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});H(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){Di(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",Mk,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(H(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&&Lt(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 Tk(e){var t=Mt('<div class="djs-overlay-container" />');return Ln(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Xb(e,t,n){Ln(e,{left:t+"px",top:n+"px"})}function El(e,t){e.style.display=t===!1?"none":""}function Zb(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Sl={__init__:["overlays"],overlays:["type",gn]};function od(e,t){t.invoke(ne,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)})}we(od,ne),od.$inject=["canvas","injector"];const kk={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",od]};function hs(e){return CSS.escape(e)}var Ok={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Qb(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return Ok[t]})}var Dk="bjs-breadcrumbs-shown";function Jb(e,t,n){var i=Mt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Lt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=oe(l),f=wt(a,function(p){return p===u});f&&s()});function s(c){c&&(a=Ik(c));var l=a.flatMap(function(f){var p=n.findRoot($i(f))||n.findRoot(f.id);if(!p&&S(f,"bpmn:Process")){var d=t.find(function(y){var v=oe(y);return v&&v.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var m=Qb(f.name||f.id),h=Mt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(p)}),h});i.innerHTML="";var u=l.length>1;o.toggle(Dk,u),l.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}Jb.$inject=["eventBus","elementRegistry","canvas"];function Ik(e){for(var t=oe(e),n=[],i=t;i;i=i.$parent)(S(i,"bpmn:SubProcess")||S(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function ex(e,t){var n=null,i=new Lk;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,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}ex.$inject=["eventBus","canvas"];function Lk(){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 tx={x:180,y:160};function fo(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}fo.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)})}},fo.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),Nk(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},fo.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=Bk(e),i={x:n.x-tx.x,y:n.y-tx.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)})},fo.prototype._moveToDiPlane=function(e,t){var n=nx(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},fo.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},fo.$inject=["eventBus","moddle"];function nx(e){return S(e,"bpmndi:BPMNDiagram")?e:nx(e.$parent)}function Bk(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=De(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),hc(t)}function Nk(e,t){var n=e.$parent;return!(!S(n,"bpmn:SubProcess")||n===t.bpmnElement||Ze(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Rl=250,$k='<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>',Fk="bjs-drilldown-empty";function Nr(e,t,n,i,r){ne.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",Rl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Rl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Rl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],Rl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}we(Nr,ne),Nr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Nr.prototype._canDrillDown=function(e){var t=this._canvas;return S(e,"bpmn:SubProcess")&&t.findRoot($i(e))},Nr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=oe(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Lt(i.html).toggle(Fk,!r)}},Nr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=oe(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=Mt('<button type="button" class="bjs-drilldown">'+$k+"</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($i(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},Nr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Nr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const jk={__depends__:[Sl,Lf,kk],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Jb],drilldownCentering:["type",ex],drilldownOverlayBehavior:["type",Nr],subprocessCompatibility:["type",fo]};function $r(e){Nt.call(this,e)}we($r,Nt),$r.prototype._modules=[jg,jk,Sl,mi,za],$r.prototype._moddleExtensions={};var Cl="keyboard.keydown",Hk="keyboard.keyup",zk=1e3,ix="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 Bn(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(ix));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Bn.$inject=["config.keyboard","eventBus"],Bn.prototype._keydownHandler=function(e){this._keyHandler(e,Cl)},Bn.prototype._keyupHandler=function(e){this._keyHandler(e,Hk)},Bn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Cl,i),n&&e.preventDefault()}},Bn.prototype._isEventIgnored=function(e){return!1},Bn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(ix)),this.unbind(),e=this._node=this._target,je.bind(e,"keydown",this._keydownHandler),je.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Bn.prototype.getBinding=function(){return this._node},Bn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),je.unbind(e,"keydown",this._keydownHandler),je.unbind(e,"keyup",this._keyupHandler)),this._node=null},Bn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Bn.prototype.addListener=function(e,t,n){un(e)&&(n=t,t=e,e=zk),this._eventBus.on(n||Cl,e,t)},Bn.prototype.removeListener=function(e,t){this._eventBus.off(t||Cl,e)},Bn.prototype.hasModifier=JM,Bn.prototype.isCmd=qn,Bn.prototype.isShift=Sf,Bn.prototype.isKey=sn;var Gk=500;function ca(e,t){var n=this;e.on("editorActions.init",Gk,function(i){var r=i.editorActions;n.registerBindings(t,r)})}ca.$inject=["eventBus","keyboard"],ca.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(rT(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(oT(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(eT(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(tT(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(nT(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(iT(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(sn(["+","Add","="],r)&&qn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(sn(["-","Subtract"],r)&&qn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(sn("0",r)&&qn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(sn(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const ad={__init__:["keyboard","keyboardBindings"],keyboard:["type",Bn],keyboardBindings:["type",ca]};var Vk={moveSpeed:50,moveSpeedAccelerated:200};function rx(e,t,n){var i=this;this._config=W({},Vk,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,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}rx.$inject=["config.keyboardMove","keyboard","canvas"];const ox={__depends__:[ad],__init__:["keyboardMove"],keyboardMove:["type",rx]};var Wk=15;function ax(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,l=n.button,u=ao(s),f=Ci(u,c);if(!n.dragging&&Uk(f)>Wk&&(n.dragging=!0,l===0&&Cv(e),Qc("grab")),n.dragging){var p=n.last||n.start;f=Ci(u,p),t.scroll({dx:f.x,dy:f.y}),n.last=u}s.preventDefault()}function o(s){je.unbind(document,"mousemove",r),je.unbind(document,"mouseup",o),n=null,Rv()}function a(s){if(!eo(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:ao(s)},je.bind(document,"mousemove",r),je.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}ax.$inject=["eventBus","canvas"];function Uk(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const sx={__init__:["moveCanvas"],moveCanvas:["type",ax]};function cx(e,t){var n=xp(e.min),i=xp(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function Yk(e,t){return Math.max(e.min,Math.min(e.max,t))}var qk=Math.sign||function(e){return e>=0?1:-1},sd={min:.2,max:4},lx=10,Kk=.1,Xk=.75;function Hi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=$n(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||Xk;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Hi.$inject=["config.zoomScroll","eventBus","canvas"],Hi.prototype.scroll=function(t){this._canvas.scroll(t)},Hi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Hi.prototype.zoom=function(t,n){var i=cx(sd,lx*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Kk&&(this._zoom(t,n,i),this._totalDelta=0)},Hi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Dy()&&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))*qk(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)}},Hi.prototype.stepZoom=function(t,n){var i=cx(sd,lx);this._zoom(t,n,i)},Hi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=xp(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(Yk(sd,s),t)},Hi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&je[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Hi.prototype._init=function(e){this.toggle(e)};const ux={__init__:["zoomScroll"],zoomScroll:["type",Hi]};function ms(e){$r.call(this,e)}we(ms,$r),ms.prototype._navigationModules=[ox,sx,ux],ms.prototype._modules=[].concat($r.prototype._modules,ms.prototype._navigationModules);function cd(e){return e&&e[e.length-1]}function px(e){return e.y}function fx(e){return e.x}var Zk={left:fx,center:fx,right:function(e){return e.x+e.width},top:px,middle:px,bottom:function(e){return e.y+e.height}};function la(e,t){this._modeling=e,this._rules=t}la.$inject=["modeling","rules"],la.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}},la.prototype._isType=function(e,t){return t.indexOf(e)!==-1},la.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,l,u;function f(p,d){return Math.round((p[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=cd(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(H(t,function(p){var d=p[i]+Math.round(p[r]/2);a[d]?a[d].elements.push(p):a[d]={elements:[p],center:d}}),c=Pi(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=cd(c).center,o;l=t[0],t=Pi(t,function(p){return p[i]+p[r]}),u=cd(t),o[e]=f(l,u)}return o},la.prototype.trigger=function(e,t){var n=this._modeling,i,r=Qe(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Ie(i)&&(r=i),!(r.length<2||!i)){var o=Zk[t],a=Pi(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const Qk={__init__:["alignElements"],alignElements:["type",la]},Jk=new ia;function ua(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}ua.$inject=["eventBus"],ua.prototype.schedule=function(e,t=Jk.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},ua.prototype._schedule=function(e,t){const n=eO();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}},ua.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},ua.prototype._cancel=function(e){clearTimeout(e.executionId)};function eO(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const tO={scheduler:["type",ua]};var nO="djs-element-hidden",Al=".entry",iO=1e3,dx=8,rO=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=Ie(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=Ie(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Jt.prototype._createContainer=function(){var e=Mt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Jt.prototype.registerProvider=function(e,t){t||(t=e,e=iO),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Jt.prototype.getEntries=function(e){var t=this._getProviders(),n=Ie(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return H(t,function(r){if(un(r[n])){var o=r[n](e);un(o)?i=o(i):H(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=Pn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},rO);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(un(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;H(t,function(r,o){var a=r.group||"default",s=Mt(r.html||'<div class="entry" draggable="true"></div>'),c;Pn(s,"data-action",o),c=ht("[data-group="+hs(a)+"]",n),c||(c=Mt('<div class="group"></div>'),Pn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&oO(s,r.className),r.title&&Pn(s,"title",r.title),r.imageUrl&&(i=Mt("<img>"),Pn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Lt(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=Mt('<div class="djs-context-pad"></div>');return Wn.bind(n,Al,"click",function(i){t.trigger("click",i)}),Wn.bind(n,Al,"dragstart",function(i){t.trigger("dragstart",i)}),Wn.bind(n,Al,"mouseover",function(i){t.trigger("mouseover",i)}),Wn.bind(n,Al,"mouseout",function(i){t.trigger("mouseout",i)}),je.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()&&sO(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 Ie(e)!==Ie(n)?!1:Ie(e)?e.length===n.length&&Xr(e,function(i){return n.includes(i)}):n===e},Jt.prototype.isShown=function(){return this.isOpen()&&Lt(this._current.html).has("open")},Jt.prototype.show=function(){this.isOpen()&&(Lt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Jt.prototype.hide=function(){this.isOpen()&&(Lt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Jt.prototype._getPosition=function(e){if(!Ie(e)&&gt(e)){var t=this._canvas.viewbox(),n=aO(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+dx*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+dx*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=Ie(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,nO)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Jt.prototype._getTargetBounds=function(e){var t=this,n=Ie(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 oO(e,t){var n=Lt(e);t=Ie(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function aO(e){return e.waypoints[e.waypoints.length-1]}function sO(e,t){return e=Ie(e)?e:[e],t=Ie(t)?t:[t],e.length===t.length&&Xr(e,function(n){return t.includes(n)})}const hx={__depends__:[Zc,tO,Sl],contextPad:["type",Jt]};var Pl,Ft,mx,Fr,gx,yx,vx,ld,Ml,gs,bx,ud,pd,fd,Tl={},kl=[],cO=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ol=Array.isArray;function cr(e,t){for(var n in t)e[n]=t[n];return e}function dd(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function xx(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?Pl.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 Dl(e,a,i,r,null)}function Dl(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??++mx,__i:-1,__u:0};return r==null&&Ft.vnode!=null&&Ft.vnode(o),o}function Il(e){return e.children}function Ll(e,t){this.props=e,this.context=t}function ho(e,t){if(t==null)return e.__?ho(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"?ho(e):null}function lO(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=cr({},t);o.__v=t.__v+1,Ft.vnode&&Ft.vnode(o),hd(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??ho(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Px(i,o,r),t.__e=t.__=null,o.__e!=n&&_x(o)}}function _x(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}),_x(e)}function wx(e){(!e.__d&&(e.__d=!0)&&Fr.push(e)&&!Bl.__r++||gx!=Ft.debounceRendering)&&((gx=Ft.debounceRendering)||yx)(Bl)}function Bl(){try{for(var e,t=1;Fr.length;)Fr.length>t&&Fr.sort(vx),e=Fr.shift(),t=Fr.length,lO(e)}finally{Fr.length=Bl.__r=0}}function Ex(e,t,n,i,r,o,a,s,c,l,u){var f,p,d,m,h,y,v=i&&i.__k||kl,g=t.length;for(c=uO(n,t,v,c,g),f=0;f<g;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&v[d.__i]||Tl,d.__i=f,y=hd(e,d,p,r,o,a,s,c,l,u),m=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&md(p.ref,null,d),u.push(d.ref,d.__c||m,d)),h==null&&m!=null&&(h=m),4&d.__u?(c=Sx(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),d.__u&=-7);return n.__e=h,c}function uO(e,t,n,i,r){var o,a,s,c,l,u=n.length,f=u,p=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=Dl(null,a,null,null,null):Ol(a)?a=e.__k[o]=Dl(Il,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Dl(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=pO(a,n,c,f))!=-1&&(f--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(r>u?p--:r<u&&p++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?p--:l==c+1?p++:(l>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<u;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=ho(s)),Tx(s,s));return i}function Sx(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=Sx(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=ho(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function pO(e,t,n,i){var r,o,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((l=t[a=r>=0?r--:o++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function Rx(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||cO.test(t)?n:n+"px"}function Nl(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||Rx(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Rx(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(bx,"$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[gs]=i[gs]:(n[gs]=ud,e.addEventListener(t,o?fd:pd,o)):e.removeEventListener(t,o?fd:pd,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 Cx(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ml]==null)t[Ml]=ud++;else if(t[Ml]<n[gs])return;return n(Ft.event?Ft.event(t):t)}}}function hd(e,t,n,i,r,o,a,s,c,l){var u,f,p,d,m,h,y,v,g,b,x,C,M,O,P,F,D=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=Ft.__b)&&u(t);e:if(typeof D=="function"){f=a.length;try{if(g=t.props,b=D.prototype&&D.prototype.render,x=(u=D.contextType)&&i[u.__c],C=u?x?x.props.value:u.__:i,n.__c?v=(p=t.__c=n.__c).__=p.__E:(b?t.__c=p=new D(g,C):(t.__c=p=new Ll(g,C),p.constructor=D,p.render=dO),x&&x.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),b&&p.__s==null&&(p.__s=p.state),b&&D.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=cr({},p.__s)),cr(p.__s,D.getDerivedStateFromProps(g,p.__s))),m=p.props,h=p.state,p.__v=t,d)b&&D.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),b&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(b&&D.getDerivedStateFromProps==null&&g!==m&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(g,C),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(g,p.__s,C)===!1){t.__v!=n.__v&&(p.props=g,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(I){I&&(I.__=t)}),kl.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=ho(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(g,p.__s,C),b&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(m,h,y)})}if(p.context=C,p.props=g,p.__P=e,p.__e=!1,M=Ft.__r,O=0,b)p.state=p.__s,p.__d=!1,M&&M(t),u=p.render(p.props,p.state,p.context),kl.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,M&&M(t),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++O<25);p.state=p.__s,p.getChildContext!=null&&(i=cr(cr({},i),p.getChildContext())),b&&!d&&p.getSnapshotBeforeUpdate!=null&&(y=p.getSnapshotBeforeUpdate(m,h)),P=u!=null&&u.type===Il&&u.key==null?Mx(u.props.children):u,s=Ex(e,Ol(P)?P:[P],t,n,i,r,o,a,s,c,l),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),v&&(p.__E=p.__=null)}catch(I){if(a.length=f,t.__v=null,c||o!=null){if(I.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(F=o.length;F--;)dd(o[F])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),I.then||Ax(t),Ft.__e(I,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=fO(n.__e,t,n,i,r,o,a,c,l);return(u=Ft.diffed)&&u(t),128&t.__u?void 0:s}function Ax(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ax))}function Px(e,t,n){for(var i=0;i<n.length;i++)md(n[i],n[++i],n[++i]);Ft.__c&&Ft.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Ft.__e(o,r.__v)}})}function Mx(e){return typeof e!="object"||e==null||e.__b>0?e:Ol(e)?e.map(Mx):e.constructor!==void 0?null:cr({},e)}function fO(e,t,n,i,r,o,a,s,c){var l,u,f,p,d,m,h,y=n.props||Tl,v=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(l=0;l<o.length;l++)if((d=o[l])&&"setAttribute"in d==!!g&&(g?d.localName==g:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(g==null)return document.createTextNode(v);e=document.createElementNS(r,g,v.is&&v),s&&(Ft.__m&&Ft.__m(t,o),s=!1),o=null}if(g==null)y===v||s&&e.data==v||(e.data=v);else{if(o=g=="textarea"&&v.defaultValue!=null?null:o&&Pl.call(e.childNodes),!s&&o!=null)for(y={},l=0;l<e.attributes.length;l++)y[(d=e.attributes[l]).name]=d.value;for(l in y)d=y[l],l=="dangerouslySetInnerHTML"?f=d:l=="children"||l in v||l=="value"&&"defaultValue"in v||l=="checked"&&"defaultChecked"in v||Nl(e,l,null,d,r);for(l in v)d=v[l],l=="children"?p=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?m=d:l=="checked"?h=d:s&&typeof d!="function"||y[l]===d||Nl(e,l,d,y[l],r);if(u)s||f&&(u.__html==f.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(f&&(e.innerHTML=""),Ex(t.type=="template"?e.content:e,Ol(p)?p:[p],t,n,i,g=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&ho(n,0),s,c),o!=null)for(l=o.length;l--;)dd(o[l]);s&&g!="textarea"||(l="value",g=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[l]||g=="progress"&&!m||g=="option"&&m!=y[l])&&Nl(e,l,m,y[l],r),l="checked",h!=null&&h!=e[l]&&Nl(e,l,h,y[l],r))}return e}function md(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){Ft.__e(r,n)}}function Tx(e,t,n){var i,r;if(Ft.unmount&&Ft.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||md(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Ft.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Tx(i[r],t,n||typeof e.type!="function");n||dd(e.__e),e.__c=e.__=e.__e=void 0}function dO(e,t,n){return this.constructor(e,n)}function kx(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Ft.__&&Ft.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],hd(t,e=t.__k=xx(Il,null,[e]),r||Tl,Tl,t.namespaceURI,r?null:t.firstChild?Pl.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Px(o,e,a),e.props.children=null}Pl=kl.slice,Ft={__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}},mx=0,Ll.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=cr({},this.state),typeof e=="function"&&(e=e(cr({},n),this.props)),e&&cr(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),wx(this))},Ll.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),wx(this))},Ll.prototype.render=Il,Fr=[],yx=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,vx=function(e,t){return e.__v.__b-t.__v.__b},Bl.__r=0,ld=Math.random().toString(8),Ml="__d"+ld,gs="__a"+ld,bx=/(PointerCapture)$|Capture$/i,ud=0,pd=Cx(!1),fd=Cx(!0);var Ox=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,Ox(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Dx=new Map;function hO(e){var t=Dx.get(this);return t||(t=new Map,Dx.set(this,t)),(t=Ox(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],l=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},u=0;u<n.length;u++){u&&(o===1&&l(),l(u));for(var f=0;f<n[u].length;f++)i=n[u][f],o===1?i==="<"?(l(),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===">"?(l(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[u][f+1]===">")?(l(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
- `||i==="\r"?(l(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var vt=hO.bind(xx),pa,en,gd,Ix,ys=0,Lx=[],cn=Ft,Bx=cn.__b,Nx=cn.__r,$x=cn.diffed,Fx=cn.__c,jx=cn.unmount,Hx=cn.__;function $l(e,t){cn.__h&&cn.__h(en,e,ys||t),ys=0;var n=en.__H||(en.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function yd(e){return ys=1,mO(Gx,e)}function mO(e,t,n){var i=$l(pa++,2);if(i.t=e,!i.__c&&(i.__=[Gx(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],l=i.t(c,s);c!==l&&(i.__N=[l,i.__[1]],i.__c.setState({}))}],i.__c=en,!en.__f)){var r=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,f=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){u=!0;var m=d.__[0];d.__=d.__N,d.__N=void 0,m!==d.__[0]&&(f=!0)}}),o){var p=o.call(this,s,c,l);return u?p||f:p}return!u||f};en.__f=!0;var o=en.shouldComponentUpdate,a=en.componentWillUpdate;en.componentWillUpdate=function(s,c,l){if(this.__e){var u=o;o=void 0,r(s,c,l),o=u}a&&a.call(this,s,c,l)},en.shouldComponentUpdate=r}return i.__N||i.__}function Fl(e,t){var n=$l(pa++,3);!cn.__s&&xd(n.__H,t)&&(n.__=e,n.u=t,en.__H.__h.push(n))}function vd(e,t){var n=$l(pa++,4);!cn.__s&&xd(n.__H,t)&&(n.__=e,n.u=t,en.__h.push(n))}function jl(e){return ys=5,lr(function(){return{current:e}},[])}function lr(e,t){var n=$l(pa++,7);return xd(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function vs(e,t){return ys=8,lr(function(){return e},t)}function gO(){for(var e;e=Lx.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Hl),t.__h.some(bd),t.__h=[]}catch(n){t.__h=[],cn.__e(n,e.__v)}}}cn.__b=function(e){en=null,Bx&&Bx(e)},cn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Hx&&Hx(e,t)},cn.__r=function(e){Nx&&Nx(e),pa=0;var t=(en=e.__c).__H;t&&(gd===en?(t.__h=[],en.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Hl),t.__h.some(bd),t.__h=[],pa=0)),gd=en},cn.diffed=function(e){$x&&$x(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Lx.push(t)!==1&&Ix===cn.requestAnimationFrame||((Ix=cn.requestAnimationFrame)||yO)(gO)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),gd=en=null},cn.__c=function(e,t){t.some(function(n){try{n.__h.some(Hl),n.__h=n.__h.filter(function(i){return!i.__||bd(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],cn.__e(i,n.__v)}}),Fx&&Fx(e,t)},cn.unmount=function(e){jx&&jx(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Hl(i)}catch(r){t=r}}),n.__H=void 0,t&&cn.__e(t,n.__v))};var zx=typeof requestAnimationFrame=="function";function yO(e){var t,n=function(){clearTimeout(i),zx&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);zx&&(t=requestAnimationFrame(n))}function Hl(e){var t=en,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),en=t}function bd(e){var t=en;e.__c=e.__(),en=t}function xd(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Gx(e,t){return typeof t=="function"?t(e):t}function vO(e){const{navigationStack:t,setNavigationStack:n}=e,i=lr(()=>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 vt`
10
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+p+'" height="'+d+'" viewBox="'+u+" "+f+" "+p+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},Ft.prototype._setDefinitions=function(e){this._definitions=e},Ft.prototype.getModules=function(){return this._modules},Ft.prototype.clear=function(){this.getDefinitions()&&Sr.prototype.clear.call(this)},Ft.prototype.destroy=function(){Sr.prototype.destroy.call(this),Oi(this._container)},Ft.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Ft.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Ft.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=bt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Ft.prototype.getDefinitions=function(){return this._definitions},Ft.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Ft.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=W(Pi(n,["additionalModules"]),{canvas:W({},n.canvas,{container:e}),modules:a});Sr.call(this,s),n&&n.container&&this.attachTo(n.container)},Ft.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Ft.prototype._createContainer=function(e){const t=kt('<div class="bjs-container"></div>');return Bn(t,{width:Lg(e.width),height:Lg(e.height),position:e.position}),t},Ft.prototype._createModdle=function(e){const t=W({},this._moddleExtensions,e.moddleExtensions);return new Ch(t)},Ft.prototype._modules=[];function bc(e,t){return e.warnings=t,e}function HC(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 zC={width:"100%",height:"100%",position:"relative"};function Lg(e){return e+(Fe(e)?"px":"")}function GC(e,t){return t&&At(e.diagrams,function(n){return n.id===t})||null}function VC(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Tg+"</a>",i=kt(n);Bn(bt("svg",i),kg),Bn(i,Og,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),je.bind(i,"click",function(r){jC(),r.preventDefault()})}function zo(e){Ft.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)}we(zo,Ft),zo.prototype._createModdle=function(e){var t=Ft.prototype._createModdle.call(this,e);return t.ids=new ki([32,36,1]),t},zo.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 nt(e,t){return S(e,"bpmn:CallActivity")?!1:S(e,"bpmn:SubProcess")?(t=t||ct(e),t&&S(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):S(e,"bpmn:Participant")?!!oe(e).processRef:!0}function fn(e){if(!(!S(e,"bpmn:Participant")&&!S(e,"bpmn:Lane"))){var t=ct(e).isHorizontal;return t===void 0?!0:t}}function WC(e){return e&&oe(e).isInterrupting!==!1}function On(e){return e&&!!oe(e).triggeredByEvent}function Go(e,t){var n=oe(e).eventDefinitions;return hr(n,function(i){return S(i,t)})}function UC(e){return Go(e,"bpmn:ErrorEventDefinition")}function YC(e){return Go(e,"bpmn:EscalationEventDefinition")}function qC(e){return Go(e,"bpmn:CompensateEventDefinition")}var ro={width:90,height:20},Ig=15;function Rr(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 xc(e){return Xe(e.label)}function KC(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=XC(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-=Ig:a+=Ig,{x:a,y:s}}function XC(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 yp(e){return e.waypoints?KC(e.waypoints):S(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+ro.height/2}:{x:e.x+e.width/2,y:e.y+e.height+ro.height/2}}function ZC(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(ro.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=yp(t),i=ro),W({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Bg(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 QC(e){var t=e.categoryValueRef;return t&&t.value||""}function ci(e){var t=e.businessObject,n=Bg(t);if(n)return n==="categoryValueRef"?QC(t):t[n]||""}function JC(e,t){var n=e.businessObject,i=Bg(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function eA(e){return Xe(e)&&Rr(e.labelTarget)}var Vo=7;function Ng(e){let t=[];return H(e.incoming,n=>{S(n,"bpmn:Association")&&S(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),H(e.outgoing,n=>{S(n,"bpmn:Association")&&S(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function $a(e){const t=new Map;return H(up(e),n=>{H(Ng(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 vp="hsl(225, 10%, 15%)",tA="white";function Bi(e,t){return hr(e.eventDefinitions,function(n){return n.$type===t})}function nA(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function iA(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function et(e,t,n){var i=ct(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||tA}function xe(e,t,n){var i=ct(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||vp}function Fa(e,t,n,i){var r=ct(e),o=r.get("label");return i||o&&o.get("color:color")||t||xe(e,n)}function $g(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 to(r)}function bp(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 to(a)}function rA(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 to(s)}function oA(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 to(o)}function ja(e,t={}){return{width:pi(e,t),height:qn(e,t)}}function pi(e,t={}){return Gn(t,"width")?t.width:e.width}function qn(e,t={}){return Gn(t,"height")?t.height:e.height}var aA=new ki,sA=10,_c=3,cA=1.5,wc=10,lA=4,Wo=.95,uA=1,pA=.25;function oo(e,t,n,i,r,o,a){Zi.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(k){return n.computeStyle(k,{strokeLinecap:"round",strokeLinejoin:"round",stroke:vp,strokeWidth:2,fill:"white"})}function f(k){return n.computeStyle(k,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:vp,strokeWidth:2})}function p(k,w){var{ref:E={x:0,y:0},scale:G=1,element:U,parentGfx:Z=r._svg}=w,Ce=Te("marker",{id:k,viewBox:"0 0 20 20",refX:E.x,refY:E.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});We(Ce,U);var Ke=bt(":scope > defs",Z);Ke||(Ke=Te("defs"),We(Z,Ke)),We(Ke,Ce)}function d(k,w,E,G){var U=aA.nextPrefixed("marker-");return m(k,U,w,E,G),"url(#"+U+")"}function m(k,w,E,G,U){if(E==="sequenceflow-end"){var Z=Te("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:U,stroke:U,strokeWidth:1})});p(w,{element:Z,ref:{x:11,y:10},scale:.5,parentGfx:k})}if(E==="messageflow-start"){var Ce=Te("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(w,{element:Ce,ref:{x:6,y:6},parentGfx:k})}if(E==="messageflow-end"){var Ke=Te("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(w,{element:Ke,ref:{x:8.5,y:5},parentGfx:k})}if(E==="association-start"){var ut=Te("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(w,{element:ut,ref:{x:1,y:10},scale:.5,parentGfx:k})}if(E==="association-end"){var Gt=Te("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(w,{element:Gt,ref:{x:11,y:10},scale:.5,parentGfx:k})}if(E==="conditional-flow-marker"){var yt=Te("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:U})});p(w,{element:yt,ref:{x:-1,y:10},scale:.5,parentGfx:k})}if(E==="conditional-default-flow-marker"){var qt=Te("path",{d:"M 6 4 L 10 16",...u({stroke:U,fill:"none"})});p(w,{element:qt,ref:{x:0,y:10},scale:.5,parentGfx:k})}}function h(k,w,E,G,U={}){un(G)&&(U=G,G=0),G=G||0,U=u(U);var Z=w/2,Ce=E/2,Ke=Te("circle",{cx:Z,cy:Ce,r:Math.round((w+E)/4-G),...U});return We(k,Ke),Ke}function y(k,w,E,G,U,Z){un(U)&&(Z=U,U=0),U=U||0,Z=u(Z);var Ce=Te("rect",{x:U,y:U,width:w-U*2,height:E-U*2,rx:G,ry:G,...Z});return We(k,Ce),Ce}function v(k,w,E,G){var U=w/2,Z=E/2,Ce=[{x:U,y:0},{x:w,y:Z},{x:U,y:E},{x:0,y:Z}],Ke=Ce.map(function(Gt){return Gt.x+","+Gt.y}).join(" ");G=u(G);var ut=Te("polygon",{...G,points:Ke});return We(k,ut),ut}function g(k,w,E,G){E=f(E);var U=ka(w,E,G);return We(k,U),U}function b(k,w,E){return g(k,w,E,5)}function _(k,w,E){E=f(E);var G=Te("path",{...E,d:w});return We(k,G),G}function C(k,w,E,G){return _(w,E,W({"data-marker":k},G))}function M(k){return Rt[k]}function O(k){return function(w,E,G){return M(k)(w,E,G)}}var P={"bpmn:MessageEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.235,my:.315}}),Z=G?xe(w,c,E.stroke):et(w,s,E.fill),Ce=G?et(w,s,E.fill):xe(w,c,E.stroke),Ke=_(k,U,{fill:Z,stroke:Ce,strokeWidth:1});return Ke},"bpmn:TimerEventDefinition":function(k,w,E={}){var G=E.width||w.width,U=E.height||w.height,Z=E.width?1:2,Ce=h(k,G,U,.2*U,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke),strokeWidth:Z}),Ke=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}});_(k,Ke,{stroke:xe(w,c,E.stroke),strokeWidth:Z});for(var ut=0;ut<12;ut++){var Gt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}}),yt=G/2,qt=U/2;_(k,Gt,{strokeWidth:1,stroke:xe(w,c,E.stroke),transform:"rotate("+ut*30+","+qt+","+yt+")"})}return Ce},"bpmn:EscalationEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.2}}),Z=G?xe(w,c,E.stroke):et(w,s,E.fill);return _(k,U,{fill:Z,stroke:xe(w,c,E.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(k,w,E={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.222}});return _(k,G,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.57,my:.263}}),Z=G?xe(w,c,E.stroke):et(w,s,E.fill);return _(k,U,{fill:Z,stroke:xe(w,c,E.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.2,my:.722}}),Z=G?xe(w,c,E.stroke):et(w,s,E.fill);return _(k,U,{fill:Z,stroke:xe(w,c,E.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.638,my:-.055}}),Z=G?xe(w,c,E.stroke):"none",Ce=_(k,U,{fill:Z,stroke:xe(w,c,E.stroke),strokeWidth:1});return Pg(Ce,45),Ce},"bpmn:CompensateEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.22,my:.5}}),Z=G?xe(w,c,E.stroke):et(w,s,E.fill);return _(k,U,{fill:Z,stroke:xe(w,c,E.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.5,my:.2}}),Z=G?xe(w,c,E.stroke):et(w,s,E.fill);return _(k,U,{strokeWidth:1,fill:Z,stroke:xe(w,c,E.stroke)})},"bpmn:MultipleEventDefinition":function(k,w,E={},G){var U=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.211,my:.36}}),Z=G?xe(w,c,E.stroke):et(w,s,E.fill);return _(k,U,{fill:Z,stroke:xe(w,c,E.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(k,w,E={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:E.width||w.width,containerHeight:E.height||w.height,position:{mx:.458,my:.194}});return _(k,G,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(k,w,E={}){var G=h(k,w.width,w.height,8,{fill:xe(w,c,E.stroke),stroke:xe(w,c,E.stroke),strokeWidth:4});return G}};function F(k,w,E={},G){var U=oe(k),Z=nA(U),Ce=G||k;return U.get("eventDefinitions")&&U.get("eventDefinitions").length>1?U.get("parallelMultiple")?P["bpmn:ParallelMultipleEventDefinition"](w,Ce,E,Z):P["bpmn:MultipleEventDefinition"](w,Ce,E,Z):Bi(U,"bpmn:MessageEventDefinition")?P["bpmn:MessageEventDefinition"](w,Ce,E,Z):Bi(U,"bpmn:TimerEventDefinition")?P["bpmn:TimerEventDefinition"](w,Ce,E,Z):Bi(U,"bpmn:ConditionalEventDefinition")?P["bpmn:ConditionalEventDefinition"](w,Ce,E,Z):Bi(U,"bpmn:SignalEventDefinition")?P["bpmn:SignalEventDefinition"](w,Ce,E,Z):Bi(U,"bpmn:EscalationEventDefinition")?P["bpmn:EscalationEventDefinition"](w,Ce,E,Z):Bi(U,"bpmn:LinkEventDefinition")?P["bpmn:LinkEventDefinition"](w,Ce,E,Z):Bi(U,"bpmn:ErrorEventDefinition")?P["bpmn:ErrorEventDefinition"](w,Ce,E,Z):Bi(U,"bpmn:CancelEventDefinition")?P["bpmn:CancelEventDefinition"](w,Ce,E,Z):Bi(U,"bpmn:CompensateEventDefinition")?P["bpmn:CompensateEventDefinition"](w,Ce,E,Z):Bi(U,"bpmn:TerminateEventDefinition")?P["bpmn:TerminateEventDefinition"](w,Ce,E,Z):null}var I={ParticipantMultiplicityMarker:function(k,w,E={}){var G=pi(w,E),U=qn(w,E),Z=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",k,Z,{strokeWidth:2,fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke)})},SubProcessMarker:function(k,w,E={}){var G=y(k,14,14,0,{strokeWidth:1,fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke)});_n(G,w.width/2-7.5,w.height-20);var U=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2-7.5)/w.width,my:(w.height-20)/w.height}});C("sub-process",k,U,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke)})},ParallelMarker:function(k,w,E){var G=pi(w,E),U=qn(w,E),Z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.parallel)/G,my:(U-20)/U}});C("parallel",k,Z,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke)})},SequentialMarker:function(k,w,E){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+E.seq)/w.width,my:(w.height-19)/w.height}});C("sequential",k,G,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke)})},CompensationMarker:function(k,w,E){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:(w.width/2+E.compensation)/w.width,my:(w.height-13)/w.height}});C("compensation",k,G,{strokeWidth:1,fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke)})},LoopMarker:function(k,w,E){var G=pi(w,E),U=qn(w,E),Z=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.loop)/G,my:(U-7)/U}});C("loop",k,Z,{strokeWidth:1.5,fill:"none",stroke:xe(w,c,E.stroke),strokeMiterlimit:.5})},AdhocMarker:function(k,w,E){var G=pi(w,E),U=qn(w,E),Z=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+E.adhoc)/G,my:(U-15)/U}});C("adhoc",k,Z,{strokeWidth:1,fill:xe(w,c,E.stroke),stroke:xe(w,c,E.stroke)})}};function B(k,w,E,G){I[k](w,E,G)}function z(k,w,E=[],G={}){G={fill:G.fill,stroke:G.stroke,width:pi(w,G),height:qn(w,G)};var U=oe(w),Z=E.includes("SubProcessMarker");Z?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")&&E.push("CompensationMarker"),S(U,"bpmn:AdHocSubProcess")&&(E.push("AdhocMarker"),Z||W(G,{compensation:G.compensation-18}));var Ce=U.get("loopCharacteristics"),Ke=Ce&&Ce.get("isSequential");Ce&&(W(G,{compensation:G.compensation-18}),E.includes("AdhocMarker")&&W(G,{seq:-23,loop:-18,parallel:-24}),Ke===void 0&&E.push("LoopMarker"),Ke===!1&&E.push("ParallelMarker"),Ke===!0&&E.push("SequentialMarker")),E.includes("CompensationMarker")&&E.length===1&&W(G,{compensation:-8}),H(E,function(ut){B(ut,k,w,G)})}function ce(k,w,E={}){E=W({size:{width:100}},E);var G=o.createText(w||"",E);return ot(G).add("djs-label"),We(k,G),G}function ve(k,w,E,G={}){var U=oe(w),Z=ja({x:w.x,y:w.y,width:w.width,height:w.height},G);return ce(k,U.name,{align:E,box:Z,padding:7,style:{fill:Fa(w,l,c,G.stroke)}})}function qe(k,w,E={}){var G={width:w.width,height:w.height,x:w.width/2+w.x,y:w.height/2+w.y};return ce(k,ci(w),{box:G,style:W({},o.getExternalStyle(),{fill:Fa(w,l,c,E.stroke)})})}function He(k,w,E,G={}){var U=fn(E),Z=ce(k,w,{box:{height:30,width:U?qn(E,G):pi(E,G)},align:"center-middle",style:{fill:Fa(E,l,c,G.stroke)}});if(U){var Ce=-1*qn(E,G);yc(Z,0,-Ce,270)}}function st(k,w,E={}){var{width:G,height:U}=ja(w,E);return y(k,G,U,wc,{...E,fill:et(w,s,E.fill),fillOpacity:Wo,stroke:xe(w,c,E.stroke)})}function X(k,w,E={}){var G=oe(w),U=et(w,s,E.fill),Z=xe(w,c,E.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(E.markerEnd=d(k,"association-end",U,Z)),G.get("associationDirection")==="Both"&&(E.markerStart=d(k,"association-start",U,Z)),E=lt(E,["markerStart","markerEnd"]),b(k,w.waypoints,{...E,stroke:Z,strokeDasharray:"0, 5"})}function Q(k,w,E={}){var G=et(w,s,E.fill),U=xe(w,c,E.stroke),Z=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}}),Ce=_(k,Z,{fill:G,fillOpacity:Wo,stroke:U}),Ke=oe(w);if(iA(Ke)){var ut=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:.33,my:(w.height-18)/w.height}});_(k,ut,{strokeWidth:2,fill:G,stroke:U})}return Ce}function ue(k,w,E={}){return h(k,w.width,w.height,{fillOpacity:Wo,...E,fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke)})}function _e(k,w,E={}){return v(k,w.width,w.height,{fill:et(w,s,E.fill),fillOpacity:Wo,stroke:xe(w,c,E.stroke)})}function q(k,w,E={}){var G=y(k,pi(w,E),qn(w,E),0,{fill:et(w,s,E.fill),fillOpacity:E.fillOpacity||Wo,stroke:xe(w,c,E.stroke),strokeWidth:1.5}),U=oe(w);if(S(U,"bpmn:Lane")){var Z=U.get("name");He(k,Z,w,E)}return G}function V(k,w,E={}){var G=st(k,w,E),U=nt(w);if(On(w)&&(Ee(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!U)){var Z=oe(w).flowElements||[],Ce=Z.filter(Ke=>S(Ke,"bpmn:StartEvent"));Ce.length===1&&ie(Ce[0],k,E,w)}return ve(k,w,U?"center-top":"center-middle",E),U?z(k,w,void 0,E):z(k,w,["SubProcessMarker"],E),G}function ie(k,w,E,G){var U=22,Z={fill:et(G,s,E.fill),stroke:xe(G,c,E.stroke),width:U,height:U},Ce=oe(k).isInterrupting,Ke=Ce?0:3,ut=Ce?1:1.2,Gt=20,yt=(U-Gt)/2,qt="translate("+yt+","+yt+")";h(w,Gt,Gt,{fill:Z.fill,stroke:Z.stroke,strokeWidth:ut,strokeDasharray:Ke,transform:qt}),F(k,w,Z,G)}function Me(k,w,E={}){var G=st(k,w,E);return ve(k,w,"center-middle",E),z(k,w,void 0,E),G}var Rt=this.handlers={"bpmn:AdHocSubProcess":function(k,w,E={}){return nt(w)?E=lt(E,["fill","stroke","width","height"]):E=lt(E,["fill","stroke"]),V(k,w,E)},"bpmn:Association":function(k,w,E={}){return E=lt(E,["fill","stroke"]),X(k,w,E)},"bpmn:BoundaryEvent":function(k,w,E={}){var{renderIcon:G=!0}=E;E=lt(E,["fill","stroke"]);var U=oe(w),Z=U.get("cancelActivity");E={strokeWidth:1.5,fill:et(w,s,E.fill),fillOpacity:uA,stroke:xe(w,c,E.stroke)},Z||(E.strokeDasharray="6");var Ce=ue(k,w,E);return h(k,w.width,w.height,_c,{...E,fill:"none"}),G&&F(w,k,E),Ce},"bpmn:BusinessRuleTask":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=Me(k,w,E),U=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),Z=_(k,U);Ee(Z,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke),strokeWidth:1});var Ce=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ke=_(k,Ce);return Ee(Ke,{fill:xe(w,c,E.stroke),stroke:xe(w,c,E.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(k,w,E={}){return E=lt(E,["fill","stroke"]),V(k,w,{strokeWidth:5,...E})},"bpmn:ComplexGateway":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=_e(k,w,E),U=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.26}});return _(k,U,{fill:xe(w,c,E.stroke),stroke:xe(w,c,E.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=Q(k,w,E);return _(k,G,{fill:"none",stroke:xe(w,c,E.stroke),strokeWidth:1}),U},"bpmn:DataInputAssociation":function(k,w,E={}){return E=lt(E,["fill","stroke"]),X(k,w,{...E,markerEnd:d(k,"association-end",et(w,s,E.fill),xe(w,c,E.stroke))})},"bpmn:DataObject":function(k,w,E={}){return E=lt(E,["fill","stroke"]),Q(k,w,E)},"bpmn:DataObjectReference":O("bpmn:DataObject"),"bpmn:DataOutput":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=Q(k,w,E);return _(k,G,{strokeWidth:1,fill:xe(w,c,E.stroke),stroke:xe(w,c,E.stroke)}),U},"bpmn:DataOutputAssociation":function(k,w,E={}){return E=lt(E,["fill","stroke"]),X(k,w,{...E,markerEnd:d(k,"association-end",et(w,s,E.fill),xe(w,c,E.stroke))})},"bpmn:DataStoreReference":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width,containerHeight:w.height,position:{mx:0,my:.133}});return _(k,G,{fill:et(w,s,E.fill),fillOpacity:Wo,stroke:xe(w,c,E.stroke),strokeWidth:2})},"bpmn:EndEvent":function(k,w,E={}){var{renderIcon:G=!0}=E;E=lt(E,["fill","stroke"]);var U=ue(k,w,{...E,strokeWidth:4});return G&&F(w,k,E),U},"bpmn:EventBasedGateway":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=oe(w),U=_e(k,w,E);h(k,w.width,w.height,w.height*.2,{fill:et(w,"none",E.fill),stroke:xe(w,c,E.stroke),strokeWidth:1});var Z=G.get("eventGatewayType"),Ce=!!G.get("instantiate");function Ke(){var Gt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:w.width,containerHeight:w.height,position:{mx:.36,my:.44}});_(k,Gt,{fill:"none",stroke:xe(w,c,E.stroke),strokeWidth:2})}if(Z==="Parallel"){var ut=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.474,my:.296}});_(k,ut,{fill:"none",stroke:xe(w,c,E.stroke),strokeWidth:1})}else Z==="Exclusive"&&(Ce||h(k,w.width,w.height,w.height*.26,{fill:"none",stroke:xe(w,c,E.stroke),strokeWidth:1}),Ke());return U},"bpmn:ExclusiveGateway":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=_e(k,w,E),U=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:w.width,containerHeight:w.height,position:{mx:.32,my:.3}}),Z=ct(w);return Z.get("isMarkerVisible")&&_(k,U,{fill:xe(w,c,E.stroke),stroke:xe(w,c,E.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(k,w,E={}){return E=lt(E,["fill","stroke"]),_e(k,w,E)},"bpmn:Group":function(k,w,E={}){return E=lt(E,["fill","stroke","width","height"]),y(k,w.width,w.height,wc,{stroke:xe(w,c,E.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:pi(w,E),height:qn(w,E)})},"bpmn:InclusiveGateway":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=_e(k,w,E);return h(k,w.width,w.height,w.height*.24,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(k,w,E={}){var{renderIcon:G=!0}=E;E=lt(E,["fill","stroke"]);var U=ue(k,w,{...E,strokeWidth:1.5});return h(k,w.width,w.height,_c,{fill:"none",stroke:xe(w,c,E.stroke),strokeWidth:1.5}),G&&F(w,k,E),U},"bpmn:IntermediateCatchEvent":O("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":O("bpmn:IntermediateEvent"),"bpmn:Lane":function(k,w,E={}){return E=lt(E,["fill","stroke","width","height"]),q(k,w,{...E,fillOpacity:pA})},"bpmn:ManualTask":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=Me(k,w,E),U=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return _(k,U,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=oe(w),U=ct(w),Z=et(w,s,E.fill),Ce=xe(w,c,E.stroke),Ke=b(k,w.waypoints,{markerEnd:d(k,"messageflow-end",Z,Ce),markerStart:d(k,"messageflow-start",Z,Ce),stroke:Ce,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var ut=Ke.getPointAtLength(Ke.getTotalLength()/2),Gt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:ut.x,y:ut.y}}),yt={strokeWidth:1};U.get("messageVisibleKind")==="initiating"?(yt.fill=Z,yt.stroke=Ce):(yt.fill=Ce,yt.stroke=Z);var qt=_(k,Gt,yt),dn=G.get("messageRef"),hn=dn.get("name"),Mt=ce(k,hn,{align:"center-top",fitBox:!0,style:{fill:Ce}}),Vt=qt.getBBox(),Dn=Mt.getBBox(),Ur=ut.x-Dn.width/2,ei=ut.y+Vt.height/2+sA;yc(Mt,Ur,ei,0)}return Ke},"bpmn:ParallelGateway":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=_e(k,w,E),U=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:w.width,containerHeight:w.height,position:{mx:.46,my:.2}});return _(k,U,{fill:xe(w,c,E.stroke),stroke:xe(w,c,E.stroke),strokeWidth:1}),G},"bpmn:Participant":function(k,w,E={}){E=lt(E,["fill","stroke","width","height"]);var G=q(k,w,E),U=nt(w),Z=fn(w),Ce=oe(w),Ke=Ce.get("name");if(U){var ut=Z?[{x:30,y:0},{x:30,y:qn(w,E)}]:[{x:0,y:30},{x:pi(w,E),y:30}];g(k,ut,{stroke:xe(w,c,E.stroke),strokeWidth:cA}),He(k,Ke,w,E)}else{var Gt=ja(w,E);Z||(Gt.height=pi(w,E),Gt.width=qn(w,E));var yt=ce(k,Ke,{box:Gt,align:"center-middle",style:{fill:Fa(w,l,c,E.stroke)}});if(!Z){var qt=-1*qn(w,E);yc(yt,0,-qt,270)}}return Ce.get("participantMultiplicity")&&B("ParticipantMultiplicityMarker",k,w,E),G},"bpmn:ReceiveTask":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=oe(w),U=Me(k,w,E),Z;return G.get("instantiate")?(h(k,28,28,20*.22,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke),strokeWidth:1}),Z=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):Z=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),_(k,Z,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke),strokeWidth:1}),U},"bpmn:ScriptTask":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=Me(k,w,E),U=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return _(k,U,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=Me(k,w,E),U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return _(k,U,{fill:xe(w,c,E.stroke),stroke:et(w,s,E.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=et(w,s,E.fill),U=xe(w,c,E.stroke),Z=b(k,w.waypoints,{markerEnd:d(k,"sequenceflow-end",G,U),stroke:U}),Ce=oe(w),{source:Ke}=w;if(Ke){var ut=oe(Ke);Ce.get("conditionExpression")&&S(ut,"bpmn:Activity")&&Ee(Z,{markerStart:d(k,"conditional-flow-marker",G,U)}),ut.get("default")&&(S(ut,"bpmn:Gateway")||S(ut,"bpmn:Activity"))&&ut.get("default")===Ce&&Ee(Z,{markerStart:d(k,"conditional-default-flow-marker",G,U)})}return Z},"bpmn:ServiceTask":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=Me(k,w,E);h(k,10,10,{fill:et(w,s,E.fill),stroke:"none",transform:"translate(6, 6)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});_(k,U,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke),strokeWidth:1}),h(k,10,10,{fill:et(w,s,E.fill),stroke:"none",transform:"translate(11, 10)"});var Z=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return _(k,Z,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(k,w,E={}){var{renderIcon:G=!0}=E;E=lt(E,["fill","stroke"]);var U=oe(w);U.get("isInterrupting")||(E={...E,strokeDasharray:"6"});var Z=ue(k,w,E);return G&&F(w,k,E),Z},"bpmn:SubProcess":function(k,w,E={}){return nt(w)?E=lt(E,["fill","stroke","width","height"]):E=lt(E,["fill","stroke"]),V(k,w,E)},"bpmn:Task":function(k,w,E={}){return E=lt(E,["fill","stroke"]),Me(k,w,E)},"bpmn:TextAnnotation":function(k,w,E={}){E=lt(E,["fill","stroke"]);var{width:G,height:U}=ja(w,E),Z=y(k,G,U,0,0,{fill:"none",stroke:"none"}),Ce=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:0,my:0}});_(k,Ce,{stroke:xe(w,c,E.stroke)});var Ke=oe(w),ut=Ke.get("text")||"";return ce(k,ut,{align:"left-top",box:ja(w,E),padding:Vo,style:{fill:Fa(w,l,c,E.stroke)}}),Z},"bpmn:Transaction":function(k,w,E={}){nt(w)?E=lt(E,["fill","stroke","width","height"]):E=lt(E,["fill","stroke"]);var G=V(k,w,{strokeWidth:1.5,...E}),U=n.style(["no-fill","no-events"],{stroke:xe(w,c,E.stroke),strokeWidth:1.5}),Z=nt(w);return Z||(E={}),y(k,pi(w,E),qn(w,E),wc-_c,_c,U),G},"bpmn:UserTask":function(k,w,E={}){E=lt(E,["fill","stroke"]);var G=Me(k,w,E),U=15,Z=12,Ce=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:Z}});_(k,Ce,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke),strokeWidth:.5});var Ke=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:Z}});_(k,Ke,{fill:et(w,s,E.fill),stroke:xe(w,c,E.stroke),strokeWidth:.5});var ut=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:Z}});return _(k,ut,{fill:xe(w,c,E.stroke),stroke:xe(w,c,E.stroke),strokeWidth:.5}),G},label:function(k,w,E={}){return qe(k,w,E)}};this._drawPath=_,this._renderer=M}we(oo,Zi),oo.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],oo.prototype.canRender=function(e){return S(e,"bpmn:BaseElement")},oo.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},oo.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},oo.prototype.getShapePath=function(e){return Xe(e)?bp(e,lA):S(e,"bpmn:Event")?$g(e):S(e,"bpmn:Activity")?bp(e,wc):S(e,"bpmn:Gateway")?rA(e):oA(e)};function lt(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var fA=0,dA={width:150,height:50};function hA(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function mA(e){return un(e)?W({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var xp=null;function gA(){return xp||(xp=document.createElement("canvas").getContext("2d")),xp}function yA(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(Fg(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Fg(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function vA(e,t){var n=gA();if(!n)return{width:0,height:0};n.font=yA(t),"letterSpacing"in n&&(n.letterSpacing=Fg(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 bA(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=vA(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return xA(e,r,i,o);r=wA(r,o.width,t)}}function xA(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 jg="­";function _A(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===jg)&&r.pop();break}var a=r[r.length-1];return a&&a===jg&&(r[r.length-1]="-"),r.join("")}function wA(e,t,n){var i=Math.max(e.length*(n/t),1),r=_A(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ec(e){this._config=W({},{size:dA,padding:fA,style:{},align:"center-top"},e||{})}Ec.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ec.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ec.prototype.layoutText=function(e,t){for(var n=W({},this._config.size,t.box),i=W({},this._config.style,t.style),r=hA(t.align||this._config.align),o=mA(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=EA(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(bA(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Vn(l,function(y,v,g){return y+(s||v.height)},0)+o.top+o.bottom,p=Vn(l,function(y,v,g){return v.width>y?v.width:y},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||l[0].height)/4;var m=Te("text");Ee(m,i),H(l,function(y){var v;switch(d+=s||y.height,r.horizontal){case"left":v=o.left;break;case"right":v=(a?p:u)-o.right-y.width;break;default:v=Math.max(((a?p:u)-y.width)/2+o.left,0)}var g=Te("tspan");Ee(g,{x:v,y:d}),g.textContent=y.text,We(m,g)});var h={width:p,height:f};return{dimensions:h,element:m}};function EA(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var SA=12,RA=1.2,CA=40;function Hg(e){var t=W({fontFamily:"Arial, sans-serif",fontSize:SA,fontWeight:"normal",lineHeight:RA},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=W({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ec({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,ro.width),height:30},l=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-l.width/2),y:a.y,width:Math.ceil(l.width),height:Math.ceil(l.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:Vo});return{x:a.x,y:a.y,width:a.width,height:Math.max(CA,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,W({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Hg.$inject=["config.textRenderer"];function AA(){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,l=0;l<i.heightElements.length;l++)a["y"+l]=i.heightElements[l]*s;for(var u=0;u<i.widthElements.length;u++)a["x"+u]=i.widthElements[u]*c}var f=kA(i.d,{mx:r,my:o,e:a});return f}}var PA=/\{([^{}]+)\}/g,MA=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function TA(e,t,n){var i=n;return t.replace(MA,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 kA(e,t){return String(e).replace(PA,function(n,i){return TA(n,i,t)})}const OA={__init__:["bpmnRenderer"],bpmnRenderer:["type",oo],textRenderer:["type",Hg],pathMap:["type",AA]};function DA(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Ha={translate:["value",DA]};function Sc(e,t,n){return W({id:e.id,type:e.$type,businessObject:e,di:t},n)}function LA(e,t,n){var i=e.waypoint;return!i||i.length<2?[Ie(t),Ie(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function zg(e,t,n){return new Error(`element ${kn(t)} referenced by ${kn(e)}#${n} not yet drawn`)}function tr(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}tr.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],tr.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(Sc(e,t,a)),this._canvas.addRootElement(i)}else if(S(t,"bpmndi:BPMNShape")){var s=!nt(e,t),c=BA(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Sc(e,t,{collapsed:s,hidden:r,x:Math.round(l.x),y:Math.round(l.y),width:Math.round(l.width),height:Math.round(l.height),isFrame:c})),S(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),S(e,"bpmn:Lane")&&(o=0),S(e,"bpmn:DataStoreReference")&&(IA(n,Ie(l))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(S(t,"bpmndi:BPMNEdge")){var u=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Sc(e,t,{hidden:r,source:u,target:f,waypoints:LA(t,u,f)})),S(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${kn(t)} for element ${kn(e)}`);return Rr(e)&&ci(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},tr.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${kn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw zg(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},tr.prototype.addLabel=function(e,t,n){var i,r,o;return i=ZC(t,n),r=ci(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Sc(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!ci(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)},tr.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?zg(e,i,t+"Ref"):new Error(`${kn(e)}#${t} Ref not specified`)},tr.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},tr.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},tr.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function IA(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 BA(e){return S(e,"bpmn:Group")}const Gg={__depends__:[OA,{__depends__:[Ha],bpmnImporter:["type",tr]}]};function za(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ri(e,t){return{x:e.x-t.x,y:e.y-t.y}}function _p(e){return Math.log(e)/Math.log(10)}var NA=1e3;function ne(e){this._eventBus=e}ne.$inject=["eventBus"];function $A(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}ne.prototype.on=function(e,t,n,i,r,o){if((pn(t)||Fe(t))&&(o=r,r=i,i=n,n=t,t=null),pn(n)&&(o=r,r=i,i=n,n=NA),un(r)&&(o=r,r=!1),!pn(i))throw new Error("handlerFn must be a function");Le(e)||(e=[e]);var a=this._eventBus;H(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?$A(i,o):i,o)})},ne.prototype.canExecute=nr("canExecute"),ne.prototype.preExecute=nr("preExecute"),ne.prototype.preExecuted=nr("preExecuted"),ne.prototype.execute=nr("execute"),ne.prototype.executed=nr("executed"),ne.prototype.postExecute=nr("postExecute"),ne.prototype.postExecuted=nr("postExecuted"),ne.prototype.revert=nr("revert"),ne.prototype.reverted=nr("reverted");function nr(e){return function(n,i,r,o,a){(pn(n)||Fe(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var wp=["top","bottom","left","right"],Rc=10;function Ep(e,t){ne.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,l=o.hints||{};l.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(xc(r)&&!wt(r)){var o=HA(r);o&&i(r,o)}}function i(r,o){var a=Ie(r),s=r.label,c=Ie(s);if(s.parent){var l=De(r),u;switch(o){case"top":u={x:a.x,y:l.top-Rc-s.height/2};break;case"left":u={x:l.left-Rc-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Rc+s.height/2};break;case"right":u={x:l.right+Rc+s.width/2,y:a.y};break}var f=Ri(u,c);t.moveShape(s,f)}}}we(Ep,ne),Ep.$inject=["eventBus","modeling"];function FA(e){var t=e.host,n=Ie(e),i=xn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=wp.filter(function(a){return r.indexOf(a)===-1});return o}function jA(e){var t=Ie(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 Vg(t,i)});return n}function HA(e){var t=Ie(e.label),n=Ie(e),i=Vg(n,t);if(zA(i)){var r=jA(e);if(e.host){var o=FA(e);r=r.concat(o)}var a=wp.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?xn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Vg(e,t){return xn(t,e,5)}function zA(e){return wp.indexOf(e)!==-1}function Sp(e){ne.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)}we(Sp,ne),Sp.$inject=["eventBus"];var GA=1500;function Rp(e,t,n){e.invoke(ne,this),this.preExecute("elements.delete",GA,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=Qe(r,l=>S(l,"bpmn:Participant")||S(l,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(l=>S(l,"bpmn:Artifact"))),c=new Set;return H(o,l=>{const u=new Set(Ro(Fo(Array.from(s),Zt(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}we(Rp,ne),Rp.$inject=["injector","eventBus","canvas"];function Cp(e,t){e.invoke(ne,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Qe(r.incoming.concat(r.outgoing),function(a){return S(a,"bpmn:Association")});H(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}we(Cp,ne),Cp.$inject=["injector","modeling"];function Uo(e,t){for(zn(t)&&(t=[t]);e=e.parent;)if(Ze(e,t))return e;return null}function Wg(e,t){var n=Uo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=Uo(e,i),n)return fn(n);if(Ze(e,i))return fn(e);var r;for(r=oe(e);r&&!S(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=oe(a);return s&&s.get("processRef")===r});return o?fn(o):!0}var Ug=500;function Cc(e,t){t.invoke(ne,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Ug,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Yg(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",Ug,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Yg(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Cc.$inject=["bpmnReplace","injector"],we(Cc,ne),Cc.prototype._replaceShape=function(e,t){var n=VA(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function VA(e){var t=oe(e),n=t.eventDefinitions;return n&&n[0]}function Yg(e,t){return!Xe(e)&&Ze(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Ap(e,t){ne.call(this,e);function n(i){return Qe(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")&&H(o.outgoing,function(a){var s=a.target,c=n(s);S(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Ap.$inject=["eventBus","modeling"],we(Ap,ne);function qg(e){return e.create("bpmn:Category")}function WA(e){return e.create("bpmn:CategoryValue")}function Kg(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=WA(e)),n.$parent||(n.$parent=qg(e)),n}function UA(e,t,n){return Yt(t.get("categoryValue"),e),e.$parent=t,Yt(n.get("rootElements"),t),t.$parent=n,e}function YA(e){var t=e.$parent;return t&&(Ut(t.get("categoryValue"),e),e.$parent=null),e}function qA(e){var t=e.$parent;return t&&(Ut(t.get("rootElements"),e),e.$parent=null),e}var KA=500;function Pp(e,t,n){n.invoke(ne,this);function i(c){return t.filter(function(l){return S(l,"bpmn:Group")&&!l.labelTarget}).map(oe).filter(function(l){return l!==c})}function r(c,l){return i(l).some(function(u){return u.get("categoryValueRef")===c})}function o(c,l){return i(l).some(function(u){var f=u.get("categoryValueRef");return f&&f.$parent===c})}function a(c,l){c&&l&&UA(c,l,e.getDefinitions())}function s(c,l,u){l&&!o(l,u)&&qA(l),c&&!r(c,u)&&YA(c)}this.executed(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!S(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var l=c.labelTarget||c.shape;!S(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,oe(l))},!0),this.executed(["shape.move","shape.resize"],KA,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var l=c.shape;c.categoryValue&&s(c.categoryValue,c.category,oe(l))},!0),this.executed("group.updateRefs",function(c){Xg(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){Xg(c).forEach(function(l){s(l.categoryValue,l.category,oe(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,oe(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}Pp.$inject=["bpmnjs","elementRegistry","injector"],we(Pp,ne);function Xg(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Mp(e,t,n){ne.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(y){const v=y.source,g=y.target;Yo(v)&&Ga(g)&&u(g)}function r(y){const v=y.connection,g=y.source,b=y.target;Yo(g)&&Ac(b)&&(l(b),p(g,[v]))}function o(y){const v=y.newTarget,g=y.oldSource,b=y.oldTarget;if(b!==v){const _=g;Ga(b)&&u(b),Yo(_)&&Ac(v)&&l(v)}}function a(y){const{element:v}=y;Ga(v)?(f(v),d(v)):Ac(v)&&m(v)}function s(y){const{newData:v,oldShape:g}=y;if(Yo(y.oldShape)&&v.eventDefinitionType!=="bpmn:CompensateEventDefinition"||v.type!=="bpmn:BoundaryEvent"){const b=g.outgoing.find(({target:_})=>Ga(_));b&&b.target&&(y._connectionTarget=b.target)}else if(!Yo(y.oldShape)&&v.eventDefinitionType==="bpmn:CompensateEventDefinition"&&v.type==="bpmn:BoundaryEvent"){const b=g.outgoing.find(({target:_})=>Ac(_));b&&b.target&&(y._connectionTarget=b.target),h(g)}}function c(y){const{_connectionTarget:v,newShape:g}=y;v&&t.connect(g,v)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function f(y){for(const v of y.incoming)n.canConnect(v.source,y)||t.removeConnection(v);for(const v of y.outgoing)n.canConnect(y,v.target)||t.removeConnection(v)}function p(y,v){y.outgoing.filter(_=>S(_,"bpmn:Association")).filter(_=>Ga(_.target)&&!v.includes(_)).forEach(_=>t.removeConnection(_))}function d(y){const v=y.attachers.slice();v.length&&t.removeElements(v)}function m(y){const v=y.incoming.filter(g=>Yo(g.source));t.removeElements(v)}function h(y){const v=y.outgoing.filter(g=>S(g,"bpmn:SequenceFlow"));t.removeElements(v)}}we(Mp,ne),Mp.$inject=["eventBus","modeling","bpmnRules"];function Ga(e){const t=oe(e);return t&&t.get("isForCompensation")}function Yo(e){return e&&S(e,"bpmn:BoundaryEvent")&&Go(e,"bpmn:CompensateEventDefinition")}function Ac(e){return e&&S(e,"bpmn:Activity")&&!On(e)}function Tp(e){e.invoke(ne,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=Uo(i,"bpmn:Participant"))})}Tp.$inject=["injector"],we(Tp,ne);function kp(e,t){ne.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}})}kp.$inject=["eventBus","bpmnFactory"],we(kp,ne);var Op=20,Dp=20,Zg=30,Pc=2e3;function Lp(e,t,n){ne.call(this,t),t.on(["create.start","shape.move.start"],Pc,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(f){return!S(f,"bpmn:Group")&&!Xe(f)&&!wt(f)});if(c.length){var l=Zt(c),u=XA(a,l);W(a,u),o.createConstraints=ZA(a,l)}}}),t.on("create.start",Pc,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function l(u){u.element=s,u.gfx=c}S(a,"bpmn:Participant")&&S(s,"bpmn:Process")&&(t.on("element.hover",Pc,l),t.once("create.cleanup",function(){t.off("element.hover",l)}))});function i(){var r=e.getRootElement();return S(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Pc,function(r){var o=r.elements,a=r.parent,s=QA(o),c;s&&S(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=oe(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=oe(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)&&oe(s).set("processRef",oe(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,l=o.participant;a&&(!l||c===l)&&oe(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 l=a.children.slice();c?s===c&&n.moveElements(l,{x:0,y:0},c):n.moveElements(l,{x:0,y:0},s)}},!0)}Lp.$inject=["canvas","eventBus","modeling"],we(Lp,ne);function XA(e,t){t={width:t.width+Op*2+Zg,height:t.height+Dp*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 ZA(e,t){return t=De(t),{bottom:t.top+e.height/2-Dp,left:t.right-e.width/2+Op,top:t.bottom-e.height/2+Dp,right:t.left+e.width/2-Op-Zg}}function QA(e){return At(e,function(t){return S(t,"bpmn:Participant")})}var Qg="__targetRef_placeholder";function Ip(e,t){ne.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],Jg(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],Jg(o));function n(a,s,c){var l=a.get("dataInputAssociations");return At(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=At(c,function(u){return u.name===Qg});return!l&&s&&(l=t.create("bpmn:Property",{name:Qg}),Yt(c,l)),l}function r(a,s){var c=i(a);c&&(n(a,c,s)||Ut(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,l=c.businessObject,u=c.target,f=u&&u.businessObject,p=s.newTarget,d=p&&p.businessObject,m=s.oldTarget||s.target,h=m&&m.businessObject,y=c.businessObject,v;h&&h!==f&&r(h,l),d&&d!==f&&r(d,l),f?(v=i(f,!0),y.targetRef=v):y.targetRef=null}}Ip.$inject=["eventBus","bpmnFactory"],we(Ip,ne);function Jg(e){return function(t){var n=t.context,i=n.connection;if(S(i,"bpmn:DataInputAssociation"))return e(t)}}function Mc(e){this._bpmnUpdater=e}Mc.$inject=["bpmnUpdater"],Mc.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),[]},Mc.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 Bp(e,t,n,i){ne.call(this,i),t.registerHandler("dataStore.updateContainment",Mc);function r(){return n.filter(function(s){return S(s,"bpmn:Participant")&&oe(s).processRef})[0]}function o(s){return s.children.filter(function(c){return S(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var l=s.businessObject||s;if(c=c||r(),c){var u=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:l,dataStoreDi:ct(s),newSemanticParent:u.processRef||u,newDiParent:ct(c)})}}this.preExecute("shape.create",function(s){var c=s.context,l=c.shape;S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,l=c.shapes,u=l.filter(function(f){return S(f,"bpmn:DataStoreReference")});u.length&&(c.hints||(c.hints={}),c.hints.autoResize=l.filter(function(f){return!S(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,l=c.shape,u=l.parent;S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&S(u,"bpmn:Collaboration")&&a(l)}),this.postExecute("shape.move",function(s){var c=s.context,l=c.shape,u=c.oldParent,f=l.parent;if(!S(u,"bpmn:Collaboration")&&S(l,"bpmn:DataStoreReference")&&l.type!=="label"&&S(f,"bpmn:Collaboration")){var p=S(u,"bpmn:Participant")?u:eP(u,"bpmn:Participant");a(l,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();Ze(l,["bpmn:Participant","bpmn:SubProcess"])&&S(u,"bpmn:Collaboration")&&o(u).filter(function(f){return JA(f,l)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,l=c.oldRoot,u=c.newRoot,f=o(l);f.forEach(function(p){S(u,"bpmn:Process")&&a(p,u)})})}Bp.$inject=["canvas","commandStack","elementRegistry","eventBus"],we(Bp,ne);function JA(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 eP(e,t){for(;e.parent;){if(S(e.parent,t))return e.parent;e=e.parent}}var Tc=Math.max,kc=Math.min,tP=20;function ey(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function nP(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 iP(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 Oc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Fe(r)&&(i=(/top|left/.test(e)?kc:Tc)(i,r)),Fe(o)&&(i=(/top|left/.test(e)?Tc:kc)(i,o)),i}function rP(e,t){if(!t)return e;var n=De(e);return hc({top:Oc("top",n,t),right:Oc("right",n,t),bottom:Oc("bottom",n,t),left:Oc("left",n,t)})}function oP(e,t,n,i){var r=De(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?De(i):o,s={top:kc(o.top,a.top),left:kc(o.left,a.left),bottom:Tc(o.bottom,a.bottom),right:Tc(o.right,a.right)};return hc(s)}function Va(e,t){return typeof e<"u"?e:tP}function aP(e,t){var n,i,r,o;return typeof t=="object"?(n=Va(t.left),i=Va(t.right),r=Va(t.top),o=Va(t.bottom)):n=i=r=o=Va(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function sP(e){return!(e.waypoints||e.type==="label")}function ty(e,t){var n;if(e.length===void 0?n=Qe(e.children,sP):n=e,n.length)return aP(Zt(n),t)}var Cr=Math.abs;function cP(e,t){return ey(De(t),De(e))}var lP=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],fi=30;function Dc(e,t){return t=t||[],e.children.filter(function(n){S(n,"bpmn:Lane")&&(Dc(n,t),t.push(n))}),t}function Ar(e){return e.children.filter(function(t){return S(t,"bpmn:Lane")})}function di(e){return Uo(e,lP)||e}function uP(e,t){var n=di(e),i=S(n,"bpmn:Process")?[]:[n],r=Dc(n,i),o=De(e),a=De(t),s=cP(e,t),c=[],l=fn(e);return r.forEach(function(u){if(u!==e){var f=l?0:s.top,p=l?s.right:0,d=l?0:s.bottom,m=l?s.left:0,h=De(u);s.top&&(Cr(h.bottom-o.top)<10&&(d=a.top-h.bottom),Cr(h.top-o.top)<5&&(f=a.top-h.top)),s.left&&(Cr(h.right-o.left)<10&&(p=a.left-h.right),Cr(h.left-o.left)<5&&(m=a.left-h.left)),s.bottom&&(Cr(h.top-o.bottom)<10&&(f=a.bottom-h.top),Cr(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(Cr(h.left-o.right)<10&&(m=a.right-h.left),Cr(h.right-o.right)<5&&(p=a.right-h.right)),(f||p||d||m)&&c.push({shape:u,newBounds:iP(u,{top:f,right:p,bottom:d,left:m})})}}),c}var pP=500;function Np(e,t){ne.call(this,e);function n(i,r){var o=fn(i),a=Ar(r),s=[],c=[],l=[],u=[];if(no(a,function(y){return o?y.y>i.y?c.push(y):s.push(y):y.x>i.x?u.push(y):l.push(y),y.children}),!!a.length){var f;o?c.length&&s.length?f=i.height/2:f=i.height:u.length&&l.length?f=i.width/2:f=i.width;var p,d,m,h;s.length&&(p=t.calculateAdjustments(s,"y",f,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:f},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-f,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-f},"n")),l.length&&(m=t.calculateAdjustments(l,"x",f,i.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:f,y:0},"e")),u.length&&(h=t.calculateAdjustments(u,"x",-f,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",pP,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))})}Np.$inject=["eventBus","spaceTool"],we(Np,ne);var ny=500;function Lc(e,t){t.invoke(ne,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ny,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return iy(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",ny,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;iy(a,dP(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}Lc.$inject=["bpmnReplace","injector"],we(Lc,ne),Lc.prototype._replaceShape=function(e){var t=fP(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function fP(e){var t=oe(e),n=t.eventDefinitions;return n&&n[0]}function iy(e,t){return!Xe(e)&&S(e,"bpmn:BoundaryEvent")&&!t}function dP(e,t){return e.indexOf(t)!==-1}var Ic=Math.round,hP=Math.max;function mP(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 gP(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var ry=10;function yP(e,t){var n,i;for(n=0;i=e[n];n++)if(La(i,t)<=ry)return{point:e[n],bendpoint:!0,index:n};return null}function vP(e,t){var n=lg(mP(t,ry),gP(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=hP(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Ic(i.x+r.x)/2,y:Ic(i.y+r.y)/2},index:i.segment2}:{point:{x:Ic(i.x),y:Ic(i.y)},index:i.segment2}:null}function $p(e,t){return yP(e,t)||vP(e,t)}function Fp(e,t,n){ne.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,f,p,d,m,h=r.outgoing.slice(),y=r.incoming.slice(),v;Fe(a.width)?v=Ie(a):v=a;var g=$p(s,v);if(g){if(c=s.slice(0,g.index),l=s.slice(g.index+(g.bendpoint?1:0)),!c.length||!l.length)return;u=g.bendpoint?s[g.index]:v,(c.length===1||!oy(r,c[c.length-1]))&&c.push(ay(u)),(l.length===1||!oy(r,l[0]))&&l.unshift(ay(u))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||v),d=o),t.canConnect(r,p,o)&&(d?m=n.connect(r,p,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||v),m=o));var b=[].concat(d&&Qe(y,function(_){return _.source===d.source})||[],m&&Qe(h,function(_){return _.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 l=Ie(c),u={x:l.x+s.x,y:l.y+s.y},f=At(o.children,function(p){var d=t.canInsert(a,p);return d&&$p(p.waypoints,u)});f&&(r.targetFlow=f,r.position=u)}},!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)}we(Fp,ne),Fp.$inject=["eventBus","bpmnRules","modeling"];function oy(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 ay(e){return W({},e)}function jp(e,t){ne.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)&&qo(r)){var c=[];S(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(l=>l!==r&&qo(l)):c=a.incoming.filter(l=>l!==r&&qo(l)&&S(l.source,"bpmn:EventBasedGateway")),c.forEach(function(l){t.removeConnection(l)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(S(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(qo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(qo).forEach(function(s){const c=a.incoming.filter(qo).filter(function(l){return l.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}jp.$inject=["eventBus","modeling"],we(jp,ne);function qo(e){return S(e,"bpmn:SequenceFlow")}var Bc=1500,sy=2e3;function cy(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"],Bc,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;S(a,"bpmn:Lane")&&!Ze(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=di(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Ze(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"],Bc,function(i){var r=i.hover;S(r,"bpmn:Lane")&&(i.hover=di(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Bc,function(i){var r=i.context,o=i.hover,a=r.type;S(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=di(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Bc,function(i){var r=i.context,o=r.start;S(o,"bpmn:Lane")&&(r.start=di(o)||o)}),t.on("shape.move.start",sy,function(i){var r=i.shape;S(r,"bpmn:Lane")&&(i.shape=di(r)||r)}),t.on("spaceTool.move",sy,function(i){var r=i.hover;r&&S(r,"bpmn:Lane")&&(i.hover=di(r))})}cy.$inject=["elementRegistry","eventBus","canvas"];var ly=770;function Hp(e,t,n,i){n.invoke(ne,this);function r(s,c){var l=oe(s),u=c.categoryValue||l.categoryValueRef;u||(u=Kg(e,l));var f=c.category||u.$parent||qg(e);l.categoryValueRef=u,u.$parent=f,c.categoryValue=u,c.category=f}function o(s,c){var l=oe(s),u=c.categoryValue||l.categoryValueRef,f=c.category||u&&u.$parent;u&&(c.categoryValue=u,c.category=f,l.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,l=c.labelTarget;S(l,"bpmn:Group")&&r(l,c)}),this.revert("label.create",function(s){var c=s.context,l=c.labelTarget;S(l,"bpmn:Group")&&o(l,c)}),this.execute("shape.delete",function(s){var c=s.context,l=c.shape,u=oe(l);if(!(!S(l,"bpmn:Group")||l.labelTarget)){var f=c.categoryValue=u.categoryValueRef;f&&(c.category=f.$parent,u.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,l=c.shape;if(!(!S(l,"bpmn:Group")||l.labelTarget)){var u=c.category,f=c.categoryValue,p=oe(l);f&&(p.categoryValueRef=f,f.$parent=u)}}),this.execute("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!S(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!oe(l).categoryValueRef&&!c.categoryValue||r(l,c)}),this.reverted("shape.create",function(s){var c=s.context,l=c.shape,u=c.hints||{};!S(l,"bpmn:Group")||l.labelTarget||u.createElementsBehavior===!1&&!oe(l).categoryValueRef&&!c.categoryValue||o(l,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||oe(l).categoryValueRef||r(l,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||!c.categoryValue||o(l,c)});function a(s,c){var l=e.create(s.$type);return i.copyElement(s,l,null,c)}t.on("copyPaste.copyElement",ly,function(s){var c=s.descriptor,l=s.element;if(!(!S(l,"bpmn:Group")||l.labelTarget)){var u=oe(l);if(u.categoryValueRef){var f=u.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",ly,function(s){var c=s.descriptor,l=c.businessObject,u=c.categoryValue,f=c.category;u&&(u=l.categoryValueRef=a(u)),f&&(u.$parent=a(f)),delete c.category,delete c.categoryValue})}Hp.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],we(Hp,ne);function zp(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 uy(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=zp(i,r,o,a),l=zp(i,r,o,s),u;c&&l?py(c,o)>py(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],Ie(i.source)),t(r[r.length-1],r[r.length-2],Ie(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}uy.$inject=["eventBus"];function py(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Gp(e){ne.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=oe(i),o=ct(i);if(Ze(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}Gp.$inject=["eventBus"],we(Gp,ne);function fy(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function dy(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function bP(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 xP(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 Vp(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=xP([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 hy(e,t){var n=Vp(e,t),i={x:n.x-e.x,y:n.y-e.y};return fy(i)}function Wa(e,t){return fy({x:e.x-t.x,y:e.y-t.y})}var my=Math.sqrt,gy=Math.min,_P=Math.max,yy=Math.abs;function vy(e){return Math.pow(e,2)}function Ua(e,t){return my(vy(e.x-t.x)+vy(e.y-t.y))}function wP(e,t){var n=0,i,r,o,a,s,c,l,u,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],xy(i,r)?l=[i]:(o=Ua(e,i),a=Ua(e,r),c=gy(o,a),l=EP(i,r,e,c)),l.length<1)throw new Error("expected between [1, 2] circle -> line intersections");l.length===1&&(u={type:"bendpoint",position:l[0],segmentIndex:n,bendpointIndex:xy(i,l[0])?n:n+1}),l.length===2&&(s=RP(l[0],l[1]),u={type:"segment",position:s,segmentIndex:n,relativeLocation:Ua(i,s)/Ua(i,r)}),f=Ua(u.position,e),(!d||p>f)&&(d=u,p=f)}return d}function EP(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,l=r*a+o*s,u=a*a+s*s-i*i,f=l/c,p=u/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var m=my(d),h=-f+m,y=-f-m,v={x:e.x-r*h,y:e.y-o*h};if(d===0)return[v];var g={x:e.x-r*y,y:e.y-o*y};return[v,g].filter(function(b){return SP(b,e,t)})}function SP(e,t,n){return by(e.x,t.x,n.x)&&by(e.y,t.y,n.y)}function by(e,t,n){return e>=gy(t,n)-Nc&&e<=_P(t,n)+Nc}function RP(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Nc=.1;function xy(e,t){return yy(e.x-t.x)<=Nc&&yy(e.y-t.y)<=Nc}function CP(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,l=i.bendpointMove.bendpointIndex,u;if(o===0)return r;if(r>=l&&(u=c?r+1:r-1),r<l&&(u=r,c&&n.type!=="bendpoint"&&l-1===r)){var f=wy(t,l);f<n.relativeLocation&&u++}return u}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 _y(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=wP(e,n),c=s.segmentIndex,l=CP(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=Ey(n,c),f=Ey(t,l),p=s.position,d=PP(u,p),m=AP(u,f);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,v=n[y];if(t.indexOf(v)!==-1)return a;if(h===0){var g=t[y];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&&y!==0&&y<n.length-1&&(d=wy(n,y))}var b={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},_=bP({x:e.x-p.x,y:e.y-p.y},m);return r=b.x+_.x-e.x,o=b.y+_.y-e.y,{point:Ji(b),delta:Ji({x:r,y:o})}}function wy(e,t){var n=Wa(e[t-1],e[t]),i=Wa(e[t],e[t+1]),r=n/(n+i);return r}function AP(e,t){var n=dy(e),i=dy(t);return i-n}function Ey(e,t){return[e[t],e[t+1]]}function PP(e,t){var n=Wa(e[0],e[1]),i=Wa(e[0],t);return n===0?0:i/n}function MP(e,t,n,i){var r=Ie(e);return _y(r,t,n,i).delta}function Ya(e,t,n){var i=za(t),r=za(n),o=Ri(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Ji({x:r.x+a.x,y:r.y+a.y})}function Sy(e,t,n){var i=za(e),r=za(t),o=za(n),a=Ri(e,i),s=Ri(i,r),c=TP(i,t,n);if(c)return c;var l={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},u={x:o.x+l.x,y:o.y+l.y};return Ji({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function TP(e,t,n){var i=De(t),r=De(n);if(kP(i,r))return null;var o=xn(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=xn(n,s),c!==o?null:a}function kP(e,t){return OP(e,t)||DP(e,t)}function OP(e,t){return e.right!==t.right&&e.left!==t.left}function DP(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Ry="name",Cy="text";function Wp(e,t,n,i){ne.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{oe(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(Ry in l&&t.updateLabel(c,l[Ry]),Cy in l&&S(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Cy]||"");t.updateLabel(c,l.text,u)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var l=s.shape||s.connection;Xe(l)||!Rr(l)||ci(l)&&t.updateLabel(l,ci(l))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,l=s.hints||{};c&&l.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,l=c.label,u=W({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof u.startChanged>"u"&&(u.startChanged=!!u.connectionStart),typeof u.endChanged>"u"&&(u.endChanged=!!u.connectionEnd),MP(l,f,p,u)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var l=s.connection,u=l.label,f;!u||!u.parent||(f=o(a),t.moveShape(u,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,l=s.oldShape,u=oe(c);u&&Rr(u)&&l.label&&c.label&&(c.label.x=l.label.x,c.label.y=l.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.hints||{};if(!(!Xe(c)||l.autoResize)){var u=s.newBounds,f=i.getDimensions(ci(c)||"",{box:u,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=u.y!==c.y,m=c.y+c.height;s.newBounds={width:u.width,height:p,x:u.x,y:d?m-p:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(xc(c)){var f=c.label,p=Ie(f),d=BP(u),m=IP(p,d),h=LP(m,u,l);t.moveShape(f,h)}})}we(Wp,ne),Wp.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function LP(e,t,n){var i=Ya(e,t,n);return Ji(Ri(i,e))}function IP(e,t){if(t.length){var n=NP(e,t);return Vp(e,n)}}function BP(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 NP(e,t){var n=t.map(function(r){return{line:r,distance:hy(e,r)}}),i=Ai(n,"distance");return i[0].line}function $P(e,t,n,i){return _y(e,t,n,i).point}function Up(e,t){ne.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=W({},o.hints),c=o.newWaypoints||a.waypoints,l=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),$P(r,c,l,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 l=c.waypoints[c.waypoints.length-1],u=n(i,l),f=[].concat(c.waypoints.slice(0,-1),[u]);t.updateWaypoints(c,f)}),a.forEach(function(c){var l=c.waypoints[0],u=n(i,l),f=[].concat([u],c.waypoints.slice(1));t.updateWaypoints(c,f)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(l){var u=l.waypoints[l.waypoints.length-1],f={x:u.x+c.x,y:u.y+c.y},p=[].concat(l.waypoints.slice(0,-1),[f]);t.updateWaypoints(l,p)}),a.forEach(function(l){var u=l.waypoints[0],f={x:u.x+c.x,y:u.y+c.y},p=[].concat([f],l.waypoints.slice(1));t.updateWaypoints(l,p)})})}we(Up,ne),Up.$inject=["eventBus","modeling"];function $c(e,t,n){var i=jc(e),r=Py(i,t),o=i[0];return r.length?r[r.length-1]:Ya(o.original||o,n,t)}function Fc(e,t,n){var i=jc(e),r=Py(i,t),o=i[i.length-1];return r.length?r[0]:Ya(o.original||o,n,t)}function Yp(e,t,n){var i=jc(e),r=Ay(t,n),o=i[0];return Ya(o.original||o,r,t)}function qp(e,t,n){var i=jc(e),r=Ay(t,n),o=i[i.length-1];return Ya(o.original||o,r,t)}function Ay(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function jc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Py(e,t){var n=Pn(e,jP);return Qe(n,function(i){return FP(i,t)})}function FP(e,t){return xn(t,e,1)==="intersect"}function jP(e){return e.original||e}function Kp(e,t){ne.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(HP(i,r)){var o=zP(i);o.incoming.forEach(function(a){var s=Fc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=$c(a,r,i);t.reconnectStart(a,r,s)})}},!0)}Kp.$inject=["eventBus","modeling"],we(Kp,ne);function HP(e,t){return S(e,"bpmn:Participant")&&nt(e)&&S(t,"bpmn:Participant")&&!nt(t)}function zP(e){var t=Oa([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 GP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function My(e){const t=oe(e);if(!S(t,"bpmn:BoundaryEvent")&&!(S(t,"bpmn:StartEvent")&&On(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:GP.some(i=>S(n[0],i))}function Ty(e){return S(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Xp(e,t){e.invoke(ne,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!My(r))return;const a=Ty(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=oe(i).get(a),l=oe(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}Xp.$inject=["injector","modeling"],we(Xp,ne);function Zp(e,t){ne.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=ct(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}we(Zp,ne),Zp.$inject=["eventBus","modeling"];function Qp(e,t,n){ne.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=VP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}we(Qp,ne),Qp.$inject=["eventBus","bpmnRules","modeling"];function Ko(e){return e.original||e}function VP(e,t){var n=zp(Ko(e[e.length-2]),Ko(e[e.length-1]),Ko(t[1]),Ko(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Ko(e[0]),Ko(t[t.length-1])]}function Jp(e,t){ne.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)}Jp.$inject=["eventBus","modeling"],we(Jp,ne);function ef(e,t,n,i){ne.call(this,e);var r=i.get("dragging",!1);function o(c){var l=c.source,u=c.target,f=c.parent;if(f){var p,d;S(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(l,u)||(d=!0),n.canConnectMessageFlow(l,u)&&(p="bpmn:MessageFlow")),S(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(l,u)||(d=!0),n.canConnectSequenceFlow(l,u)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(l,u,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var l=c.context,u=l.connection,f=l.newSource||u.source,p=l.newTarget||u.target,d,m;d=n.canConnect(f,p),!(!d||d.type===u.type)&&(m=t.connect(f,p,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=m,r&&s(u,m))}function s(c,l){var u=r.context(),f=u&&u.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,l))}this.postExecuted("elements.move",function(c){var l=c.closure,u=l.allConnections;H(u,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var l=c.context,u=l.properties,f=l.element,p=f.businessObject,d;u.default&&(d=At(f.outgoing,Ao({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),u.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}we(ef,ne),ef.$inject=["eventBus","modeling","bpmnRules","injector"];function Hc(e,t,n,i,r,o){i.invoke(ne,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,l=s.elements,u=Vn(l,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);u.length&&this._replaceElements(l,u)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,l=s.newHost,u=[];H(s.closure.topLevel,function(p){On(p)?u=u.concat(p.children):u=u.concat(p)}),u.length===1&&l&&(c=l);var f=t.canReplace(u,c);f&&this._replaceElements(u,f.replacements,l)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape,u=c.attachers,f;u&&u.length&&(f=t.canReplace(u,l),this._replaceElements(u,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,l=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(l,{id:c.id})})}we(Hc,ne),Hc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;H(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)},Hc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var WP=1500,UP={width:140,height:120},tf={width:300,height:60},nf={width:60,height:300},zc={width:300,height:150},Gc={width:150,height:300},ky={width:140,height:120},Oy={width:100,height:40};function Dy(e){e.on("resize.start",WP,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=ZP(i,r,o)),S(i,"bpmn:SubProcess")&&nt(i)&&(n.minDimensions=ky),S(i,"bpmn:TextAnnotation")&&(n.minDimensions=Oy)})}Dy.$inject=["eventBus"];var Pr=Math.abs,YP=Math.min,qP=Math.max;function Ly(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Xo(e,t,n){return Ly(e,t,n,YP)}function Zo(e,t,n){return Ly(e,t,n,qP)}var KP={top:20,left:50,right:20,bottom:20},XP={top:50,left:20,right:20,bottom:20};function ZP(e,t,n){var i=di(e),r=!0,o=!0,a=Dc(i,[i]),s=De(e),c={},l={},u=fn(e),f=u?tf:nf;/n/.test(t)?l.top=s.bottom-f.height:/e/.test(t)?l.right=s.left+f.width:/s/.test(t)?l.bottom=s.top+f.height:/w/.test(t)&&(l.left=s.right-f.width),a.forEach(function(m){var h=De(m);u?(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&&Pr(s.top-h.bottom)<10&&Zo(c,"top",h.top+f.height),Pr(s.top-h.top)<5&&Xo(l,"top",h.bottom-f.height)),/e/.test(t)&&(n&&Pr(s.right-h.left)<10&&Xo(c,"right",h.right-f.width),Pr(s.right-h.right)<5&&Zo(l,"right",h.left+f.width)),/s/.test(t)&&(n&&Pr(s.bottom-h.top)<10&&Xo(c,"bottom",h.bottom-f.height),Pr(s.bottom-h.bottom)<5&&Zo(l,"bottom",h.top+f.height)),/w/.test(t)&&(n&&Pr(s.left-h.right)<10&&Zo(c,"left",h.left+f.width),Pr(s.left-h.left)<5&&Xo(l,"left",h.right-f.width))});var p=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(S(m,"bpmn:FlowElement")||S(m,"bpmn:Artifact"))}),d=u?KP:XP;return p.forEach(function(m){var h=De(m);/n/.test(t)&&(!u||r)&&Xo(l,"top",h.top-d.top),/e/.test(t)&&(u||o)&&Zo(l,"right",h.right+d.right),/s/.test(t)&&(!u||o)&&Zo(l,"bottom",h.bottom+d.bottom),/w/.test(t)&&(u||r)&&Xo(l,"left",h.left-d.left)}),{min:l,max:c}}function Iy(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Qo(e){return e.originalEvent||e.srcEvent}function rf(e){Iy(e),Iy(Qo(e))}function ao(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 By(){return/mac/i.test(navigator.platform)}function Ny(e,t){return(Qo(e)||e).button===t}function Mr(e){return Ny(e,0)}function QP(e){return Ny(e,1)}function qa(e){var t=Qo(e)||e;return Mr(e)?By()?t.metaKey:t.ctrlKey:!1}function Vc(e){var t=Qo(e)||e;return Mr(e)&&t.shiftKey}var $y=1001;function Fy(e,t){e.on("resize.start",$y+500,function(n){var i=n.context,r=i.shape;(S(r,"bpmn:Lane")||S(r,"bpmn:Participant"))&&(i.balanced=!qa(n))}),e.on("resize.end",$y,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=hg(a),t.resizeLane(r,a,i.balanced)),!1})}Fy.$inject=["eventBus","modeling"];var JP=500;function of(e,t,n,i,r){n.invoke(ne,this);function o(u){return Ze(u,["bpmn:ReceiveTask","bpmn:SendTask"])||eM(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var f=e.getDefinitions(),p=f.get("rootElements");return!!At(p,Ao({id:u.id}))}function s(u){if(S(u,"bpmn:ErrorEventDefinition"))return"errorRef";if(S(u,"bpmn:EscalationEventDefinition"))return"escalationRef";if(S(u,"bpmn:MessageEventDefinition"))return"messageRef";if(S(u,"bpmn:SignalEventDefinition"))return"signalRef"}function c(u){if(Ze(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.get("messageRef");var f=u.get("eventDefinitions"),p=f[0];return p.get(s(p))}function l(u,f){if(Ze(u,["bpmn:ReceiveTask","bpmn:SendTask"]))return u.set("messageRef",f);var p=u.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var f=u.shape||u.element;if(o(f)){var p=oe(f),d=c(p),m;d&&!a(d)&&(m=e.getDefinitions().get("rootElements"),Yt(m,d),u.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(u){var f=u.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");Ut(p,f)}},!0),t.on("copyPaste.copyElement",function(u){var f=u.descriptor,p=u.element;if(!(p.labelTarget||!o(p))){var d=oe(p),m=c(d);m&&(f.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",JP,function(u){var f=u.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),l(p,d),delete f.referencedRootElement)})}of.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],we(of,ne);function eM(e,t){return Le(t)||(t=[t]),hr(t,function(n){return Go(e,n)})}var jy=Math.max;function Hy(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return H(n,function(a){var s=a.id;S(a,"bpmn:Participant")&&(o[s]=nM(a,i,r)),S(a,"bpmn:Lane")&&(o[s]=fn(a)?tf:nf),S(a,"bpmn:SubProcess")&&nt(a)&&(o[s]=ky),S(a,"bpmn:TextAnnotation")&&(o[s]=Oy),S(a,"bpmn:Group")&&(o[s]=UP)}),o})}Hy.$inject=["eventBus"];function tM(e){return e==="x"}function nM(e,t,n){var i=fn(e);if(!oM(e))return i?zc:Gc;var r=tM(t),o={};return r?i?o=zc:o={width:rM(e,n,r),height:Gc.height}:i?o={width:zc.width,height:iM(e,n,r)}:o=Gc,o}function iM(e,t,n){var i;return i=aM(e,t,n),jy(zc.height,i)}function rM(e,t,n){var i;return i=sM(e,t,n),jy(Gc.width,i)}function oM(e){return!!Ar(e).length}function aM(e,t,n){var i=Ar(e),r;return r=af(i,t,n),e.height-r.height+tf.height}function sM(e,t,n){var i=Ar(e),r;return r=af(i,t,n),e.width-r.width+nf.width}function af(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=Ar(r),o.length?af(o,t,n):r}var zy="_plane";function Gy(e){var t=e.id;return cM(t)}function Ni(e){var t=e.id;return S(e,"bpmn:SubProcess")?Vy(t):t}function so(e){return Vy(e)}function Wc(e){var t=ct(e);return S(t,"bpmndi:BPMNPlane")}function Vy(e){return e+zy}function cM(e){return e.replace(new RegExp(zy+"$"),"")}var Wy=400,lM=600,Uy={x:180,y:160};function ir(e,t,n,i,r,o,a){ne.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(f){return S(f,"bpmn:SubProcess")&&!nt(f)}function l(f){var p=f.shape,d=f.newRootElement,m=oe(p);d=s._addDiagram(d||m),f.newRootElement=e.addRootElement(d)}function u(f){var p=f.shape,d=oe(p);s._removeDiagram(d);var m=f.newRootElement=a.get(Ni(d));e.removeRootElement(m)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;H(p,function(d){if(c(d)){var m=a.get(Ni(d));if(!(!m||!d.children||!d.children.length)){var h=Yy(d);s._showRecursively(h),s._moveChildrenToShape(h,m)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!S(p,"bpmn:SubProcess")||!nt(p)||H($a([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(Ni(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(Ni(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,m=e.findRoot(Ni(p));if(!(!d||!m)){var h=d.children;n.moveElements(h,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(S(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,y=d.id;if(h!==y){if(Wc(p)){a.updateId(p,so(y)),a.updateId(h,y);return}var v=a.get(so(h));v&&a.updateId(so(h),so(y))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(S(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,y=d.id;if(h!==y){if(Wc(p)){a.updateId(p,so(h)),a.updateId(y,h);return}var v=a.get(so(y));v&&a.updateId(v,so(h))}}},!0),t.on("element.changed",function(f){var p=f.element;if(Wc(p)){var d=p,m=a.get(Gy(d));!m||m===d||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",Wy,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(nt(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",Wy,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(nt(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",lM,function(f){var p=f.shape;if(S(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(nt(p))s._moveChildrenToShape(d.children.slice(),p),H($a(p.children),h=>{n.moveShape(h.annotation,{x:0,y:0},p.parent),H(h.associations,y=>{n.moveConnection(y,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var m=Yy(p);s._moveChildrenToShape(m,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var m=Ni(p),h=a.get(m);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,m=f.elements,h=d.parent,y=S(ct(h),"bpmndi:BPMNPlane");if(y){var v=Gy(h),g=At(m,function(b){return b.id===v});g&&(p.parent=g.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}we(ir,ne),ir.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=Zt(i),o;if(!t.x)o={x:Uy.x-r.x,y:Uy.y-r.y};else{var a=Ie(t),s=Ie(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},ir.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Ng(e).map(i=>i.annotation));n.size&&H($a(e.children),i=>{n.has(i.annotation)&&H(i.associations,r=>{t.removeConnection(r)})})},ir.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},ir.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},ir.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:Ni(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},ir.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=At(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},ir.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function uM(e){var t=[];return H($a(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Yy(e){return e.children.slice().concat(uM(e.children)).concat(pM(e))}function pM(e){return up(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function sf(e,t){e.invoke(ne,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"))||!nt(r))){var o=fM(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}sf.$inject=["injector","modeling"],we(sf,ne);function fM(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function cf(e,t){ne.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,ci(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,l=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?l-s.height:a.y}}})}we(cf,ne),cf.$inject=["eventBus","textRenderer"];function lf(e,t){ne.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(nt(i))return;var r=Oa(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();H(s,function(l){o(l,!0)}),H(c,function(l){o(l,!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,Ie(i)):t.reconnectStart(a,i,Ie(i)))}},!0)}we(lf,ne),lf.$inject=["eventBus","modeling"];var uf=500;function pf(e,t,n){ne.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,l=s,u,f;return u=dM(c).concat([a]),f=ty(u),f?(l.width=Math.max(f.width,l.width),l.height=Math.max(f.height,l.height),l.x=f.x+(f.width-l.width)/2,l.y=f.y+(f.height-l.height)/2):(l.x=a.x+(a.width-l.width)/2,l.y=a.y+(a.height-l.height)/2),l}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"],uf,function(a){var s=a.context,c=s.shape;S(c,"bpmn:SubProcess")&&(c.collapsed?ct(c).isExpanded=!1:(i(c.children),ct(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],uf,function(a){var s=a.context,c=s.shape;c.collapsed?ct(c).isExpanded=!1:ct(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],uf,function(a){var s=a.context.shape,c=t.getDefaultSize(s),l;s.collapsed?l=o(s,c):l=r(s,c),n.resizeShape(s,l,null,{autoResize:s.collapsed?!1:"nwse"})})}we(pf,ne),pf.$inject=["eventBus","elementFactory","modeling"];function dM(e){return e.filter(function(t){return!t.hidden})}function ff(e,t,n,i){t.invoke(ne,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Xe(a)||(S(a,"bpmn:Participant")&&nt(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)})}we(ff,ne),ff.$inject=["canvas","injector","moddle","modeling"];function df(e,t){ne.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;hM(r,o)&&t.updateProperties(o,{default:null})})}we(df,ne),df.$inject=["eventBus","modeling"];function hM(e,t){if(!S(e,"bpmn:SequenceFlow"))return!1;var n=oe(t),i=oe(e);return n.get("default")===i}var mM=500,gM=5e3,qy=["shape.create","shape.delete","shape.move","shape.resize"],Ky=[...qy,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function hf(e,t){ne.call(this,e);var n;function i(){return n=n||new yM,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(Ky,gM,function(){i()}),this.postExecuted(Ky,mM,function(){o()}),this.preExecute(qy,function(a){var s=a.context,c=s.shape,l=r();!c||c.labelTarget||(S(c,"bpmn:Lane")&&l.addLane(c),S(c,"bpmn:FlowNode")&&l.addFlowNode(c))})}hf.$inject=["eventBus","modeling"],we(hf,ne);function yM(){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 vM=500,bM=5e3,Xy=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Zy=[...Xy,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function mf(e,t){ne.call(this,e);var n;function i(){return n=n||new xM,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(Zy,bM,function(){i()}),this.postExecuted(Zy,vM,function(){o()}),this.preExecute(Xy,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)})}mf.$inject=["eventBus","modeling"],we(mf,ne);function xM(){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 gf(e,t){ne.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)_M(o)&&!EM(o)&&t.updateProperties(o,{isForCompensation:void 0})})}we(gf,ne),gf.$inject=["eventBus","modeling"];function _M(e){const t=oe(e);return t&&t.isForCompensation}function wM(e){return e&&S(e,"bpmn:BoundaryEvent")&&Go(e,"bpmn:CompensateEventDefinition")}function EM(e){return e.incoming.filter(n=>wM(n.source)).length>0}const SM={__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",Ep],appendBehavior:["type",Sp],associationBehavior:["type",Cp],attachEventBehavior:["type",Cc],artifactBehavior:["type",Rp],boundaryEventBehavior:["type",Ap],categoryRootElementReferenceBehavior:["type",Pp],compensateBoundaryEventBehaviour:["type",Mp],createBehavior:["type",Tp],createDataObjectBehavior:["type",kp],createParticipantBehavior:["type",Lp],dataInputAssociationBehavior:["type",Ip],dataStoreBehavior:["type",Bp],deleteLaneBehavior:["type",Np],detachEventBehavior:["type",Lc],dropOnFlowBehavior:["type",Fp],eventBasedGatewayBehavior:["type",jp],fixHoverBehavior:["type",cy],groupBehavior:["type",Hp],importDockingFix:["type",uy],isHorizontalFix:["type",Gp],labelBehavior:["type",Wp],layoutConnectionBehavior:["type",Up],messageFlowBehavior:["type",Kp],nonInterruptingBehavior:["type",Xp],removeElementBehavior:["type",Qp],removeEmbeddedLabelBoundsBehavior:["type",Zp],removeParticipantBehavior:["type",Jp],replaceConnectionBehavior:["type",ef],replaceElementBehaviour:["type",Hc],resizeBehavior:["type",Dy],resizeLaneBehavior:["type",Fy],rootElementReferenceBehavior:["type",of],spaceToolBehavior:["type",Hy],subProcessPlaneBehavior:["type",ir],subProcessStartEventBehavior:["type",sf],textAnnotationBehavior:["type",cf],toggleCollapseConnectionBehaviour:["type",lf],toggleElementCollapseBehaviour:["type",pf],unclaimIdBehavior:["type",ff],unsetDefaultFlowBehavior:["type",df],updateFlowNodeRefsBehavior:["type",hf],updateCategoryValueRefsBehavior:["type",mf],setCompensationActivityAfterPasteBehavior:["type",gf]};function yf(e){this._commandStack=e.get("commandStack",!1)}yf.$inject=["injector"],yf.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const $i={__init__:["rules"],rules:["type",yf]};function hi(e){ne.call(this,e),this.init()}hi.$inject=["eventBus"],we(hi,ne),hi.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)})},hi.prototype.init=function(){};function Qy(e,t){var n=xn(e,t,-15);return n!=="intersect"?n:null}function wn(e){hi.call(this,e)}we(wn,hi),wn.$inject=["eventBus"],wn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return RM(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 Yc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return Yc(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 pv(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return wt(i)&&!qc(t,i)?!1:Xr(t,function(r){return wt(r)?Yc(r.source,r.target,r):r.host?Ka(r,r.host,null,n):_f(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 ov(a)&&!n.includes(a.host)})?!1:Ka(n,t,null,i)||lv(n,t,i)||uv(n,t)||qc(n,t)}),this.addRule("shape.create",function(e){return _f(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return Ka(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return gv(n,t)})},wn.prototype.canConnectMessageFlow=hv,wn.prototype.canConnectSequenceFlow=mv,wn.prototype.canConnectDataAssociation=wf,wn.prototype.canConnectAssociation=fv,wn.prototype.canConnectCompensationAssociation=dv,wn.prototype.canMove=uv,wn.prototype.canAttach=Ka,wn.prototype.canReplace=lv,wn.prototype.canDrop=Jo,wn.prototype.canInsert=qc,wn.prototype.canCreate=_f,wn.prototype.canConnect=Yc,wn.prototype.canResize=pv,wn.prototype.canCopy=gv;function RM(e){return vf(e)?null:Ze(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function vf(e){return!e||Xe(e)}function Jy(e){do{if(S(e,"bpmn:Process"))return oe(e);if(S(e,"bpmn:Participant"))return oe(e).processRef||oe(e)}while(e=e.parent)}function bf(e){return S(e,"bpmn:TextAnnotation")}function xf(e){return S(e,"bpmn:Group")&&!e.labelTarget}function ev(e){return S(e,"bpmn:BoundaryEvent")&&Fi(e,"bpmn:CompensateEventDefinition")}function Uc(e){return oe(e).isForCompensation}function CM(e,t){var n=Jy(e),i=Jy(t);return n===i}function AM(e){return S(e,"bpmn:InteractionNode")&&!S(e,"bpmn:BoundaryEvent")&&(!S(e,"bpmn:Event")||S(e,"bpmn:ThrowEvent")&&iv(e,"bpmn:MessageEventDefinition"))}function PM(e){return S(e,"bpmn:InteractionNode")&&!Uc(e)&&(!S(e,"bpmn:Event")||S(e,"bpmn:CatchEvent")&&iv(e,"bpmn:MessageEventDefinition"))&&!(S(e,"bpmn:BoundaryEvent")&&!Fi(e,"bpmn:MessageEventDefinition"))}function tv(e){for(var t=e;t=t.parent;){if(S(t,"bpmn:FlowElementsContainer"))return oe(t);if(S(t,"bpmn:Participant"))return oe(t).processRef}return null}function nv(e,t){var n=tv(e),i=tv(t);return n===i}function Fi(e,t){var n=oe(e);return!!At(n.eventDefinitions||[],function(i){return S(i,t)})}function iv(e,t){var n=oe(e);return(n.eventDefinitions||[]).every(function(i){return S(i,t)})}function MM(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:EndEvent")&&!On(e)&&!(S(e,"bpmn:IntermediateThrowEvent")&&Fi(e,"bpmn:LinkEventDefinition"))&&!ev(e)&&!Uc(e)}function TM(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:StartEvent")&&!S(e,"bpmn:BoundaryEvent")&&!On(e)&&!(S(e,"bpmn:IntermediateCatchEvent")&&Fi(e,"bpmn:LinkEventDefinition"))&&!Uc(e)}function kM(e){return S(e,"bpmn:ReceiveTask")||S(e,"bpmn:IntermediateCatchEvent")&&(Fi(e,"bpmn:MessageEventDefinition")||Fi(e,"bpmn:TimerEventDefinition")||Fi(e,"bpmn:ConditionalEventDefinition")||Fi(e,"bpmn:SignalEventDefinition"))}function OM(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function rv(e,t){var n=OM(t);return n.indexOf(e)!==-1}function Yc(e,t,n){if(vf(e)||vf(t))return null;if(!S(n,"bpmn:DataAssociation")){if(hv(e,t))return{type:"bpmn:MessageFlow"};if(mv(e,t))return{type:"bpmn:SequenceFlow"}}var i=wf(e,t);return i||(dv(e,t)?{type:"bpmn:Association",associationDirection:"One"}:fv(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Jo(e,t){return Xe(e)||xf(e)?!0:S(t,"bpmn:Participant")&&!nt(t)?!1:S(e,"bpmn:Participant")?S(t,"bpmn:Process")||S(t,"bpmn:Collaboration"):Ze(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")&&!DM(e)?!1:S(e,"bpmn:FlowElement")&&!S(e,"bpmn:DataStoreReference")?S(t,"bpmn:FlowElementsContainer")?nt(t):Ze(t,["bpmn:Participant","bpmn:Lane"]):S(e,"bpmn:DataStoreReference")&&S(t,"bpmn:Collaboration")?hr(oe(t).get("participants"),function(n){return!!n.get("processRef")}):Ze(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ze(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 DM(e){return oe(e).cancelActivity&&(av(e)||sv(e))}function ov(e){return!Xe(e)&&S(e,"bpmn:BoundaryEvent")}function LM(e){return S(e,"bpmn:Lane")}function IM(e){return ov(e)||S(e,"bpmn:IntermediateThrowEvent")&&av(e)?!0:S(e,"bpmn:IntermediateCatchEvent")&&sv(e)}function av(e){var t=oe(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function sv(e){return cv(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function cv(e,t){return t.some(function(n){return Fi(e,n)})}function BM(e){return S(e,"bpmn:ReceiveTask")&&At(e.incoming,function(t){return S(t.source,"bpmn:EventBasedGateway")})}function Ka(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Xe(r)||!IM(r)||On(t)||!S(t,"bpmn:Activity")||Uc(t)||i&&!Qy(i,t)||BM(t)?!1:"attach"}function lv(e,t,n){if(!t)return!1;var i={replacements:[]};return H(e,function(r){On(t)||S(r,"bpmn:StartEvent")&&r.type!=="label"&&Jo(r,t)&&(WC(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(UC(r)||YC(r)||qC(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),cv(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")||Fi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(S(r,"bpmn:EndEvent")&&Jo(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),S(r,"bpmn:BoundaryEvent")&&Ka(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function uv(e,t){return hr(e,LM)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Jo(n,t)})}function _f(e,t,n,i){return t?Xe(e)||xf(e)?!0:Jo(e,t)||qc(e,t):!1}function pv(e,t,n){return S(e,"bpmn:SubProcess")?nt(e)&&(!t||t.width>=100&&t.height>=80):S(e,"bpmn:Lane")||S(e,"bpmn:Participant")?!0:bf(e)?n?n==="e"||n==="w":!0:xf(e)?!0:Xe(e)?n?n==="e"||n==="w":!0:!1}function NM(e,t){var n=bf(e),i=bf(t);return(n||i)&&n!==i}function fv(e,t){return rv(t,e)||rv(e,t)?!1:NM(e,t)?!0:!!wf(e,t)}function dv(e,t){return nv(e,t)&&ev(e)&&S(t,"bpmn:Activity")&&!FM(t,e)&&!On(t)}function hv(e,t){return vv(e)&&!vv(t)?!1:AM(e)&&PM(t)&&!CM(e,t)}function mv(e,t){return MM(e)&&TM(t)&&nv(e,t)&&!(S(e,"bpmn:EventBasedGateway")&&!kM(t))}function wf(e,t){return Ze(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ze(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Ze(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ze(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function qc(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:Ze(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Xe(t)&&S(e,"bpmn:FlowNode")&&!S(e,"bpmn:BoundaryEvent")&&Jo(e,t.parent)}function Ef(e,t){return e&&t&&e.indexOf(t)!==-1}function gv(e,t){return Xe(t)?!0:!(S(t,"bpmn:Lane")&&!Ef(e,t.parent)||S(t,"bpmn:MessageFlow")&&!$M(e,t))}function $M(e,t){var n=yv(t.source),i=yv(t.target);return Ef(e,n)&&Ef(e,i)}function yv(e){for(;e;e=e.parent)if(S(e,"bpmn:Participant"))return e;return null}function vv(e){return Uo(e,"bpmn:Process")||Uo(e,"bpmn:Collaboration")}function FM(e,t){return e.attachers.includes(t)}const jM={__depends__:[$i],__init__:["bpmnRules"],bpmnRules:["type",wn]};var HM=2e3;function bv(e,t){e.on("saveXML.start",HM,n);function n(){var i=t.getRootElements();H(i,function(r){var o=ct(r),a,s;a=Oa([r]),a=Qe(a,function(c){return c!==r&&!c.labelTarget}),s=Pn(a,ct),o.set("planeElement",s)})}}bv.$inject=["eventBus","canvas"];const zM={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",bv]};function Kc(e){ne.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)})}Kc.prototype.getOrdering=function(e,t){return null},we(Kc,ne);function Sf(e,t){Kc.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=At(n,function(c){return Ze(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 l=s;l&&!Ze(l,c);)l=l.parent;if(!l)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return l}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 l=s.children.indexOf(a),u=sh(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return u!==-1&&l!==-1&&l<u&&(u-=1),{index:u,parent:s}}}Sf.$inject=["eventBus","canvas"],we(Sf,Kc);const GM={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Sf]};function Xa(){}Xa.prototype.get=function(){return this._data},Xa.prototype.set=function(e){this._data=e},Xa.prototype.clear=function(){var e=this._data;return delete this._data,e},Xa.prototype.isEmpty=function(){return!this._data};const VM={clipboard:["type",Xa]};var xv=1500;function _v(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),l=c&&e.get(c);c&&l&&(a.stopPropagation(),r.hover({element:l,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",xv,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",xv,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=ao(a),c=document.elementFromPoint(s.x,s.y),WM(c)}}_v.$inject=["elementRegistry","eventBus","injector"];function WM(e){return eo(e,"svg, .djs-element",!0)}const UM={__init__:["hoverFix"],hoverFix:["type",_v]};function YM(e){return!0}function Xc(e){return Mr(e)||QP(e)}var wv=500;function Ev(e,t,n){var i=this;function r(P,F,I){if(!s(P,F)){var B,z,ce;I?z=t.getGraphics(I):(B=F.delegateTarget||F.target,B&&(z=B,I=t.get(z))),!(!z||!I)&&(ce=e.fire(P,{element:I,gfx:z,originalEvent:F}),ce===!1&&(F.stopPropagation(),F.preventDefault()))}}var o={};function a(P){return o[P]}function s(P,F){var I=l[P]||Mr;return!I(F)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},l={"element.contextmenu":YM,"element.mousedown":Xc,"element.mouseup":Xc,"element.click":Xc,"element.dblclick":Xc};function u(P,F,I){var B=c[P];if(!B)throw new Error("unmapped DOM event name <"+P+">");return r(B,F,I)}var f="svg, .djs-element";function p(P,F,I,B){var z=o[I]=function(ce){r(I,ce)};B&&(l[I]=B),z.$delegate=Un.bind(P,f,F,z)}function d(P,F,I){var B=a(I);B&&Un.unbind(P,F,B.$delegate)}function m(P){H(c,function(F,I){p(P,I,F)})}function h(P){H(c,function(F,I){d(P,I,F)})}e.on("canvas.destroy",function(P){h(P.svg)}),e.on("canvas.init",function(P){m(P.svg)}),e.on(["shape.added","connection.added"],function(P){var F=P.element,I=P.gfx;e.fire("interactionEvents.createHit",{element:F,gfx:I})}),e.on(["shape.changed","connection.changed"],wv,function(P){var F=P.element,I=P.gfx;e.fire("interactionEvents.updateHit",{element:F,gfx:I})}),e.on("interactionEvents.createHit",wv,function(P){var F=P.element,I=P.gfx;i.createDefaultHit(F,I)}),e.on("interactionEvents.updateHit",function(P){var F=P.element,I=P.gfx;i.updateDefaultHit(F,I)});var y=C("djs-hit djs-hit-stroke"),v=C("djs-hit djs-hit-click-stroke"),g=C("djs-hit djs-hit-all"),b=C("djs-hit djs-hit-no-move"),_={all:g,"click-stroke":v,stroke:y,"no-move":b};function C(P,F){return F=W({stroke:"white",strokeWidth:15},F||{}),n.cls(P,["no-fill","no-border"],F)}function M(P,F){var I=_[F];if(!I)throw new Error("invalid hit type <"+F+">");return Ee(P,I),P}function O(P,F){We(P,F)}this.removeHits=function(P){var F=sc(".djs-hit",P);H(F,an)},this.createDefaultHit=function(P,F){var I=P.waypoints,B=P.isFrame,z;return I?this.createWaypointsHit(F,I):(z=B?"stroke":"all",this.createBoxHit(F,z,{width:P.width,height:P.height}))},this.createWaypointsHit=function(P,F){var I=ka(F);return M(I,"stroke"),O(P,I),I},this.createBoxHit=function(P,F,I){I=W({x:0,y:0},I);var B=Te("rect");return M(B,F),Ee(B,I),O(P,B),B},this.updateDefaultHit=function(P,F){var I=bt(".djs-hit",F);if(I)return P.waypoints?lp(I,P.waypoints):Ee(I,{width:P.width,height:P.height}),I},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}Ev.$inject=["eventBus","elementRegistry","styles"];const Zc={__init__:["interactionEvents"],interactionEvents:["type",Ev]};function ea(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)})}ea.$inject=["eventBus","canvas"],ea.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()})}},ea.prototype.get=function(){return Array.from(this._selectedElements)},ea.prototype.isSelected=function(e){return this._selectedElements.has(e)},ea.prototype.select=function(e,t){var n=this.get();Le(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?H(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Sv="hover",Rv="selected";function Cv(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,Sv)}),t.on("element.out",function(r){i(r.element,Sv)}),t.on("selection.changed",function(r){function o(l){i(l,Rv)}function a(l){n(l,Rv)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let l of s)c.has(l)||o(l);for(let l of c)s.has(l)||a(l)})}Cv.$inject=["canvas","eventBus"];function Av(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},l=c.autoSelect;if(a){if(l===!1)return;Le(l)?t.select(l):t.select(s.filter(qM))}}),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=At(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Mr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Vc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Av.$inject=["eventBus","selection","canvas","elementRegistry"];function qM(e){return!e.hidden}const mi={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Zc],selection:["type",ea],selectionVisuals:["type",Cv],selectionBehavior:["type",Av]};var KM=/^djs-cursor-.*$/;function Qc(e){var t=Bt(document.body);t.removeMatching(KM),e&&t.add("djs-cursor-"+e)}function Pv(){Qc(null)}var XM=5e3;function Mv(e,t){t=t||"element.click";function n(){return!1}return e.once(t,XM,n),function(){e.off(t,n)}}var ZM=["c","C"],QM=["v","V"],JM=["d","D"],eT=["x","X"],tT=["y","Y"],Tv=["z","Z"];function nT(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Kn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function sn(e,t){return e=Le(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Rf(e){return e.shiftKey}function iT(e){return Kn(e)&&sn(ZM,e)}function rT(e){return Kn(e)&&sn(QM,e)}function oT(e){return Kn(e)&&sn(JM,e)}function aT(e){return Kn(e)&&sn(eT,e)}function sT(e){return Kn(e)&&!Rf(e)&&sn(Tv,e)}function cT(e){return Kn(e)&&(sn(tT,e)||sn(Tv,e)&&Rf(e))}var ta=Math.round,kv="djs-drag-active";function co(e){e.preventDefault()}function lT(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function uT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ov(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var _=t.viewbox(),C=t._container.getBoundingClientRect();return{x:_.x+(b.x-C.left)/_.scale,y:_.y+(b.y-C.top)/_.scale}}function s(b,_){_=_||o;var C=e.createEvent(W({},_.payload,_.data,{isTouch:_.isTouch}));return e.fire("drag."+b,C)===!1?!1:e.fire(_.prefix+"."+b,C)}function c(b){var _=b.filter(function(C){return i.get(C.id)});_.length&&n.select(_)}function l(b,_){var C=o.payload,M=o.displacement,O=o.globalStart,P=ao(b),F=Ri(P,O),I=o.localStart,B=a(P),z=Ri(B,I);if(!o.active&&(_||uT(F)>o.threshold)){if(W(C,{x:ta(I.x+M.x),y:ta(I.y+M.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return y();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&Qc(o.cursor),t.addMarker(t.getRootElement(),kv)}rf(b),o.active&&(W(C,{x:ta(B.x+M.x),y:ta(B.y+M.y),dx:ta(z.x),dy:ta(z.y)},{originalEvent:b}),s("move"))}function u(b){var _,C=!0;o.active&&(b&&(o.payload.originalEvent=b,rf(b)),C=s("end")),C===!1&&s("rejected"),_=v(C!==!0),s("ended",_)}function f(b){sn("Escape",b)&&(co(b),y())}function p(b){var _;o.active&&(_=Mv(e),setTimeout(_,400),co(b)),u(b)}function d(b){l(b)}function m(b){var _=o.payload;_.hoverGfx=b.gfx,_.hover=b.element,s("hover")}function h(b){s("out");var _=o.payload;_.hoverGfx=null,_.hover=null}function y(b){var _;if(o){var C=o.active;C&&s("cancel"),_=v(b),C&&s("canceled",_)}}function v(b){var _,C;s("cleanup"),Pv(),o.trapClick?C=p:C=u,je.unbind(document,"mousemove",l),je.unbind(document,"dragstart",co),je.unbind(document,"selectstart",co),je.unbind(document,"mousedown",C,!0),je.unbind(document,"mouseup",C,!0),je.unbind(document,"keyup",f),je.unbind(document,"touchstart",d,!0),je.unbind(document,"touchcancel",y,!0),je.unbind(document,"touchmove",l,!0),je.unbind(document,"touchend",u,!0),e.off("element.hover",m),e.off("element.out",h),t.removeMarker(t.getRootElement(),kv);var M=o.payload.previousSelection;return b!==!1&&M&&!n.get().length&&c(M),_=o,o=null,_}function g(b,_,C,M){o&&y(!1),typeof _=="string"&&(M=C,C=_,_=null),M=W({},r,M||{});var O=M.data||{},P,F,I,B,z;if(M.trapClick?B=p:B=u,b?(P=Qo(b)||b,F=ao(b),rf(b),P.type==="dragstart"&&co(P)):(P=null,F={x:0,y:0}),I=a(F),_||(_=I),z=lT(P),o=W({prefix:C,data:O,payload:{},globalStart:F,displacement:Ri(_,I),localStart:I,isTouch:z},M),M.manual||(z?(je.bind(document,"touchstart",d,!0),je.bind(document,"touchcancel",y,!0),je.bind(document,"touchmove",l,!0),je.bind(document,"touchend",u,!0)):(je.bind(document,"mousemove",l),je.bind(document,"dragstart",co),je.bind(document,"selectstart",co),je.bind(document,"mousedown",B,!0),je.bind(document,"mouseup",B,!0)),je.bind(document,"keyup",f),e.on("element.hover",m),e.on("element.out",h)),s("init")===!1)return y(),!1;M.autoActivate&&l(b,!0)}e.on("diagram.destroy",y),this.init=g,this.move=l,this.hover=m,this.out=h,this.end=u,this.cancel=y,this.context=function(){return o},this.setOptions=function(b){W(r,b)}}Ov.$inject=["eventBus","canvas","selection","elementRegistry"];const rr={__depends__:[UM,mi],dragging:["type",Ov]};function na(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}na.prototype.next=function(){return this._prefix+ ++this._counter};const pT=new na("ps");var fT=["marker-start","marker-mid","marker-end"],dT=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Tr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}Tr.$inject=["elementRegistry","eventBus","canvas","styles"],Tr.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")},Tr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Tr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Wm(n);return this._cloneMarkers(io(r),i),Ee(r,this._styles.cls(i,[])),We(t,r),Ee(r,"data-preview-support-element-id",e.id),r},Tr.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 We(t,n),Ee(n,"data-preview-support-element-id",e.id),n},Tr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),yT(e)&&fT.forEach(function(r){if(Ee(e,r)){var o=hT(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},Tr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,pT.next()].join("-"),a=bt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Wm(n);s.id=o,ot(s).add(r);var c=bt(":scope > defs",e);c||(c=Te("defs"),We(e,c)),We(c,s);var l=gT(s.id);Ee(t,i,l)};function hT(e,t,n){var i=mT(Ee(e,t));return bt("marker#"+i,n||document)}function mT(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function gT(e){return"url(#"+e+")"}function yT(e){return dT.indexOf(e.nodeName)!==-1}const ia={__init__:["previewSupport"],previewSupport:["type",Tr]};var vT="drop-ok",Dv="drop-not-ok",Lv="attach-ok",Iv="new-parent",Bv="create",bT=2e3;function Nv(e,t,n,i,r){function o(c,l,u,f,p){if(!l)return!1;c=Qe(c,function(g){var b=g.labelTarget;return!g.parent&&!(Xe(g)&&c.indexOf(b)!==-1)});var d=At(c,function(g){return!wt(g)}),m=!1,h=!1,y=!1;Fv(c)&&(m=r.allowed("shape.attach",{position:u,shape:d,target:l})),m||(Fv(c)?y=r.allowed("shape.create",{position:u,shape:d,source:f,target:l}):y=r.allowed("elements.create",{elements:c,position:u,target:l}));var v=p.connectionTarget;return y||m?(d&&f&&(h=r.allowed("connection.create",{source:v===f?d:f,target:v===f?f:d,hints:{targetParent:l,targetAttach:m}})),{attach:m,connect:h}):y===null||m===null?null:!1}function a(c,l){[Lv,vT,Dv,Iv].forEach(function(u){u===l?e.addMarker(c,u):e.removeMarker(c,u)})}n.on(["create.move","create.hover"],function(c){var l=c.context,u=l.elements,f=c.hover,p=l.source,d=l.hints||{};if(!f){l.canExecute=!1,l.target=null;return}$v(c);var m={x:c.x,y:c.y},h=l.canExecute=f&&o(u,f,m,p,d);f&&h!==null&&(l.target=f,h&&h.attach?a(f,Lv):a(f,h?Iv:Dv))}),n.on(["create.end","create.out","create.cleanup"],function(c){var l=c.hover;l&&a(l,null)}),n.on("create.end",function(c){var l=c.context,u=l.source,f=l.shape,p=l.elements,d=l.target,m=l.canExecute,h=m&&m.attach,y=m&&m.connect,v=l.hints||{};if(m===!1||!d)return!1;$v(c);var g={x:c.x,y:c.y};y?f=i.appendShape(u,f,g,d,{attach:h,connection:y===!0?{}:y,connectionTarget:v.connectionTarget}):(p=i.createElements(p,g,d,W({},v,{attach:h})),f=At(p,function(b){return!wt(b)})),W(l,{elements:p,shape:f}),W(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===Bv&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],bT,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Le(l)||(l=[l]);var f=At(l,function(m){return!wt(m)});if(f){u=W({elements:l,hints:{},shape:f},u||{}),H(l,function(m){Fe(m.x)||(m.x=0),Fe(m.y)||(m.y=0)});var p=Qe(l,function(m){return!m.hidden}),d=Zt(p);H(l,function(m){wt(m)&&(m.waypoints=Pn(m.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),W(m,{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2})}),t.init(c,Bv,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:l,context:u}})}}}Nv.$inject=["canvas","dragging","eventBus","modeling","rules"];function $v(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 Fv(e){return e&&e.length===1&&!wt(e[0])}var xT=750;function jv(e,t,n,i,r){function o(a){var s=Te("g");Ee(s,r.cls("djs-drag-group",["no-events"]));var c=Te("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(io(u),l)):(u=n._createContainer("shape",c),n.drawShape(io(u),l),_n(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",xT,function(a){var s=a.hover,c=a.context,l=c.elements,u=c.dragGroup;u||(u=c.dragGroup=o(l));var f;s?(u.parentNode||(f=e.getActiveLayer(),We(f,u)),_n(u,a.x,a.y)):an(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&an(c)})}jv.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Jc={__depends__:[rr,ia,$i,mi],__init__:["create","createPreview"],create:["type",Nv],createPreview:["type",jv]};function Cf(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)})}Cf.$inject=["eventBus"],Cf.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||_T(0,0)};function _T(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 Za={__init__:["mouse"],mouse:["type",Cf]};var Hv=2e3;function Xn(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 l=c.descriptor,u=c.element,f=c.elementsSet;l.priority=1,l.id=u.id,f.has(u.parent)&&(l.parent=u.parent.id),wT(u)&&(l.priority=2,l.host=u.host.id),wt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=ET(u)),Xe(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),H(["x","y","width","height"],function(p){Fe(u[p])&&(l[p]=u[p])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.elementsCopied",Hv,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Hv,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;W(l,{createElementsBehavior:!1})})}Xn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Xn.prototype.copy=function(e,t={}){var n,i;return Le(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Le(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Xn.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})}}},Xn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Xn.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},Xn.prototype._getElementIdsFromTree=function(e){var t={};return H(e,function(n){H(n,function(i){i.id&&(t[i.id]=!0)})}),t},Xn.prototype._paste=function(e,t,n,i){H(e,function(o){Fe(o.x)||(o.x=0),Fe(o.y)||(o.y=0)});var r=Zt(e);return H(e,function(o){wt(o)&&(o.waypoints=Pn(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),W(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,W({},i))},Xn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return H(e,function(o,a){o=Ai(o,"priority"),H(o,function(s){var c=W({},Pi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(wt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(Xe(c)){c.labelTarget=i[c.labelTarget],l=i[s.id]=t.createLabel(c),r.push(l);return}c.host&&(c.host=i[c.host]),l=i[s.id]=t.createShape(c),r.push(l)})}),r},Xn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Pi(e,["id"]));return t},Xn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Pi(e,["id"]));return t},Xn.prototype.createShape=function(e){var t=this._elementFactory.createShape(Pi(e,["id"]));return t},Xn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(wt(e)&&(!n.has(e.source)||!n.has(e.target))||Xe(e)&&!n.has(e.labelTarget))},Xn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=pc(e);function s(f,p){return t.allowed("element.copy",{element:f,elements:p})}function c(f,p){var d=o.get(f);if(!d){var m={element:f,depth:p};r.push(m),o.set(f,m);return}if(d.depth<p){r=l(d,r);var h={element:d.element,depth:p};r.push(h),o.set(f,h)}}function l(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}no(a,function(f,p,d){if(Xe(f))return;H(f.labels,function(y){c(y,d)});function m(y){y&&y.length&&H(y,function(v){H(v.labels,function(g){c(g,d)}),c(v,d)})}H([f.attachers,f.incoming,f.outgoing],m),c(f,d);var h=[];return f.children&&(h=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:h}),h}),e=Pn(r,function(f){return f.element});var u=new Set(e);return r=Pn(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:u}),f}),r=Ai(r,function(f){return f.descriptor.priority}),e=Pn(r,function(f){return f.element}),H(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,u)){Gv(f.element,e),u.delete(f.element);return}if(!s(f.element,e)){Gv(f.element,e),u.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function wT(e){return!!e.host}function ET(e){return Pn(e.waypoints,function(t){return t=zv(t),t.original&&(t.original=zv(t.original)),t})}function zv(e){return W({},e)}function Gv(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const ST={__depends__:[VM,Jc,Za,$i],__init__:["copyPaste"],copyPaste:["type",Xn]};function Af(e,t,n){Le(n)||(n=[n]),H(n,function(i){Kr(e[i])||(t[i]=e[i])})}var Pf=750;function Vv(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",Pf,function(c){var l=c.descriptor,u=c.element,f=oe(u);if(Xe(u))return l;var p=l.businessObject=i(f,!0),d=l.di=i(ct(u),!0);d.bpmnElement=p,Af(p,l,"name"),Af(d,l,"isExpanded"),f.default&&(l.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,l){c[r]=l}function s(c,l,u){var f=oe(c);return c.default&&(u[c.default]={element:f,property:"default"}),c.host&&(oe(c).attachedToRef=oe(l[c.host])),Pi(u,Vn(u,function(p,d,m){var h=d.element,y=d.property;return m===c.id&&(h.set(y,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var l=c.cache,u=c.descriptor,f=u.businessObject,p=u.di;if(Xe(u)){u.businessObject=oe(l[u.labelTarget]),u.di=ct(l[u.labelTarget]);return}f=u.businessObject=i(f),p=u.di=i(p),p.bpmnElement=f,Af(u,f,["isExpanded","name"]),u.type=f.$type}),t.on("copyPaste.copyElement",Pf,function(c){var l=c.descriptor,u=c.element;if(S(u,"bpmn:Participant")){var f=oe(u);f.processRef&&(l.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var l=c.descriptor,u=l.processRef;u&&(l.processRef=i(u))}),t.on("copyPaste.createTree",function(c){var l=c.element,u=c.children;S(l,"bpmn:SubProcess")&&H($a(u),f=>{u.push(f.annotation)})}),t.on("copyPaste.pasteElement",Pf,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}Vv.$inject=["bpmnFactory","eventBus","moddleCopy"];const RT=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],CT=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Qa(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",i=>{const{propertyNames:r}=i;if(!(!r||!r.length))return Ai(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=un(r)&&r.$descriptor;if(a&&CT.includes(a))return o;if(a&&RT.includes(a)||a&&s&&!At(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})}Qa.$inject=["eventBus","bpmnFactory","moddle"],Qa.prototype.copyElement=function(e,t,n,i=!1){n&&!Le(n)&&(n=[n]),n=n||Mf(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Le(r)&&(n=r),H(n,o=>{let a;Gn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!rn(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Qa.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 un(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):Le(e)?Vn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):un(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},Qa.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 Mf(e,t){return Vn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Wv={__depends__:[ST],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Vv],moddleCopy:["type",Qa]};var Uv=Math.round;function Tf(e,t){this._modeling=e,this._eventBus=t}Tf.$inject=["modeling","eventBus"],Tf.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,l=Uv(s+o/2),u=Uv(c+a/2),f=i.replaceShape(e,W({},t,{x:l,y:u,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function Yv(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Yv.$inject=["selection","eventBus"];const AT={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Yv],replace:["type",Tf]};function PT(e,t,n){Le(n)||(n=[n]),H(n,function(i){Kr(e[i])||(t[i]=e[i])})}var MT=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function TT(e,t){var n=e&&Gn(e,"collapsed")?e.collapsed:!nt(e),i;return t&&(Gn(t,"collapsed")||Gn(t,"isExpanded"))?i=Gn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function qv(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,f=s.businessObject;if(el(f)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&TT(s,c))return i.toggleCollapse(s),s;var p=e.create(u),d={type:u,businessObject:p};d.di={},u==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),PT(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var m=Mf(f.$descriptor),h=Mf(p.$descriptor,!0),y=kT(m,h);W(p,Ei(c,MT));var v=Qe(y,function(_){return _==="eventDefinitions"?Kv(s,c.eventDefinitionType):_==="loopCharacteristics"?!On(p):Gn(p,_)||_==="processRef"&&c.isExpanded===!1||_==="triggeredByEvent"?!1:_==="isForCompensation"?!On(p):!0});if(p=n.copyElement(f,p,v),c.eventDefinitionType&&(Kv(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),S(f,"bpmn:Activity")){if(el(f))d.isExpanded=nt(s);else if(c&&Gn(c,"isExpanded")){d.isExpanded=c.isExpanded;var g=t.getDefaultSize(p,{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}nt(s)&&!S(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(el(f)&&!el(p)&&(l.moveChildren=!1),S(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var b=fn(s);ct(s).isHorizontal||(ct(d).isHorizontal=b),d.width=b?s.width:t.getDefaultSize(d).width,d.height=b?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,Ze(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Ze(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!S(f,"bpmn:BoundaryEvent")&&S(p,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...l,targetElement:c})}this.replaceElement=a}qv.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function el(e){return S(e,"bpmn:SubProcess")}function Kv(e,t){var n=oe(e);return t&&n.get("eventDefinitions").some(function(i){return S(i,t)})}function kT(e,t){return e.filter(function(n){return t.includes(n)})}const Xv={__depends__:[Wv,AT,mi],bpmnReplace:["type",qv]};var OT=250;function lo(e){this._eventBus=e,this._tools=[],this._active=null}lo.$inject=["eventBus"],lo.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)},lo.prototype.isActive=function(e){return e&&this._active===e},lo.prototype.length=function(e){return this._tools.length},lo.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},lo.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),H(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,OT,function(r){this._active&&(DT(r)||this.setActive(null))},this)};function DT(e){var t=e.originalEvent&&e.originalEvent.target;return t&&eo(t,'.group[data-group="tools"]')}const tl={__depends__:[rr],__init__:["toolManager"],toolManager:["type",lo]};function LT(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 IT(e,t){var n=[],i=new Set(e);H(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;H(a.concat(s),function(c){var l=c.source,u=c.target;(i.has(l)||i.has(u))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function BT(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 kf=Math.abs,NT=Math.round,or={x:"width",y:"height"},Zv="crosshair",kr={n:"top",w:"left",s:"bottom",e:"right"},$T=1500,nl={n:"s",w:"e",s:"n",e:"w"},il=20;function gi(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",$T,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&Jv(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,f=l.direction,p=l.movingShapes,d=l.resizingShapes,m=l.start;if(l.initialized){Jv(c);var h={x:0,y:0};h[u]=NT(c["d"+u]),s.makeSpace(p,d,h,f,m),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}gi.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],gi.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Zv,data:{context:{reactivate:n}},trapClick:!1})},gi.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Zv,data:{context:{}}})},gi.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},gi.prototype.init=function(e,t){var n=kf(e.dx)>kf(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(kf(i)<5)return!1;i<0&&(i*=-1),qa(e)&&(i*=-1);var o=LT(n,i),a=this._canvas.getRootElement();!Vc(e)&&e.hover&&(a=e.hover);var s=[...Oa(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),l=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),u=FT(c,n,o,r,l);return W(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),Qc("resize-"+(n==="x"?"ew":"ns")),!0},gi.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,l=[],u=[];function f(d){s.has(d)||(s.add(d),o.push(d));var m=d.label;m&&!s.has(m)&&(s.add(m),o.push(m))}function p(d){c.has(d)||(c.add(d),a.push(d))}return H(e,function(d){if(!(!d.parent||Xe(d))){if(wt(d)){u.push(d);return}var m=d[t],h=m+d[or[t]];if(jT(d)&&(n>0&&Ie(d)[t]>i||n<0&&Ie(d)[t]<i)){l.push(d);return}if(n>0&&m>i||n<0&&h<i){f(d);return}if(m<i&&h>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),H(o,function(d){var m=d.attachers;m&&H(m,function(h){f(h)})}),H(l,function(d){var m=d.host;(s.has(m)||c.has(m))&&f(d)}),H(u,function(d){var m=d.source,h=d.target,y=d.label;(s.has(m)||c.has(m))&&(s.has(h)||c.has(h))&&y&&f(y)}),{movingShapes:o,resizingShapes:a}},gi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},gi.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function Qv(e){return{top:e.top-il,right:e.right+il,bottom:e.bottom+il,left:e.left-il}}function Jv(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Fe(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Fe(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Fe(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Fe(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function FT(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,l,u=new Set(o),f=new Set(a);return H(a,function(p){var d=p.attachers,m=p.children,h=De(p),y=Qe(m,function(z){return!wt(z)&&!Xe(z)&&!u.has(z)&&!f.has(z)}),v=Qe(m,function(z){return!wt(z)&&!Xe(z)&&u.has(z)}),g,b,_,C=[],M=[],O,P,F,I;y.length&&(b=Qv(De(Zt(y))),g=i-h[kr[n]]+b[kr[n]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,g):g:n==="w"?s.right=l=Fe(l)?Math.min(l,g):g:n==="s"?s.top=c=Fe(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Fe(c)?Math.max(c,g):g)),v.length&&(_=Qv(De(Zt(v))),g=i-_[kr[nl[n]]]+h[kr[nl[n]]],n==="n"?s.bottom=l=Fe(l)?Math.min(l,g):g:n==="w"?s.right=l=Fe(l)?Math.min(l,g):g:n==="s"?s.top=c=Fe(c)?Math.max(c,g):g:n==="e"&&(s.left=c=Fe(c)?Math.max(c,g):g)),d&&d.length&&(d.forEach(function(z){u.has(z)?C.push(z):M.push(z)}),C.length&&(O=De(Zt(C.map(Ie))),P=h[kr[nl[n]]]-(O[kr[nl[n]]]-i)),M.length&&(F=De(Zt(M.map(Ie))),I=F[kr[n]]-(h[kr[n]]-i)),n==="n"?(g=Math.min(P||1/0,I||1/0),s.bottom=l=Fe(l)?Math.min(l,g):g):n==="w"?(g=Math.min(P||1/0,I||1/0),s.right=l=Fe(l)?Math.min(l,g):g):n==="s"?(g=Math.max(P||-1/0,I||-1/0),s.top=c=Fe(c)?Math.max(c,g):g):n==="e"&&(g=Math.max(P||-1/0,I||-1/0),s.left=c=Fe(c)?Math.max(c,g):g));var B=r&&r[p.id];B&&(n==="n"?(g=i+p[or[t]]-B[or[t]],s.bottom=l=Fe(l)?Math.min(l,g):g):n==="w"?(g=i+p[or[t]]-B[or[t]],s.right=l=Fe(l)?Math.min(l,g):g):n==="s"?(g=i-p[or[t]]+B[or[t]],s.top=c=Fe(c)?Math.max(c,g):g):n==="e"&&(g=i-p[or[t]]+B[or[t]],s.left=c=Fe(c)?Math.max(c,g):g))}),s}}function jT(e){return!!e.host}var Of="djs-dragging",eb="djs-resizing",HT=250,rl=Math.max;function tb(e,t,n,i,r){function o(a,s){H(a,function(c){r.addDragger(c,s),n.addMarker(c,Of)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,l={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},u=Te("g");Ee(u,i.cls("djs-crosshair-group",["no-events"])),We(s,u);var f=Te("path");Ee(f,"d",l.x),ot(f).add("djs-crosshair"),We(u,f);var p=Te("path");Ee(p,"d",l.y),ot(p).add("djs-crosshair"),We(u,p),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;_n(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&an(c)}),e.on("spaceTool.move",HT,function(a){var s=a.context,c=s.line,l=s.axis,u=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=Te("path"),Ee(c,"d","M0,0 L0,0"),ot(c).add("djs-crosshair"),We(p,c),s.line=c;var d=Te("g");Ee(d,i.cls("djs-drag-group",["no-events"])),We(n.getActiveLayer(),d),o(u,d);var m=new Set(u);H(f,function(M){m.add(M)});var h=new Set,y=s.movingConnections=[];m.forEach(function(M){H(M.outgoing,function(O){h.has(O)||!wt(O)||!m.has(O.target)||(h.add(O),y.push(O))})}),o(y,d),s.dragGroup=d}if(!s.frameGroup){var v=Te("g");Ee(v,i.cls("djs-frame-group",["no-events"])),We(n.getActiveLayer(),v);var g=[];H(f,function(M){var O=r.addFrame(M,v),P=O.getBBox();g.push({element:O,initialBounds:P}),n.addMarker(M,eb)}),s.frameGroup=v,s.frames=g}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Ee(c,{d:b[l]});var _={x:"y",y:"x"},C={x:a.dx,y:a.dy};C[_[s.axis]]=0,_n(s.dragGroup,C.x,C.y),H(s.frames,function(M){var O=M.element,P=M.initialBounds,F,I;s.direction==="e"?Ee(O,{width:rl(P.width+C.x,5)}):(F=rl(P.width-C.x,5),Ee(O,{width:F,x:P.x+P.width-F})),s.direction==="s"?Ee(O,{height:rl(P.height+C.y,5)}):(I=rl(P.height-C.y,5),Ee(O,{height:I,y:P.y+P.height-I}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,l=s.movingConnections,u=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;H(c,function(m){n.removeMarker(m,Of)}),H(l,function(m){n.removeMarker(m,Of)}),p&&(an(f),an(p)),H(u,function(m){n.removeMarker(m,eb)}),d&&an(d)})}tb.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const zT={__init__:["spaceToolPreview"],__depends__:[rr,$i,tl,ia,Za],spaceTool:["type",gi],spaceToolPreview:["type",tb]};function ol(e,t){e.invoke(gi,this),this._canvas=t}ol.$inject=["injector","canvas"],we(ol,gi),ol.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Ro(Fo(r.children.filter(l=>S(l,"bpmn:Artifact")),Zt(o))));const s=[...e,...a];var c=gi.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(S(l,"bpmn:TextAnnotation")||GT(l)&&(t==="y"&&fn(l)||t==="x"&&!fn(l)))}),c};function GT(e){return S(e,"bpmn:Participant")&&!oe(e).processRef}const nb={__depends__:[zT],spaceTool:["type",ol]};function jt(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)}jt.$inject=["eventBus","injector"],jt.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()},jt.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},jt.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},jt.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()}},jt.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()}},jt.prototype.register=function(e,t){this._setHandler(e,t)},jt.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)},jt.prototype.canUndo=function(){return!!this._getUndoAction()},jt.prototype.canRedo=function(){return!!this._getRedoAction()},jt.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},jt.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},jt.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)})},jt.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},jt.prototype._createId=function(){return this._uid++},jt.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},jt.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()},jt.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)},jt.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:ch("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},jt.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Le(e)?e:[e],t.dirty=t.dirty.concat(e))},jt.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},jt.prototype._revertedAction=function(e){this._stackIdx--},jt.prototype._getHandler=function(e){return this._handlerMap[e]},jt.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 VT={commandStack:["type",jt]};function Or(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 WT=250,ib=1400;function Df(e,t,n){ne.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",ib,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=rb(a),o.validatedShapes=rb(s)}),i&&t.on("shape.move.start",WT,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const l of c.labels)!l.hidden&&!a.has(l)&&s.add(l),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",ib,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];H(s,function(l){H(l.labels,function(u){s[u.id]||c.push(u)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;Or(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=pp(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&&(Yt(s.labels,a,c),a.labelTarget=s)})}we(Df,ne),Df.$inject=["injector","eventBus","modeling"];function rb(e){var t=new Set(e);return Qe(e,function(n){return!t.has(n.labelTarget)})}const UT={__init__:["labelSupport"],labelSupport:["type",Df]};var YT=251,ob=1401,ab="attach-ok";function Lf(e,t,n,i,r){ne.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",ob,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=qT(c),s.validatedShapes=KT(l)}),o&&t.on("shape.move.start",YT,function(a){var s=a.context,c=s.shapes,l=If(c);H(l,function(u){o.makeDraggable(s,u,!0),H(u.labels,function(f){o.makeDraggable(s,f,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var l=c[0],u=l.host;u&&(n.addMarker(u,ab),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,ab)}))}}),this.preExecuted("elements.move",ob,function(a){var s=a.context,c=s.closure,l=s.shapes,u=If(l);H(u,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,l=s.newHost,u;l&&c.length!==1||(l?u=c:u=Qe(c,function(f){var p=f.host;return XT(f)&&!ZT(c,p)}),H(u,function(f){r.updateAttachment(f,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;H(s,function(c){H(c.attachers,function(l){H(l.outgoing.slice(),function(u){var f=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});f||r.removeConnection(u)}),H(l.incoming.slice(),function(u){var f=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});f||r.removeConnection(u)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,l=s.host;l&&r.updateAttachment(c,l)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,l=s.newShape;Or(c.attachers,function(u){var f=i.allowed("elements.move",{target:l,shapes:[u]});f==="attach"?r.updateAttachment(u,l):r.removeShape(u)}),l.attachers.length&&H(l.attachers,function(u){var f=Sy(u,c,l);r.moveShape(u,f,u.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.oldBounds,u=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&H(f,function(d){var m=Sy(d,l,u);r.moveShape(d,m,d.parent),H(d.labels,function(h){r.moveShape(h,m,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;Or(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}we(Lf,ne),Lf.$inject=["injector","eventBus","canvas","rules","modeling"];function If(e){return bu(Pn(e,function(t){return t.attachers||[]}))}function qT(e){var t=If(e);return lE("id",e,t)}function KT(e){var t=Co(e,"id");return Qe(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function XT(e){return!!e.host}function ZT(e,t){return e.indexOf(t)!==-1}const QT={__depends__:[$i],__init__:["attachSupport"],attachSupport:["type",Lf]};function sb(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(Jm(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)})}sb.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Bf={__init__:["changeSupport"],changeSupport:["type",sb]};function yi(e){this._model=e}yi.$inject=["moddle"],yi.prototype._needsId=function(e){return Ze(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"])},yi.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":Ze(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))},yi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},yi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},yi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",W({bpmnElement:e,bounds:this.createDiBounds()},t))},yi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},yi.prototype.createDiWaypoints=function(e){var t=this;return Pn(e,function(n){return t.createDiWaypoint(n)})},yi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Ei(e,["x","y"]))},yi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",W({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},yi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",W({bpmnElement:e},t))};function Zn(e,t,n){ne.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var m=d.context,h=m.hints||{},y;!m.cropped&&h.createElementsBehavior!==!1&&(y=m.connection,y.waypoints=n.getCroppedWaypoints(y),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,y=m.parent||m.newParent;i.updateParent(h,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Qn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Qn(a));function s(d){var m=d.context,h=m.oldRoot,y=h.children;H(y,function(v){S(v,"bpmn:BaseElement")&&i.updateParent(v)})}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"],Qn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Qn(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 l(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Qn(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Qn(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Qn(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Qn(u)),this.executed("connection.reconnect",Qn(function(d){var m=d.context,h=m.connection,y=m.oldSource,v=m.newSource,g=oe(h),b=oe(y),_=oe(v);g.conditionExpression&&!Ze(_,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=g.conditionExpression,delete g.conditionExpression),y!==v&&b.default===g&&(m.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",Qn(function(d){var m=d.context,h=m.connection,y=m.oldSource,v=m.newSource,g=oe(h),b=oe(y),_=oe(v);m.oldConditionExpression&&(g.conditionExpression=m.oldConditionExpression),m.oldDefault&&(b.default=m.oldDefault,delete _.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Qn(f)),this.reverted(["element.updateAttachment"],Qn(f)),this.executed("element.updateLabel",Qn(p)),this.reverted("element.updateLabel",Qn(p));function p(d){const{element:m}=d.context,h=ci(m),y=ct(m),v=y&&y.get("label");Rr(m)||Wc(m)||(h&&!v?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&v&&y.set("label",void 0))}}we(Zn,ne),Zn.$inject=["eventBus","bpmnFactory","connectionDocking"],Zn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Zn.prototype.updateParent=function(e,t){if(!Xe(e)&&!(S(e,"bpmn:DataStoreReference")&&e.parent&&S(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=ct(e),o=n&&n.businessObject,a=ct(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)}},Zn.prototype.updateBounds=function(e){var t=ct(e),n=e2(e);if(n){var i=Ri(n,t.get("bounds"));W(n,{x:e.x+i.x,y:e.y+i.y})}var r=Xe(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),W(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Zn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;S(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Ut(i,e)),S(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Yt(r,e))}},Zn.prototype.updateDiConnection=function(e,t,n){var i=ct(e),r=ct(t),o=ct(n);i.sourceElement&&i.sourceElement.bpmnElement!==oe(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==oe(n)&&(i.targetElement=n&&o)},Zn.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):(Ut(n,e),e.$parent=null)}};function JT(e){for(;e&&!S(e,"bpmn:Definitions");)e=e.$parent;return e}Zn.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)},Zn.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=JT(e.$parent||t),e.$parent&&(Ut(o.get("rootElements"),r),r.$parent=null),t&&(Yt(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),Ut(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Ut(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Zn.prototype.updateConnectionWaypoints=function(e){var t=ct(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Zn.prototype.updateConnection=function(e){var t=e.connection,n=oe(t),i=t.source,r=oe(i),o=t.target,a=oe(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&&(Ut(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Ut(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)},Zn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Qn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;S(i,"bpmn:BaseElement")&&e(t)}}function e2(e){if(S(e,"bpmn:Activity")){var t=ct(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Dr(e,t){er.call(this),this._bpmnFactory=e,this._moddle=t}we(Dr,er),Dr.$inject=["bpmnFactory","moddle"],Dr.prototype._baseCreate=er.prototype.create,Dr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,W({type:"label",di:n},ro,t))}return this.createElement(e,t)},Dr.prototype.createElement=function(e,t){t=W({},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(!n2(r)){var o=W({},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=W({isFrame:!0},t)),t=t2(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Nf(r,t,"isExpanded")),Ze(i,["bpmn:Lane","bpmn:Participant"])&&(t=Nf(r,t,"isHorizontal")),S(i,"bpmn:SubProcess")&&(t.collapsed=!nt(i,r)),S(i,"bpmn:ExclusiveGateway")&&(Gn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),rn(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),rn(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=W({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},Dr.prototype.getDefaultSize=function(e,t){var n=oe(e);if(t=t||ct(e),S(n,"bpmn:SubProcess"))return nt(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 nt(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}},Dr.prototype.createParticipantShape=function(e){return un(e)||(e={isExpanded:e}),e=W({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function t2(e,t,n){return H(n,function(i){t=Nf(e,t,i)}),t}function Nf(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Pi(t,[n]))}function n2(e){return Ze(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function al(e,t){this._modeling=e,this._canvas=t}al.$inject=["modeling","canvas"],al.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;H(n,function(r){var o={x:0,y:0};rn(i.left)?o.x=i.left-r.x:rn(i.right)?o.x=i.right-r.width-r.x:rn(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:rn(i.top)?o.y=i.top-r.y:rn(i.bottom)?o.y=i.bottom-r.height-r.y:rn(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},al.prototype.postExecute=function(e){};function sl(e){this._modeling=e}sl.$inject=["modeling"],sl.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},sl.prototype.postExecute=function(e){var t=e.hints||{};i2(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 i2(e,t){return hr(e.outgoing,function(n){return n.target===t})}function cl(e,t){this._canvas=e,this._layouter=t}cl.$inject=["canvas","layouter"],cl.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},cl.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var ll=Math.round;function $f(e){this._modeling=e}$f.$inject=["modeling"],$f.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;H(t,function(f){Fe(f.x)||(f.x=0),Fe(f.y)||(f.y=0)});var s=Qe(t,function(f){return!f.hidden}),c=Zt(s);H(t,function(f){wt(f)&&(f.waypoints=Pn(f.waypoints,function(p){return{x:ll(p.x-c.x-c.width/2+r.x),y:ll(p.y-c.y-c.height/2+r.y)}})),W(f,{x:ll(f.x-c.x-c.width/2+r.x),y:ll(f.y-c.y-c.height/2+r.y)})});var l=new Set(pc(t)),u={};H(t,function(f){if(wt(f)){u[f.id]=Fe(i)?a.createConnection(u[f.source.id],u[f.target.id],i,f,f.parent||n,o):a.createConnection(u[f.source.id],u[f.target.id],f,f.parent||n,o);return}var p=W({},o);l.has(f)||(p.autoResize=!1),Xe(f)&&(p=Pi(p,["attach"])),u[f.id]=Fe(i)?a.createShape(f,Ei(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,Ei(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=Ro(u)};var cb=Math.round;function Lr(e){this._canvas=e}Lr.$inject=["canvas"],Lr.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?W(t,n):W(t,{x:n.x-cb(t.width/2),y:n.y-cb(t.height/2)}),this._canvas.addShape(t,i,r),t},Lr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Ja(e){Lr.call(this,e)}we(Ja,Lr),Ja.$inject=["canvas"];var r2=Lr.prototype.execute;Ja.prototype.execute=function(e){var t=e.shape;return a2(t),t.labelTarget=e.labelTarget,r2.call(this,e)};var o2=Lr.prototype.revert;Ja.prototype.revert=function(e){return e.shape.labelTarget=null,o2.call(this,e)};function a2(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function es(e,t){this._canvas=e,this._modeling=t}es.$inject=["canvas","modeling"],es.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;Or(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Or(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},es.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=pp(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},es.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Yt(n.children,t,i),this._canvas.addConnection(t,n),t};function Ff(e,t){this._modeling=e,this._elementRegistry=t}Ff.$inject=["modeling","elementRegistry"],Ff.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;H(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function ts(e,t){this._canvas=e,this._modeling=t}ts.$inject=["canvas","modeling"],ts.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Or(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),Or(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),Or(n.children,function(i){wt(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},ts.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=pp(i.children,n),t.removeShape(n),n},ts.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Yt(i.children,n,r),t.addShape(n,i),n};function ul(e){this._modeling=e}ul.$inject=["modeling"];var lb={x:"y",y:"x"};ul.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(y,v){y.range.min=Math.min(v[i],y.range.min),y.range.max=Math.max(v[i]+v[r],y.range.max)}function a(y){return y[i]+y[r]/2}function s(y){return y.length-1}function c(y){return y.max-y.min}function l(y,v){var g={y:0};g[i]=y-a(v),g[i]&&(g[lb[i]]=0,t.moveElements([v],g,v.parent))}var u=n[0],f=s(n),p=n[f],d,m,h=0;H(n,function(y,v){var g,b,_;if(y.elements.length<2){v&&v!==n.length-1&&(o(y,y.elements[0]),h+=c(y.range));return}g=Ai(y.elements,i),b=g[0],v===f&&(b=g[s(g)]),_=a(b),y.range=null,H(g,function(C){if(l(_,C),y.range===null){y.range={min:C[i],max:C[i]+C[r]};return}o(y,C)}),v&&v!==n.length-1&&(h+=c(y.range))}),m=Math.abs(p.range.min-u.range.max),d=Math.round((m-h)/(n.length-1)),!(d<n.length-1)&&H(n,function(y,v){var g={},b;y===u||y===p||(b=n[v-1],y.range.max=0,H(y.elements,function(_,C){g[lb[i]]=0,g[i]=b.range.max-_[i]+d,y.range.min!==_[i]&&(g[i]+=_[i]-y.range.min),g[i]&&t.moveElements([_],g,_.parent),y.range.max=Math.max(_[i]+_[r],C?y.range.max:0)}))})},ul.prototype.postExecute=function(e){};function pl(e,t){this._layouter=e,this._canvas=t}pl.$inject=["layouter","canvas"],pl.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return W(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},pl.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function jf(){}jf.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=Ut(o.children,t),Yt(i.children,t,r),t.parent=i,H(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},jf.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Ut(n.children,t),Yt(i.children,t,r),t.parent=i,H(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 Hf(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}Hf.prototype.add=function(e,t){return this.addAll([e],t)},Hf.prototype.addAll=function(e,t){var n=BR(e,!!t,this);return W(this,n),this};function ns(e){this._modeling=e}ns.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ns.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,l=e.topLevel,u=!1;r&&r.parent===n&&(u=!0),H(a,function(f){o.moveShape(f,t,l[f.id]&&!u&&n,{recurse:!1,layout:!1})}),H(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,l[f.id]&&!u&&n):o.layoutConnection(f,{connectionStart:p&&Yp(f,f.source,t),connectionEnd:d&&qp(f,f.target,t)})})},ns.prototype.getClosure=function(e){return new Hf().addAll(e,!0)};function fl(e){this._helper=new ns(e)}fl.$inject=["modeling"],fl.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},fl.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 uo(e){this._modeling=e,this._helper=new ns(e)}uo.$inject=["modeling"],uo.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=Ei(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Ut(o.children,t),Yt(i.children,t,r),W(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},uo.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(H(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:qp(o,t,n)})}),H(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:Yp(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},uo.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Yt(n.children,t,i),W(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},uo.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},uo.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function is(e){this._modeling=e}is.$inject=["modeling"],is.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return Le(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},is.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||ub(Le(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||ub(Le(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},is.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 ub(e){return e.original||e}function ar(e,t){this._modeling=e,this._rules=t}ar.$inject=["modeling","rules"],ar.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,y){return i.allowed("connection.reconnect",{connection:y,source:m,target:h})}var l={x:o.x,y:o.y},u={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,l,r.parent,a),r.host&&n.updateAttachment(s,r.host);var f;a.moveChildren!==!1&&(f=r.children.slice(),n.moveElements(f,{x:0,y:0},s,a));var p=r.incoming.slice(),d=r.outgoing.slice();H(p,function(m){var h=m.source,y=c(h,s,m);y&&t.reconnectEnd(m,s,Fc(m,s,u),a)}),H(d,function(m){var h=m.target,y=c(s,h,m);y&&t.reconnectStart(m,s,$c(m,s,u),a)})},ar.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},ar.prototype.execute=function(e){},ar.prototype.revert=function(e){},ar.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},ar.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},ar.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function rs(e){this._modeling=e}rs.$inject=["modeling"],rs.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},W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},rs.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(H(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Fc(o,n,i)})}),H(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:$c(o,n,i)})}))},rs.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return W(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function Ir(e){this._modeling=e}Ir.$inject=["modeling"],Ir.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),H(r,function(s){a[s.id]=c2(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(IT(i,r),t,n,o,i,r,a)},Ir.prototype.execute=function(){},Ir.prototype.revert=function(){},Ir.prototype.moveShapes=function(e,t){var n=this;H(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},Ir.prototype.resizeShapes=function(e,t,n){var i=this;H(e,function(r){var o=BT(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},Ir.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),l=new Set(o);H(e,function(u){var f=u.source,p=u.target,d=s2(u),m=fb(n),h={},y=c.has(f)||l.has(f),v=c.has(p)||l.has(p);y&&v?(d=Pn(d,function(g){return db(g,i,n)&&(g[m]=g[m]+t[m]),g.original&&db(g.original,i,n)&&(g.original[m]=g.original[m]+t[m]),g}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(y||v)&&(c.has(f)?h.connectionStart=Yp(u,f,t):c.has(p)?h.connectionEnd=qp(u,p,t):l.has(f)?h.connectionStart=$c(u,f,a[f.id]):l.has(p)&&(h.connectionEnd=Fc(u,p,a[p.id])),s._modeling.layoutConnection(u,h))})};function pb(e){return W({},e)}function s2(e){return Pn(e.waypoints,function(t){return t=pb(t),t.original&&(t.original=pb(t.original)),t})}function fb(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function db(e,t,n){var i=fb(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function c2(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function dl(e){this._modeling=e}dl.$inject=["modeling"],dl.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=hb(n),t.collapsed=!t.collapsed;var i=mb(n,t.collapsed);return[t].concat(i)},dl.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=gb(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function hb(e){var t={};return H(e,function(n){t[n.id]=n.hidden,n.children&&(t=W({},t,hb(n.children)))}),t}function mb(e,t){var n=[];return H(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(mb(i.children,i.collapsed||t)))}),n}function gb(e,t){var n=[];return H(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(gb(i.children,t)))}),n}function hl(e){this._modeling=e}hl.$inject=["modeling"],hl.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=yb(i,t),vb(n,t),t.host=n,t},hl.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,yb(n,t),vb(i,t,r),t};function yb(e,t){return Ut(e&&e.attachers,t)}function vb(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Yt(i,t,n)}}function zf(){}zf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},zf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function Et(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Et.$inject=["eventBus","elementFactory","commandStack"],Et.prototype.getHandlers=function(){return{"shape.append":sl,"shape.create":Lr,"shape.delete":ts,"shape.move":uo,"shape.resize":rs,"shape.replace":ar,"shape.toggleCollapse":dl,spaceTool:Ir,"label.create":Ja,"connection.create":cl,"connection.delete":es,"connection.move":jf,"connection.layout":pl,"connection.updateWaypoints":zf,"connection.reconnect":is,"elements.create":$f,"elements.move":fl,"elements.delete":Ff,"elements.distribute":ul,"elements.align":al,"element.updateAttachment":hl}},Et.prototype.registerHandlers=function(e){H(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Et.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)},Et.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Et.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)},Et.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)},Et.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Et.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},Et.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},Et.prototype.createElements=function(e,t,n,i,r){Le(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},Et.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},Et.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},Et.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Et.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Et.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Et.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Et.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Et.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Et.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Et.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)},Et.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Et.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)},Et.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,W(i,{docking:"source"}))},Et.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,W(i,{docking:"target"}))},Et.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Et.prototype._create=function(e,t){return _C(t)?t:this._elementFactory.create(e,t)},Et.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function os(e){this._elementRegistry=e}os.$inject=["elementRegistry"],os.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||l2(n,Bs(i));return bb(n,i),e.oldProperties=o,e.changed=r,r},os.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return bb(n,t),i},os.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return S(e,"bpmn:DataObject")?u2(e,t):[]};function l2(e,t){return Vn(t,function(n,i){return n[i]=e.get(i),n},{})}function bb(e,t){H(t,function(n,i){e.set(i,n)})}function u2(e,t){return t.filter(function(n){return S(n,"bpmn:DataObjectReference")&&oe(n).dataObjectRef===e})}var as="default",sr="id",xb="di",p2={width:0,height:0};function ss(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}ss.$inject=["elementRegistry","moddle","modeling","textRenderer"],ss.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=g2(e.properties),s=e.oldProperties||f2(t,a);return _b(a,o)&&(r.unclaim(o[sr]),i.updateId(t,a[sr]),r.claim(a[sr],o)),as in a&&(a[as]&&n.push(i.get(a[as].id)),o[as]&&n.push(i.get(o[as].id))),wb(t,a),e.oldProperties=s,e.changed=n,n},ss.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&oe(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,p2)}},ss.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 wb(t,i),_b(n,r)&&(a.unclaim(n[sr]),o.updateId(t,i[sr]),a.claim(i[sr],r)),e.changed};function _b(e,t){return sr in e&&e[sr]!==t[sr]}function f2(e,t){var n=Bs(t),i=e.businessObject,r=ct(e);return Vn(n,function(o,a){return a!==xb?o[a]=i.get(a):o[a]=d2(r,Bs(t.di)),o},{})}function d2(e,t){return Vn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function wb(e,t){var n=e.businessObject,i=ct(e);H(t,function(r,o){o!==xb?n.set(o,r):i&&h2(i,r)})}function h2(e,t){H(t,function(n,i){e.set(i,n)})}var m2=["default"];function g2(e){var t=W({},e);return m2.forEach(function(n){n in e&&(t[n]=oe(t[n]))}),t}function ml(e,t){this._canvas=e,this._modeling=t}ml.$inject=["canvas","modeling"],ml.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=ct(r);return t.setRootElement(n),t.removeRootElement(r),Yt(a.rootElements,i),i.$parent=a,Ut(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},ml.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=ct(n);return t.setRootElement(r),t.removeRootElement(n),Ut(a.rootElements,i),i.$parent=null,Yt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function Gf(e,t){this._modeling=e,this._spaceTool=t}Gf.$inject=["modeling","spaceTool"],Gf.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=di(i),a=o===i,s=a?i:i.parent,c=Ar(s),l=fn(i);if(l?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var u=l?{x:i.x+fi,y:i.y,width:i.width-fi,height:i.height}:{x:i.x,y:i.y+fi,width:i.width,height:i.height-fi};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var f=[];no(o,function(_){return f.push(_),_.label&&f.push(_.label),_===i?[]:Qe(_.children,function(C){return C!==i})});var p,d,m,h,y;r==="top"?(p=-120,d=i.y,m=d+10,h="n",y="y"):r==="left"?(p=-120,d=i.x,m=d+10,h="w",y="x"):r==="bottom"?(p=120,d=i.y+i.height,m=d-10,h="s",y="y"):r==="right"&&(p=120,d=i.x+i.width,m=d-10,h="e",y="x");var v=t.calculateAdjustments(f,y,p,m),g=l?{x:0,y:p}:{x:p,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,g,h,m);var b=l?{x:i.x+(a?fi:0),y:d-(r==="top"?120:0),width:i.width-(a?fi:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?fi:0),width:120,height:i.height-(a?fi:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},b,s)};function Vf(e){this._modeling=e}Vf.$inject=["modeling"],Vf.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Ar(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=fn(n),s=a?n.height:n.width,c=Math.round(s/i),l,u,f,p;for(p=0;p<i;p++)p===i-1?l=s-c*p:l=c,u=a?{x:n.x+fi,y:n.y+p*c,width:n.width-fi,height:l}:{x:n.x+p*c,y:n.y+fi,width:l,height:n.height-fi},p<o?t.resizeShape(r[p],u):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,u,n))};function cs(e,t){this._modeling=e,this._spaceTool=t}cs.$inject=["modeling","spaceTool"],cs.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},cs.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=uP(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},cs.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=De(e),r=De(t),o=ey(r,i),a=di(e),s=[],c=[];no(a,function(m){return s.push(m),(S(m,"bpmn:Lane")||S(m,"bpmn:Participant"))&&c.push(m),m.children});var l,u,f,p,d;(o.bottom||o.top)&&(l=o.bottom||o.top,u=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-l:l,d=n.calculateAdjustments(s,"y",p,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:l},f)),(o.left||o.right)&&(l=o.right||o.left,u=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-l:l,d=n.calculateAdjustments(c,"x",p,u),n.makeSpace(d.movingShapes,d.resizingShapes,{x:l,y:0},f))};var ls="flowNodeRef",Wf="lanes";function gl(){}gl.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,f){var p=De(f),d={x:u.x+u.width/2,y:u.y+u.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(u){n.indexOf(u)===-1&&(o.push(u),n.push(u))}function c(u){var f=di(u);return r[f.id]||(r[f.id]=Dc(f)),r[f.id]}function l(u){if(!u.parent)return[];var f=c(u);return f.filter(function(p){return a(u,p)}).map(function(p){return p.businessObject})}return t.forEach(function(u){var f=di(u);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return S(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(u){var f=u.businessObject,p=f.get(Wf),d=p.slice(),m=l(u);i.push({flowNode:f,remove:d,add:m})}),t.forEach(function(u){var f=u.businessObject;u.parent||f.get(ls).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},gl.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(Wf);n.remove.forEach(function(o){Ut(r,o),Ut(o.get(ls),i)}),n.add.forEach(function(o){Yt(r,o),Yt(o.get(ls),i)})}),[]},gl.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(Wf);n.add.forEach(function(o){Ut(r,o),Ut(o.get(ls),i)}),n.remove.forEach(function(o){Yt(r,o),Yt(o.get(ls),i)})}),[]};var Uf="categoryValueRef";function us(e,t){this._bpmnFactory=e,this._elementRegistry=t}us.$inject=["bpmnFactory","elementRegistry"],us.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(g,b,_){if(b){var C=a.get(g);C||(C={},a.set(g,C)),!(_&&C.present)&&(!_&&C.past||(_?C.present={categoryValue:b,root:Yf(g)}:C.past={categoryValue:b}))}}function c(g){r.set(g,oe(g))}function l(){n.filter(function(g){return S(g,"bpmn:FlowElement")&&!Xe(g)&&g.parent}).forEach(c)}function u(g){var b=oe(g),_=b.get("categoryValueRef");return _||(_=Kg(i,b),o.push(y2(g,_))),_}function f(g){return g.reduce(function(b,_){var C=Yf(_),M=b.get(C);return M||(M=[],b.set(C,M)),M.push(_),b},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&l(),e.forEach(c),n.filter(function(g){return S(g,"bpmn:Group")&&!Xe(g)&&g.parent}).forEach(function(g){var b=oe(g).get("categoryValueRef");if(!b){var _=Yf(g),C=p.get(_)||[],M=Fo(C,g),O=Object.keys(M).length>0;O&&(b=u(g))}s(g,b,!0)}),t.forEach(function(g){s(g.groupShape,g.categoryValue,!1)}),o.length&&l();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,y=f(d);a.forEach(function(g,b){var _=g.present;if(_){var C=y.get(_.root)||[],M=Fo(C,b);C.forEach(function(O){if(M[O.id]){var P=h.get(O);P||(P=new Set,h.set(O,P)),P.add(_.categoryValue)}})}});var v=d.reduce(function(g,b){var _=r.get(b),C=_.get(Uf),M=new Set(C),O=h.get(b)||new Set,P=Array.from(O).filter(function(I){return!M.has(I)}),F=C.filter(function(I){return m.has(I)&&!O.has(I)});return(P.length||F.length)&&g.push({businessObject:_,categoryValuesToAdd:P,categoryValuesToRemove:F}),g},[]);return{flowElements:v,groups:o}},us.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),v2(t.groups),x2(t.flowElements),[]},us.prototype.revert=function(e){var t=e.updates;return _2(t.flowElements),b2(t.groups),[]};function y2(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function v2(e){e.forEach(function(t){oe(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function b2(e){e.forEach(function(t){oe(t.groupShape).categoryValueRef=null})}function x2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Uf);t.categoryValuesToRemove.forEach(function(r){Ut(i,r)}),t.categoryValuesToAdd.forEach(function(r){Yt(i,r,!0)})})}function _2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(Uf);t.categoryValuesToAdd.forEach(function(r){Ut(i,r)}),t.categoryValuesToRemove.forEach(function(r){Yt(i,r,!0)})})}function Yf(e){for(;e.parent;)e=e.parent;return e}function yl(e){this._moddle=e}yl.$inject=["moddle"],yl.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),[]},yl.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 w2={fill:void 0,stroke:void 0};function qf(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(zn(t)){var n=E2(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}qf.$inject=["commandStack"],qf.prototype.postExecute=function(e){var t=e.elements,n=e.colors||w2,i=this,r={};"fill"in n&&W(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&W(r,{"border-color":this._normalizeColor(n.stroke)}),H(t,function(o){var a=wt(o)?Ei(r,["border-color"]):r,s=ct(o);if(S2(a),Xe(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(!Ze(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function E2(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 S2(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var R2={width:0,height:0};function Eb(e,t,n){function i(c,l){var u=c.label||c,f=c.labelTarget||c;return JC(u,l),[u,f]}function r(c){var l=c.element,u=l.businessObject,f=c.newLabel;if(!Xe(l)&&Rr(l)&&!xc(l)&&!Sb(f)){var p=7,d=yp(l);d={x:d.x,y:d.y+p},e.createLabel(l,d,{id:u.id+"_label",businessObject:u,di:l.di})}}function o(c){return c.oldLabel=ci(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var l=c.element,u=l.label||l,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!Xe(u)&&!S(u,"bpmn:TextAnnotation"))){if(Xe(u)&&Sb(f)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var m=ci(l);typeof p>"u"&&(p=t.getExternalLabelBounds(u,m)),p&&e.resizeShape(u,p,R2)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Eb.$inject=["modeling","textRenderer","bpmnFactory"];function Sb(e){return!e||!e.trim()}function En(e,t,n,i){Et.call(this,e,t,n),this._bpmnRules=i}we(En,Et),En.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],En.prototype.getHandlers=function(){var e=Et.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=os,e["element.updateProperties"]=ss,e["canvas.updateRoot"]=ml,e["lane.add"]=Gf,e["lane.resize"]=cs,e["lane.split"]=Vf,e["lane.updateRefs"]=gl,e["group.updateRefs"]=us,e["id.updateClaim"]=yl,e["element.setColor"]=qf,e["element.updateLabel"]=Eb,e},En.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},En.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)},En.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},En.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},En.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},En.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},En.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},En.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},En.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},En.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},En.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},En.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},En.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},En.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Rb(){}Rb.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Ie(t.source||e.source),t.connectionEnd||Ie(t.target||e.target)]};var vl=20,C2=5,bl=Math.round,Cb=20,A2={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function P2(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function M2(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Ab(e,t,n){var i=xn(t,e,C2),r=n.split(":")[0],o=bl((t.x-e.x)/2+e.x),a=bl((t.y-e.y)/2+e.y),s,c,l=M2(r,i),u=/h|r|l/.test(r),f=!1,p=!1;return l?(s=u?{x:o,y:e.y}:{x:e.x,y:a},c=u?"h:h":"v:v"):(f=P2(i,r),c=u?"h:v":"v:h",f?u?(p=a===e.y,s={x:e.x+vl*(/l/.test(r)?-1:1),y:p?a+vl:a}):(p=o===e.x,s={x:p?o+vl:o,y:e.y+vl*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:Kf(e,s,c).concat(s),directions:c,turnNextDirections:p}}function T2(e,t,n){return Ab(e,t,n)}function k2(e,t,n){var i=Ab(t,e,Pb(n));return{waypoints:i.waypoints.slice().reverse(),directions:Pb(i.directions),turnNextDirections:i.turnNextDirections}}function O2(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=Kf(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Pb(e){return e.split(":").reverse().join(":")}function D2(e,t,n){var i=bl((t.x-e.x)/2+e.x),r=bl((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 Kf(e,t,n){if(n=n||"h:h",!z2(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Tb(n)){var i=T2(e,t,n),r=k2(e,t,n),o=O2(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return D2(e,t,n)}function L2(e,t,n){var i=Kf(e,t,n);return i.unshift(e),i.push(t),Ob(i)}function I2(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=sE(o,"straight")[0]||"h:h",s=A2[a]||0,c=xn(e,t,s),l=H2(c,a);n=n||Ie(e),i=i||Ie(t);var u=l.split(":"),f=kb(n,e,u[0],G2(c)),p=kb(i,t,u[1],c);return L2(f,p,l)}function B2(e,t,n,i,r,o){Le(n)&&(r=n,o=i,n=Ie(e),i=Ie(t)),o=W({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&$2(e,t,n,i,o),c||(c=o.connectionEnd&&j2(t,e,i,r),c)||(c=o.connectionStart&&F2(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:I2(e,t,n,i,o)}function N2(e,t,n){return e>=t&&e<=n}function Mb(e,t,n){var i={x:"width",y:"height"};return N2(t[e],n[e],n[e]+n[i[e]])}function $2(e,t,n,i,r){var o={},a,s;return s=xn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Mb(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:Mb(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 F2(e,t,n,i){return Xf(e,t,n,i)}function j2(e,t,n,i){var r=i.slice().reverse();return r=Xf(e,t,n,r),r?r.reverse():null}function Xf(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!At(u,function(f,p){var d=u[p-1];return d&&La(f,d)<3})}function o(u,f,p){var d=Qi(f,u);switch(d){case"v":return{x:p.x,y:u.y};case"h":return{x:u.x,y:p.y}}return{x:u.x,y:u.y}}function a(u,f,p){var d;for(d=u.length-2;d!==0;d--)if(tg(u[d],f,Cb)||tg(u[d],p,Cb))return u.slice(d);return u}if(r(i))return null;var s=i[0],c=i.slice(),l;return c[0]=n,c[1]=o(c[1],s,n),l=a(c,e,t),l!==c&&(c=Xf(e,t,n,l)),c&&Qi(c)?null:c}function H2(e,t){if(Tb(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 z2(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Tb(e){return e&&/t|r|b|l/.test(e)}function G2(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 kb(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 Ob(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return fp(r,o,n,0)||t.push(n),t},[])}var V2=-10,W2=40,U2={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},Y2={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},Zf={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},ps={top:"t",right:"r",bottom:"b",left:"l"};function xl(e){this._elementRegistry=e}we(xl,Rb),xl.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,l;if(o||(o=Db(r&&r[0],n)),a||(a=Db(r&&r[r.length-1],i)),(S(e,"bpmn:Association")||S(e,"bpmn:DataAssociation"))&&r&&!Lb(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=Wg(n,s)?U2:Y2;return S(e,"bpmn:MessageFlow")?c=K2(n,i,u):(S(e,"bpmn:SequenceFlow")||Lb(n,i))&&(n===i?c={preferredLayouts:tk(n,e,u)}:S(n,"bpmn:BoundaryEvent")?c={preferredLayouts:nk(n,i,a,u)}:fs(n)||fs(i)?c={preferredLayouts:u.subProcess,preserveDocking:Z2(n)}:S(n,"bpmn:Gateway")?c={preferredLayouts:u.fromGateway}:S(i,"bpmn:Gateway")?c={preferredLayouts:u.toGateway}:c={preferredLayouts:u.default}),c&&(c=W(c,t),l=Ob(B2(n,i,o,a,r,c))),l||[o,a]};function q2(e){var t=e.host;return xn(Ie(e),t,V2)}function K2(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:X2(e,t)}}function X2(e,t){return S(t,"bpmn:Participant")?"source":S(e,"bpmn:Participant")?"target":fs(t)?"source":fs(e)||S(t,"bpmn:Event")?"target":S(e,"bpmn:Event")?"source":null}function Z2(e){return fs(e)?"target":"source"}function Db(e,t){return e?e.original||e:Ie(t)}function Lb(e,t){return S(t,"bpmn:Activity")&&S(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function fs(e){return S(e,"bpmn:SubProcess")&&nt(e)}function po(e,t){return e===t}function Q2(e,t){return t.indexOf(e)!==-1}function ra(e){var t=/right|left/.exec(e);return t&&t[0]}function oa(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Ib(e,t){return Zf[e]===t}function J2(e,t){var n=ra(e),i=Zf[n];return t.indexOf(i)!==-1}function ek(e,t){var n=oa(e),i=Zf[n];return t.indexOf(i)!==-1}function Bb(e){return e==="right"||e==="left"}function tk(e,t,n){var i=t.waypoints,r=i&&i.length&&xn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function nk(e,t,n,i){var r=Ie(e),o=Ie(t),a=q2(e),s,c,l=po(e.host,t),u=Q2(a,["top","right","bottom","left"]),f=xn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?ik(a,u,e,t,n,i):(s=rk(a,f,u,i.isHorizontal),c=ok(a,f,u,i.isHorizontal),[s+":"+c])}function ik(e,t,n,i,r,o){var a=t?e:o.isHorizontal?oa(e):ra(e),s=ps[a],c;return t?Bb(e)?c=Nb("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Nb("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Nb(e,t,n,i){var r=W2;return!(Qf(e,i,n,r)||Qf(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Qf(e,i,Ie(t),r))}function Qf(e,t,n,i){return Math.abs(t[e]-n[e])<i}function rk(e,t,n,i){if(n)return ps[e];var r=oa(e),o=ra(e),a=oa(t),s=ra(t);if(i){if(po(r,a)||Ib(o,s))return ps[r]}else if(po(o,s)||Ib(r,a))return ps[o];return ps[i?o:r]}function ok(e,t,n,i){if(n)return Bb(e)?J2(e,t)||po(e,t)?"h":"v":ek(e,t)||po(e,t)?"v":"h";var r=oa(e),o=ra(e),a=oa(t),s=ra(t);return a&&!s?"v":s&&!a?"h":i?po(r,a)?"h":"v":po(o,s)?"v":"h"}xl.$inject=["elementRegistry"];function $b(e){return W({original:e.point.original||e.point},e.actual)}function Br(e,t){this._elementRegistry=e,this._graphicsFactory=t}Br.$inject=["elementRegistry","graphicsFactory"],Br.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($b(i)),o.push($b(r)),o},Br.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}},Br.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Ia(i,r,n)},Br.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Br.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Br.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const Jf={__init__:["modeling","bpmnUpdater"],__depends__:[SM,jM,zM,GM,Xv,VT,UT,QT,mi,Bf,nb],bpmnFactory:["type",yi],bpmnUpdater:["type",Zn],elementFactory:["type",Dr],modeling:["type",En],layouter:["type",xl],connectionDocking:["type",Br]};var ak=10,Fb=50,sk=250;function ed(e,t,n,i){for(var r;r=ck(e,n,t);)n=i(t,n,r);return n}function td(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,l=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-l+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+l+c)}}),r}}function ck(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=uk(e);return At(r,function(o){if(o===n)return!1;var a=xn(o,i,ak);return a==="intersect"})}function lk(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||Fb,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||sk,c=t.reference||"start";o||(o=dk);function l(m,h){return r==="n"?c==="start"?De(m).top-De(h).bottom:c==="center"?De(m).top-Ie(h).y:De(m).top-De(h).top:r==="w"?c==="start"?De(m).left-De(h).right:c==="center"?De(m).left-Ie(h).x:De(m).left-De(h).left:r==="s"?c==="start"?De(h).top-De(m).bottom:c==="center"?Ie(h).y-De(m).bottom:De(h).bottom-De(m).bottom:c==="start"?De(h).left-De(m).right:c==="center"?Ie(h).x-De(m).right:De(h).right-De(m).right}var u=e.incoming.filter(o).map(function(m){var h=a(m),y=h<0?l(m.source,e):l(e,m.source);return{id:m.source.id,distance:y,weight:h}}),f=e.outgoing.filter(o).map(function(m){var h=a(m),y=h>0?l(e,m.target):l(m.target,e);return{id:m.target.id,distance:y,weight:h}}),p=u.concat(f).reduce(function(m,h){return m[h.id+"__weight_"+h.weight]=h,m},{}),d=Vn(p,function(m,h){var y=h.distance,v=h.weight;return y<0||y>s||(m[String(y)]||(m[String(y)]=0),m[String(y)]+=1*v,(!m.distance||m[m.distance]<m[String(y)])&&(m.distance=y)),m},{});return d.distance||i}function uk(e){var t=nd(e);return e.host&&(t=t.concat(nd(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(nd(i))},[]))),t}function nd(e){return fk(e).concat(pk(e))}function pk(e){return e.incoming.map(function(t){return t.source})}function fk(e){return e.outgoing.map(function(t){return t.target})}function dk(){return!0}var hk=100;function jb(e,t,n){e.on("autoPlace",hk,function(i){var r=i.shape,o=i.source;return mk(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}}jb.$inject=["eventBus","modeling","canvas"];function mk(e,t,n){n||(n={});var i=n.defaultDistance||Fb,r=Ie(e),o=De(e);return{x:o.right+i+t.width/2,y:r.y}}function Hb(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Hb.$inject=["eventBus","selection"];const gk={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",jb],autoPlaceSelectionBehavior:["type",Hb]};function zb(e,t,n){var i=Wg(e,n);if(S(t,"bpmn:TextAnnotation"))return vk(e,t,i);if(Ze(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return bk(e,t,i);if(S(t,"bpmn:FlowNode"))return yk(e,t,i)}function yk(e,t,n){var i=De(e),r=Ie(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=lk(e,{filter:function(d){return S(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,l=o.baseOrientation;S(e,"bpmn:BoundaryEvent")&&(l=xn(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+Gb(l,c,o)}:{x:r.x+Gb(l,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return ed(e,t,u,td(p))}function Gb(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function vk(e,t,n){var i=De(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};wt(e)&&(r=Ie(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 ed(e,t,r,td(a))}function bk(e,t,n){var i=De(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 ed(e,t,r,td(a))}function Vb(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return zb(r,i,t)})}Vb.$inject=["eventBus","elementRegistry"];const _l={__depends__:[gk],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Vb]},Wb=[Gg,Ha,Jf,_l];function xk(e={}){Th(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new zo({container:t,moddleExtensions:e.moddleExtensions??Gs,additionalModules:[...Wb,...e.additionalModules??[]]})}const Ub={"edge-crosses-shape":"연결","edge-crosses-subprocess":"연결","edge-endpoint-detached":"연결","edge-overlap-opposite":"겹침","edge-overlap-mixed":"겹침","edge-overlap-unrelated":"겹침","shape-overlap":"겹침","shape-outside-container":"소속","label-on-shared-segment":"라벨","label-over-line":"라벨","annotation-over-label":"라벨","pool-name-over-label":"라벨","group-overlap-unintended":"그룹","group-overlap-unreadable":"그룹","group-stack-unreadable":"그룹","group-on-container-boundary":"그룹","group-on-group-boundary":"그룹","group-cuts-shape":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},_k={이:["이","가"],을:["을","를"],와:["과","와"]};function wk(e,t){const[n,i]=_k[t],r=e.at(-1)??"",o=r.charCodeAt(0);return o>=44032&&o<=55203?e+((o-44032)%28===0?i:n):r>="0"&&r<="9"?e+("013678".includes(r)?n:i):e+`${n}(${i})`}const Ek={"bpmn:StartEvent":"시작 이벤트","bpmn:EndEvent":"종료 이벤트","bpmn:IntermediateCatchEvent":"중간 이벤트","bpmn:IntermediateThrowEvent":"중간 이벤트","bpmn:BoundaryEvent":"경계 이벤트","bpmn:Task":"작업","bpmn:UserTask":"작업","bpmn:ServiceTask":"작업","bpmn:SendTask":"작업","bpmn:ReceiveTask":"작업","bpmn:ManualTask":"작업","bpmn:ScriptTask":"작업","bpmn:BusinessRuleTask":"작업","bpmn:CallActivity":"작업","bpmn:SubProcess":"서브프로세스","bpmn:ExclusiveGateway":"게이트웨이","bpmn:ParallelGateway":"게이트웨이","bpmn:InclusiveGateway":"게이트웨이","bpmn:EventBasedGateway":"게이트웨이","bpmn:ComplexGateway":"게이트웨이","bpmn:Participant":"풀","bpmn:Lane":"레인","bpmn:TextAnnotation":"주석","bpmn:Group":"그룹","bpmn:DataStoreReference":"데이터 저장소","bpmn:DataObjectReference":"데이터 객체","bpmn:SequenceFlow":"연결선","bpmn:MessageFlow":"메시지 연결선","bpmn:Association":"연관선"},Sk="요소";function id(e){return(e&&Ek[e.type])??Sk}const Yb=20;function Rk(e){const t=e.replace(/\s+/g," ").trim();return t.length>Yb?`${t.slice(0,Yb)}…`:t}function wl(e,t,n,i=""){const r=e(t),o=(r==null?void 0:r.name)===void 0?void 0:Rk(r.name),a=o===void 0?i+id(r):o,s=o===void 0?a:`「${o}」`;return n?s+wk(a,n).slice(a.length):s}function Ck(e,t,n,i,r){const[o,a]=[e(t),e(n)],s=(o==null?void 0:o.name)===void 0&&(a==null?void 0:a.name)===void 0&&id(o)===id(a);return[wl(e,t,i),wl(e,n,r,s?"다른 ":"")]}function Ak(e){switch(e.kind){case"shape-overlap":return e.identical?"error":"warning";case"shape-outside-container":return"error";case"edge-endpoint-detached":return"error";case"pool-overlap":return e.contained?"error":"warning";case"group-cuts-shape":return"error";default:return"warning"}}function Pk(e){switch(e.kind){case"edge-crosses-shape":return[e.edge,e.shape];case"edge-crosses-subprocess":return[e.edge,e.subProcess];case"edge-endpoint-detached":return[e.edge,e.shape];case"shape-overlap":return[...e.shapes];case"shape-outside-container":return[e.shape,e.container];case"edge-overlap-opposite":case"edge-overlap-mixed":case"edge-overlap-unrelated":return[...e.edges];case"label-on-shared-segment":return[e.edge,e.other];case"label-over-line":return[e.edge,e.line];case"annotation-over-label":return[e.annotation,e.label];case"group-overlap-unintended":return e.container?[e.container,...e.groups.filter(t=>t!==e.container)]:[...e.groups];case"group-overlap-unreadable":return e.reason==="orphan"?[...e.groups,...e.shapes]:[e.group,...e.shapes];case"group-stack-unreadable":return[...e.groups,...e.shapes];case"group-on-container-boundary":return[e.group,e.container];case"group-on-group-boundary":return[...e.groups];case"group-cuts-shape":return[e.group,e.shape];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const qb={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function Mk(e,t){const n=(r,o)=>wl(t,r,o),i=(r,o,a,s)=>Ck(t,r,o,a,s);switch(e.kind){case"edge-crosses-shape":return`${n(e.edge,"이")} ${n(e.shape,"을")} 가로지릅니다.`;case"edge-crosses-subprocess":return`${n(e.edge,"이")} 서브프로세스 ${n(e.subProcess)} 안을 지나갑니다.`;case"edge-endpoint-detached":return`${n(e.edge)}의 끝이 ${n(e.shape)}에서 ${Math.round(e.distance)}px 떨어져 연결이 끊겨 보입니다.`;case"shape-overlap":{const[r,o]=i(e.shapes[0],e.shapes[1],"와","이");return e.identical?`${r} ${o} 완전히 같은 자리에 겹쳐 하나가 가려집니다.`:`${r} ${o} 겹칩니다.`}case"shape-outside-container":return`${n(e.shape,"이")} ${n(e.container)} 경계 밖에 놓여 다른 소속으로 읽힙니다.`;case"edge-overlap-opposite":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 같은 선 위를 ${Math.round(e.length)}px 서로 반대 방향으로 흐릅니다.`}case"edge-overlap-mixed":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} 종류가 다른 선인데 ${Math.round(e.length)}px 겹쳐 흐릅니다.`}case"edge-overlap-unrelated":{const[r,o]=i(e.edges[0],e.edges[1],"와","이");return`${r} ${o} ${Math.round(e.length)}px 한 선처럼 겹쳐 흐르는데 만나는 지점이 없습니다.`}case"label-on-shared-segment":{const[r,o]=i(e.edge,e.other,void 0,"와");return`${r}의 라벨이 ${o} 공유하는 구간 위에 있어 어느 선의 것인지 모호합니다.`}case"label-over-line":return`${n(e.edge)}의 라벨을 선이 가로지릅니다.`;case"annotation-over-label":return`주석 ${n(e.annotation,"이")} ${n(e.label)}의 이름 라벨을 덮습니다.`;case"group-overlap-unintended":{if(e.container)return`${n(e.container,"이")} 다른 그룹을 통째로 덮습니다.`;const[r,o]=i(e.groups[0],e.groups[1],"와","이");return`${r} ${o} 공유 멤버 없이 겹쳐 의도인지 알 수 없습니다.`}case"group-overlap-unreadable":switch(e.reason){case"orphan":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 겹친 영역에 어느 그룹에도 속하지 않은 요소가 ${e.shapes.length}개 있습니다.`}case"minority":return`${n(e.group)} 상자 안에서 자기 멤버가 과반이 아닙니다(다른 요소 ${e.shapes.length}개).`;case"throughpass":return`${n(e.group)} 상자를 자기 멤버가 아닌 요소 ${e.shapes.length}개가 지나갑니다.`}case"group-stack-unreadable":return`그룹 ${e.groups.length}개가 겹쳐 쌓여 요소 ${e.shapes.length}개가 어느 단계인지 읽히지 않습니다.`;case"group-on-container-boundary":return`${n(e.group)} 테두리가 ${n(e.container)}의 ${qb[e.side]} 경계선과 겹쳐 흐릅니다.`;case"group-on-group-boundary":{const[r,o]=i(e.groups[0],e.groups[1],"와");return`${r} ${o}의 테두리가 같은 선 위에 겹칩니다.`}case"group-cuts-shape":return`${n(e.group)} 테두리가 ${n(e.shape)}의 ${qb[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"pool-name-over-label":return`${n(e.pool)}의 이름 밴드가 ${n(e.label)}의 라벨을 덮습니다.`;case"pool-overlap":{const[r,o]=i(e.pools[0],e.pools[1],"와","이");return e.contained?`${r} ${o} 중 하나가 다른 하나 안에 들어가 있습니다.`:`${r} ${o} 겹칩니다.`}}}function Tk(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${wl(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const Kb="기타",rd={error:0,warning:1,info:2};function Xb(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${Tt(i)}`,source:"geometry",code:i.kind,severity:Ak(i),targetRefs:Pk(i),category:Ub[i.kind]??Kb,message:Mk(i,t)});for(const i of e.semantic)n.push({key:`s:${i.ruleId}|${i.targetRefs.join(",")}`,source:"semantic",code:i.ruleId,severity:i.severity,targetRefs:[...i.targetRefs],category:Ub[i.ruleId]??Kb,message:Tk(i,t)});return n}function Zb(e){const t={error:0,warning:0,info:0};for(const n of e)t[n.severity]++;return t}function aa(e,t){return t!==void 0&&e.targetRefs.some(n=>t.has(n))}function od(e,t){if(t===void 0||e.length===0)return!1;const n=aa(e[0],t);return e.some(i=>aa(i,t)!==n)}function Qb(e,t){const n=od(e,t);return e.slice().sort((i,r)=>(n?Number(aa(r,t))-Number(aa(i,t)):0)||rd[i.severity]-rd[r.severity])}var kk=new na("ov"),Ok=500;function mn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=kk,this._overlayDefaults=W({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=Dk(n.getContainer()),this._init()}mn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],mn.prototype.get=function(e){if(zn(e)&&(e={id:e}),zn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Qe(t.overlays,Ao({type:e.type})):t.overlays.slice():[]}else return e.type?Qe(this._overlays,Ao({type:e.type})):e.id?this._overlays[e.id]:null},mn.prototype.add=function(e,t,n){if(un(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=W({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},mn.prototype.remove=function(e){var t=this.get(e)||[];Le(t)||(t=[t]);var n=this;H(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(Oi(i.html),Oi(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)}})},mn.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},mn.prototype.show=function(){El(this._overlayRoot)},mn.prototype.hide=function(){El(this._overlayRoot,!1)},mn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],oc(this._overlayRoot)},mn.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Zt(t);i=o.x,r=o.y}Jb(n,i,r),Tn(e.html,"data-container-id",t.id)},mn.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=Zt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Zt(i).height:s=i.height,o=t.bottom*-1+s}Jb(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},mn.prototype._createOverlayContainer=function(e){var t=kt('<div class="djs-overlays" />');Bn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},mn.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";ex(this._overlayRoot,n)},mn.prototype._getOverlayContainer=function(e,t){var n=At(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},mn.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)),zn(i)&&(i=kt(i)),o=this._getOverlayContainer(n),r=kt('<div class="djs-overlay" data-overlay-id="'+t+'">'),Bn(r,{position:"absolute"}),r.appendChild(i),e.type&&Bt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();El(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())},mn.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&&(rn(r)&&r>t.scale||rn(o)&&o<t.scale))&&(c=!1),El(a,c),this._updateOverlayScale(e,t)},mn.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),rn(i)&&t.scale<i&&(a=(1/t.scale||1)*i),rn(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),rn(a)&&(s="scale("+a+","+a+")"),ex(o,s)},mn.prototype._updateOverlaysVisibilty=function(e){var t=this;H(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},mn.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});H(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){Oi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",Ok,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(H(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&&Bt(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 Dk(e){var t=kt('<div class="djs-overlay-container" />');return Bn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Jb(e,t,n){Bn(e,{left:t+"px",top:n+"px"})}function El(e,t){e.style.display=t===!1?"none":""}function ex(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Sl={__init__:["overlays"],overlays:["type",mn]};function ad(e,t){t.invoke(ne,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)})}we(ad,ne),ad.$inject=["canvas","injector"];const Lk={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",ad]};function ds(e){return CSS.escape(e)}var Ik={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function tx(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return Ik[t]})}var Bk="bjs-breadcrumbs-shown";function nx(e,t,n){var i=kt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=Bt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=oe(l),f=At(a,function(p){return p===u});f&&s()});function s(c){c&&(a=Nk(c));var l=a.flatMap(function(f){var p=n.findRoot(Ni(f))||n.findRoot(f.id);if(!p&&S(f,"bpmn:Process")){var d=t.find(function(y){var v=oe(y);return v&&v.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var m=tx(f.name||f.id),h=kt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(p)}),h});i.innerHTML="";var u=l.length>1;o.toggle(Bk,u),l.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}nx.$inject=["eventBus","elementRegistry","canvas"];function Nk(e){for(var t=oe(e),n=[],i=t;i;i=i.$parent)(S(i,"bpmn:SubProcess")||S(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function ix(e,t){var n=null,i=new $k;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,l=(a.y-s.y)*a.scale;(c!==0||l!==0)&&t.scroll({dx:c,dy:l}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}ix.$inject=["eventBus","canvas"];function $k(){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 rx={x:180,y:160};function fo(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}fo.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)})}},fo.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),jk(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},fo.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=Fk(e),i={x:n.x-rx.x,y:n.y-rx.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)})},fo.prototype._moveToDiPlane=function(e,t){var n=ox(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},fo.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},fo.$inject=["eventBus","moddle"];function ox(e){return S(e,"bpmndi:BPMNDiagram")?e:ox(e.$parent)}function Fk(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=De(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),hc(t)}function jk(e,t){var n=e.$parent;return!(!S(n,"bpmn:SubProcess")||n===t.bpmnElement||Ze(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Rl=250,Hk='<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>',zk="bjs-drilldown-empty";function Nr(e,t,n,i,r){ne.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",Rl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Rl,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Rl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),this.reverted(["shape.create","shape.move","shape.delete"],Rl,function(a){var s=a.oldParent,c=a.newParent||a.parent,l=a.shape;o._canDrillDown(l)&&o._addOverlay(l),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(l)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}we(Nr,ne),Nr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},Nr.prototype._canDrillDown=function(e){var t=this._canvas;return S(e,"bpmn:SubProcess")&&t.findRoot(Ni(e))},Nr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=oe(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;Bt(i.html).toggle(zk,!r)}},Nr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=oe(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=kt('<button type="button" class="bjs-drilldown">'+Hk+"</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(Ni(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},Nr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},Nr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const Gk={__depends__:[Sl,Bf,Lk],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",nx],drilldownCentering:["type",ix],drilldownOverlayBehavior:["type",Nr],subprocessCompatibility:["type",fo]};function $r(e){Ft.call(this,e)}we($r,Ft),$r.prototype._modules=[Gg,Gk,Sl,mi,Ha],$r.prototype._moddleExtensions={};var Cl="keyboard.keydown",Vk="keyboard.keyup",Wk=1e3,ax="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 Nn(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(ax));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Nn.$inject=["config.keyboard","eventBus"],Nn.prototype._keydownHandler=function(e){this._keyHandler(e,Cl)},Nn.prototype._keyupHandler=function(e){this._keyHandler(e,Vk)},Nn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Cl,i),n&&e.preventDefault()}},Nn.prototype._isEventIgnored=function(e){return!1},Nn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(ax)),this.unbind(),e=this._node=this._target,je.bind(e,"keydown",this._keydownHandler),je.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Nn.prototype.getBinding=function(){return this._node},Nn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),je.unbind(e,"keydown",this._keydownHandler),je.unbind(e,"keyup",this._keyupHandler)),this._node=null},Nn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Nn.prototype.addListener=function(e,t,n){pn(e)&&(n=t,t=e,e=Wk),this._eventBus.on(n||Cl,e,t)},Nn.prototype.removeListener=function(e,t){this._eventBus.off(t||Cl,e)},Nn.prototype.hasModifier=nT,Nn.prototype.isCmd=Kn,Nn.prototype.isShift=Rf,Nn.prototype.isKey=sn;var Uk=500;function sa(e,t){var n=this;e.on("editorActions.init",Uk,function(i){var r=i.editorActions;n.registerBindings(t,r)})}sa.$inject=["eventBus","keyboard"],sa.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(sT(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(cT(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(iT(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(rT(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(oT(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(aT(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(sn(["+","Add","="],r)&&Kn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(sn(["-","Subtract"],r)&&Kn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(sn("0",r)&&Kn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(sn(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const sd={__init__:["keyboard","keyboardBindings"],keyboard:["type",Nn],keyboardBindings:["type",sa]};var Yk={moveSpeed:50,moveSpeedAccelerated:200};function sx(e,t,n){var i=this;this._config=W({},Yk,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,l;switch(a.key){case"ArrowLeft":case"Left":l="left";break;case"ArrowUp":case"Up":l="up";break;case"ArrowRight":case"Right":l="right";break;case"ArrowDown":case"Down":l="down";break}return i.moveCanvas({speed:c,direction:l}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,l=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=l;break;case"up":s=l;break;case"right":a=-l;break;case"down":s=-l;break}n.scroll({dx:a,dy:s})}}sx.$inject=["config.keyboardMove","keyboard","canvas"];const cx={__depends__:[sd],__init__:["keyboardMove"],keyboardMove:["type",sx]};var qk=15;function lx(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,l=n.button,u=ao(s),f=Ri(u,c);if(!n.dragging&&Kk(f)>qk&&(n.dragging=!0,l===0&&Mv(e),Qc("grab")),n.dragging){var p=n.last||n.start;f=Ri(u,p),t.scroll({dx:f.x,dy:f.y}),n.last=u}s.preventDefault()}function o(s){je.unbind(document,"mousemove",r),je.unbind(document,"mouseup",o),n=null,Pv()}function a(s){if(!eo(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:ao(s)},je.bind(document,"mousemove",r),je.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}lx.$inject=["eventBus","canvas"];function Kk(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const ux={__init__:["moveCanvas"],moveCanvas:["type",lx]};function px(e,t){var n=_p(e.min),i=_p(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function Xk(e,t){return Math.max(e.min,Math.min(e.max,t))}var Zk=Math.sign||function(e){return e>=0?1:-1},cd={min:.2,max:4},fx=10,Qk=.1,Jk=.75;function ji(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Fn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||Jk;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}ji.$inject=["config.zoomScroll","eventBus","canvas"],ji.prototype.scroll=function(t){this._canvas.scroll(t)},ji.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ji.prototype.zoom=function(t,n){var i=px(cd,fx*2);this._totalDelta+=t,Math.abs(this._totalDelta)>Qk&&(this._zoom(t,n,i),this._totalDelta=0)},ji.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||By()&&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))*Zk(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)}},ji.prototype.stepZoom=function(t,n){var i=px(cd,fx);this._zoom(t,n,i)},ji.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=_p(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(Xk(cd,s),t)},ji.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&je[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},ji.prototype._init=function(e){this.toggle(e)};const dx={__init__:["zoomScroll"],zoomScroll:["type",ji]};function hs(e){$r.call(this,e)}we(hs,$r),hs.prototype._navigationModules=[cx,ux,dx],hs.prototype._modules=[].concat($r.prototype._modules,hs.prototype._navigationModules);function ld(e){return e&&e[e.length-1]}function hx(e){return e.y}function mx(e){return e.x}var eO={left:mx,center:mx,right:function(e){return e.x+e.width},top:hx,middle:hx,bottom:function(e){return e.y+e.height}};function ca(e,t){this._modeling=e,this._rules=t}ca.$inject=["modeling","rules"],ca.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}},ca.prototype._isType=function(e,t){return t.indexOf(e)!==-1},ca.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,l,u;function f(p,d){return Math.round((p[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))u=ld(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(H(t,function(p){var d=p[i]+Math.round(p[r]/2);a[d]?a[d].elements.push(p):a[d]={elements:[p],center:d}}),c=Ai(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=ld(c).center,o;l=t[0],t=Ai(t,function(p){return p[i]+p[r]}),u=ld(t),o[e]=f(l,u)}return o},ca.prototype.trigger=function(e,t){var n=this._modeling,i,r=Qe(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Le(i)&&(r=i),!(r.length<2||!i)){var o=eO[t],a=Ai(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const tO={__init__:["alignElements"],alignElements:["type",ca]},nO=new na;function la(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}la.$inject=["eventBus"],la.prototype.schedule=function(e,t=nO.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},la.prototype._schedule=function(e,t){const n=iO();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}},la.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},la.prototype._cancel=function(e){clearTimeout(e.executionId)};function iO(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const rO={scheduler:["type",la]};var oO="djs-element-hidden",Al=".entry",aO=1e3,gx=8,sO=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=Le(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=Le(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Jt.prototype._createContainer=function(){var e=kt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Jt.prototype.registerProvider=function(e,t){t||(t=e,e=aO),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Jt.prototype.getEntries=function(e){var t=this._getProviders(),n=Le(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return H(t,function(r){if(pn(r[n])){var o=r[n](e);pn(o)?i=o(i):H(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=Tn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},sO);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(pn(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;H(t,function(r,o){var a=r.group||"default",s=kt(r.html||'<div class="entry" draggable="true"></div>'),c;Tn(s,"data-action",o),c=bt("[data-group="+ds(a)+"]",n),c||(c=kt('<div class="group"></div>'),Tn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&cO(s,r.className),r.title&&Tn(s,"title",r.title),r.imageUrl&&(i=kt("<img>"),Tn(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),Bt(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=kt('<div class="djs-context-pad"></div>');return Un.bind(n,Al,"click",function(i){t.trigger("click",i)}),Un.bind(n,Al,"dragstart",function(i){t.trigger("dragstart",i)}),Un.bind(n,Al,"mouseover",function(i){t.trigger("mouseover",i)}),Un.bind(n,Al,"mouseout",function(i){t.trigger("mouseout",i)}),je.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()&&uO(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 Le(e)!==Le(n)?!1:Le(e)?e.length===n.length&&Xr(e,function(i){return n.includes(i)}):n===e},Jt.prototype.isShown=function(){return this.isOpen()&&Bt(this._current.html).has("open")},Jt.prototype.show=function(){this.isOpen()&&(Bt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Jt.prototype.hide=function(){this.isOpen()&&(Bt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Jt.prototype._getPosition=function(e){if(!Le(e)&&wt(e)){var t=this._canvas.viewbox(),n=lO(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+gx*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+gx*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=Le(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,oO)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Jt.prototype._getTargetBounds=function(e){var t=this,n=Le(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function cO(e,t){var n=Bt(e);t=Le(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function lO(e){return e.waypoints[e.waypoints.length-1]}function uO(e,t){return e=Le(e)?e:[e],t=Le(t)?t:[t],e.length===t.length&&Xr(e,function(n){return t.includes(n)})}const yx={__depends__:[Zc,rO,Sl],contextPad:["type",Jt]};var Pl,Ht,vx,Fr,bx,xx,_x,ud,Ml,ms,wx,pd,fd,dd,Tl={},kl=[],pO=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ol=Array.isArray;function cr(e,t){for(var n in t)e[n]=t[n];return e}function hd(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ex(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?Pl.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 Dl(e,a,i,r,null)}function Dl(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??++vx,__i:-1,__u:0};return r==null&&Ht.vnode!=null&&Ht.vnode(o),o}function Ll(e){return e.children}function Il(e,t){this.props=e,this.context=t}function ho(e,t){if(t==null)return e.__?ho(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"?ho(e):null}function fO(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=cr({},t);o.__v=t.__v+1,Ht.vnode&&Ht.vnode(o),md(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??ho(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,kx(i,o,r),t.__e=t.__=null,o.__e!=n&&Sx(o)}}function Sx(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}),Sx(e)}function Rx(e){(!e.__d&&(e.__d=!0)&&Fr.push(e)&&!Bl.__r++||bx!=Ht.debounceRendering)&&((bx=Ht.debounceRendering)||xx)(Bl)}function Bl(){try{for(var e,t=1;Fr.length;)Fr.length>t&&Fr.sort(_x),e=Fr.shift(),t=Fr.length,fO(e)}finally{Fr.length=Bl.__r=0}}function Cx(e,t,n,i,r,o,a,s,c,l,u){var f,p,d,m,h,y,v=i&&i.__k||kl,g=t.length;for(c=dO(n,t,v,c,g),f=0;f<g;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&v[d.__i]||Tl,d.__i=f,y=md(e,d,p,r,o,a,s,c,l,u),m=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&gd(p.ref,null,d),u.push(d.ref,d.__c||m,d)),h==null&&m!=null&&(h=m),4&d.__u?(c=Ax(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&y!==void 0?c=y:m&&(c=m.nextSibling),d.__u&=-7);return n.__e=h,c}function dO(e,t,n,i,r){var o,a,s,c,l,u=n.length,f=u,p=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=Dl(null,a,null,null,null):Ol(a)?a=e.__k[o]=Dl(Ll,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Dl(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,s=null,(l=a.__i=hO(a,n,c,f))!=-1&&(f--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(r>u?p--:r<u&&p++),typeof a.type!="function"&&(a.__u|=4)):l!=c&&(l==c-1?p--:l==c+1?p++:(l>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<u;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=ho(s)),Dx(s,s));return i}function Ax(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=Ax(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=ho(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function hO(e,t,n,i){var r,o,a,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(i>(u?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((l=t[a=r>=0?r--:o++])!=null&&(2&l.__u)==0&&s==l.key&&c==l.type)return a}return-1}function Px(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||pO.test(t)?n:n+"px"}function Nl(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||Px(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Px(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(wx,"$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[ms]=i[ms]:(n[ms]=pd,e.addEventListener(t,o?dd:fd,o)):e.removeEventListener(t,o?dd:fd,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 Mx(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ml]==null)t[Ml]=pd++;else if(t[Ml]<n[ms])return;return n(Ht.event?Ht.event(t):t)}}}function md(e,t,n,i,r,o,a,s,c,l){var u,f,p,d,m,h,y,v,g,b,_,C,M,O,P,F,I=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=Ht.__b)&&u(t);e:if(typeof I=="function"){f=a.length;try{if(g=t.props,b=I.prototype&&I.prototype.render,_=(u=I.contextType)&&i[u.__c],C=u?_?_.props.value:u.__:i,n.__c?v=(p=t.__c=n.__c).__=p.__E:(b?t.__c=p=new I(g,C):(t.__c=p=new Il(g,C),p.constructor=I,p.render=gO),_&&_.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),b&&p.__s==null&&(p.__s=p.state),b&&I.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=cr({},p.__s)),cr(p.__s,I.getDerivedStateFromProps(g,p.__s))),m=p.props,h=p.state,p.__v=t,d)b&&I.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),b&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(b&&I.getDerivedStateFromProps==null&&g!==m&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(g,C),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(g,p.__s,C)===!1){t.__v!=n.__v&&(p.props=g,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(B){B&&(B.__=t)}),kl.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=ho(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(g,p.__s,C),b&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(m,h,y)})}if(p.context=C,p.props=g,p.__P=e,p.__e=!1,M=Ht.__r,O=0,b)p.state=p.__s,p.__d=!1,M&&M(t),u=p.render(p.props,p.state,p.context),kl.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,M&&M(t),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++O<25);p.state=p.__s,p.getChildContext!=null&&(i=cr(cr({},i),p.getChildContext())),b&&!d&&p.getSnapshotBeforeUpdate!=null&&(y=p.getSnapshotBeforeUpdate(m,h)),P=u!=null&&u.type===Ll&&u.key==null?Ox(u.props.children):u,s=Cx(e,Ol(P)?P:[P],t,n,i,r,o,a,s,c,l),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),v&&(p.__E=p.__=null)}catch(B){if(a.length=f,t.__v=null,c||o!=null){if(B.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(F=o.length;F--;)hd(o[F])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),B.then||Tx(t),Ht.__e(B,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=mO(n.__e,t,n,i,r,o,a,c,l);return(u=Ht.diffed)&&u(t),128&t.__u?void 0:s}function Tx(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Tx))}function kx(e,t,n){for(var i=0;i<n.length;i++)gd(n[i],n[++i],n[++i]);Ht.__c&&Ht.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){Ht.__e(o,r.__v)}})}function Ox(e){return typeof e!="object"||e==null||e.__b>0?e:Ol(e)?e.map(Ox):e.constructor!==void 0?null:cr({},e)}function mO(e,t,n,i,r,o,a,s,c){var l,u,f,p,d,m,h,y=n.props||Tl,v=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(l=0;l<o.length;l++)if((d=o[l])&&"setAttribute"in d==!!g&&(g?d.localName==g:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(g==null)return document.createTextNode(v);e=document.createElementNS(r,g,v.is&&v),s&&(Ht.__m&&Ht.__m(t,o),s=!1),o=null}if(g==null)y===v||s&&e.data==v||(e.data=v);else{if(o=g=="textarea"&&v.defaultValue!=null?null:o&&Pl.call(e.childNodes),!s&&o!=null)for(y={},l=0;l<e.attributes.length;l++)y[(d=e.attributes[l]).name]=d.value;for(l in y)d=y[l],l=="dangerouslySetInnerHTML"?f=d:l=="children"||l in v||l=="value"&&"defaultValue"in v||l=="checked"&&"defaultChecked"in v||Nl(e,l,null,d,r);for(l in v)d=v[l],l=="children"?p=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?m=d:l=="checked"?h=d:s&&typeof d!="function"||y[l]===d||Nl(e,l,d,y[l],r);if(u)s||f&&(u.__html==f.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(f&&(e.innerHTML=""),Cx(t.type=="template"?e.content:e,Ol(p)?p:[p],t,n,i,g=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&ho(n,0),s,c),o!=null)for(l=o.length;l--;)hd(o[l]);s&&g!="textarea"||(l="value",g=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[l]||g=="progress"&&!m||g=="option"&&m!=y[l])&&Nl(e,l,m,y[l],r),l="checked",h!=null&&h!=e[l]&&Nl(e,l,h,y[l],r))}return e}function gd(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){Ht.__e(r,n)}}function Dx(e,t,n){var i,r;if(Ht.unmount&&Ht.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||gd(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){Ht.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Dx(i[r],t,n||typeof e.type!="function");n||hd(e.__e),e.__c=e.__=e.__e=void 0}function gO(e,t,n){return this.constructor(e,n)}function Lx(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),Ht.__&&Ht.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],md(t,e=t.__k=Ex(Ll,null,[e]),r||Tl,Tl,t.namespaceURI,r?null:t.firstChild?Pl.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),kx(o,e,a),e.props.children=null}Pl=kl.slice,Ht={__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}},vx=0,Il.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=cr({},this.state),typeof e=="function"&&(e=e(cr({},n),this.props)),e&&cr(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Rx(this))},Il.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Rx(this))},Il.prototype.render=Ll,Fr=[],xx=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,_x=function(e,t){return e.__v.__b-t.__v.__b},Bl.__r=0,ud=Math.random().toString(8),Ml="__d"+ud,ms="__a"+ud,wx=/(PointerCapture)$|Capture$/i,pd=0,fd=Mx(!1),dd=Mx(!0);var Ix=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,Ix(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Bx=new Map;function yO(e){var t=Bx.get(this);return t||(t=new Map,Bx.set(this,t)),(t=Ix(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],l=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},u=0;u<n.length;u++){u&&(o===1&&l(),l(u));for(var f=0;f<n[u].length;f++)i=n[u][f],o===1?i==="<"?(l(),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===">"?(l(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[u][f+1]===">")?(l(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
+ `||i==="\r"?(l(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return l(),c})(e)),t),arguments,[])).length>1?t:t[0]}var St=yO.bind(Ex),ua,en,yd,Nx,gs=0,$x=[],cn=Ht,Fx=cn.__b,jx=cn.__r,Hx=cn.diffed,zx=cn.__c,Gx=cn.unmount,Vx=cn.__;function $l(e,t){cn.__h&&cn.__h(en,e,gs||t),gs=0;var n=en.__H||(en.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function vd(e){return gs=1,vO(Ux,e)}function vO(e,t,n){var i=$l(ua++,2);if(i.t=e,!i.__c&&(i.__=[Ux(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],l=i.t(c,s);c!==l&&(i.__N=[l,i.__[1]],i.__c.setState({}))}],i.__c=en,!en.__f)){var r=function(s,c,l){if(!i.__c.__H)return!0;var u=!1,f=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){u=!0;var m=d.__[0];d.__=d.__N,d.__N=void 0,m!==d.__[0]&&(f=!0)}}),o){var p=o.call(this,s,c,l);return u?p||f:p}return!u||f};en.__f=!0;var o=en.shouldComponentUpdate,a=en.componentWillUpdate;en.componentWillUpdate=function(s,c,l){if(this.__e){var u=o;o=void 0,r(s,c,l),o=u}a&&a.call(this,s,c,l)},en.shouldComponentUpdate=r}return i.__N||i.__}function Fl(e,t){var n=$l(ua++,3);!cn.__s&&_d(n.__H,t)&&(n.__=e,n.u=t,en.__H.__h.push(n))}function bd(e,t){var n=$l(ua++,4);!cn.__s&&_d(n.__H,t)&&(n.__=e,n.u=t,en.__h.push(n))}function jl(e){return gs=5,lr(function(){return{current:e}},[])}function lr(e,t){var n=$l(ua++,7);return _d(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ys(e,t){return gs=8,lr(function(){return e},t)}function bO(){for(var e;e=$x.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Hl),t.__h.some(xd),t.__h=[]}catch(n){t.__h=[],cn.__e(n,e.__v)}}}cn.__b=function(e){en=null,Fx&&Fx(e)},cn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Vx&&Vx(e,t)},cn.__r=function(e){jx&&jx(e),ua=0;var t=(en=e.__c).__H;t&&(yd===en?(t.__h=[],en.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Hl),t.__h.some(xd),t.__h=[],ua=0)),yd=en},cn.diffed=function(e){Hx&&Hx(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&($x.push(t)!==1&&Nx===cn.requestAnimationFrame||((Nx=cn.requestAnimationFrame)||xO)(bO)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),yd=en=null},cn.__c=function(e,t){t.some(function(n){try{n.__h.some(Hl),n.__h=n.__h.filter(function(i){return!i.__||xd(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],cn.__e(i,n.__v)}}),zx&&zx(e,t)},cn.unmount=function(e){Gx&&Gx(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Hl(i)}catch(r){t=r}}),n.__H=void 0,t&&cn.__e(t,n.__v))};var Wx=typeof requestAnimationFrame=="function";function xO(e){var t,n=function(){clearTimeout(i),Wx&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Wx&&(t=requestAnimationFrame(n))}function Hl(e){var t=en,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),en=t}function xd(e){var t=en;e.__c=e.__(),en=t}function _d(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Ux(e,t){return typeof t=="function"?t(e):t}function _O(e){const{navigationStack:t,setNavigationStack:n}=e,i=lr(()=>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 St`
12
12
  <div class="djs-popup-breadcrumbs">
13
- ${r&&vt`
13
+ ${r&&St`
14
14
  <button
15
15
  type="button"
16
16
  class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--back"
@@ -23,7 +23,7 @@
23
23
  </svg>
24
24
  </button>
25
25
  `}
26
- ${i.map((a,s)=>vt`
26
+ ${i.map((a,s)=>St`
27
27
  <button
28
28
  key=${s}
29
29
  type="button"
@@ -35,22 +35,22 @@
35
35
  </button>
36
36
  <span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
37
37
  `)}
38
- ${o&&vt`
38
+ ${o&&St`
39
39
  <span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${o}>
40
40
  ${o}
41
41
  </span>
42
42
  `}
43
43
  </div>
44
- `}function Vx(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=Vx(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function zl(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Vx(e))&&(i&&(i+=" "),i+=t);return i}function bO(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=lr(()=>xO(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return vt`
44
+ `}function Yx(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=Yx(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function zl(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Yx(e))&&(i&&(i+=" "),i+=t);return i}function wO(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=lr(()=>EO(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return St`
45
45
  <div class="djs-popup-header">
46
46
  <h3 class="djs-popup-title" title=${o}>${o}</h3>
47
- ${a.map(l=>vt`
47
+ ${a.map(l=>St`
48
48
  <ul key=${l.id} class="djs-popup-header-group" data-header-group=${l.id}>
49
49
 
50
- ${l.entries.map(u=>vt`
50
+ ${l.entries.map(u=>St`
51
51
  <li key=${u.id}>
52
52
  <${s(u)?"button":"span"}
53
- class=${_O(u,u===i)}
53
+ class=${SO(u,u===i)}
54
54
  onClick=${f=>c(f,u)}
55
55
  title=${u.title||u.label}
56
56
  data-id=${u.id}
@@ -60,8 +60,8 @@
60
60
  onFocus=${()=>s(u)&&r(u)}
61
61
  onBlur=${()=>s(u)&&r(null)}
62
62
  >
63
- ${u.imageUrl&&vt`<img class="djs-popup-entry-icon" src=${u.imageUrl} alt="" />`||u.imageHtml&&vt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:u.imageHtml}} />`}
64
- ${u.label?vt`
63
+ ${u.imageUrl&&St`<img class="djs-popup-entry-icon" src=${u.imageUrl} alt="" />`||u.imageHtml&&St`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:u.imageHtml}} />`}
64
+ ${u.label?St`
65
65
  <span class="djs-popup-label">${u.label}</span>
66
66
  `:null}
67
67
  </${u.action?"button":"span"}>
@@ -70,11 +70,11 @@
70
70
  </ul>
71
71
  `)}
72
72
  </div>
73
- `}function xO(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 _O(e,t){return zl("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Wx(e,t){return`${e}-entry-${t.id}`}function wO(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(l,u)=>{if(!n.disabled)return a(l,n,u)},c=!n.entries;return vt`
73
+ `}function EO(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 SO(e,t){return zl("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function qx(e,t){return`${e}-entry-${t.id}`}function RO(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(l,u)=>{if(!n.disabled)return a(l,n,u)},c=!n.entries;return St`
74
74
  <li
75
75
  class=${zl("entry",{selected:i,disabled:n.disabled})}
76
76
  data-id=${n.id}
77
- id=${Wx(t,n)}
77
+ id=${qx(t,n)}
78
78
  role="option"
79
79
  aria-selected=${i||void 0}
80
80
  aria-haspopup=${n.entries?"true":void 0}
@@ -90,15 +90,15 @@
90
90
  <span
91
91
  class=${zl("djs-popup-entry-name",n.className)}
92
92
  >
93
- ${n.imageUrl&&vt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&vt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
93
+ ${n.imageUrl&&St`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&St`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
94
94
 
95
- ${n.label?vt`
95
+ ${n.label?St`
96
96
  <span class="djs-popup-label">
97
97
  ${n.label}
98
98
  </span>
99
99
  `:null}
100
100
 
101
- ${n.documentationRef&&vt`
101
+ ${n.documentationRef&&St`
102
102
  <a
103
103
  class="djs-popup-entry-docs"
104
104
  href=${n.documentationRef}
@@ -115,7 +115,7 @@
115
115
  </a>
116
116
  `}
117
117
  </span>
118
- ${n.description&&vt`
118
+ ${n.description&&St`
119
119
  <span
120
120
  class="djs-popup-entry-description"
121
121
  >
@@ -123,7 +123,7 @@
123
123
  </span>
124
124
  `}
125
125
  </div>
126
- ${n.entries&&vt`
126
+ ${n.entries&&St`
127
127
  <div class="djs-popup-entry-chevron" aria-hidden="true">
128
128
  <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
129
129
  <path fill-rule="evenodd" clip-rule="evenodd" d="M3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L9.03033 5.46967C9.32322 5.76256 9.32322 6.23744 9.03033 6.53033L5.03033 10.5303C4.73744 10.8232 4.26256 10.8232 3.96967 10.5303C3.67678 10.2374 3.67678 9.76256 3.96967 9.46967L7.43934 6L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967Z" fill="currentColor"/>
@@ -131,7 +131,7 @@
131
131
  </div>
132
132
  `}
133
133
  </li>
134
- `}function EO(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,f=jl();vd(()=>{if(!r||!r.current)return;const h=f.current;if(!h)return;const y=h.querySelector(".selected");y&&SO(y)},[t]);const p=()=>{r.current=!1},d=h=>{r.current||n(h)},m=()=>{r.current||n(null)};return vt`
134
+ `}function CO(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,f=jl();bd(()=>{if(!r||!r.current)return;const h=f.current;if(!h)return;const y=h.querySelector(".selected");y&&AO(y)},[t]);const p=()=>{r.current=!1},d=h=>{r.current||n(h)},m=()=>{r.current||n(null)};return St`
135
135
  <div
136
136
  class="djs-popup-results"
137
137
  ref=${f}
@@ -142,9 +142,9 @@
142
142
  aria-activedescendant=${l}
143
143
  onMouseMove=${p}
144
144
  >
145
- ${i.map(h=>vt`
146
- ${h.name&&vt`
147
- <div key=${h.id} id=${Ux(o,h)} class="entry-header" title=${h.name}>
145
+ ${i.map(h=>St`
146
+ ${h.name&&St`
147
+ <div key=${h.id} id=${Kx(o,h)} class="entry-header" title=${h.name}>
148
148
  ${h.name}
149
149
  </div>
150
150
  `}
@@ -152,10 +152,10 @@
152
152
  class="djs-popup-group"
153
153
  data-group=${h.id}
154
154
  role="group"
155
- aria-labelledby=${h.name?Ux(o,h):void 0}
155
+ aria-labelledby=${h.name?Kx(o,h):void 0}
156
156
  >
157
- ${h.entries.map(y=>vt`
158
- <${wO}
157
+ ${h.entries.map(y=>St`
158
+ <${RO}
159
159
  key=${y.id}
160
160
  idPrefix=${o}
161
161
  entry=${y}
@@ -168,8 +168,8 @@
168
168
  </ul>
169
169
  `)}
170
170
  </div>
171
- `}function Ux(e,t){return`${e}-group-${t.id}`}function SO(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const RO=new ia("djs-popup");function CO(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,searchFn:f,entries:p,onOpened:d,onClosed:m}=e,[h,y]=yd([]);Fl(()=>{y([])},[p]);const[v,g]=yd(""),b=v.trim().length>0,x=lr(()=>MO(p),[p]),C=lr(()=>rn(l)?x.length>5:!1,[l,x]),M=lr(()=>{const q=h.length?h[h.length-1].entries:p;return C?b?f(x.filter(({searchable:V})=>V!==!1),v,{keys:["label","search","description"]}).map(({item:V})=>V):q.filter(({rank:V=0})=>V>=0):q},[C,b,x,v,f,h,p]),O=lr(()=>b?M.length?[{id:"default",entries:M}]:[]:TO(M),[M,b]),[P,F]=yd(M[0]),D=jl(null),I=jl(!1),z=lr(()=>RO.next(),[]),ce=`${z}-results`,ve=P&&Wx(z,P);Fl(()=>{const q=D.current;q&&M.includes(q)?F(q):F(M[0]),D.current=null},[M]);const Ye=vs(q=>{const V=PO(O);let Pe=V.indexOf(P)+q;Pe<0&&(Pe=V.length-1),Pe>=V.length&&(Pe=0),I.current=!0,F(V[Pe])},[O,P]),He=vs(q=>{q>0&&P&&P.entries&&(I.current=!0,y(V=>[...V,P])),q<0&&h.length>0&&(I.current=!0,D.current=h[h.length+q],y(V=>V.slice(0,q)))},[P,h]),it=vs((q,V,ie)=>{if(!(!V||V.disabled))return V.entries?(q.preventDefault(),He(1)):n(q,V,ie)},[n,He]),X=vs(q=>{if(q.key==="Enter"&&P){const V=q.target;return!!eo(V,"a, button",!0)||P.disabled?void 0:it(q,P)}if(q.key==="Backspace"){const V=q.target;if(!(Ju(V,"input")&&V.value!==""))return He(-1),q.preventDefault()}if(q.key==="ArrowUp")return Ye(-1),q.preventDefault();if(q.key==="ArrowDown")return Ye(1),q.preventDefault();if(q.key==="ArrowRight")return He(1),q.preventDefault();if(q.key==="ArrowLeft")return He(-1),q.preventDefault()},[P,Ye,He,it]),Q=vs(q=>{Ju(q.target,"input")&&g(()=>q.target.value)},[g]);Fl(()=>(d(),()=>{m()}),[]);const ue=!b&&h.length>0,_e=(a||r.length>0)&&!ue;return vt`
172
- <${Yx}
171
+ `}function Kx(e,t){return`${e}-group-${t.id}`}function AO(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const PO=new na("djs-popup");function MO(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:l,emptyPlaceholder:u,searchFn:f,entries:p,onOpened:d,onClosed:m}=e,[h,y]=vd([]);Fl(()=>{y([])},[p]);const[v,g]=vd(""),b=v.trim().length>0,_=lr(()=>OO(p),[p]),C=lr(()=>rn(l)?_.length>5:!1,[l,_]),M=lr(()=>{const q=h.length?h[h.length-1].entries:p;return C?b?f(_.filter(({searchable:V})=>V!==!1),v,{keys:["label","search","description"]}).map(({item:V})=>V):q.filter(({rank:V=0})=>V>=0):q},[C,b,_,v,f,h,p]),O=lr(()=>b?M.length?[{id:"default",entries:M}]:[]:DO(M),[M,b]),[P,F]=vd(M[0]),I=jl(null),B=jl(!1),z=lr(()=>PO.next(),[]),ce=`${z}-results`,ve=P&&qx(z,P);Fl(()=>{const q=I.current;q&&M.includes(q)?F(q):F(M[0]),I.current=null},[M]);const qe=ys(q=>{const V=kO(O);let Me=V.indexOf(P)+q;Me<0&&(Me=V.length-1),Me>=V.length&&(Me=0),B.current=!0,F(V[Me])},[O,P]),He=ys(q=>{q>0&&P&&P.entries&&(B.current=!0,y(V=>[...V,P])),q<0&&h.length>0&&(B.current=!0,I.current=h[h.length+q],y(V=>V.slice(0,q)))},[P,h]),st=ys((q,V,ie)=>{if(!(!V||V.disabled))return V.entries?(q.preventDefault(),He(1)):n(q,V,ie)},[n,He]),X=ys(q=>{if(q.key==="Enter"&&P){const V=q.target;return!!eo(V,"a, button",!0)||P.disabled?void 0:st(q,P)}if(q.key==="Backspace"){const V=q.target;if(!(ep(V,"input")&&V.value!==""))return He(-1),q.preventDefault()}if(q.key==="ArrowUp")return qe(-1),q.preventDefault();if(q.key==="ArrowDown")return qe(1),q.preventDefault();if(q.key==="ArrowRight")return He(1),q.preventDefault();if(q.key==="ArrowLeft")return He(-1),q.preventDefault()},[P,qe,He,st]),Q=ys(q=>{ep(q.target,"input")&&g(()=>q.target.value)},[g]);Fl(()=>(d(),()=>{m()}),[]);const ue=!b&&h.length>0,_e=(a||r.length>0)&&!ue;return St`
172
+ <${Xx}
173
173
  onClose=${t}
174
174
  onKeyup=${Q}
175
175
  onKeydown=${X}
@@ -179,8 +179,8 @@
179
179
  scale=${c}
180
180
  navigationStack=${h}
181
181
  >
182
- ${_e&&vt`
183
- <${bO}
182
+ ${_e&&St`
183
+ <${wO}
184
184
  headerEntries=${r}
185
185
  onSelect=${n}
186
186
  selectedEntry=${P}
@@ -188,16 +188,16 @@
188
188
  title=${a}
189
189
  />
190
190
  `}
191
- ${ue&&vt`
192
- <${vO}
191
+ ${ue&&St`
192
+ <${_O}
193
193
  navigationStack=${h}
194
194
  setNavigationStack=${y}
195
195
  />
196
196
  `}
197
- ${p.length>0&&vt`
197
+ ${p.length>0&&St`
198
198
  <div class="djs-popup-body">
199
199
 
200
- ${C&&vt`
200
+ ${C&&St`
201
201
  <div class="djs-popup-search">
202
202
  <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
203
203
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -215,18 +215,18 @@
215
215
  </div>
216
216
  `}
217
217
 
218
- ${b&&vt`
218
+ ${b&&St`
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
- <${EO}
224
+ <${CO}
225
225
  groupedEntries=${O}
226
226
  selectedEntry=${P}
227
227
  setSelectedEntry=${F}
228
- keyboardSelection=${I}
229
- onAction=${it}
228
+ keyboardSelection=${B}
229
+ onAction=${st}
230
230
  idPrefix=${z}
231
231
  id=${ce}
232
232
  ariaLabel=${a||"Results"}
@@ -234,7 +234,7 @@
234
234
  ariaActivedescendant=${C?void 0:ve||void 0}
235
235
  />
236
236
 
237
- ${P&&P.documentationRef&&vt`
237
+ ${P&&P.documentationRef&&St`
238
238
  <div class="djs-popup-footer">
239
239
  <a
240
240
  class="djs-popup-footer-docs"
@@ -254,14 +254,14 @@
254
254
  `}
255
255
  </div>
256
256
  `}
257
- ${u&&M.length===0&&vt`
258
- <div class="djs-popup-no-results">${un(u)?u(v):u}</div>
257
+ ${u&&M.length===0&&St`
258
+ <div class="djs-popup-no-results">${pn(u)?u(v):u}</div>
259
259
  `}
260
- </${Yx}>
261
- `}function Yx(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=jl();return vd(()=>{if(typeof s!="function")return;const l=c.current,u=s(l);l.style.left=`${u.x}px`,l.style.top=`${u.y}px`},[c.current,s]),vd(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),Fl(()=>{const l=f=>{if(f.key==="Escape")return f.preventDefault(),t()},u=f=>{if(!eo(f.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",l),document.body.addEventListener("click",u,!0),()=>{document.documentElement.removeEventListener("keydown",l),document.body.removeEventListener("click",u,!0)}},[]),vt`
260
+ </${Xx}>
261
+ `}function Xx(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=jl();return bd(()=>{if(typeof s!="function")return;const l=c.current,u=s(l);l.style.left=`${u.x}px`,l.style.top=`${u.y}px`},[c.current,s]),bd(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),Fl(()=>{const l=f=>{if(f.key==="Escape")return f.preventDefault(),t()},u=f=>{if(!eo(f.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",l),document.body.addEventListener("click",u,!0),()=>{document.documentElement.removeEventListener("keydown",l),document.body.removeEventListener("click",u,!0)}},[]),St`
262
262
  <div
263
263
  class=${zl("djs-popup",r)}
264
- style=${AO(e)}
264
+ style=${TO(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 AO(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:rn(t)?n:void 0,maxWidth:rn(t)?"unset":void 0,"transform-origin":"top left"}}function PO(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function MO(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function TO(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 kO="data-id",qx=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],OO=1e3;function jt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=rn(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()})}jt.$inject=["config.popupMenu","eventBus","canvas","search"],jt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Kx(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),l=this._updateScale(this._current.container);kx(vt`
273
- <${CO}
272
+ `}function TO(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:rn(t)?n:void 0,maxWidth:rn(t)?"unset":void 0,"transform-origin":"top left"}}function kO(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function OO(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function DO(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 LO="data-id",Zx=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],IO=1e3;function zt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=rn(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()})}zt.$inject=["config.popupMenu","eventBus","canvas","search"],zt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Qx(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),l=this._updateScale(this._current.container);Lx(St`
273
+ <${MO}
274
274
  onClose=${p=>this.close(p)}
275
275
  onSelect=${(p,d,m)=>this.trigger(p,d,m)}
276
276
  position=${c}
@@ -284,7 +284,7 @@
284
284
  searchFn=${this._search}
285
285
  ...${{...o}}
286
286
  />
287
- `,this._current.container)},jt.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()},jt.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()},jt.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)}},jt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},jt.prototype.reset=function(){const e=this._current.container;kx(null,e),Di(e)},jt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},jt.prototype._onOpened=function(){this._emit("opened")},jt.prototype._onClosed=function(){this._emit("closed")},jt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Mt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},jt.prototype._bindAutoClose=function(){this._eventBus.once(qx,this.close,this)},jt.prototype._unbindAutoClose=function(){this._eventBus.off(qx,this.close,this)},jt.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),rn(n)&&e<n&&(r=n),rn(i)&&e>i&&(r=i)),r},jt.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}},jt.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},jt.prototype.registerProvider=function(e,t,n){n||(n=t,t=OO),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},jt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},jt.prototype._getEntries=function(e,t){var n={};return H(t,function(i){if(!i.getPopupMenuEntries){H(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Mi(o,["id"])});return}var r=i.getPopupMenuEntries(e);un(r)?n=r(n):H(r,function(o,a){n[a]=o})}),n},jt.prototype._getHeaderEntries=function(e,t){var n={};return H(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;H(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Mi(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);un(r)?n=r(n):H(r,function(o,a){n[a]=o})}),n},jt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>un(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},jt.prototype.isOpen=function(){return!!this._current},jt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=eo(e.delegateTarget||e.target,".entry",!0),o=Pn(r,kO);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(un(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},jt.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 Kx(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Kx(r.entries,[...t,...Xx(r.search)]):t.length&&(r.search=[...t,...Xx(r.search)]),r})}function Xx(e){return e?Ie(e)?e:[e]:[]}function DO(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=IO(o,r,i);return a?{item:o,tokens:a}:[]}).sort(LO(i))}function IO(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Ie(s)?s.reduce((u,f)=>{const{tokens:p,matchedWords:d}=t_(f,t);return{tokens:[...u.tokens,p],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):t_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function LO(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=BO(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Zx;continue}const s=NO(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Zx;continue}}return i}}function BO(e,t){return Qx(t)-Qx(e)}const Zx=.5,fa={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Qx(e){const t=e.reduce((s,c)=>s+Jx(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 Jx(e){if(Ie(e))return Math.max(...e.map(Jx));const t=Math.log(e.value.length);return e.match?(e.start?e.end?fa.FULL:e.wordEnd?fa.START_FULL_WORD:fa.START_WORD_PART:e.wordStart?fa.WORD_START:fa.WORD_PART)*t:fa.NO_MATCH*t}function e_(e=""){return Ie(e)?e.join(", "):e}function NO(e,t){return e_(e).localeCompare(e_(t))}function t_(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map($O),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[u]=s,f=s.index,p=s.index+u.length,d=f===0,m=p===e.length,h=!!((l=s.groups)!=null&&l.all),y=d||/\s/.test(e.charAt(f-1)),v=m||/\s/.test(e.charAt(p));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:u,index:s.index,match:!0,wordStart:y,wordEnd:v,start:d,end:m,all:h});const g=h?t:[u];for(const b of g)i[b.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function $O(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const n_={search:["value",DO]},_d={__depends__:[n_],__init__:["popupMenu"],popupMenu:["type",jt]};var i_={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},zt.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()},zt.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()},zt.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)}},zt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},zt.prototype.reset=function(){const e=this._current.container;Lx(null,e),Oi(e)},zt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},zt.prototype._onOpened=function(){this._emit("opened")},zt.prototype._onClosed=function(){this._emit("closed")},zt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=kt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},zt.prototype._bindAutoClose=function(){this._eventBus.once(Zx,this.close,this)},zt.prototype._unbindAutoClose=function(){this._eventBus.off(Zx,this.close,this)},zt.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),rn(n)&&e<n&&(r=n),rn(i)&&e>i&&(r=i)),r},zt.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}},zt.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},zt.prototype.registerProvider=function(e,t,n){n||(n=t,t=IO),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},zt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},zt.prototype._getEntries=function(e,t){var n={};return H(t,function(i){if(!i.getPopupMenuEntries){H(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Pi(o,["id"])});return}var r=i.getPopupMenuEntries(e);pn(r)?n=r(n):H(r,function(o,a){n[a]=o})}),n},zt.prototype._getHeaderEntries=function(e,t){var n={};return H(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;H(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Pi(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);pn(r)?n=r(n):H(r,function(o,a){n[a]=o})}),n},zt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>pn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},zt.prototype.isOpen=function(){return!!this._current},zt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=eo(e.delegateTarget||e.target,".entry",!0),o=Tn(r,LO);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(pn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},zt.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 Qx(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Qx(r.entries,[...t,...Jx(r.search)]):t.length&&(r.search=[...t,...Jx(r.search)]),r})}function Jx(e){return e?Le(e)?e:[e]:[]}function BO(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=NO(o,r,i);return a?{item:o,tokens:a}:[]}).sort($O(i))}function NO(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Le(s)?s.reduce((u,f)=>{const{tokens:p,matchedWords:d}=r_(f,t);return{tokens:[...u.tokens,p],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):r_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function $O(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=FO(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=e_;continue}const s=jO(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=e_;continue}}return i}}function FO(e,t){return t_(t)-t_(e)}const e_=.5,pa={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function t_(e){const t=e.reduce((s,c)=>s+n_(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 n_(e){if(Le(e))return Math.max(...e.map(n_));const t=Math.log(e.value.length);return e.match?(e.start?e.end?pa.FULL:e.wordEnd?pa.START_FULL_WORD:pa.START_WORD_PART:e.wordStart?pa.WORD_START:pa.WORD_PART)*t:pa.NO_MATCH*t}function i_(e=""){return Le(e)?e.join(", "):e}function jO(e,t){return i_(e).localeCompare(i_(t))}function r_(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(HO),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[u]=s,f=s.index,p=s.index+u.length,d=f===0,m=p===e.length,h=!!((l=s.groups)!=null&&l.all),y=d||/\s/.test(e.charAt(f-1)),v=m||/\s/.test(e.charAt(p));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:u,index:s.index,match:!0,wordStart:y,wordEnd:v,start:d,end:m,all:h});const g=h?t:[u];for(const b of g)i[b.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function HO(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const o_={search:["value",BO]},wd={__depends__:[o_],__init__:["popupMenu"],popupMenu:["type",zt]};var a_={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>`},FO=900;function da(e,t,n,i){e.registerProvider(FO,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}da.$inject=["contextPad","popupMenu","translate","canvas"],da.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},da.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},da.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${i_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);W(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},da.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 jO=["left","center","right","top","middle","bottom"];function bs(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}bs.$inject=["popupMenu","alignElements","translate","rules"],bs.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},bs.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},bs.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return H(jO,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:i_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Gl(e){hi.call(this,e)}Gl.$inject=["eventBus"],we(Gl,hi),Gl.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Qe(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=pc(n),n.length<2?!1:n})};const HO={__depends__:[Qk,hx,_d],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",da],alignElementsMenuProvider:["type",bs],bpmnAlignElements:["type",Gl]};function ur(e,t,n,i){ne.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,l=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],l)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=vu(Co(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=Ao(s,function(f){return f.parent.id});H(u,function(f,p){Ie(l)&&(f=f.filter(function(d){return wt(l,Po({id:d.id}))})),r._expand(f,p)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,l=c.parent;s&&s.autoResize===!1||l&&r._expand([c],l)})}ur.$inject=["eventBus","elementRegistry","modeling","rules"],we(ur,ne),ur.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=De(Zt(e)),o=De(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),hc(W({},o,a))},ur.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(zO(i,t)){var r=GO(Si(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},ur.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},ur.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},ur.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function zO(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function GO(e,t){var n="";return e=De(e),t=De(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 Vl(e){e.invoke(ur,this)}Vl.$inject=["injector"],we(Vl,ur),Vl.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 xs(e){hi.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}xs.$inject=["eventBus"],we(xs,hi),xs.prototype.canResize=function(e,t){return!1};function Wl(e,t){xs.call(this,e),this._modeling=t}we(Wl,xs),Wl.$inject=["eventBus","modeling"],Wl.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 H(e,function(i){if(S(i,"bpmn:Lane")||Xe(i)){n=!1;return}}),n};const VO={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Vl],bpmnAutoResizeProvider:["type",Wl]};function ha(e,t,n){this._canvas=n,this._opts=W({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()})}ha.$inject=["config.autoScroll","eventBus","canvas"],ha.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++)WO(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 WO(e,t,n){return t<e&&e<n}ha.prototype.stopScroll=function(){clearTimeout(this._scrolling)},ha.prototype.setOptions=function(e){this._opts=W({},this._opts,e)},ha.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=ao(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const UO={__depends__:[rr],__init__:["autoScroll"],autoScroll:["type",ha]};var r_="djs-bendpoint",o_="djs-segment-dragger";function YO(e,t){var n=ao(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 wd(e,t,n){var i=YO(e,n),r=Np(t,i);return r}function Ed(e,t){var n=Me("g");nt(n).add(r_),Ve(e,n);var i=Me("circle");Ee(i,{cx:0,cy:0,r:4}),nt(i).add("djs-visual"),Ve(n,i);var r=Me("circle");return Ee(r,{cx:0,cy:0,r:10}),nt(r).add("djs-hit"),Ve(n,r),t&&nt(n).add(t),n}function qO(e,t,n,i){var r=Me("g");Ve(e,r);var o=18,a=6,s=11,c=XO(t,n,i),l=a+s,u=Me("rect");Ee(u,{x:-o/2,y:-a/2,width:o,height:a}),nt(u).add("djs-visual"),Ve(r,u);var f=Me("rect");return Ee(f,{x:-c/2,y:-l/2,width:c,height:l}),nt(f).add("djs-hit"),Ve(r,f),Rg(r,i==="v"?90:0),r}function a_(e,t,n){var i=Me("g"),r=fp(t,n),o=Qi(t,n);return Ve(e,i),qO(i,t,n,o),nt(i).add(o_),nt(i).add(o==="h"?"horizontal":"vertical"),xn(i,r.x,r.y),i}function Sd(e){return Math.abs(Math.round(e*2/3))}function KO(e,t){var n=ZO(e,t);return Gp(e,n)}function XO(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Sd(n==="h"?i:r)}function ZO(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=py(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function s_(e,t,n,i,r){function o(b,x,C){var M=b.index,O=b.point,P,F,D,I,z,ce;return M<=0||b.bendpoint?!1:(P=x[M-1],F=x[M],D=fp(P,F),I=Qi(P,F),z=Math.abs(O.x-D.x),ce=Math.abs(O.y-D.y),I&&z<=C&&ce<=C)}function a(b,x){var C=b.waypoints,M,O,P,F;return x.index<=0||x.bendpoint||(M={start:C[x.index-1],end:C[x.index]},O=Qi(M.start,M.end),!O)?null:(O==="h"?P=M.end.x-M.start.x:P=M.end.y-M.start.y,F=Sd(P)/2,F)}function s(b,x){var C=x.waypoints,M=wd(t,C,b),O;if(M){O=a(x,M);var P;if(o(M,C,O)?P=r.start(b,x,M.index):P=i.start(b,x,M.index,!M.bendpoint),P!==!1)return!0}}function c(b,x,C){je.bind(b,x,function(M){n.triggerMouseEvent(x,M,C),M.stopPropagation()})}function l(b,x){var C=t.getLayer("overlays"),M=ht('.djs-bendpoints[data-element-id="'+hs(b.id)+'"]',C);return!M&&x&&(M=Me("g"),Ee(M,{"data-element-id":b.id}),nt(M).add("djs-bendpoints"),Ve(C,M),c(M,"mousedown",b),c(M,"click",b),c(M,"dblclick",b)),M}function u(b,x){return ht('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function f(b,x){x.waypoints.forEach(function(C,M){var O=Ed(b);Ve(b,O),xn(O,C.x,C.y)}),Ed(b,"floating")}function p(b,x){for(var C=x.waypoints,M,O,P,F=1;F<C.length;F++)M=C[F-1],O=C[F],Qi(M,O)&&(P=a_(b,M,O),Ee(P,{"data-segment-idx":F}),c(P,"mousemove",x))}function d(b){H(sc("."+r_,b),function(x){an(x)})}function m(b){H(sc("."+o_,b),function(x){an(x)})}function h(b){var x=l(b);return x||(x=l(b,!0),f(x,b),p(x,b)),x}function y(b){var x=l(b);x&&(m(x),d(x),p(x,b),f(x,b))}function v(b,x){var C=ht(".floating",b),M=x.point;C&&(xn(C,M.x,M.y),nt(C).add("positioned"))}function g(b,x,C){var M=u(x.index,b),O=C[x.index-1],P=C[x.index],F=x.point,D=fp(O,P),I=Qi(O,P),z,ce;M&&(z=QO(M),ce={x:F.x-D.x,y:F.y-D.y},I==="v"&&(ce={x:ce.y,y:ce.x}),xn(z,ce.x,ce.y))}e.on("connection.changed",function(b){y(b.element)}),e.on("connection.remove",function(b){var x=l(b.element);x&&an(x)}),e.on("element.marker.update",function(b){var x=b.element,C;x.waypoints&&(C=h(x),b.add?nt(C).add(b.marker):nt(C).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,C=x.waypoints,M,O;if(C){if(M=l(x,!0),O=wd(t,C,b.originalEvent),!O)return;v(M,O),O.bendpoint||g(M,O,C)}}),e.on("element.mousedown",function(b){if(Mr(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=l(x);if(C){var M=ht(".floating",C);M&&nt(M).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,C=b.newId;if(x.waypoints){var M=l(x);M&&Ee(M,{"data-element-id":C})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}s_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function QO(e){return ht(".djs-visual",e)}var c_=Math.round,mo="reconnectStart",go="reconnectEnd",_s="updateWaypoints";function Rd(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),f=s.source,p=s.target,d=s.waypoints,m;!l&&c===0?m=mo:!l&&c===d.length-1?m=go:m=_s;var h=m===_s?"connection.updateWaypoints":"connection.reconnect",y=r.allowed(h,{connection:s,source:f,target:p});if(y===!1&&(y=r.allowed(h,{connection:s,source:p,target:f})),y!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:f,target:p,insert:l,type:m}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,f=a.hover,p=s.type;s.hover=f;var d;if(f){var m=p===_s?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(m,{connection:c,source:p===mo?f:l,target:p===go?f:u}),d){s.source=p===mo?f:l,s.target=p===go?f:u;return}d===!1&&(d=s.allowed=r.allowed(m,{connection:c,source:p===go?f:u,target:p===mo?f:l})),d&&(s.source=p===go?f:u,s.target=p===mo?f:l)}}),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!==_s&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,f=s.insert,p=u.waypoints.slice(),d=s.source,m=s.target,h=s.type,y=s.hints||{},v={x:c_(a.x),y:c_(a.y)};if(!c)return!1;h===_s?(f?p.splice(l,0,v):p[l]=v,y.bendpointMove={insert:f,bendpointIndex:l},p=this.cropWaypoints(u,p),o.updateWaypoints(u,oC(p),y)):(h===mo?(y.docking="source",Ul(s)&&(y.docking="target",y.newWaypoints=p.reverse())):h===go&&(y.docking="target",Ul(s)&&(y.docking="source",y.newWaypoints=p.reverse())),o.reconnect(u,d,m,v,y))},this)}Rd.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Rd.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 Ul(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===mo)return t&&i&&t===i&&n!==i;if(r===go)return t&&n&&t===n&&n!==i}var JO="reconnectStart",eD="reconnectEnd",l_="updateWaypoints",ws="connect-ok",Yl="connect-not-ok",u_="connect-hover",p_="djs-updating",f_="djs-dragging",d_=1100;function h_(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,l=a.insert,u=c.waypoints,f=u.slice();a.waypoints=u,l&&f.splice(s,0,{x:o.x,y:o.y}),c.waypoints=f;var p=a.draggerGfx=Ed(i.getLayer("overlays"));nt(p).add("djs-dragging"),i.addMarker(c,f_),i.addMarker(c,p_)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,u_),l===l_)return;s?(i.removeMarker(c,Yl),i.addMarker(c,ws)):s===!1&&(i.removeMarker(c,ws),i.addMarker(c,Yl))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],d_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,u_),i.removeMarker(s,c?ws:Yl))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,f=a.type,p=a.connection,d=p.source,m=p.target,h=p.waypoints.slice(),y={x:o.x,y:o.y},v=a.hints||{},g={};r&&(v.connectionStart&&(g.connectionStart=v.connectionStart),v.connectionEnd&&(g.connectionEnd=v.connectionEnd),f===JO?Ul(a)?(g.connectionEnd=g.connectionEnd||y,g.source=m,g.target=u||d,h=h.reverse()):(g.connectionStart=g.connectionStart||y,g.source=u||d,g.target=m):f===eD?Ul(a)?(g.connectionStart=g.connectionStart||y,g.source=u||m,g.target=d,h=h.reverse()):(g.connectionEnd=g.connectionEnd||y,g.source=d,g.target=u||m):(g.noCropping=!0,g.noLayout=!0,h[c]=y),f===l_&&(h=e.cropWaypoints(p,h)),g.waypoints=h,r.drawPreview(a,s,g)),xn(l,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],d_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,f=a.waypoints;s.waypoints=f,an(c),i.removeMarker(s,p_),i.removeMarker(s,f_),l&&(i.removeMarker(l,ws),i.removeMarker(l,u?ws:Yl)),r&&r.cleanUp(a)})}h_.$inject=["bendpointMove","injector","eventBus","canvas"];var m_="connect-hover",g_="djs-updating";function y_(e,t,n){return Cd(e,t,e[t]+n)}function Cd(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function tD(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 Cd(t,i,s)}function v_(e){return e==="x"?"y":"x"}function b_(e,t,n){var i,r;return e.original?e.original:(i=Le(t),r=v_(n),Cd(e,r,i[r]))}function x_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var m,h=n.getGraphics(p),y=d-1,v=d,g=p.waypoints,b=g[y],x=g[v],C=wd(n,g,f),M,O,P;if(M=Qi(b,x),!!M)return O=M==="v"?"x":"y",y===0&&(b=b_(b,p.source,O)),v===g.length-1&&(x=b_(x,p.target,O)),C?P=C.point:P={x:(b.x+x.x)/2,y:(b.y+x.y)/2},m={connection:p,segmentStartIndex:y,segmentEndIndex:v,segmentStart:b,segmentEnd:x,axis:O,dragPosition:P},i.init(f,P,"connectionSegment.move",{cursor:O==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:h,context:m}})};function s(f,p){if(!a)return p;var d=f.waypoints,m;return f.waypoints=p,m=a.getCroppedWaypoints(f),f.waypoints=d,m}function c(f){r.update("connection",f.connection,f.connectionGfx)}function l(f,p,d){var m=f.newWaypoints,h=f.segmentStartIndex+p,y=m[h],v=f.segmentEndIndex+p,g=m[v],b=v_(f.axis),x=tD(d,y,g,b);xn(f.draggerGfx,x.x,x.y)}function u(f,p){var d=0,m=f.filter(function(h,y){return pp(f[y-1],f[y+1],h)?(d=y<=p?d-1:d,!1):!0});return{waypoints:m,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,m=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=a_(m,p.segmentStart,p.segmentEnd),nt(p.draggerGfx).add("djs-dragging"),n.addMarker(d,g_)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,m=p.segmentStartIndex,h=p.segmentEndIndex,y=p.segmentStart,v=p.segmentEnd,g=p.axis,b=p.originalWaypoints.slice(),x=y_(y,g,f["d"+g]),C=y_(v,g,f["d"+g]),M=b.length,O=0;b[m]=x,b[h]=C;var P,F;m<2&&(P=bn(d.source,x),m===1?P==="intersect"&&(b.shift(),b[0]=x,O--):P!=="intersect"&&(b.unshift(y),O++)),h>M-3&&(F=bn(d.target,C),h===M-2?F==="intersect"&&(b.pop(),b[b.length-1]=C):F!=="intersect"&&b.push(v)),p.newWaypoints=d.waypoints=s(d,b),l(p,O,f),p.newSegmentStartIndex=m+O,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,m_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,m_)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&an(p.draggerGfx),n.removeMarker(d,g_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var p=f.context,d=p.connection;d.waypoints=p.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var p=f.context,d=p.connection,m=p.newWaypoints,h=p.newSegmentStartIndex;m=m.map(function(C){return{original:C.original,x:Math.round(C.x),y:Math.round(C.y)}});var y=u(m,h),v=y.waypoints,g=s(d,v),b=y.segmentOffset,x={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:h+b}};o.updateWaypoints(d,g,x)})}x_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var nD=Math.abs,__=Math.round;function iD(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],nD(r-e)<=n)return r}function w_(e){return{x:e.x,y:e.y}}function E_(e){return{x:e.x+e.width,y:e.y+e.height}}function vi(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:__(e.x+e.width/2),y:__(e.y+e.height/2)}}function ma(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function tn(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 S_(e){return e.children||[]}var rD=Math.abs,R_=Math.round,Ad=10;function C_(e){function t(o,a){if(Ie(o)){for(var s=o.length;s--;)if(rD(o[s]-a)<=Ad)return o[s]}else{o=+o;var c=a%o;if(c<Ad)return a-c;if(c>o-Ad)return a-c+o}return a}function n(o,a){if(o.waypoints)return KO(a,o);if(o.width)return{x:R_(o.width/2+o.x),y:R_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,m=a.axis;if(s)return s;var h=[l[f-1],u,p,l[d+1]];return f<2&&h.unshift(n(c.source,o)),d>l.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},H(h,function(y){y&&(y=y.original||y,m==="y"&&s.horizontal.push(y.y),m==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var f=s-l,p=c-u;W(o,{dx:o.dx-f,dy:o.dy-p,x:l,y:u}),(f||a.vertical.indexOf(s)!==-1)&&tn(o,"x",l),(p||a.horizontal.indexOf(c)!==-1)&&tn(o,"y",u)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},H(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.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);!gt(s)||!c||!c.x||!c.y||(tn(o,"x",c.x),tn(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,l=c&&n(c,o),u=o.x,f=o.y,p,d;if(s){p=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,f);var m=u-p,h=f-d;W(o,{dx:o.dx-m,dy:o.dy-h,x:o.x-m,y:o.y-h}),(m||s.vertical.indexOf(u)!==-1)&&tn(o,"x",p),(h||s.horizontal.indexOf(f)!==-1)&&tn(o,"y",d)}})}C_.$inject=["eventBus"];const oD={__depends__:[rr,Fi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",s_],bendpointMove:["type",Rd],bendpointMovePreview:["type",h_],connectionSegmentMove:["type",x_],bendpointSnapping:["type",C_]};function A_(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,l=a.hover,u;if(s.hover=l,u=s.canExecute=r(c,l),!Ro(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=o(c,l),!Ro(u)&&u!==!1&&(s.source=l,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,l=s.connectionStart,u={x:a.x,y:a.y},f=s.source,p=s.target;if(!c)return!1;var d=null,m={connectionStart:Pd(s)?u:l,connectionEnd:Pd(s)?l:u};ln(c)&&(d=c),s.connection=n.connect(f,p,d,m)}),this.start=function(a,s,c,l){ln(c)||(l=c,c=Le(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}A_.$inject=["eventBus","dragging","modeling","rules"];function Pd(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var aD=1100,sD=900,P_="connect-ok",M_="connect-not-ok";function T_(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,l=o.start,u=o.startPosition,f=o.target,p=o.connectionStart||u,d=o.connectionEnd||{x:r.x,y:r.y},m=p,h=d;Pd(o)&&(m=d,h=p),i.drawPreview(o,a,{source:c||l,target:f||s,connectionStart:m,connectionEnd:h})}),t.on("connect.hover",sD,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?P_:M_)}),t.on(["connect.out","connect.cleanup"],aD,function(r){var o=r.hover;o&&(n.removeMarker(o,P_),n.removeMarker(o,M_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}T_.$inject=["injector","eventBus","canvas"];const Md={__depends__:[mi,Fi,rr],__init__:["connectPreview"],connect:["type",A_],connectPreview:["type",T_]};var cD="djs-dragger";function pr(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)}pr.$inject=["injector","canvas","graphicsFactory","elementFactory"],pr.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,l=n.connectionEnd,u=n.noLayout,f=n.noCropping,p=n.noNoop,d,m=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),cc(i),r||(r=e.getConnection=lD(function(h,y,v){return m.getConnection(h,y,v)})),t&&(d=r(t,o,a)),!d){!p&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?Le(o):c,a?Le(a):l]),this._connectionDocking&&(o||a)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},pr.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]);Ve(e,s)},pr.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&&Ba(o,s,!0)||e,t=i&&Ba(a,s,!1)||t,[e,t]},pr.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&an(e.connectionPreviewGfx)},pr.prototype.getConnection=function(e){var t=uD(e);return this._elementFactory.createConnection(t)},pr.prototype.createConnectionPreviewGfx=function(){var e=Me("g");return Ee(e,{pointerEvents:"none"}),nt(e).add(cD),Ve(this._canvas.getActiveLayer(),e),e},pr.prototype.createNoopConnection=function(e,t){return Oa([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function lD(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 uD(e){return ln(e)?e:{}}const pD={__init__:["connectionPreview"],connectionPreview:["type",pr]},ql="complex-preview";class k_{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(ql);n.filter(s=>!fD(s)).forEach(s=>{let c;gt(s)?(c=this._graphicsFactory._createContainer("connection",Me("g")),this._graphicsFactory.drawConnection(io(c),s)):(c=this._graphicsFactory._createContainer("shape",Me("g")),this._graphicsFactory.drawShape(io(c),s),xn(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 l=this._previewSupport.addDragger(s,a);gt(s)?xn(l,c.x,c.y):xn(l,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 l=this._graphicsFactory._createContainer("shape",Me("g"));this._graphicsFactory.drawShape(io(l),s,{width:c.width,height:c.height}),xn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){cc(this._canvas.getLayer(ql)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(ql)}hide(){this._canvas.hideLayer(ql)}}k_.$inject=["canvas","graphicsFactory","previewSupport"];function fD(e){return e.hidden}const dD={__depends__:[ra],__init__:["complexPreview"],complexPreview:["type",k_]},O_=Math.round;function Kl(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}Kl.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,l=o.createShape(W({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;W(l,{x:u.x-O_(l.width/2),y:u.y-O_(l.height/2)});const f=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let p=null;f&&(p=o.createConnection(f),p.waypoints=s.layoutConnection(p,{source:e,target:l}),p.waypoints=r.getCroppedWaypoints(p,e,l)),i.create({created:[l,p].filter(d=>!Ro(d))})},Kl.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Kl.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const hD={__depends__:[_l,dD,Qf],__init__:["appendPreview"],appendPreview:["type",Kl]};var D_=Math.min,I_=Math.max;function Td(e){e.preventDefault()}function Es(e){e.stopPropagation()}function mD(e){return e.nodeType===Node.TEXT_NODE}function gD(e){return[].slice.call(e)}function Ai(e){this.container=e.container,this.parent=Mt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ht("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=$n(this.autoResize,this),this.handlePaste=$n(this.handlePaste,this)}Ai.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=Si(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);W(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 l=Si(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return W(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&W(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,je.bind(a,"keydown",this.keyHandler),je.bind(a,"mousedown",Es),je.bind(a,"paste",r.handlePaste),je.bind(a,"focusout",this.focusoutHandler),i.autoResize&&je.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Ai.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)}},Ai.prototype.insertText=function(e){e=yD(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Ai.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=gD(a.childNodes),c,l;if(mD(a)){var u=n.textContent;n.textContent=u.substring(0,r)+e+u.substring(o),c=n,l=r+e.length}else if(n===this.content&&i===this.content){var f=document.createTextNode(e);this.content.insertBefore(f,s[r]),c=f,l=f.textContent.length}else{var p=s.indexOf(n),d=s.indexOf(i);s.forEach(function(m,h){h===p?m.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>p&&h<=d&&Di(m)}),c=n,l=r+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Ai.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})}},Ai.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=Mt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,f=function(m){Td(m),Es(m),s=m.clientX,c=m.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,je.bind(document,"mousemove",p),je.bind(document,"mouseup",d)},p=function(m){Td(m),Es(m);var h=D_(I_(l+m.clientX-s,i),o),y=D_(I_(u+m.clientY-c,r),a);t.style.width=h+"px",t.style.height=y+"px",e.resizeHandler({width:l,height:u,dx:m.clientX-s,dy:m.clientY-c})},d=function(m){Td(m),Es(m),je.unbind(document,"mousemove",p,!1),je.unbind(document,"mouseup",d,!1)};je.bind(n,"mousedown",f)}W(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)},Ai.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),je.unbind(t,"keydown",this.keyHandler),je.unbind(t,"mousedown",Es),je.unbind(t,"input",this.autoResize),je.unbind(t,"paste",this.handlePaste),je.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Di(n)),Di(e)},Ai.prototype.getValue=function(){return this.content.innerText.trim()},Ai.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Ai.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 yD(e){return e.replace(/\r\n|\r|\n/g,`
316
- `)}function Qn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Ai({container:t.getContainer(),keyHandler:$n(this._handleKey,this),resizeHandler:$n(this._handleResize,this),focusoutHandler:$n(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Qn.$inject=["eventBus","canvas"],Qn.prototype.registerProvider=function(e){this._providers.push(e)},Qn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Qn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Qn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Qn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Qn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Qn.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()}},Qn.prototype.getValue=function(){return this._textbox.getValue()},Qn.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()},Qn.prototype._handleResize=function(e){this._fire("resize",e)},Qn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Qn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=wt(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 L_={__depends__:[Zc],__init__:["directEditing"],directEditing:["type",Qn]};function vD(e){return function(t){var n=t.target,i=oe(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===et(e);return!o||!a||!s||!c}}const bD={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 te(e,t={}){var n=bD[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var xD=[te("none-start-event",{actionName:"replace-with-none-start"}),te("none-intermediate-throwing"),te("none-end-event",{actionName:"replace-with-none-end"}),te("message-start"),te("timer-start"),te("conditional-start"),te("signal-start")],_D=[te("none-start-event",{actionName:"replace-with-none-start"}),te("none-intermediate-throwing"),te("none-end-event",{actionName:"replace-with-none-end"})],wD=[te("none-start-event",{actionName:"replace-with-none-start"}),te("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),te("none-end-event",{actionName:"replace-with-none-end"}),te("message-intermediate-catch"),te("message-intermediate-throw"),te("timer-intermediate-catch"),te("escalation-intermediate-throw"),te("conditional-intermediate-catch"),te("link-intermediate-catch"),te("link-intermediate-throw"),te("compensation-intermediate-throw"),te("signal-intermediate-catch"),te("signal-intermediate-throw")],ED=[te("none-start-event",{actionName:"replace-with-none-start"}),te("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),te("none-end-event",{actionName:"replace-with-none-end"}),te("message-end"),te("escalation-end"),te("error-end"),te("cancel-end"),te("compensation-end"),te("signal-end"),te("terminate-end")],SD=[te("exclusive-gateway"),te("parallel-gateway"),te("inclusive-gateway"),te("complex-gateway"),te("event-based-gateway")],RD=[te("transaction"),te("event-subprocess"),te("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),te("collapsed-subprocess")],CD=[te("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),te("transaction"),te("event-subprocess"),te("collapsed-ad-hoc-subprocess")],B_=[te("transaction"),te("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),te("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),te("event-subprocess")],AD=B_,N_=[te("task"),te("user-task"),te("service-task"),te("send-task"),te("receive-task"),te("manual-task"),te("rule-task"),te("script-task"),te("call-activity"),te("collapsed-subprocess"),te("expanded-subprocess"),te("collapsed-ad-hoc-subprocess"),te("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],PD=[te("data-store-reference")],MD=[te("data-object-reference")],TD=[te("message-boundary"),te("timer-boundary"),te("escalation-boundary"),te("conditional-boundary"),te("error-boundary"),te("cancel-boundary"),te("signal-boundary"),te("compensation-boundary"),te("non-interrupting-message-boundary"),te("non-interrupting-timer-boundary"),te("non-interrupting-escalation-boundary"),te("non-interrupting-conditional-boundary"),te("non-interrupting-signal-boundary")],kD=[te("message-start"),te("timer-start"),te("conditional-start"),te("signal-start"),te("error-start"),te("escalation-start"),te("compensation-start"),te("non-interrupting-message-start"),te("non-interrupting-timer-start"),te("non-interrupting-conditional-start"),te("non-interrupting-signal-start"),te("non-interrupting-escalation-start")],OD=[{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"}],DD=[te("expanded-pool"),te("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],ID={"bpmn:MessageEventDefinition":[te("message-start"),te("message-intermediate-catch"),te("message-intermediate-throw"),te("message-end")],"bpmn:TimerEventDefinition":[te("timer-start"),te("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[te("conditional-start"),te("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[te("signal-start"),te("signal-intermediate-catch"),te("signal-intermediate-throw"),te("signal-end")],"bpmn:ErrorEventDefinition":[te("error-start"),te("error-end")],"bpmn:EscalationEventDefinition":[te("escalation-start"),te("escalation-intermediate-throw"),te("escalation-end")],"bpmn:CompensateEventDefinition":[te("compensation-start"),te("compensation-intermediate-throw"),te("compensation-end")]};const $_={"start-event-non-interrupting":`
315
+ </svg>`},zO=900;function fa(e,t,n,i){e.registerProvider(zO,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}fa.$inject=["contextPad","popupMenu","translate","canvas"],fa.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},fa.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},fa.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${a_.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);W(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},fa.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 GO=["left","center","right","top","middle","bottom"];function vs(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}vs.$inject=["popupMenu","alignElements","translate","rules"],vs.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},vs.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},vs.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return H(GO,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:a_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Gl(e){hi.call(this,e)}Gl.$inject=["eventBus"],we(Gl,hi),Gl.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Qe(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=pc(n),n.length<2?!1:n})};const VO={__depends__:[tO,yx,wd],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",fa],alignElementsMenuProvider:["type",vs],bpmnAlignElements:["type",Gl]};function ur(e,t,n,i){ne.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,l=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],l)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=bu(Ro(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=Co(s,function(f){return f.parent.id});H(u,function(f,p){Le(l)&&(f=f.filter(function(d){return At(l,Ao({id:d.id}))})),r._expand(f,p)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,l=c.parent;s&&s.autoResize===!1||l&&r._expand([c],l)})}ur.$inject=["eventBus","elementRegistry","modeling","rules"],we(ur,ne),ur.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=De(Zt(e)),o=De(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),hc(W({},o,a))},ur.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(WO(i,t)){var r=UO(Ei(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},ur.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},ur.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},ur.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function WO(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function UO(e,t){var n="";return e=De(e),t=De(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 Vl(e){e.invoke(ur,this)}Vl.$inject=["injector"],we(Vl,ur),Vl.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 bs(e){hi.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}bs.$inject=["eventBus"],we(bs,hi),bs.prototype.canResize=function(e,t){return!1};function Wl(e,t){bs.call(this,e),this._modeling=t}we(Wl,bs),Wl.$inject=["eventBus","modeling"],Wl.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 H(e,function(i){if(S(i,"bpmn:Lane")||Xe(i)){n=!1;return}}),n};const YO={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Vl],bpmnAutoResizeProvider:["type",Wl]};function da(e,t,n){this._canvas=n,this._opts=W({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()})}da.$inject=["config.autoScroll","eventBus","canvas"],da.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++)qO(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 qO(e,t,n){return t<e&&e<n}da.prototype.stopScroll=function(){clearTimeout(this._scrolling)},da.prototype.setOptions=function(e){this._opts=W({},this._opts,e)},da.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=ao(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const KO={__depends__:[rr],__init__:["autoScroll"],autoScroll:["type",da]};var s_="djs-bendpoint",c_="djs-segment-dragger";function XO(e,t){var n=ao(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 Ed(e,t,n){var i=XO(e,n),r=$p(t,i);return r}function Sd(e,t){var n=Te("g");ot(n).add(s_),We(e,n);var i=Te("circle");Ee(i,{cx:0,cy:0,r:4}),ot(i).add("djs-visual"),We(n,i);var r=Te("circle");return Ee(r,{cx:0,cy:0,r:10}),ot(r).add("djs-hit"),We(n,r),t&&ot(n).add(t),n}function ZO(e,t,n,i){var r=Te("g");We(e,r);var o=18,a=6,s=11,c=JO(t,n,i),l=a+s,u=Te("rect");Ee(u,{x:-o/2,y:-a/2,width:o,height:a}),ot(u).add("djs-visual"),We(r,u);var f=Te("rect");return Ee(f,{x:-c/2,y:-l/2,width:c,height:l}),ot(f).add("djs-hit"),We(r,f),Pg(r,i==="v"?90:0),r}function l_(e,t,n){var i=Te("g"),r=dp(t,n),o=Qi(t,n);return We(e,i),ZO(i,t,n,o),ot(i).add(c_),ot(i).add(o==="h"?"horizontal":"vertical"),_n(i,r.x,r.y),i}function Rd(e){return Math.abs(Math.round(e*2/3))}function QO(e,t){var n=eD(e,t);return Vp(e,n)}function JO(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Rd(n==="h"?i:r)}function eD(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=hy(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function u_(e,t,n,i,r){function o(b,_,C){var M=b.index,O=b.point,P,F,I,B,z,ce;return M<=0||b.bendpoint?!1:(P=_[M-1],F=_[M],I=dp(P,F),B=Qi(P,F),z=Math.abs(O.x-I.x),ce=Math.abs(O.y-I.y),B&&z<=C&&ce<=C)}function a(b,_){var C=b.waypoints,M,O,P,F;return _.index<=0||_.bendpoint||(M={start:C[_.index-1],end:C[_.index]},O=Qi(M.start,M.end),!O)?null:(O==="h"?P=M.end.x-M.start.x:P=M.end.y-M.start.y,F=Rd(P)/2,F)}function s(b,_){var C=_.waypoints,M=Ed(t,C,b),O;if(M){O=a(_,M);var P;if(o(M,C,O)?P=r.start(b,_,M.index):P=i.start(b,_,M.index,!M.bendpoint),P!==!1)return!0}}function c(b,_,C){je.bind(b,_,function(M){n.triggerMouseEvent(_,M,C),M.stopPropagation()})}function l(b,_){var C=t.getLayer("overlays"),M=bt('.djs-bendpoints[data-element-id="'+ds(b.id)+'"]',C);return!M&&_&&(M=Te("g"),Ee(M,{"data-element-id":b.id}),ot(M).add("djs-bendpoints"),We(C,M),c(M,"mousedown",b),c(M,"click",b),c(M,"dblclick",b)),M}function u(b,_){return bt('.djs-segment-dragger[data-segment-idx="'+b+'"]',_)}function f(b,_){_.waypoints.forEach(function(C,M){var O=Sd(b);We(b,O),_n(O,C.x,C.y)}),Sd(b,"floating")}function p(b,_){for(var C=_.waypoints,M,O,P,F=1;F<C.length;F++)M=C[F-1],O=C[F],Qi(M,O)&&(P=l_(b,M,O),Ee(P,{"data-segment-idx":F}),c(P,"mousemove",_))}function d(b){H(sc("."+s_,b),function(_){an(_)})}function m(b){H(sc("."+c_,b),function(_){an(_)})}function h(b){var _=l(b);return _||(_=l(b,!0),f(_,b),p(_,b)),_}function y(b){var _=l(b);_&&(m(_),d(_),p(_,b),f(_,b))}function v(b,_){var C=bt(".floating",b),M=_.point;C&&(_n(C,M.x,M.y),ot(C).add("positioned"))}function g(b,_,C){var M=u(_.index,b),O=C[_.index-1],P=C[_.index],F=_.point,I=dp(O,P),B=Qi(O,P),z,ce;M&&(z=tD(M),ce={x:F.x-I.x,y:F.y-I.y},B==="v"&&(ce={x:ce.y,y:ce.x}),_n(z,ce.x,ce.y))}e.on("connection.changed",function(b){y(b.element)}),e.on("connection.remove",function(b){var _=l(b.element);_&&an(_)}),e.on("element.marker.update",function(b){var _=b.element,C;_.waypoints&&(C=h(_),b.add?ot(C).add(b.marker):ot(C).remove(b.marker))}),e.on("element.mousemove",function(b){var _=b.element,C=_.waypoints,M,O;if(C){if(M=l(_,!0),O=Ed(t,C,b.originalEvent),!O)return;v(M,O),O.bendpoint||g(M,O,C)}}),e.on("element.mousedown",function(b){if(Mr(b)){var _=b.originalEvent,C=b.element;if(C.waypoints)return s(_,C)}}),e.on("selection.changed",function(b){var _=b.newSelection,C=_[0];C&&C.waypoints&&h(C)}),e.on("element.hover",function(b){var _=b.element;_.waypoints&&h(_)}),e.on("element.out",function(b){var _=b.element;if(_.waypoints){var C=l(_);if(C){var M=bt(".floating",C);M&&ot(M).remove("positioned")}}}),e.on("element.updateId",function(b){var _=b.element,C=b.newId;if(_.waypoints){var M=l(_);M&&Ee(M,{"data-element-id":C})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}u_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function tD(e){return bt(".djs-visual",e)}var p_=Math.round,mo="reconnectStart",go="reconnectEnd",xs="updateWaypoints";function Cd(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,l){var u=n.getGraphics(s),f=s.source,p=s.target,d=s.waypoints,m;!l&&c===0?m=mo:!l&&c===d.length-1?m=go:m=xs;var h=m===xs?"connection.updateWaypoints":"connection.reconnect",y=r.allowed(h,{connection:s,source:f,target:p});if(y===!1&&(y=r.allowed(h,{connection:s,source:p,target:f})),y!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:u,context:{allowed:y,bendpointIndex:c,connection:s,source:f,target:p,insert:l,type:m}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,l=c.source,u=c.target,f=a.hover,p=s.type;s.hover=f;var d;if(f){var m=p===xs?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(m,{connection:c,source:p===mo?f:l,target:p===go?f:u}),d){s.source=p===mo?f:l,s.target=p===go?f:u;return}d===!1&&(d=s.allowed=r.allowed(m,{connection:c,source:p===go?f:u,target:p===mo?f:l})),d&&(s.source=p===go?f:u,s.target=p===mo?f:l)}}),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!==xs&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,l=s.bendpointIndex,u=s.connection,f=s.insert,p=u.waypoints.slice(),d=s.source,m=s.target,h=s.type,y=s.hints||{},v={x:p_(a.x),y:p_(a.y)};if(!c)return!1;h===xs?(f?p.splice(l,0,v):p[l]=v,y.bendpointMove={insert:f,bendpointIndex:l},p=this.cropWaypoints(u,p),o.updateWaypoints(u,cC(p),y)):(h===mo?(y.docking="source",Ul(s)&&(y.docking="target",y.newWaypoints=p.reverse())):h===go&&(y.docking="target",Ul(s)&&(y.docking="source",y.newWaypoints=p.reverse())),o.reconnect(u,d,m,v,y))},this)}Cd.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Cd.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 Ul(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===mo)return t&&i&&t===i&&n!==i;if(r===go)return t&&n&&t===n&&n!==i}var nD="reconnectStart",iD="reconnectEnd",f_="updateWaypoints",_s="connect-ok",Yl="connect-not-ok",d_="connect-hover",h_="djs-updating",m_="djs-dragging",g_=1100;function y_(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,l=a.insert,u=c.waypoints,f=u.slice();a.waypoints=u,l&&f.splice(s,0,{x:o.x,y:o.y}),c.waypoints=f;var p=a.draggerGfx=Sd(i.getLayer("overlays"));ot(p).add("djs-dragging"),i.addMarker(c,m_),i.addMarker(c,h_)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,l=a.type;if(c){if(i.addMarker(c,d_),l===f_)return;s?(i.removeMarker(c,Yl),i.addMarker(c,_s)):s===!1&&(i.removeMarker(c,_s),i.addMarker(c,Yl))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],g_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,d_),i.removeMarker(s,c?_s:Yl))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,l=a.draggerGfx,u=a.hover,f=a.type,p=a.connection,d=p.source,m=p.target,h=p.waypoints.slice(),y={x:o.x,y:o.y},v=a.hints||{},g={};r&&(v.connectionStart&&(g.connectionStart=v.connectionStart),v.connectionEnd&&(g.connectionEnd=v.connectionEnd),f===nD?Ul(a)?(g.connectionEnd=g.connectionEnd||y,g.source=m,g.target=u||d,h=h.reverse()):(g.connectionStart=g.connectionStart||y,g.source=u||d,g.target=m):f===iD?Ul(a)?(g.connectionStart=g.connectionStart||y,g.source=u||m,g.target=d,h=h.reverse()):(g.connectionEnd=g.connectionEnd||y,g.source=d,g.target=u||m):(g.noCropping=!0,g.noLayout=!0,h[c]=y),f===f_&&(h=e.cropWaypoints(p,h)),g.waypoints=h,r.drawPreview(a,s,g)),_n(l,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],g_,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,l=a.hover,u=a.target,f=a.waypoints;s.waypoints=f,an(c),i.removeMarker(s,h_),i.removeMarker(s,m_),l&&(i.removeMarker(l,_s),i.removeMarker(l,u?_s:Yl)),r&&r.cleanUp(a)})}y_.$inject=["bendpointMove","injector","eventBus","canvas"];var v_="connect-hover",b_="djs-updating";function x_(e,t,n){return Ad(e,t,e[t]+n)}function Ad(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function rD(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 Ad(t,i,s)}function __(e){return e==="x"?"y":"x"}function w_(e,t,n){var i,r;return e.original?e.original:(i=Ie(t),r=__(n),Ad(e,r,i[r]))}function E_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var m,h=n.getGraphics(p),y=d-1,v=d,g=p.waypoints,b=g[y],_=g[v],C=Ed(n,g,f),M,O,P;if(M=Qi(b,_),!!M)return O=M==="v"?"x":"y",y===0&&(b=w_(b,p.source,O)),v===g.length-1&&(_=w_(_,p.target,O)),C?P=C.point:P={x:(b.x+_.x)/2,y:(b.y+_.y)/2},m={connection:p,segmentStartIndex:y,segmentEndIndex:v,segmentStart:b,segmentEnd:_,axis:O,dragPosition:P},i.init(f,P,"connectionSegment.move",{cursor:O==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:h,context:m}})};function s(f,p){if(!a)return p;var d=f.waypoints,m;return f.waypoints=p,m=a.getCroppedWaypoints(f),f.waypoints=d,m}function c(f){r.update("connection",f.connection,f.connectionGfx)}function l(f,p,d){var m=f.newWaypoints,h=f.segmentStartIndex+p,y=m[h],v=f.segmentEndIndex+p,g=m[v],b=__(f.axis),_=rD(d,y,g,b);_n(f.draggerGfx,_.x,_.y)}function u(f,p){var d=0,m=f.filter(function(h,y){return fp(f[y-1],f[y+1],h)?(d=y<=p?d-1:d,!1):!0});return{waypoints:m,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,m=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=l_(m,p.segmentStart,p.segmentEnd),ot(p.draggerGfx).add("djs-dragging"),n.addMarker(d,b_)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,m=p.segmentStartIndex,h=p.segmentEndIndex,y=p.segmentStart,v=p.segmentEnd,g=p.axis,b=p.originalWaypoints.slice(),_=x_(y,g,f["d"+g]),C=x_(v,g,f["d"+g]),M=b.length,O=0;b[m]=_,b[h]=C;var P,F;m<2&&(P=xn(d.source,_),m===1?P==="intersect"&&(b.shift(),b[0]=_,O--):P!=="intersect"&&(b.unshift(y),O++)),h>M-3&&(F=xn(d.target,C),h===M-2?F==="intersect"&&(b.pop(),b[b.length-1]=C):F!=="intersect"&&b.push(v)),p.newWaypoints=d.waypoints=s(d,b),l(p,O,f),p.newSegmentStartIndex=m+O,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,v_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,v_)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&an(p.draggerGfx),n.removeMarker(d,b_)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var p=f.context,d=p.connection;d.waypoints=p.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var p=f.context,d=p.connection,m=p.newWaypoints,h=p.newSegmentStartIndex;m=m.map(function(C){return{original:C.original,x:Math.round(C.x),y:Math.round(C.y)}});var y=u(m,h),v=y.waypoints,g=s(d,v),b=y.segmentOffset,_={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:h+b}};o.updateWaypoints(d,g,_)})}E_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var oD=Math.abs,S_=Math.round;function aD(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],oD(r-e)<=n)return r}function R_(e){return{x:e.x,y:e.y}}function C_(e){return{x:e.x+e.width,y:e.y+e.height}}function vi(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:S_(e.x+e.width/2),y:S_(e.y+e.height/2)}}function ha(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function tn(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 A_(e){return e.children||[]}var sD=Math.abs,P_=Math.round,Pd=10;function M_(e){function t(o,a){if(Le(o)){for(var s=o.length;s--;)if(sD(o[s]-a)<=Pd)return o[s]}else{o=+o;var c=a%o;if(c<Pd)return a-c;if(c>o-Pd)return a-c+o}return a}function n(o,a){if(o.waypoints)return QO(a,o);if(o.width)return{x:P_(o.width/2+o.x),y:P_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,m=a.axis;if(s)return s;var h=[l[f-1],u,p,l[d+1]];return f<2&&h.unshift(n(c.source,o)),d>l.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},H(h,function(y){y&&(y=y.original||y,m==="y"&&s.horizontal.push(y.y),m==="x"&&s.vertical.push(y.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,l,u;if(a){l=t(a.vertical,s),u=t(a.horizontal,c);var f=s-l,p=c-u;W(o,{dx:o.dx-f,dy:o.dy-p,x:l,y:u}),(f||a.vertical.indexOf(s)!==-1)&&tn(o,"x",l),(p||a.horizontal.indexOf(c)!==-1)&&tn(o,"y",u)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var l=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},H(l,function(u){u&&(u=u.original||u,a.horizontal.push(u.y),a.vertical.push(u.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);!wt(s)||!c||!c.x||!c.y||(tn(o,"x",c.x),tn(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,l=c&&n(c,o),u=o.x,f=o.y,p,d;if(s){p=t(l?s.vertical.concat([l.x]):s.vertical,u),d=t(l?s.horizontal.concat([l.y]):s.horizontal,f);var m=u-p,h=f-d;W(o,{dx:o.dx-m,dy:o.dy-h,x:o.x-m,y:o.y-h}),(m||s.vertical.indexOf(u)!==-1)&&tn(o,"x",p),(h||s.horizontal.indexOf(f)!==-1)&&tn(o,"y",d)}})}M_.$inject=["eventBus"];const cD={__depends__:[rr,$i],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",u_],bendpointMove:["type",Cd],bendpointMovePreview:["type",y_],connectionSegmentMove:["type",E_],bendpointSnapping:["type",M_]};function T_(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,l=a.hover,u;if(s.hover=l,u=s.canExecute=r(c,l),!So(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=o(c,l),!So(u)&&u!==!1&&(s.source=l,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,l=s.connectionStart,u={x:a.x,y:a.y},f=s.source,p=s.target;if(!c)return!1;var d=null,m={connectionStart:Md(s)?u:l,connectionEnd:Md(s)?l:u};un(c)&&(d=c),s.connection=n.connect(f,p,d,m)}),this.start=function(a,s,c,l){un(c)||(l=c,c=Ie(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}T_.$inject=["eventBus","dragging","modeling","rules"];function Md(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var lD=1100,uD=900,k_="connect-ok",O_="connect-not-ok";function D_(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,l=o.start,u=o.startPosition,f=o.target,p=o.connectionStart||u,d=o.connectionEnd||{x:r.x,y:r.y},m=p,h=d;Md(o)&&(m=d,h=p),i.drawPreview(o,a,{source:c||l,target:f||s,connectionStart:m,connectionEnd:h})}),t.on("connect.hover",uD,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?k_:O_)}),t.on(["connect.out","connect.cleanup"],lD,function(r){var o=r.hover;o&&(n.removeMarker(o,k_),n.removeMarker(o,O_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}D_.$inject=["injector","eventBus","canvas"];const Td={__depends__:[mi,$i,rr],__init__:["connectPreview"],connect:["type",T_],connectPreview:["type",D_]};var pD="djs-dragger";function pr(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)}pr.$inject=["injector","canvas","graphicsFactory","elementFactory"],pr.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,l=n.connectionEnd,u=n.noLayout,f=n.noCropping,p=n.noNoop,d,m=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),cc(i),r||(r=e.getConnection=fD(function(h,y,v){return m.getConnection(h,y,v)})),t&&(d=r(t,o,a)),!d){!p&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!u&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:l,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?Ie(o):c,a?Ie(a):l]),this._connectionDocking&&(o||a)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},pr.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Ie(n),o=t.connectionEnd||Ie(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);We(e,s)},pr.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&&Ia(o,s,!0)||e,t=i&&Ia(a,s,!1)||t,[e,t]},pr.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&an(e.connectionPreviewGfx)},pr.prototype.getConnection=function(e){var t=dD(e);return this._elementFactory.createConnection(t)},pr.prototype.createConnectionPreviewGfx=function(){var e=Te("g");return Ee(e,{pointerEvents:"none"}),ot(e).add(pD),We(this._canvas.getActiveLayer(),e),e},pr.prototype.createNoopConnection=function(e,t){return ka([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function fD(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 dD(e){return un(e)?e:{}}const hD={__init__:["connectionPreview"],connectionPreview:["type",pr]},ql="complex-preview";class L_{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(ql);n.filter(s=>!mD(s)).forEach(s=>{let c;wt(s)?(c=this._graphicsFactory._createContainer("connection",Te("g")),this._graphicsFactory.drawConnection(io(c),s)):(c=this._graphicsFactory._createContainer("shape",Te("g")),this._graphicsFactory.drawShape(io(c),s),_n(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 l=this._previewSupport.addDragger(s,a);wt(s)?_n(l,c.x,c.y):_n(l,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 l=this._graphicsFactory._createContainer("shape",Te("g"));this._graphicsFactory.drawShape(io(l),s,{width:c.width,height:c.height}),_n(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){cc(this._canvas.getLayer(ql)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(ql)}hide(){this._canvas.hideLayer(ql)}}L_.$inject=["canvas","graphicsFactory","previewSupport"];function mD(e){return e.hidden}const gD={__depends__:[ia],__init__:["complexPreview"],complexPreview:["type",L_]},I_=Math.round;function Kl(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}Kl.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,l=o.createShape(W({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;W(l,{x:u.x-I_(l.width/2),y:u.y-I_(l.height/2)});const f=c.allowed("connection.create",{source:e,target:l,hints:{targetParent:e.parent}});let p=null;f&&(p=o.createConnection(f),p.waypoints=s.layoutConnection(p,{source:e,target:l}),p.waypoints=r.getCroppedWaypoints(p,e,l)),i.create({created:[l,p].filter(d=>!So(d))})},Kl.prototype.cleanUp=function(){this._complexPreview.cleanUp()},Kl.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const yD={__depends__:[_l,gD,Jf],__init__:["appendPreview"],appendPreview:["type",Kl]};var B_=Math.min,N_=Math.max;function kd(e){e.preventDefault()}function ws(e){e.stopPropagation()}function vD(e){return e.nodeType===Node.TEXT_NODE}function bD(e){return[].slice.call(e)}function Ci(e){this.container=e.container,this.parent=kt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=bt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Fn(this.autoResize,this),this.handlePaste=Fn(this.handlePaste,this)}Ci.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=Ei(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);W(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 l=Ei(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return W(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&W(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),a.innerText=n,je.bind(a,"keydown",this.keyHandler),je.bind(a,"mousedown",ws),je.bind(a,"paste",r.handlePaste),je.bind(a,"focusout",this.focusoutHandler),i.autoResize&&je.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Ci.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)}},Ci.prototype.insertText=function(e){e=xD(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Ci.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=bD(a.childNodes),c,l;if(vD(a)){var u=n.textContent;n.textContent=u.substring(0,r)+e+u.substring(o),c=n,l=r+e.length}else if(n===this.content&&i===this.content){var f=document.createTextNode(e);this.content.insertBefore(f,s[r]),c=f,l=f.textContent.length}else{var p=s.indexOf(n),d=s.indexOf(i);s.forEach(function(m,h){h===p?m.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>p&&h<=d&&Oi(m)}),c=n,l=r+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Ci.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})}},Ci.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=kt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,f=function(m){kd(m),ws(m),s=m.clientX,c=m.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,je.bind(document,"mousemove",p),je.bind(document,"mouseup",d)},p=function(m){kd(m),ws(m);var h=B_(N_(l+m.clientX-s,i),o),y=B_(N_(u+m.clientY-c,r),a);t.style.width=h+"px",t.style.height=y+"px",e.resizeHandler({width:l,height:u,dx:m.clientX-s,dy:m.clientY-c})},d=function(m){kd(m),ws(m),je.unbind(document,"mousemove",p,!1),je.unbind(document,"mouseup",d,!1)};je.bind(n,"mousedown",f)}W(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)},Ci.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),je.unbind(t,"keydown",this.keyHandler),je.unbind(t,"mousedown",ws),je.unbind(t,"input",this.autoResize),je.unbind(t,"paste",this.handlePaste),je.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Oi(n)),Oi(e)},Ci.prototype.getValue=function(){return this.content.innerText.trim()},Ci.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Ci.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 xD(e){return e.replace(/\r\n|\r|\n/g,`
316
+ `)}function Jn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Ci({container:t.getContainer(),keyHandler:Fn(this._handleKey,this),resizeHandler:Fn(this._handleResize,this),focusoutHandler:Fn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Jn.$inject=["eventBus","canvas"],Jn.prototype.registerProvider=function(e){this._providers.push(e)},Jn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Jn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Jn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Jn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Jn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Jn.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue(),o=e.context.text;(r!==o||i.height!==n.height||i.width!==n.width)&&(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},Jn.prototype.getValue=function(){return this._textbox.getValue()},Jn.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;if(t===27)return e.preventDefault(),this.cancel();if(t===13&&!e.shiftKey)return e.preventDefault(),this.complete()},Jn.prototype._handleResize=function(e){this._fire("resize",e)},Jn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Jn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=At(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 $_={__depends__:[Zc],__init__:["directEditing"],directEditing:["type",Jn]};function _D(e){return function(t){var n=t.target,i=oe(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===nt(e);return!o||!a||!s||!c}}const wD={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 te(e,t={}){var n=wD[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var ED=[te("none-start-event",{actionName:"replace-with-none-start"}),te("none-intermediate-throwing"),te("none-end-event",{actionName:"replace-with-none-end"}),te("message-start"),te("timer-start"),te("conditional-start"),te("signal-start")],SD=[te("none-start-event",{actionName:"replace-with-none-start"}),te("none-intermediate-throwing"),te("none-end-event",{actionName:"replace-with-none-end"})],RD=[te("none-start-event",{actionName:"replace-with-none-start"}),te("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),te("none-end-event",{actionName:"replace-with-none-end"}),te("message-intermediate-catch"),te("message-intermediate-throw"),te("timer-intermediate-catch"),te("escalation-intermediate-throw"),te("conditional-intermediate-catch"),te("link-intermediate-catch"),te("link-intermediate-throw"),te("compensation-intermediate-throw"),te("signal-intermediate-catch"),te("signal-intermediate-throw")],CD=[te("none-start-event",{actionName:"replace-with-none-start"}),te("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),te("none-end-event",{actionName:"replace-with-none-end"}),te("message-end"),te("escalation-end"),te("error-end"),te("cancel-end"),te("compensation-end"),te("signal-end"),te("terminate-end")],AD=[te("exclusive-gateway"),te("parallel-gateway"),te("inclusive-gateway"),te("complex-gateway"),te("event-based-gateway")],PD=[te("transaction"),te("event-subprocess"),te("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),te("collapsed-subprocess")],MD=[te("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),te("transaction"),te("event-subprocess"),te("collapsed-ad-hoc-subprocess")],F_=[te("transaction"),te("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),te("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),te("event-subprocess")],TD=F_,j_=[te("task"),te("user-task"),te("service-task"),te("send-task"),te("receive-task"),te("manual-task"),te("rule-task"),te("script-task"),te("call-activity"),te("collapsed-subprocess"),te("expanded-subprocess"),te("collapsed-ad-hoc-subprocess"),te("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],kD=[te("data-store-reference")],OD=[te("data-object-reference")],DD=[te("message-boundary"),te("timer-boundary"),te("escalation-boundary"),te("conditional-boundary"),te("error-boundary"),te("cancel-boundary"),te("signal-boundary"),te("compensation-boundary"),te("non-interrupting-message-boundary"),te("non-interrupting-timer-boundary"),te("non-interrupting-escalation-boundary"),te("non-interrupting-conditional-boundary"),te("non-interrupting-signal-boundary")],LD=[te("message-start"),te("timer-start"),te("conditional-start"),te("signal-start"),te("error-start"),te("escalation-start"),te("compensation-start"),te("non-interrupting-message-start"),te("non-interrupting-timer-start"),te("non-interrupting-conditional-start"),te("non-interrupting-signal-start"),te("non-interrupting-escalation-start")],ID=[{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"}],BD=[te("expanded-pool"),te("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],ND={"bpmn:MessageEventDefinition":[te("message-start"),te("message-intermediate-catch"),te("message-intermediate-throw"),te("message-end")],"bpmn:TimerEventDefinition":[te("timer-start"),te("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[te("conditional-start"),te("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[te("signal-start"),te("signal-intermediate-catch"),te("signal-intermediate-throw"),te("signal-end")],"bpmn:ErrorEventDefinition":[te("error-start"),te("error-end")],"bpmn:EscalationEventDefinition":[te("escalation-start"),te("escalation-intermediate-throw"),te("escalation-end")],"bpmn:CompensateEventDefinition":[te("compensation-start"),te("compensation-intermediate-throw"),te("compensation-end")]};const H_={"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 bi(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()}bi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],bi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},bi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Ie(e)||!n.allowed("shape.replace",{element:e}))return{};var a=vD(e);return S(t,"bpmn:DataObjectReference")?this._createEntries(e,PD):S(t,"bpmn:DataStoreReference")&&!S(e.parent,"bpmn:Collaboration")?this._createEntries(e,MD):(S(t,"bpmn:Event")&&!S(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=ID[r]||[],!Tn(t.$parent)&&S(t.$parent,"bpmn:SubProcess")&&(i=Qe(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),S(t,"bpmn:StartEvent")&&!S(t.$parent,"bpmn:SubProcess")?(o=Qe(xD.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Participant")?(o=Qe(DD,function(c){return et(e)!==c.target.isExpanded}),this._createEntries(e,o)):S(t,"bpmn:StartEvent")&&Tn(t.$parent)?(o=Qe(kD.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,f=t.isInterrupting===u;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):S(t,"bpmn:StartEvent")&&!Tn(t.$parent)&&S(t.$parent,"bpmn:SubProcess")?(o=Qe(_D.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:EndEvent")?(o=Qe(ED.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!S(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):S(t,"bpmn:BoundaryEvent")?(o=Qe(TD,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!S(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,f=t.cancelActivity==u;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):S(t,"bpmn:IntermediateCatchEvent")||S(t,"bpmn:IntermediateThrowEvent")?(o=Qe(wD.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Gateway")?(o=Qe(SD,a),this._createEntries(e,o)):S(t,"bpmn:Transaction")?(o=Qe(B_,a),this._createEntries(e,o)):Tn(t)&&et(e)?(o=Qe(AD,a),this._createEntries(e,o)):S(t,"bpmn:AdHocSubProcess")&&et(e)?(o=Qe(CD,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&et(e)?(o=Qe(RD,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&!et(e)?(o=Qe(N_,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,o)):S(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,OD):S(t,"bpmn:FlowNode")?(o=Qe(N_,a),this._createEntries(e,o)):{})},bi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return S(e,"bpmn:Activity")&&!Tn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),S(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),S(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Cy(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},bi.prototype._createEntries=function(e,t){var n={},i=this;return H(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},bi.prototype._createSequenceFlowEntries=function(e,t){var n=oe(e),i={},r=this._modeling,o=this._moddle,a=this;return H(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},bi.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}},bi.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var f=e.businessObject.get("loopCharacteristics");f&&S(f,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,f,{isSequential:u.options.isSequential}):(f=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:f}))}var r=oe(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"}}}},bi.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}}},bi.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},bi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=oe(e),i=this,r=Ay(e),o=S(e,"bpmn:BoundaryEvent")?$_["intermediate-event-non-interrupting"]:$_["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 LD={__depends__:[_d,Yv,_l],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",bi]};function Ss(e,t,n,i,r,o,a,s,c,l,u,f,p){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=l,this._rules=u,this._translate=f,this._eventBus=n,this._appendPreview=p,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var m=d.context,h=m.shape;if(!(!Ka(d)||!i.isOpen(h))){var y=i.getEntries(h);y.replace&&y.replace.action.click(d,h)}}),n.on("contextPad.close",function(){p.cleanUp()})}Ss.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Ss.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&W(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Ss.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Ie(t)?Xr(e,n=>t.includes(n)):t},Ss.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,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&W(u,m()),u;var f=e.businessObject;function p(b,x){r.start(b,x)}function d(b,x){n.removeElements([x])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(b){var x=5,C=t.getPad(b).html,M=C.getBoundingClientRect(),O={x:M.left,y:M.bottom+x};return O}function y(b,x,C,M){function O(D,I){var z=i.createShape(W({type:b},M));o.start(D,z,{source:I})}var P=s?function(D,I){var z=i.createShape(W({type:b},M));s.append(I,z)}:O,F=s?function(D,I){return l.create(I,b,M),()=>{l.cleanUp()}}:null;return{group:"model",className:x,title:C,action:{dragstart:O,click:P,hover:F}}}function v(b){return function(x,C){n.splitLane(C,b),t.open(C,!0)}}if(Ze(f,["bpmn:Lane","bpmn:Participant"])&&et(e)){var g=Ar(e);W(u,{"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&&((pn(e)?e.height>=120:e.width>=120)&&W(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:v(2)}}}),(pn(e)?e.height>=180:e.width>=180)&&W(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:v(3)}}})),W(u,{"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(f,"bpmn:FlowNode")&&(S(f,"bpmn:EventBasedGateway")?W(u,{"append.receive-task":y("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):F_(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?W(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!S(f,"bpmn:EndEvent")&&!f.isForCompensation&&!F_(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!Tn(f)&&W(u,{"append.end-event":y("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":y("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":y("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":y("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||W(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var C=W(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(f,"bpmn:SequenceFlow")&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),S(f,"bpmn:MessageFlow")&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Ze(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:p,dragstart:p}}}),S(f,"bpmn:TextAnnotation")&&W(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),Ze(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&W(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:p,dragstart:p}}}),S(f,"bpmn:Group")&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&W(u,m()),u};function F_(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return H(o,function(a){a.$type===n&&(r=!0)}),i&&r}const BD={__depends__:[hD,L_,hx,mi,Md,Jc,LD],__init__:["contextPadProvider"],contextPadProvider:["type",Ss]};var ND={horizontal:["x","width"],vertical:["y","height"]},j_=5;function fr(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Ie(i)?i:i?n:[]})}fr.$inject=["modeling","rules"],fr.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},fr.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},fr.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(H(t,function(o){r=o(r,n,i)}),r):e},fr.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=Pi(e,i);return H(o,function(a,s){var c=n._findRange(a,i,r),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t},fr.prototype._setOrientation=function(e){var t=ND[e];this._axis=t[0],this._dimension=t[1]},fr.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)},fr.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+j_,max:t+n-j_}};const $D={__init__:["distributeElements"],distributeElements:["type",fr]};function Xl(e){hi.call(this,e)}Xl.$inject=["eventBus"],we(Xl,hi),Xl.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Qe(t,function(n){var i=Ze(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=pc(t),t.length<3?!1:t})};var H_={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function bi(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()}bi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],bi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},bi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Le(e)||!n.allowed("shape.replace",{element:e}))return{};var a=_D(e);return S(t,"bpmn:DataObjectReference")?this._createEntries(e,kD):S(t,"bpmn:DataStoreReference")&&!S(e.parent,"bpmn:Collaboration")?this._createEntries(e,OD):(S(t,"bpmn:Event")&&!S(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=ND[r]||[],!On(t.$parent)&&S(t.$parent,"bpmn:SubProcess")&&(i=Qe(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),S(t,"bpmn:StartEvent")&&!S(t.$parent,"bpmn:SubProcess")?(o=Qe(ED.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Participant")?(o=Qe(BD,function(c){return nt(e)!==c.target.isExpanded}),this._createEntries(e,o)):S(t,"bpmn:StartEvent")&&On(t.$parent)?(o=Qe(LD.concat(i),function(c){var l=c.target,u=l.isInterrupting!==!1,f=t.isInterrupting===u;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):S(t,"bpmn:StartEvent")&&!On(t.$parent)&&S(t.$parent,"bpmn:SubProcess")?(o=Qe(SD.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:EndEvent")?(o=Qe(CD.concat(i),function(c){var l=c.target;return l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!S(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):S(t,"bpmn:BoundaryEvent")?(o=Qe(DD,function(c){var l=c.target;if(l.eventDefinitionType=="bpmn:CancelEventDefinition"&&!S(t.attachedToRef,"bpmn:Transaction"))return!1;var u=l.cancelActivity!==!1,f=t.cancelActivity==u;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):S(t,"bpmn:IntermediateCatchEvent")||S(t,"bpmn:IntermediateThrowEvent")?(o=Qe(RD.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Gateway")?(o=Qe(AD,a),this._createEntries(e,o)):S(t,"bpmn:Transaction")?(o=Qe(F_,a),this._createEntries(e,o)):On(t)&&nt(e)?(o=Qe(TD,a),this._createEntries(e,o)):S(t,"bpmn:AdHocSubProcess")&&nt(e)?(o=Qe(MD,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&nt(e)?(o=Qe(PD,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&!nt(e)?(o=Qe(j_,function(c){var l=c.target.type===e.type,u=c.target.isExpanded===!0;return l===u}),this._createEntries(e,o)):S(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,ID):S(t,"bpmn:FlowNode")?(o=Qe(j_,a),this._createEntries(e,o)):{})},bi.prototype.getPopupMenuHeaderEntries=function(e){var t={};return S(e,"bpmn:Activity")&&!On(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),S(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),S(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),My(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},bi.prototype._createEntries=function(e,t){var n={},i=this;return H(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},bi.prototype._createSequenceFlowEntries=function(e,t){var n=oe(e),i={},r=this._modeling,o=this._moddle,a=this;return H(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},bi.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}},bi.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(l,u){if(u.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var f=e.businessObject.get("loopCharacteristics");f&&S(f,u.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,f,{isSequential:u.options.isSequential}):(f=t._moddle.create(u.options.loopCharacteristics,{isSequential:u.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:f}))}var r=oe(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"}}}},bi.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}}},bi.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,l;c||(l=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:l})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},bi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=oe(e),i=this,r=Ty(e),o=S(e,"bpmn:BoundaryEvent")?H_["intermediate-event-non-interrupting"]:H_["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 $D={__depends__:[wd,Xv,_l],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",bi]};function Es(e,t,n,i,r,o,a,s,c,l,u,f,p){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=l,this._rules=u,this._translate=f,this._eventBus=n,this._appendPreview=p,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var m=d.context,h=m.shape;if(!(!qa(d)||!i.isOpen(h))){var y=i.getEntries(h);y.replace&&y.replace.action.click(d,h)}}),n.on("contextPad.close",function(){p.cleanUp()})}Es.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Es.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&W(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Es.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Le(t)?Xr(e,n=>t.includes(n)):t},Es.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,l=this._appendPreview,u={};if(e.type==="label")return this._isDeleteAllowed([e])&&W(u,m()),u;var f=e.businessObject;function p(b,_){r.start(b,_)}function d(b,_){n.removeElements([_])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(b){var _=5,C=t.getPad(b).html,M=C.getBoundingClientRect(),O={x:M.left,y:M.bottom+_};return O}function y(b,_,C,M){function O(I,B){var z=i.createShape(W({type:b},M));o.start(I,z,{source:B})}var P=s?function(I,B){var z=i.createShape(W({type:b},M));s.append(B,z)}:O,F=s?function(I,B){return l.create(B,b,M),()=>{l.cleanUp()}}:null;return{group:"model",className:_,title:C,action:{dragstart:O,click:P,hover:F}}}function v(b){return function(_,C){n.splitLane(C,b),t.open(C,!0)}}if(Ze(f,["bpmn:Lane","bpmn:Participant"])&&nt(e)){var g=Ar(e);W(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(b,_){n.addLane(_,"top")}}}}),g.length<2&&((fn(e)?e.height>=120:e.width>=120)&&W(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:v(2)}}}),(fn(e)?e.height>=180:e.width>=180)&&W(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:v(3)}}})),W(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(b,_){n.addLane(_,"bottom")}}}})}return S(f,"bpmn:FlowNode")&&(S(f,"bpmn:EventBasedGateway")?W(u,{"append.receive-task":y("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":y("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):z_(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?W(u,{"append.compensation-activity":y("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!S(f,"bpmn:EndEvent")&&!f.isForCompensation&&!z_(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!On(f)&&W(u,{"append.end-event":y("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":y("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":y("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":y("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||W(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,_){var C=W(h(_),{cursor:{x:b.x,y:b.y}});a.open(_,"bpmn-replace",C,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),S(f,"bpmn:SequenceFlow")&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),S(f,"bpmn:MessageFlow")&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Ze(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:p,dragstart:p}}}),S(f,"bpmn:TextAnnotation")&&W(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),Ze(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&W(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:p,dragstart:p}}}),S(f,"bpmn:Group")&&W(u,{"append.text-annotation":y("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&W(u,m()),u};function z_(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return H(o,function(a){a.$type===n&&(r=!0)}),i&&r}const FD={__depends__:[yD,$_,yx,mi,Td,Jc,$D],__init__:["contextPadProvider"],contextPadProvider:["type",Es]};var jD={horizontal:["x","width"],vertical:["y","height"]},G_=5;function fr(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Le(i)?i:i?n:[]})}fr.$inject=["modeling","rules"],fr.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},fr.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},fr.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(H(t,function(o){r=o(r,n,i)}),r):e},fr.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=Ai(e,i);return H(o,function(a,s){var c=n._findRange(a,i,r),l,u=t[t.length-1];u&&n._hasIntersection(u.range,c)?t[t.length-1].elements.push(a):(l={range:c,elements:[a]},t.push(l))}),t},fr.prototype._setOrientation=function(e){var t=jD[e];this._axis=t[0],this._dimension=t[1]},fr.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)},fr.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+G_,max:t+n-G_}};const HD={__init__:["distributeElements"],distributeElements:["type",fr]};function Xl(e){hi.call(this,e)}Xl.$inject=["eventBus"],we(Xl,hi),Xl.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Qe(t,function(n){var i=Ze(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=pc(t),t.length<3?!1:t})};var V_={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>`},FD=900;function Rs(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",FD,this)}Rs.$inject=["popupMenu","distributeElements","translate","rules"],Rs.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},Rs.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Rs.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:H_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:H_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const jD={__depends__:[_d,$D],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Xl],distributeElementsMenuProvider:["type",Rs]};var z_="is not a registered action",HD="is already registered";function xi(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}xi.$inject=["eventBus","injector"],xi.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),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var u=i.get();if(u.length)return o.copy(u)}),o&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return o.duplicate(u)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var f=s.allowed("elements.delete",{elements:u});if(f!==!1){var p=Ie(f)?f:u;return o.cut(p.slice())}}}),r&&this.register("stepZoom",function(u){r.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&i&&s&&this.register("removeSelection",function(){var u=i.get();if(u.length){var f=s.allowed("elements.delete",{elements:u}),p;f!==!1&&(Ie(f)?p=f:p=u,p.length&&n.removeElements(p.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},xi.prototype.trigger=function(e,t){if(!this._actions[e])throw kd(e,z_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},xi.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);H(e,function(i,r){n._registerAction(r,i)})},xi.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw kd(e,HD);this._actions[e]=t},xi.prototype.unregister=function(e){if(!this.isRegistered(e))throw kd(e,z_);this._actions[e]=void 0},xi.prototype.getActions=function(){return Object.keys(this._actions)},xi.prototype.isRegistered=function(e){return!!this._actions[e]};function kd(e,t){return new Error(e+" "+t)}const zD={__init__:["editorActions"],editorActions:["type",xi]};function Zl(e){e.invoke(xi,this)}we(Zl,xi),Zl.$inject=["injector"],Zl.prototype._registerDefaultActions=function(e){xi.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),l=e.get("alignElements",!1),u=e.get("directEditing",!1),f=e.get("searchPad",!1),p=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var m=t.getRootElement(),h=n.filter(function(y){return y!==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(),y=m.type;h.length&&c.trigger(h,y)}),i&&l&&this._registerAction("alignElements",function(m){var h=i.get(),y=[],v=m.type;h.length&&(y=Qe(h,function(g){return!S(g,"bpmn:Lane")}),l.trigger(y,v))}),i&&p&&this._registerAction("setColor",function(m){var h=i.get();h.length&&p.setColor(h,m)}),i&&u&&this._registerAction("directEditing",function(){var m=i.get();m.length&&u.activate(m[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),h,y;S(m,"bpmn:Collaboration")?y=n.filter(function(v){return S(v.parent,"bpmn:Collaboration")}):y=n.filter(function(v){return v!==m&&!S(v.parent,"bpmn:SubProcess")}),h=Zt(y),p.moveElements(y,{x:-h.x,y:-h.y},m)}),i&&d&&this._registerAction("replaceElement",function(m){d.triggerEntry("replace","click",m)})};const GD={__depends__:[zD],editorActions:["type",Zl]};function G_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Ze(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}G_.$inject=["eventBus"];function yo(e,t){ne.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;Hn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}yo.$inject=["eventBus","gridSnapping","modeling"],we(yo,ne),yo.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},yo.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},yo.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),W(e,o),e},yo.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),W(e,o),e};var VD=2e3;function V_(e,t){e.on(["spaceTool.move","spaceTool.end"],VD,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)}})}V_.$inject=["eventBus","gridSnapping"];const WD={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",yo],gridSnappingSpaceToolBehavior:["type",V_]};var Ql=10;function Od(e,t,n){return n||(n="round"),Math[n](e/t)*t}var UD=1200,YD=800;function jr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",YD,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"],UD,function(o){var a=o.originalEvent;if(!(!r.active||a&&qn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},f=KD(o,l,e);f&&(u.offset=f);var p=qD(o,l);p&&W(u,p),ma(o,l)||r.snapEvent(o,l,u)})}})}jr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);tn(e,t,i)},jr.prototype.getGridSpacing=function(){return Ql},jr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Od(e,Ql);var i,r;return t&&t.min&&(i=t.min,Fe(i)&&(i=Od(i+n,Ql,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Fe(r)&&(r=Od(r+n,Ql,"floor"),e=Math.min(e,r))),e-=n,e},jr.prototype.isActive=function(){return this.active},jr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},jr.prototype.toggleActive=function(){this.setActive(!this.active)},jr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function qD(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&&(Jl(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,l=r.max;return c&&(Jl(t)?U_(s)?a.x.max=c.left:a.x.min=c.right:W_(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Jl(t)?U_(s)?a.x.min=l.left:a.x.max=l.right:W_(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function KD(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Fe(s[t])||(s||(s=o.snapOffset={}),Fe(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Jl(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 Jl(e){return e==="x"}function W_(e){return e.indexOf("n")!==-1}function U_(e){return e.indexOf("w")!==-1}const XD={__depends__:[WD],__init__:["gridSnapping"],gridSnapping:["type",jr]};var ZD=2e3;function Y_(e,t,n){e.on("autoPlace",ZD,function(i){var r=i.source,o=Le(r),a=i.shape,s=Fb(r,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==o[c]&&(s[c]>o[c]?l.min=s[c]:l.max=s[c],S(a,"bpmn:TextAnnotation")&&(QD(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}Y_.$inject=["eventBus","gridSnapping","elementRegistry"];function QD(e){return e==="x"}var JD=1750;function q_(e,t,n){t.on(["create.start","shape.move.start"],JD,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}))}})}q_.$inject=["canvas","eventBus","gridSnapping"];var eI=3e3;function eu(e,t,n){ne.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],eI,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||tI(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}eu.$inject=["eventBus","gridSnapping","modeling"],we(eu,ne),eu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=rI(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function tI(e){return e.length>3}function nI(e){return e==="h"}function iI(e){return e==="v"}function rI(e,t,n){var i=Qi(t,n),r={};return nI(i)&&(r.y=e.snapValue(t.y)),iI(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=W({},t,r),n=W({},n,r)),[t,n]}const oI={__depends__:[XD,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Y_],gridSnappingParticipantBehavior:["type",q_],gridSnappingLayoutConnectionBehavior:["type",eu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",G_]};var aI=30,K_=30;function Cs(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 et(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(S(r,"bpmn:SubProcess"))return et(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Cs.$inject=["eventBus","interactionEvents"],Cs.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Cs.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=pn(e)?{width:aI,height:e.height}:{width:e.width,height:K_};return this._interactionEvents.createBoxHit(t,"all",n),!0},Cs.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:K_}),!0};const sI={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Cs]};function tu(e){e.invoke(ca,this)}we(tu,ca),tu.$inject=["injector"],tu.prototype.registerBindings=function(e,t){ca.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 cI={__depends__:[ad],__init__:["keyboardBindings"],keyboardBindings:["type",tu]};var lI={moveSpeed:1,moveSpeedAccelerated:10},uI=1500,X_="left",Z_="up",Q_="right",J_="down",pI={ArrowLeft:X_,Left:X_,ArrowUp:Z_,Up:Z_,ArrowRight:Q_,Right:Q_,ArrowDown:J_,Down:J_},fI={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 ew(e,t,n,i,r){var o=this;this._config=W({},lI,e||{}),t.addListener(uI,function(a){var s=a.keyEvent,c=pI[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return o.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=fI[a](l),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,u)}}}ew.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const dI={__depends__:[ad,mi],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",ew]};var tw=10;function As(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,l){var u=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=l,d=JA(u,f,l),c.newBounds=tP(d,p),c.canExecute=r.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=r.computeMinResizeBox(c)),c.resizeConstraints={min:De(u)})}function s(c){var l=c.shape,u=c.canExecute,f=c.newBounds;if(u){if(f=pg(f),!hI(l,f))return;n.resizeShape(l,f)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};o(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}As.prototype.canResize=function(e){var t=this._rules,n=Si(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},As.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=W({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,nw(t,o),"resize",{autoActivate:!0,cursor:mI(o),data:{shape:t,context:r}})},As.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:tw,height:tw},r=Qg(t,e.childrenBoxPadding),nP(n,t,i,r)},As.$inject=["eventBus","rules","modeling","dragging"];function hI(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function nw(e,t){var n=Le(e),i=De(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 mI(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 iw="djs-resizing",rw="resize-not-ok",gI=500;function ow(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,iw)),s.width>5&&Ee(c,{x:s.x,width:s.width}),s.height>5&&Ee(c,{y:s.y,height:s.height}),o.canExecute?nt(c).remove(rw):nt(c).add(rw)}function r(o){var a=o.shape,s=o.frame;s&&an(o.frame),t.removeMarker(a,iw)}e.on("resize.move",gI,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}ow.$inject=["eventBus","canvas","previewSupport"];var nu=-6,iu=8,ru=20,Ps="djs-resizer",yI=["n","w","s","e","nw","ne","se","sw"];function Hr(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&&H(a,$n(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}Hr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Mr(o)&&i.activate(o,e,n)}je.bind(t,"mousedown",r),je.bind(t,"touchstart",r)},Hr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=vI(i),a=Me("g");nt(a).add(Ps),nt(a).add(Ps+"-"+e.id),nt(a).add(Ps+"-"+i),Ve(r,a);var s=Me("rect");Ee(s,{x:-iu/2+o.x,y:-iu/2+o.y,width:iu,height:iu}),nt(s).add(Ps+"-visual"),Ve(a,s);var c=Me("rect");return Ee(c,{x:-ru/2+o.x,y:-ru/2+o.y,width:ru,height:ru}),nt(c).add(Ps+"-hit"),Ve(a,c),yc(a,t,n),a},Hr.prototype.createResizer=function(e,t){var n=nw(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Hr.prototype.addResizer=function(e){var t=this;gt(e)||H(yI,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Hr.prototype.removeResizers=function(){var e=this._getResizersParent();cc(e)},Hr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Hr.$inject=["eventBus","canvas","selection","resize"];function vI(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-nu:e.indexOf("w")!==-1&&(t.x=nu),e.indexOf("s")!==-1?t.y=-nu:e.indexOf("n")!==-1&&(t.y=nu),t}const aw={__depends__:[Fi,rr,ra],__init__:["resize","resizePreview","resizeHandles"],resize:["type",As],resizePreview:["type",ow],resizeHandles:["type",Hr]};var bI=2e3;function Ms(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"],bI,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 l=c.context,u=l.shape,f=c.context.canExecute,p=c.isTouch;p||f&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||Ze(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ms.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ms.prototype.activate=function(e){var t=ci(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);W(n,i);var r={},o=n.style||{};return W(o,{backgroundColor:null,border:null}),(Ze(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||sw(e))&&W(r,{centerVertically:!0}),Rr(e)&&(W(r,{resizable:!0,autoResize:!0}),W(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),S(e,"bpmn:TextAnnotation")&&(W(r,{resizable:!0,autoResize:!0}),W(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),W(n,{options:r,style:o}),n}},Ms.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(),l=c.fontSize*a,u=c.lineHeight,f=s.fontSize*a,p=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(S(e,"bpmn:Lane")||wI(e)){var m=pn(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};W(o,h),W(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(_I(e)){var y=pn(e),v=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};W(o,v),W(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(Ze(e,["bpmn:Task","bpmn:CallActivity"])||sw(e))&&(W(o,{width:i.width,height:i.height}),W(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),xI(e)&&(W(o,{width:i.width,x:i.x}),W(d,{fontSize:f+"px",lineHeight:p,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&&(W(o,{width:b,height:i.height+2*g,x:i.x-g,y:i.y-g}),W(d,{fontSize:l+"px",lineHeight:u})),Rr(n)&&!xc(n)&&!Xe(n)){var x=gp(e),C=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),M=l,O=ro.width*a+2*g;W(o,{width:O,height:M+2*g,x:C.x-O/2,y:C.y-M/2-g}),W(d,{fontSize:l+"px",lineHeight:u})}return S(e,"bpmn:TextAnnotation")&&(W(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}),W(d,{textAlign:"left",paddingTop:Wo*a+"px",paddingBottom:Wo*a+"px",paddingLeft:Wo*a+"px",paddingRight:Wo*a+"px",fontSize:f+"px",lineHeight:p})),{bounds:o,style:d}},Ms.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}),EI(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function sw(e){return S(e,"bpmn:SubProcess")&&!et(e)}function xI(e){return S(e,"bpmn:SubProcess")&&et(e)}function _I(e){return S(e,"bpmn:Participant")&&!et(e)}function wI(e){return S(e,"bpmn:Participant")&&et(e)}function EI(e){return!e||!e.trim()}var cw="djs-element-hidden",lw="djs-label-hidden";function uw(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(o=l.element.label||l.element,S(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Me("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),f=i.path=Me("path");Ee(f,{d:u,strokeWidth:2,stroke:SI(o)}),Ve(s,f),Ve(r,s),xn(s,o.x,o.y)}S(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,cw):(S(o,"bpmn:Task")||S(o,"bpmn:CallActivity")||S(o,"bpmn:SubProcess")||S(o,"bpmn:Participant")||S(o,"bpmn:Lane"))&&t.addMarker(o,lw)}),e.on("directEditing.resize",function(c){if(S(o,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,f=Math.max(o.height/a.height*(l+u),0),p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:f,position:{mx:0,my:0}});Ee(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,cw),t.removeMarker(o,lw)),o=void 0,a=void 0,s&&(an(s),s=void 0)})}uw.$inject=["eventBus","canvas","pathMap"];function SI(e,t){var n=st(e);return n.get("stroke")||t||"black"}const RI={__depends__:[Lf,aw,L_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ms],labelEditingPreview:["type",uw]};var CI=500,AI=1e3;function zi(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){tC(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){H(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],CI,function(o){var a=o.element,s=o.gfx,c=ht(".djs-outline",s);c&&i.updateOutline(a,c)})}zi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=ht(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Ve(t,n),this.updateOutline(e,n)),n},zi.prototype._createOutlineGfx=function(){var e=Me("rect");return Ee(e,W({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},zi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},zi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&H(i,function(r){n=n||r.updateOutline(t,e)}),n||Ee(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},zi.prototype.updateConnectionOutline=function(e,t){var n=Zt(t);Ee(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},zi.prototype.registerProvider=function(e,t){t||(t=e,e=AI),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},zi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},zi.prototype.getOutline=function(e){var t,n=this._getProviders();return H(n,function(i){un(i.getOutline)&&(t=t||i.getOutline(e))}),t},zi.$inject=["eventBus","styles","elementRegistry"];var ou=6;function Dd(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)})}Dd.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");cc(t);var n=e.length>1,i=this._canvas.getContainer();if(nt(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=PI(Zt(e)),o=Me("rect");Ee(o,W({rx:3},r)),nt(o).add("djs-selection-outline"),Ve(t,o)}},Dd.$inject=["eventBus","canvas","selection"];function PI(e){return{x:e.x-ou,y:e.y-ou,width:e.width+ou*2,height:e.height+ou*2}}const Id={__depends__:[mi],__init__:["outline","multiSelectionOutline"],outline:["type",zi],multiSelectionOutline:["type",Dd]},pw=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],fw={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},MI=15,au=2;function dw(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:f}){var d;const p=f.filter(m=>Ze(m,pw));if(p.length===1){const m=p[0];Xe(m)?a(m,m.labelTarget):(d=m.labels)!=null&&d.length&&a(m.labels[0],m)}if(p.length===2){const m=p.find(Xe),h=p.find(y=>{var v;return(v=y.labels)==null?void 0:v.includes(m)});m&&h&&a(m,h)}}),e.on("shape.changed",function({element:f}){var p;!Ze(f,pw)||!u(f)||(Xe(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=Oa([Le(p),Le(f)],fw),m=d.getAttribute("d"),y=r.isSelected(f)?c(f):l(f),v=Ba(y,m);if(!v)return;const b=r.isSelected(p)?c(p):l(p),x=Ba(b,m)||Le(p);Ua(x,v)<MI||(cp(d,[x,v]),Ve(o,d))}function s(){sc(`.${fw.class}`,o).forEach(an)}function c(f){const p=i.getOutline(f);if(!p)return l(f);if(p.x){const d={x:f.x+zr(p,"x")-au,y:f.y+zr(p,"y")-au,width:zr(p,"width")+au*2,height:zr(p,"height")+au*2};return vp(d,zr(p,"rx"))}if(p.cx){const d=zr(p,"r"),m={x:f.x+zr(p,"cx")-d,y:f.y+zr(p,"cy")-d,width:d*2,height:d*2};return Lg(m)}}function l(f){return n.getShapePath(f)}function u(f){return r.isSelected(f)}}dw.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function zr(e,t){return parseFloat(Ee(e,t)||0)}const TI={__depends__:[mi,Id],__init__:["labelLink"],labelLink:["type",dw]};var kI=new ia("tt");function OI(e){var t=Mt('<div class="djs-tooltip-container" />');return Ln(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function DI(e,t,n){Ln(e,{left:t+"px",top:n+"px"})}function Ld(e,t){e.style.display=t===!1?"none":""}var hw="djs-tooltip",Bd="."+hw;function jn(e,t){this._eventBus=e,this._canvas=t,this._ids=kI,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=OI(t.getContainer());var n=this;Wn.bind(this._tooltipRoot,Bd,"mousedown",function(i){i.stopPropagation()}),Wn.bind(this._tooltipRoot,Bd,"mouseover",function(i){n.trigger("mouseover",i)}),Wn.bind(this._tooltipRoot,Bd,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}jn.$inject=["eventBus","canvas"],jn.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=W({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},jn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Pn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},jn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},jn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},jn.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)}},jn.prototype.remove=function(e){var t=this.get(e);t&&(Di(t.html),Di(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},jn.prototype.show=function(){Ld(this._tooltipRoot)},jn.prototype.hide=function(){Ld(this._tooltipRoot,!1)},jn.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},jn.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)),Hn(n)&&(n=Mt(n)),i=Mt('<div data-tooltip-id="'+t+'" class="'+hw+'">'),Ln(i,{position:"absolute"}),i.appendChild(n),e.type&&Lt(i).add("djs-tooltip-"+e.type),e.className&&Lt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},jn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;DI(n,t.x,t.y)},jn.prototype._updateTooltipVisibilty=function(e){H(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Ld(i,r))})},jn.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 II={__init__:["tooltips"],tooltips:["type",jn]};var LI="flow elements must be children of pools/participants",BI="Data object must be placed within a pool/participant.";function mw(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(LI)):S(a,"bpmn:DataObjectReference")&&i(r,n(BI)))})}mw.$inject=["eventBus","tooltips","translate"];const NI={__depends__:[II],__init__:["modelingFeedback"],modelingFeedback:["type",mw]};var $I=500,FI=1250,jI=1500,su=Math.round;function HI(e){return{x:e.x+su(e.width/2),y:e.y+su(e.height/2)}}function gw(e,t,n,i,r){function o(s,c,l,u){return r.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",jI,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=zI(u),W(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",FI,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=o(l),!u)return!1}),e.on("shape.move.move",$I,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,f={x:s.dx,y:s.dy},p={x:s.x,y:s.y},d;if(d=o(l,f,p,u),c.delta=f,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,f=u==="attach",p=c.shapes;if(u===!1)return!1;l.x=su(l.x),l.y=su(l.y),!(l.x===0&&l.y===0)&&n.moveElements(p,l,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(Mr(s)){var c=Jo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(ln(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!nt(s.target).has("djs-hit-no-move")){var f=HI(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(p!==!1)return!0}}this.start=a}gw.$inject=["eventBus","dragging","modeling","selection","rules"];function zI(e){var t=Ao(e,"id");return Qe(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var yw=499,Nd="djs-dragging",vw="drop-ok",bw="drop-not-ok",xw="new-parent",_w="attach-ok";function ww(e,t,n,i){function r(c){var l=o(c),u=GI(l);return u}function o(c){var l=Da(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=l.concat(u),p=[...new Set(f)];return p}function a(c,l){[_w,vw,bw,xw].forEach(function(u){u===l?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,l,u){i.addDragger(l,c.dragGroup),u&&t.addMarker(l,Nd),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",yw,function(c){var l=c.context,u=l.shapes,f=l.allDraggedElements,p=r(u);if(!l.dragGroup){var d=Me("g");Ee(d,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();Ve(m,d),l.dragGroup=d}p.forEach(function(h){i.addDragger(h,l.dragGroup)}),f?f=vu([f,o(u)]):f=o(u),H(f,function(h){t.addMarker(h,Nd)}),l.allDraggedElements=f,l.differentParents=VI(u)}),e.on("shape.move.move",yw,function(c){var l=c.context,u=l.dragGroup,f=l.target,p=l.shape.parent,d=l.canExecute;f&&(d==="attach"?a(f,_w):l.canExecute&&p&&f.id!==p.id?a(f,xw):a(f,l.canExecute?vw:bw)),xn(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,f=l.dragGroup;H(u,function(p){t.removeMarker(p,Nd)}),f&&an(f)}),this.makeDraggable=s}ww.$inject=["eventBus","canvas","styles","previewSupport"];function GI(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Qe(e,function(i){return gt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function VI(e){return oE(Ao(e,function(t){return t.parent&&t.parent.id}))!==1}const WI={__depends__:[Zc,mi,Id,Fi,rr,ra],__init__:["move","movePreview"],move:["type",gw],movePreview:["type",ww]};var Ew=".djs-palette-toggle",Sw=".entry",UI=Ew+", "+Sw,$d="djs-palette-",YI="shown",Fd="open",Rw="two-column",qI=1e3;function nn(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()})}nn.$inject=["eventBus","canvas"],nn.prototype.registerProvider=function(e,t){t||(t=e,e=qI),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},nn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(XI,{})},nn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},nn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=Mt(nn.HTML_MARKUP);n.appendChild(i),Lt(n).add($d+YI),Wn.bind(i,UI,"click",function(r){var o=r.delegateTarget;if(Ju(o,Ew))return e.toggle();e.trigger("click",r)}),je.bind(i,"mousedown",function(r){r.stopPropagation()}),Wn.bind(i,Sw,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},nn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},nn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Lt(n),a=Lt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Rw,r),a.toggle($d+Rw,r),"open"in e&&(o.toggle(Fd,e.open),a.toggle($d+Fd,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},nn.prototype._update=function(){var e=ht(".djs-palette-entries",this._container),t=this._entries=this.getEntries();oc(e),H(t,function(n,i){var r=n.group||"default",o=ht("[data-group="+hs(r)+"]",e);o||(o=Mt('<div class="group"></div>'),Pn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Mt(a);if(o.appendChild(s),!n.separator&&(Pn(s,"data-action",i),n.title&&Pn(s,"title",n.title),n.className&&KI(s,n.className),n.imageUrl)){var c=Mt("<img>");Pn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},nn.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=Pn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},nn.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(un(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},nn.prototype._layoutChanged=function(){this._toggleState({})},nn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},nn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},nn.prototype.open=function(){this._toggleState({open:!0})},nn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},nn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},nn.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=ht(".djs-palette-entries",this._container),this._toolsContainer=ht("[data-group=tools]",t)),n=this._toolsContainer,H(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Lt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},nn.prototype.isOpen=function(){return Lt(this._container).has(Fd)},nn.prototype._getParentContainer=function(){return this._canvas.getContainer()},nn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function KI(e,t){var n=Lt(e),i=Ie(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function XI(e,t){var n=t.getPaletteEntries();return un(n)?n(e):(H(n,function(i,r){e[r]=i}),e)}const ZI={__init__:["palette"],palette:["type",nn]};var Cw="crosshair",Aw="selected",QI="djs-dragging-active-lasso";function Gr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(f){var p=t.getActiveLayer(),d=f.frame=Me("rect");Ee(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Ve(p,d),l(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&Ee(p,{x:d.x,y:d.y,width:d.width,height:d.height});var m=f.marked,h=f.lastMarked;if(m&&h){for(const y of h)m.has(y)||t.removeMarker(y,Aw);for(const y of m)h.has(y)||t.addMarker(y,Aw)}},remove:function(f){this.update(f),f.frame&&an(f.frame),l(!1)}};function l(f){nt(t.getContainer()).toggle(QI,f)}function u(f){var p=i.getAll();return new Set(Co(jo(p,f)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(f){var p=f.originalEvent.target;!f.hover&&!(p instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(f.originalEvent,!0)})}),e.on("lasso.end",0,function(f){var p=f.context;s._select(Array.from(p.marked))}),e.on("lasso.start",function(f){var p=f.context;p.bbox=Pw(f),p.add=Vc(f),p.lastMarked=new Set(r.get()),p.add?p.marked=p.lastMarked:p.marked=new Set,p.initialMarked=p.marked,c.create(p)}),e.on("lasso.move",function(f){var p=f.context,d=p.bbox=Pw(f),m=u(d),h=p.initialMarked.union(m);p.lastMarked=p.marked,p.marked=h,c.update(p)}),e.on("lasso.cleanup",function(f){var p=f.context;p.lastMarked=p.marked,p.marked=new Set(r.get()),c.remove(f.context)}),e.on("element.mousedown",1500,function(f){if(Vc(f))return s.activateLasso(f.originalEvent),!0})}Gr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Gr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Cw,data:{context:{}},keepSelection:!0})},Gr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Cw,data:{context:{}},keepSelection:!0})},Gr.prototype._select=function(e){this._selection.select(e)},Gr.prototype.select=function(e,t,n=[]){var i=Co(jo(e,t));this._select([...n,...i])},Gr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Gr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function Pw(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 JI={__depends__:[tl,Qa],__init__:["lassoTool"],lassoTool:["type",Gr]};var jd=1500,Mw="grab";function ga(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",jd,function(c){if(Ka(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(jd,function(c){if(!(!Tw(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(jd,function(c){!Tw(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var l=c.originalEvent.target;if(!c.hover&&!(l instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var l=t.viewbox().scale;t.scroll({dx:c.dx*l,dy:c.dy*l})}),e.on("hand.move.end",function(c){var l=c.context,u=l.reactivate;return!Ka(c)&&u&&e.once("hand.move.ended",function(f){a.activateHand(f.originalEvent,!0,!0)}),!1})}ga.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],ga.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Mw,data:{context:n||{}}})},ga.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Mw,data:{context:{reactivate:n}}})},ga.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},ga.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Tw(e){return sn("Space",e)}const eL={__depends__:[tl,Qa],__init__:["handTool"],handTool:["type",ga]};var kw="connect-ok",Ow="connect-not-ok";function ya(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 l=c.context,u=c.hover,f=l.canStartConnect=s.canStartConnect(u);f!==null&&(l.startTarget=u,i.addMarker(u,f?kw:Ow))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?kw:Ow)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,f={x:c.x,y:c.y},p=s.canStartConnect(u);if(p)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,f)}),!1})}ya.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],ya.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},ya.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},ya.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},ya.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const tL={__depends__:[Md,Fi,rr,tl,Qa],globalConnect:["type",ya]};function Hd(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)}Hd.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Hd.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(f,p,d,m,h){function y(v){var g=n.createShape(W({type:f},h));t.start(v,g)}return{group:p,className:d,title:m,action:{dragstart:y,click:y}}}function l(f){var p=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:p});t.start(f,[p,d],{hints:{autoSelect:[p]}})}function u(f){t.start(f,n.createParticipantShape())}return W(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(f){o.activateHand(f)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(f){r.activateSelection(f)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(f){i.activateSelection(f)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(f){a.start(f)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const nL={__depends__:[ZI,Jc,Jv,JI,eL,tL,za],__init__:["paletteProvider"],paletteProvider:["type",Hd]};var iL=250;function zd(e,t,n,i,r){ne.call(this,e);function o(s){var c=s.canExecute.replacements;H(c,function(l){var u=l.oldElementId,f={type:l.newElementType};if(!s.visualReplacements[u]){var p=t.get(u);W(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var m=ht('[data-element-id="'+hs(p.id)+'"]',s.dragGroup);m&&Ee(m,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;H(c,function(l,u){var f=ht('[data-element-id="'+hs(u)+'"]',s.dragGroup);f&&Ee(f,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",iL,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?o(c):a(c)})}zd.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],we(zd,ne);const rL={__depends__:[ra],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",zd]};var oL=1250,Gd=40,aL=20,sL=10,Dw=20,Iw=["x","y"],cL=Math.abs;function Lw(e){e.on(["connect.hover","connect.move","connect.end"],oL,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&qn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&lL(t,o,dL(o)),o&&fL(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=vi(r),Ze(o,["bpmn:Event","bpmn:Gateway"])&&Bw(t,vi(o)),Ze(o,["bpmn:Task","bpmn:SubProcess"])&&uL(t,o),S(a,"bpmn:BoundaryEvent")&&s===a.host&&pL(t)):Nw(i,"bpmn:MessageFlow")?(S(r,"bpmn:Event")&&(n.connectionStart=vi(r)),S(o,"bpmn:Event")&&Bw(t,vi(o))):n.connectionStart=n.initialConnectionStart)})}Lw.$inject=["eventBus"];function lL(e,t,n){Iw.forEach(function(i){var r=$w(i,t);e[i]<t[i]+n?tn(e,i,t[i]+n):e[i]>t[i]+r-n&&tn(e,i,t[i]+r-n)})}function uL(e,t){var n=vi(t);Iw.forEach(function(i){hL(e,t,i)&&tn(e,i,n[i])})}function pL(e){var t=e.context,n=t.source,i=t.target;if(!mL(t)){var r=vi(n),o=bn(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],l;cL(c-r[s])<Gd&&(c>r[s]?l=r[s]+Gd:l=r[s]-Gd,tn(e,s,l))})}}function Bw(e,t){tn(e,"x",t.x),tn(e,"y",t.y)}function Nw(e,t){return e&&e.type===t}function fL(e,t){return hr(t,function(n){return Nw(e,n)})}function $w(e,t){return e==="x"?t.width:t.height}function dL(e){return S(e,"bpmn:Task")?sL:aL}function hL(e,t,n){return e[n]>t[n]+Dw&&e[n]<t[n]+$w(n,t)-Dw}function mL(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Vr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Vr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Vr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Vr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Vr.prototype.getSnapLocations=function(){return this._snapLocations},Vr.prototype.setSnapLocations=function(e){this._snapLocations=e},Vr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new cu,n.initDefaults(this._defaultSnaps)),n};function cu(){this._snapValues={}}cu.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)},cu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&iD(e[n],r[n],i)},cu.prototype.initDefaults=function(e){var t=this;H(e||{},function(n,i){H(n,function(r){t.add(i,r)})})};var gL=1250;function Gi(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"],gL,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&qn(r.originalEvent))&&!(ma(r)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(r,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Gi.$inject=["elementRegistry","eventBus","snapping"],Gi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Vr);var o;t.get(i.id)?o=vi(i,e):o={x:e.x+vi(i).x,y:e.y+vi(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),Xe(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},Gi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return H(i,function(r){if(Xe(r)){Xe(t)&&e.add("mid",vi(r));return}if(gt(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);H(o,function(a){e.add("mid",a)});return}e.add("mid",vi(r))}),!Fe(t.x)||!Fe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",vi(t)),e},Gi.prototype.getSnapTargets=function(e,t){return S_(t).filter(function(n){return!yL(n)})};function yL(e){return!!e.hidden}var Fw=1500;function va(e,t){t.invoke(Gi,this),e.on(["create.move","create.end"],Fw,_L),e.on(["create.move","create.end","shape.move.move","shape.move.end"],Fw,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!ma(n)&&vL(n,o)})}we(va,Gi),va.$inject=["eventBus","injector"],va.prototype.initSnap=function(e){var t=Gi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return H(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Hw(o,i,e))}),H(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Hw(o,i,e))}),S(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},va.prototype.addSnapTargetPoints=function(e,t,n){Gi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);H(i,function(o){(xL(o)||bL([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",w_(o)),e.add("bottom-right",E_(o)))});var r=this._elementRegistry;return H(t.incoming,function(o){if(r.get(t.id)){jw(i,o.source)||e.add("mid",Le(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),H(t.outgoing,function(o){if(r.get(t.id)){jw(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},va.prototype.getSnapTargets=function(e,t){return Gi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!S(n,"bpmn:Lane")})};function vL(e,t){var n=De(t),i=Ky(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Le(o),/top/.test(i)?tn(e,"y",n.top-a.y):/bottom/.test(i)&&tn(e,"y",n.bottom-a.y),/left/.test(i)?tn(e,"x",n.left-a.x):/right/.test(i)&&tn(e,"x",n.right-a.x)}function bL(e,t){return e.every(function(n){return S(n,t)})}function xL(e){return S(e,"bpmn:SubProcess")&&et(e)?!0:S(e,"bpmn:Participant")}function _L(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)&&tn(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&tn(e,"y",e.y)}}function jw(e,t){return e.indexOf(t)!==-1}function Hw(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var wL=1250;function Ts(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],wL,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&qn(i.originalEvent))&&!ma(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,o,a,s),l.initialized=!0),RL(s)&&tn(i,"x",i.x),CL(s)&&tn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ts.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Vr);var o=zw(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ts.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return H(r,function(o){e.add("corner",E_(o)),e.add("corner",w_(o))}),e.add("corner",zw(t,i)),e},Ts.$inject=["eventBus","snapping"],Ts.prototype.getSnapTargets=function(e,t){return S_(t).filter(function(n){return!EL(n,e)&&!gt(n)&&!SL(n)&&!Xe(n)})};function zw(e,t){var n=Le(e),i=De(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 EL(e,t){return e.host===t}function SL(e){return!!e.hidden}function RL(e){return e==="n"||e==="s"}function CL(e){return e==="e"||e==="w"}var AL=7,PL=1e3;function Wr(e){this._canvas=e,this._asyncHide=xu($n(this.hide,this),PL)}Wr.$inject=["canvas"],Wr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:ma(e,"x"),y:ma(e,"y")};H(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(H(["x","y"],function(l){var u;o[l]||(u=t.snap(c,a,l,AL),u!==void 0&&(o[l]={value:u,originValue:u-s[l]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),H(["x","y"],function(a){var s=o[a];ln(s)&&tn(e,a,s.originValue)})},Wr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Me("path");return Ee(n,{d:"M0,0 L0,0"}),nt(n).add("djs-snap-line"),Ve(t,n),{update:function(i){Fe(i)?e==="horizontal"?Ee(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Ee(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Ee(n,{display:"none"})}}},Wr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Wr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Wr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Wr.prototype.hide=function(){H(this._snapLines,function(e){e.update()})};const ML={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Gi],resizeSnapping:["type",Ts],snapping:["type",Wr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Lw],createMoveSnapping:["type",va]};var Gw=300;function We(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=ht(We.INPUT_SELECTOR,this._container),this._resultsContainer=ht(We.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}We.$inject=["canvas","eventBus","selection","translate"],We.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Wn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,We.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,We.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,We.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,We.INPUT_SELECTOR,"keydown",function(n){sn("ArrowUp",n)&&n.preventDefault(),sn("ArrowDown",n)&&n.preventDefault()}),t(this._container,We.INPUT_SELECTOR,"keyup",function(n){if(sn("Escape",n))return e.close();if(sn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(sn("ArrowUp",n))return e._scrollToDirection(!0);if(sn("ArrowDown",n))return e._scrollToDirection();sn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},We.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Wn.unbind(e.el,e.type,e.listener)})},We.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=ht(We.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},We.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},We.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)}},We.prototype._clearResults=function(){oc(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},We.prototype._getCurrentResult=function(){return ht(We.RESULT_SELECTED_SELECTOR,this._resultsContainer)},We.prototype._createResultNode=function(e,t){var n=Mt(We.RESULT_HTML);return e.primaryTokens.length>0&&Vw(n,e.primaryTokens,We.RESULT_PRIMARY_HTML),Vw(n,e.secondaryTokens,We.RESULT_SECONDARY_HTML),Pn(n,We.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},We.prototype.registerProvider=function(e){this._searchProvider=e},We.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,Lt(this._canvas.getContainer()).add("djs-search-open"),Lt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},We.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,Lt(this._canvas.getContainer()).remove("djs-search-open"),Lt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},We.prototype.toggle=function(){this.isOpen()?this.close():this.open()},We.prototype.isOpen=function(){return this._open},We.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Lt(t).remove(We.RESULT_SELECTED_CLASS);var n=Pn(e,We.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Lt(e).add(We.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Gw}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},We.prototype._select=function(e){var t=Pn(e,We.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Gw}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},We.prototype._getBoxHtml=function(){const e=Mt(We.BOX_HTML),t=ht(We.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Vw(e,t,n){var i=TL(t),r=Mt(n);r.innerHTML=i,e.appendChild(r)}function TL(e){var t="";return e.forEach(function(n){var i=Qb(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+We.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}We.CONTAINER_SELECTOR=".djs-search-container",We.INPUT_SELECTOR=".djs-search-input input",We.RESULTS_CONTAINER_SELECTOR=".djs-search-results",We.RESULT_SELECTOR=".djs-search-result",We.RESULT_SELECTED_CLASS="djs-search-result-selected",We.RESULT_SELECTED_SELECTOR="."+We.RESULT_SELECTED_CLASS,We.RESULT_ID_ATTRIBUTE="data-result-id",We.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",We.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
+ </svg>`},zD=900;function Ss(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",zD,this)}Ss.$inject=["popupMenu","distributeElements","translate","rules"],Ss.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&W(t,this._getEntries(e)),t},Ss.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ss.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:V_.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:V_.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const GD={__depends__:[wd,HD],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Xl],distributeElementsMenuProvider:["type",Ss]};var W_="is not a registered action",VD="is already registered";function xi(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}xi.$inject=["eventBus","injector"],xi.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),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var u=i.get();if(u.length)return o.copy(u)}),o&&i&&this.register("duplicate",function(){var u=i.get();if(u.length)return o.duplicate(u)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var u=i.get();if(u.length){var f=s.allowed("elements.delete",{elements:u});if(f!==!1){var p=Le(f)?f:u;return o.cut(p.slice())}}}),r&&this.register("stepZoom",function(u){r.stepZoom(u.value)}),a&&this.register("zoom",function(u){a.zoom(u.value)}),n&&i&&s&&this.register("removeSelection",function(){var u=i.get();if(u.length){var f=s.allowed("elements.delete",{elements:u}),p;f!==!1&&(Le(f)?p=f:p=u,p.length&&n.removeElements(p.slice()))}}),c&&this.register("moveCanvas",function(u){c.moveCanvas(u)}),l&&this.register("moveSelection",function(u){l.moveSelection(u.direction,u.accelerated)})},xi.prototype.trigger=function(e,t){if(!this._actions[e])throw Od(e,W_);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},xi.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);H(e,function(i,r){n._registerAction(r,i)})},xi.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Od(e,VD);this._actions[e]=t},xi.prototype.unregister=function(e){if(!this.isRegistered(e))throw Od(e,W_);this._actions[e]=void 0},xi.prototype.getActions=function(){return Object.keys(this._actions)},xi.prototype.isRegistered=function(e){return!!this._actions[e]};function Od(e,t){return new Error(e+" "+t)}const WD={__init__:["editorActions"],editorActions:["type",xi]};function Zl(e){e.invoke(xi,this)}we(Zl,xi),Zl.$inject=["injector"],Zl.prototype._registerDefaultActions=function(e){xi.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),l=e.get("alignElements",!1),u=e.get("directEditing",!1),f=e.get("searchPad",!1),p=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var m=t.getRootElement(),h=n.filter(function(y){return y!==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(),y=m.type;h.length&&c.trigger(h,y)}),i&&l&&this._registerAction("alignElements",function(m){var h=i.get(),y=[],v=m.type;h.length&&(y=Qe(h,function(g){return!S(g,"bpmn:Lane")}),l.trigger(y,v))}),i&&p&&this._registerAction("setColor",function(m){var h=i.get();h.length&&p.setColor(h,m)}),i&&u&&this._registerAction("directEditing",function(){var m=i.get();m.length&&u.activate(m[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),h,y;S(m,"bpmn:Collaboration")?y=n.filter(function(v){return S(v.parent,"bpmn:Collaboration")}):y=n.filter(function(v){return v!==m&&!S(v.parent,"bpmn:SubProcess")}),h=Zt(y),p.moveElements(y,{x:-h.x,y:-h.y},m)}),i&&d&&this._registerAction("replaceElement",function(m){d.triggerEntry("replace","click",m)})};const UD={__depends__:[WD],editorActions:["type",Zl]};function U_(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Ze(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}U_.$inject=["eventBus"];function yo(e,t){ne.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;zn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}yo.$inject=["eventBus","gridSnapping","modeling"],we(yo,ne),yo.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},yo.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},yo.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),W(e,o),e},yo.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),W(e,o),e};var YD=2e3;function Y_(e,t){e.on(["spaceTool.move","spaceTool.end"],YD,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)}})}Y_.$inject=["eventBus","gridSnapping"];const qD={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",yo],gridSnappingSpaceToolBehavior:["type",Y_]};var Ql=10;function Dd(e,t,n){return n||(n="round"),Math[n](e/t)*t}var KD=1200,XD=800;function jr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",XD,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"],KD,function(o){var a=o.originalEvent;if(!(!r.active||a&&Kn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},f=QD(o,l,e);f&&(u.offset=f);var p=ZD(o,l);p&&W(u,p),ha(o,l)||r.snapEvent(o,l,u)})}})}jr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);tn(e,t,i)},jr.prototype.getGridSpacing=function(){return Ql},jr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Dd(e,Ql);var i,r;return t&&t.min&&(i=t.min,Fe(i)&&(i=Dd(i+n,Ql,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Fe(r)&&(r=Dd(r+n,Ql,"floor"),e=Math.min(e,r))),e-=n,e},jr.prototype.isActive=function(){return this.active},jr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},jr.prototype.toggleActive=function(){this.setActive(!this.active)},jr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function ZD(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&&(Jl(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,l=r.max;return c&&(Jl(t)?K_(s)?a.x.max=c.left:a.x.min=c.right:q_(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(Jl(t)?K_(s)?a.x.min=l.left:a.x.max=l.right:q_(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function QD(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Fe(s[t])||(s||(s=o.snapOffset={}),Fe(s[t])||(s[t]=0),!r)||(n.get(r.id)||(Jl(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 Jl(e){return e==="x"}function q_(e){return e.indexOf("n")!==-1}function K_(e){return e.indexOf("w")!==-1}const JD={__depends__:[qD],__init__:["gridSnapping"],gridSnapping:["type",jr]};var eL=2e3;function X_(e,t,n){e.on("autoPlace",eL,function(i){var r=i.source,o=Ie(r),a=i.shape,s=zb(r,a,n);return["x","y"].forEach(function(c){var l={};s[c]!==o[c]&&(s[c]>o[c]?l.min=s[c]:l.max=s[c],S(a,"bpmn:TextAnnotation")&&(tL(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}X_.$inject=["eventBus","gridSnapping","elementRegistry"];function tL(e){return e==="x"}var nL=1750;function Z_(e,t,n){t.on(["create.start","shape.move.start"],nL,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}))}})}Z_.$inject=["canvas","eventBus","gridSnapping"];var iL=3e3;function eu(e,t,n){ne.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],iL,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||rL(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}eu.$inject=["eventBus","gridSnapping","modeling"],we(eu,ne),eu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=sL(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function rL(e){return e.length>3}function oL(e){return e==="h"}function aL(e){return e==="v"}function sL(e,t,n){var i=Qi(t,n),r={};return oL(i)&&(r.y=e.snapValue(t.y)),aL(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=W({},t,r),n=W({},n,r)),[t,n]}const cL={__depends__:[JD,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",X_],gridSnappingParticipantBehavior:["type",Z_],gridSnappingLayoutConnectionBehavior:["type",eu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",U_]};var lL=30,Q_=30;function Rs(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 nt(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(S(r,"bpmn:SubProcess"))return nt(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Rs.$inject=["eventBus","interactionEvents"],Rs.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Rs.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=fn(e)?{width:lL,height:e.height}:{width:e.width,height:Q_};return this._interactionEvents.createBoxHit(t,"all",n),!0},Rs.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:Q_}),!0};const uL={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Rs]};function tu(e){e.invoke(sa,this)}we(tu,sa),tu.$inject=["injector"],tu.prototype.registerBindings=function(e,t){sa.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 pL={__depends__:[sd],__init__:["keyboardBindings"],keyboardBindings:["type",tu]};var fL={moveSpeed:1,moveSpeedAccelerated:10},dL=1500,J_="left",ew="up",tw="right",nw="down",hL={ArrowLeft:J_,Left:J_,ArrowUp:ew,Up:ew,ArrowRight:tw,Right:tw,ArrowDown:nw,Down:nw},mL={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 iw(e,t,n,i,r){var o=this;this._config=W({},fL,e||{}),t.addListener(dL,function(a){var s=a.keyEvent,c=hL[s.key];if(c&&!t.isCmd(s)){var l=t.isShift(s);return o.moveSelection(c,l),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var l=this._config[s?"moveSpeedAccelerated":"moveSpeed"],u=mL[a](l),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,u)}}}iw.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const gL={__depends__:[sd,mi],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",iw]};var rw=10;function Cs(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,l){var u=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=l,d=nP(u,f,l),c.newBounds=rP(d,p),c.canExecute=r.canResize(c)}function a(c){var l=c.resizeConstraints,u=c.minBounds;l===void 0&&(u===void 0&&(u=r.computeMinResizeBox(c)),c.resizeConstraints={min:De(u)})}function s(c){var l=c.shape,u=c.canExecute,f=c.newBounds;if(u){if(f=hg(f),!yL(l,f))return;n.resizeShape(l,f)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var l={x:c.dx,y:c.dy};o(c.context,l)}),e.on("resize.end",function(c){s(c.context)})}Cs.prototype.canResize=function(e){var t=this._rules,n=Ei(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Cs.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=W({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,ow(t,o),"resize",{autoActivate:!0,cursor:vL(o),data:{shape:t,context:r}})},Cs.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:rw,height:rw},r=ty(t,e.childrenBoxPadding),oP(n,t,i,r)},Cs.$inject=["eventBus","rules","modeling","dragging"];function yL(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function ow(e,t){var n=Ie(e),i=De(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 vL(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 aw="djs-resizing",sw="resize-not-ok",bL=500;function cw(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,aw)),s.width>5&&Ee(c,{x:s.x,width:s.width}),s.height>5&&Ee(c,{y:s.y,height:s.height}),o.canExecute?ot(c).remove(sw):ot(c).add(sw)}function r(o){var a=o.shape,s=o.frame;s&&an(o.frame),t.removeMarker(a,aw)}e.on("resize.move",bL,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}cw.$inject=["eventBus","canvas","previewSupport"];var nu=-6,iu=8,ru=20,As="djs-resizer",xL=["n","w","s","e","nw","ne","se","sw"];function Hr(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&&H(a,Fn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}Hr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){Mr(o)&&i.activate(o,e,n)}je.bind(t,"mousedown",r),je.bind(t,"touchstart",r)},Hr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=_L(i),a=Te("g");ot(a).add(As),ot(a).add(As+"-"+e.id),ot(a).add(As+"-"+i),We(r,a);var s=Te("rect");Ee(s,{x:-iu/2+o.x,y:-iu/2+o.y,width:iu,height:iu}),ot(s).add(As+"-visual"),We(a,s);var c=Te("rect");return Ee(c,{x:-ru/2+o.x,y:-ru/2+o.y,width:ru,height:ru}),ot(c).add(As+"-hit"),We(a,c),yc(a,t,n),a},Hr.prototype.createResizer=function(e,t){var n=ow(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Hr.prototype.addResizer=function(e){var t=this;wt(e)||H(xL,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Hr.prototype.removeResizers=function(){var e=this._getResizersParent();cc(e)},Hr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Hr.$inject=["eventBus","canvas","selection","resize"];function _L(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-nu:e.indexOf("w")!==-1&&(t.x=nu),e.indexOf("s")!==-1?t.y=-nu:e.indexOf("n")!==-1&&(t.y=nu),t}const lw={__depends__:[$i,rr,ia],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Cs],resizePreview:["type",cw],resizeHandles:["type",Hr]};var wL=2e3;function Ps(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"],wL,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 l=c.context,u=l.shape,f=c.context.canExecute,p=c.isTouch;p||f&&(l.hints&&l.hints.createElementsBehavior===!1||s(u))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,l){(l||Ze(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ps.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ps.prototype.activate=function(e){var t=ci(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);W(n,i);var r={},o=n.style||{};return W(o,{backgroundColor:null,border:null}),(Ze(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||uw(e))&&W(r,{centerVertically:!0}),Rr(e)&&(W(r,{resizable:!0,autoResize:!0}),W(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),S(e,"bpmn:TextAnnotation")&&(W(r,{resizable:!0,autoResize:!0}),W(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),W(n,{options:r,style:o}),n}},Ps.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(),l=c.fontSize*a,u=c.lineHeight,f=s.fontSize*a,p=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(S(e,"bpmn:Lane")||RL(e)){var m=fn(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};W(o,h),W(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(SL(e)){var y=fn(e),v=y?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};W(o,v),W(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:y?null:"rotate(-90deg)"})}(Ze(e,["bpmn:Task","bpmn:CallActivity"])||uw(e))&&(W(o,{width:i.width,height:i.height}),W(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),EL(e)&&(W(o,{width:i.width,x:i.x}),W(d,{fontSize:f+"px",lineHeight:p,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&&(W(o,{width:b,height:i.height+2*g,x:i.x-g,y:i.y-g}),W(d,{fontSize:l+"px",lineHeight:u})),Rr(n)&&!xc(n)&&!Xe(n)){var _=yp(e),C=t.getAbsoluteBBox({x:_.x,y:_.y,width:0,height:0}),M=l,O=ro.width*a+2*g;W(o,{width:O,height:M+2*g,x:C.x-O/2,y:C.y-M/2-g}),W(d,{fontSize:l+"px",lineHeight:u})}return S(e,"bpmn:TextAnnotation")&&(W(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}),W(d,{textAlign:"left",paddingTop:Vo*a+"px",paddingBottom:Vo*a+"px",paddingLeft:Vo*a+"px",paddingRight:Vo*a+"px",fontSize:f+"px",lineHeight:p})),{bounds:o,style:d}},Ps.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}),CL(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function uw(e){return S(e,"bpmn:SubProcess")&&!nt(e)}function EL(e){return S(e,"bpmn:SubProcess")&&nt(e)}function SL(e){return S(e,"bpmn:Participant")&&!nt(e)}function RL(e){return S(e,"bpmn:Participant")&&nt(e)}function CL(e){return!e||!e.trim()}var pw="djs-element-hidden",fw="djs-label-hidden";function dw(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var l=c.active;if(o=l.element.label||l.element,S(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Te("g");var u=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),f=i.path=Te("path");Ee(f,{d:u,strokeWidth:2,stroke:AL(o)}),We(s,f),We(r,s),_n(s,o.x,o.y)}S(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,pw):(S(o,"bpmn:Task")||S(o,"bpmn:CallActivity")||S(o,"bpmn:SubProcess")||S(o,"bpmn:Participant")||S(o,"bpmn:Lane"))&&t.addMarker(o,fw)}),e.on("directEditing.resize",function(c){if(S(o,"bpmn:TextAnnotation")){var l=c.height,u=c.dy,f=Math.max(o.height/a.height*(l+u),0),p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:f,position:{mx:0,my:0}});Ee(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,pw),t.removeMarker(o,fw)),o=void 0,a=void 0,s&&(an(s),s=void 0)})}dw.$inject=["eventBus","canvas","pathMap"];function AL(e,t){var n=ct(e);return n.get("stroke")||t||"black"}const PL={__depends__:[Bf,lw,$_],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ps],labelEditingPreview:["type",dw]};var ML=500,TL=1e3;function Hi(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){rC(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){H(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],ML,function(o){var a=o.element,s=o.gfx,c=bt(".djs-outline",s);c&&i.updateOutline(a,c)})}Hi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=bt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),We(t,n),this.updateOutline(e,n)),n},Hi.prototype._createOutlineGfx=function(){var e=Te("rect");return Ee(e,W({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Hi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Hi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&H(i,function(r){n=n||r.updateOutline(t,e)}),n||Ee(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Hi.prototype.updateConnectionOutline=function(e,t){var n=Zt(t);Ee(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Hi.prototype.registerProvider=function(e,t){t||(t=e,e=TL),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Hi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Hi.prototype.getOutline=function(e){var t,n=this._getProviders();return H(n,function(i){pn(i.getOutline)&&(t=t||i.getOutline(e))}),t},Hi.$inject=["eventBus","styles","elementRegistry"];var ou=6;function Ld(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)})}Ld.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");cc(t);var n=e.length>1,i=this._canvas.getContainer();if(ot(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=kL(Zt(e)),o=Te("rect");Ee(o,W({rx:3},r)),ot(o).add("djs-selection-outline"),We(t,o)}},Ld.$inject=["eventBus","canvas","selection"];function kL(e){return{x:e.x-ou,y:e.y-ou,width:e.width+ou*2,height:e.height+ou*2}}const Id={__depends__:[mi],__init__:["outline","multiSelectionOutline"],outline:["type",Hi],multiSelectionOutline:["type",Ld]},hw=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],mw={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},OL=15,au=2;function gw(e,t,n,i,r){const o=t.getLayer("overlays");e.on(["selection.changed","shape.changed"],function(){s()}),e.on("selection.changed",function({newSelection:f}){var d;const p=f.filter(m=>Ze(m,hw));if(p.length===1){const m=p[0];Xe(m)?a(m,m.labelTarget):(d=m.labels)!=null&&d.length&&a(m.labels[0],m)}if(p.length===2){const m=p.find(Xe),h=p.find(y=>{var v;return(v=y.labels)==null?void 0:v.includes(m)});m&&h&&a(m,h)}}),e.on("shape.changed",function({element:f}){var p;!Ze(f,hw)||!u(f)||(Xe(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=ka([Ie(p),Ie(f)],mw),m=d.getAttribute("d"),y=r.isSelected(f)?c(f):l(f),v=Ia(y,m);if(!v)return;const b=r.isSelected(p)?c(p):l(p),_=Ia(b,m)||Ie(p);Wa(_,v)<OL||(lp(d,[_,v]),We(o,d))}function s(){sc(`.${mw.class}`,o).forEach(an)}function c(f){const p=i.getOutline(f);if(!p)return l(f);if(p.x){const d={x:f.x+zr(p,"x")-au,y:f.y+zr(p,"y")-au,width:zr(p,"width")+au*2,height:zr(p,"height")+au*2};return bp(d,zr(p,"rx"))}if(p.cx){const d=zr(p,"r"),m={x:f.x+zr(p,"cx")-d,y:f.y+zr(p,"cy")-d,width:d*2,height:d*2};return $g(m)}}function l(f){return n.getShapePath(f)}function u(f){return r.isSelected(f)}}gw.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function zr(e,t){return parseFloat(Ee(e,t)||0)}const DL={__depends__:[mi,Id],__init__:["labelLink"],labelLink:["type",gw]};var LL=new na("tt");function IL(e){var t=kt('<div class="djs-tooltip-container" />');return Bn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function BL(e,t,n){Bn(e,{left:t+"px",top:n+"px"})}function Bd(e,t){e.style.display=t===!1?"none":""}var yw="djs-tooltip",Nd="."+yw;function Hn(e,t){this._eventBus=e,this._canvas=t,this._ids=LL,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=IL(t.getContainer());var n=this;Un.bind(this._tooltipRoot,Nd,"mousedown",function(i){i.stopPropagation()}),Un.bind(this._tooltipRoot,Nd,"mouseover",function(i){n.trigger("mouseover",i)}),Un.bind(this._tooltipRoot,Nd,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Hn.$inject=["eventBus","canvas"],Hn.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=W({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Hn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Tn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Hn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Hn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Hn.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)}},Hn.prototype.remove=function(e){var t=this.get(e);t&&(Oi(t.html),Oi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Hn.prototype.show=function(){Bd(this._tooltipRoot)},Hn.prototype.hide=function(){Bd(this._tooltipRoot,!1)},Hn.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},Hn.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)),zn(n)&&(n=kt(n)),i=kt('<div data-tooltip-id="'+t+'" class="'+yw+'">'),Bn(i,{position:"absolute"}),i.appendChild(n),e.type&&Bt(i).add("djs-tooltip-"+e.type),e.className&&Bt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Hn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;BL(n,t.x,t.y)},Hn.prototype._updateTooltipVisibilty=function(e){H(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Bd(i,r))})},Hn.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 NL={__init__:["tooltips"],tooltips:["type",Hn]};var $L="flow elements must be children of pools/participants",FL="Data object must be placed within a pool/participant.";function vw(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($L)):S(a,"bpmn:DataObjectReference")&&i(r,n(FL)))})}vw.$inject=["eventBus","tooltips","translate"];const jL={__depends__:[NL],__init__:["modelingFeedback"],modelingFeedback:["type",vw]};var HL=500,zL=1250,GL=1500,su=Math.round;function VL(e){return{x:e.x+su(e.width/2),y:e.y+su(e.height/2)}}function bw(e,t,n,i,r){function o(s,c,l,u){return r.allowed("elements.move",{shapes:s,delta:c,position:l,target:u})}e.on("shape.move.start",GL,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=WL(u),W(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",zL,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=o(l),!u)return!1}),e.on("shape.move.move",HL,function(s){var c=s.context,l=c.validatedShapes,u=s.hover,f={x:s.dx,y:s.dy},p={x:s.x,y:s.y},d;if(d=o(l,f,p,u),c.delta=f,c.canExecute=d,d===null){c.target=null;return}c.target=u}),e.on("shape.move.end",function(s){var c=s.context,l=c.delta,u=c.canExecute,f=u==="attach",p=c.shapes;if(u===!1)return!1;l.x=su(l.x),l.y=su(l.y),!(l.x===0&&l.y===0)&&n.moveElements(p,l,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(Mr(s)){var c=Qo(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,l,u){if(un(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!ot(s.target).has("djs-hit-no-move")){var f=VL(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:l,data:{shape:c,context:u||{}}});if(p!==!1)return!0}}this.start=a}bw.$inject=["eventBus","dragging","modeling","selection","rules"];function WL(e){var t=Co(e,"id");return Qe(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var xw=499,$d="djs-dragging",_w="drop-ok",ww="drop-not-ok",Ew="new-parent",Sw="attach-ok";function Rw(e,t,n,i){function r(c){var l=o(c),u=UL(l);return u}function o(c){var l=Oa(c),u=l.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=l.concat(u),p=[...new Set(f)];return p}function a(c,l){[Sw,_w,ww,Ew].forEach(function(u){u===l?t.addMarker(c,u):t.removeMarker(c,u)})}function s(c,l,u){i.addDragger(l,c.dragGroup),u&&t.addMarker(l,$d),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",xw,function(c){var l=c.context,u=l.shapes,f=l.allDraggedElements,p=r(u);if(!l.dragGroup){var d=Te("g");Ee(d,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();We(m,d),l.dragGroup=d}p.forEach(function(h){i.addDragger(h,l.dragGroup)}),f?f=bu([f,o(u)]):f=o(u),H(f,function(h){t.addMarker(h,$d)}),l.allDraggedElements=f,l.differentParents=YL(u)}),e.on("shape.move.move",xw,function(c){var l=c.context,u=l.dragGroup,f=l.target,p=l.shape.parent,d=l.canExecute;f&&(d==="attach"?a(f,Sw):l.canExecute&&p&&f.id!==p.id?a(f,Ew):a(f,l.canExecute?_w:ww)),_n(u,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var l=c.context,u=l.target;u&&a(u,null)}),e.on("shape.move.cleanup",function(c){var l=c.context,u=l.allDraggedElements,f=l.dragGroup;H(u,function(p){t.removeMarker(p,$d)}),f&&an(f)}),this.makeDraggable=s}Rw.$inject=["eventBus","canvas","styles","previewSupport"];function UL(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Qe(e,function(i){return wt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function YL(e){return cE(Co(e,function(t){return t.parent&&t.parent.id}))!==1}const qL={__depends__:[Zc,mi,Id,$i,rr,ia],__init__:["move","movePreview"],move:["type",bw],movePreview:["type",Rw]};var Cw=".djs-palette-toggle",Aw=".entry",KL=Cw+", "+Aw,Fd="djs-palette-",XL="shown",jd="open",Pw="two-column",ZL=1e3;function nn(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()})}nn.$inject=["eventBus","canvas"],nn.prototype.registerProvider=function(e,t){t||(t=e,e=ZL),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},nn.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(JL,{})},nn.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},nn.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=kt(nn.HTML_MARKUP);n.appendChild(i),Bt(n).add(Fd+XL),Un.bind(i,KL,"click",function(r){var o=r.delegateTarget;if(ep(o,Cw))return e.toggle();e.trigger("click",r)}),je.bind(i,"mousedown",function(r){r.stopPropagation()}),Un.bind(i,Aw,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},nn.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},nn.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=Bt(n),a=Bt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Pw,r),a.toggle(Fd+Pw,r),"open"in e&&(o.toggle(jd,e.open),a.toggle(Fd+jd,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},nn.prototype._update=function(){var e=bt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();oc(e),H(t,function(n,i){var r=n.group||"default",o=bt("[data-group="+ds(r)+"]",e);o||(o=kt('<div class="group"></div>'),Tn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=kt(a);if(o.appendChild(s),!n.separator&&(Tn(s,"data-action",i),n.title&&Tn(s,"title",n.title),n.className&&QL(s,n.className),n.imageUrl)){var c=kt("<img>");Tn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},nn.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=Tn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},nn.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(pn(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},nn.prototype._layoutChanged=function(){this._toggleState({})},nn.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},nn.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},nn.prototype.open=function(){this._toggleState({open:!0})},nn.prototype.toggle=function(){this.isOpen()?this.close():this.open()},nn.prototype.isActiveTool=function(e){return e&&this._activeTool===e},nn.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=bt(".djs-palette-entries",this._container),this._toolsContainer=bt("[data-group=tools]",t)),n=this._toolsContainer,H(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=Bt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},nn.prototype.isOpen=function(){return Bt(this._container).has(jd)},nn.prototype._getParentContainer=function(){return this._canvas.getContainer()},nn.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function QL(e,t){var n=Bt(e),i=Le(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function JL(e,t){var n=t.getPaletteEntries();return pn(n)?n(e):(H(n,function(i,r){e[r]=i}),e)}const eI={__init__:["palette"],palette:["type",nn]};var Mw="crosshair",Tw="selected",tI="djs-dragging-active-lasso";function Gr(e,t,n,i,r,o,a){this._selection=r,this._dragging=n,this._mouse=a;var s=this,c={create:function(f){var p=t.getActiveLayer(),d=f.frame=Te("rect");Ee(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),We(p,d),l(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&Ee(p,{x:d.x,y:d.y,width:d.width,height:d.height});var m=f.marked,h=f.lastMarked;if(m&&h){for(const y of h)m.has(y)||t.removeMarker(y,Tw);for(const y of m)h.has(y)||t.addMarker(y,Tw)}},remove:function(f){this.update(f),f.frame&&an(f.frame),l(!1)}};function l(f){ot(t.getContainer()).toggle(tI,f)}function u(f){var p=i.getAll();return new Set(Ro(Fo(p,f)))}o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(f){var p=f.originalEvent.target;!f.hover&&!(p instanceof SVGElement)||e.once("lasso.selection.ended",function(){s.activateLasso(f.originalEvent,!0)})}),e.on("lasso.end",0,function(f){var p=f.context;s._select(Array.from(p.marked))}),e.on("lasso.start",function(f){var p=f.context;p.bbox=kw(f),p.add=Vc(f),p.lastMarked=new Set(r.get()),p.add?p.marked=p.lastMarked:p.marked=new Set,p.initialMarked=p.marked,c.create(p)}),e.on("lasso.move",function(f){var p=f.context,d=p.bbox=kw(f),m=u(d),h=p.initialMarked.union(m);p.lastMarked=p.marked,p.marked=h,c.update(p)}),e.on("lasso.cleanup",function(f){var p=f.context;p.lastMarked=p.marked,p.marked=new Set(r.get()),c.remove(f.context)}),e.on("element.mousedown",1500,function(f){if(Vc(f))return s.activateLasso(f.originalEvent),!0})}Gr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Gr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Mw,data:{context:{}},keepSelection:!0})},Gr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Mw,data:{context:{}},keepSelection:!0})},Gr.prototype._select=function(e){this._selection.select(e)},Gr.prototype.select=function(e,t,n=[]){var i=Ro(Fo(e,t));this._select([...n,...i])},Gr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Gr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function kw(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 nI={__depends__:[tl,Za],__init__:["lassoTool"],lassoTool:["type",Gr]};var Hd=1500,Ow="grab";function ma(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",Hd,function(c){if(qa(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Hd,function(c){if(!(!Dw(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(Hd,function(c){!Dw(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var l=c.originalEvent.target;if(!c.hover&&!(l instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var l=t.viewbox().scale;t.scroll({dx:c.dx*l,dy:c.dy*l})}),e.on("hand.move.end",function(c){var l=c.context,u=l.reactivate;return!qa(c)&&u&&e.once("hand.move.ended",function(f){a.activateHand(f.originalEvent,!0,!0)}),!1})}ma.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],ma.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Ow,data:{context:n||{}}})},ma.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Ow,data:{context:{reactivate:n}}})},ma.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},ma.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function Dw(e){return sn("Space",e)}const iI={__depends__:[tl,Za],__init__:["handTool"],handTool:["type",ma]};var Lw="connect-ok",Iw="connect-not-ok";function ga(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 l=c.context,u=c.hover,f=l.canStartConnect=s.canStartConnect(u);f!==null&&(l.startTarget=u,i.addMarker(u,f?Lw:Iw))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?Lw:Iw)}),e.on(["global-connect.ended"],function(c){var l=c.context,u=l.startTarget,f={x:c.x,y:c.y},p=s.canStartConnect(u);if(p)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,u,f)}),!1})}ga.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],ga.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},ga.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},ga.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},ga.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const rI={__depends__:[Td,$i,rr,tl,Za],globalConnect:["type",ga]};function zd(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)}zd.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],zd.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(f,p,d,m,h){function y(v){var g=n.createShape(W({type:f},h));t.start(v,g)}return{group:p,className:d,title:m,action:{dragstart:y,click:y}}}function l(f){var p=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:p});t.start(f,[p,d],{hints:{autoSelect:[p]}})}function u(f){t.start(f,n.createParticipantShape())}return W(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(f){o.activateHand(f)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(f){r.activateSelection(f)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(f){i.activateSelection(f)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(f){a.start(f)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:u,click:u}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const oI={__depends__:[eI,Jc,nb,nI,iI,rI,Ha],__init__:["paletteProvider"],paletteProvider:["type",zd]};var aI=250;function Gd(e,t,n,i,r){ne.call(this,e);function o(s){var c=s.canExecute.replacements;H(c,function(l){var u=l.oldElementId,f={type:l.newElementType};if(!s.visualReplacements[u]){var p=t.get(u);W(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var m=bt('[data-element-id="'+ds(p.id)+'"]',s.dragGroup);m&&Ee(m,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;H(c,function(l,u){var f=bt('[data-element-id="'+ds(u)+'"]',s.dragGroup);f&&Ee(f,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",aI,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?o(c):a(c)})}Gd.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],we(Gd,ne);const sI={__depends__:[ia],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Gd]};var cI=1250,Vd=40,lI=20,uI=10,Bw=20,Nw=["x","y"],pI=Math.abs;function $w(e){e.on(["connect.hover","connect.move","connect.end"],cI,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Kn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&fI(t,o,gI(o)),o&&mI(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=vi(r),Ze(o,["bpmn:Event","bpmn:Gateway"])&&Fw(t,vi(o)),Ze(o,["bpmn:Task","bpmn:SubProcess"])&&dI(t,o),S(a,"bpmn:BoundaryEvent")&&s===a.host&&hI(t)):jw(i,"bpmn:MessageFlow")?(S(r,"bpmn:Event")&&(n.connectionStart=vi(r)),S(o,"bpmn:Event")&&Fw(t,vi(o))):n.connectionStart=n.initialConnectionStart)})}$w.$inject=["eventBus"];function fI(e,t,n){Nw.forEach(function(i){var r=Hw(i,t);e[i]<t[i]+n?tn(e,i,t[i]+n):e[i]>t[i]+r-n&&tn(e,i,t[i]+r-n)})}function dI(e,t){var n=vi(t);Nw.forEach(function(i){yI(e,t,i)&&tn(e,i,n[i])})}function hI(e){var t=e.context,n=t.source,i=t.target;if(!vI(t)){var r=vi(n),o=xn(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],l;pI(c-r[s])<Vd&&(c>r[s]?l=r[s]+Vd:l=r[s]-Vd,tn(e,s,l))})}}function Fw(e,t){tn(e,"x",t.x),tn(e,"y",t.y)}function jw(e,t){return e&&e.type===t}function mI(e,t){return hr(t,function(n){return jw(e,n)})}function Hw(e,t){return e==="x"?t.width:t.height}function gI(e){return S(e,"bpmn:Task")?uI:lI}function yI(e,t,n){return e[n]>t[n]+Bw&&e[n]<t[n]+Hw(n,t)-Bw}function vI(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Vr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Vr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Vr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Vr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Vr.prototype.getSnapLocations=function(){return this._snapLocations},Vr.prototype.setSnapLocations=function(e){this._snapLocations=e},Vr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new cu,n.initDefaults(this._defaultSnaps)),n};function cu(){this._snapValues={}}cu.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)},cu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&aD(e[n],r[n],i)},cu.prototype.initDefaults=function(e){var t=this;H(e||{},function(n,i){H(n,function(r){t.add(i,r)})})};var bI=1250;function zi(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"],bI,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Kn(r.originalEvent))&&!(ha(r)||!c)){var l=s.pointsForTarget(c);l.initialized||(l=i.addSnapTargetPoints(l,a,c),l.initialized=!0),n.snap(r,l)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}zi.$inject=["elementRegistry","eventBus","snapping"],zi.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Vr);var o;t.get(i.id)?o=vi(i,e):o={x:e.x+vi(i).x,y:e.y+vi(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),Xe(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},zi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return H(i,function(r){if(Xe(r)){Xe(t)&&e.add("mid",vi(r));return}if(wt(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);H(o,function(a){e.add("mid",a)});return}e.add("mid",vi(r))}),!Fe(t.x)||!Fe(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",vi(t)),e},zi.prototype.getSnapTargets=function(e,t){return A_(t).filter(function(n){return!xI(n)})};function xI(e){return!!e.hidden}var zw=1500;function ya(e,t){t.invoke(zi,this),e.on(["create.move","create.end"],zw,SI),e.on(["create.move","create.end","shape.move.move","shape.move.end"],zw,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!ha(n)&&_I(n,o)})}we(ya,zi),ya.$inject=["eventBus","injector"],ya.prototype.initSnap=function(e){var t=zi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return H(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Vw(o,i,e))}),H(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",Vw(o,i,e))}),S(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},ya.prototype.addSnapTargetPoints=function(e,t,n){zi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);H(i,function(o){(EI(o)||wI([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",R_(o)),e.add("bottom-right",C_(o)))});var r=this._elementRegistry;return H(t.incoming,function(o){if(r.get(t.id)){Gw(i,o.source)||e.add("mid",Ie(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),H(t.outgoing,function(o){if(r.get(t.id)){Gw(i,o.target)||e.add("mid",Ie(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},ya.prototype.getSnapTargets=function(e,t){return zi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!S(n,"bpmn:Lane")})};function _I(e,t){var n=De(t),i=Qy(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Ie(o),/top/.test(i)?tn(e,"y",n.top-a.y):/bottom/.test(i)&&tn(e,"y",n.bottom-a.y),/left/.test(i)?tn(e,"x",n.left-a.x):/right/.test(i)&&tn(e,"x",n.right-a.x)}function wI(e,t){return e.every(function(n){return S(n,t)})}function EI(e){return S(e,"bpmn:SubProcess")&&nt(e)?!0:S(e,"bpmn:Participant")}function SI(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)&&tn(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&tn(e,"y",e.y)}}function Gw(e,t){return e.indexOf(t)!==-1}function Vw(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var RI=1250;function Ms(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],RI,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Kn(i.originalEvent))&&!ha(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,o,a,s),l.initialized=!0),PI(s)&&tn(i,"x",i.x),MI(s)&&tn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ms.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Vr);var o=Ww(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ms.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return H(r,function(o){e.add("corner",C_(o)),e.add("corner",R_(o))}),e.add("corner",Ww(t,i)),e},Ms.$inject=["eventBus","snapping"],Ms.prototype.getSnapTargets=function(e,t){return A_(t).filter(function(n){return!CI(n,e)&&!wt(n)&&!AI(n)&&!Xe(n)})};function Ww(e,t){var n=Ie(e),i=De(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 CI(e,t){return e.host===t}function AI(e){return!!e.hidden}function PI(e){return e==="n"||e==="s"}function MI(e){return e==="e"||e==="w"}var TI=7,kI=1e3;function Wr(e){this._canvas=e,this._asyncHide=_u(Fn(this.hide,this),kI)}Wr.$inject=["canvas"],Wr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:ha(e,"x"),y:ha(e,"y")};H(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(H(["x","y"],function(l){var u;o[l]||(u=t.snap(c,a,l,TI),u!==void 0&&(o[l]={value:u,originValue:u-s[l]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),H(["x","y"],function(a){var s=o[a];un(s)&&tn(e,a,s.originValue)})},Wr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Te("path");return Ee(n,{d:"M0,0 L0,0"}),ot(n).add("djs-snap-line"),We(t,n),{update:function(i){Fe(i)?e==="horizontal"?Ee(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Ee(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Ee(n,{display:"none"})}}},Wr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Wr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Wr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Wr.prototype.hide=function(){H(this._snapLines,function(e){e.update()})};const OI={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",zi],resizeSnapping:["type",Ms],snapping:["type",Wr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",$w],createMoveSnapping:["type",ya]};var Uw=300;function Ue(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=bt(Ue.INPUT_SELECTOR,this._container),this._resultsContainer=bt(Ue.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ue.$inject=["canvas","eventBus","selection","translate"],Ue.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Un.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ue.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ue.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ue.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ue.INPUT_SELECTOR,"keydown",function(n){sn("ArrowUp",n)&&n.preventDefault(),sn("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ue.INPUT_SELECTOR,"keyup",function(n){if(sn("Escape",n))return e.close();if(sn("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(sn("ArrowUp",n))return e._scrollToDirection(!0);if(sn("ArrowDown",n))return e._scrollToDirection();sn(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},Ue.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Un.unbind(e.el,e.type,e.listener)})},Ue.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=bt(Ue.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ue.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ue.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)}},Ue.prototype._clearResults=function(){oc(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ue.prototype._getCurrentResult=function(){return bt(Ue.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ue.prototype._createResultNode=function(e,t){var n=kt(Ue.RESULT_HTML);return e.primaryTokens.length>0&&Yw(n,e.primaryTokens,Ue.RESULT_PRIMARY_HTML),Yw(n,e.secondaryTokens,Ue.RESULT_SECONDARY_HTML),Tn(n,Ue.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ue.prototype.registerProvider=function(e){this._searchProvider=e},Ue.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,Bt(this._canvas.getContainer()).add("djs-search-open"),Bt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ue.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,Bt(this._canvas.getContainer()).remove("djs-search-open"),Bt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ue.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ue.prototype.isOpen=function(){return this._open},Ue.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Bt(t).remove(Ue.RESULT_SELECTED_CLASS);var n=Tn(e,Ue.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Bt(e).add(Ue.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:Uw}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ue.prototype._select=function(e){var t=Tn(e,Ue.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:Uw}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ue.prototype._getBoxHtml=function(){const e=kt(Ue.BOX_HTML),t=bt(Ue.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function Yw(e,t,n){var i=DI(t),r=kt(n);r.innerHTML=i,e.appendChild(r)}function DI(e){var t="";return e.forEach(function(n){var i=tx(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Ue.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ue.CONTAINER_SELECTOR=".djs-search-container",Ue.INPUT_SELECTOR=".djs-search-input input",Ue.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ue.RESULT_SELECTOR=".djs-search-result",Ue.RESULT_SELECTED_CLASS="djs-search-result-selected",Ue.RESULT_SELECTED_SELECTOR="."+Ue.RESULT_SELECTED_CLASS,Ue.RESULT_ID_ATTRIBUTE="data-result-id",Ue.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ue.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>`,We.RESULT_HTML='<div class="djs-search-result"></div>',We.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',We.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const kL={__depends__:[za,Sl,mi],searchPad:["type",We]};function Vd(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Vd.$inject=["elementRegistry","searchPad","canvas","search"],Vd.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Xe(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:ci(i),id:i.id})),e,{keys:["label","id"]}).map(OL)};function OL(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const DL={__depends__:[kL,n_],__init__:["bpmnSearch"],bpmnSearch:["type",Vd]},IL="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",LL="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",BL={width:36,height:50},NL={width:50,height:50};function Ww(e,t,n){return Me("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const _i=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(ZC(e))return n=Me("rect"),Ee(n,W({x:-_i,y:-_i,rx:4,width:e.width+_i*2,height:e.height+_i*2},t)),n;if(!Xe(e))return S(e,"bpmn:Gateway")?(n=Me("rect"),W(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Ee(n,W({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Ze(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Me("rect"),Ee(n,W({x:-_i,y:-_i,rx:14,width:e.width+_i*2,height:e.height+_i*2},t))):S(e,"bpmn:EndEvent")?(n=Me("circle"),Ee(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+_i+1},t))):S(e,"bpmn:Event")?(n=Me("circle"),Ee(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+_i},t))):S(e,"bpmn:DataObjectReference")&&Uw(e,"bpmn:DataObjectReference")?n=Ww(IL,{x:-6,y:-6},t):S(e,"bpmn:DataStoreReference")&&Uw(e,"bpmn:DataStoreReference")&&(n=Ww(LL,{x:-6,y:-6},t)),n},lu.prototype.updateOutline=function(e,t){if(!Xe(e))return Ze(e,["bpmn:SubProcess","bpmn:Group"])?(Ee(t,{width:e.width+_i*2,height:e.height+_i*2}),!0):!!Ze(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function Uw(e,t){var n;return t==="bpmn:DataObjectReference"?n=BL:t==="bpmn:DataStoreReference"&&(n=NL),e.width===n.width&&e.height===n.height}const $L={__depends__:[Id],__init__:["outlineProvider"],outlineProvider:["type",lu]};var FL='<?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 Vi(e){Go.call(this,e)}we(Vi,Go),Vi.Viewer=$r,Vi.NavigatedViewer=ms,Vi.prototype.createDiagram=function(){return this.importXML(FL)},Vi.prototype._interactionModules=[ox,sx,ux],Vi.prototype._modelingModules=[HO,_l,UO,VO,oD,Md,pD,BD,zv,Jc,jD,GD,oI,sI,cI,dI,RI,TI,Qf,NI,WI,nL,rL,aw,ML,DL,$L],Vi.prototype._modules=[].concat($r.prototype._modules,Vi.prototype._interactionModules,Vi.prototype._modelingModules);const jL=ye.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=ye.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),f=Du(u);return r("imported",f),{warnings:f}}catch(u){throw r("import-error",u),u}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:l}=await a.saveXML({format:!0});return l??""}return ye.onMounted(async()=>{a=new Vi({container:o.value,moddleExtensions:Gs}),i.xml&&await s(i.xml),r("ready")}),ye.watch(()=>i.xml,l=>{l&&a&&s(l)}),ye.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(ye.openBlock(),ye.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),Yw=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n},HL=Yw(jL,[["__scopeId","data-v-a9b41c97"]]),zL=["title","aria-expanded"],GL=["title","onClick"],VL={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},WL={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},UL={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},YL={key:0,class:"bwl-validation__body"},qL={key:0,class:"bwl-validation__empty"},KL={key:1,class:"bwl-validation__empty"},XL={key:2,class:"bwl-validation__list"},ZL=["onClick"],QL={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},JL={class:"bwl-validation__msg"},eB=["title"],tB=Yw(ye.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=ye.computed(()=>Yb(n.issues.value,n.describeElement)),r=ye.computed(()=>qb(i.value)),o=m=>sa(m,n.changeScope.value),a=ye.computed(()=>rd(i.value,n.changeScope.value)),s=ye.ref({error:!0,warning:!0,info:!0}),c=ye.computed(()=>Kb(i.value.filter(m=>s.value[m.severity]),n.changeScope.value)),l=ye.ref(!1),u=["error","warning","info"],f={error:"오류",warning:"경고",info:"정보"};function p(m){if(!l.value){l.value=!0;return}s.value[m]=!s.value[m]}function d(m){const h=m.targetRefs[0];h&&n.requestFocus(h)}return(m,h)=>(ye.openBlock(),ye.createElementBlock("section",{class:ye.normalizeClass(["bwl-validation",{"is-open":l.value}])},[ye.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[ye.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(ye.openBlock(),ye.createElementBlock("svg",{class:ye.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[ye.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=ye.createElementVNode("span",null,"검증",-1))],8,zL),ye.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=ye.withModifiers(()=>{},["stop"]))},[(ye.openBlock(),ye.createElementBlock(ye.Fragment,null,ye.renderList(u,y=>ye.createElementVNode("button",{key:y,type:"button",class:ye.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${f[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:v=>p(y)},[(ye.openBlock(),ye.createElementBlock("svg",VL,[h[4]||(h[4]=ye.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(ye.openBlock(),ye.createElementBlock("path",WL)):(ye.openBlock(),ye.createElementBlock("path",UL))])),ye.createElementVNode("span",null,ye.toDisplayString(r.value[y]),1)],10,GL)),64))])]),l.value?(ye.openBlock(),ye.createElementBlock("div",YL,[i.value.length===0?(ye.openBlock(),ye.createElementBlock("p",qL,"발견된 문제가 없습니다.")):c.value.length===0?(ye.openBlock(),ye.createElementBlock("p",KL," 선택한 심각도에 해당하는 항목이 없습니다. ")):(ye.openBlock(),ye.createElementBlock("ul",XL,[(ye.openBlock(!0),ye.createElementBlock(ye.Fragment,null,ye.renderList(c.value,y=>(ye.openBlock(),ye.createElementBlock("li",{key:y.key,class:ye.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:v=>d(y)},[h[5]||(h[5]=ye.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&o(y)?(ye.openBlock(),ye.createElementBlock("span",QL,"이번 변경")):ye.createCommentVNode("",!0),ye.createElementVNode("span",JL,ye.toDisplayString(y.message),1),ye.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},ye.toDisplayString(y.category),9,eB)],10,ZL))),128))]))])):ye.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]);ee.ADDABLE_FLOW_NODE_TYPES=Ls,ee.APPLY_BPMN_OPS_SCHEMA=tE,ee.BPMN_MODDLE_EXTENSIONS=Gs,ee.BWL_MODDLE_SCHEMA=Jd,ee.BWL_NS=Qd,ee.BWL_PREFIX=mu,ee.BWL_SIDES=gu,ee.BpmnModelerView=HL,ee.BpmnValidationPanel=tB,ee.EDITOR=XS,ee.FLOW_LABEL_INDENT=Dh,ee.HEADLESS_BPMN_MODULES=zb,ee.HEADLESS_TEXT_METRICS=Oo,ee.I18N_NS=D1,ee.I18N_PREFIX=Sh,ee.IR_FLOW_NODE_TYPES=qr,ee.LABEL_FORK_MARGIN=Nu,ee.SEVERITY_ORDER=id,ee.SYMBOLIC_OP_KINDS=nh,ee.SYMBOLIC_OP_SCHEMA=ih,ee.UNDO_EPISODE_COMMAND=yu,ee.applyBpmnOpBatch=Lm,ee.applyBpmnOps=Am,ee.approximateTextWidth=Do,ee.auditBpmnGeometry=Uh,ee.auditBpmnGeometryXml=aS,ee.auditBpmnSemantics=Xu,ee.auditBpmnSemanticsXml=HS,ee.auditGeometry=It,ee.auditTargetsOf=oi,ee.axisSegmentsOf=In,ee.blackBoxNameRect=Lu,ee.buildBpmnOpBatch=KS,ee.buildRegistryIndex=qh,ee.containerBoundarySegments=Aa,ee.countBySeverity=qb,ee.createBpmnEditorController=ZS,ee.createBpmnModdle=Rh,ee.createHeadlessBpmnModeler=yk,ee.crossedShapesOf=yn,ee.crossingCost=ri,ee.describeProcess=km,ee.describeProcessXml=LS,ee.diffBpmnElements=Im,ee.diffBpmnElementsXml=YS,ee.edgeCrossCount=Ma,ee.edgeCrossingPairsOf=Ks,ee.edgeCrossingStatsOf=jh,ee.executeAsUndoEpisode=th,ee.followMovedEdgeLabels=hm,ee.forwardThreePointCandidates=Zs,ee.geometryFindingKey=Tt,ee.installHeadlessBpmnDom=Ah,ee.isAddableFlowNodeType=Zd,ee.isChangeScopeMixed=rd,ee.isEdgeOverlapFinding=Bu,ee.isInChangeScope=sa,ee.isIrFlowNodeType=Xd,ee.labelRectsOf=Bo,ee.lineCrossesLabel=Ki,ee.lineThroughLabel=Lh,ee.lineThroughShapeLabel=Vh,ee.loadBpmnXml=ko,ee.lowerOps=Cm,ee.oppositeOverlapCount=U1,ee.oppositeOverlapOf=Oh,ee.planBackEdgeBoundaryClearance=im,ee.planCrossPoolRoute=em,ee.planEdgeRepair=Hu,ee.planLabelLineClearance=dm,ee.planLabelPlacement=fm,ee.planMiddleSegmentShifts=Xh,ee.planOppositeOverlapRepair=om,ee.planSegmentDetours=Xs,ee.planShapeLabelClearance=ym,ee.redockIntroducedDetachedEndpoints=bm,ee.repairIntroducedBoundaryHugging=rm,ee.repairIntroducedCrossings=zu,ee.repairIntroducedEdgeCrossings=Qh,ee.repairIntroducedFakeMerges=sm,ee.repairIntroducedLabelLines=mm,ee.repairIntroducedOppositeOverlaps=pm,ee.repairIntroducedShapeLabelLines=vm,ee.repairIntroducedSharedSegmentLabels=gm,ee.rerouteIntroducedCrossPoolEdges=tm,ee.resolverServicesOf=Em,ee.saveBpmnXml=I1,ee.sceneCrossingCost=Fh,ee.sceneFromDefinitions=Wh,ee.sceneFromRegistry=tt,ee.segmentShapeClearance=qs,ee.sharedSegmentUnderLabel=Ys,ee.sharedSpansOf=Us,ee.sortPanelIssues=Kb,ee.toPanelIssues=Yb,ee.touchedElements=qS,ee.unreadableOverlapCount=ii,ee.unreadableOverlapOf=Io,ee.validateOps=wm,ee.warningMessages=Du,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})}));
343
+ </div>`,Ue.RESULT_HTML='<div class="djs-search-result"></div>',Ue.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ue.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const LI={__depends__:[Ha,Sl,mi],searchPad:["type",Ue]};function Wd(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}Wd.$inject=["elementRegistry","searchPad","canvas","search"],Wd.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Xe(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:ci(i),id:i.id})),e,{keys:["label","id"]}).map(II)};function II(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const BI={__depends__:[LI,o_],__init__:["bpmnSearch"],bpmnSearch:["type",Wd]},NI="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",$I="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",FI={width:36,height:50},jI={width:50,height:50};function qw(e,t,n){return Te("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const _i=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(eA(e))return n=Te("rect"),Ee(n,W({x:-_i,y:-_i,rx:4,width:e.width+_i*2,height:e.height+_i*2},t)),n;if(!Xe(e))return S(e,"bpmn:Gateway")?(n=Te("rect"),W(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Ee(n,W({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Ze(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Te("rect"),Ee(n,W({x:-_i,y:-_i,rx:14,width:e.width+_i*2,height:e.height+_i*2},t))):S(e,"bpmn:EndEvent")?(n=Te("circle"),Ee(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+_i+1},t))):S(e,"bpmn:Event")?(n=Te("circle"),Ee(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+_i},t))):S(e,"bpmn:DataObjectReference")&&Kw(e,"bpmn:DataObjectReference")?n=qw(NI,{x:-6,y:-6},t):S(e,"bpmn:DataStoreReference")&&Kw(e,"bpmn:DataStoreReference")&&(n=qw($I,{x:-6,y:-6},t)),n},lu.prototype.updateOutline=function(e,t){if(!Xe(e))return Ze(e,["bpmn:SubProcess","bpmn:Group"])?(Ee(t,{width:e.width+_i*2,height:e.height+_i*2}),!0):!!Ze(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function Kw(e,t){var n;return t==="bpmn:DataObjectReference"?n=FI:t==="bpmn:DataStoreReference"&&(n=jI),e.width===n.width&&e.height===n.height}const HI={__depends__:[Id],__init__:["outlineProvider"],outlineProvider:["type",lu]};var zI='<?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 Gi(e){zo.call(this,e)}we(Gi,zo),Gi.Viewer=$r,Gi.NavigatedViewer=hs,Gi.prototype.createDiagram=function(){return this.importXML(zI)},Gi.prototype._interactionModules=[cx,ux,dx],Gi.prototype._modelingModules=[VO,_l,KO,YO,cD,Td,hD,FD,Wv,Jc,GD,UD,cL,uL,pL,gL,PL,DL,Jf,jL,qL,oI,sI,lw,OI,BI,HI],Gi.prototype._modules=[].concat($r.prototype._modules,Gi.prototype._interactionModules,Gi.prototype._modelingModules);const GI=ye.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=ye.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),f=Lu(u);return r("imported",f),{warnings:f}}catch(u){throw r("import-error",u),u}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:l}=await a.saveXML({format:!0});return l??""}return ye.onMounted(async()=>{a=new Gi({container:o.value,moddleExtensions:Gs}),i.xml&&await s(i.xml),r("ready")}),ye.watch(()=>i.xml,l=>{l&&a&&s(l)}),ye.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(ye.openBlock(),ye.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),Xw=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n},VI=Xw(GI,[["__scopeId","data-v-a9b41c97"]]),WI=["title","aria-expanded"],UI=["title","onClick"],YI={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},qI={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},KI={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},XI={key:0,class:"bwl-validation__body"},ZI={key:0,class:"bwl-validation__empty"},QI={key:1,class:"bwl-validation__empty"},JI={key:2,class:"bwl-validation__list"},eB=["onClick"],tB={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},nB={class:"bwl-validation__msg"},iB=["title"],rB=Xw(ye.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=ye.computed(()=>Xb(n.issues.value,n.describeElement)),r=ye.computed(()=>Zb(i.value)),o=m=>aa(m,n.changeScope.value),a=ye.computed(()=>od(i.value,n.changeScope.value)),s=ye.ref({error:!0,warning:!0,info:!0}),c=ye.computed(()=>Qb(i.value.filter(m=>s.value[m.severity]),n.changeScope.value)),l=ye.ref(!1),u=["error","warning","info"],f={error:"오류",warning:"경고",info:"정보"};function p(m){if(!l.value){l.value=!0;return}s.value[m]=!s.value[m]}function d(m){const h=m.targetRefs[0];h&&n.requestFocus(h)}return(m,h)=>(ye.openBlock(),ye.createElementBlock("section",{class:ye.normalizeClass(["bwl-validation",{"is-open":l.value}])},[ye.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[ye.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(ye.openBlock(),ye.createElementBlock("svg",{class:ye.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[ye.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=ye.createElementVNode("span",null,"검증",-1))],8,WI),ye.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=ye.withModifiers(()=>{},["stop"]))},[(ye.openBlock(),ye.createElementBlock(ye.Fragment,null,ye.renderList(u,y=>ye.createElementVNode("button",{key:y,type:"button",class:ye.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${f[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:v=>p(y)},[(ye.openBlock(),ye.createElementBlock("svg",YI,[h[4]||(h[4]=ye.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(ye.openBlock(),ye.createElementBlock("path",qI)):(ye.openBlock(),ye.createElementBlock("path",KI))])),ye.createElementVNode("span",null,ye.toDisplayString(r.value[y]),1)],10,UI)),64))])]),l.value?(ye.openBlock(),ye.createElementBlock("div",XI,[i.value.length===0?(ye.openBlock(),ye.createElementBlock("p",ZI,"발견된 문제가 없습니다.")):c.value.length===0?(ye.openBlock(),ye.createElementBlock("p",QI," 선택한 심각도에 해당하는 항목이 없습니다. ")):(ye.openBlock(),ye.createElementBlock("ul",JI,[(ye.openBlock(!0),ye.createElementBlock(ye.Fragment,null,ye.renderList(c.value,y=>(ye.openBlock(),ye.createElementBlock("li",{key:y.key,class:ye.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:v=>d(y)},[h[5]||(h[5]=ye.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&o(y)?(ye.openBlock(),ye.createElementBlock("span",tB,"이번 변경")):ye.createCommentVNode("",!0),ye.createElementVNode("span",nB,ye.toDisplayString(y.message),1),ye.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},ye.toDisplayString(y.category),9,iB)],10,eB))),128))]))])):ye.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]);ee.ADDABLE_FLOW_NODE_TYPES=Is,ee.APPLY_BPMN_OPS_SCHEMA=rE,ee.BPMN_MODDLE_EXTENSIONS=Gs,ee.BWL_MODDLE_SCHEMA=nh,ee.BWL_NS=th,ee.BWL_PREFIX=gu,ee.BWL_SIDES=yu,ee.BpmnModelerView=VI,ee.BpmnValidationPanel=rB,ee.EDITOR=JS,ee.FLOW_LABEL_INDENT=Bh,ee.HEADLESS_BPMN_MODULES=Wb,ee.HEADLESS_TEXT_METRICS=ko,ee.I18N_NS=B1,ee.I18N_PREFIX=Ah,ee.IR_FLOW_NODE_TYPES=qr,ee.LABEL_FORK_MARGIN=$u,ee.SEVERITY_ORDER=rd,ee.SYMBOLIC_OP_KINDS=oh,ee.SYMBOLIC_OP_SCHEMA=ah,ee.UNDO_EPISODE_COMMAND=vu,ee.applyBpmnOpBatch=$m,ee.applyBpmnOps=Tm,ee.approximateTextWidth=Oo,ee.auditBpmnGeometry=Kh,ee.auditBpmnGeometryXml=lS,ee.auditBpmnSemantics=Zu,ee.auditBpmnSemanticsXml=VS,ee.auditGeometry=Ot,ee.auditTargetsOf=oi,ee.axisSegmentsOf=In,ee.blackBoxNameRect=Bu,ee.buildBpmnOpBatch=QS,ee.buildRegistryIndex=Zh,ee.containerBoundarySegments=Ca,ee.countBySeverity=Zb,ee.createBpmnEditorController=eR,ee.createBpmnModdle=Ph,ee.createHeadlessBpmnModeler=xk,ee.crossedShapesOf=vn,ee.crossingCost=ri,ee.describeProcess=Lm,ee.describeProcessXml=$S,ee.diffBpmnElements=Nm,ee.diffBpmnElementsXml=XS,ee.edgeCrossCount=Pa,ee.edgeCrossingPairsOf=Ks,ee.edgeCrossingStatsOf=Gh,ee.executeAsUndoEpisode=rh,ee.followMovedEdgeLabels=ym,ee.forwardThreePointCandidates=Zs,ee.geometryFindingKey=Tt,ee.installHeadlessBpmnDom=Th,ee.isAddableFlowNodeType=eh,ee.isChangeScopeMixed=od,ee.isEdgeOverlapFinding=Nu,ee.isInChangeScope=aa,ee.isIrFlowNodeType=Jd,ee.labelRectsOf=Io,ee.lineCrossesLabel=Ki,ee.lineThroughLabel=$h,ee.lineThroughShapeLabel=Yh,ee.loadBpmnXml=To,ee.lowerOps=Mm,ee.oppositeOverlapCount=K1,ee.oppositeOverlapOf=Ih,ee.planBackEdgeBoundaryClearance=am,ee.planCrossPoolRoute=im,ee.planEdgeRepair=zu,ee.planLabelLineClearance=gm,ee.planLabelPlacement=mm,ee.planMiddleSegmentShifts=Jh,ee.planOppositeOverlapRepair=cm,ee.planSegmentDetours=Xs,ee.planShapeLabelClearance=xm,ee.redockIntroducedDetachedEndpoints=wm,ee.repairIntroducedBoundaryHugging=sm,ee.repairIntroducedCrossings=Gu,ee.repairIntroducedEdgeCrossings=tm,ee.repairIntroducedFakeMerges=um,ee.repairIntroducedLabelLines=vm,ee.repairIntroducedOppositeOverlaps=hm,ee.repairIntroducedShapeLabelLines=_m,ee.repairIntroducedSharedSegmentLabels=bm,ee.rerouteIntroducedCrossPoolEdges=rm,ee.resolverServicesOf=Cm,ee.saveBpmnXml=N1,ee.sceneCrossingCost=zh,ee.sceneFromDefinitions=qh,ee.sceneFromRegistry=tt,ee.segmentShapeClearance=qs,ee.sharedSegmentUnderLabel=Ys,ee.sharedSpansOf=Us,ee.sortPanelIssues=Qb,ee.toPanelIssues=Xb,ee.touchedElements=ZS,ee.unreadableOverlapCount=ii,ee.unreadableOverlapOf=Do,ee.validateOps=Rm,ee.warningMessages=Lu,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})}));