@g1cloud/bpmn-modeler-next 5.0.0-alpha.95 → 5.0.0-alpha.96

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,14 +1,14 @@
1
- (function(ee,be){typeof exports=="object"&&typeof module<"u"?be(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],be):(ee=typeof globalThis<"u"?globalThis:ee||self,be(ee.BpmnModeler={},ee.Vue))})(this,(function(ee,be){"use strict";var HB=Object.defineProperty;var zB=(ee,be,qr)=>be in ee?HB(ee,be,{enumerable:!0,configurable:!0,writable:!0,value:qr}):ee[be]=qr;var wo=(ee,be,qr)=>zB(ee,typeof be!="symbol"?be+"":be,qr);const qr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent"],$s=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function hh(e){return qr.includes(e)}function mh(e){return $s.includes(e)}const gh="http://g1project.net/spec/bpmn/bwl/1.0",Cu="bwl",Mu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],yh={name:"bwl-hints",uri:gh,prefix:Cu,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"}]}]},Au="bwl.undoEpisode",vh=new WeakSet;function iE(e){vh.has(e)||(e.register(Au,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),vh.add(e))}function bh(e,t){iE(e);const n={run:t};if(e.execute(Au,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const xh=["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"],rE={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},oE={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},aE={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},sE={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ).",properties:{id:{type:"string"},type:{type:"string",enum:[...$s]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},cE={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},lE={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},uE={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},pE={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},fE={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},dE={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},hE={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},mE={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},gE={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Mu]},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 yE={"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:[...$s]},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"]})},_h={anyOf:xh.map(e=>yE[e])},vE={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:oE,irParticipant:aE,irNode:sE,irFlowCondition:cE,irSequenceFlow:lE,irMessageFlow:uE,irDataStore:pE,irDataAssociation:fE,irTextAnnotation:dE,irAssociation:hE,irGroup:mE,bwlPlacement:gE,nullableString:rE,symbolicOp:_h}};function Pu(e){return Array.prototype.concat.apply([],e)}const wa=Object.prototype.toString,bE=Object.prototype.hasOwnProperty;function Kr(e){return e===void 0}function rn(e){return e!==void 0}function Eo(e){return e==null}function Ne(e){return wa.call(e)==="[object Array]"}function pn(e){return wa.call(e)==="[object Object]"}function ze(e){return wa.call(e)==="[object Number]"}function fn(e){const t=wa.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Fn(e){return wa.call(e)==="[object String]"}function xE(e){if(!Ne(e))throw new Error("must supply array")}function jn(e,t){return!Eo(e)&&bE.call(e,t)}function kt(e,t){const n=js(t);let i;return z(e,function(r,o){if(n(r,o))return i=r,!1}),i}function wh(e,t){const n=js(t);let i=Ne(e)?-1:void 0;return z(e,function(r,o){if(n(r,o))return i=o,!1}),i}function nt(e,t){const n=js(t);let i=[];return z(e,function(r,o){n(r,o)&&i.push(r)}),i}function z(e,t){let n,i;if(Kr(e))return;const r=Ne(e)?RE:SE;for(let o in e)if(jn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function _E(e,t){if(Kr(e))return[];xE(e);const n=js(t);return e.filter(function(i,r){return!n(i,r)})}function Hn(e,t,n){return z(e,function(i,r){n=t(n,i,r)}),n}function Xr(e,t){return!!Hn(e,function(n,i,r){return n&&t(i,r)},!0)}function hr(e,t){return!!kt(e,t)}function Cn(e,t){let n=[];return z(e,function(i,r){n.push(t(i,r))}),n}function Fs(e){return e&&Object.keys(e)||[]}function wE(e){return Fs(e).length}function So(e){return Cn(e,t=>t)}function Ro(e,t,n={}){return t=Tu(t),z(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Eh(e,...t){e=Tu(e);let n={};return z(t,r=>Ro(r,e,n)),Cn(n,function(r,o){return r[0]})}const EE=Eh;function Pi(e,t){t=Tu(t);let n=[];return z(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 Co(e){return function(t){return Xr(e,function(n,i){return t[i]===n})}}function Tu(e){return fn(e)?e:t=>t[e]}function js(e){return fn(e)?e:t=>t===e}function SE(e){return e}function RE(e){return Number(e)}function ku(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 Bn(e,t){return e.bind(t)}function W(e,...t){return Object.assign(e,...t)}function CE(e,t,n){let i=e;return z(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)&&Eo(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 z(t,function(r){r in i&&(n[r]=e[r])}),n}function Ti(e,t){let n={},i=Object(e);return z(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Ou(){}Ou.prototype.get=function(e){return this.$model.properties.get(this,e)},Ou.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Sh(e,t){this.model=e,this.properties=t}Sh.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Ou.prototype);z(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}),z(a,Bn(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 ME=W(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Rh=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 Du(e,t){var n=Rh[e];return n?n(t):t}function Lu(e){return!!ME[e]}function Ch(e){return!!Rh[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 Jn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Jn.prototype.build=function(){return Si(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Jn.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)},Jn.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},Jn.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},Jn.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},Jn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Jn.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},Jn.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},Jn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Jn.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")},Jn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Jn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(z(e.properties,Bn(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,z(e,Bn(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;Mh(t,e,"prefix"),Mh(t,e,"uri"),z(e.types,Bn(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);z(e.properties,Bn(function(o){var a=Mn(o.name,n.prefix),s=a.name;Lu(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}),z(e.extends,Bn(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=Lu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,l){var u=Mn(c,Lu(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+">");z(i.superClass,n?a:s),t(i,!n),z(i.traits,a)},mr.prototype.getEffectiveDescriptor=function(e){var t=Mn(e),n=new Jn(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 Mh(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(!Fn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;AE(n)?i?delete e[r]:delete e.$attrs[Iu(t)]:i?r in e?e[r]=n:Ah(e,i,n):e.$attrs[Iu(t)]=n},Zr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Iu(t)];var i=n.name;return!e[i]&&n.isMany&&Ah(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 AE(e){return typeof e>"u"}function Ah(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Iu(e){return e.replace(/^:/,"")}function si(e,t={}){this.properties=new Zr(this),this.factory=new Sh(this,this.properties),this.registry=new mr(e,this.properties),this.typeCache=Object.create(null),this.config=t}si.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},si.prototype.getType=function(e){var t=this.typeCache,n=Fn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},si.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){CE(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}),z(n,function(a,s){pn(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},si.prototype.getPackage=function(e){return this.registry.getPackage(e)},si.prototype.getPackages=function(){return this.registry.getPackages()},si.prototype.getElementDescriptor=function(e){return e.$descriptor},si.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},si.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},si.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Ph=String.fromCharCode,PE=Object.prototype.hasOwnProperty,TE=/&#(\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 kE(e,t,n,i){return i?PE.call(Ea,i)?Ea[i]:"&"+i+";":Ph(t||parseInt(n,16))}function Qr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(TE,kE):e}var Th="non-whitespace outside of root node";function gr(e){return new Error(e)}function OE(e){return"missing namespace for prefix <"+e+">"}function Hs(e){return{get:e,enumerable:!0}}function DE(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var kh=Symbol("nameCache");function Bu(e){return e+"$uri"}function LE(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Bu(i)]=n;return t}function zs(){return{line:0,column:0}}function IE(e){throw e}function Oh(e){if(!this)return new Oh(e);var t=e&&e.proxy,n,i,r,o,a=IE,s,c,l,u,f=zs,p=!1,d=!1,m="",h=!1,y=!1,C=null,_=!1,g,v,w,R;function P(D){D instanceof Error||(D=gr(D)),C=D,a(D,f)}function T(D){s&&(D instanceof Error||(D=gr(D)),s(D,f))}this.on=function(D,H){if(typeof H!="function")throw gr("required args <name, cb>");switch(D){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":r=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":o=H;break;case"attention":u=H;break;case"question":l=H;break;case"comment":c=H;break;default:throw gr("unsupported event: "+D)}return this},this.ns=function(D){if(typeof D>"u"&&(D={}),typeof D!="object")throw gr("required args <nsMap={}>");var H=Object.create(null),Q;for(Q in D)H[Q]=D[Q];return y=!0,R=H,this};function N(){g=y?[]:null,v=y?LE(R):null,w=[],f=zs,_=!1,C=null,d=!1,m=""}this.parse=function(D){if(typeof D!="string")throw gr("required args <xml=string>");if(p)throw gr("parse during stream; call end() first");return N(),k(D),f=zs,_=!1,C},this.write=function(D){if(typeof D!="string")throw gr("required args <xml=string>");return p||(N(),p=!0),C||(m=k(m+D,!0)||""),this},this.end=function(){return p||N(),p=!1,C||k(m),m="",f=zs,_=!1,C},this.stop=function(){_=!0};function k(D,H=!1){var Q=null,pe=null,Me,Be=0,it=!1,X=!1,J=0,le=0,ve,q,V,ne,Te,Pe,L,E,x,G="",U=0,Z;function Re(wt,ln){var gn=wt.indexOf(":");if(gn===-1)return wt;var yn=v[wt.substring(0,gn)];return yn?ln===yn?wt.substr(gn+1):yn+wt.substr(gn):(T(OE(wt.substring(0,gn))),null)}function Xe(){if(Z!==null)return Z;var wt,ln,gn=y&&v.xmlns,yn=y&&h?[]:null,Et=U,un=G,hn=un.length,vo,Zn,xi,_i,Kt,wi={},Ts=new Set,Qn,ct,xt;e:for(;Et<hn;Et++)if(Qn=!1,ct=un.charCodeAt(Et),!(ct===32||ct<14&&ct>8)){for((ct<65||ct>122||ct>90&&ct<97)&&ct!==95&&ct!==58&&(T("illegal first char attribute name"),Qn=!0),xt=Et+1;xt<hn;xt++)if(ct=un.charCodeAt(xt),!(ct>96&&ct<123||ct>64&&ct<91||ct>47&&ct<59||ct===46||ct===45||ct===95)){if(ct===32||ct<14&&ct>8){T("missing attribute value"),Et=xt;continue e}if(ct===61)break;T("illegal attribute name char"),Qn=!0}if(Kt=un.substring(Et,xt),Kt==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),Qn=!0),ct=un.charCodeAt(xt+1),ct===34)xt=un.indexOf('"',Et=xt+2),xt===-1&&(xt=un.indexOf("'",Et),xt!==-1&&(T("attribute value quote missmatch"),Qn=!0));else if(ct===39)xt=un.indexOf("'",Et=xt+2),xt===-1&&(xt=un.indexOf('"',Et),xt!==-1&&(T("attribute value quote missmatch"),Qn=!0));else for(T("missing attribute value quotes"),Qn=!0,xt=xt+1;xt<hn&&(ct=un.charCodeAt(xt+1),!(ct===32||ct<14&&ct>8));xt++);for(xt===-1&&(T("missing closing quotes"),xt=hn,Qn=!0),Qn||(xi=un.substring(Et,xt)),Et=xt;xt+1<hn&&(ct=un.charCodeAt(xt+1),!(ct===32||ct<14&&ct>8));xt++)Et===xt&&(T("illegal character after attribute end"),Qn=!0);if(Et=xt+1,Qn)continue e;if(Ts.has(Kt)){T("attribute <"+Kt+"> already defined");continue}if(Ts.add(Kt),!y){wi[Kt]=xi;continue}if(h){if(Zn=Kt==="xmlns"?"xmlns":Kt.charCodeAt(0)===120&&Kt.substr(0,6)==="xmlns:"?Kt.substr(6):null,Zn!==null){if(wt=Qr(xi),ln=Bu(Zn),_i=R[wt],!_i){if(Zn==="xmlns"||ln in v&&v[ln]!==wt)do _i="ns"+Be++;while(typeof v[_i]<"u");else _i=Zn;R[wt]=_i}v[Zn]!==_i&&(vo||(v=DE(v),vo=!0),v[Zn]=_i,Zn==="xmlns"&&(v[Bu(_i)]=wt,gn=_i),v[ln]=wt),wi[Kt]=xi;continue}yn.push(Kt,xi);continue}Kt=Re(Kt,gn),Kt!==null&&(wi[Kt]=xi)}if(h)for(Et=0,hn=yn.length;Et<hn;Et++)Kt=Re(yn[Et++],gn),xi=yn[Et],Kt!==null&&(wi[Kt]=xi);return Z=wi}function dt(){for(var wt=/(\r\n|\r|\n)/g,ln=0,gn=0,yn=0,Et=le,un,hn;J>=yn&&(un=wt.exec(D),!(!un||(Et=un[0].length+un.index,Et>J)));)ln+=1,yn=Et;return J==-1?(gn=Et,hn=D.substring(le)):le===0?hn=D.substring(le,J):(gn=J-yn,hn=le==-1?D.substring(J):D.substring(J,le+1)),{data:hn,line:ln,column:gn}}for(f=dt,t&&(x=Object.create({},{name:Hs(function(){return L}),originalName:Hs(function(){return E}),attrs:Hs(Xe),ns:Hs(function(){return v})}));le!==-1;){if(D.charCodeAt(le)===60?J=le:J=D.indexOf("<",le),J===-1){if(H)return D.substring(le);if(w.length)return P("unexpected end of file");if(!d)return P("missing start tag");le<D.length&&D.substring(le).trim()&&T(Th);return}if(d||(d=!0),le!==J){if(w.length){if(n&&(n(D.substring(le,J),Qr,f),_))return}else if(D.substring(le,J).trim()&&(T(Th),_))return}if(ne=D.charCodeAt(J+1),ne===33){if(V=D.charCodeAt(J+2),V===91&&D.substr(J+3,6)==="CDATA["){if(le=D.indexOf("]]>",J),le===-1)return H?D.substring(J):P("unclosed cdata");if(o&&(o(D.substring(J+9,le),f),_))return;le+=3;continue}if(V===45&&D.charCodeAt(J+3)===45){if(le=D.indexOf("-->",J),le===-1)return H?D.substring(J):P("unclosed comment");if(c&&(c(D.substring(J+4,le),Qr,f),_))return;le+=3;continue}}if(ne===63){if(le=D.indexOf("?>",J),le===-1)return H?D.substring(J):P("unclosed question");if(l&&(l(D.substring(J,le+2),f),_))return;le+=2;continue}for(ve=J+1;;ve++){if(Te=D.charCodeAt(ve),isNaN(Te))return H?D.substring(J):(le=-1,P("unclosed tag"));if(Te===34)V=D.indexOf('"',ve+1),ve=V!==-1?V:ve;else if(Te===39)V=D.indexOf("'",ve+1),ve=V!==-1?V:ve;else if(Te===62){le=ve;break}}if(ne===33){if(u&&(u(D.substring(J,le+1),Qr,f),_))return;le+=1;continue}if(Z={},ne===47){if(it=!1,X=!0,!w.length)return P("missing open tag");if(ve=L=w.pop(),V=J+2+ve.length,D.substring(J+2,V)!==ve)return P("closing tag mismatch");for(;V<le;V++)if(ne=D.charCodeAt(V),!(ne===32||ne>8&&ne<14))return P("close tag")}else{if(D.charCodeAt(le-1)===47?(ve=L=D.substring(J+1,le-1),it=!0,X=!0):(ve=L=D.substring(J+1,le),it=!0,X=!1),!(ne>96&&ne<123||ne>64&&ne<91||ne===95||ne===58))return P("illegal first char nodeName");for(V=1,q=ve.length;V<q;V++)if(ne=ve.charCodeAt(V),!(ne>96&&ne<123||ne>64&&ne<91||ne>47&&ne<59||ne===45||ne===95||ne==46)){if(ne===32||ne<14&&ne>8){L=ve.substring(0,V),Z=null;break}return P("invalid nodeName")}X||w.push(L)}if(y){Me=v,it&&(X||g.push(Me),Z===null&&(h=ve.indexOf("xmlns",V)!==-1)&&(U=V,G=ve,Xe(),h=!1)),E=L,pe!==v&&(Q=v[kh],Q===void 0&&(Q=v[kh]=Object.create(null)),pe=v);var Vt=Q[L];if(Vt!==void 0)L=Vt;else{if(ne=L.indexOf(":"),ne!==-1){if(Pe=v[L.substring(0,ne)],!Pe)return P("missing namespace on <"+E+">");L=L.substr(ne+1)}else Pe=v.xmlns;Pe&&(L=Pe+":"+L),Q[E]=L}}if(it&&(U=V,G=ve,i&&(t?i(x,Qr,X,f):i(L,Xe,Qr,X,f),_)))return;if(X){if(r&&(r(t?x:L,Qr,it,f),_))return;y&&(it?v=Me:v=g.pop())}le+=1}}}function Dh(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Nu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Lh="property";function Ih(e){return e.xml&&e.xml.serialize}function BE(e){const t=Ih(e);return t!==Lh&&(t||null)}function NE(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Bh(e,t){return Dh(t)?e.prefix+":"+NE(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 FE(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 $E(o,a)}function yr(e){return new Error(e)}function Yi(e){return e.$descriptor}function jE(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=Yi(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 $u(){}$u.prototype=Object.create(Sa.prototype),$u.prototype.handleNode=function(){return this};function Mo(){}Mo.prototype=Object.create(Sa.prototype),Mo.prototype.handleText=function(e){this.body=(this.body||"")+e};function Ra(e,t){this.property=e,this.context=t}Ra.prototype=Object.create(Mo.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 Fu(e,t){this.element=t,this.propertyDesc=e}Fu.prototype=Object.create(Mo.prototype),Fu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Du(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Gs(){}Gs.prototype=Object.create(Mo.prototype),Gs.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 On(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}On.prototype=Object.create(Gs.prototype),On.prototype.addReference=function(e){this.context.addReference(e)},On.prototype.handleText=function(e){var t=this.element,n=Yi(t),i=n.bodyProperty;if(!i)throw yr("unexpected body text <"+e+">");Mo.prototype.handleText.call(this,e)},On.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Yi(t),i=n.bodyProperty;i&&e!==void 0&&(e=Du(i.type,e),t.set(i.name,e))},On.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Yi(n),r=this.context,o=new n({}),a=this.model,s;return z(t,function(c,l){var u=i.propertiesByName[l],f;u&&u.isReference?u.isMany?(f=c.split(" "),z(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=Du(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},On.prototype.getPropertyForNode=function(e){var t=e.name,n=Mn(t),i=this.type,r=this.model,o=Yi(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=FE(u,e.ns,r),p=r.getType(f);return W({},s,{effectiveType:Yi(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const l=Bh(n,c),u=r.getType(l);if(s=kt(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&u.hasType(f.type)}),s)return W({},s,{effectiveType:Yi(u).name})}else if(s=kt(o.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw yr("unrecognized element <"+n.name+">")},On.prototype.toString=function(){return"ElementDescriptor["+Yi(this.type).name+"]"},On.prototype.valueHandler=function(e,t){return new Fu(e,t)},On.prototype.referenceHandler=function(e){return new Ra(e,this.context)},On.prototype.handler=function(e){return e==="Element"?new Ao(this.model,e,this.context):new On(this.model,e,this.context)},On.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 ju(e,t,n){On.call(this,e,t,n)}ju.prototype=Object.create(On.prototype),ju.prototype.createElement=function(e){var t=e.name,n=Mn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Bh(n,o)||t;if(!r.hasType(a))throw yr("unexpected element <"+e.originalName+">");return On.prototype.createElement.call(this,e)};function Ao(e,t,n){this.model=e,this.context=n}Ao.prototype=Object.create(Gs.prototype),Ao.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)},Ao.prototype.handleChild=function(e){var t=new Ao(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},Ao.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Hu(e){e instanceof si&&(e={model:e}),W(this,{lax:!1},e)}Hu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof On?(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 jE(W({},t,{rootHandler:i})),s=new Oh({proxy:!0}),c=HE();i.context=a,c.push(i);function l(w,R,P){var T=R(),N=T.line,k=T.column,D=T.data;D.charAt(0)==="<"&&D.indexOf(" ")!==-1&&(D=D.slice(0,D.indexOf(" "))+">");var H="unparsable content "+(D?D+" ":"")+`detected
1
+ (function(te,be){typeof exports=="object"&&typeof module<"u"?be(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],be):(te=typeof globalThis<"u"?globalThis:te||self,be(te.BpmnModeler={},te.Vue))})(this,(function(te,be){"use strict";var GB=Object.defineProperty;var VB=(te,be,Kr)=>be in te?GB(te,be,{enumerable:!0,configurable:!0,writable:!0,value:Kr}):te[be]=Kr;var Eo=(te,be,Kr)=>VB(te,typeof be!="symbol"?be+"":be,Kr);const Kr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent"],$s=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function hh(e){return Kr.includes(e)}function gh(e){return $s.includes(e)}const mh="http://g1project.net/spec/bpmn/bwl/1.0",Cu="bwl",Mu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],yh={name:"bwl-hints",uri:mh,prefix:Cu,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"}]}]},Au="bwl.undoEpisode",vh=new WeakSet;function oE(e){vh.has(e)||(e.register(Au,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),vh.add(e))}function bh(e,t){oE(e);const n={run:t};if(e.execute(Au,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const xh=["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"],aE={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},sE={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},cE={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},lE={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ).",properties:{id:{type:"string"},type:{type:"string",enum:[...$s]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},uE={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},pE={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},fE={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},dE={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},hE={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},gE={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},mE={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},yE={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},vE={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Mu]},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 bE={"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:[...$s]},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"]})},_h={anyOf:xh.map(e=>bE[e])},xE={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:sE,irParticipant:cE,irNode:lE,irFlowCondition:uE,irSequenceFlow:pE,irMessageFlow:fE,irDataStore:dE,irDataAssociation:hE,irTextAnnotation:gE,irAssociation:mE,irGroup:yE,bwlPlacement:vE,nullableString:aE,symbolicOp:_h}};function Pu(e){return Array.prototype.concat.apply([],e)}const wa=Object.prototype.toString,_E=Object.prototype.hasOwnProperty;function Xr(e){return e===void 0}function rn(e){return e!==void 0}function So(e){return e==null}function Ne(e){return wa.call(e)==="[object Array]"}function pn(e){return wa.call(e)==="[object Object]"}function ze(e){return wa.call(e)==="[object Number]"}function fn(e){const t=wa.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Fn(e){return wa.call(e)==="[object String]"}function wE(e){if(!Ne(e))throw new Error("must supply array")}function jn(e,t){return!So(e)&&_E.call(e,t)}function kt(e,t){const n=js(t);let i;return z(e,function(r,o){if(n(r,o))return i=r,!1}),i}function wh(e,t){const n=js(t);let i=Ne(e)?-1:void 0;return z(e,function(r,o){if(n(r,o))return i=o,!1}),i}function nt(e,t){const n=js(t);let i=[];return z(e,function(r,o){n(r,o)&&i.push(r)}),i}function z(e,t){let n,i;if(Xr(e))return;const r=Ne(e)?ME:CE;for(let o in e)if(jn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function EE(e,t){if(Xr(e))return[];wE(e);const n=js(t);return e.filter(function(i,r){return!n(i,r)})}function Hn(e,t,n){return z(e,function(i,r){n=t(n,i,r)}),n}function Zr(e,t){return!!Hn(e,function(n,i,r){return n&&t(i,r)},!0)}function hr(e,t){return!!kt(e,t)}function Cn(e,t){let n=[];return z(e,function(i,r){n.push(t(i,r))}),n}function Fs(e){return e&&Object.keys(e)||[]}function SE(e){return Fs(e).length}function Ro(e){return Cn(e,t=>t)}function Co(e,t,n={}){return t=Tu(t),z(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function Eh(e,...t){e=Tu(e);let n={};return z(t,r=>Co(r,e,n)),Cn(n,function(r,o){return r[0]})}const RE=Eh;function Pi(e,t){t=Tu(t);let n=[];return z(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 Mo(e){return function(t){return Zr(e,function(n,i){return t[i]===n})}}function Tu(e){return fn(e)?e:t=>t[e]}function js(e){return fn(e)?e:t=>t===e}function CE(e){return e}function ME(e){return Number(e)}function ku(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 Bn(e,t){return e.bind(t)}function W(e,...t){return Object.assign(e,...t)}function AE(e,t,n){let i=e;return z(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)?{}:[]),Xr(a)?Xr(n)?delete i[r]:i[r]=n:i=s}),e}function Si(e,t){let n={},i=Object(e);return z(t,function(r){r in i&&(n[r]=e[r])}),n}function Ti(e,t){let n={},i=Object(e);return z(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Ou(){}Ou.prototype.get=function(e){return this.$model.properties.get(this,e)},Ou.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Sh(e,t){this.model=e,this.properties=t}Sh.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Ou.prototype);z(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}),z(a,Bn(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 PE=W(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Rh=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 Du(e,t){var n=Rh[e];return n?n(t):t}function Lu(e){return!!PE[e]}function Ch(e){return!!Rh[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 Jn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Jn.prototype.build=function(){return Si(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Jn.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)},Jn.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},Jn.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},Jn.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},Jn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Jn.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},Jn.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},Jn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Jn.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")},Jn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Jn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(z(e.properties,Bn(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 gr(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,z(e,Bn(this.registerPackage,this))}gr.prototype.getPackage=function(e){return this.packageMap[e]},gr.prototype.getPackages=function(){return this.packages},gr.prototype.registerPackage=function(e){e=W({},e);var t=this.packageMap;Mh(t,e,"prefix"),Mh(t,e,"uri"),z(e.types,Bn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},gr.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);z(e.properties,Bn(function(o){var a=Mn(o.name,n.prefix),s=a.name;Lu(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}),z(e.extends,Bn(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},gr.prototype.mapTypes=function(e,t,n){var i=Lu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,l){var u=Mn(c,Lu(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+">");z(i.superClass,n?a:s),t(i,!n),z(i.traits,a)},gr.prototype.getEffectiveDescriptor=function(e){var t=Mn(e),n=new Jn(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},gr.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Mh(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Qr(e){this.model=e}Qr.prototype.set=function(e,t,n){if(!Fn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;TE(n)?i?delete e[r]:delete e.$attrs[Iu(t)]:i?r in e?e[r]=n:Ah(e,i,n):e.$attrs[Iu(t)]=n},Qr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Iu(t)];var i=n.name;return!e[i]&&n.isMany&&Ah(e,n,[]),e[i]},Qr.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)},Qr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Qr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Qr.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 TE(e){return typeof e>"u"}function Ah(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Iu(e){return e.replace(/^:/,"")}function si(e,t={}){this.properties=new Qr(this),this.factory=new Sh(this,this.properties),this.registry=new gr(e,this.properties),this.typeCache=Object.create(null),this.config=t}si.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},si.prototype.getType=function(e){var t=this.typeCache,n=Fn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},si.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){AE(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}),z(n,function(a,s){pn(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},si.prototype.getPackage=function(e){return this.registry.getPackage(e)},si.prototype.getPackages=function(){return this.registry.getPackages()},si.prototype.getElementDescriptor=function(e){return e.$descriptor},si.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},si.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},si.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Ph=String.fromCharCode,kE=Object.prototype.hasOwnProperty,OE=/&#(\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 DE(e,t,n,i){return i?kE.call(Ea,i)?Ea[i]:"&"+i+";":Ph(t||parseInt(n,16))}function Jr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(OE,DE):e}var Th="non-whitespace outside of root node";function mr(e){return new Error(e)}function LE(e){return"missing namespace for prefix <"+e+">"}function Hs(e){return{get:e,enumerable:!0}}function IE(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var kh=Symbol("nameCache");function Bu(e){return e+"$uri"}function BE(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Bu(i)]=n;return t}function zs(){return{line:0,column:0}}function NE(e){throw e}function Oh(e){if(!this)return new Oh(e);var t=e&&e.proxy,n,i,r,o,a=NE,s,c,l,u,f=zs,p=!1,d=!1,g="",h=!1,y=!1,M=null,_=!1,m,v,w,R;function P(D){D instanceof Error||(D=mr(D)),M=D,a(D,f)}function T(D){s&&(D instanceof Error||(D=mr(D)),s(D,f))}this.on=function(D,H){if(typeof H!="function")throw mr("required args <name, cb>");switch(D){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":r=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":o=H;break;case"attention":u=H;break;case"question":l=H;break;case"comment":c=H;break;default:throw mr("unsupported event: "+D)}return this},this.ns=function(D){if(typeof D>"u"&&(D={}),typeof D!="object")throw mr("required args <nsMap={}>");var H=Object.create(null),Q;for(Q in D)H[Q]=D[Q];return y=!0,R=H,this};function N(){m=y?[]:null,v=y?BE(R):null,w=[],f=zs,_=!1,M=null,d=!1,g=""}this.parse=function(D){if(typeof D!="string")throw mr("required args <xml=string>");if(p)throw mr("parse during stream; call end() first");return N(),k(D),f=zs,_=!1,M},this.write=function(D){if(typeof D!="string")throw mr("required args <xml=string>");return p||(N(),p=!0),M||(g=k(g+D,!0)||""),this},this.end=function(){return p||N(),p=!1,M||k(g),g="",f=zs,_=!1,M},this.stop=function(){_=!0};function k(D,H=!1){var Q=null,pe=null,Me,Be=0,it=!1,K=!1,J=0,ce=0,ve,q,V,ne,Te,Pe,L,E,x,G="",U=0,Z;function Re(wt,ln){var mn=wt.indexOf(":");if(mn===-1)return wt;var yn=v[wt.substring(0,mn)];return yn?ln===yn?wt.substr(mn+1):yn+wt.substr(mn):(T(LE(wt.substring(0,mn))),null)}function Ze(){if(Z!==null)return Z;var wt,ln,mn=y&&v.xmlns,yn=y&&h?[]:null,Et=U,un=G,hn=un.length,bo,Zn,xi,_i,Kt,wi={},Ts=new Set,Qn,ct,xt;e:for(;Et<hn;Et++)if(Qn=!1,ct=un.charCodeAt(Et),!(ct===32||ct<14&&ct>8)){for((ct<65||ct>122||ct>90&&ct<97)&&ct!==95&&ct!==58&&(T("illegal first char attribute name"),Qn=!0),xt=Et+1;xt<hn;xt++)if(ct=un.charCodeAt(xt),!(ct>96&&ct<123||ct>64&&ct<91||ct>47&&ct<59||ct===46||ct===45||ct===95)){if(ct===32||ct<14&&ct>8){T("missing attribute value"),Et=xt;continue e}if(ct===61)break;T("illegal attribute name char"),Qn=!0}if(Kt=un.substring(Et,xt),Kt==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),Qn=!0),ct=un.charCodeAt(xt+1),ct===34)xt=un.indexOf('"',Et=xt+2),xt===-1&&(xt=un.indexOf("'",Et),xt!==-1&&(T("attribute value quote missmatch"),Qn=!0));else if(ct===39)xt=un.indexOf("'",Et=xt+2),xt===-1&&(xt=un.indexOf('"',Et),xt!==-1&&(T("attribute value quote missmatch"),Qn=!0));else for(T("missing attribute value quotes"),Qn=!0,xt=xt+1;xt<hn&&(ct=un.charCodeAt(xt+1),!(ct===32||ct<14&&ct>8));xt++);for(xt===-1&&(T("missing closing quotes"),xt=hn,Qn=!0),Qn||(xi=un.substring(Et,xt)),Et=xt;xt+1<hn&&(ct=un.charCodeAt(xt+1),!(ct===32||ct<14&&ct>8));xt++)Et===xt&&(T("illegal character after attribute end"),Qn=!0);if(Et=xt+1,Qn)continue e;if(Ts.has(Kt)){T("attribute <"+Kt+"> already defined");continue}if(Ts.add(Kt),!y){wi[Kt]=xi;continue}if(h){if(Zn=Kt==="xmlns"?"xmlns":Kt.charCodeAt(0)===120&&Kt.substr(0,6)==="xmlns:"?Kt.substr(6):null,Zn!==null){if(wt=Jr(xi),ln=Bu(Zn),_i=R[wt],!_i){if(Zn==="xmlns"||ln in v&&v[ln]!==wt)do _i="ns"+Be++;while(typeof v[_i]<"u");else _i=Zn;R[wt]=_i}v[Zn]!==_i&&(bo||(v=IE(v),bo=!0),v[Zn]=_i,Zn==="xmlns"&&(v[Bu(_i)]=wt,mn=_i),v[ln]=wt),wi[Kt]=xi;continue}yn.push(Kt,xi);continue}Kt=Re(Kt,mn),Kt!==null&&(wi[Kt]=xi)}if(h)for(Et=0,hn=yn.length;Et<hn;Et++)Kt=Re(yn[Et++],mn),xi=yn[Et],Kt!==null&&(wi[Kt]=xi);return Z=wi}function dt(){for(var wt=/(\r\n|\r|\n)/g,ln=0,mn=0,yn=0,Et=ce,un,hn;J>=yn&&(un=wt.exec(D),!(!un||(Et=un[0].length+un.index,Et>J)));)ln+=1,yn=Et;return J==-1?(mn=Et,hn=D.substring(ce)):ce===0?hn=D.substring(ce,J):(mn=J-yn,hn=ce==-1?D.substring(J):D.substring(J,ce+1)),{data:hn,line:ln,column:mn}}for(f=dt,t&&(x=Object.create({},{name:Hs(function(){return L}),originalName:Hs(function(){return E}),attrs:Hs(Ze),ns:Hs(function(){return v})}));ce!==-1;){if(D.charCodeAt(ce)===60?J=ce:J=D.indexOf("<",ce),J===-1){if(H)return D.substring(ce);if(w.length)return P("unexpected end of file");if(!d)return P("missing start tag");ce<D.length&&D.substring(ce).trim()&&T(Th);return}if(d||(d=!0),ce!==J){if(w.length){if(n&&(n(D.substring(ce,J),Jr,f),_))return}else if(D.substring(ce,J).trim()&&(T(Th),_))return}if(ne=D.charCodeAt(J+1),ne===33){if(V=D.charCodeAt(J+2),V===91&&D.substr(J+3,6)==="CDATA["){if(ce=D.indexOf("]]>",J),ce===-1)return H?D.substring(J):P("unclosed cdata");if(o&&(o(D.substring(J+9,ce),f),_))return;ce+=3;continue}if(V===45&&D.charCodeAt(J+3)===45){if(ce=D.indexOf("-->",J),ce===-1)return H?D.substring(J):P("unclosed comment");if(c&&(c(D.substring(J+4,ce),Jr,f),_))return;ce+=3;continue}}if(ne===63){if(ce=D.indexOf("?>",J),ce===-1)return H?D.substring(J):P("unclosed question");if(l&&(l(D.substring(J,ce+2),f),_))return;ce+=2;continue}for(ve=J+1;;ve++){if(Te=D.charCodeAt(ve),isNaN(Te))return H?D.substring(J):(ce=-1,P("unclosed tag"));if(Te===34)V=D.indexOf('"',ve+1),ve=V!==-1?V:ve;else if(Te===39)V=D.indexOf("'",ve+1),ve=V!==-1?V:ve;else if(Te===62){ce=ve;break}}if(ne===33){if(u&&(u(D.substring(J,ce+1),Jr,f),_))return;ce+=1;continue}if(Z={},ne===47){if(it=!1,K=!0,!w.length)return P("missing open tag");if(ve=L=w.pop(),V=J+2+ve.length,D.substring(J+2,V)!==ve)return P("closing tag mismatch");for(;V<ce;V++)if(ne=D.charCodeAt(V),!(ne===32||ne>8&&ne<14))return P("close tag")}else{if(D.charCodeAt(ce-1)===47?(ve=L=D.substring(J+1,ce-1),it=!0,K=!0):(ve=L=D.substring(J+1,ce),it=!0,K=!1),!(ne>96&&ne<123||ne>64&&ne<91||ne===95||ne===58))return P("illegal first char nodeName");for(V=1,q=ve.length;V<q;V++)if(ne=ve.charCodeAt(V),!(ne>96&&ne<123||ne>64&&ne<91||ne>47&&ne<59||ne===45||ne===95||ne==46)){if(ne===32||ne<14&&ne>8){L=ve.substring(0,V),Z=null;break}return P("invalid nodeName")}K||w.push(L)}if(y){Me=v,it&&(K||m.push(Me),Z===null&&(h=ve.indexOf("xmlns",V)!==-1)&&(U=V,G=ve,Ze(),h=!1)),E=L,pe!==v&&(Q=v[kh],Q===void 0&&(Q=v[kh]=Object.create(null)),pe=v);var Vt=Q[L];if(Vt!==void 0)L=Vt;else{if(ne=L.indexOf(":"),ne!==-1){if(Pe=v[L.substring(0,ne)],!Pe)return P("missing namespace on <"+E+">");L=L.substr(ne+1)}else Pe=v.xmlns;Pe&&(L=Pe+":"+L),Q[E]=L}}if(it&&(U=V,G=ve,i&&(t?i(x,Jr,K,f):i(L,Ze,Jr,K,f),_)))return;if(K){if(r&&(r(t?x:L,Jr,it,f),_))return;y&&(it?v=Me:v=m.pop())}ce+=1}}}function Dh(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Nu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Lh="property";function Ih(e){return e.xml&&e.xml.serialize}function $E(e){const t=Ih(e);return t!==Lh&&(t||null)}function FE(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Bh(e,t){return Dh(t)?e.prefix+":"+FE(e.localName):e.name}function jE(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 HE(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 jE(o,a)}function yr(e){return new Error(e)}function Yi(e){return e.$descriptor}function zE(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=Yi(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 $u(){}$u.prototype=Object.create(Sa.prototype),$u.prototype.handleNode=function(){return this};function Ao(){}Ao.prototype=Object.create(Sa.prototype),Ao.prototype.handleText=function(e){this.body=(this.body||"")+e};function Ra(e,t){this.property=e,this.context=t}Ra.prototype=Object.create(Ao.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 Fu(e,t){this.element=t,this.propertyDesc=e}Fu.prototype=Object.create(Ao.prototype),Fu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Du(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function Gs(){}Gs.prototype=Object.create(Ao.prototype),Gs.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 On(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}On.prototype=Object.create(Gs.prototype),On.prototype.addReference=function(e){this.context.addReference(e)},On.prototype.handleText=function(e){var t=this.element,n=Yi(t),i=n.bodyProperty;if(!i)throw yr("unexpected body text <"+e+">");Ao.prototype.handleText.call(this,e)},On.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Yi(t),i=n.bodyProperty;i&&e!==void 0&&(e=Du(i.type,e),t.set(i.name,e))},On.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Yi(n),r=this.context,o=new n({}),a=this.model,s;return z(t,function(c,l){var u=i.propertiesByName[l],f;u&&u.isReference?u.isMany?(f=c.split(" "),z(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=Du(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},On.prototype.getPropertyForNode=function(e){var t=e.name,n=Mn(t),i=this.type,r=this.model,o=Yi(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const l=$E(s);if(l){const u=e.attributes[l];if(u){const f=HE(u,e.ns,r),p=r.getType(f);return W({},s,{effectiveType:Yi(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const l=Bh(n,c),u=r.getType(l);if(s=kt(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&u.hasType(f.type)}),s)return W({},s,{effectiveType:Yi(u).name})}else if(s=kt(o.properties,function(l){return!l.isReference&&!l.isAttribute&&l.type==="Element"}),s)return s;throw yr("unrecognized element <"+n.name+">")},On.prototype.toString=function(){return"ElementDescriptor["+Yi(this.type).name+"]"},On.prototype.valueHandler=function(e,t){return new Fu(e,t)},On.prototype.referenceHandler=function(e){return new Ra(e,this.context)},On.prototype.handler=function(e){return e==="Element"?new Po(this.model,e,this.context):new On(this.model,e,this.context)},On.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 ju(e,t,n){On.call(this,e,t,n)}ju.prototype=Object.create(On.prototype),ju.prototype.createElement=function(e){var t=e.name,n=Mn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Bh(n,o)||t;if(!r.hasType(a))throw yr("unexpected element <"+e.originalName+">");return On.prototype.createElement.call(this,e)};function Po(e,t,n){this.model=e,this.context=n}Po.prototype=Object.create(Gs.prototype),Po.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)},Po.prototype.handleChild=function(e){var t=new Po(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},Po.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Hu(e){e instanceof si&&(e={model:e}),W(this,{lax:!1},e)}Hu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof On?(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 zE(W({},t,{rootHandler:i})),s=new Oh({proxy:!0}),c=GE();i.context=a,c.push(i);function l(w,R,P){var T=R(),N=T.line,k=T.column,D=T.data;D.charAt(0)==="<"&&D.indexOf(" ")!==-1&&(D=D.slice(0,D.indexOf(" "))+">");var H="unparsable content "+(D?D+" ":"")+`detected
2
2
  line: `+N+`
3
3
  column: `+k+`
4
- nested error: `+w.message;if(P)return a.addWarning({message:H,error:w}),!0;throw yr(H)}function u(w,R){return l(w,R,!0)}function f(){var w=a.elementsById,R=a.references,P,T;for(P=0;T=R[P];P++){var N=T.element,k=w[T.id],D=Yi(N).propertiesByName[T.property];if(k||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),D.isMany){var H=N.get(D.name),Q=H.indexOf(T);Q===-1&&(Q=H.length),k?H[Q]=k:H.splice(Q,1)}else N.set(D.name,k)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,m=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function y(w){if(d.test(w)){var R=m.exec(w),P=R&&R[1];!P||h.test(P)||a.addWarning({message:"unsupported document encoding <"+P+">, falling back to UTF-8"})}}function C(w,R){var P=c.peek();try{c.push(P.handleNode(w))}catch(T){l(T,R,o)&&c.push(new $u)}}function _(w,R){try{c.peek().handleText(w)}catch(P){u(P,R)}}function g(w,R){w.trim()&&_(w,R)}var v=r.getPackages().reduce(function(w,R){return w[R.uri]=R.prefix,w},Object.entries(Nu).reduce(function(w,[R,P]){return w[P]=R,w},r.config&&r.config.nsMap||{}));return s.ns(v).on("openTag",function(w,R,P,T){var N=w.attrs||{},k=Object.keys(N).reduce(function(H,Q){var pe=R(N[Q]);return H[Q]=pe,H},{}),D={name:w.name,originalName:w.originalName,attributes:k,ns:w.ns};C(D,T)}).on("question",y).on("closeTag",p).on("cdata",_).on("text",function(w,R,P){g(R(w),P)}).on("error",l).on("warn",u),new Promise(function(w,R){var P;try{s.parse(e),f()}catch(H){P=H}var T=i.element;!P&&!T&&(P=yr("failed to parse document as <"+i.type.$descriptor.name+">"));var N=a.warnings,k=a.references,D=a.elementsById;return P?(P.warnings=N,R(P)):w({rootElement:T,elementsById:D,references:k,warnings:N})})},Hu.prototype.handler=function(e){return new ju(this.model,e)};function HE(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var zE=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,GE=/<|>|'|"|&|\n\r|\n/g,Nh=/<|>|&/g;function ki(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}ki.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},ki.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},ki.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},ki.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)},ki.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},ki.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},ki.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},ki.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},ki.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 VE(e){return e.charAt(0).toLowerCase()+e.slice(1)}function WE(e,t){return Dh(t)?VE(e):e}function $h(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Fh(e){return Fn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function UE(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 YE(e,t){return t.isGeneric?W({localName:t.ns.localName},e):W({localName:WE(t.ns.localName,t.$pkg)},e)}function qE(e,t){return W({localName:t.ns.localName},e)}function KE(e){var t=e.$descriptor;return nt(t.properties,function(n){var i=n.name;if(n.isVirtual||!jn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var XE={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},ZE={"<":"lt",">":"gt","&":"amp"};function jh(e,t,n){return e=Fn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function QE(e){return jh(e,GE,XE)}function JE(e){return jh(e,Nh,ZE)}function e1(e){return nt(e,function(t){return t.isAttr})}function t1(e){return nt(e,function(t){return!t.isAttr})}function zu(e){this.tagName=e}zu.prototype.build=function(e){return this.element=e,this},zu.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?JE(this.value):this.value)},Jr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Nh)!==-1&&(this.escape=!0),this};function Gu(e){this.tagName=e}$h(Gu,Jr),Gu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Nt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Nt.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=KE(e),this.parseAttributes(e1(r)),this.parseContainments(t1(r))),this.parseGenericAttributes(e,i),this},Nt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return YE(t,e)},Nt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return qE(t,e)},Nt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Nt.prototype.nsAttributeName=function(e){var t;if(Fn(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)},Nt.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}))},Nt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Jr().build({type:"String"},t));var n=e.$children;n&&z(n,i=>{this.body.push(new Nt(this).build(i))})},Nt.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)}},Nt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return z(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},Nt.prototype.parseGenericAttributes=function(e,t){var n=this;z(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)}})},Nt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;z(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))z(o,function(l){n.push(new Gu(t.addTagName(t.nsPropertyTagName(r))).build(r,l))});else if(a)z(o,function(l){n.push(new zu(t.addTagName(t.nsPropertyTagName(r))).build(l))});else{var c=Ih(r);z(o,function(l){var u;c?c===Lh?u=new Nt(t,r):u=new Vs(t,r,c):u=new Nt(t),n.push(u.build(l))})}})},Nt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new ki(i):t=i),t},Nt.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},Nt.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},Nt.prototype.parseAttributes=function(e){var t=this,n=this.element;z(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];z(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},Nt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Fh(e)},Nt.prototype.addAttribute=function(e,t){var n=this.attrs;Fn(t)&&(t=QE(t));var i=wh(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)},Nt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=UE(n).concat(t)),z(t,function(i){e.append(" ").append(Fh(i.name)).append('="').append(i.value).append('"')})},Nt.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(),z(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Vs(e,t,n){Nt.call(this,e,t),this.serialization=n}$h(Vs,Nt),Vs.prototype.parseNsAttributes=function(e){var t=Nt.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},Vs.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function n1(){this.value="",this.write=function(e){this.value+=e}}function i1(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 r1(e){e=W({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new n1,o=new i1(r,e.format);e.preamble&&o.append(zE);var a=new Nt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(o1(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function o1(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Nu)n[i]=Nu[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 Ws(e,t){si.call(this,e,t)}Ws.prototype=Object.create(si.prototype),Ws.prototype.fromXML=function(e,t,n){Fn(t)||(n=t,t="bpmn:Definitions");var i=new Hu(W({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Ws.prototype.toXML=function(e,t){var n=new r1(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var a1="BPMN20",s1="http://www.omg.org/spec/BPMN/20100524/MODEL",c1="bpmn",l1=[],u1=[{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"}]}],p1=[{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"}]}],f1={tagAlias:"lowerCase",typePrefix:"t"},d1={name:a1,uri:s1,prefix:c1,associations:l1,types:u1,enumerations:p1,xml:f1},h1="BPMNDI",m1="http://www.omg.org/spec/BPMN/20100524/DI",g1="bpmndi",y1=[{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"]}],v1=[{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"}]}],b1=[],x1={name:h1,uri:m1,prefix:g1,types:y1,enumerations:v1,associations:b1},_1="DC",w1="http://www.omg.org/spec/DD/20100524/DC",E1="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}]}],R1=[],C1={name:_1,uri:w1,prefix:E1,types:S1,associations:R1},M1="DI",A1="http://www.omg.org/spec/DD/20100524/DI",P1="di",T1=[{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"}]}],k1=[],O1={tagAlias:"lowerCase"},D1={name:M1,uri:A1,prefix:P1,types:T1,associations:k1,xml:O1},L1="bpmn.io colors for BPMN",I1="http://bpmn.io/schema/bpmn/biocolor/1.0",B1="bioc",N1=[{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=[],F1=[],j1={name:L1,uri:I1,prefix:B1,types:N1,enumerations:$1,associations:F1},H1="BPMN in Color",z1="http://www.omg.org/spec/BPMN/non-normative/color/1.0",G1="color",V1=[{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"}]}],W1=[],U1=[],Y1={name:H1,uri:z1,prefix:G1,types:V1,enumerations:W1,associations:U1};const q1={bpmn:d1,bpmndi:x1,dc:C1,di:D1,bioc:j1,color:Y1};function Hh(e,t){const n=W({},q1,e);return new Ws(n,t)}const K1={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"}},X1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",zh="i18n",Us={[zh]:K1,[Cu]:yh};function Gh(){return Hh(Us)}const Vh=Gh();async function Po(e){const{rootElement:t,warnings:n}=await Vh.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function Z1(e){const{xml:t}=await Vh.toXML(e,{format:!0});return t}function Vu(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const To={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},Q1=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function J1(e){const t=To;return Q1.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 ko(e,t){let n=0;for(const i of e)n+=t*J1(i);return n}function Wh(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&eS(e),tS(e),nS(e),iS(e)}function eS(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:ko(r,o),fontBoundingBoxAscent:o*To.ascentEm,fontBoundingBoxDescent:o*To.descentEm,actualBoundingBoxAscent:o*To.ascentEm,actualBoundingBoxDescent:o*To.descentEm}}};t.getContext=()=>n}function tS(e){if(e.SVGMatrix)return;class t{constructor(){wo(this,"a",1);wo(this,"b",0);wo(this,"c",0);wo(this,"d",1);wo(this,"e",0);wo(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 nS(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 iS(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:ko(n,12),height:14}})}const Ys=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),rS=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),oS=1,qs=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),aS=2;function gt(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;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"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Uh=20,Ks=5,Yh=3,sS=8,Oo=15,Wu=50,qh=12,cS=qh*1.2;function Uu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>ko(o,qh))),r=n.length*cS;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 vn(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 vn(e))for(const s of vn(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>=Uh&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function Yu(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Xh(e,t){const n=Do(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function lS(e,t){let n=0;for(const i of t)i.id!==e.id&&Xh(e,i)&&n++;return n}function ei(e,t){let n=0;for(const i of t)i.id!==e.id&&Do(e,i)&&n++;return n}const Zh=15,Qh=20;function uS(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Qh||t.at>n[1]+Qh)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 qu=20;function Xs(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<Uh||n.push([r-qu,o+qu])}return n}function Zs(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of vn(e)){const o=uS(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Xs(r,vn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const pS=10,fS=1,dS=(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 hS(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 Ku(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 mS=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Lo=1;function qi(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 Jh(e,t){const n=e.label;if(!n)return null;if(vn(e).some(i=>qi(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(vn(i).some(r=>qi(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=>qi(n,r)))return i.id;return null}function bn(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(hS(e.waypoints[o],e.waypoints[o+1],r,aS)){i.push(r);break}}return i}const Ma=(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))},gS=(e,t,n,i)=>tm(e,t,n,i)?0:Math.min(Ma(e,n,i),Ma(t,n,i),Ma(n,e,t),Ma(i,e,t)),em=(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,Ma({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(em(e,s)||em(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,gS(e,t,s[l],s[(l+1)%s.length]));return c}function tm(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 nm=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Aa(e,t){let n=0;for(const i of t){if(i.id===e.id||nm(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++)tm(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function ti(e,t){let n=0;for(const i of t)i.id===e.id||nm(e,i)||Aa(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function im(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++)Aa(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Js(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Aa(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 rm(e){const t=Js(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:yS(e)}}function yS(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 om(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!qs.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 am(e){var n;const t=(n=It(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=It(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 sm=e=>e?{members:e}:{},ni=e=>e.shapes.filter(t=>!t.container);function vS(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 bS(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 cm(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(vn(i).some(r=>qi(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=>qi(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}const lm=3;function um(e,t){const n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),i=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n<=0||i<=0)return 0;const r=/Event$/.test(t.type);if(!r&&!/Gateway$/.test(t.type))return Math.min(n,i);const o=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(o,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(r)return Math.max(0,t.width/2-Math.hypot(s-o,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-o)/l+Math.abs(c-a)/u))*Math.min(l,u))}function ec(e,t){const n=[];for(const i of t.shapes){if(i.container||qs.has(i.type))continue;const r=um(e,i);r>=lm&&n.push({shape:i.id,depth:r})}return n.sort((i,r)=>i.shape.localeCompare(r.shape))}function bt(e,t={}){const n=[],i=e.shapes.filter(g=>!g.container);for(const g of e.edges)for(const v of bn(g,i))n.push({kind:"edge-crosses-shape",edge:g.id,shape:v.id});const r=e.shapes.filter(g=>g.container&&rS.has(g.type));if(r.length){const g=(v,w)=>{const R=e.shapes.find(P=>P.id===w);return!!R&&R.x>=v.x&&R.y>=v.y&&R.x+R.width<=v.x+v.width&&R.y+R.height<=v.y+v.height};for(const v of e.edges)for(const w of bn(v,r))v.endpoints.includes(w.id)||v.endpoints.some(R=>g(w,R))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:w.id})}for(const g of e.edges){if(g.waypoints.length<2)continue;const v=[[g.source,g.waypoints[0]],[g.target,g.waypoints[g.waypoints.length-1]]];for(const[w,R]of v){if(!w)continue;const P=e.shapes.find(D=>D.id===w);if(!P||P.container)continue;const T=Math.max(P.x-R.x,R.x-(P.x+P.width),0),N=Math.max(P.y-R.y,R.y-(P.y+P.height),0),k=Math.hypot(T,N);k>pS&&n.push({kind:"edge-endpoint-detached",edge:g.id,shape:w,distance:Math.round(k)})}}const o=e.shapes.filter(g=>g.type==="bpmn:Participant");for(let g=0;g<o.length;g++)for(let v=g+1;v<o.length;v++){const w=o[g],R=o[v];if(w.x+w.width<=R.x||R.x+R.width<=w.x||w.y+w.height<=R.y||R.y+R.height<=w.y)continue;const P=(T,N)=>T.x<=N.x&&T.y<=N.y&&T.x+T.width>=N.x+N.width&&T.y+T.height>=N.y+N.height;n.push({kind:"pool-overlap",pools:[w.id,R.id],contained:P(w,R)||P(R,w)})}const a=i.filter(g=>!g.attached);for(let g=0;g<a.length;g++)for(let v=g+1;v<a.length;v++){const w=a[g],R=a[v];if(!Ku(w,R,oS))continue;const P=w.id<R.id?[w.id,R.id]:[R.id,w.id];n.push({kind:"shape-overlap",shapes:P,identical:mS(w,R)})}const s=e.shapes.filter(g=>g.type==="bpmn:Group"&&Array.isArray(g.members)&&g.members.length>0);for(let g=0;g<s.length;g++)for(let v=g+1;v<s.length;v++){const w=s[g],R=s[v],P=Math.min(w.x+w.width,R.x+R.width)-Math.max(w.x,R.x),T=Math.min(w.y+w.height,R.y+R.height)-Math.max(w.y,R.y);if(P<=Ks||T<=Ks)continue;const N=w.id<R.id?[w.id,R.id]:[R.id,w.id],k=new Set(R.members);if(w.members.some(H=>k.has(H))){const H=om(e,s,{x:Math.max(w.x,R.x),y:Math.max(w.y,R.y),right:Math.min(w.x+w.width,R.x+R.width),bottom:Math.min(w.y+w.height,R.y+R.height)});H.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:N,shapes:H});continue}const D=w.x<=R.x&&w.y<=R.y&&w.x+w.width>=R.x+R.width&&w.y+w.height>=R.y+R.height?w.id:R.x<=w.x&&R.y<=w.y&&R.x+R.width>=w.x+w.width&&R.y+R.height>=w.y+w.height?R.id:void 0;n.push({kind:"group-overlap-unintended",groups:N,...D?{container:D}:{}})}const c=new Set(s.flatMap(g=>[...g.members])),l=g=>e.shapes.filter(v=>!v.container&&!qs.has(v.type)&&v.x>=g.x&&v.y>=g.y&&v.x+v.width<=g.x+g.width&&v.y+v.height<=g.y+g.height);for(const g of s){const v=l(g);if(!v.length)continue;const w=new Set(g.members),R=v.filter(P=>!w.has(P.id));R.some(P=>c.has(P.id))&&(R.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:g.id,shapes:R.map(P=>P.id).sort()}))}for(const g of s){const v=new Set(l(g).map(k=>k.id)),w=new Set(g.members),R=new Set([...v].filter(k=>!w.has(k)&&c.has(k)));if(!R.size)continue;let P=!1,T=!1,N=!1;for(const k of e.edges){if(k.type!=="bpmn:SequenceFlow"||!k.source||!k.target)continue;const D=R.has(k.source),H=R.has(k.target);!D&&H&&!v.has(k.source)?P=!0:D&&!H&&!v.has(k.target)?T=!0:D&&H&&(N=!0)}P&&T&&N&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:g.id,shapes:[...R].sort()})}const u=e.shapes.filter(g=>g.type==="bpmn:Group");for(let g=0;g<u.length;g++)for(let v=g+1;v<u.length;v++)for(let w=v+1;w<u.length;w++){const R=[u[g],u[v],u[w]],P={x:Math.max(...R.map(k=>k.x)),y:Math.max(...R.map(k=>k.y)),right:Math.min(...R.map(k=>k.x+k.width)),bottom:Math.min(...R.map(k=>k.y+k.height))};if(P.right-P.x<=Ks||P.bottom-P.y<=Ks)continue;const T=om(e,[],P);if(!T.length)continue;const N=R.map(k=>k.id).sort();n.push({kind:"group-stack-unreadable",groups:N,shapes:T})}for(const g of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||qs.has(v.type)||v.width<=0||v.height<=0)continue;const w=[["top",g.y,"h",g.x,g.x+g.width],["bottom",g.y+g.height,"h",g.x,g.x+g.width],["left",g.x,"v",g.y,g.y+g.height],["right",g.x+g.width,"v",g.y,g.y+g.height]];for(const[R,P,T,N,k]of w){const D=T==="h"?v.x:v.y,H=T==="h"?v.x+v.width:v.y+v.height;if(!(D<k&&N<H))continue;const Q=T==="h"?v.y:v.x,pe=T==="h"?v.y+v.height:v.x+v.width;if(!(Q<P&&P<pe))continue;const Me=Math.min(P-Q,pe-P);Me<sS||n.push({kind:"group-cuts-shape",group:g.id,shape:v.id,side:R,depth:Me})}}const f=t.includeObservationOnly?e.shapes.filter(g=>g.type==="bpmn:Group"&&g.width>0&&g.height>0):[];if(f.length){const g=new Map(e.shapes.filter(v=>!v.container).map(v=>[v.id,{x:v.x+v.width/2,y:v.y+v.height/2}]));for(const v of e.edges){if(v.type!=="bpmn:SequenceFlow"&&v.type!=="bpmn:MessageFlow")continue;const w=vn(v);if(w.length)for(const R of f){const P=R.x+R.width,T=R.y+R.height,N=v.endpoints.some(D=>{const H=g.get(D);return!!H&&R.x<H.x&&H.x<P&&R.y<H.y&&H.y<T});let k=null;for(const D of w){const[H,Q,pe]=D.axis==="v"?[R.y,T,[["left",R.x],["right",P]]]:[R.x,P,[["top",R.y],["bottom",T]]],Me=Math.min(D.hi,Q)-Math.max(D.lo,H);if(Me<Wu)continue;const Be=D.axis==="v"?R.x<D.at&&D.at<P:R.y<D.at&&D.at<T;if(!(Be&&N))for(const[it,X]of pe){const J=Math.abs(D.at-X);J<=Oo&&(!k||J<k.distance)&&(k={side:it,inside:Be,distance:J,length:Me})}}k&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:R.id,side:k.side,inside:k.inside,distance:Math.round(k.distance),length:Math.round(k.length)})}}}const p=e.shapes.filter(g=>g.container&&g.type!=="bpmn:Group"&&g.type!=="bpmn:Lane");for(const g of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of p){const w=g.x<v.x+v.width&&v.x<g.x+g.width,R=g.y<v.y+v.height&&v.y<g.y+g.height,P=[["top",g.y,v.y,w],["bottom",g.y+g.height,v.y+v.height,w],["left",g.x,v.x,R],["right",g.x+g.width,v.x+v.width,R]];for(const[T,N,k,D]of P)D&&Math.abs(N-k)<=Yh&&n.push({kind:"group-on-container-boundary",group:g.id,container:v.id,side:T})}const d=e.shapes.filter(g=>g.type==="bpmn:Group");for(let g=0;g<d.length;g++)for(let v=g+1;v<d.length;v++){const w=d[g],R=d[v],P=w.x<R.x+R.width&&R.x<w.x+w.width,T=w.y<R.y+R.height&&R.y<w.y+w.height,N=[["x",w.x+w.width,R.x,T],["x",R.x+R.width,w.x,T],["y",w.y+w.height,R.y,P],["y",R.y+R.height,w.y,P]];for(const[k,D,H,Q]of N)if(Q&&Math.abs(D-H)<=Yh){n.push({kind:"group-on-group-boundary",groups:w.id<R.id?[w.id,R.id]:[R.id,w.id],axis:k});break}}for(let g=0;g<e.edges.length;g++)for(let v=g+1;v<e.edges.length;v++){const w=e.edges[g],R=e.edges[v],P=Do(w,R);if(!P)continue;const T=w.id<R.id?[w.id,R.id]:[R.id,w.id];n.push({kind:P.kind==="opposite"?"edge-overlap-opposite":P.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:T,axis:P.axis,length:Math.round(P.length)})}for(const g of e.edges){if(!g.label)continue;const v=Zs(g,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:g.id,other:v.other,axis:v.axis})}for(const g of e.edges){if(!g.label)continue;const v=Jh(g,e);v&&n.push({kind:"label-over-line",edge:g.id,line:v})}if(t.includeObservationOnly){for(const g of e.edges)if(!(!g.label||g.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:w}of ec(g.label,e))n.push({kind:"label-over-shape",edge:g.id,shape:v,depth:Math.round(w)})}const m=new Set(i.map(g=>g.id)),h=e.shapes.filter(g=>g.type==="bpmn:Participant"&&g.label);for(const g of[...i,...h.filter(v=>!m.has(v.id))]){if(!g.label)continue;const v=cm(g,e);v&&n.push({kind:"label-over-line",edge:g.id,line:v})}const y=new Set(e.shapes.filter(g=>g.type==="bpmn:TextAnnotation").map(g=>g.id));for(const g of h)for(const{owner:v,rect:w}of Io(e))v===g.id||y.has(v)||Ku(g.label,w,Lo)&&n.push({kind:"pool-name-over-label",pool:g.id,label:v});const C=Io(e);for(const g of i)if(g.type==="bpmn:TextAnnotation")for(const{owner:v,rect:w}of C)v!==g.id&&Ku(g,w,Lo)&&n.push({kind:"annotation-over-label",annotation:g.id,label:v});const _=new Map(e.shapes.map(g=>[g.id,g]));for(const g of i){const v=g.parent??vS(g,e,_);if(!v)continue;const w=_.get(v);!w||!w.container||dS(w,g,fS)||g.type==="bpmn:TextAnnotation"&&!bS(g,w,e)||n.push({kind:"shape-outside-container",shape:g.id,container:w.id})}return n.sort((g,v)=>gt(g).localeCompare(gt(v)))}const It=e=>typeof e=="object"&&e!==null?e:void 0,Wt=e=>typeof e=="number"?e:0,Ki=e=>{const t=It(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function xS(e){const t=It(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=Ki(o);a&&n.push(a)}}return n}function _S(e){const t=It(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Ki(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Ki(t.targetRef);return n&&i?{source:n,target:i}:{}}function wS(e,t){const n=It(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Ki(n);return r?t.get(r):void 0}if(Ys.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Ki(n)}function pm(e){var a,s,c,l,u;const t=[],n=[],i=((a=It(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=It(e))==null?void 0:s.rootElements)??[]){const p=It(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const m=It(d),h=Ki(m),y=Ki(m==null?void 0:m.processRef);h&&y?r.set(y,h):h&&o.add(h)}}for(const f of i){const p=It((c=It(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const m of d){const h=It(m);if(!h)continue;const y=It(h.bpmnElement),C=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!C)continue;const _=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",g=It(h.bounds);if(g){const w=h.isExpanded===!1&&_!=="bpmn:Participant",R=It((l=It(h.label))==null?void 0:l.bounds),P={id:C,type:_,x:Wt(g.x),y:Wt(g.y),width:Wt(g.width),height:Wt(g.height),container:Ys.has(_)&&!w,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:wS(y,r)}:{},...R?{label:{x:Wt(R.x),y:Wt(R.y),width:Wt(R.width),height:Wt(R.height)}}:{},..._==="bpmn:Group"?sm(am(y)):{}},T=h.isHorizontal!==!1,N=typeof(y==null?void 0:y.name)=="string"?y.name:"";o.has(C)&&T&&N&&(P.label=Uu(P,N)),t.push(P);continue}const v=h.waypoint;if(Array.isArray(v)){const w=It((u=It(h.label))==null?void 0:u.bounds);n.push({id:C,type:_,waypoints:v.map(R=>{var P,T;return{x:Wt((P=It(R))==null?void 0:P.x),y:Wt((T=It(R))==null?void 0:T.y)}}),endpoints:xS(y),..._S(y),...w?{label:{x:Wt(w.x),y:Wt(w.y),width:Wt(w.width),height:Wt(w.height)}}:{}})}}}return{shapes:t,edges:n}}function fm(e){return bt(pm(e),{includeObservationOnly:!0})}async function ES(e){const{definitions:t,warnings:n}=await Po(e);return{findings:fm(t),warnings:n}}function Qe(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=It(o.label),y=Ki(o.source),C=Ki(o.target);n.push({id:o.id,type:a,waypoints:s.map(_=>({x:Wt(_.x),y:Wt(_.y)})),endpoints:[y,C].filter(_=>!!_),...y&&C?{source:y,target:C}:{},...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=It(o.businessObject),l=It(o.label);let u=It(o.parent);for(;u&&u.type==="bpmn:Lane";)u=It(u.parent);const f=typeof(u==null?void 0:u.type)=="string"?u.type:"",p=u&&Ys.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:Ys.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"?sm(am(c)):{}},m=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&m&&((i=It(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Uu(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 RS(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 dm(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function hm(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 RS(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&dm(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?dm(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 Xu=20,CS=4,Dt=(e,t)=>Math.abs(e-t)<.5;function tc(e,t,n,i=Xu){if(Dt(e.y,t.y)&&!Dt(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(Dt(e.x,t.x)&&!Dt(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 mm(e,t,n,i=Xu){if(n.length<2)return null;if(Dt(e.y,t.y)&&!Dt(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(Dt(e.x,t.x)&&!Dt(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 gm(e,t,n=Xu){if(e.length!==4)return null;const[i,r,o,a]=e;if(Dt(i.y,r.y)&&Dt(r.x,o.x)&&Dt(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(Dt(i.x,r.x)&&Dt(r.y,o.y)&&Dt(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 nc(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 ym=30,MS=[0,-25,25,-40,40];function AS(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+ym:s-ym,l=a?i.y+i.height:i.y,u=n.x+n.width/2,f=i.x+i.width/2;return MS.map(p=>[{x:u,y:s},{x:u,y:c},{x:f+p,y:c},{x:f+p,y:l}])}const Zu=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],Bo=(e,t,n)=>bn({...e,waypoints:t},n).length;function Qu(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 nc(e,t))if(Bo(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(vn),c=f=>vn({...e,waypoints:f}).some(p=>Xs(p,s).length>0),l=AS(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&&Dt(f.y+f.height/2,p.y+p.height/2)){const d=[r[0],r[r.length-1]];if(Dt(d[0].y,d[1].y)&&!Dt(d[0].x,d[1].x)){const m=t.filter(_=>!e.endpoints.includes(_.id)&&bn({...e,waypoints:d},[_]).length>0),h=m.length>=2?mm(d[0],d[1],m):null,C=(h?h.map(_=>[d[0],..._,d[1]]):m.length===1?(tc(d[0],d[1],m[0])??[]).map(_=>[d[0],..._,d[1]]):m.length===0?[d]:[]).filter(_=>Bo(e,_,t)===0&&_.length<=r.length).sort((_,g)=>Number(u(g))-Number(u(_)));if(C.length)return C.find(_=>!c(_))??C[0]}}}for(let f=0;f+1<r.length;f++){const p=r[f],d=r[f+1],m=t.filter(C=>!e.endpoints.includes(C.id)&&bn({...e,waypoints:[p,d]},[C]).length>0);if(m.length<2)continue;const h=mm(p,d,m);if(!h)continue;const y=h.map(C=>Zu(r,f,C)).filter(C=>Bo(e,C,t)===0).sort((C,_)=>Number(u(_))-Number(u(C)));if(y.length)return y.find(C=>!c(C))??y[0]}for(let f=0;f<CS&&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)||bn({...e,waypoints:[m,h]},[y]).length===0)continue;const C=tc(m,h,y),_=C?C.map(v=>Zu(r,d,v)):gm(r,y)??[];if(!_.length)continue;const g=[..._].sort((v,w)=>Number(u(w))-Number(u(v)));for(const v of g){const w=Bo(e,v,t);if(w<o){r=v,o=w,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function Ju(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Qe(i),a=ni(o),s=new Set,c=bt(o).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(gt(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=Qu(f,a,m,o.edges);if(!h){bn(f,a).some(g=>g.type==="bpmn:TextAnnotation")&&s.add(u);continue}const y=o.edges.filter(g=>g.id!==u),C=ei(f,y);ei({...f,waypoints:h},y)>C||r.updateWaypoints(p,h)}return s}const PS=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},ep=(e,t)=>Aa(e,[t])>0;function vm(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Qe(i),a=ni(o);let s=o;const c=new Set(bt(o).map(gt));for(const[l,u]of Js(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(N=>N.id===f),m=s.edges.find(N=>N.id===p);if(!d||!m)continue;const h=i.get(f);if(!h)continue;const y=h.parent,C=y&&typeof y.x=="number"&&typeof y.width=="number"?{x:y.x,y:y.y,width:y.width,height:y.height}:void 0,_=PS(m),g=[...nc(d,a)??[]],v=Qu(d,[...a,..._],C,o.edges);v&&g.push(v);for(let N=0;N+1<d.waypoints.length;N++)for(const k of _)for(const D of tc(d.waypoints[N],d.waypoints[N+1],k)??[])g.push(Zu(d.waypoints,N,D));const w=s.edges.filter(N=>N.id!==f),R=N=>({...s,edges:s.edges.map(k=>k.id===f?{...k,waypoints:N}:k)}),P=N=>!C||N.every(k=>k.x>=C.x&&k.x<=C.x+C.width&&k.y>=C.y&&k.y<=C.y+C.height),T=g.find(N=>{const k={...d,waypoints:N};return ep(k,m)||!P(N)||w.some(D=>D.id!==p&&!ep(d,D)&&ep(k,D))?!1:bt(R(N)).every(D=>c.has(gt(D)))});if(T){r.updateWaypoints(h,T),s=R(T);break}}}const TS=10;function bm(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 xm(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(H=>H.type==="bpmn:Participant"&&H.container),i=t.shapes.find(H=>H.id===e.endpoints[0]),r=t.shapes.find(H=>H.id===e.endpoints[1]);if(!i||!r)return null;const o=bm(i,n),a=bm(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(H=>H.id!==o.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=l.y).sort((H,Q)=>H.y-Q.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,C=e.waypoints[0],_=e.waypoints[e.waypoints.length-1],g=ni(t),v=t.edges.filter(H=>H.id!==e.id),w=ti(e,v),R=bn(e,g).length;if(w===0&&R===0||R===0&&e.waypoints.length===2)return null;const P=Math.min(...u.map(H=>H.x)),T=Math.max(...u.map(H=>H.x+H.width)),N=(C.x+_.x)/2,k=H=>H.filter((Q,pe)=>pe===0||!(Dt(Q.x,H[pe-1].x)&&Dt(Q.y,H[pe-1].y)));let D;for(let H=P;H<=T;H+=TS){const Q=k([C,{x:C.x,y:h},{x:H,y:h},{x:H,y},{x:_.x,y},_]),pe={...e,waypoints:Q};if(bn(pe,g).length>0)continue;const Me=ti(pe,v),Be=Math.abs(H-N);(!D||Me<D.cross||Me===D.cross&&Be<D.detour)&&(D={pts:Q,cross:Me,detour:Be})}return D&&(R>0?D.cross<=w:D.cross<w)?D.pts:null}function _m(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Qe(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Qe(n),s=a.edges.find(u=>u.id===o.id);if(!s)continue;const c=xm(s,a);if(!c)continue;const l=n.get(o.id);l&&i.updateWaypoints(l,c)}}const Oi=[25,-25,40,-40],No=35;function kS(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,...Oi])if(!(Math.abs(l)>=e.width/2-5))for(const u of[0,...Oi]){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 ic(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 kS(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 _ of[0,...Oi]){if(Math.abs(_)>=i.width/2-5)continue;const g=o+_;f.push({pts:[{x:n.x,y:r},{x:g,y:r},{x:g,y:c}],cost:Math.abs(_)});for(const v of[0,...Oi]){if(Math.abs(v)>=n.width/2-5)continue;const w=a+v;f.push({pts:[{x:w,y:l},{x:w,y:u},{x:g,y:u},{x:g,y:c}],cost:Math.abs(_)+Math.abs(v)})}}const p=50,d=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const _ of[0,...Oi]){if(Math.abs(_)>=n.width/2-5)continue;const g=a+_;f.push({pts:[{x:g,y:m},{x:g,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(_)})}const h=60,y=s?i.y+i.height:i.y,C=s?i.y+i.height+No:i.y-No;for(const _ of[0,...Oi]){if(Math.abs(_)>=i.width/2-5)continue;const g=o+_;for(const v of[0,...Oi]){if(Math.abs(v)>=n.width/2-5)continue;const w=a+v;f.push({pts:[{x:w,y:m},{x:w,y:C},{x:g,y:C},{x:g,y}],cost:h+Math.abs(_)+Math.abs(v)})}}return f}const rc=30;function wm(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Dt(i.y,r.y)&&!Dt(i.x,r.x),a=Dt(i.x,r.x)&&!Dt(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)<rc||Math.abs(i.y-(s.y+s.height))<rc)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)<rc||Math.abs(i.x-(s.x+s.width))<rc)return!0}}return!1}const oc=40;function OS(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-oc,a=r.x+r.width+oc,s=r.y-oc,c=r.y+r.height+oc;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 Em(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(R=>R.container),i=new Map(t.shapes.map(R=>[R.id,R])),r=ni(t),o=t.edges.filter(R=>R.id!==e.id),a=ei(e,o),s=ti(e,o),c=R=>OS(R,t.shapes,e.endpoints)+(wm(R,n)?1:0),l=c(e.waypoints),u=R=>{if(!R)return;const P=R.x+R.width/2,T=R.y+R.height/2;return n.find(N=>N.type==="bpmn:Lane"&&P>=N.x&&P<=N.x+N.width&&T>=N.y&&T<=N.y+N.height)},f=u(i.get(e.endpoints[0]??"")),p=u(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,m=R=>{if(!d||!p)return!1;for(let P=1;P<R.length-2;P++){const T=R[P],N=R[P+1];if(Dt(T.y,N.y)&&!Dt(T.x,N.x)&&T.y>p.y&&T.y<p.y+p.height)return!0}return!1},h=m(e.waypoints),C=(R=>{if(!R)return;const P=R.x+R.width/2,T=R.y+R.height/2;return n.filter(N=>N.type==="bpmn:Participant"&&P>=N.x&&P<=N.x+N.width&&T>=N.y&&T<=N.y+N.height).sort((N,k)=>N.width*N.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),_=R=>{if(!C)return 0;let P=0;for(let T=1;T<R.length-1;T++){const N=R[T];(N.x<C.x||N.x>C.x+C.width||N.y<C.y||N.y>C.y+C.height)&&P++}return P},g=_(e.waypoints);if(!wm(e.waypoints,n)&&!(d&&!h)&&g===0)return null;const v=R=>R.reduce((P,T,N)=>N?P+Math.abs(T.x-R[N-1].x)+Math.abs(T.y-R[N-1].y):0,0);let w;for(const{pts:R,cost:P}of ic(e,i)){const T={...e,waypoints:R};if(bn(T,r).length>0)continue;const N=ei(T,o);if(N>a)continue;const k=_(R);if(k>g)continue;const D=k<g&&N===0;if(!D&&ti(T,o)>s)continue;const H=c(R),Q=m(R);if(!D&&!(Q&&!h)&&H>=l)continue;const Me=Q?0:1,Be=v(R);(!w||k<w.out||k===w.out&&(Me<w.lane||Me===w.lane&&(N<w.opp||N===w.opp&&(H<w.sc||H===w.sc&&(P<w.cost||P===w.cost&&Be<w.len)))))&&(w={pts:R,out:k,sc:H,lane:Me,opp:N,cost:P,len:Be})}return(w==null?void 0:w.pts)??null}function DS(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Qe(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=Qe(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=ni(a),l=a.edges.filter(d=>d.id!==o),u=bn(s,c).length,f=ei(s,l),p=ti(s,l);for(const d of nc(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const m={...s,waypoints:d};if(bn(m,c).length>u||ei(m,l)>f||ti(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=Qe(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Qe(n),s=a.edges.find(u=>u.id===o);if(!s)continue;const c=Em(s,a);if(!c)continue;const l=n.get(o);l&&i.updateWaypoints(l,c)}}function tp(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=Dt(n[0].x,n[1].x)&&!Dt(n[0].y,n[1].y),s=Dt(n[n.length-1].x,n[n.length-2].x)&&!Dt(n[n.length-1].y,n[n.length-2].y);for(const c of Oi){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 LS(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 C of[0,...Oi])Math.abs(C)<i.width/2-5&&y.push({pts:[{x:p,y:l},{x:u+C,y:l},{x:u+C,y:h}],cost:Math.abs(C)}),Math.abs(C)<i.height/2-5&&y.push({pts:[{x:c,y:d},{x:c,y:f+C},{x:m,y:f+C}],cost:Math.abs(C)});return y}function np(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,...Oi]){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 Rm(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=ni(t),r=t.edges.filter(d=>d.id!==e.id),o=ei(e,r);if(o===0)return null;const a=ti(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=[...ic(e,n),...np(e,n),...tp(e,n)];for(const{pts:d,cost:m}of p){const h={...e,waypoints:d};if(bn(h,i).length>0)continue;const y=ei(h,r),C=ti(h,r),_=o-y+(f-u(d));if(y>=o||C-a>_)continue;const g=c(d);(!s||y<s.opposite||y===s.opposite&&(C<s.cross||C===s.cross&&(m<s.cost||m===s.cost&&g<s.len)))&&(s={pts:d,opposite:y,cross:C,cost:m,len:g})}return(s==null?void 0:s.pts)??null}function Cm(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 IS(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=ni(t),r=t.edges.filter(p=>p.id!==e.id),o=Cm(e,r);if(o===0)return null;const a=ei(e,r),s=ti(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=[...ic(e,n),...np(e,n),...LS(e,n),...tp(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(bn(m,i).length>0)continue;const h=Cm(m,r);if(h>=o)continue;const y=ei(m,r);if(y-h>a-o)continue;const C=ti(m,r);if(C-s>(o-h)*l)continue;const _=c(p);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(C<u.cross||C===u.cross&&(d<u.cost||d===u.cost&&_<u.length))))&&(u={pts:p,fake:h,unreadable:y,cross:C,cost:d,length:_})}return(u==null?void 0:u.pts)??null}function Mm(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=bt(Qe(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(gt(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=Qe(i),l=c.edges.find(p=>p.id===s);if(!l)continue;const u=IS(l,c);if(!u)continue;const f=i.get(s);f&&r.updateWaypoints(f,u)}}function Am(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 Pm(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:Am(e,n)&&Am(t,n)}function Tm(e,t,n){let i=0;for(const r of t)r.id!==e.id&&Pm(e,r,n)&&i++;return i}function BS(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=ni(t),r=t.edges.filter(p=>p.id!==e.id),o=Tm(e,r,n);if(o===0)return null;const a=ei(e,r),s=ti(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=[...ic(e,n),...np(e,n),...tp(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(bn(m,i).length>0)continue;const h=Tm(m,r,n);if(h>=o)continue;const y=ei(m,r);if(y-h>a-o)continue;const C=ti(m,r);if(C-s>(o-h)*l)continue;const _=c(p);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(C<u.cross||C===u.cross&&(d<u.cost||d===u.cost&&_<u.length))))&&(u={pts:p,chain:h,unreadable:y,cross:C,cost:d,length:_})}return(u==null?void 0:u.pts)??null}function NS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Qe(i),a=new Map(o.shapes.map(l=>[l.id,l])),s=bt(o).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(gt(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||!Pm(u,f,a)))for(const p of l.edges)n.has(p)||c.add(p)}for(const l of[...c].sort()){const u=Qe(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 km(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Qe(i),a=bt(o).filter(u=>Yu(u)&&!t.has(gt(u)));if(!a.length)return;const s=new Set;for(const u of a)if(Yu(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=Qe(i),p=f.edges.find(h=>h.id===u);if(!p)continue;const d=Rm(p,f);if(!d)continue;const m=i.get(u);m&&r.updateWaypoints(m,d)}}const $S=10,FS=(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 Om(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Zs(e,i))return null;const r=ni(t),o=i.flatMap(vn);for(const a of vn(e)){let s=[[a.lo,a.hi]];for(const[d,m]of Xs(a,o))s=s.flatMap(([h,y])=>{const C=[];return d>h&&C.push([h,Math.min(y,d)]),m<y&&C.push([Math.max(h,m),y]),C.filter(([_,g])=>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-Zh}:{x:a.at+zn+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(!Zs({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&FS(p,d)))return p}return null}const zn=8;function ip(e,t){const n=e.label;if(!n)return null;const i=vn(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(vn),...t.shapes.filter(p=>p.container).flatMap(Ca)],l=p=>!c.some(d=>qi(p,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+zn,f=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const p of[s.at+zn,s.at-zn-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-zn-n.height,s.at+zn])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}const jS=30,HS=(e,t)=>{let n=1/0;for(let i=0;i+1<t.length;i++){const r=t[i],o=t[i+1],a=o.x-r.x,s=o.y-r.y,c=a*a+s*s,l=c?Math.max(0,Math.min(1,((e.x-r.x)*a+(e.y-r.y)*s)/c)):0;n=Math.min(n,Math.hypot(e.x-(r.x+l*a),e.y-(r.y+l*s)))}return n};function Dm(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let r=Qe(n),o=new Set(bt(r).map(gt));for(const[c,l]of t){const u=l.wps,f=n.get(c),p=f==null?void 0:f.label;if(!p||!(f!=null&&f.waypoints))continue;const d=f.waypoints[0].x-u[0].x,m=f.waypoints[0].y-u[0].y;if(!(f.waypoints.length===u.length&&f.waypoints.every((R,P)=>R.x-u[P].x===d&&R.y-u[P].y===m))){if(((a=f.source)==null?void 0:a.id)===l.source&&((s=f.target)==null?void 0:s.id)===l.target)continue;const R=r.edges.find(D=>D.id===c);if(!(R!=null&&R.label)||!ec(R.label,r).length)continue;const P={...R.label,x:l.label.x,y:l.label.y};if(ec(P,r).length)continue;const T={x:P.x+P.width/2,y:P.y+P.height/2};if(HS(T,R.waypoints)>jS)continue;const N={...r,edges:r.edges.map(D=>D.id===c?{...D,label:P}:D)},k=bt(N);if(k.some(D=>!o.has(gt(D))))continue;i.moveElements([p],{x:l.label.x-p.x,y:l.label.y-p.y}),r=N,o=new Set(k.map(gt));continue}const y=l.label.x+d-p.x,C=l.label.y+m-p.y;if(y===0&&C===0)continue;const _=r.edges.find(R=>R.id===c);if(!(_!=null&&_.label))continue;const g={..._.label,x:_.label.x+y,y:_.label.y+C},v={...r,edges:r.edges.map(R=>R.id===c?{...R,label:g}:R)},w=bt(v);w.some(R=>!o.has(gt(R)))||(i.moveElements([p],{x:y,y:C}),r=v,o=new Set(w.map(gt)))}}function Lm(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Qe(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=ip(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 Im(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Qe(i),a=bt(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(gt(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=Om(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 Bm(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(vn),...t.shapes.filter(p=>p.container).flatMap(Ca)],r=i.filter(p=>qi(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=>qi(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-zn-n.height},{...n,y:p.at+zn}):l.push({...n,x:p.at-zn-n.width},{...n,x:p.at+zn});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+zn},{...n,x:u-n.width/2,y:e.y-zn-n.height},{...n,x:e.x+e.width+zn,y:f-n.height/2},{...n,x:e.x-zn-n.width,y:f-n.height/2}),l.find(c)??null}function Nm(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Qe(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Bm(o,Qe(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 zS(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 $m(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=Qe(n),o=new Set(bt(r).map(gt));const a=[...new Set(bt(r).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(gt(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 C=h?r.shapes.find(g=>g.id===h):void 0;if(!C)continue;const _=zS(C,l[y]);_.x===l[y].x&&_.y===l[y].y||(l[y]=_,f=!0)}if(!f)continue;const p={...r,edges:r.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=bt(p);if(d.some(h=>!o.has(gt(h))))continue;const m=n.get(s);m&&(i.updateWaypoints(m,l),r=p,o=new Set(d.map(gt)))}}const GS=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Fm=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),jm={"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}]},ac=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),rp=e=>typeof e=="string"&&e!=="";function VS(e){const t=[];function n(i,r,o,a){if(a===null){rp(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ac(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)rp(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a;if(!ac(i)||!rp(i.kind)||!(i.kind in jm)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const s of jm[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(!ac(f))break;f=f[d]}if(!ac(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"&&!mh(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 Hm(e,t){const n=VS(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,m){if(!GS.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:C,name:_,condition:g}=p.flow,v=l(d,y,"source",["flowNode"]),w=l(d,C,"target",["flowNode"]);v&&w&&c(y)!==c(C)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),_!==void 0&&g!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:y,target:C}=p.flow,_=l(d,y,"source",["flowNode","participant"]),g=l(d,C,"target",["flowNode","participant"]);if(_&&g){const v=c(y),w=c(C);v!==void 0&&v===w&&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(_=>_===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const C=h.source===p.dataStore.id?h.target:h.source;l(d,C,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:y}=p.association,C=l(d,h,"source"),_=l(d,y,"target");if(C&&_){const g=new Set([C,_]);g.has("dataStore")&&g.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:y})}break}case"association.add":{const{id:h,source:y,target:C}=p.association,_=l(d,y,"source"),g=l(d,C,"target");_&&g&&_!=="annotation"&&g!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${y}->${C}`});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 C=h===p.annotation.id?y:h;l(d,C,"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&&Fm.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(_=>_.id);for(const _ of h)y.includes(_)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.id,lane:_});for(const _ of y)t.categoryOf(_)!==void 0&&!h.includes(_)&&i.push({kind:"id-duplicate",opIndex:d,id:_});const C=y.filter(_=>h.includes(_));C.length===h.length&&C.some((_,g)=>_!==h[g])&&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,C=t.endpointsOf(p.id),_=p.source??(C==null?void 0:C.source),g=p.target??(C==null?void 0:C.target);h&&y&&_!==void 0&&g!==void 0&&new Set([c(_),c(g),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&&Fm.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 zm(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 sc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const cc={"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]},xn=10,WS=300,US=160,Gm=20,Vm=40,YS=10;function op(e,t,n,i,r){const o=n,a=(k,D)=>{const[H,Q]=cc[k];let pe={x:t.x+t.width/2+H*(t.width/2+o.width/2+D),y:t.y+t.height/2+Q*(t.height/2+o.height/2+D)};const Me=i.x+xn+o.width/2,Be=i.x+i.width-xn-o.width/2,it=i.y+xn+o.height/2,X=i.y+i.height-xn-o.height/2,J={x:Math.min(Be,Math.max(Me,pe.x)),y:Math.min(X,Math.max(it,pe.y))};return(J.x!==pe.x||J.y!==pe.y)&&(pe=Math.abs(J.x-(t.x+t.width/2))<(t.width+o.width)/2+xn&&Math.abs(J.y-(t.y+t.height/2))<(t.height+o.height)/2+xn?{x:t.x+t.width+xn+o.width/2,y:J.y}:J),pe},s=(i.children??[]).filter(k=>!("waypoints"in k&&k.waypoints)&&k.type!=="bpmn:Lane"&&k.type!=="label"&&typeof k.x=="number"&&k.id!==r.selfId),c=Qe(e),l=k=>{var H,Q;if(!r.selfId)return!1;const D=e.get(k);return!!D&&(((H=D.source)==null?void 0:H.id)===r.selfId||((Q=D.target)==null?void 0:Q.id)===r.selfId)},u=c.edges.filter(k=>!l(k.id)).flatMap(vn),f=Io(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),p=k=>({x0:k.x-o.width/2-xn,x1:k.x+o.width/2+xn,y0:k.y-o.height/2-xn,y1:k.y+o.height/2+xn}),d=k=>{const D=p(k);return s.some(H=>D.x0<H.x+H.width&&D.x1>H.x&&D.y0<H.y+H.height&&D.y1>H.y)},m=k=>{const D=p(k);return u.some(H=>H.axis==="h"?H.at>D.y0&&H.at<D.y1&&H.lo<D.x1&&H.hi>D.x0:H.at>D.x0&&H.at<D.x1&&H.lo<D.y1&&H.hi>D.y0)},h=k=>{const D=p(k);return f.some(H=>D.x0<H.x+H.width&&D.x1>H.x&&D.y0<H.y+H.height&&D.y1>H.y)},y=c.shapes.filter(k=>k.type==="bpmn:Group").flatMap(k=>[{axis:"h",at:k.y,lo:k.x,hi:k.x+k.width},{axis:"h",at:k.y+k.height,lo:k.x,hi:k.x+k.width},{axis:"v",at:k.x,lo:k.y,hi:k.y+k.height},{axis:"v",at:k.x+k.width,lo:k.y,hi:k.y+k.height}]),C=k=>{const D=p(k);return y.some(H=>H.axis==="h"?H.at>D.y0&&H.at<D.y1&&H.lo<D.x1&&H.hi>D.x0:H.at>D.x0&&H.at<D.x1&&H.lo<D.y1&&H.hi>D.y0)},_=k=>d(k)||m(k)||h(k)||C(k),g=k=>k.x-o.width/2>=i.x&&k.x+o.width/2<=i.x+i.width&&k.y-o.height/2>=i.y&&k.y+o.height/2<=i.y+i.height;if(r.placement){const k=Be=>Be.startsWith("top")?Be.replace(/^top/,"bottom"):Be.replace(/^bottom/,"top"),D=Be=>Be.endsWith("left")?Be.replace(/left$/,"right"):Be.replace(/right$/,"left"),H=r.placement.side,Q=[H,k(H),D(H),k(D(H)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],pe=r.placement.offset??50;let Me=a(H,pe);if(_(Me)){const Be=new Set;for(const it of Q){if(Be.has(it))continue;Be.add(it);const X=a(it,pe);if(g(X)&&!_(X)){Me=X;break}}}return Me}const v=r.from,w=i.x+xn+o.width/2,R=i.x+i.width-xn-o.width/2,P=i.y+xn+o.height/2,T=i.y+i.height-xn-o.height/2;let N={x:Math.min(R,Math.max(w,v.x)),y:Math.min(T,Math.max(P,v.y))};if(_(N)){const k=(t.width+o.width)/2+xn,H=[{x:N.x+k,y:N.y},{x:N.x-k,y:N.y},{x:N.x,y:N.y-o.height-xn},{x:N.x,y:N.y+o.height+xn}].filter(g).find(Q=>!_(Q));H&&(N=H)}return N}function Xt(e,t){return e.filter(n=>n.kind===t)}function Wm(e,t){var L0,I0,B0,N0,$0,F0,j0,H0,z0,G0,V0,W0,U0,Y0,q0,K0,X0,Z0,Q0,J0,eE,tE,nE;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),f=b=>o.get(b),p=b=>{const M=f(b);if(!M)throw new Error(`하강 참조 해소 실패: ${b}`);return M},d=b=>{let M=b.parent;for(;M;){if(M.type==="bpmn:Participant")return M;M=M.parent}},m=new Map;for(const b of o.filter(M=>!("waypoints"in M&&M.waypoints)&&M.type!=="bpmn:Lane"&&M.type!=="label"&&typeof M.x=="number"))m.set(b.id,{x:b.x,y:b.y});const h=Xt(e,"participant.add"),y=Xt(e,"node.add"),C=Xt(e,"sequenceFlow.add"),_=Xt(e,"messageFlow.add"),g=Xt(e,"dataStore.add"),v=Xt(e,"dataAssociation.add"),w=Xt(e,"annotation.add"),R=Xt(e,"group.add"),P=new Map(y.map(b=>[b.node.id,b])),T=(b,M,A)=>{var j;const O=b.businessObject,B=(((j=O.extensionElements)==null?void 0:j.values)??[]).filter($=>$.$type!==M),I=A?[...B,i.create(M,A)]:B;if(!I.length){O.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const F=i.create("bpmn:ExtensionElements",{values:I});I.forEach($=>{$.$parent=F}),n.updateProperties(b,{extensionElements:F})},N=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of Xt(e,"element.remove")){const M=f(b.id);M&&n.removeElements([M])}const k=b=>o.filter(M=>{var A;return M.type==="bpmn:Lane"&&((A=d(M))==null?void 0:A.id)===b}).sort((M,A)=>M.y-A.y);for(const b of Xt(e,"participant.update")){const M=p(b.id);if(b.name!==void 0&&n.updateProperties(M,{name:b.name??void 0}),!b.lanes)continue;const A=k(b.id);if(!A.length){n.splitLane(M,b.lanes.length),k(b.id).forEach((B,I)=>{const F=b.lanes[I];F&&n.updateProperties(B,{id:F.id,name:F.name})});continue}const O=new Set(A.map(B=>B.id));b.lanes.forEach((B,I)=>{if(O.has(B.id)){n.updateProperties(p(B.id),{name:B.name});return}const F=I===0?n.addLane(k(b.id)[0],"top"):n.addLane(p(b.lanes[I-1].id),"bottom");n.updateProperties(F,{id:B.id,name:B.name})})}const D=150,H=130,Q=80,pe=90,Me=180,Be=30,it=30,X=(b,M,A,O,B)=>{const I=A-M.width/2,F=O-M.height/2;return(b.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"&&I<j.x+j.width+it&&I+M.width+it>j.x&&F<j.y+j.height&&F+M.height>j.y)},J=new Set;for(const b of h){J.add(`pool:${b.participant.id}`);for(const M of b.participant.lanes??[])J.add(M.id)}const le=new Map;for(const b of y){const M=b.node.lane??`pool:${b.node.participant??""}`;let A=le.get(M);A||le.set(M,A=new Set([0])),b.band!==void 0&&A.add(b.band)}const ve=new Map;for(const[b,M]of le){if(!J.has(b))continue;const A=[...M].sort((I,F)=>I-F),O=A.map((I,F)=>F===0?0:F%2===1?Math.ceil(F/2):-(F/2)),B=Math.min(...O);ve.set(b,new Map(A.map((I,F)=>[I,O[F]-B])))}{const b=new Map;for(const M of h)(M.participant.lanes??[]).forEach((A,O)=>b.set(A.id,O));for(const[M,A]of ve){if(!b.has(M)||A.size<2)continue;const O=b.get(M),B=A.get(0)??0,I=new Set;for(const se of y){if(se.node.lane!==M||(se.band??0)!==0||!se.node.type.endsWith("Gateway"))continue;const me={in:new Set,out:new Set,cross:new Set};for(const ge of C){const Ce=ge.flow.source===se.node.id;if(!Ce&&ge.flow.target!==se.node.id)continue;const ht=P.get(Ce?ge.flow.target:ge.flow.source);if(!ht||ht.node.participant!==se.node.participant||!ht.node.lane)continue;let De,K=!1;if(ht.node.lane!==M){const ce=b.get(ht.node.lane);if(ce===void 0)continue;De=ce>O?"down":"up",K=!0}else{const ce=A.get(ht.band??0)??B;De=ce>B?"down":ce<B?"up":void 0}De&&(me[Ce?"out":"in"].add(De),K&&me.cross.add(De))}for(const ge of["up","down"])me.in.has(ge)&&me.out.has(ge)&&me.cross.has(ge)&&I.add(ge)}if(I.size!==1)continue;const[F]=I,j=Math.max(...A.values()),$=F==="down"?j:0;if(B===$)continue;const Y=[...A.entries()].filter(([se])=>se!==0).sort((se,me)=>se[1]-me[1]),ue=[...Array(j+1).keys()].filter(se=>se!==$),xe=new Map([[0,$]]);Y.forEach(([se],me)=>xe.set(se,ue[me])),ve.set(M,xe)}}const q=b=>{var M;return(((M=le.get(b))==null?void 0:M.size)??0)>1},V=b=>b.band??(b.node.lane||!q(`pool:${b.node.participant??""}`)?void 0:0),ne=new Map,Te=b=>ne.get(b.node.id)??V(b),Pe=new Set,L=new Set;{const b=new Map;for(const O of C)b.set(O.flow.target,(b.get(O.flow.target)??0)+1);const M=O=>{const B=[],I=new Set([O]),F=[O];for(;F.length;){const j=F.shift();B.push(j);for(const $ of C)$.flow.source!==j||I.has($.flow.target)||(b.get($.flow.target)??0)!==1||(I.add($.flow.target),F.push($.flow.target))}return B},A=(O,B)=>{var I;return((I=ve.get(O))==null?void 0:I.get(B))??B};for(const O of y){if(!O.node.type.endsWith("Gateway"))continue;const B=O.node.lane??`pool:${O.node.participant??""}`,I=ve.get(B);if(!I||I.size<2)continue;const F=Te(O);if(F===void 0||A(B,F)!==A(B,0))continue;const j=A(B,F),$=C.filter(ge=>ge.flow.source===O.node.id).map(ge=>P.get(ge.flow.target)).filter(ge=>!!ge&&(ge.node.lane??`pool:${ge.node.participant??""}`)===B),Y=$.filter(ge=>{const Ce=Te(ge);return Ce!==void 0&&A(B,Ce)===j&&(b.get(ge.node.id)??0)===1}),ue=$.some(ge=>{const Ce=Te(ge);return Ce!==void 0&&A(B,Ce)>j});if(Y.length!==1||!ue)continue;const xe=new Set($.flatMap(ge=>M(ge.node.id)));if(!C.some(ge=>ge.flow.target===O.node.id&&xe.has(ge.flow.source)))continue;const me=new Map;for(const[ge,Ce]of I)me.set(ge,Ce+1);me.set(-1,0),ve.set(B,me);for(const ge of M(Y[0].node.id))P.has(ge)&&(ne.set(ge,-1),L.add(ge));Pe.add(O.node.id)}}const E=(b,M)=>{var A;return((A=ve.get(b))==null?void 0:A.get(M))??M},x=(b,M,A,O)=>{const B=b?f(b):M?f(M):void 0;if(!B)return!1;const I=b?B.y+Math.min(B.height/2,pe):B.y+Q;return Math.abs(I+E(b??`pool:${M??""}`,A)*D-O)<=D/2},G=new Map;for(const[b,M]of le){let A=0;for(const O of M)A=Math.max(A,E(b,O));G.set(b,A)}const U=b=>Me+D*b,Z=(b,M,A)=>{const O=u().children.filter(B=>!("waypoints"in B&&B.waypoints)&&B.id!==M&&typeof B.y=="number"&&B.y>=b);O.length&&n.moveElements(O,{x:0,y:A})},Re=(b,M,A)=>{const O=b.type==="bpmn:Participant"?b:void 0;if(!O||O.children.some(j=>j.type==="bpmn:Lane"))return;const B=A+M.height/2+Be-O.y;if(O.height>=B)return;const I=B-O.height,F=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:B}),Z(F,O.id,I)},Xe=(b,M)=>{const A=M-b.height;if(A<=0)return;const O=d(b)??b,B=[],I=$=>{B.push($);for(const Y of $.children??[])I(Y)};I(O);const F=b.y+b.height-10,j=l.calculateAdjustments(B,"y",A,F);l.makeSpace(j.movingShapes,j.resizingShapes,{x:0,y:A},"s",F)},dt=(b,M,A)=>{if(b){const F=p(b),j=U(M);if(F.height>=j)return;const $=j-F.height,Y=d(F),ue=Y?Y.y+Y.height:F.y+F.height;Xe(F,j),Z(ue,Y==null?void 0:Y.id,$);return}if(!A)return;const O=D*(M+1);if(A.height>=O)return;const B=O-A.height,I=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:O}),Z(I,A.id,B)},Vt=new Map;for(const b of C)Vt.set(b.flow.target,(Vt.get(b.flow.target)??0)+1);const wt=b=>(Vt.get(b)??0)<=1,ln=(b,M)=>{if(!b)return;const A=f(b);if(!A||A.height>=U(M))return;const O=A.y+A.height-10,B=d(A);if(B)return new Set((B.children??[]).filter(I=>I.type!=="bpmn:Lane"&&typeof I.y=="number"&&I.y>O).map(I=>I.id))},gn=(b,M,A)=>{if(!b)return!0;const O=f(b);return O?A-M.height/2>=O.y&&A+M.height/2<=O.y+O.height:!0},yn=h.map((b,M)=>({op:b,declared:M}));yn.sort((b,M)=>{const A=b.op.order??Number.POSITIVE_INFINITY,O=M.op.order??Number.POSITIVE_INFINITY;return A!==O?A-O:b.declared-M.declared});let Et=80;for(const b of o.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(Et=Math.max(Et,b.y+b.height+60));for(const{op:b}of yn){const M=b.participant,A=y.filter(se=>se.node.participant===M.id).length,O=((L0=M.lanes)==null?void 0:L0.length)??0,B=Math.max(1200,A*160+300),I=(M.lanes??[]).map(se=>U(G.get(se.id)??0)),F=I.reduce((se,me)=>se+me,0);O&&F<300&&(I[O-1]+=300-F);const j=Math.max(300,D*((G.get(`pool:${M.id}`)??0)+1)),$=M.blackBox||A+O===0?120:O?Math.max(300,F):j,Y=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:M.id,name:M.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},...M.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:B,height:$,isExpanded:!0}),ue=n.createShape(Y,{x:100+B/2,y:Et+$/2},u()),xe=M.lanes??[];if(xe.length&&n.splitLane(ue,xe.length),xe.length){const se=o.filter(me=>{var ge;return me.type==="bpmn:Lane"&&((ge=d(me))==null?void 0:ge.id)===M.id}).sort((me,ge)=>me.y-ge.y);if(se.forEach((me,ge)=>{const Ce=xe[ge];Ce&&n.updateProperties(me,{id:Ce.id,name:Ce.name})}),I.some(me=>me!==ue.height/O)){let me=ue.y;se.forEach((ge,Ce)=>{const ht=I[Ce];n.resizeShape(ge,{x:ge.x,y:me,width:ge.width,height:ht}),me+=ht})}}Et=ue.y+ue.height+60}const un=b=>{var O;const M=P.get(b);if(M)return M.node.participant??"";const A=f(b);return A?A.type==="bpmn:Participant"?A.id:((O=d(A))==null?void 0:O.id)??"":""},hn=new Map,vo=b=>{let M=hn.get(b);return M||hn.set(b,M={nodes:[],flows:[]}),M};for(const b of y)vo(b.node.participant??"").nodes.push(b);for(const b of C)vo(un(b.flow.source)).flows.push(b);const Zn=b=>{var M;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((M=b.condition)==null?void 0:M.label)})},xi=(b,M,A)=>r.createShape({type:sc(b.type),businessObject:i.create(sc(b.type),{id:b.id,name:b.name,...M!==void 0?{"bwl:band":M}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),_i=[...yn.map(({op:b})=>b.participant.id).filter(b=>hn.has(b)),...[...hn.keys()].filter(b=>!h.some(M=>M.participant.id===b))],Kt=b=>b.endsWith("Gateway");for(const b of _i){const M=hn.get(b),A=b?p(b):void 0,O=A?A.x+150:250;let B=A?A.y+80:120;const I=(K,ce,te)=>{if(K){const de=p(K);return de.y+Math.min(de.height/2,pe)+E(K,ce??0)*D}return ce!==void 0&&A?A.y+Q+E(`pool:${b}`,ce)*D:te},F=(K,ce,te)=>{if(K){const de=p(K);return de.y+Math.min(de.height/2,pe)+ce*D}return A?A.y+Q+ce*D:te},j=K=>K.participant?p(K.participant):u(),$=(K,ce,te,de,Ve,We,Ct)=>{const Ft=te!==void 0||de!==void 0,he=E(te??`pool:${b}`,de??0);if((de===void 0||x(te,b,de,Ct??Number.NaN))&&Ct!==void 0&&gn(te,ce,Ct)&&!X(K,ce,Ve,Ct))return{x:Ve,y:Ct};if(Ft)for(let fe=0;fe<4;fe++){const Le=F(te,he+fe,We);if(!X(K,ce,Ve,Le,ln(te,he+fe)))return dt(te,he+fe,A),{x:Ve,y:Le}}const ye=I(te,de,We);Ft?dt(te,he,A):Re(K,ce,ye);let ie=Ve;for(let fe=0;fe<64;fe++){const Le=X(K,ce,ie,ye);if(!Le)break;ie=Le.x+Le.width+H+ce.width/2}return{x:ie,y:ye}},Y=new Set(M.flows.map(K=>K.flow.target)),ue=new Map,xe=K=>{if(K===void 0)return;const ce=o.get(K);if(!(!ce||typeof ce.x!="number"||typeof ce.width!="number"))return ce.x+ce.width+H};for(const K of M.nodes){if(Y.has(K.node.id))continue;const ce=xi(K.node,K.band,K.afterColumn),te=V(K),de=K.node.lane?`${K.node.lane}|${te??""}`:te!==void 0?`band:${te}`:"",Ve=j(K.node),We=ue.get(de)??O,Ct=xe(K.afterColumn),Ft=Ct===void 0?We:Math.max(We,Ct),he=$(Ve,ce,K.node.lane,te,Ft,B);n.createShape(ce,he,Ve),ue.set(de,he.x+ce.width+H),!K.node.lane&&te===void 0&&(B+=160)}const se=new Set,me=new Map,ge=new Map,Ce=new Map;if(b&&J.has(`pool:${b}`)){const K=new Map;for(const he of M.flows)K.set(he.flow.target,(K.get(he.flow.target)??0)+1);const ce=he=>I(he.node.lane,Te(he),Number.NaN),te=new Set,de=he=>{var fe;const ye=(fe=P.get(he))==null?void 0:fe.node.participant;if(ye)return f(ye);const ie=f(he);if(ie)return ie.type==="bpmn:Participant"?ie:d(ie)},Ve=he=>{const ye=[],ie=new Set([he]),fe=[he];for(;fe.length;){const Le=fe.shift(),qe=P.get(Le);qe&&ye.push(qe);for(const ke of M.flows)ke.flow.source!==Le||ie.has(ke.flow.target)||(K.get(ke.flow.target)??0)!==1||(ie.add(ke.flow.target),fe.push(ke.flow.target))}return ye},We=he=>{if(!A)return;const ye=new Set(he.map(Le=>Le.node.id));let ie=!1,fe=!1;for(const Le of _){if(!ye.has(Le.flow.source))continue;const qe=de(Le.flow.target);!qe||qe.id===A.id||(qe.y<A.y?ie=!0:fe=!0)}return ie&&!fe?"up":fe&&!ie?"down":void 0};for(const he of M.nodes){if(!Kt(he.node.type))continue;const ye=I(he.node.lane,V(he),Number.NaN);if(Number.isNaN(ye))continue;const ie=[];for(const ke of M.flows){if(ke.flow.source!==he.node.id)continue;const He=P.get(ke.flow.target);if(!He||He.node.lane!==he.node.lane||(K.get(He.node.id)??0)!==1)continue;const Ze=V(He);if(Ze===void 0)continue;const we=I(He.node.lane,Ze,Number.NaN);if(Number.isNaN(we))continue;const lt=Ve(He.node.id),Ae=We(lt);Ae&&ie.push({subtree:lt,band:Ze,row:we,dir:Ae})}if(!ie.some(ke=>ke.dir==="up")||!ie.some(ke=>ke.dir==="down")||!ie.some(ke=>ke.dir==="up"&&ie.some(He=>He.dir==="down"&&He.row<ke.row)))continue;const Le=[...ie].sort((ke,He)=>ke.row-He.row);[...ie.filter(ke=>ke.dir==="up"),...ie.filter(ke=>ke.dir==="down")].sort((ke,He)=>ke.dir===He.dir?ke.row-He.row:ke.dir==="up"?-1:1).forEach((ke,He)=>{const Ze=Le[He].band;if(Ze!==ke.band){te.add(he.node.id);for(const we of ke.subtree)V(we)===ke.band&&ne.set(we.node.id,Ze)}})}const Ct=he=>{if(!A)return;const ye=new Set(he.map(Le=>Le.node.id));let ie=!1,fe=!1;for(const Le of _){if(!ye.has(Le.flow.target))continue;const qe=de(Le.flow.source);!qe||qe.id===A.id||(qe.y<A.y?ie=!0:fe=!0)}return ie&&!fe?"up":fe&&!ie?"down":void 0};for(const he of M.nodes){if(!Kt(he.node.type))continue;const ye=he.node.lane??`pool:${b}`,ie=ve.get(ye);if(!ie||ie.size<2)continue;const fe=ie.get(0);if(fe===void 0)continue;const Le=Math.max(...ie.values()),qe=fe===Le&&fe!==0?"down":void 0;if(!qe)continue;const ke=[];for(const Ae of M.flows){if(Ae.flow.source!==he.node.id)continue;const St=P.get(Ae.flow.target);if(!St||St.node.lane!==he.node.lane||(K.get(St.node.id)??0)!==1)continue;const _t=Te(St);_t!==void 0&&ke.push({t:St,subtree:Ve(St.node.id),band:_t})}const He=ke.find(Ae=>(ie.get(Ae.band)??Ae.band)===fe);if(!He||Ct(He.subtree)===qe||We(He.subtree)===qe)continue;const Ze=ke.find(Ae=>Ae!==He&&Ct(Ae.subtree)===qe);if(!Ze)continue;const we=He.band,lt=Ze.band;for(const Ae of He.subtree)Te(Ae)===we&&ne.set(Ae.node.id,lt);for(const Ae of Ze.subtree)Te(Ae)===lt&&ne.set(Ae.node.id,we);te.add(he.node.id)}for(const he of M.nodes){if(!Kt(he.node.type))continue;const ye=ce(he);if(Number.isNaN(ye)||w.some(ke=>{var He,Ze;return(((He=ke.placement)==null?void 0:He.anchor)??(ke.association?ke.association.source===ke.annotation.id?ke.association.target:ke.association.source:void 0))===he.node.id&&((Ze=ke.placement)==null?void 0:Ze.side.startsWith("bottom"))}))continue;let fe,Le=!1,qe;for(const ke of M.flows){if(ke.flow.source!==he.node.id)continue;const He=P.get(ke.flow.target);if(!He||!He.node.lane&&V(He)===void 0)continue;const Ze=ce(He);Number.isNaN(Ze)||(Math.abs(Ze-ye)<.5&&(Le=!0),Ze>ye?!fe||Ze>fe.row?fe={id:He.node.id,row:Ze,count:1}:Ze===fe.row&&fe.count++:Ze<ye&&He.node.lane===he.node.lane&&(!qe||Ze>qe.row?qe={op:He,row:Ze,count:1}:Ze===qe.row&&qe.count++))}fe&&fe.count===1&&(K.get(fe.id)??0)===1&&!te.has(he.node.id)&&se.add(fe.id),!Le&&qe&&qe.count===1&&(K.get(qe.op.node.id)??0)===1&&!Pe.has(he.node.id)&&me.set(qe.op.node.id,{lane:he.node.lane,band:Te(he)})}const Ft=new Map;for(const he of _)Ft.set(he.flow.target,[...Ft.get(he.flow.target)??[],he]);for(const he of M.nodes){const ye=Ft.get(he.node.id);if(!ye||ye.length!==1||!K.get(he.node.id)||!he.node.lane&&V(he)===void 0||L.has(he.node.id))continue;const ie=(I0=P.get(ye[0].flow.source))==null?void 0:I0.node.participant,fe=ie?f(ie):void 0;if(!fe||!A||fe.id===A.id)continue;const Le=he.node.lane??`pool:${b}`,qe=ve.get(Le);if(!qe)continue;const ke=qe.get(0)??0,He=(qe.get(Te(he)??0)??ke)-ke;if(He===0)continue;const Ze=fe.y<A.y;if(Ze&&He<0||!Ze&&He>0)continue;let we;for(const[lt,Ae]of qe){const St=Ae-ke;(Ze&&St<0&&(!we||St<we.row)||!Ze&&St>0&&(!we||St>we.row))&&(we={band:lt,row:St})}we&&ge.set(he.node.id,{lane:he.node.lane,band:we.band})}}const ht=new Set;let De=0;for(;De++<M.nodes.length+2;){for(let te=0;te<M.nodes.length+M.flows.length+2;te++){let de=!1;for(const Ve of M.flows){const We=Ve.flow;if(ht.has(We.id))continue;const Ct=f(We.source);if(!Ct)continue;const Ft=f(We.target),he=P.get(We.target);if(!Ft&&he){const ye=xi(he.node,he.band),ie=Te(he);if(he.node.lane||ie!==void 0){const fe=j(he.node),Le=Ct,qe=Le.x+(Ce.get(We.source)??0)+Le.width+H,ke=me.get(We.target)??ge.get(We.target),He=$(fe,ye,ke?ke.lane:he.node.lane,ke?ke.band:ie,se.has(We.target)?Le.x+Le.width/2:qe,Number.NaN,ke||!wt(We.target)?void 0:Le.y+Le.height/2),Ze=n.createShape(ye,He,fe);se.has(We.target)&&Ce.set(We.target,qe-(Ze.x+Ze.width/2)),n.connect(Ct,Ze,{type:"bpmn:SequenceFlow",businessObject:Zn(We)})}else s.append(Ct,ye,{connection:{type:"bpmn:SequenceFlow",businessObject:Zn(We)}})}else if(Ft)n.connect(Ct,Ft,{type:"bpmn:SequenceFlow",businessObject:Zn(We)});else continue;ht.add(We.id),de=!0}if(!de)break}const K=M.nodes.filter(te=>!f(te.node.id));if(!K.length)break;const ce=K[0];{const te=xi(ce.node,ce.band),de=j(ce.node),Ve=V(ce);n.createShape(te,$(de,te,ce.node.lane,Ve,O,B),de),!ce.node.lane&&Ve===void 0&&(B+=160)}}}const wi=40,Ts=b=>{const M=()=>new Set(bt(Qe(o)).map(Y=>gt(Y))),A=M(),O=b.waypoints.map(Y=>({x:Y.x,y:Y.y})),B=b.label,I=B&&{x:B.x,y:B.y};n.layoutConnection(b,{waypoints:[]});const F=M(),j=[...F].filter(Y=>!A.has(Y)).length,$=[...A].filter(Y=>!F.has(Y)).length;j<=$||(n.updateWaypoints(b,O),B&&I&&(B.x!==I.x||B.y!==I.y)&&n.moveElements([B],{x:I.x-B.x,y:I.y-B.y}))},Qn=5,ct=10,xt=200,bu=new Set([...C.map(b=>b.flow.id),..._.map(b=>b.flow.id),...Xt(e,"sequenceFlow.update").map(b=>b.id),...Xt(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),EB=(b,M,A,O,B,I)=>{const F=new Set(b.map(K=>K.id)),j=Math.min(...b.map(K=>K.x))+M-ct,$=Math.max(...b.map(K=>K.x+K.width))+M+xt+ct,Y=Math.min(...b.map(K=>K.y+Math.min(0,...A)))-ct,ue=Math.max(...b.map(K=>K.y+K.height+Math.max(0,...A)))+ct,xe=o.getAll().filter(K=>{if(K.type!=="bpmn:SequenceFlow"&&K.type!=="bpmn:MessageFlow")return!1;const ce=K;return bu.has(ce.id)||!ce.waypoints||ce.waypoints.length<2||[ce.source,ce.target].some(de=>!de||F.has(de.id)||de.x>=O)?!1:ce.waypoints.some((de,Ve)=>{const We=ce.waypoints[Ve+1];return!!We&&Math.max(de.x,We.x)>=j&&Math.min(de.x,We.x)<=$&&Math.max(de.y,We.y)>=Y&&Math.min(de.y,We.y)<=ue})});if(!xe.length)return 0;const se=K=>{const ce=new Map;for(const te of b)for(const de of A){const Ve={id:te.id,type:te.type,x:te.x+M+K,y:te.y+de,width:te.width,height:te.height};for(const We of xe){let Ct=1/0;for(let he=0;he+1<We.waypoints.length;he++)Ct=Math.min(Ct,Qs(We.waypoints[he],We.waypoints[he+1],Ve));const Ft=`${We.id}|${te.id}`;ce.set(Ft,Math.min(ce.get(Ft)??1/0,Ct))}}return ce},me=[...se(0)].filter(([,K])=>K<=Qn).map(([K])=>K);if(!me.length)return 0;let ge=0;for(let K=1;K<=xt;K++){const ce=se(K);if([...ce.values()].every(te=>te>Qn)&&me.every(te=>(ce.get(te)??1/0)>=ct)){ge=K;break}}if(!ge)return 0;const Ce=Math.min(...b.map(K=>K.x))+M+ge,ht=new Set(me.map(K=>K.slice(0,K.indexOf("|"))));return xe.some(K=>K.type==="bpmn:SequenceFlow"&&ht.has(K.id)&&K.waypoints.some((ce,te)=>{const de=K.waypoints[te+1];if(!de||Math.min(ce.y,de.y)>I||Math.max(ce.y,de.y)<I||ce.y===de.y)return!1;const Ve=ce.x+(I-ce.y)*(de.x-ce.x)/(de.y-ce.y);return Ve>B&&Ve<Ce}))?0:ge},bo=(b,M=()=>!0)=>{const A=f(b);if(!A)return[];const O=[A],B=new Set([b]);for(let I=0;I<O.length;I++){const F=O[I].id;for(const j of C){const $=j.flow.target;if(j.flow.source!==F||B.has($)||!P.has($))continue;B.add($);const Y=f($);Y&&M(Y)&&O.push(Y)}}return O},SB=(b,M=()=>!0)=>{const A=f(b);if(!A)return[];const O=[A],B=new Set([b]);for(let I=0;I<O.length;I++){const F=O[I].id;for(const j of C){const $=j.flow.source;if(j.flow.target!==F||B.has($)||!P.has($))continue;B.add($);const Y=f($);Y&&M(Y)&&O.push(Y)}}return O},Ui=30,fr=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",xu=(b,M)=>sp(n,b,M),ks=(b,M)=>{const A=new Set(b.flatMap(F=>F.subtree.map(j=>j.id)));for(const F of b){const j=(F.pool.children??[]).filter(fr).filter(Y=>!A.has(Y.id));if(F.subtree.some(Y=>j.some(ue=>Y.x+M<ue.x+ue.width+Ui&&Y.x+M+Y.width+Ui>ue.x&&Y.y<ue.y+ue.height&&Y.y+Y.height>ue.y)))return null}const O=b.map(F=>F.pool.width),B=o.filter(F=>F.type==="label").map(F=>({label:F,x:F.x,y:F.y}));n.moveElements(b.flatMap(F=>F.subtree),{x:M,y:0});const I=b.map(F=>{const $=Math.max(...F.subtree.map(Y=>Y.x+Y.width))+Um-(F.pool.x+F.pool.width);return $>0&&xu(F.pool,F.pool.width+$),$});return()=>{n.moveElements(b.flatMap(F=>F.subtree),{x:-M,y:0}),b.forEach((F,j)=>{I[j]>0&&xu(F.pool,O[j])});for(let F=0;F<3;F++){let j=0;for(const $ of B){const Y=$.x-$.label.x,ue=$.y-$.label.y;Math.abs(Y)<=.5&&Math.abs(ue)<=.5||(n.moveElements([$.label],{x:Y,y:ue}),j++)}if(!j)break}}},rh=b=>{var B,I;const M=new Map,A=new Map;for(const F of o.getAll()){if(F.type!=="bpmn:Participant")continue;const j=F;(j.children??[]).length||(M.set(j.id,j),A.set(j.id,[]))}for(const F of o.getAll()){if(F.type!=="bpmn:MessageFlow")continue;const j=F,$=(B=j.source)==null?void 0:B.id,Y=(I=j.target)==null?void 0:I.id;$&&Y&&A.has($)&&A.get($).push(Y),$&&Y&&A.has(Y)&&A.get(Y).push($)}const O=[];for(const[F,j]of A)j.length&&j.every($=>b.has($))&&O.push(M.get(F));return O},d0=(b,M)=>{if(!b.length)return null;const A=new Set(b.map(F=>F.id)),O=o.getAll().filter(F=>F.type==="bpmn:Participant"&&!A.has(F.id));if(b.some(F=>O.some(j=>F.x+M<j.x+j.width+Ui&&F.x+M+F.width+Ui>j.x&&F.y<j.y+j.height&&F.y+F.height>j.y)))return null;const I=o.filter(F=>F.type==="label").map(F=>({label:F,x:F.x,y:F.y}));return n.moveElements(b,{x:M,y:0}),()=>{n.moveElements(b,{x:-M,y:0});for(let F=0;F<3;F++){let j=0;for(const $ of I){const Y=$.x-$.label.x,ue=$.y-$.label.y;Math.abs(Y)<=.5&&Math.abs(ue)<=.5||(n.moveElements([$.label],{x:Y,y:ue}),j++)}if(!j)break}}},h0=()=>{let b=0;for(const M of o.getAll()){if(M.type!=="bpmn:DataInputAssociation"&&M.type!=="bpmn:DataOutputAssociation")continue;const A=M.waypoints??[];for(let O=1;O<A.length;O++)b+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return b},m0=()=>{let b=0;for(const M of o.getAll()){if(M.type!=="bpmn:Association")continue;const A=M.waypoints??[];for(let O=1;O<A.length;O++)b+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return b},RB=b=>{const M=[];for(const A of o.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const O=A;if(b.has(O.id))continue;const I=[...O.incoming??[],...O.outgoing??[]].filter($=>$.type==="bpmn:Association").map($=>$.source===O?$.target:$.source);if(!I.length||I.some($=>$===void 0))continue;const F=$=>{if(!("waypoints"in $&&$.waypoints))return[$.id];const Y=$,ue=[Y.source,Y.target];return ue.some(xe=>!xe)?[]:ue.map(xe=>xe.id)},j=I.flatMap($=>F($));j.length&&j.every($=>b.has($))&&M.push(O)}return M},g0=()=>bt(Qe(o)).filter(b=>b.kind==="edge-crosses-shape").length,y0=b=>{const M=(b.children??[]).filter(fr);let A=0;for(let O=0;O<M.length;O++)for(let B=O+1;B<M.length;B++){const I=M[O],F=M[B];I.x<F.x+F.width&&I.x+I.width>F.x&&I.y<F.y+F.height&&I.y+I.height>F.y&&A++}return A},va=()=>{const b=Qe(o),M=A=>A.length>=2&&(A.every(O=>Math.abs(O.x-A[0].x)<.01)||A.every(O=>Math.abs(O.y-A[0].y)<.01));return{messages:b.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:b.edges.filter(A=>M(A.waypoints)).length}},v0=b=>{const M=new Map;for(const O of o.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const B=O;if(!B.waypoints||B.waypoints.length!==2)continue;const I=B.source,F=B.target;if(!I||!F)continue;const j=b.has(I.id);if(j===b.has(F.id))continue;const $=j?F:I,Y=d($);if(!Y||b.has($.id))continue;const ue=M.get(Y.id);ue?$.x<ue.minX&&(ue.minX=$.x):M.set(Y.id,{pool:Y,minX:$.x})}const A=[];for(const{pool:O,minX:B}of M.values()){const I=(O.children??[]).filter(F=>fr(F)&&!b.has(F.id)&&F.x>=B);I.length&&A.push({subtree:I,pool:O})}return A},CB=(b,M,A)=>{const O=new Map(M.map(F=>[F.pool.id,{subtree:[...F.subtree],pool:F.pool}])),B=new Set(b);for(const F of M)for(const j of F.subtree)B.add(j.id);let I=!1;for(;;){let F=0;for(const j of v0(B)){if(j.pool===A)continue;const $=O.get(j.pool.id);$?$.subtree.push(...j.subtree):O.set(j.pool.id,{subtree:[...j.subtree],pool:j.pool});for(const Y of j.subtree)B.add(Y.id);F+=j.subtree.length}if(!F)break;I=!0}return I?[...O.values()]:null},b0=new Map;for(const b of Xt(e,"sequenceFlow.update")){if(b.target===void 0)continue;const M=P.get(b.target);if(!M)continue;const A=f(b.target),O=f(b.id);if(!A||!O)continue;const B=b.source!==void 0?f(b.source):O.source,I=O.target;if(!B||!I||I.id===A.id)continue;const F=O.waypoints&&O.waypoints.length>=3&&Math.abs(O.waypoints[0].x-O.waypoints[1].x)<1&&Math.abs(O.waypoints[0].y-O.waypoints[1].y)>1?{x:O.waypoints[0].x,y:O.waypoints[0].y}:void 0,j=F?O.waypoints[1].y:void 0,$=F&&O.label?{x:O.label.x,y:O.label.y}:void 0,Y=$&&O.label&&Math.abs($.y+O.label.height/2-j)<=D/5&&$.x+O.label.width>F.x?$.x+O.label.width+6:void 0,ue=(B.outgoing??[]).filter(we=>we.type==="bpmn:SequenceFlow"&&we.id!==O.id&&we.target&&!bu.has(we.id)),xe=new Set(ue.map(we=>we.target.id)),se=we=>{const lt={type:"bpmn:Task",x:we.x+2,y:we.y+2,width:we.width-4,height:we.height-4};return ue.find(Ae=>(Ae.waypoints??[]).some((St,_t)=>!!Ae.waypoints[_t+1]&&Qs(St,Ae.waypoints[_t+1],lt)===0))},me=bo(b.target),ge=new Set(me.map(we=>we.id)),Ce=Math.min(...me.map(we=>we.x)),ht=Math.max(...me.map(we=>we.x+we.width)),De=B.x+B.width,K=A.y+A.height/2,ce=EB(me,De+wi-Ce,[0,B.y+B.height/2-K,I.y+I.height/2-K],I.x,De,B.y+B.height/2),te=De+wi+ce,de=(()=>{if(Y===void 0)return 0;const we=De+wi,lt=B.y+B.height/2-A.height/2,Ae={x:we,y:lt,width:ht-Ce,height:A.height},St=d(B);return((St==null?void 0:St.children)??[]).some(yt=>fr(yt)&&!ge.has(yt.id)&&yt.id!==B.id&&yt.id!==I.id&&yt.type!=="bpmn:Group"&&yt.type!=="bpmn:Participant"&&yt.x<Ae.x+Ae.width&&yt.x+yt.width>Ae.x&&yt.y<Ae.y+Ae.height&&yt.y+yt.height>Ae.y)||se(Ae)?Math.max(0,Y-we):0})(),Ve=ht-Ce+wi*2+ce+de-(I.x-De);let We=[];if(Ve>0){const we=d(A),lt=(we==null?void 0:we.children)??[],Ae=rt=>rt.type==="bpmn:Lane";We=(()=>{const rt=new Set;for(const vt of lt)fr(vt)&&!ge.has(vt.id)&&vt.id!==B.id&&vt.x>=I.x&&rt.add(vt.id);const et=[];for(const vt of lt){if(vt.type!=="bpmn:DataStoreReference"&&vt.type!=="bpmn:DataObjectReference")continue;const Ke=vt,kn=[...Ke.incoming??[],...Ke.outgoing??[]].filter(Yt=>Yt.type==="bpmn:DataInputAssociation"||Yt.type==="bpmn:DataOutputAssociation").map(Yt=>Yt.source===Ke?Yt.target:Yt.source);kn.length&&kn.every(Yt=>Yt!==void 0&&rt.has(Yt.id))&&et.push(Ke)}return et})();const _t=lt.filter(rt=>!("waypoints"in rt&&rt.waypoints)&&!Ae(rt)&&!ge.has(rt.id)&&rt.id!==B.id&&rt.x>=I.x),yt=we?[we,...lt.filter(rt=>Ae(rt))]:[];if(_t.length){const rt=new Set(_t.map(Bt=>Bt.id)),et=v0(rt),vt=et.length?CB(rt,et,we):null,Ke=Bt=>{const je=new Set(rt);for(const mt of Bt)for(const Tt of mt.subtree)je.add(Tt.id);return RB(je)},Ot=Ke(et),kn=vt?Ke(vt):Ot,Yt=rh(rt),Ei=new Set(rt);for(const Bt of et)for(const je of Bt.subtree)Ei.add(je.id);const fh=et.length?rh(Ei):Yt,Ru=(()=>{if(!vt)return[];const Bt=new Set(rt);for(const je of vt)for(const mt of je.subtree)Bt.add(mt.id);return rh(Bt)})();n.createSpace(_t,yt,{x:Ve,y:0},"e",I.x-1);const Is=(Bt,je)=>{const mt=va(),Tt=ks(Bt,Ve);if(!Tt)return!1;const In=je.length?d0(je,Ve):null,dr=va();return dr.messages>mt.messages&&dr.lines>=mt.lines?!0:(In==null||In(),Tt(),!1)},Bs=vt?Is(vt,Ru):!1;let Ns=Bs;!Ns&&et.length&&(Ns=Is(et,fh));const _a=Bs?kn:Ot;if(!Ns){for(const Bt of et){const je=va(),mt=ks([Bt],Ve);if(!mt)continue;const Tt=va();(Tt.messages<=je.messages||Tt.lines<je.lines)&&mt()}if(Yt.length){const Bt=va(),je=d0(Yt,Ve);if(je){const mt=va();(mt.messages<=Bt.messages||mt.lines<Bt.lines)&&je()}}}if(_a.length){const Bt=()=>new Set(bt(Qe(o)).map(mt=>gt(mt))),je=mt=>{const Tt=m0(),In=Bt(),dr=mt.map(ot=>({a:ot,x:ot.x,y:ot.y})),Yr=o.filter(ot=>ot.type==="label").map(ot=>({label:ot,x:ot.x,y:ot.y}));n.moveElements(mt,{x:Ve,y:0});const dh=[...Bt()].filter(ot=>!In.has(ot));if(m0()<Tt&&dh.length===0)return!0;for(const{a:ot,x:ai,y:Ai}of dr)(ot.x!==ai||ot.y!==Ai)&&n.moveElements([ot],{x:ai-ot.x,y:Ai-ot.y});for(const ot of Yr){const ai=ot.x-ot.label.x,Ai=ot.y-ot.label.y;(ai!==0||Ai!==0)&&n.moveElements([ot.label],{x:ai,y:Ai})}return!1};if(!je(_a)&&_a.length>1)for(const mt of _a)je([mt])}}}const Ct=M.node.lane!==void 0?f(M.node.lane):M.node.participant!==void 0?f(M.node.participant):void 0,Ft=we=>{if(!Ct)return!0;const lt=we.y+we.height/2;return lt>=Ct.y&&lt<=Ct.y+Ct.height},he=!Ft(B)&&Ft(I)?I:B,ye=he.y+he.height/2,ie=ye-(A.y+A.height/2),fe=M.band!==void 0,Le=fe?[A]:me,qe=(M.band===void 0||x(M.node.lane,M.node.participant,M.band,ye))&&wt(b.target)&&Le.every(we=>{var lt;return gn((lt=P.get(we.id))==null?void 0:lt.node.lane,we,we.y+we.height/2+ie)}),ke=we=>Math.abs(we.y+we.height/2-(A.y+A.height/2))<=D/2;if(qe&&fe){const we=Math.abs(ie)<=D/2?me.filter(lt=>lt.id!==A.id&&ke(lt)):[];if(n.moveElements(me,{x:te-Ce,y:0}),n.moveElements([A],{x:0,y:ie}),we.length){const lt=()=>new Set(bt(Qe(o)).map(et=>gt(et))),Ae=lt(),St=o.filter(et=>et.type==="label").map(et=>({label:et,x:et.x,y:et.y}));n.moveElements(we,{x:0,y:ie});const _t=lt(),yt=[..._t].filter(et=>!Ae.has(et)).length,rt=[...Ae].filter(et=>!_t.has(et)).length;if(yt>rt){n.moveElements(we,{x:0,y:-ie});for(const et of St){const vt=et.x-et.label.x,Ke=et.y-et.label.y;(vt!==0||Ke!==0)&&n.moveElements([et.label],{x:vt,y:Ke})}}}}else n.moveElements(me,{x:te-Ce,y:qe?ie:0});const He=d(A);if(!qe&&M.node.lane===void 0&&M.band!==void 0&&He){const we=He.y+Q+E(`pool:${M.node.participant??""}`,M.band)*D,lt=we-(A.y+A.height/2);lt!==0&&!X(He,A,A.x+A.width/2,we,ge)&&n.moveElements([A],{x:0,y:lt})}if(He){const we=(He.children??[]).filter(_t=>fr(_t)&&!ge.has(_t.id)&&_t.type!=="bpmn:Group"&&_t.type!=="bpmn:Participant"),lt=(_t,yt,rt,et,vt)=>_t.x+yt<vt.x+vt.width+et&&_t.x+yt+_t.width+et>vt.x&&_t.y+rt<vt.y+vt.height+et&&_t.y+rt+_t.height+et>vt.y,Ae=we.find(_t=>lt(A,0,0,0,_t)),St=Ae?void 0:se(A);if(Ae||St){const _t=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],yt=o.getAll().filter(je=>{if(!_t.includes(je.type))return!1;const mt=je;return bu.has(mt.id)||!mt.waypoints||mt.waypoints.length<2?!1:![mt.source,mt.target].some(Tt=>!Tt||ge.has(Tt.id))}),rt=(je,mt,Tt)=>{var In;return gn((In=P.get(je.id))==null?void 0:In.node.lane,je,je.y+Tt+je.height/2)&&je.x+mt>=He.x&&je.x+mt+je.width<=He.x+He.width&&je.y+Tt>=He.y&&je.y+Tt+je.height<=He.y+He.height},et=(je,mt)=>me.every(Tt=>rt(Tt,je,mt)&&!we.some(In=>lt(Tt,je,mt,ct,In))&&yt.every(In=>{const dr={id:Tt.id,type:Tt.type,x:Tt.x+je,y:Tt.y+mt,width:Tt.width,height:Tt.height};for(let Yr=0;Yr+1<In.waypoints.length;Yr++)if(Qs(In.waypoints[Yr],In.waypoints[Yr+1],dr)<ct)return!1;return!0})),vt=A.y+A.height/2,Ke=[j,I.y+I.height/2].filter(je=>je!==void 0&&Math.abs(je-vt)>=1),Ot=Ae&&xe.has(Ae.id)?Ae:St==null?void 0:St.target,kn=Ot?Ot.x-A.x:0,Yt=Math.max(...me.map(je=>je.x+je.width)),Ei=[...kn!==0?[kn]:[],...ce!==0?[-ce]:[],0],fh=Y===void 0?[]:Ei.map(je=>Math.max(je,Y-A.x)),Ru=je=>Yt+je+wi<=I.x,Is=[...new Set([...fh,...Ei])].filter(Ru),Bs=Ae&&xe.has(Ae.id)?[Ae.x+Ae.width+wi-A.x]:[],Ns=Y===void 0?[]:Bs.map(je=>Math.max(je,Y-A.x)),_a=[...new Set([...Ns,...Bs])].filter(je=>Ru(je)&&!Is.includes(je));let Bt;for(const je of[Is,_a]){for(const mt of Ke){for(const Tt of je)if(et(Tt,mt-vt)){Bt={dx:Tt,dy:mt-vt};break}if(Bt)break}if(Bt)break}if(Bt){const je=ot=>{const ai=ot;return[ai.edge,ai.other,...Array.isArray(ai.edges)?ai.edges:[]].some(Ai=>typeof Ai=="string"&&bu.has(Ai))},mt=()=>new Set(bt(Qe(o)).filter(ot=>!je(ot)).map(ot=>gt(ot))),Tt=mt(),In=o.filter(ot=>ot.type==="label").map(ot=>({label:ot,x:ot.x,y:ot.y}));n.moveElements(me,{x:Bt.dx,y:Bt.dy});const dr=mt(),Yr=[...dr].filter(ot=>!Tt.has(ot)).length,dh=[...Tt].filter(ot=>!dr.has(ot)).length;if(Yr>dh){n.moveElements(me,{x:-Bt.dx,y:-Bt.dy});for(const ot of In){const ai=ot.x-ot.label.x,Ai=ot.y-ot.label.y;(ai!==0||Ai!==0)&&n.moveElements([ot.label],{x:ai,y:Ai})}}else F&&b0.set(O.id,{exit:F,channelY:j,label:$})}}}{const we=new Set(me.map(yt=>yt.id)),lt=new Set(C.map(yt=>yt.flow.id)),Ae=20,St=yt=>{const rt=yt.source,et=yt.target,vt=Math.min(rt.x,et.x)-Ae,Ke=Math.max(rt.x+rt.width,et.x+et.width)+Ae,Ot=Math.min(rt.y,et.y)-Ae,kn=Math.max(rt.y+rt.height,et.y+et.height)+Ae;return yt.waypoints.some(Yt=>Yt.x<vt||Yt.x>Ke||Yt.y<Ot||Yt.y>kn)},_t=new Map;for(const yt of me)for(const rt of[...yt.incoming??[],...yt.outgoing??[]])rt.id!==b.id&&lt.has(rt.id)&&!(we.has(rt.source.id)&&we.has(rt.target.id))&&_t.set(rt.id,rt);for(const yt of _t.values())St(yt)&&Ts(yt)}const Ze=We.length?d(We[0]):void 0;if(Ze){const we={assoc:h0(),overlaps:y0(Ze),crosses:g0()},lt=We.map(Ke=>({st:Ke,x:Ke.x})),Ae=o.filter(Ke=>Ke.type==="label").map(Ke=>({label:Ke,x:Ke.x,y:Ke.y})),St=Math.min(...We.flatMap(Ke=>[...Ke.incoming??[],...Ke.outgoing??[]].filter(Ot=>Ot.type==="bpmn:DataInputAssociation"||Ot.type==="bpmn:DataOutputAssociation").map(Ot=>(Ot.source===Ke?Ot.target:Ot.source).x))),_t=new Set(We.map(Ke=>Ke.id)),yt=(Ze.children??[]).filter(fr).filter(Ke=>!_t.has(Ke.id));let rt=St;for(const Ke of[...We].sort((Ot,kn)=>Ot.x-kn.x)){let Ot=rt;for(let kn=0;kn<100;kn++){const Yt=yt.find(Ei=>Ot<Ei.x+Ei.width+Ui&&Ot+Ke.width+Ui>Ei.x&&Ke.y<Ei.y+Ei.height&&Ke.y+Ke.height>Ei.y);if(!Yt)break;Ot=Yt.x+Yt.width+Ui}Ot!==Ke.x&&n.moveElements([Ke],{x:Ot-Ke.x,y:0}),rt=Ot+Ke.width+Ui}const et=rt+150-(Ze.x+Ze.width);et>0&&xu(Ze,Ze.width+et);const vt={assoc:h0(),overlaps:y0(Ze),crosses:g0()};if(vt.assoc>=we.assoc||vt.overlaps>we.overlaps||vt.crosses>we.crosses){for(const{st:Ke,x:Ot}of lt)Ke.x!==Ot&&n.moveElements([Ke],{x:Ot-Ke.x,y:0});et>0&&xu(Ze,Ze.width-et);for(const Ke of Ae){const Ot=Ke.x-Ke.label.x,kn=Ke.y-Ke.label.y;(Ot!==0||kn!==0)&&n.moveElements([Ke.label],{x:Ot,y:kn})}}}}const x0=(b,M)=>{const A=M.target===b,O=p(M.source),B=p(M.target),I=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,B,M.id?{type:I,businessObject:i.create(I,{id:M.id})}:{type:I})},_0=100,w0=b=>{for(const M of h){if(!M.participant.blackBox)continue;const A=f(M.participant.id);if(!A)continue;const O=[];for(const I of _){const F=I.flow.source===M.participant.id?I.flow.target:I.flow.target===M.participant.id?I.flow.source:void 0,j=F?f(F):void 0;j&&typeof j.x=="number"&&j.type!=="bpmn:Participant"&&O.push(j)}if(!O.length)continue;if(!b&&M.order===void 0){const I=(()=>{var j;const F=new Map;for(const $ of O){const Y=d($);if(!Y)continue;const ue=F.get(Y.id);ue?ue.n+=1:F.set(Y.id,{shape:Y,n:1})}return(j=[...F.values()].sort(($,Y)=>Y.n-$.n)[0])==null?void 0:j.shape})();if(I){const F=Y=>Y.reduce((ue,xe)=>ue+xe,0)/Y.length,j=F(O.map(Y=>Y.y+Y.height/2))<I.y+I.height/2,$=o.filter(Y=>Y.type==="bpmn:Participant"&&Y.id!==M.participant.id&&Y.id!==I.id).filter(Y=>j?Y.y+Y.height<=I.y+5:Y.y>=I.y+I.height-5);if($.length){const Y=[...$.reduce((te,de)=>te.set(de.y,(te.get(de.y)??0)+1),new Map)].sort((te,de)=>de[1]-te[1]||(j?de[0]-te[0]:te[0]-de[0]))[0][0],ue=Math.min(A.width,WS),xe=US,se=O.map(te=>te.x+te.width/2),me=Math.round(F(se)-ue/2),ge=Math.max(...se)+_0,Ce=te=>({x:te,width:Math.max(ue,ge-te)}),ht=$.filter(te=>Math.min(te.y+te.height,Y+xe)-Math.max(te.y,Y)>0),De=te=>{const de=Ce(te);return ht.some(Ve=>Ve.x<de.x+de.width&&de.x<Ve.x+Ve.width)},K=te=>{const de=Ce(te);return se.filter(Ve=>Ve>=de.x+10&&Ve<=de.x+de.width-10).length},ce=(()=>{if(!De(me))return me;const te=K(me);return ht.flatMap(de=>[de.x+de.width+Gm,de.x-Gm-ue]).map(de=>Math.round(de)).filter(de=>!De(de)&&K(de)>=te).sort((de,Ve)=>Math.abs(de-me)-Math.abs(Ve-me))[0]??me})();if(ce!==A.x||Y!==A.y||ue!==A.width||xe!==A.height){const te=()=>new Set(bt(Qe(o)).map(he=>gt(he))),de=te(),Ve={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:ce,y:Y,width:ue,height:xe});const We=te(),Ct=[...We].filter(he=>!de.has(he)).length,Ft=[...de].filter(he=>!We.has(he)).length;Ct>Ft&&n.resizeShape(A,Ve)}}}}const B=Math.max(...O.map(I=>I.x+I.width/2))+_0;if(B>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:B-A.x,height:A.height}),!!b)for(const I of _){const F=f(I.flow.id),j=I.flow.source===M.participant.id?I.flow.target:I.flow.target===M.participant.id?I.flow.source:void 0,$=j?f(j):void 0;if(!F||!$||$.type==="bpmn:Participant")continue;const Y=$.x+$.width/2;if(Y<A.x+10||Y>A.x+A.width-10)continue;const ue=A.y>$.y,xe=ue?$.y+$.height:$.y,se=ue?A.y:A.y+A.height,me=I.flow.source===M.participant.id?[{x:Y,y:se},{x:Y,y:xe}]:[{x:Y,y:xe},{x:Y,y:se}],ge=Qe(o),Ce={...ge.edges.find(ht=>ht.id===I.flow.id),waypoints:me};bn(Ce,ni(ge)).length||n.updateWaypoints(F,me)}}};w0(!1);for(const b of _){const M=b.flow;n.connect(p(M.source),p(M.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:M.id,name:M.name})})}{const A=new Set([...C.map($=>$.flow.id),..._.map($=>$.flow.id)].filter($=>!!$)),O=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,I=new Map,F=($,Y,ue)=>{if(!$||!Y||typeof $.x!="number")return;const xe=B($,Y);if(!xe)return;let se=I.get($.id);se||I.set($.id,se=new Map),se.set(xe,[...se.get(xe)??[],ue])};for(const $ of O){const Y=$.waypoints;!Y||Y.length<2||(F($.source,Y[0],{id:$.id,dir:"out"}),F($.target,Y[Y.length-1],{id:$.id,dir:"in"}))}const j=new Set;for(const[$,Y]of I){const ue=f($);if(!ue||typeof ue.x!="number"||![...Y.values()].some(K=>{const ce=K.filter(te=>te.dir==="in");return K.length>=3&&ce.length>=1&&K.some(te=>te.dir==="out")&&ce.some(te=>A.has(te.id))}))continue;const se=d(ue);if(!se||j.has(se.id)||(se.children??[]).some(K=>K.type==="bpmn:Lane"))continue;const me=(B0=Y.get("T"))!=null&&B0.length?(N0=Y.get("B"))!=null&&N0.length?void 0:"B":"T";if(!me||(me==="T"?ue.y-se.y:se.y+se.height-(ue.y+ue.height))>=D)continue;const Ce=(se.children??[]).filter(K=>!("waypoints"in K&&K.waypoints)&&K.type!=="label"&&typeof K.x=="number"),ht=se.y+se.height;n.resizeShape(se,{x:se.x,y:se.y,width:se.width,height:se.height+D});const De=u().children.filter(K=>!("waypoints"in K&&K.waypoints)&&K.id!==se.id&&typeof K.y=="number"&&K.y>=ht);De.length&&n.moveElements(De,{x:0,y:D}),me==="T"&&Ce.length&&n.moveElements(Ce,{x:0,y:D}),j.add(se.id)}}const oh=20,E0=4,MB=2,AB=[10,30,80],ba=()=>{const b=Qe(o);return{bad:bt(b).filter(M=>M.kind==="edge-crosses-shape"||M.kind==="edge-overlap-opposite"||M.kind==="edge-overlap-mixed").length,crossings:im(b),straight:b.edges.filter(M=>M.type==="bpmn:MessageFlow"&&M.waypoints.length===2).length}},xa=b=>{const M=Qe(o),A=M.edges.find(O=>O.id===b);return A?bn(A,ni(M)).length:0},_u=b=>xa(b)>0,wu=b=>Qe(o).edges.filter(M=>M.type==="bpmn:MessageFlow"&&M.id!==b&&M.waypoints.length===2).length,PB=(b,M,A)=>ks([{subtree:b,pool:M}],A),S0=(b,M)=>M.bad>b.bad||M.crossings>b.crossings&&M.straight<=b.straight&&M.bad>=b.bad,Eu=(b,M)=>S0(b,M)||M.straight<b.straight,Os=(b,M,A=()=>!0,O=S0)=>{const B=ba(),I=ks(b,M);if(!I)return!1;const F=ba();return O(B,F)||!A()?(I(),!1):!0},TB=(b,M,A,O=()=>!0)=>Os([{subtree:b,pool:M}],A,O),xo=b=>{var M;return!!((M=P.get(b))!=null&&M.node.participant)},Ds=new Map;for(const b of _){if(!xo(b.flow.target))continue;const M=Ds.get(b.flow.target)??[];M.push(b),Ds.set(b.flow.target,M)}const Su=[...Ds.keys()],ah=new Set(C.map(b=>b.flow.target)),R0=b=>yn.findIndex(({op:M})=>M.participant.id===b);Su.sort((b,M)=>{var B,I;const A=ah.has(b)?1:0,O=ah.has(M)?1:0;return A!==O?A-O:R0((B=P.get(b))==null?void 0:B.node.participant)-R0((I=P.get(M))==null?void 0:I.node.participant)});const Ur=b=>b.x+b.width/2,kB=b=>{const M=new Map;for(const B of o.getAll()){const I=B;if(!I.waypoints||!I.source||!I.target)continue;(M.get(I.source.id)??M.set(I.source.id,[]).get(I.source.id)).push(I.target.id)}const A=new Set([b]),O=[b];for(let B=0;B<O.length;B++)for(const I of M.get(O[B])??[])A.has(I)||(A.add(I),O.push(I));return A},OB=(b,M)=>{const A=kB(M);let O;for(const B of o.getAll()){const I=B;if(I.type!=="bpmn:MessageFlow"||!I.source||!I.target||I.target.id!==b||A.has(I.source.id))continue;const F=I.source;if(typeof F.x!="number"||F.type==="bpmn:Participant")continue;const j=Ur(F);(O===void 0||j>O)&&(O=j)}return O},sh=(b,M)=>{const A=f(b.flow.source);if(A)return A.type==="bpmn:Participant"?OB(A.id,M):Ur(A)},C0=b=>{let M;for(const A of Ds.get(b)??[]){const O=sh(A,b);O!==void 0&&(!M||O>M.cx)&&(M={op:A,cx:O})}return M==null?void 0:M.op},DB=b=>{const M=C0(b),A=f(b),O=M?sh(M,b):void 0;return A&&O!==void 0?O-Ur(A):void 0},LB=b=>{const M=DB(b);return M!==void 0&&Math.abs(M)<oh},ch=(b,M,A,O,B)=>{var I;for(let F=!0;F;){F=!1;for(const j of _){if(j.flow.id===A)continue;const $=M.has(j.flow.source),Y=M.has(j.flow.target);if($===Y||O($?j.flow.source:j.flow.target))continue;const ue=$?j.flow.target:j.flow.source;if(B(ue)||!xo(ue))continue;const xe=f(j.flow.id);if(!(xe!=null&&xe.waypoints)||xe.waypoints.length!==2)continue;const se=f(ue),me=(I=P.get(ue))==null?void 0:I.node.participant;if(!se||!me)continue;const ge=bo(ue,Ce=>Ce.x>=se.x).filter(Ce=>!M.has(Ce.id));if(!(!ge.length||ge.some(Ce=>B(Ce.id)))){for(const Ce of ge)M.add(Ce.id);b.set(me,[...b.get(me)??[],...ge]),F=!0}}}return[...b].map(([F,j])=>({subtree:j,pool:p(F)}))},M0=(b,M,A,O,B)=>ch(new Map([[M,[...b]]]),new Set(b.map(I=>I.id)),O,I=>I===A,I=>I===B),lh=b=>{const M=C0(b);if(!M)return null;const A=f(b),O=f(M.flow.source),B=sh(M,b);if(!A||!O||B===void 0)return null;const I=B-Ur(A);if(I>=oh){const F=P.get(b).node.participant,j=bo(b,$=>$.x>=A.x);return{groups:M0(j,F,b,M.flow.id,M.flow.source),dx:I}}if(-I>=oh&&xo(M.flow.source)){const F=P.get(M.flow.source).node.participant,j=bo(M.flow.source,$=>$.x>=O.x&&!LB($.id));return{groups:M0(j,F,M.flow.source,M.flow.id,b),dx:-I}}return null},A0=()=>Su.map(b=>({id:b,plan:lh(b)})).filter(b=>!!b.plan).sort((b,M)=>Math.min(...b.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))-Math.min(...M.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))).map(b=>b.id);for(let b=0;b<3;b++){const M=ba(),A=[];for(const B of A0()){const I=lh(B);if(!I)continue;const F=ks(I.groups,I.dx);F&&A.push(F)}if(!A.length)break;if(!Eu(M,ba()))continue;for(const B of A.reverse())B();let O=!1;for(const B of A0()){const I=lh(B);I&&Os(I.groups,I.dx,()=>!0,Eu)&&(O=!0)}if(!O)break}for(const b of Su){if(ah.has(b))continue;const M=P.get(b);if(!M||M.node.lane!==void 0)continue;const A=V(M);if(A===void 0)continue;const O=f(b),B=O?d(O):void 0;if(!O||!B)continue;const I=B.y+Q+E(`pool:${M.node.participant??""}`,A)*D,F=I-(O.y+O.height/2);F!==0&&!X(B,O,O.x+O.width/2,I)&&n.moveElements([O],{x:0,y:F})}for(const b of Su.flatMap(M=>Ds.get(M)??[])){if(!_u(b.flow.id))continue;const M=f(b.flow.target);if(!M)continue;const A=p(P.get(b.flow.target).node.participant),O=bo(b.flow.target,j=>j.x>=M.x),B=M.width+H,I=xa(b.flow.id),F=wu(b.flow.id);for(let j=1;j<=E0;j++){const $=()=>xa(b.flow.id)<I&&wu(b.flow.id)>=F;if(TB(O,A,B*j,$))break}}const uh=_.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),IB=new Set(uh.map(b=>b.id));for(const b of o.filter(M=>M.type==="bpmn:MessageFlow"))IB.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&uh.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of uh){if(!_u(b.id))continue;const M=f(b.source),A=f(b.target);if(!M||!A)continue;let O,B,I;if(b.preexisting){const[j,$]=M.type==="bpmn:Participant"?[A,M]:[M,A];if(O=Ur(j),O<$.x||O>$.x+$.width)continue;[B,I]=j.y<$.y?[j.y+j.height,$.y]:[$.y+$.height,j.y]}else{if(M.type==="bpmn:Participant"||A.type==="bpmn:Participant"||(O=M.x+M.width/2,Math.abs(O-(A.x+A.width/2))>15))continue;[B,I]=M.y<A.y?[M.y+M.height,A.y]:[A.y+A.height,M.y]}const F=[...P.values()].map(j=>f(j.node.id)).filter(j=>!!j&&j.id!==M.id&&j.id!==A.id).filter(j=>j.x<=O&&O<=j.x+j.width&&j.y+j.height>B&&j.y<I).sort((j,$)=>j.x-$.x);for(const j of F){const $=($0=P.get(j.id))==null?void 0:$0.node.participant,Y=$?f($):void 0;if(!$||!Y)continue;const ue=[...P.values()].filter(ce=>ce.node.participant===$).map(ce=>ce.node.id),xe=ce=>ce.map(te=>f(te)).filter(te=>!!te),me=[SB(j.id,ce=>{var te;return((te=P.get(ce.id))==null?void 0:te.node.participant)===$}),xe(ue)].filter(ce=>ce.length).map(ce=>[{subtree:ce,pool:Y}]);if(b.preexisting){const ce=xe(ue);ce.length&&me.push(ch(new Map([[$,[...ce]]]),new Set(ce.map(te=>te.id)),b.id,()=>!1,te=>te===M.id||te===A.id))}const ge=j.width+H,Ce=xa(b.id),ht=wu(b.id),De=()=>xa(b.id)<Ce&&wu(b.id)>=ht;let K=!1;for(const ce of me){for(let te=1;te<=E0;te++)if(Os(ce,ge*te,De)){K=!0;break}if(K)break}if(!_u(b.id))break}}for(const b of _){if(!_u(b.flow.id))continue;const M=f(b.flow.id);if(((F0=M==null?void 0:M.waypoints)==null?void 0:F0.length)!==2)continue;const A=f(b.flow.source),O=f(b.flow.target);if(!A||!O||A.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!xo(b.flow.source)||!xo(b.flow.target)||Math.abs(Ur(A)-Ur(O))>MB)continue;const B=Ur(A),I=M.waypoints.map(Ce=>Ce.y),[F,j]=[Math.min(...I),Math.max(...I)],$=ni(Qe(o)).filter(Ce=>Ce.id!==A.id&&Ce.id!==O.id&&Ce.x<B&&B<Ce.x+Ce.width&&F<Ce.y+Ce.height&&Ce.y<j);if(!$.length)continue;const Y=(j0=P.get(b.flow.source))==null?void 0:j0.node.participant,ue=(H0=P.get(b.flow.target))==null?void 0:H0.node.participant;if(!Y||!ue)continue;const xe=new Map;for(const[Ce,ht,De]of[[b.flow.source,A,Y],[b.flow.target,O,ue]]){const K=xe.get(De)??[],ce=bo(Ce,te=>te.x>=ht.x).filter(te=>!K.some(de=>de.id===te.id));xe.set(De,[...K,...ce])}const se=new Set([...xe.values()].flat().map(Ce=>Ce.id)),me=ch(xe,se,b.flow.id,Ce=>Ce===b.flow.source||Ce===b.flow.target,()=>!1),ge=Math.max(...$.map(Ce=>Ce.x+Ce.width));for(const Ce of AB){const ht=ge+Ce-B;if(ht<=0)continue;if(Os(me,ht,()=>{var K,ce;return xa(b.flow.id)===0&&((ce=(K=f(b.flow.id))==null?void 0:K.waypoints)==null?void 0:ce.length)===2},Eu))break}}{const b=A=>A.y+A.height/2,M=[];for(const A of P.keys()){if(!xo(A))continue;const O=C.filter(F=>F.flow.target===A);if(O.length!==1)continue;const B=f(O[0].flow.source),I=f(A);!B||!I||!P.has(B.id)||Math.abs(b(B)-b(I))>1||I.x-(B.x+B.width)<=H+1||M.push({id:A,pred:B,node:I})}M.sort((A,O)=>A.node.x-O.node.x);for(const{id:A}of M){const O=P.get(A),B=f(A),I=f(C.find(se=>se.flow.target===A).flow.source);if(!B||!I)continue;const F=B.x-(I.x+I.width);if(F<=H+1)continue;const j=p(O.node.participant),$=bo(A,se=>se.x>=B.x),Y=ba(),ue=PB($,j,-(F-H));if(!ue)continue;const xe=ba();(xe.bad>Y.bad||xe.crossings>=Y.crossings||xe.straight<Y.straight)&&ue()}}w0(!0);for(const b of g){const M=b.associations??[],A=M.map(I=>I.source===b.dataStore.id?I.target:I.source).map(f).find(Boolean),O=A?d(A)??u():u(),B=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:Et+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},B,O);for(const I of M)x0(b.dataStore.id,I)}for(const b of v){const A=p(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;x0(A,b.association)}let P0=0;const _o=10,T0=40,BB=(b,M)=>{const A=M.map($=>d($)).filter($=>!!$);for(const $ of A){const Y=_o,ue=$.y,xe=$.y+$.height,se=$.x,me=$.x+$.width;if(Math.abs(b.y-ue)<Y){const ge=ue+Y-b.y;b.y+=ge,b.height-=ge}if(Math.abs(b.y+b.height-xe)<Y&&(b.height=xe-Y-b.y),Math.abs(b.x-se)<Y){const ge=se+Y-b.x;b.x+=ge,b.width-=ge}Math.abs(b.x+b.width-me)<Y&&(b.width=me-Y-b.x)}if(!A.length)return;const O=Math.min(...A.map($=>$.y)),B=Math.max(...A.map($=>$.y+$.height)),I=O-b.y,F=b.y+b.height-B,j=T0-_o;if(I>0!=F>0)if(I>0&&I<j){const $=I+_o;b.y+=$,b.height-=$}else F>0&&F<j&&(b.height-=F+_o)},NB=(b,M)=>{const A=_o,O=30,B=o.filter(I=>I.type==="bpmn:Group"&&I.id!==M);for(const I of B){const F=I.x,j=I.x+I.width,$=I.y,Y=I.y+I.height,ue=b.y<Y&&$<b.y+b.height,xe=b.x<j&&F<b.x+b.width;if(ue){if(Math.abs(b.x-j)<A){const se=Math.min(j+A-b.x,O);se>0&&b.width-se>0&&(b.x+=se,b.width-=se)}if(Math.abs(b.x+b.width-F)<A){const se=Math.min(b.x+b.width-(F-A),O);se>0&&b.width-se>0&&(b.width-=se)}}if(xe){if(Math.abs(b.y-Y)<A){const se=Math.min(Y+A-b.y,O);se>0&&b.height-se>0&&(b.y+=se,b.height-=se)}if(Math.abs(b.y+b.height-$)<A){const se=Math.min(b.y+b.height-($-A),O);se>0&&b.height-se>0&&(b.height-=se)}}}},ph=(b,M)=>{const A=T0,O=Math.min(...b.map($=>$.x))-A,B=Math.min(...b.map($=>$.y))-A,I=Math.max(...b.map($=>$.x+$.width))+A,F=Math.max(...b.map($=>$.y+$.height))+A,j={x:O,y:B,width:I-O,height:F-B};return BB(j,b),NB(j,M),j};for(const b of R){const M=(b.group.members??[]).map(f).filter(B=>!!B);let A;M.length?A=ph(M,b.group.id):(A={x:300+P0*350,y:40,width:300,height:200},P0++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());b.group.name&&n.updateLabel(O,b.group.name),(z0=b.group.members)!=null&&z0.length&&T(O,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=o.filter(B=>!!B.waypoints),M=new Map,A=(B,I)=>{!B||!I||(M.has(B)||M.set(B,new Set),M.get(B).add(I))};for(const B of b){const I=(G0=B.source)==null?void 0:G0.id,F=(V0=B.target)==null?void 0:V0.id;A(I,F),((W0=B.type)!=null&&W0.includes("DataOutputAssociation")||(U0=B.type)!=null&&U0.includes("DataInputAssociation")||B.type==="bpmn:Association")&&A(F,I)}const O=o.filter(B=>B.type==="bpmn:Group");for(const B of O){const F=(((Y0=B.businessObject.extensionElements)==null?void 0:Y0.values)??[]).find(De=>De.$type==="bwl:Members"),j=((F==null?void 0:F.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const $=new Set(j),Y=[...j];for(;Y.length;){const De=Y.shift();for(const K of M.get(De)??[])$.has(K)||($.add(K),Y.push(K))}const ue=B.x,xe=B.x+B.width,se=B.y,me=B.y+B.height,ge=De=>C.filter(K=>K.flow.target===De).length,Ce=De=>{var ce;const K=((ce=f(De))==null?void 0:ce.type)??"";if(K==="bpmn:StartEvent"&&ge(De)===0)return!1;if(K.endsWith("Gateway")){const te=C.filter(de=>de.flow.target===De).map(de=>de.flow.source);if(te.length&&te.every(de=>{var Ve;return((Ve=f(de))==null?void 0:Ve.type)==="bpmn:StartEvent"&&ge(de)===0}))return!1}return!0},ht=o.filter(De=>fr(De)).filter(De=>De.type!=="bpmn:Group"&&De.type!=="bpmn:Participant"&&De.type!=="bpmn:TextAnnotation"&&!$.has(De.id)&&xo(De.id)&&Ce(De.id)&&De.x<xe&&De.x+De.width>ue&&De.y<me&&De.y+De.height>se);if(ht.length)for(const De of[-1,1]){const K=ht.filter(ye=>(ye.x+ye.width-ue<=xe-ye.x?-1:1)===De);if(!K.length)continue;const ce=[];for(const ye of K){const ie=ce.find(fe=>fe.some(Le=>ye.y<Le.y+Le.height&&ye.y+ye.height>Le.y));ie?ie.push(ye):ce.push([ye])}const te=new Map;for(const ye of ce){let ie=De<0?ue-_o:xe+_o;for(const fe of[...ye].sort((Le,qe)=>De<0?qe.x-Le.x:Le.x-qe.x)){const Le=De<0?Math.min(fe.x,ie-fe.width):Math.max(fe.x,ie);ie=De<0?Le-Ui:Le+fe.width+Ui,Le!==fe.x&&Math.sign(Le-fe.x)===De&&te.set(fe.id,Le-fe.x)}}const de=new Map,Ve=ye=>de.get(ye)===ye||!de.get(ye)?ye:Ve(de.get(ye));for(const ye of K)de.set(ye.id,ye.id);for(const ye of _){const ie=te.has(ye.flow.source)?ye.flow.source:void 0,fe=te.has(ye.flow.target)?ye.flow.target:void 0;if(!ie||!fe)continue;const Le=f(ye.flow.id);((q0=Le==null?void 0:Le.waypoints)==null?void 0:q0.length)===2&&de.set(Ve(ie),Ve(fe))}const We=new Map;for(const ye of K){if(!te.has(ye.id))continue;const ie=Ve(ye.id);We.set(ie,[...We.get(ie)??[],ye])}const Ct=[...We.values()].sort((ye,ie)=>De<0?Math.min(...ye.map(fe=>fe.x))-Math.min(...ie.map(fe=>fe.x)):Math.max(...ie.map(fe=>fe.x))-Math.max(...ye.map(fe=>fe.x))),Ft=[];let he=!0;for(const ye of Ct){const ie=ye.map(qe=>te.get(qe.id)??0).reduce((qe,ke)=>Math.abs(ke)>Math.abs(qe)?ke:qe,0),fe=new Map;let Le=!0;for(const qe of ye){const ke=d(qe);if(!ke){Le=!1;break}fe.has(ke.id)||fe.set(ke.id,{subtree:[],pool:ke}),fe.get(ke.id).subtree.push(qe)}Le&&Os([...fe.values()],ie,()=>!0,Eu)?Ft.push({shapes:ye,dx:ie}):he=!1}if(!he)for(const ye of Ft.reverse())n.moveElements(ye.shapes,{x:-ye.dx,y:0})}}}{const b=new Set([...R.map(M=>M.group.id),...Xt(e,"group.update").map(M=>M.id)]);for(const M of o.filter(A=>A.type==="bpmn:Group")){if(b.has(M.id))continue;const O=(((K0=M.businessObject.extensionElements)==null?void 0:K0.values)??[]).find(j=>j.$type==="bwl:Members"),B=((O==null?void 0:O.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<M.x||j.y<M.y||j.x+j.width>M.x+M.width||j.y+j.height>M.y+M.height)||n.resizeShape(M,ph(B,M.id))}}{const M=new Map(Io(Qe(o)).map(j=>[j.owner,j.rect])),A=o.filter(j=>!!j.waypoints),O=new Map,B=(j,$)=>{!j||!$||(O.has(j)||O.set(j,new Set),O.get(j).add($))};for(const j of A){const $=(X0=j.source)==null?void 0:X0.id,Y=(Z0=j.target)==null?void 0:Z0.id;B($,Y),((Q0=j.type)!=null&&Q0.includes("DataOutputAssociation")||(J0=j.type)!=null&&J0.includes("DataInputAssociation")||j.type==="bpmn:Association")&&B(Y,$)}const I=j=>C.filter($=>$.flow.target===j).length,F=j=>{var Y;const $=((Y=f(j))==null?void 0:Y.type)??"";if($==="bpmn:StartEvent"&&I(j)===0)return!1;if($.endsWith("Gateway")){const ue=C.filter(xe=>xe.flow.target===j).map(xe=>xe.flow.source);if(ue.length&&ue.every(xe=>{var se;return((se=f(xe))==null?void 0:se.type)==="bpmn:StartEvent"&&I(xe)===0}))return!1}return!0};for(const j of o.filter($=>$.type==="bpmn:Group")){const Y=(((eE=j.businessObject.extensionElements)==null?void 0:eE.values)??[]).find(ie=>ie.$type==="bwl:Members"),ue=((Y==null?void 0:Y.refs)??"").split(" ").filter(Boolean);if(!ue.length)continue;const xe=ue.map(f).filter(ie=>!!ie);if(!xe.length||!(R.some(ie=>ie.group.id===j.id)||Xt(e,"group.update").some(ie=>ie.id===j.id)||xe.some(ie=>{const fe=m.get(ie.id);return!fe||fe.x!==ie.x||fe.y!==ie.y})))continue;const me=new Set(ue),ge=[...ue];for(;ge.length;){const ie=ge.shift();for(const fe of O.get(ie)??[])me.has(fe)||(me.add(fe),ge.push(fe))}const Ce=j.x,ht=j.x+j.width,De=j.y,K=j.y+j.height,ce=ie=>{const fe=M.get(ie.id),Le={x:ie.x,y:ie.y,width:ie.width,height:ie.height};return fe?[Le,{x:fe.x,y:fe.y,width:fe.width,height:fe.height}]:[Le]},te=xe.flatMap(ce),de=Math.min(...te.map(ie=>ie.x)),Ve=Math.max(...te.map(ie=>ie.x+ie.width)),We=Math.min(...te.map(ie=>ie.y)),Ct=Math.max(...te.map(ie=>ie.y+ie.height)),Ft={L:de-Ce,R:ht-Ve,T:We-De,B:K-Ct},he=o.filter(ie=>fr(ie)).filter(ie=>ie.type!=="bpmn:Group"&&ie.type!=="bpmn:Participant"&&ie.type!=="bpmn:TextAnnotation"&&!me.has(ie.id)&&F(ie.id)&&ie.x<ht&&ie.x+ie.width>Ce&&ie.y<K&&ie.y+ie.height>De);if(!he.length)continue;const ye={L:0,R:0,T:0,B:0};for(const ie of he){const fe=ce(ie),Le=Math.min(...fe.map(Ae=>Ae.x)),qe=Math.max(...fe.map(Ae=>Ae.x+Ae.width)),ke=Math.min(...fe.map(Ae=>Ae.y)),He=Math.max(...fe.map(Ae=>Ae.y+Ae.height)),Ze={L:qe-Ce,R:ht-Le,T:He-De,B:K-ke},we=["L","R","T","B"].filter(Ae=>Ze[Ae]<=Ft[Ae]+.001);if(!we.length)continue;const lt=we.reduce((Ae,St)=>Ze[St]<Ze[Ae]?St:Ae,we[0]);ye[lt]=Math.max(ye[lt],Math.min(Ze[lt]+10,Ft[lt]))}!ye.L&&!ye.R&&!ye.T&&!ye.B||n.resizeShape(j,{x:j.x+ye.L,y:j.y+ye.T,width:j.width-ye.L-ye.R,height:j.height-ye.T-ye.B})}}const k0=b=>{const M=b.waypoints;if(M!=null&&M.length){const O=M[Math.floor((M.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const A=b;return{x:A.x,y:A.y,width:A.width,height:A.height}};let Ls=0;const O0=12,D0=14,$B=15,FB=300,jB=b=>{const M=b.split(`
7
- `),A=Math.max(...M.map(I=>ko(I,O0))),O=Math.max(100,Math.min(FB,Math.ceil(A)+D0)),B=M.reduce((I,F)=>I+Math.max(1,Math.ceil((ko(F,O0)+D0)/O)),0);return{width:O,height:Math.max(30,B*$B+10)}};for(const b of w){const M=b.association,A=((tE=b.placement)==null?void 0:tE.anchor)??(M?M.source===b.annotation.id?M.target:M.source:void 0),O=A?f(A):void 0,B=O?k0(O):void 0,I=jB(b.annotation.text??"");let F;if(B&&b.placement){const[ue,xe]=cc[b.placement.side],se=b.placement.offset??50;F={x:B.x+B.width/2+ue*(B.width/2+I.width/2+se),y:B.y+B.height/2+xe*(B.height/2+I.height/2+se)}}else B?(F={x:B.x+B.width/2+180+Ls%3*260,y:B.y-110-Ls%2*95},Ls++):(F={x:300+Ls*260,y:60},Ls++);const j=O?d(O)??u():u(),$=j;B&&typeof $.x=="number"&&typeof $.width=="number"&&$.type==="bpmn:Participant"&&(F=op(o,B,I,$,b.placement?{placement:b.placement}:{from:F}));const Y=n.createShape({type:"bpmn:TextAnnotation",width:I.width,height:I.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},F,j);if(M){const ue=xe=>xe===b.annotation.id?Y:p(xe);n.connect(ue(M.source),ue(M.target),M.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:M.id})}:{type:"bpmn:Association"})}b.placement&&T(Y,"bwl:Placement",N(b.placement))}for(const b of Xt(e,"association.add")){const M=b.association;n.connect(p(M.source),p(M.target),M.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:M.id})}:{type:"bpmn:Association"})}for(const b of Xt(e,"node.update")){let M=p(b.id);if(b.type&&sc(b.type)!==M.type&&(M=c.replaceElement(M,{type:sc(b.type)})),b.name!==void 0&&n.updateProperties(M,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(M,{"bwl:band":b.band});const A=M.y+M.height/2,O=d(M),B=b.lane?p(b.lane):((O==null?void 0:O.children)??[]).find(F=>F.type==="bpmn:Lane"&&A>=F.y&&A<=F.y+F.height);b.band!==void 0&&dt(B==null?void 0:B.id,b.band,O);const I=B?B.y+(b.band===void 0?B.height/2:Math.min(B.height/2,pe)+E(B.id,b.band)*D):b.band!==void 0&&O?O.y+Q+E(`pool:${O.id}`,b.band)*D:void 0;if(I!==void 0){const F=I-A;F!==0&&n.moveElements([M],{x:0,y:F})}}}for(const b of Xt(e,"sequenceFlow.update")){const M=p(b.id);if(b.source!==void 0||b.target!==void 0){const A=M,O=b.source!==void 0?p(b.source):A.source,B=b.target!==void 0?p(b.target):A.target,I=$=>({x:$.x+$.width/2,y:$.y+$.height/2});n.reconnect(A,O,B,[I(O),I(B)]);const F=b0.get(A.id),j=B.y+B.height/2;if(F&&B.x>F.exit.x&&Math.abs(j-F.exit.y)>1){n.updateWaypoints(A,[F.exit,{x:F.exit.x,y:j},{x:B.x,y:j}]);const $=A.label;if($&&F.label){const ue=Math.abs(F.label.y+$.height/2-F.channelY)<=D/5&&F.label.x+$.width>F.exit.x,xe=F.exit.x+6,se=B.x-6-$.width,me=ue?se>=xe?{x:Math.max(xe,Math.min(F.label.x,se)),y:F.label.y+(j-F.channelY)}:void 0:F.label;me&&(me.x!==$.x||me.y!==$.y)&&n.moveElements([$],{x:me.x-$.x,y:me.y-$.y})}}else Math.abs(j-(O.y+O.height/2))>1&&Ts(A)}b.name!==void 0&&n.updateProperties(M,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(M,{name:((nE=b.condition)==null?void 0:nE.label)??void 0})}for(const b of Xt(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(p(b.id),{name:b.name??void 0});for(const b of Xt(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(p(b.id),{name:b.name??void 0});for(const b of Xt(e,"annotation.update")){const M=p(b.id);if(b.text!==void 0&&n.updateProperties(M,{text:b.text}),b.placement===null)T(M,"bwl:Placement",null);else if(b.placement){const A=p(b.placement.anchor),O=k0(A),B=d(A)??u(),I=typeof B.x=="number"&&typeof B.width=="number"&&B.type==="bpmn:Participant",[F,j]=cc[b.placement.side],$=b.placement.offset??50,Y={x:O.x+O.width/2+F*(O.width/2+M.width/2+$),y:O.y+O.height/2+j*(O.height/2+M.height/2+$)},ue=I?op(o,O,{width:M.width,height:M.height},B,{placement:b.placement,selfId:b.id}):Y;n.moveElements([M],{x:ue.x-(M.x+M.width/2),y:ue.y-(M.y+M.height/2)}),T(M,"bwl:Placement",N(b.placement))}}for(const b of Xt(e,"group.update")){const M=p(b.id);if(b.name!==void 0&&n.updateLabel(M,b.name??""),b.members){const A=b.members.map(f).filter(O=>!!O);A.length&&n.resizeShape(M,ph(A,b.id)),T(M,"bwl:Members",{refs:b.members.join(" ")})}}}function ap(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 qS(e,t,n){var u,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>bt(p).filter(d=>!t.has(gt(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Qe(i),c=o(s),l=[...new Set(c.flatMap(ap))].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 pe=d.x+d.width/2,Me=d.y+d.height/2;h=i.getAll().find(Be=>{if(Be.type!=="bpmn:Participant")return!1;const it=Be;return typeof it.x=="number"&&typeof it.width=="number"&&pe>=it.x&&pe<=it.x+it.width&&Me>=it.y&&Me<=it.y+it.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const C=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(pe=>pe.$type==="bwl:Placement"),_=[...d.incoming??[],...d.outgoing??[]].find(pe=>pe.type==="bpmn:Association"),g=(C!=null&&C.anchor?i.get(C.anchor):void 0)??(_?((f=_.source)==null?void 0:f.id)===p?_.target:_.source:void 0);if(!g)continue;const v=g.waypoints,w=v!=null&&v.length?{x:v[Math.floor((v.length-1)/2)].x,y:v[Math.floor((v.length-1)/2)].y,width:0,height:0}:{x:g.x,y:g.y,width:g.width,height:g.height},R={width:d.width,height:d.height},P={x:d.x+d.width/2,y:d.y+d.height/2},T=C==null?void 0:C.side,N=[];T&&T in cc&&N.push(op(i,w,R,h,{placement:{side:T,offset:(C==null?void 0:C.offset)??null},selfId:p}));for(const[pe,Me]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Be=1;Be<=YS;Be++)N.push({x:P.x+pe*Vm*Be,y:P.y+Me*Vm*Be});const k={...s,edges:s.edges.filter(pe=>pe.id!==(_==null?void 0:_.id))},D=o(k),H=D.filter(pe=>ap(pe).includes(p)).length;if(!H)continue;let Q;for(const pe of N){const Me=pe.x-P.x,Be=pe.y-P.y;if(!Me&&!Be||pe.x-R.width/2<h.x||pe.x+R.width/2>h.x+h.width||pe.y-R.height/2<h.y||pe.y+R.height/2>h.y+h.height)continue;const it={...k,shapes:k.shapes.map(ve=>ve.id===p?{...ve,x:ve.x+Me,y:ve.y+Be}:ve)},X=o(it),J=X.filter(ve=>ap(ve).includes(p)).length;if(J>=H||X.length>D.length)continue;const le=Math.abs(Me)+Math.abs(Be);if((!Q||J<Q.mine||J===Q.mine&&(X.length<Q.all||X.length===Q.all&&le<Q.dist))&&(Q={x:pe.x,y:pe.y,mine:J,all:X.length,dist:le}),Q.mine===0&&Q.all<D.length)break}Q&&r.moveElements([d],{x:Q.x-P.x,y:Q.y-P.y})}}const KS=60;function sp(e,t,n,i){const r=t.x+t.width,o=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(o.push(l),a(l))};a(t),e.resizeShape(t,{x:t.x,y:t.y,width:n,height:t.height},void 0,i);const s=t.x+n;for(const c of o)Math.abs(c.x+c.width-r)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function XS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>bt(u).filter(f=>!t.has(gt(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 C of n.shapes)C.type!=="bpmn:Group"||p.has(C.id)||[...d].some(_=>{const g=s.get(_);return g&&c(C,g)})&&(p.add(C.id),y=!0);for(const C of n.shapes)C.type!=="bpmn:Participant"||d.has(C.id)||[...p].some(_=>{const g=s.get(_);return g&&c(g,C)})&&(d.add(C.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 C=s.get(y);return C&&c(C,h)})).map(h=>h.id);return[...d,...p,...m]};for(let u=0;u<6;u++){const f=Qe(i),p=o(f),d=a(p);if(!d.length)return;const m=new Map(f.shapes.map(v=>[v.id,v]));let h=null;for(const v of d){if(v.kind!=="pool-overlap")continue;const[w,R]=v.pools,P=m.get(w),T=m.get(R);if(!P||!T)continue;const[N,k]=P.x<=T.x?[P,T]:[T,P];if(v.contained)continue;const D=s.get(N.id),H=s.get(k.id),Q=D&&H?Math.max(H.x-(D.x+D.width),0):KS,pe=N.x+N.width+Q-k.x;if(pe<=0)continue;const Me=l(k.id).filter(Be=>i.get(Be));Me.length&&(!h||pe>h.dx)&&(h={movers:Me,dx:pe})}if(!h)return;const y=h.movers.map(v=>i.get(v)).filter(v=>!!v&&typeof v.x=="number");if(!y.length)return;const C=p.length,_=d.length;r.moveElements(y,{x:h.dx,y:0});const g=o(Qe(i));if(!(a(g).length<_&&g.length<=C)){r.moveElements(y,{x:-h.dx,y:0});return}}}const lc=.5,Um=150;function ZS(e,t){const{elementRegistry:n}=e,i=e.modeling,r=t.shapes.filter(g=>g.type==="bpmn:Participant");if(r.length<2)return;const o=r.map(g=>g.x+g.width),a=Math.max(...o);if(a-Math.min(...o)>lc)return;const s=r.map(g=>n.get(g.id)).filter(g=>!!g&&typeof g.x=="number");if(s.length<2)return;const c=new Map(r.map(g=>[g.id,g.x]));if(s.some(g=>Math.abs(g.x-c.get(g.id))>lc))return;const l=s.map(g=>g.x+g.width);if(Math.max(...l)-Math.min(...l)<=lc)return;const u=g=>g.x+g.width,f=g=>!!g&&typeof g.width=="number",p=g=>{const v={shapes:[],edges:[],lanes:[]},w=R=>{for(const P of R.children??[]){if("waypoints"in P&&P.waypoints){v.edges.push(P);continue}P.type!=="label"&&(P.type==="bpmn:Lane"?v.lanes.push(P):v.shapes.push(P),w(P))}};return w(g),v},d=new Map(s.map(g=>[g.id,p(g)]));let m=a;for(const g of s){const{shapes:v}=d.get(g.id),w=v.flatMap(R=>[u(R),...f(R.label)?[u(R.label)]:[]]);w.length&&(m=Math.max(m,Math.max(...w)+Um))}const h=s.filter(g=>Math.abs(u(g)-m)>lc);if(!h.length)return;for(const g of h){const v=u(g),{shapes:w,edges:R,lanes:P}=d.get(g.id);if([...w.flatMap(k=>[u(k),...f(k.label)?[u(k.label)]:[]]),...R.flatMap(k=>[...k.waypoints.map(D=>D.x),...f(k.label)?[u(k.label)]:[]])].some(k=>k>m)||[...(g.incoming??[]).map(k=>k.waypoints[k.waypoints.length-1]),...(g.outgoing??[]).map(k=>k.waypoints[0])].some(k=>!k||k.x>m||Math.abs(k.x-v)<1))return;if(m>v){const k={x:v,y:g.y,width:m-v,height:g.height},D=new Set([g.id,...w.map(Q=>Q.id),...R.map(Q=>Q.id),...P.map(Q=>Q.id)]);if(n.getAll().some(Q=>{var Be;if("waypoints"in Q&&Q.waypoints||Q.type==="bpmn:Group"||!f(Q))return!1;const pe=Q.type==="label"?(Be=Q.labelTarget)==null?void 0:Be.id:Q.id;if(!pe||D.has(pe)||D.has(Q.id))return!1;const Me=Q;return Me.x<k.x+k.width&&Me.x+Me.width>k.x&&Me.y<k.y+k.height&&Me.y+Me.height>k.y}))return}}const y=()=>new Set(bt(Qe(n)).map(gt)),C=y(),_=h.map(g=>g.width);for(const g of h)sp(i,g,m-g.x,{layout:!1});[...y()].every(g=>C.has(g))||h.forEach((g,v)=>sp(i,g,_[v],{layout:!1}))}function QS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>bt(l).filter(u=>!t.has(gt(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(R=>R.id!==l.id&&R.type!=="bpmn:Group"&&a(l,R));if(!f.length)continue;const p=f.map(R=>i.get(R.id)).filter(R=>!!R&&typeof R.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),C=m.r+(l.x+l.width-d.r),_=m.b+(l.y+l.height-d.b),g={x:h,y,width:C-h,height:_-y};if(g.width<=0||g.height<=0||Math.abs(g.x-u.x)<1&&Math.abs(g.y-u.y)<1&&Math.abs(g.width-u.width)<1&&Math.abs(g.height-u.height)<1)continue;const v=o(Qe(i)).length,w={x:u.x,y:u.y,width:u.width,height:u.height};r.resizeShape(u,g),o(Qe(i)).length>v&&r.resizeShape(u,w)}}const uc=20,pc=10;function JS(e,t,n,i){var f,p;const{elementRegistry:r}=e,o=e.modeling,a=d=>new Set(bt(d,{includeObservationOnly:!0}).filter(m=>m.kind==="edge-along-group-boundary").map(gt)),s=Qe(r),c=bt(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(gt(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,m]of u){const h=s.shapes.find(Pe=>Pe.id===d);if(!((f=h==null?void 0:h.members)!=null&&f.length))continue;const y=l.get(d);if(!(!y||Math.abs(y.x-h.x)>=.5||Math.abs(y.y-h.y)>=.5||Math.abs(y.width-h.width)>=.5||Math.abs(y.height-h.height)>=.5))continue;const _=h.members.map(Pe=>r.get(Pe)).filter(Pe=>!!Pe&&typeof Pe.x=="number");if(!_.length)continue;const g=Math.min(..._.map(Pe=>Pe.x)),v=Math.min(..._.map(Pe=>Pe.y)),w=Math.max(..._.map(Pe=>Pe.x+Pe.width)),R=Math.max(..._.map(Pe=>Pe.y+Pe.height)),P=h.x,T=h.y,N=h.x+h.width,k=h.y+h.height;let D=P,H=T,Q=N,pe=k;for(const Pe of m){const L=s.edges.find(x=>x.id===Pe.edge);if(!L)continue;const E=L.endpoints.some(x=>{const G=s.shapes.find(Re=>Re.id===x);if(!G||G.container)return!1;const U=G.x+G.width/2,Z=G.y+G.height/2;return P<U&&U<N&&T<Z&&Z<k});for(const x of vn(L)){const G=x.axis==="v"?[T,k]:[P,N];Math.min(x.hi,G[1])-Math.max(x.lo,G[0])<Wu||(x.axis==="v"?P<x.at&&x.at<N:T<x.at&&x.at<k)&&E||(x.axis==="v"?(Math.abs(x.at-P)<=Oo&&(D=Math.max(D,x.at+uc)),Math.abs(x.at-N)<=Oo&&(Q=Math.min(Q,x.at-uc))):(Math.abs(x.at-T)<=Oo&&(H=Math.max(H,x.at+uc)),Math.abs(x.at-k)<=Oo&&(pe=Math.min(pe,x.at-uc))))}}if(D>g-pc&&(D=P),H>v-pc&&(H=T),Q<w+pc&&(Q=N),pe<R+pc&&(pe=k),D===P&&H===T&&Q===N&&pe===k)continue;const Me=r.get(d),Be={x:Me.x,y:Me.y,width:Me.width,height:Me.height},it=Qe(r),X=new Set(bt(it).map(gt)),J=a(it);o.resizeShape(Me,{x:D,y:H,width:Q-D,height:pe-H});let le=Qe(r),ve=bt(le).filter(Pe=>!X.has(gt(Pe)));const q=[];if(ve.length>0&&ve.every(Pe=>Pe.kind==="label-over-line"&&!i.has(Pe.edge)&&le.edges.some(L=>L.id===Pe.edge))){for(const Pe of ve){if(Pe.kind!=="label-over-line")continue;const L=le.edges.find(Z=>Z.id===Pe.edge),E=L&&ip(L,le),x=(p=r.get(Pe.edge))==null?void 0:p.label;if(!E||!x)continue;const G=E.x-x.x,U=E.y-x.y;o.moveElements([x],{x:G,y:U}),q.push({label:x,dx:G,dy:U})}le=Qe(r),ve=bt(le).filter(Pe=>!X.has(gt(Pe)))}const ne=a(le),Te=[...ne].some(Pe=>!J.has(Pe));if(ve.length||Te||ne.size>=J.size){for(const Pe of q.reverse())o.moveElements([Pe.label],{x:-Pe.dx,y:-Pe.dy});o.resizeShape(Me,Be)}}}function Ym(e,t,n=Wm){var g,v;const i=zm(e),r=Hm(t,hm(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=Qe(i.elementRegistry),s=new Set(bt(a).map(gt)),c=new Set(bt(a,{includeObservationOnly:!0}).map(gt)),l=new Set(a.edges.map(w=>w.id)),u=new Set(a.shapes.map(w=>w.id)),f=Js(a),p=f.length,d=new Set(f.map(([w,R])=>`${w}|${R}`)),m=new Map;for(const w of i.elementRegistry.filter(R=>"waypoints"in R&&!!R.waypoints))w.label&&m.set(w.id,{wps:w.waypoints.map(R=>({x:R.x,y:R.y})),label:{x:w.label.x,y:w.label.y},source:(g=w.source)==null?void 0:g.id,target:(v=w.target)==null?void 0:v.id});const h=e.get("commandStack");try{bh(h,()=>{n(t,i),XS(i,s,a),ZS(i,a),QS(i,s,a),_m(i,l);const w=Ju(i,s);vm(i,d,l),km(i,s,l),Sm(i,l),DS(i,l),Mm(i,s,l),NS(i,s,l),Im(i,s,l),Lm(i,l),Nm(i,u),qS(i,s,u),Ju(i,s,w),JS(i,c,a,l),$m(i,s),Dm(i,m)})}catch(w){return{ok:!1,issues:[{kind:"lower-failed",message:w instanceof Error?w.message:String(w)}],findings:[],stats:o}}const y=Qe(i.elementRegistry),C=bt(y,{includeObservationOnly:!0}).filter(w=>!c.has(gt(w))),_=rm(y);return{ok:!0,issues:[],findings:C,stats:{edgeCrossings:{before:p,after:_.pairs.length,pairs:_.pairs,solidPairs:_.solidPairs,dashedPairs:_.dashedPairs,mixedPairs:_.mixedPairs,crossPoolMessages:_.crossPoolMessages}}}}function eR(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function qm(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Km(e,t){const n=qm(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Xm(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function tR(e){return typeof e=="string"&&Mu.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 Zm(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=[],C=[],_=new Set,g=new Set,v=X=>{X&&_.add(X)},w=X=>{_.add(X),g.add(X)},R=X=>{const J=Xm(X,"bwl:Placement");if(!J)return;const le=typeof J.anchor=="string"?J.anchor:void 0;if(!le||!tR(J.side))return;const ve=typeof J.offset=="number"?J.offset:void 0;h.push({owner:X.id,anchor:le,side:J.side,...ve!==void 0?{offset:ve}:{}})},P=X=>{const J=Xm(X,"bwl:Members"),le=typeof(J==null?void 0:J.refs)=="string"?J.refs.split(/\s+/).filter(Boolean):[];le.length&&C.push({owner:X.id,refs:le})},T=X=>{var J;for(const le of X)switch(v(le.id),le.$type){case"bpmn:TextAnnotation":w(le.id),s.push({id:le.id,text:typeof le.text=="string"?le.text:""}),R(le);break;case"bpmn:Association":d.push({id:le.id,type:le.$type,source:Ri(le.sourceRef),target:Ri(le.targetRef)});break;case"bpmn:Group":{w(le.id);const ve=(J=le.categoryValueRef)==null?void 0:J.value;c.push({id:le.id,...typeof ve=="string"&&ve?{name:ve}:{}}),P(le);break}default:l.push({id:le.id,type:le.$type,reason:"type-outside-mvp"})}},N=X=>{for(const J of X.flowElements??[])v(J.id),l.push({id:J.id,type:J.$type,reason:"inside-container"}),(J.flowElements??[]).length&&N(J);for(const J of X.artifacts??[])v(J.id),l.push({id:J.id,type:J.$type,reason:"inside-container"})},k=(X,J)=>{const le=X.flowElements??[],ve=(X.laneSets??[]).flatMap(V=>V.lanes??[]),q=new Map;for(const V of ve){v(V.id);for(const ne of V.flowNodeRef??[]){const Te=Ri(ne);Te&&q.set(Te,V.id)}}for(const V of le){if(v(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"){w(V.id),a.push({id:V.id,...V.name?{name:V.name}:{}});continue}const ne=eR(V.$type);if(!hh(ne)){l.push({id:V.id,type:V.$type,reason:"type-outside-mvp"});continue}w(V.id);const Te=ne==="boundaryEvent"?Ri(V.attachedToRef):void 0;o.push({id:V.id,type:ne,...V.name?{name:V.name}:{},...J?{participant:J}:{},...q.has(V.id)?{lane:q.get(V.id)}:{},...Te?{attachedTo:Te}:{}}),ne==="subProcess"&&N(V);const Pe=Km(V,"bwl:band");Pe!==void 0&&(u.bands[V.id]=Pe);const L=qm(V,"bwl:afterColumn");typeof L=="string"&&L!==""&&y.push([V.id,L]);for(const E of V.dataOutputAssociations??[])v(E.id),m.push({id:E.id,type:E.$type,source:V.id,target:Ri(E.targetRef)});for(const E of V.dataInputAssociations??[])v(E.id),m.push({id:E.id,type:E.$type,source:Ri((E.sourceRef??[])[0]),target:V.id})}T(X.artifacts??[])};if(n){const X=new Set;for(const J of n.participants??[]){w(J.id);const le=Ri(J.processRef);le&&X.add(le);const ve=le?i.get(le):void 0,q=((ve==null?void 0:ve.laneSets)??[]).flatMap(Pe=>Pe.lanes??[]),V=q.map(Pe=>({id:Pe.id,...Pe.name?{name:Pe.name}:{}}));for(const Pe of V)w(Pe.id);const ne=!ve||(ve.flowElements??[]).length===0&&q.length===0&&(ve.artifacts??[]).length===0;r.push({id:J.id,...J.name?{name:J.name}:{},...ne?{blackBox:!0}:{},...V.length?{lanes:V}:{}});const Te=Km(J,"bwl:poolOrder");Te!==void 0&&(u.poolOrders[J.id]=Te),ve&&k(ve,J.id)}for(const J of n.messageFlows??[])v(J.id),p.push({id:J.id,source:Ri(J.sourceRef),target:Ri(J.targetRef),...typeof J.name=="string"&&J.name?{name:J.name}:{}});T(n.artifacts??[]);for(const[J,le]of i)!X.has(J)&&(le.flowElements??[]).length>0&&l.push({id:J,type:le.$type,reason:"unreachable-process"})}else for(const X of i.values())k(X);const D=[],H=[],Q=[],pe=[],Me=(X,J)=>!!X&&!!J&&g.has(X)&&g.has(J);for(const X of f){if(!Me(X.source,X.target)){l.push({id:X.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}D.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),g.add(X.id)}for(const X of p){if(!Me(X.source,X.target)){l.push({id:X.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}H.push({id:X.id,source:X.source,target:X.target,...X.name?{name:X.name}:{}}),g.add(X.id)}for(const X of m){if(!Me(X.source,X.target)){l.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}pe.push({...X.id?{id:X.id}:{},source:X.source,target:X.target}),X.id&&g.add(X.id)}for(const X of d){if(!Me(X.source,X.target)){l.push({id:X.id??"",type:X.type,reason:"endpoint-outside-mvp"});continue}Q.push({...X.id?{id:X.id}:{},source:X.source,target:X.target})}const Be=new Map(c.map(X=>[X.id,X]));for(const{owner:X,refs:J}of C){const le=J.filter(q=>_.has(q)),ve=Be.get(X);ve&&le.length&&(ve.members=le)}for(const X of h)_.has(X.anchor)&&(u.placements[X.owner]={anchor:X.anchor,side:X.side,...X.offset!==void 0?{offset:X.offset}:{}});for(const[X,J]of y)_.has(J)&&(u.afterColumns[X]=J);return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:D,...H.length?{messageFlows:H}:{},...a.length?{dataStores:a}:{},...pe.length?{dataAssociations:pe}:{},...s.length?{annotations:s}:{},...Q.length?{associations:Q}:{},...c.length?{groups:c}:{}},hints:u,omitted:l}}async function nR(e){const{definitions:t,warnings:n}=await Po(e);return{...Zm(t),warnings:n}}const iR=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function cp(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function rR(e){return cp(e.processRef)!==void 0}function oR(e){const t=new Set,n=r=>{const o=cp(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 aR(e){const t=[],n=i=>{for(const r of i.flowElements??[])iR.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 sR(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 lp(e){const t=[],n=e.rootElements??[],i=oR(e);for(const o of aR(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??[])rR(s)&&sR(o.get(cp(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 cR(e){const{definitions:t,warnings:n}=await Po(e);return{issues:lp(t),warnings:n}}const lR=.5,uR=8,pR=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),fc=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function fR(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}=${fc(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=>`${fc(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(fc).sort().join(",")}]`);const r=t.conditionExpression;return r&&typeof r.body=="string"&&n.push(`cond=${r.body}`),n.join("|")}function dR(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=fc(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 Qm(e){const t=dR(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:")&&!pR.has(s)&&n.set(c,{type:s,props:fR(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 Jm(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 eg(e,t,n={}){const i=n.moveTolerance??lR,r=Qm(e),o=Qm(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||Jm(f.geometry,u.geometry,i)||Jm(f.label,u.label,n.labelTolerance??uR))&&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 hR(e,t,n={}){const[i,r]=await Promise.all([Po(e),Po(t)]);return{...eg(i.definitions,r.definitions,n),warnings:[...i.warnings,...r.warnings]}}function mR(e){return new Set([...e.added,...e.modified])}function gR(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function tg(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Ym(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 yR=Symbol("bpmn-editor"),up={geometry:[],semantic:[]};function vR(){const e=be.ref(!1),t=be.ref(!0),n=be.ref(!1),i=be.shallowRef(up),r=be.shallowRef(void 0);let o,a;const s=()=>{if(!o){i.value=up;return}const p=bt(Qe(o.get("elementRegistry")),{includeObservationOnly:!0}),d=o.getDefinitions();i.value={geometry:p,semantic:d?lp(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=up,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 tg(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:Vu(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 Ee(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function bR(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pp={exports:{}},ng;function xR(){if(ng)return pp.exports;ng=1;var e=pp.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},pp.exports}var _R=xR(),wR=bR(_R);function Di(e){if(!(this instanceof Di))return new Di(e);e=e||[128,36,1],this._seed=e.length?wR.rack(e[0],e[1],e[2]):e}Di.prototype.next=function(e){return this._seed(e||!0)},Di.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Di.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Di.prototype.assigned=function(e){return this._seed.get(e)||!1},Di.prototype.unclaim=function(e){delete this._seed.hats[e]},Di.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 Lt(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 ER(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 Dn(e,...t){const n=e.style;return z(t,function(i){i&&z(i,function(r,o){n[o]=r})}),e}function An(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const SR=Object.prototype.toString;function $t(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 SR.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 dc(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 hc={},ig;function CR(){if(ig)return hc;ig=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return hc.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},hc.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},hc}var rg=CR(),MR=RR(rg),Ge=ER({__proto__:null,default:MR},[rg]),og=["focus","blur"];function AR(e,t,n,i,r){return og.indexOf(n)!==-1&&(r=!0),Ge.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 og.indexOf(t)!==-1&&(i=!0),Ge.unbind(e,t,n,i)}var Gn={bind:AR,unbind:PR};function fp(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Rt(e,t){return t=t||document,t.querySelector(e)}function mc(e,t){return t=t||document,t.querySelectorAll(e)}function Li(e){e.parentNode&&e.parentNode.removeChild(e)}function TR(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function kR(e,t){return t.appendChild(TR(e,t))}function Ue(e,t){return kR(t,e),e}var dp=2,ag={"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":dp,"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":dp,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function OR(e,t){return ag[t]?e.style[t]:e.getAttributeNS(null,t)}function sg(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=ag[i];r?(r===dp&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function DR(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)sg(e,r,t[r])}function Se(e,t,n){if(typeof t=="string")if(n!==void 0)sg(e,t,n);else return OR(e,t);else DR(e,t);return e}const LR=Object.prototype.toString;function ut(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 LR.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 gc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function cg(e){return e.cloneNode(!0)}var hp={svg:"http://www.w3.org/2000/svg"},lg='<svg xmlns="'+hp.svg+'"';function IR(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(hp.svg)===-1&&(e=lg+e.substring(4)):(e=lg+">"+e+"</svg>",t=!0);var n=BR(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function BR(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Oe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=IR(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(hp.svg,e),t&&Se(n,t),n}var mp=null;function ug(){return mp===null&&(mp=Oe("svg")),mp}function pg(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function NR(e,t,n,i,r,o){var a=ug().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return pg(a,e);case 6:return pg(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Pa(e){return ug().createSVGTransform()}var fg=/([&<>]{1})/g,$R=/([&<>\n\r"]{1})/g,FR={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function gp(e,t){function n(i,r){return FR[r]||r}return e.replace(t,n)}function dg(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(gp(e.textContent,fg));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,'="',gp(o.value,$R),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)dg(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",gp(e.nodeValue,fg),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function jR(e){for(var t=e.firstChild,n=[];t;)dg(t,n),t=t.nextSibling;return n.join("")}function hg(e,t){return jR(e)}function an(e){var t=e.parentNode;return t&&t.removeChild(e),e}function HR(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function zR(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(HR(e,i))}function Ta(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),zR(n,t)),n.consolidate()}const GR=/^class[ {]/;function VR(e){return GR.test(e.toString())}function yp(e){return Array.isArray(e)}function vp(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function yc(...e){e.length===1&&yp(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const WR=/constructor\s*[^(]*\(\s*([^)]*)\)/m,UR=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,YR=/\/\*([^*]*)\*\//m;function qR(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(VR(e)?WR:UR);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(YR);return(r&&r[1]||i).trim()})||[]}function mg(e,t){const n=t||{get:function(g,v){if(i.push(g),v===!1)return null;throw s(`No provider for "${g}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(g){const v=i.join(" -> ");return i.length=0,new Error(v?`${g} (Resolving: ${v})`:g)};function c(g,v){if(!r[g]&&g.includes(".")){const w=g.split(".");let R=c(w.shift());for(;w.length;)R=R[w.shift()];return R}if(vp(o,g))return o[g];if(vp(r,g)){if(i.indexOf(g)!==-1)throw i.push(g),s("Cannot resolve circular dependency!");return i.push(g),o[g]=r[g][0](r[g][1]),i.pop(),o[g]}return n.get(g,v)}function l(g,v){if(typeof v>"u"&&(v={}),typeof g!="function")if(yp(g))g=yc(g.slice());else throw s(`Cannot invoke "${g}". Expected a function!`);const R=(g.$inject||qR(g)).map(P=>vp(v,P)?v[P]:c(P));return{fn:g,dependencies:R}}function u(g){const{fn:v,dependencies:w}=l(g),R=Function.prototype.bind.call(v,null,...w);return new R}function f(g,v,w){const{fn:R,dependencies:P}=l(g,w);return R.apply(v,P)}function p(g){return yc(v=>g.get(v))}function d(g,v){if(v&&v.length){const w=Object.create(null),R=Object.create(null),P=[],T=[],N=[];let k,D,H,Q;for(let pe in r)k=r[pe],v.indexOf(pe)!==-1&&(k[2]==="private"?(D=P.indexOf(k[3]),D===-1?(H=k[3].createChild([],v),Q=p(H),P.push(k[3]),T.push(H),N.push(Q),w[pe]=[Q,pe,"private",H]):w[pe]=[N[D],pe,"private",T[D]]):w[pe]=[k[2],k[1]],R[pe]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&v.forEach(Me=>{k[1].$scope.indexOf(Me)!==-1&&(w[pe]=[k[2],k[1]],R[Me]=!0)});v.forEach(pe=>{if(!R[pe])throw new Error('No provider for "'+pe+'". Cannot use provider from the parent!')}),g.unshift(w)}return new mg(g,a)}const m={factory:f,type:u,value:function(g){return g}};function h(g,v){const w=g.__init__||[];return function(){w.forEach(R=>{typeof R=="string"?v.get(R):v.invoke(R)})}}function y(g){const v=g.__exports__;if(v){const w=g.__modules__,R=Object.keys(g).reduce((D,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&(D[H]=g[H]),D),Object.create(null)),P=(w||[]).concat(R),T=d(P),N=yc(function(D){return T.get(D)});v.forEach(function(D){r[D]=[N,D,"private",T]});const k=(g.__init__||[]).slice();return k.unshift(function(){T.init()}),g=Object.assign({},g,{__init__:k}),h(g,T)}return Object.keys(g).forEach(function(w){if(w==="__init__"||w==="__depends__")return;const R=g[w];if(R[2]==="private"){r[w]=R;return}const P=R[0],T=R[1];r[w]=[m[P],KR(P,T),P]}),h(g,a)}function C(g,v){return g.indexOf(v)!==-1||(g=(v.__depends__||[]).reduce(C,g),g.indexOf(v)!==-1)?g:g.concat(v)}function _(g){const v=g.reduce(C,[]).map(y);let w=!1;return function(){w||(w=!0,v.forEach(R=>R()))}}this.get=c,this.invoke=f,this.instantiate=u,this.createChild=d,this.init=_(e)}function KR(e,t){return e!=="value"&&yp(t)&&(t=yc(t.slice())),t}var XR=1e3;function Xi(e,t){var n=this;t=t||XR,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)})}Xi.prototype.canRender=function(e){},Xi.prototype.drawShape=function(e,t){},Xi.prototype.drawConnection=function(e,t){},Xi.prototype.getShapePath=function(e){},Xi.prototype.getConnectionPath=function(e){};function to(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function ZR(e){return["M",e.x,e.y]}function bp(e){return["L",e.x,e.y]}function QR(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function JR(e,t){const n=e.length,i=[ZR(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(bp(a));continue}const c=Math.min(t,xp(a.x-o.x,a.y-o.y),xp(s.x-a.x,s.y-a.y));if(!c){i.push(bp(a));continue}const l=vc(a,o,c),u=vc(a,o,c*.5),f=vc(a,s,c),p=vc(a,s,c*.5);i.push(bp(l)),i.push(QR(u,p,f))}return i}function vc(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=xp(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function xp(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ka(e,t,n){ze(t)&&(n=t,t=null),t||(t={});const i=Oe("path",t);return ze(n)&&(i.dataset.cornerRadius=String(n)),_p(i,e)}function _p(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Se(e,{d:to(JR(t,n))}),e}function bc(e){var t=new Set(e);return nt(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,Ne(e)||(e=[e]),z(e,function(i,r){var o=t(i,r,n);Ne(o)&&o.length&&no(o,t,n+1)})}function wp(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 wp(e)}function eC(e,t,n){Kr(t)&&(t=!0),pn(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&&Ro(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,z(u.incoming,c),z(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,Ne(e)||(e=[e]);var n,i,r,o;return z(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 z(e,function(i){var r=i;r.waypoints&&(r=Zt(r)),!ze(t.y)&&r.x>t.x&&(n[i.id]=i),!ze(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(ze(t.width)&&ze(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!ze(t.width)||!ze(t.height))&&(n[i.id]=i)}),n}function gg(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function yg(e){return!!(e&&e.isFrame)}function Da(e,t){return W({},e||{},t||{})}var tC=1;function xr(e,t){Xi.call(this,e,tC),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}Ee(xr,Xi),xr.prototype.canRender=function(){return!0},xr.prototype.drawShape=function(t,n,i){var r=Oe("rect");return Se(r,{x:0,y:0,width:n.width||0,height:n.height||0}),yg(n)?Se(r,W({},this.FRAME_STYLE,i||{})):Se(r,W({},this.SHAPE_STYLE,i||{})),Ue(t,r),r},xr.prototype.drawConnection=function(t,n,i){var r=ka(n.waypoints,W({},this.CONNECTION_STYLE,i||{}));return Ue(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 nC(){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){!Ne(n)&&!i&&(i=n,n=[]);var r=Hn(n,function(o,a){return W(o,e[a]||{})},{});return i?W(r,i):r},this.computeStyle=function(n,i,r){return Ne(i)||(r=i,i=[]),t.style(i||[],W({},r,n||{}))}}const iC={__init__:["defaultRenderer"],defaultRenderer:["type",xr],styles:["type",nC]};function Ut(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function qt(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 Ep(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 Sp(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 rC=2;function Zi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(oC(r,n))return o;return!1}function oC(e,t){const n=t[0];return Xr(t,function(i){return Math.abs(n[e]-i[e])<=rC})}function vg(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 Rp(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var aC=/,?([a-z]),?/gi,bg=parseFloat,Qt=Math,_r=Qt.PI,Ii=Qt.min,Bi=Qt.max,xg=Qt.pow,wr=Qt.abs,sC=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,cC=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,_g=Array.isArray||function(e){return e instanceof Array};function lC(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function uC(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 pC(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 lC(r,i)?(uC(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function fC(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(sC,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(cC,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 dC(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 hC(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 Cp(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(aC,"$1")}function mC(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 wg(e,t,n,i,r,o,a,s,c){var l=1-c,u=xg(l,3),f=xg(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:xc(m),y:xc(h)}}function Eg(e){var t=_C(...e);return Cp(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 gC(e,t){return e=Cp(e),t=Cp(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 Rg(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),C=Sg(h,t,i,o,s),_=y*y+C*C;d+=p[m]*Qt.sqrt(_)}return l*d}function yC(e,t,n,i,r,o,a,s){if(!(Bi(e,n)<Ii(r,a)||Ii(e,n)>Bi(r,a)||Bi(t,i)<Ii(o,s)||Ii(t,i)>Bi(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=xc(c/u),p=xc(l/u),d=+f.toFixed(2),m=+p.toFixed(2);if(!(d<+Ii(e,n).toFixed(2)||d>+Bi(e,n).toFixed(2)||d<+Ii(r,a).toFixed(2)||d>+Bi(r,a).toFixed(2)||m<+Ii(t,i).toFixed(2)||m>+Bi(t,i).toFixed(2)||m<+Ii(o,s).toFixed(2)||m>+Bi(o,s).toFixed(2)))return{x:f,y:p}}}}function xc(e){return Math.round(e*1e11)/1e11}function vC(e,t,n){var i=Eg(e),r=Eg(t);if(!gC(i,r))return[];var o=Rg(...e),a=Rg(...t),s=Mg(e)?1:~~(o/5)||1,c=Mg(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=wg(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=wg(...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],C=l[d+1],_=u[m],g=u[m+1],v=wr(C.x-y.x)<.01?"y":"x",w=wr(g.x-_.x)<.01?"y":"x",R=yC(y.x,y.y,C.x,C.y,_.x,_.y,g.x,g.y),P;if(R){if(P=R.x.toFixed(9)+"#"+R.y.toFixed(9),f[P])continue;f[P]=!0;var T=y.t+wr((R[v]-y[v])/(C[v]-y[v]))*(C.t-y.t),N=_.t+wr((R[w]-_[w])/(g[w]-_[w]))*(g.t-_.t);T>=0&&T<=1&&N>=0&&N<=1&&p.push({x:R.x,y:R.y,t1:T,t2:N})}}return p}function Cg(e,t,n){e=Tg(e),t=Tg(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 C=0,_=t.length;C<_;C++){var g=t[C];if(g[0]=="M")o=l=g[1],a=u=g[2];else{g[0]=="C"?(p=[o,a,...g.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,l,u,l,u],o=l,a=u);var v=vC(f,p);{for(var w=0,R=v.length;w<R;w++)v[w].segment1=m,v[w].segment2=C,v[w].bez1=f,v[w].bez2=p;d=d.concat(v)}}}}}return d}function bC(e){return _g(e)&&_g(e[0])}function xC(e){if(dC(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 Mg(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function _c(e,t,n,i){return[e,t,n,i,n,i]}function Ag(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 Pg(e,t,n,i,r,o,a,s,c,l){var u=_r*120/180,f=_r/180*(+r||0),p=[],d,m=pC(function(L,E,x){var G=L*Qt.cos(x)-E*Qt.sin(x),U=L*Qt.sin(x)+E*Qt.cos(x);return{x:G,y:U}});if(l)P=l[0],T=l[1],w=l[2],R=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,C=h*h/(n*n)+y*y/(i*i);C>1&&(C=Qt.sqrt(C),n=C*n,i=C*i);var _=n*n,g=i*i,v=(o==a?-1:1)*Qt.sqrt(wr((_*g-_*y*y-g*h*h)/(_*y*y+g*h*h))),w=v*n*y/i+(e+s)/2,R=v*-i*h/n+(t+c)/2,P=Qt.asin(((t-R)/i).toFixed(9)),T=Qt.asin(((c-R)/i).toFixed(9));P=e<w?_r-P:P,T=s<w?_r-T:T,P<0&&(P=_r*2+P),T<0&&(T=_r*2+T),a&&P>T&&(P=P-_r*2),!a&&T>P&&(T=T-_r*2)}var N=T-P;if(wr(N)>u){var k=T,D=s,H=c;T=P+u*(a&&T>P?1:-1),s=w+n*Qt.cos(T),c=R+i*Qt.sin(T),p=Pg(s,c,n,i,r,0,a,D,H,[T,k,w,R])}N=T-P;var Q=Qt.cos(P),pe=Qt.sin(P),Me=Qt.cos(T),Be=Qt.sin(T),it=Qt.tan(N/4),X=4/3*n*it,J=4/3*i*it,le=[e,t],ve=[e+X*pe,t-J*Q],q=[s+X*Be,c-J*Me],V=[s,c];if(ve[0]=2*le[0]-ve[0],ve[1]=2*le[1]-ve[1],l)return[ve,q,V].concat(p);p=[ve,q,V].concat(p).join().split(",");for(var ne=[],Te=0,Pe=p.length;Te<Pe;Te++)ne[Te]=Te%2?m(p[Te-1],p[Te],f).y:m(p[Te],p[Te+1],f).x;return ne}function _C(e,t,n,i,r,o,a,s){for(var c=[],l=[[],[]],u,f,p,d,m,h,y,C,_=0;_<2;++_){if(_==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,C=Qt.sqrt(y),!(y<0)&&(m=(-f+C)/(2*u),0<m&&m<1&&c.push(m),h=(-f-C)/(2*u),0<h&&h<1&&c.push(h))}for(var g=c.length,v=g,w;g--;)d=c[g],w=1-d,l[0][g]=w*w*w*e+3*w*w*d*n+3*w*d*d*r+d*d*d*a,l[1][g]=w*w*w*t+3*w*w*d*i+3*w*d*d*o+d*d*d*s;return l[0][v]=e,l[1][v]=t,l[0][v+1]=a,l[1][v+1]=s,l[0].length=l[1].length=v+2,{x0:Ii(...l[0]),y0:Ii(...l[1]),x1:Bi(...l[0]),y1:Bi(...l[1])}}function Tg(e){if(bC(e)||(e=fC(e)),hC(e))return e;for(var t=mC(xC(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",...Pg(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",...Ag(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",...Ag(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",..._c(d.x,d.y,p[1],p[2])];break;case"H":p=["C",..._c(d.x,d.y,p[1],d.y)];break;case"V":p=["C",..._c(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",..._c(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=bg(u[f-4])||n.x,n.by=bg(u[f-3])||n.y}return t}function Mt(e){return pn(e)&&jn(e,"waypoints")}function Je(e){return pn(e)&&jn(e,"labelTarget")}function wC(e){return pn(e)&&Eo(e.parent)}function kg(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Qi(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ie(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function wc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function EC(e){return Qi({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function SC(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=MC(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 $e(e){return Mt(e)?SC(e):EC(e)}function _n(e,t,n){n=n||0,pn(n)||(n={x:n,y:n});var i=Ie(e),r=Ie(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,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=RC(e,t);return i.length===1||i.length===2&&La(i[0],i[1])<1?Qi(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}),Qi(i[n?0:i.length-1])):null}function RC(e,t){return Cg(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||Sp(i,r,n)?e.splice(t,1):t++;return e}function MC(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ec(e,t){return Math.round(e*t)/t}function Og(e){return ze(e)?e+"px":e}function AC(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"),Dn(n,{position:"relative",overflow:"hidden",width:Og(e.width),height:Og(e.height)}),t.appendChild(n),n}function Dg(e,t,n){const i=Oe("g");ut(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const TC="base",Lg=0,kC=1,OC={shape:["x","y","width","height"],connection:["waypoints"]};function Fe(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}Fe.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Fe.prototype._init=function(e){const t=this._eventBus,n=this._container=PC(e),i=this._svg=Oe("svg");Se(i,{width:"100%",height:"100%"}),An(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")}),Ue(n,i);const r=this._viewport=Dg(i,"viewport");e.deferUpdate&&(this._viewboxChanged=ku(this._viewboxChanged,300)),this._restoreFocus=ku(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Fe.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},Fe.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Fe.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=gg(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Fe.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Fe.prototype.restoreFocus=function(){this._restoreFocus()},Fe.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Fe.prototype.isFocused=function(){return this._focused},Fe.prototype.getDefaultLayer=function(){return this.getLayer(TC,Lg)},Fe.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},Fe.prototype._getChildIndex=function(e){return Hn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Fe.prototype._createLayer=function(e,t){typeof t>"u"&&(t=kC);const n=this._getChildIndex(t);return{group:Dg(this._viewport,"layer-"+e,n),index:t,visible:!0}},Fe.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},Fe.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(an(n),t.visible=!1),n},Fe.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],an(t.group))},Fe.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Fe.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(AC(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Fe.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Fe.prototype._findPlaneForRoot=function(e){return kt(this._planes,function(t){return t.rootElement===e})},Fe.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Fe.prototype._resolveElements=function(e){return Ne(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Fe.prototype.getContainer=function(){return this._container},Fe.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(z([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),ut(r).add(t)):(e.markers.delete(t),ut(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Fe.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Fe.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Fe.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Fe.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Fe.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Fe.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,Lg);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Fe.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},Fe.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},Fe.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},Fe.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},Fe.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},Fe.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=OC[e];if(!Xr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Fe.prototype._setParent=function(e,t,n){qt(t.children,e,n),e.parent=t},Fe.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},Fe.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Fe.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Fe.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),Ut(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Fe.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Fe.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Fe.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Fe.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Fe.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Fe.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,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:NR(),s=Ec(r.a,1e3),c=Ec(-r.e||0,1e3),l=Ec(-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},Fe.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),Ig(t,n)}),{x:n.e,y:n.f}},Fe.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(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=Ie(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=Ie(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),C=Math.min(0,s.top-p.top);u=m||h,f=y||C}this.scroll({dx:-u*l,dy:-f*l})},Fe.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Ec(i.a,1e3)};function Ig(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Fe.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},Fe.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,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),Ig(this._viewport,u),u},Fe.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Fe.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},Fe.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var jo="data-element-id";function ii(e){this._elements={},this._eventBus=e}ii.$inject=["eventBus"],ii.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Se(t,jo,i),n&&Se(n,jo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},ii.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Se(i.gfx,jo,""),i.secondaryGfx&&Se(i.secondaryGfx,jo,""),delete t[n])},ii.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)},ii.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Se(t,jo,i),t},ii.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Se(e,jo);var n=this._elements[t];return n&&n.element},ii.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},ii.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}},ii.prototype.getAll=function(){return this.filter(function(e){return e})},ii.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)})},ii.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},ii.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 DC(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 LC(e){return e.__refs_collection===!0}function IC(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Bg(e,t,n){var i=DC(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 BC(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 ci(e,t){if(!(this instanceof ci))return new ci(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}ci.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):BC(this,t,e)},ci.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return LC(n)||Bg(this,t,e),n},ci.prototype.ensureBound=function(e,t){IC(e,t)||this.bind(e,t)},ci.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},ci.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Ap=new ci({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Ng=new ci({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),$g=new ci({name:"attachers",collection:!0},{name:"host"}),Fg=new ci({name:"outgoing",collection:!0},{name:"source"}),jg=new ci({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)}}),Ap.bind(this,"parent"),Ng.bind(this,"labels"),Fg.bind(this,"outgoing"),jg.bind(this,"incoming")}function Ba(){Ho.call(this),Ap.bind(this,"children"),$g.bind(this,"host"),$g.bind(this,"attachers")}Ee(Ba,Ho);function Hg(){Ho.call(this),Ap.bind(this,"children")}Ee(Hg,Ba);function zg(){Ba.call(this),Ng.bind(this,"labelTarget")}Ee(zg,Ba);function Gg(){Ho.call(this),Fg.bind(this,"source"),jg.bind(this,"target")}Ee(Gg,Ho);var NC={connection:Gg,shape:Ba,label:zg,root:Hg};function $C(e,t){var n=NC[e];if(!n)throw new Error("unknown type: <"+e+">");return W(new n,t)}function FC(e){return e instanceof Ho}function Ji(){this._uid=12}Ji.prototype.createRoot=function(e){return this.create("root",e)},Ji.prototype.createLabel=function(e){return this.create("label",e)},Ji.prototype.createShape=function(e){return this.create("shape",e)},Ji.prototype.createConnection=function(e){return this.create("connection",e)},Ji.prototype.create=function(e,t){return t=W({},t||{}),t.id||(t.id=e+"_"+this._uid++),$C(e,t)};var Sc="__fn",Vg=1e3,jC=Array.prototype.slice;function Vn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Vn.prototype.on=function(e,t,n,i){if(e=Ne(e)?e:[e],fn(t)&&(i=n,n=t,t=Vg),!ze(t))throw new Error("priority must be a number");var r=n;i&&(r=Bn(n,i),r[Sc]=n[Sc]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Vn.prototype.once=function(e,t,n,i){var r=this;if(fn(t)&&(i=n,n=t,t=Vg),!ze(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[Sc]=n,this.on(e,t,o)},Vn.prototype.off=function(e,t){e=Ne(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Vn.prototype.createEvent=function(e){var t=new Na;return t.init(e),t},Vn.prototype.fire=function(e,t){var n,i,r,o;if(o=jC.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}},Vn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Vn.prototype._destroy=function(){this._listeners={}},Vn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Vn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=HC(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},Vn.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},Vn.prototype._getListeners=function(e){return this._listeners[e]},Vn.prototype._setListeners=function(e,t){this._listeners[e]=t},Vn.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[Sc]===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 HC(e,t){return e.apply(null,t)}function io(e){return e.childNodes[0]}function zC(e){return e.parentNode.childNodes[1]}function Rc(e,t,n,i,r){var o=Pa();o.setTranslate(t,n);var a=Pa();a.setRotate(i||0,0,0);var s=Pa();s.setScale(1,1),Ta(e,[o,a,s])}function wn(e,t,n){var i=Pa();i.setTranslate(t,n),Ta(e,i)}function Wg(e,t){var n=Pa();n.setRotate(t,0,0),Ta(e,n)}function ri(e,t){this._eventBus=e,this._elementRegistry=t}ri.$inject=["eventBus","elementRegistry"],ri.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=zC(t),n||(n=Oe("g"),ut(n).add("djs-children"),Ue(t.parentNode,n))):n=t,n},ri.prototype._clear=function(e){var t=io(e);return dc(t),t},ri.prototype._createContainer=function(e,t,n,i){var r=Oe("g");ut(r).add("djs-group"),typeof n<"u"?GC(r,t,t.childNodes[n]):Ue(t,r);var o=Oe("g");ut(o).add("djs-element"),ut(o).add("djs-"+e),i&&ut(o).add("djs-frame"),Ue(r,o);var a=Oe("g");return ut(a).add("djs-visual"),Ue(o,a),o},ri.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,yg(t))},ri.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Hn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),z(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;z(o,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},ri.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},ri.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},ri.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},ri.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},ri.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),wn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Se(n,"display","none"):Se(n,"display","block")}},ri.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);an(t.parentNode)};function GC(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const VC={__depends__:[iC],__init__:["canvas"],canvas:["type",Fe],elementRegistry:["type",ii],elementFactory:["type",Ji],eventBus:["type",Vn],graphicsFactory:["type",ri]};function WC(e){var t=new mg(e);return t.init(),t}function UC(e){e=e||{};var t={config:["value",e]},n=[t,VC].concat(e.modules||[]);return WC(n)}function Sr(e,t){this._injector=t||UC(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 Pn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Nn(e,t){return e.$instanceOf(t)}function YC(e){return kt(e.rootElements,function(t){return Nn(t,"bpmn:Process")||Nn(t,"bpmn:Collaboration")})}function qC(e){var t={},n=[],i={};function r(q,V){return function(ne){q(ne,V)}}function o(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,V){var ne=q.gfx;if(ne)throw new Error(`already rendered ${Pn(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 ne=i[q.id]&&s(q,V);return o(q),ne}catch(Te){u(Te.message,{element:q,error:Te}),console.error(`failed to import ${Pn(q)}`,Te)}}function u(q,V){e.error(q,V)}var f=this.registerDi=function(V){var ne=V.bpmnElement;ne?i[ne.id]?u(`multiple DI elements defined for ${Pn(ne)}`,{element:ne}):i[ne.id]=V:u(`no bpmnElement referenced in ${Pn(V)}`,{element:V})};function p(q){d(q.plane)}function d(q){f(q),z(q.planeElement,m)}function m(q){f(q)}this.handleDefinitions=function(V,ne){var Te=V.diagrams;if(ne&&Te.indexOf(ne)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ne&&Te&&Te.length&&(ne=Te[0]),!ne)throw new Error("no diagram to display");i={},p(ne);var Pe=ne.plane;if(!Pe)throw new Error(`no plane for ${Pn(ne)}`);var L=Pe.bpmnElement;if(!L)if(L=YC(V),L)u(`correcting missing bpmnElement on ${Pn(Pe)} to ${Pn(L)}`),Pe.bpmnElement=L,f(Pe);else throw new Error("no process or collaboration to display");var E=c(L,Pe);if(Nn(L,"bpmn:Process")||Nn(L,"bpmn:SubProcess"))y(L,E);else if(Nn(L,"bpmn:Collaboration"))le(L,E),C(V.rootElements,E);else throw new Error(`unsupported bpmnElement for ${Pn(Pe)}: ${Pn(L)}`);h(n)};var h=this.handleDeferred=function(){for(var V;n.length;)V=n.shift(),V()};function y(q,V){it(q,V),N(q.ioSpecification,V),T(q.artifacts,V),o(q)}function C(q,V){var ne=nt(q,function(Te){return!a(Te)&&Nn(Te,"bpmn:Process")&&Te.laneSets});ne.forEach(r(y,V))}function _(q,V){l(q,V)}function g(q,V){z(q,r(_,V))}function v(q,V){l(q,V)}function w(q,V){l(q,V)}function R(q,V){l(q,V)}function P(q,V){l(q,V)}function T(q,V){z(q,function(ne){Nn(ne,"bpmn:Association")?n.push(function(){P(ne,V)}):P(ne,V)})}function N(q,V){q&&(z(q.dataInputs,r(w,V)),z(q.dataOutputs,r(R,V)))}var k=this.handleSubProcess=function(V,ne){it(V,ne),T(V.artifacts,ne)};function D(q,V){var ne=l(q,V);Nn(q,"bpmn:SubProcess")&&k(q,ne||V),Nn(q,"bpmn:Activity")&&N(q.ioSpecification,V),n.push(function(){z(q.dataInputAssociations,r(v,V)),z(q.dataOutputAssociations,r(v,V))})}function H(q,V){l(q,V)}function Q(q,V){l(q,V)}function pe(q,V){n.push(function(){var ne=l(q,V);q.childLaneSet&&Me(q.childLaneSet,ne||V),ve(q)})}function Me(q,V){z(q.lanes,r(pe,V))}function Be(q,V){z(q,r(Me,V))}function it(q,V){X(q.flowElements,V),q.laneSets&&Be(q.laneSets,V)}function X(q,V){z(q,function(ne){Nn(ne,"bpmn:SequenceFlow")?n.push(function(){H(ne,V)}):Nn(ne,"bpmn:BoundaryEvent")?n.unshift(function(){D(ne,V)}):Nn(ne,"bpmn:FlowNode")?D(ne,V):Nn(ne,"bpmn:DataObject")||(Nn(ne,"bpmn:DataStoreReference")||Nn(ne,"bpmn:DataObjectReference")?Q(ne,V):u(`unrecognized flowElement ${Pn(ne)} in context ${Pn(V&&V.businessObject)}`,{element:ne,context:V}))})}function J(q,V){var ne=l(q,V),Te=q.processRef;Te&&y(Te,ne||V)}function le(q,V){z(q.participants,r(J,V)),n.push(function(){g(q.messageFlows,V)}),T(q.artifacts,V)}function ve(q){z(q.flowNodeRef,function(V){var ne=V.get("lanes");ne&&ne.push(q)})}}function S(e,t){var n=ae(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function tt(e,t){return hr(t,function(n){return S(e,n)})}function ae(e){return e&&e.businessObject||e}function pt(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,C){return i.add(h,y,C)},error:function(h,y){s.push({message:h,context:y})}},p=new qC(f);u=u||l.diagrams&&l.diagrams[0];var d=XC(l,u);if(!d)throw new Error("no diagram to display");z(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 XC(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!S(n,"bpmn:Process")&&!S(n,"bpmn:Collaboration")&&(i=ZC(n));var r;S(i,"bpmn:Collaboration")?r=i:r=kt(e.rootElements,function(l){if(S(l,"bpmn:Collaboration"))return kt(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=Ug(o),s=[t],c=[n];return z(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 Ug(e){var t=[];return z(e,function(n){n&&(t.push(n),t=t.concat(Ug(n.flowElements)))}),t}function ZC(e){for(var t=e;t;){if(S(t,"bpmn:Process"))return t;t=t.$parent}}var QC='<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>',Yg=QC,qg={verticalAlign:"middle"},Kg={color:"#404040"},JC={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},eM={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},tM={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"},nM='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Yg+'</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>',Ni;function iM(){Ni=Lt(nM),Dn(Ni,JC),Dn(Rt("svg",Ni),qg),Dn(Rt(".backdrop",Ni),eM),Dn(Rt(".notice",Ni),tM),Dn(Rt(".link",Ni),Kg,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function rM(){Ni||(iM(),Gn.bind(Ni,".backdrop","click",function(e){document.body.removeChild(Ni)})),document.body.appendChild(Ni)}const Cc=5,Xg="djs-outline-hidden";function jt(e){e=W({},aM,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),cM(this._container)}Ee(jt,Sr),jt.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||[]),Mc(s,o),s=oM(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},jt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},jt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Mc(o,[]),o}if(typeof t=="string"&&(i=sM(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Mc(o,[]),o}try{this.clear()}catch(o){throw Mc(o,[]),o}const{warnings:r}=await KC(this,n,i);return{warnings:r}},jt.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},jt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=Rt(":scope > defs",i._svg),a=hg(r),s=o?"<defs>"+hg(o)+"</defs>":"",c=i.getContainer();$t(c).add(Xg);let l;try{l=r.getBBox()}finally{$t(c).remove(Xg)}const u=l.x-Cc,f=l.y-Cc,p=l.width+Cc*2,d=l.height+Cc*2;t=`<?xml version="1.0" encoding="utf-8"?>
4
+ nested error: `+w.message;if(P)return a.addWarning({message:H,error:w}),!0;throw yr(H)}function u(w,R){return l(w,R,!0)}function f(){var w=a.elementsById,R=a.references,P,T;for(P=0;T=R[P];P++){var N=T.element,k=w[T.id],D=Yi(N).propertiesByName[T.property];if(k||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),D.isMany){var H=N.get(D.name),Q=H.indexOf(T);Q===-1&&(Q=H.length),k?H[Q]=k:H.splice(Q,1)}else N.set(D.name,k)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,g=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function y(w){if(d.test(w)){var R=g.exec(w),P=R&&R[1];!P||h.test(P)||a.addWarning({message:"unsupported document encoding <"+P+">, falling back to UTF-8"})}}function M(w,R){var P=c.peek();try{c.push(P.handleNode(w))}catch(T){l(T,R,o)&&c.push(new $u)}}function _(w,R){try{c.peek().handleText(w)}catch(P){u(P,R)}}function m(w,R){w.trim()&&_(w,R)}var v=r.getPackages().reduce(function(w,R){return w[R.uri]=R.prefix,w},Object.entries(Nu).reduce(function(w,[R,P]){return w[P]=R,w},r.config&&r.config.nsMap||{}));return s.ns(v).on("openTag",function(w,R,P,T){var N=w.attrs||{},k=Object.keys(N).reduce(function(H,Q){var pe=R(N[Q]);return H[Q]=pe,H},{}),D={name:w.name,originalName:w.originalName,attributes:k,ns:w.ns};M(D,T)}).on("question",y).on("closeTag",p).on("cdata",_).on("text",function(w,R,P){m(R(w),P)}).on("error",l).on("warn",u),new Promise(function(w,R){var P;try{s.parse(e),f()}catch(H){P=H}var T=i.element;!P&&!T&&(P=yr("failed to parse document as <"+i.type.$descriptor.name+">"));var N=a.warnings,k=a.references,D=a.elementsById;return P?(P.warnings=N,R(P)):w({rootElement:T,elementsById:D,references:k,warnings:N})})},Hu.prototype.handler=function(e){return new ju(this.model,e)};function GE(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var VE=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,WE=/<|>|'|"|&|\n\r|\n/g,Nh=/<|>|&/g;function ki(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}ki.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},ki.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},ki.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},ki.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)},ki.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},ki.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},ki.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},ki.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},ki.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 UE(e){return e.charAt(0).toLowerCase()+e.slice(1)}function YE(e,t){return Dh(t)?UE(e):e}function $h(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Fh(e){return Fn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function qE(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 KE(e,t){return t.isGeneric?W({localName:t.ns.localName},e):W({localName:YE(t.ns.localName,t.$pkg)},e)}function XE(e,t){return W({localName:t.ns.localName},e)}function ZE(e){var t=e.$descriptor;return nt(t.properties,function(n){var i=n.name;if(n.isVirtual||!jn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var QE={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},JE={"<":"lt",">":"gt","&":"amp"};function jh(e,t,n){return e=Fn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function e1(e){return jh(e,WE,QE)}function t1(e){return jh(e,Nh,JE)}function n1(e){return nt(e,function(t){return t.isAttr})}function i1(e){return nt(e,function(t){return!t.isAttr})}function zu(e){this.tagName=e}zu.prototype.build=function(e){return this.element=e,this},zu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function eo(){}eo.prototype.serializeValue=eo.prototype.serializeTo=function(e){e.append(this.escape?t1(this.value):this.value)},eo.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Nh)!==-1&&(this.escape=!0),this};function Gu(e){this.tagName=e}$h(Gu,eo),Gu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function Nt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}Nt.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=ZE(e),this.parseAttributes(n1(r)),this.parseContainments(i1(r))),this.parseGenericAttributes(e,i),this},Nt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return KE(t,e)},Nt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return XE(t,e)},Nt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Nt.prototype.nsAttributeName=function(e){var t;if(Fn(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)},Nt.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}))},Nt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new eo().build({type:"String"},t));var n=e.$children;n&&z(n,i=>{this.body.push(new Nt(this).build(i))})},Nt.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)}},Nt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return z(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},Nt.prototype.parseGenericAttributes=function(e,t){var n=this;z(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)}})},Nt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;z(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new eo().build(r,o[0]));else if(Ch(r.type))z(o,function(l){n.push(new Gu(t.addTagName(t.nsPropertyTagName(r))).build(r,l))});else if(a)z(o,function(l){n.push(new zu(t.addTagName(t.nsPropertyTagName(r))).build(l))});else{var c=Ih(r);z(o,function(l){var u;c?c===Lh?u=new Nt(t,r):u=new Vs(t,r,c):u=new Nt(t),n.push(u.build(l))})}})},Nt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new ki(i):t=i),t},Nt.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},Nt.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},Nt.prototype.parseAttributes=function(e){var t=this,n=this.element;z(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];z(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},Nt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Fh(e)},Nt.prototype.addAttribute=function(e,t){var n=this.attrs;Fn(t)&&(t=e1(t));var i=wh(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)},Nt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=qE(n).concat(t)),z(t,function(i){e.append(" ").append(Fh(i.name)).append('="').append(i.value).append('"')})},Nt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==eo;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),z(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function Vs(e,t,n){Nt.call(this,e,t),this.serialization=n}$h(Vs,Nt),Vs.prototype.parseNsAttributes=function(e){var t=Nt.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},Vs.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function r1(){this.value="",this.write=function(e){this.value+=e}}function o1(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 a1(e){e=W({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new r1,o=new o1(r,e.format);e.preamble&&o.append(VE);var a=new Nt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(s1(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function s1(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Nu)n[i]=Nu[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 Ws(e,t){si.call(this,e,t)}Ws.prototype=Object.create(si.prototype),Ws.prototype.fromXML=function(e,t,n){Fn(t)||(n=t,t="bpmn:Definitions");var i=new Hu(W({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},Ws.prototype.toXML=function(e,t){var n=new a1(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var c1="BPMN20",l1="http://www.omg.org/spec/BPMN/20100524/MODEL",u1="bpmn",p1=[],f1=[{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"}]}],d1=[{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"}]}],h1={tagAlias:"lowerCase",typePrefix:"t"},g1={name:c1,uri:l1,prefix:u1,associations:p1,types:f1,enumerations:d1,xml:h1},m1="BPMNDI",y1="http://www.omg.org/spec/BPMN/20100524/DI",v1="bpmndi",b1=[{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"]}],x1=[{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"}]}],_1=[],w1={name:m1,uri:y1,prefix:v1,types:b1,enumerations:x1,associations:_1},E1="DC",S1="http://www.omg.org/spec/DD/20100524/DC",R1="dc",C1=[{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}]}],M1=[],A1={name:E1,uri:S1,prefix:R1,types:C1,associations:M1},P1="DI",T1="http://www.omg.org/spec/DD/20100524/DI",k1="di",O1=[{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"}]}],D1=[],L1={tagAlias:"lowerCase"},I1={name:P1,uri:T1,prefix:k1,types:O1,associations:D1,xml:L1},B1="bpmn.io colors for BPMN",N1="http://bpmn.io/schema/bpmn/biocolor/1.0",$1="bioc",F1=[{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"}]}],j1=[],H1=[],z1={name:B1,uri:N1,prefix:$1,types:F1,enumerations:j1,associations:H1},G1="BPMN in Color",V1="http://www.omg.org/spec/BPMN/non-normative/color/1.0",W1="color",U1=[{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"}]}],Y1=[],q1=[],K1={name:G1,uri:V1,prefix:W1,types:U1,enumerations:Y1,associations:q1};const X1={bpmn:g1,bpmndi:w1,dc:A1,di:I1,bioc:z1,color:K1};function Hh(e,t){const n=W({},X1,e);return new Ws(n,t)}const Z1={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"}},Q1="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",zh="i18n",Us={[zh]:Z1,[Cu]:yh};function Gh(){return Hh(Us)}const Vh=Gh();async function To(e){const{rootElement:t,warnings:n}=await Vh.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function J1(e){const{xml:t}=await Vh.toXML(e,{format:!0});return t}function Vu(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},eS=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function tS(e){const t=ko;return eS.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*tS(i);return n}function Wh(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&nS(e),iS(e),rS(e),oS(e)}function nS(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 iS(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 rS(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 oS(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 Ys=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),aS=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),sS=1,qs=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),cS=2;function mt(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"label-over-shape":return`ls|${e.edge}|${e.shape}`;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"edge-along-group-boundary":return`eg|${e.edge}|${e.group}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Uh=20,Ks=5,Yh=3,lS=8,Do=15,Wu=50,qh=12,uS=qh*1.2;function Uu(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>Oo(o,qh))),r=n.length*uS;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 vn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function Lo(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of vn(e))for(const s of vn(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>=Uh&&(!n||l>n.length)&&(n={axis:a.axis,length:l,kind:c})}return n}function Yu(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Xh(e,t){const n=Lo(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function pS(e,t){let n=0;for(const i of t)i.id!==e.id&&Xh(e,i)&&n++;return n}function ei(e,t){let n=0;for(const i of t)i.id!==e.id&&Lo(e,i)&&n++;return n}const Zh=15,Qh=20;function fS(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Qh||t.at>n[1]+Qh)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 qu=20;function Xs(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<Uh||n.push([r-qu,o+qu])}return n}function Zs(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of vn(e)){const o=fS(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of Xs(r,vn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const dS=10,hS=1,gS=(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 mS(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,g)=>{if(g===0)return d<=0;const h=d/g;if(g>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 Ku(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 yS=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,Io=1;function qi(e,t){const n=e.x+Io,i=e.x+e.width-Io,r=e.y+Io,o=e.y+e.height-Io;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 Jh(e,t){const n=e.label;if(!n)return null;if(vn(e).some(i=>qi(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(vn(i).some(r=>qi(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=>qi(n,r)))return i.id;return null}function bn(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(mS(e.waypoints[o],e.waypoints[o+1],r,cS)){i.push(r);break}}return i}const Ma=(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))},vS=(e,t,n,i)=>tg(e,t,n,i)?0:Math.min(Ma(e,n,i),Ma(t,n,i),Ma(n,e,t),Ma(i,e,t)),eg=(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,Ma({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(eg(e,s)||eg(t,s))return 0;let c=1/0;for(let l=0;l<s.length;l++)c=Math.min(c,vS(e,t,s[l],s[(l+1)%s.length]));return c}function tg(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 ng=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Aa(e,t){let n=0;for(const i of t){if(i.id===e.id||ng(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++)tg(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function ti(e,t){let n=0;for(const i of t)i.id===e.id||ng(e,i)||Aa(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function ig(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++)Aa(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function Js(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Aa(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 rg(e){const t=Js(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:bS(e)}}function bS(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 og(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!qs.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 ag(e){var n;const t=(n=It(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=It(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 sg=e=>e?{members:e}:{},ni=e=>e.shapes.filter(t=>!t.container);function xS(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 _S(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 cg(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(vn(i).some(r=>qi(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=>qi(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}const lg=3;function ug(e,t){const n=Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x),i=Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y);if(n<=0||i<=0)return 0;const r=/Event$/.test(t.type);if(!r&&!/Gateway$/.test(t.type))return Math.min(n,i);const o=t.x+t.width/2,a=t.y+t.height/2,s=Math.min(Math.max(o,e.x),e.x+e.width),c=Math.min(Math.max(a,e.y),e.y+e.height);if(r)return Math.max(0,t.width/2-Math.hypot(s-o,c-a));const l=t.width/2,u=t.height/2;return Math.max(0,(1-(Math.abs(s-o)/l+Math.abs(c-a)/u))*Math.min(l,u))}function ec(e,t){const n=[];for(const i of t.shapes){if(i.container||qs.has(i.type))continue;const r=ug(e,i);r>=lg&&n.push({shape:i.id,depth:r})}return n.sort((i,r)=>i.shape.localeCompare(r.shape))}function vt(e,t={}){const n=[],i=e.shapes.filter(m=>!m.container);for(const m of e.edges)for(const v of bn(m,i))n.push({kind:"edge-crosses-shape",edge:m.id,shape:v.id});const r=e.shapes.filter(m=>m.container&&aS.has(m.type));if(r.length){const m=(v,w)=>{const R=e.shapes.find(P=>P.id===w);return!!R&&R.x>=v.x&&R.y>=v.y&&R.x+R.width<=v.x+v.width&&R.y+R.height<=v.y+v.height};for(const v of e.edges)for(const w of bn(v,r))v.endpoints.includes(w.id)||v.endpoints.some(R=>m(w,R))||n.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:w.id})}for(const m of e.edges){if(m.waypoints.length<2)continue;const v=[[m.source,m.waypoints[0]],[m.target,m.waypoints[m.waypoints.length-1]]];for(const[w,R]of v){if(!w)continue;const P=e.shapes.find(D=>D.id===w);if(!P||P.container)continue;const T=Math.max(P.x-R.x,R.x-(P.x+P.width),0),N=Math.max(P.y-R.y,R.y-(P.y+P.height),0),k=Math.hypot(T,N);k>dS&&n.push({kind:"edge-endpoint-detached",edge:m.id,shape:w,distance:Math.round(k)})}}const o=e.shapes.filter(m=>m.type==="bpmn:Participant");for(let m=0;m<o.length;m++)for(let v=m+1;v<o.length;v++){const w=o[m],R=o[v];if(w.x+w.width<=R.x||R.x+R.width<=w.x||w.y+w.height<=R.y||R.y+R.height<=w.y)continue;const P=(T,N)=>T.x<=N.x&&T.y<=N.y&&T.x+T.width>=N.x+N.width&&T.y+T.height>=N.y+N.height;n.push({kind:"pool-overlap",pools:[w.id,R.id],contained:P(w,R)||P(R,w)})}const a=i.filter(m=>!m.attached);for(let m=0;m<a.length;m++)for(let v=m+1;v<a.length;v++){const w=a[m],R=a[v];if(!Ku(w,R,sS))continue;const P=w.id<R.id?[w.id,R.id]:[R.id,w.id];n.push({kind:"shape-overlap",shapes:P,identical:yS(w,R)})}const s=e.shapes.filter(m=>m.type==="bpmn:Group"&&Array.isArray(m.members)&&m.members.length>0);for(let m=0;m<s.length;m++)for(let v=m+1;v<s.length;v++){const w=s[m],R=s[v],P=Math.min(w.x+w.width,R.x+R.width)-Math.max(w.x,R.x),T=Math.min(w.y+w.height,R.y+R.height)-Math.max(w.y,R.y);if(P<=Ks||T<=Ks)continue;const N=w.id<R.id?[w.id,R.id]:[R.id,w.id],k=new Set(R.members);if(w.members.some(H=>k.has(H))){const H=og(e,s,{x:Math.max(w.x,R.x),y:Math.max(w.y,R.y),right:Math.min(w.x+w.width,R.x+R.width),bottom:Math.min(w.y+w.height,R.y+R.height)});H.length&&n.push({kind:"group-overlap-unreadable",reason:"orphan",groups:N,shapes:H});continue}const D=w.x<=R.x&&w.y<=R.y&&w.x+w.width>=R.x+R.width&&w.y+w.height>=R.y+R.height?w.id:R.x<=w.x&&R.y<=w.y&&R.x+R.width>=w.x+w.width&&R.y+R.height>=w.y+w.height?R.id:void 0;n.push({kind:"group-overlap-unintended",groups:N,...D?{container:D}:{}})}const c=new Set(s.flatMap(m=>[...m.members])),l=m=>e.shapes.filter(v=>!v.container&&!qs.has(v.type)&&v.x>=m.x&&v.y>=m.y&&v.x+v.width<=m.x+m.width&&v.y+v.height<=m.y+m.height);for(const m of s){const v=l(m);if(!v.length)continue;const w=new Set(m.members),R=v.filter(P=>!w.has(P.id));R.some(P=>c.has(P.id))&&(R.length*2<v.length||n.push({kind:"group-overlap-unreadable",reason:"minority",group:m.id,shapes:R.map(P=>P.id).sort()}))}for(const m of s){const v=new Set(l(m).map(k=>k.id)),w=new Set(m.members),R=new Set([...v].filter(k=>!w.has(k)&&c.has(k)));if(!R.size)continue;let P=!1,T=!1,N=!1;for(const k of e.edges){if(k.type!=="bpmn:SequenceFlow"||!k.source||!k.target)continue;const D=R.has(k.source),H=R.has(k.target);!D&&H&&!v.has(k.source)?P=!0:D&&!H&&!v.has(k.target)?T=!0:D&&H&&(N=!0)}P&&T&&N&&n.push({kind:"group-overlap-unreadable",reason:"throughpass",group:m.id,shapes:[...R].sort()})}const u=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<u.length;m++)for(let v=m+1;v<u.length;v++)for(let w=v+1;w<u.length;w++){const R=[u[m],u[v],u[w]],P={x:Math.max(...R.map(k=>k.x)),y:Math.max(...R.map(k=>k.y)),right:Math.min(...R.map(k=>k.x+k.width)),bottom:Math.min(...R.map(k=>k.y+k.height))};if(P.right-P.x<=Ks||P.bottom-P.y<=Ks)continue;const T=og(e,[],P);if(!T.length)continue;const N=R.map(k=>k.id).sort();n.push({kind:"group-stack-unreadable",groups:N,shapes:T})}for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||qs.has(v.type)||v.width<=0||v.height<=0)continue;const w=[["top",m.y,"h",m.x,m.x+m.width],["bottom",m.y+m.height,"h",m.x,m.x+m.width],["left",m.x,"v",m.y,m.y+m.height],["right",m.x+m.width,"v",m.y,m.y+m.height]];for(const[R,P,T,N,k]of w){const D=T==="h"?v.x:v.y,H=T==="h"?v.x+v.width:v.y+v.height;if(!(D<k&&N<H))continue;const Q=T==="h"?v.y:v.x,pe=T==="h"?v.y+v.height:v.x+v.width;if(!(Q<P&&P<pe))continue;const Me=Math.min(P-Q,pe-P);Me<lS||n.push({kind:"group-cuts-shape",group:m.id,shape:v.id,side:R,depth:Me})}}const f=t.includeObservationOnly?e.shapes.filter(m=>m.type==="bpmn:Group"&&m.width>0&&m.height>0):[];if(f.length){const m=new Map(e.shapes.filter(v=>!v.container).map(v=>[v.id,{x:v.x+v.width/2,y:v.y+v.height/2}]));for(const v of e.edges){if(v.type!=="bpmn:SequenceFlow"&&v.type!=="bpmn:MessageFlow")continue;const w=vn(v);if(w.length)for(const R of f){const P=R.x+R.width,T=R.y+R.height,N=v.endpoints.some(D=>{const H=m.get(D);return!!H&&R.x<H.x&&H.x<P&&R.y<H.y&&H.y<T});let k=null;for(const D of w){const[H,Q,pe]=D.axis==="v"?[R.y,T,[["left",R.x],["right",P]]]:[R.x,P,[["top",R.y],["bottom",T]]],Me=Math.min(D.hi,Q)-Math.max(D.lo,H);if(Me<Wu)continue;const Be=D.axis==="v"?R.x<D.at&&D.at<P:R.y<D.at&&D.at<T;if(!(Be&&N))for(const[it,K]of pe){const J=Math.abs(D.at-K);J<=Do&&(!k||J<k.distance)&&(k={side:it,inside:Be,distance:J,length:Me})}}k&&n.push({kind:"edge-along-group-boundary",edge:v.id,group:R.id,side:k.side,inside:k.inside,distance:Math.round(k.distance),length:Math.round(k.length)})}}}const p=e.shapes.filter(m=>m.container&&m.type!=="bpmn:Group"&&m.type!=="bpmn:Lane");for(const m of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of p){const w=m.x<v.x+v.width&&v.x<m.x+m.width,R=m.y<v.y+v.height&&v.y<m.y+m.height,P=[["top",m.y,v.y,w],["bottom",m.y+m.height,v.y+v.height,w],["left",m.x,v.x,R],["right",m.x+m.width,v.x+v.width,R]];for(const[T,N,k,D]of P)D&&Math.abs(N-k)<=Yh&&n.push({kind:"group-on-container-boundary",group:m.id,container:v.id,side:T})}const d=e.shapes.filter(m=>m.type==="bpmn:Group");for(let m=0;m<d.length;m++)for(let v=m+1;v<d.length;v++){const w=d[m],R=d[v],P=w.x<R.x+R.width&&R.x<w.x+w.width,T=w.y<R.y+R.height&&R.y<w.y+w.height,N=[["x",w.x+w.width,R.x,T],["x",R.x+R.width,w.x,T],["y",w.y+w.height,R.y,P],["y",R.y+R.height,w.y,P]];for(const[k,D,H,Q]of N)if(Q&&Math.abs(D-H)<=Yh){n.push({kind:"group-on-group-boundary",groups:w.id<R.id?[w.id,R.id]:[R.id,w.id],axis:k});break}}for(let m=0;m<e.edges.length;m++)for(let v=m+1;v<e.edges.length;v++){const w=e.edges[m],R=e.edges[v],P=Lo(w,R);if(!P)continue;const T=w.id<R.id?[w.id,R.id]:[R.id,w.id];n.push({kind:P.kind==="opposite"?"edge-overlap-opposite":P.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:T,axis:P.axis,length:Math.round(P.length)})}for(const m of e.edges){if(!m.label)continue;const v=Zs(m,e.edges);v&&n.push({kind:"label-on-shared-segment",edge:m.id,other:v.other,axis:v.axis})}for(const m of e.edges){if(!m.label)continue;const v=Jh(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}if(t.includeObservationOnly){for(const m of e.edges)if(!(!m.label||m.type!=="bpmn:SequenceFlow"))for(const{shape:v,depth:w}of ec(m.label,e))n.push({kind:"label-over-shape",edge:m.id,shape:v,depth:Math.round(w)})}const g=new Set(i.map(m=>m.id)),h=e.shapes.filter(m=>m.type==="bpmn:Participant"&&m.label);for(const m of[...i,...h.filter(v=>!g.has(v.id))]){if(!m.label)continue;const v=cg(m,e);v&&n.push({kind:"label-over-line",edge:m.id,line:v})}const y=new Set(e.shapes.filter(m=>m.type==="bpmn:TextAnnotation").map(m=>m.id));for(const m of h)for(const{owner:v,rect:w}of Bo(e))v===m.id||y.has(v)||Ku(m.label,w,Io)&&n.push({kind:"pool-name-over-label",pool:m.id,label:v});const M=Bo(e);for(const m of i)if(m.type==="bpmn:TextAnnotation")for(const{owner:v,rect:w}of M)v!==m.id&&Ku(m,w,Io)&&n.push({kind:"annotation-over-label",annotation:m.id,label:v});const _=new Map(e.shapes.map(m=>[m.id,m]));for(const m of i){const v=m.parent??xS(m,e,_);if(!v)continue;const w=_.get(v);!w||!w.container||gS(w,m,hS)||m.type==="bpmn:TextAnnotation"&&!_S(m,w,e)||n.push({kind:"shape-outside-container",shape:m.id,container:w.id})}return n.sort((m,v)=>mt(m).localeCompare(mt(v)))}const It=e=>typeof e=="object"&&e!==null?e:void 0,Wt=e=>typeof e=="number"?e:0,Ki=e=>{const t=It(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function wS(e){const t=It(e);if(!t)return[];const n=[];for(const i of["sourceRef","targetRef"]){const r=t[i];for(const o of Array.isArray(r)?r:[r]){const a=Ki(o);a&&n.push(a)}}return n}function ES(e){const t=It(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Ki(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Ki(t.targetRef);return n&&i?{source:n,target:i}:{}}function SS(e,t){const n=It(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Ki(n);return r?t.get(r):void 0}if(Ys.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Ki(n)}function pg(e){var a,s,c,l,u;const t=[],n=[],i=((a=It(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=It(e))==null?void 0:s.rootElements)??[]){const p=It(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const g=It(d),h=Ki(g),y=Ki(g==null?void 0:g.processRef);h&&y?r.set(y,h):h&&o.add(h)}}for(const f of i){const p=It((c=It(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const g of d){const h=It(g);if(!h)continue;const y=It(h.bpmnElement),M=typeof(y==null?void 0:y.id)=="string"?y.id:void 0;if(!M)continue;const _=typeof(y==null?void 0:y.$type)=="string"?y.$type:"",m=It(h.bounds);if(m){const w=h.isExpanded===!1&&_!=="bpmn:Participant",R=It((l=It(h.label))==null?void 0:l.bounds),P={id:M,type:_,x:Wt(m.x),y:Wt(m.y),width:Wt(m.width),height:Wt(m.height),container:Ys.has(_)&&!w,attached:(y==null?void 0:y.attachedToRef)!==void 0,...y?{parent:SS(y,r)}:{},...R?{label:{x:Wt(R.x),y:Wt(R.y),width:Wt(R.width),height:Wt(R.height)}}:{},..._==="bpmn:Group"?sg(ag(y)):{}},T=h.isHorizontal!==!1,N=typeof(y==null?void 0:y.name)=="string"?y.name:"";o.has(M)&&T&&N&&(P.label=Uu(P,N)),t.push(P);continue}const v=h.waypoint;if(Array.isArray(v)){const w=It((u=It(h.label))==null?void 0:u.bounds);n.push({id:M,type:_,waypoints:v.map(R=>{var P,T;return{x:Wt((P=It(R))==null?void 0:P.x),y:Wt((T=It(R))==null?void 0:T.y)}}),endpoints:wS(y),...ES(y),...w?{label:{x:Wt(w.x),y:Wt(w.y),width:Wt(w.width),height:Wt(w.height)}}:{}})}}}return{shapes:t,edges:n}}function fg(e){return vt(pg(e),{includeObservationOnly:!0})}async function RS(e){const{definitions:t,warnings:n}=await To(e);return{findings:fg(t),warnings:n}}function Xe(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=It(o.label),y=Ki(o.source),M=Ki(o.target);n.push({id:o.id,type:a,waypoints:s.map(_=>({x:Wt(_.x),y:Wt(_.y)})),endpoints:[y,M].filter(_=>!!_),...y&&M?{source:y,target:M}:{},...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=It(o.businessObject),l=It(o.label);let u=It(o.parent);for(;u&&u.type==="bpmn:Lane";)u=It(u.parent);const f=typeof(u==null?void 0:u.type)=="string"?u.type:"",p=u&&Ys.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:Ys.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"?sg(ag(c)):{}},g=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&g&&((i=It(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=Uu(d,g)),t.push(d)}return{shapes:t,edges:n}}const CS={"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 MS(e,t){const n=CS[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function dg(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function hg(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 MS(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&dg(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?dg(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 Xu=20,AS=4,Dt=(e,t)=>Math.abs(e-t)<.5;function tc(e,t,n,i=Xu){if(Dt(e.y,t.y)&&!Dt(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(Dt(e.x,t.x)&&!Dt(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 gg(e,t,n,i=Xu){if(n.length<2)return null;if(Dt(e.y,t.y)&&!Dt(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(Dt(e.x,t.x)&&!Dt(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 mg(e,t,n=Xu){if(e.length!==4)return null;const[i,r,o,a]=e;if(Dt(i.y,r.y)&&Dt(r.x,o.x)&&Dt(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(Dt(i.x,r.x)&&Dt(r.y,o.y)&&Dt(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 nc(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 yg=30,PS=[0,-25,25,-40,40];function TS(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+yg:s-yg,l=a?i.y+i.height:i.y,u=n.x+n.width/2,f=i.x+i.width/2;return PS.map(p=>[{x:u,y:s},{x:u,y:c},{x:f+p,y:c},{x:f+p,y:l}])}const Zu=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],No=(e,t,n)=>bn({...e,waypoints:t},n).length;function Qu(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 nc(e,t))if(No(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(vn),c=f=>vn({...e,waypoints:f}).some(p=>Xs(p,s).length>0),l=TS(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&&Dt(f.y+f.height/2,p.y+p.height/2)){const d=[r[0],r[r.length-1]];if(Dt(d[0].y,d[1].y)&&!Dt(d[0].x,d[1].x)){const g=t.filter(_=>!e.endpoints.includes(_.id)&&bn({...e,waypoints:d},[_]).length>0),h=g.length>=2?gg(d[0],d[1],g):null,M=(h?h.map(_=>[d[0],..._,d[1]]):g.length===1?(tc(d[0],d[1],g[0])??[]).map(_=>[d[0],..._,d[1]]):g.length===0?[d]:[]).filter(_=>No(e,_,t)===0&&_.length<=r.length).sort((_,m)=>Number(u(m))-Number(u(_)));if(M.length)return M.find(_=>!c(_))??M[0]}}}for(let f=0;f+1<r.length;f++){const p=r[f],d=r[f+1],g=t.filter(M=>!e.endpoints.includes(M.id)&&bn({...e,waypoints:[p,d]},[M]).length>0);if(g.length<2)continue;const h=gg(p,d,g);if(!h)continue;const y=h.map(M=>Zu(r,f,M)).filter(M=>No(e,M,t)===0).sort((M,_)=>Number(u(_))-Number(u(M)));if(y.length)return y.find(M=>!c(M))??y[0]}for(let f=0;f<AS&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const g=r[d],h=r[d+1];for(const y of t){if(e.endpoints.includes(y.id)||bn({...e,waypoints:[g,h]},[y]).length===0)continue;const M=tc(g,h,y),_=M?M.map(v=>Zu(r,d,v)):mg(r,y)??[];if(!_.length)continue;const m=[..._].sort((v,w)=>Number(u(w))-Number(u(v)));for(const v of m){const w=No(e,v,t);if(w<o){r=v,o=w,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function Ju(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=ni(o),s=new Set,c=vt(o).filter(u=>u.kind==="edge-crosses-shape"&&!t.has(mt(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,g=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=Qu(f,a,g,o.edges);if(!h){bn(f,a).some(m=>m.type==="bpmn:TextAnnotation")&&s.add(u);continue}const y=o.edges.filter(m=>m.id!==u),M=ei(f,y);ei({...f,waypoints:h},y)>M||r.updateWaypoints(p,h)}return s}const kS=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},ep=(e,t)=>Aa(e,[t])>0;function vg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=ni(o);let s=o;const c=new Set(vt(o).map(mt));for(const[l,u]of Js(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(N=>N.id===f),g=s.edges.find(N=>N.id===p);if(!d||!g)continue;const h=i.get(f);if(!h)continue;const y=h.parent,M=y&&typeof y.x=="number"&&typeof y.width=="number"?{x:y.x,y:y.y,width:y.width,height:y.height}:void 0,_=kS(g),m=[...nc(d,a)??[]],v=Qu(d,[...a,..._],M,o.edges);v&&m.push(v);for(let N=0;N+1<d.waypoints.length;N++)for(const k of _)for(const D of tc(d.waypoints[N],d.waypoints[N+1],k)??[])m.push(Zu(d.waypoints,N,D));const w=s.edges.filter(N=>N.id!==f),R=N=>({...s,edges:s.edges.map(k=>k.id===f?{...k,waypoints:N}:k)}),P=N=>!M||N.every(k=>k.x>=M.x&&k.x<=M.x+M.width&&k.y>=M.y&&k.y<=M.y+M.height),T=m.find(N=>{const k={...d,waypoints:N};return ep(k,g)||!P(N)||w.some(D=>D.id!==p&&!ep(d,D)&&ep(k,D))?!1:vt(R(N)).every(D=>c.has(mt(D)))});if(T){r.updateWaypoints(h,T),s=R(T);break}}}const OS=10;function bg(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 xg(e,t){if(e.waypoints.length<2||e.endpoints.length!==2)return null;const n=t.shapes.filter(H=>H.type==="bpmn:Participant"&&H.container),i=t.shapes.find(H=>H.id===e.endpoints[0]),r=t.shapes.find(H=>H.id===e.endpoints[1]);if(!i||!r)return null;const o=bg(i,n),a=bg(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(H=>H.id!==o.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=l.y).sort((H,Q)=>H.y-Q.y);if(!u.length)return null;const f=u[0],p=u[u.length-1],d=(c.y+c.height+f.y)/2,g=(p.y+p.height+l.y)/2,h=s?d:g,y=s?g:d,M=e.waypoints[0],_=e.waypoints[e.waypoints.length-1],m=ni(t),v=t.edges.filter(H=>H.id!==e.id),w=ti(e,v),R=bn(e,m).length;if(w===0&&R===0||R===0&&e.waypoints.length===2)return null;const P=Math.min(...u.map(H=>H.x)),T=Math.max(...u.map(H=>H.x+H.width)),N=(M.x+_.x)/2,k=H=>H.filter((Q,pe)=>pe===0||!(Dt(Q.x,H[pe-1].x)&&Dt(Q.y,H[pe-1].y)));let D;for(let H=P;H<=T;H+=OS){const Q=k([M,{x:M.x,y:h},{x:H,y:h},{x:H,y},{x:_.x,y},_]),pe={...e,waypoints:Q};if(bn(pe,m).length>0)continue;const Me=ti(pe,v),Be=Math.abs(H-N);(!D||Me<D.cross||Me===D.cross&&Be<D.detour)&&(D={pts:Q,cross:Me,detour:Be})}return D&&(R>0?D.cross<=w:D.cross<w)?D.pts:null}function _g(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Xe(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=Xe(n),s=a.edges.find(u=>u.id===o.id);if(!s)continue;const c=xg(s,a);if(!c)continue;const l=n.get(o.id);l&&i.updateWaypoints(l,c)}}const Oi=[25,-25,40,-40],$o=35;function DS(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,...Oi])if(!(Math.abs(l)>=e.width/2-5))for(const u of[0,...Oi]){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 ic(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 DS(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 _ of[0,...Oi]){if(Math.abs(_)>=i.width/2-5)continue;const m=o+_;f.push({pts:[{x:n.x,y:r},{x:m,y:r},{x:m,y:c}],cost:Math.abs(_)});for(const v of[0,...Oi]){if(Math.abs(v)>=n.width/2-5)continue;const w=a+v;f.push({pts:[{x:w,y:l},{x:w,y:u},{x:m,y:u},{x:m,y:c}],cost:Math.abs(_)+Math.abs(v)})}}const p=50,d=i.y+i.height/2,g=s?n.y+n.height:n.y;for(const _ of[0,...Oi]){if(Math.abs(_)>=n.width/2-5)continue;const m=a+_;f.push({pts:[{x:m,y:g},{x:m,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(_)})}const h=60,y=s?i.y+i.height:i.y,M=s?i.y+i.height+$o:i.y-$o;for(const _ of[0,...Oi]){if(Math.abs(_)>=i.width/2-5)continue;const m=o+_;for(const v of[0,...Oi]){if(Math.abs(v)>=n.width/2-5)continue;const w=a+v;f.push({pts:[{x:w,y:g},{x:w,y:M},{x:m,y:M},{x:m,y}],cost:h+Math.abs(_)+Math.abs(v)})}}return f}const rc=30;function wg(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=Dt(i.y,r.y)&&!Dt(i.x,r.x),a=Dt(i.x,r.x)&&!Dt(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)<rc||Math.abs(i.y-(s.y+s.height))<rc)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)<rc||Math.abs(i.x-(s.x+s.width))<rc)return!0}}return!1}const oc=40;function LS(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-oc,a=r.x+r.width+oc,s=r.y-oc,c=r.y+r.height+oc;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 Eg(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(R=>R.container),i=new Map(t.shapes.map(R=>[R.id,R])),r=ni(t),o=t.edges.filter(R=>R.id!==e.id),a=ei(e,o),s=ti(e,o),c=R=>LS(R,t.shapes,e.endpoints)+(wg(R,n)?1:0),l=c(e.waypoints),u=R=>{if(!R)return;const P=R.x+R.width/2,T=R.y+R.height/2;return n.find(N=>N.type==="bpmn:Lane"&&P>=N.x&&P<=N.x+N.width&&T>=N.y&&T<=N.y+N.height)},f=u(i.get(e.endpoints[0]??"")),p=u(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,g=R=>{if(!d||!p)return!1;for(let P=1;P<R.length-2;P++){const T=R[P],N=R[P+1];if(Dt(T.y,N.y)&&!Dt(T.x,N.x)&&T.y>p.y&&T.y<p.y+p.height)return!0}return!1},h=g(e.waypoints),M=(R=>{if(!R)return;const P=R.x+R.width/2,T=R.y+R.height/2;return n.filter(N=>N.type==="bpmn:Participant"&&P>=N.x&&P<=N.x+N.width&&T>=N.y&&T<=N.y+N.height).sort((N,k)=>N.width*N.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),_=R=>{if(!M)return 0;let P=0;for(let T=1;T<R.length-1;T++){const N=R[T];(N.x<M.x||N.x>M.x+M.width||N.y<M.y||N.y>M.y+M.height)&&P++}return P},m=_(e.waypoints);if(!wg(e.waypoints,n)&&!(d&&!h)&&m===0)return null;const v=R=>R.reduce((P,T,N)=>N?P+Math.abs(T.x-R[N-1].x)+Math.abs(T.y-R[N-1].y):0,0);let w;for(const{pts:R,cost:P}of ic(e,i)){const T={...e,waypoints:R};if(bn(T,r).length>0)continue;const N=ei(T,o);if(N>a)continue;const k=_(R);if(k>m)continue;const D=k<m&&N===0;if(!D&&ti(T,o)>s)continue;const H=c(R),Q=g(R);if(!D&&!(Q&&!h)&&H>=l)continue;const Me=Q?0:1,Be=v(R);(!w||k<w.out||k===w.out&&(Me<w.lane||Me===w.lane&&(N<w.opp||N===w.opp&&(H<w.sc||H===w.sc&&(P<w.cost||P===w.cost&&Be<w.len)))))&&(w={pts:R,out:k,sc:H,lane:Me,opp:N,cost:P,len:Be})}return(w==null?void 0:w.pts)??null}function IS(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Xe(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=Xe(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=ni(a),l=a.edges.filter(d=>d.id!==o),u=bn(s,c).length,f=ei(s,l),p=ti(s,l);for(const d of nc(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const g={...s,waypoints:d};if(bn(g,c).length>u||ei(g,l)>f||ti(g,l)>p)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function Sg(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Xe(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=Xe(n),s=a.edges.find(u=>u.id===o);if(!s)continue;const c=Eg(s,a);if(!c)continue;const l=n.get(o);l&&i.updateWaypoints(l,c)}}function tp(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=Dt(n[0].x,n[1].x)&&!Dt(n[0].y,n[1].y),s=Dt(n[n.length-1].x,n[n.length-2].x)&&!Dt(n[n.length-1].y,n[n.length-2].y);for(const c of Oi){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 BS(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,g=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,y=[];for(const M of[0,...Oi])Math.abs(M)<i.width/2-5&&y.push({pts:[{x:p,y:l},{x:u+M,y:l},{x:u+M,y:h}],cost:Math.abs(M)}),Math.abs(M)<i.height/2-5&&y.push({pts:[{x:c,y:d},{x:c,y:f+M},{x:g,y:f+M}],cost:Math.abs(M)});return y}function np(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,...Oi]){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 Rg(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=ni(t),r=t.edges.filter(d=>d.id!==e.id),o=ei(e,r);if(o===0)return null;const a=ti(e,r);let s;const c=d=>d.reduce((g,h,y)=>y?g+Math.abs(h.x-d[y-1].x)+Math.abs(h.y-d[y-1].y):0,0),l=3,u=d=>{const g=d[0],h=d[d.length-1],y=Math.hypot(h.x-g.x,h.y-g.y);return y>=1&&c(d)/y>=l?1:0},f=u(e.waypoints),p=[...ic(e,n),...np(e,n),...tp(e,n)];for(const{pts:d,cost:g}of p){const h={...e,waypoints:d};if(bn(h,i).length>0)continue;const y=ei(h,r),M=ti(h,r),_=o-y+(f-u(d));if(y>=o||M-a>_)continue;const m=c(d);(!s||y<s.opposite||y===s.opposite&&(M<s.cross||M===s.cross&&(g<s.cost||g===s.cost&&m<s.len)))&&(s={pts:d,opposite:y,cross:M,cost:g,len:m})}return(s==null?void 0:s.pts)??null}function Cg(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=Lo(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function NS(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=ni(t),r=t.edges.filter(p=>p.id!==e.id),o=Cg(e,r);if(o===0)return null;const a=ei(e,r),s=ti(e,r),c=p=>p.reduce((d,g,h)=>h?d+Math.abs(g.x-p[h-1].x)+Math.abs(g.y-p[h-1].y):0,0),l=2;let u;const f=[...ic(e,n),...np(e,n),...BS(e,n),...tp(e,n)];for(const{pts:p,cost:d}of f){const g={...e,waypoints:p};if(bn(g,i).length>0)continue;const h=Cg(g,r);if(h>=o)continue;const y=ei(g,r);if(y-h>a-o)continue;const M=ti(g,r);if(M-s>(o-h)*l)continue;const _=c(p);(!u||h<u.fake||h===u.fake&&(y<u.unreadable||y===u.unreadable&&(M<u.cross||M===u.cross&&(d<u.cost||d===u.cost&&_<u.length))))&&(u={pts:p,fake:h,unreadable:y,cross:M,cost:d,length:_})}return(u==null?void 0:u.pts)??null}function Mg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=vt(Xe(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(mt(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=Xe(i),l=c.edges.find(p=>p.id===s);if(!l)continue;const u=NS(l,c);if(!u)continue;const f=i.get(s);f&&r.updateWaypoints(f,u)}}function Ag(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 Pg(e,t,n){var l;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((l=Lo(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:Ag(e,n)&&Ag(t,n)}function Tg(e,t,n){let i=0;for(const r of t)r.id!==e.id&&Pg(e,r,n)&&i++;return i}function $S(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=ni(t),r=t.edges.filter(p=>p.id!==e.id),o=Tg(e,r,n);if(o===0)return null;const a=ei(e,r),s=ti(e,r),c=p=>p.reduce((d,g,h)=>h?d+Math.abs(g.x-p[h-1].x)+Math.abs(g.y-p[h-1].y):0,0),l=2;let u;const f=[...ic(e,n),...np(e,n),...tp(e,n)];for(const{pts:p,cost:d}of f){const g={...e,waypoints:p};if(bn(g,i).length>0)continue;const h=Tg(g,r,n);if(h>=o)continue;const y=ei(g,r);if(y-h>a-o)continue;const M=ti(g,r);if(M-s>(o-h)*l)continue;const _=c(p);(!u||h<u.chain||h===u.chain&&(y<u.unreadable||y===u.unreadable&&(M<u.cross||M===u.cross&&(d<u.cost||d===u.cost&&_<u.length))))&&(u={pts:p,chain:h,unreadable:y,cross:M,cost:d,length:_})}return(u==null?void 0:u.pts)??null}function FS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=new Map(o.shapes.map(l=>[l.id,l])),s=vt(o).filter(l=>l.kind==="edge-overlap-opposite"&&!t.has(mt(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||!Pg(u,f,a)))for(const p of l.edges)n.has(p)||c.add(p)}for(const l of[...c].sort()){const u=Xe(i),f=u.edges.find(g=>g.id===l);if(!f)continue;const p=$S(f,u);if(!p)continue;const d=i.get(l);d&&r.updateWaypoints(d,p)}}function kg(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=vt(o).filter(u=>Yu(u)&&!t.has(mt(u)));if(!a.length)return;const s=new Set;for(const u of a)if(Yu(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=Xe(i),p=f.edges.find(h=>h.id===u);if(!p)continue;const d=Rg(p,f);if(!d)continue;const g=i.get(u);g&&r.updateWaypoints(g,d)}}const jS=10,HS=(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 Og(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!Zs(e,i))return null;const r=ni(t),o=i.flatMap(vn);for(const a of vn(e)){let s=[[a.lo,a.hi]];for(const[d,g]of Xs(a,o))s=s.flatMap(([h,y])=>{const M=[];return d>h&&M.push([h,Math.min(y,d)]),g<y&&M.push([Math.max(h,g),y]),M.filter(([_,m])=>m>_)});const c=a.axis==="h"?n.width:n.height,l=s.find(([d,g])=>g-d>=c+jS*2);if(!l)continue;const u=(l[0]+l[1])/2,f=a.axis==="h"?{x:u,y:a.at-Zh}:{x:a.at+zn+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(!Zs({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&HS(p,d)))return p}return null}const zn=8;function ip(e,t){const n=e.label;if(!n)return null;const i=vn(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,g=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(g,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(vn),...t.shapes.filter(p=>p.container).flatMap(Ca)],l=p=>!c.some(d=>qi(p,d));if(l(n))return null;const u=(s.axis==="v"?n.height:n.width)+zn,f=[0,-u,u,-2*u,2*u];if(s.axis==="v")for(const p of[s.at+zn,s.at-zn-n.width])for(const d of f){const g=n.y+d;if(g<s.lo||g+n.height>s.hi)continue;const h={...n,x:p,y:g};if(l(h))return h}else for(const p of[s.at-zn-n.height,s.at+zn])for(const d of f){const g=n.x+d;if(g<s.lo||g+n.width>s.hi)continue;const h={...n,x:g,y:p};if(l(h))return h}return null}const zS=30,GS=(e,t)=>{let n=1/0;for(let i=0;i+1<t.length;i++){const r=t[i],o=t[i+1],a=o.x-r.x,s=o.y-r.y,c=a*a+s*s,l=c?Math.max(0,Math.min(1,((e.x-r.x)*a+(e.y-r.y)*s)/c)):0;n=Math.min(n,Math.hypot(e.x-(r.x+l*a),e.y-(r.y+l*s)))}return n};function Dg(e,t){var a,s;const{elementRegistry:n}=e,i=e.modeling;let r=Xe(n),o=new Set(vt(r).map(mt));for(const[c,l]of t){const u=l.wps,f=n.get(c),p=f==null?void 0:f.label;if(!p||!(f!=null&&f.waypoints))continue;const d=f.waypoints[0].x-u[0].x,g=f.waypoints[0].y-u[0].y;if(!(f.waypoints.length===u.length&&f.waypoints.every((R,P)=>R.x-u[P].x===d&&R.y-u[P].y===g))){if(((a=f.source)==null?void 0:a.id)===l.source&&((s=f.target)==null?void 0:s.id)===l.target)continue;const R=r.edges.find(D=>D.id===c);if(!(R!=null&&R.label)||!ec(R.label,r).length)continue;const P={...R.label,x:l.label.x,y:l.label.y};if(ec(P,r).length)continue;const T={x:P.x+P.width/2,y:P.y+P.height/2};if(GS(T,R.waypoints)>zS)continue;const N={...r,edges:r.edges.map(D=>D.id===c?{...D,label:P}:D)},k=vt(N);if(k.some(D=>!o.has(mt(D))))continue;i.moveElements([p],{x:l.label.x-p.x,y:l.label.y-p.y}),r=N,o=new Set(k.map(mt));continue}const y=l.label.x+d-p.x,M=l.label.y+g-p.y;if(y===0&&M===0)continue;const _=r.edges.find(R=>R.id===c);if(!(_!=null&&_.label))continue;const m={..._.label,x:_.label.x+y,y:_.label.y+M},v={...r,edges:r.edges.map(R=>R.id===c?{...R,label:m}:R)},w=vt(v);w.some(R=>!o.has(mt(R)))||(i.moveElements([p],{x:y,y:M}),r=v,o=new Set(w.map(mt)))}}function Lg(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Xe(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=ip(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 Ig(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=Xe(i),a=vt(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(mt(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=Og(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 Bg(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(vn),...t.shapes.filter(p=>p.container).flatMap(Ca)],r=i.filter(p=>qi(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=>qi(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-zn-n.height},{...n,y:p.at+zn}):l.push({...n,x:p.at-zn-n.width},{...n,x:p.at+zn});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+zn},{...n,x:u-n.width/2,y:e.y-zn-n.height},{...n,x:e.x+e.width+zn,y:f-n.height/2},{...n,x:e.x-zn-n.width,y:f-n.height/2}),l.find(c)??null}function Ng(e,t){const{elementRegistry:n}=e,i=e.modeling,r=Xe(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Bg(o,Xe(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 VS(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 $g(e,t){const{elementRegistry:n}=e,i=e.modeling;let r=Xe(n),o=new Set(vt(r).map(mt));const a=[...new Set(vt(r).filter(s=>s.kind==="edge-endpoint-detached"&&!t.has(mt(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 M=h?r.shapes.find(m=>m.id===h):void 0;if(!M)continue;const _=VS(M,l[y]);_.x===l[y].x&&_.y===l[y].y||(l[y]=_,f=!0)}if(!f)continue;const p={...r,edges:r.edges.map(h=>h.id===s?{...h,waypoints:l}:h)},d=vt(p);if(d.some(h=>!o.has(mt(h))))continue;const g=n.get(s);g&&(i.updateWaypoints(g,l),r=p,o=new Set(d.map(mt)))}}const WS=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Fg=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),jg={"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}]},ac=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),rp=e=>typeof e=="string"&&e!=="";function US(e){const t=[];function n(i,r,o,a){if(a===null){rp(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!ac(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)rp(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a;if(!ac(i)||!rp(i.kind)||!(i.kind in jg)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const s of jg[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(!ac(f))break;f=f[d]}if(!ac(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,g)=>n(r,`${l}[${g}]`,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"&&!gh(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 Hg(e,t){const n=US(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,g){if(!WS.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,{...g,opIndex:p})}e.forEach((p,d)=>{var g;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"}),(g=p.association)!=null&&g.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,g,h){const y=s(d);if(y===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:g});return}if(h&&!h.includes(y)){i.push({kind:"ref-category",opIndex:p,ref:d,role:g,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 g;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&&((((g=r.get(h))==null?void 0:g.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:M,name:_,condition:m}=p.flow,v=l(d,y,"source",["flowNode"]),w=l(d,M,"target",["flowNode"]);v&&w&&c(y)!==c(M)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),_!==void 0&&m!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:y,target:M}=p.flow,_=l(d,y,"source",["flowNode","participant"]),m=l(d,M,"target",["flowNode","participant"]);if(_&&m){const v=c(y),w=c(M);v!==void 0&&v===w&&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(_=>_===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const M=h.source===p.dataStore.id?h.target:h.source;l(d,M,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:y}=p.association,M=l(d,h,"source"),_=l(d,y,"target");if(M&&_){const m=new Set([M,_]);m.has("dataStore")&&m.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:y})}break}case"association.add":{const{id:h,source:y,target:M}=p.association,_=l(d,y,"source"),m=l(d,M,"target");_&&m&&_!=="annotation"&&m!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${y}->${M}`});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 M=h===p.annotation.id?y:h;l(d,M,"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&&Fg.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(_=>_.id);for(const _ of h)y.includes(_)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.id,lane:_});for(const _ of y)t.categoryOf(_)!==void 0&&!h.includes(_)&&i.push({kind:"id-duplicate",opIndex:d,id:_});const M=y.filter(_=>h.includes(_));M.length===h.length&&M.some((_,m)=>_!==h[m])&&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,M=t.endpointsOf(p.id),_=p.source??(M==null?void 0:M.source),m=p.target??(M==null?void 0:M.target);h&&y&&_!==void 0&&m!==void 0&&new Set([c(_),c(m),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&&Fg.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,g){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(g&&h!==g){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:g,actual:h});return}return h}}function zg(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 sc(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const cc={"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]},xn=10,YS=300,qS=160,Gg=20,Vg=40,KS=10;function op(e,t,n,i,r){const o=n,a=(k,D)=>{const[H,Q]=cc[k];let pe={x:t.x+t.width/2+H*(t.width/2+o.width/2+D),y:t.y+t.height/2+Q*(t.height/2+o.height/2+D)};const Me=i.x+xn+o.width/2,Be=i.x+i.width-xn-o.width/2,it=i.y+xn+o.height/2,K=i.y+i.height-xn-o.height/2,J={x:Math.min(Be,Math.max(Me,pe.x)),y:Math.min(K,Math.max(it,pe.y))};return(J.x!==pe.x||J.y!==pe.y)&&(pe=Math.abs(J.x-(t.x+t.width/2))<(t.width+o.width)/2+xn&&Math.abs(J.y-(t.y+t.height/2))<(t.height+o.height)/2+xn?{x:t.x+t.width+xn+o.width/2,y:J.y}:J),pe},s=(i.children??[]).filter(k=>!("waypoints"in k&&k.waypoints)&&k.type!=="bpmn:Lane"&&k.type!=="label"&&typeof k.x=="number"&&k.id!==r.selfId),c=Xe(e),l=k=>{var H,Q;if(!r.selfId)return!1;const D=e.get(k);return!!D&&(((H=D.source)==null?void 0:H.id)===r.selfId||((Q=D.target)==null?void 0:Q.id)===r.selfId)},u=c.edges.filter(k=>!l(k.id)).flatMap(vn),f=Bo(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),p=k=>({x0:k.x-o.width/2-xn,x1:k.x+o.width/2+xn,y0:k.y-o.height/2-xn,y1:k.y+o.height/2+xn}),d=k=>{const D=p(k);return s.some(H=>D.x0<H.x+H.width&&D.x1>H.x&&D.y0<H.y+H.height&&D.y1>H.y)},g=k=>{const D=p(k);return u.some(H=>H.axis==="h"?H.at>D.y0&&H.at<D.y1&&H.lo<D.x1&&H.hi>D.x0:H.at>D.x0&&H.at<D.x1&&H.lo<D.y1&&H.hi>D.y0)},h=k=>{const D=p(k);return f.some(H=>D.x0<H.x+H.width&&D.x1>H.x&&D.y0<H.y+H.height&&D.y1>H.y)},y=c.shapes.filter(k=>k.type==="bpmn:Group").flatMap(k=>[{axis:"h",at:k.y,lo:k.x,hi:k.x+k.width},{axis:"h",at:k.y+k.height,lo:k.x,hi:k.x+k.width},{axis:"v",at:k.x,lo:k.y,hi:k.y+k.height},{axis:"v",at:k.x+k.width,lo:k.y,hi:k.y+k.height}]),M=k=>{const D=p(k);return y.some(H=>H.axis==="h"?H.at>D.y0&&H.at<D.y1&&H.lo<D.x1&&H.hi>D.x0:H.at>D.x0&&H.at<D.x1&&H.lo<D.y1&&H.hi>D.y0)},_=k=>d(k)||g(k)||h(k)||M(k),m=k=>k.x-o.width/2>=i.x&&k.x+o.width/2<=i.x+i.width&&k.y-o.height/2>=i.y&&k.y+o.height/2<=i.y+i.height;if(r.placement){const k=Be=>Be.startsWith("top")?Be.replace(/^top/,"bottom"):Be.replace(/^bottom/,"top"),D=Be=>Be.endsWith("left")?Be.replace(/left$/,"right"):Be.replace(/right$/,"left"),H=r.placement.side,Q=[H,k(H),D(H),k(D(H)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],pe=r.placement.offset??50;let Me=a(H,pe);if(_(Me)){const Be=new Set;for(const it of Q){if(Be.has(it))continue;Be.add(it);const K=a(it,pe);if(m(K)&&!_(K)){Me=K;break}}}return Me}const v=r.from,w=i.x+xn+o.width/2,R=i.x+i.width-xn-o.width/2,P=i.y+xn+o.height/2,T=i.y+i.height-xn-o.height/2;let N={x:Math.min(R,Math.max(w,v.x)),y:Math.min(T,Math.max(P,v.y))};if(_(N)){const k=(t.width+o.width)/2+xn,H=[{x:N.x+k,y:N.y},{x:N.x-k,y:N.y},{x:N.x,y:N.y-o.height-xn},{x:N.x,y:N.y+o.height+xn}].filter(m).find(Q=>!_(Q));H&&(N=H)}return N}function Xt(e,t){return e.filter(n=>n.kind===t)}function Wg(e,t){var B0,N0,$0,F0,j0,H0,z0,G0,V0,W0,U0,Y0,q0,K0,X0,Z0,Q0,J0,eE,tE,nE,iE,rE;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c,spaceTool:l}=t,u=()=>a.getRootElement(),f=b=>o.get(b),p=b=>{const C=f(b);if(!C)throw new Error(`하강 참조 해소 실패: ${b}`);return C},d=b=>{let C=b.parent;for(;C;){if(C.type==="bpmn:Participant")return C;C=C.parent}},g=new Map;for(const b of o.filter(C=>!("waypoints"in C&&C.waypoints)&&C.type!=="bpmn:Lane"&&C.type!=="label"&&typeof C.x=="number"))g.set(b.id,{x:b.x,y:b.y});const h=Xt(e,"participant.add"),y=Xt(e,"node.add"),M=Xt(e,"sequenceFlow.add"),_=Xt(e,"messageFlow.add"),m=Xt(e,"dataStore.add"),v=Xt(e,"dataAssociation.add"),w=Xt(e,"annotation.add"),R=Xt(e,"group.add"),P=new Map(y.map(b=>[b.node.id,b])),T=(b,C,A)=>{var j;const O=b.businessObject,B=(((j=O.extensionElements)==null?void 0:j.values)??[]).filter($=>$.$type!==C),I=A?[...B,i.create(C,A)]:B;if(!I.length){O.extensionElements&&n.updateProperties(b,{extensionElements:void 0});return}const F=i.create("bpmn:ExtensionElements",{values:I});I.forEach($=>{$.$parent=F}),n.updateProperties(b,{extensionElements:F})},N=b=>({anchor:b.anchor,side:b.side,...b.offset!==void 0?{offset:b.offset}:{}});for(const b of Xt(e,"element.remove")){const C=f(b.id);C&&n.removeElements([C])}const k=b=>o.filter(C=>{var A;return C.type==="bpmn:Lane"&&((A=d(C))==null?void 0:A.id)===b}).sort((C,A)=>C.y-A.y);for(const b of Xt(e,"participant.update")){const C=p(b.id);if(b.name!==void 0&&n.updateProperties(C,{name:b.name??void 0}),!b.lanes)continue;const A=k(b.id);if(!A.length){n.splitLane(C,b.lanes.length),k(b.id).forEach((B,I)=>{const F=b.lanes[I];F&&n.updateProperties(B,{id:F.id,name:F.name})});continue}const O=new Set(A.map(B=>B.id));b.lanes.forEach((B,I)=>{if(O.has(B.id)){n.updateProperties(p(B.id),{name:B.name});return}const F=I===0?n.addLane(k(b.id)[0],"top"):n.addLane(p(b.lanes[I-1].id),"bottom");n.updateProperties(F,{id:B.id,name:B.name})})}const D=150,H=130,Q=80,pe=90,Me=180,Be=30,it=30,K=(b,C,A,O,B)=>{const I=A-C.width/2,F=O-C.height/2;return(b.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"&&I<j.x+j.width+it&&I+C.width+it>j.x&&F<j.y+j.height&&F+C.height>j.y)},J=new Set;for(const b of h){J.add(`pool:${b.participant.id}`);for(const C of b.participant.lanes??[])J.add(C.id)}const ce=new Map;for(const b of y){const C=b.node.lane??`pool:${b.node.participant??""}`;let A=ce.get(C);A||ce.set(C,A=new Set([0])),b.band!==void 0&&A.add(b.band)}const ve=new Map;for(const[b,C]of ce){if(!J.has(b))continue;const A=[...C].sort((I,F)=>I-F),O=A.map((I,F)=>F===0?0:F%2===1?Math.ceil(F/2):-(F/2)),B=Math.min(...O);ve.set(b,new Map(A.map((I,F)=>[I,O[F]-B])))}{const b=new Map;for(const C of h)(C.participant.lanes??[]).forEach((A,O)=>b.set(A.id,O));for(const[C,A]of ve){if(!b.has(C)||A.size<2)continue;const O=b.get(C),B=A.get(0)??0,I=new Set;for(const se of y){if(se.node.lane!==C||(se.band??0)!==0||!se.node.type.endsWith("Gateway"))continue;const ge={in:new Set,out:new Set,cross:new Set};for(const me of M){const Ce=me.flow.source===se.node.id;if(!Ce&&me.flow.target!==se.node.id)continue;const ht=P.get(Ce?me.flow.target:me.flow.source);if(!ht||ht.node.participant!==se.node.participant||!ht.node.lane)continue;let Oe,X=!1;if(ht.node.lane!==C){const ue=b.get(ht.node.lane);if(ue===void 0)continue;Oe=ue>O?"down":"up",X=!0}else{const ue=A.get(ht.band??0)??B;Oe=ue>B?"down":ue<B?"up":void 0}Oe&&(ge[Ce?"out":"in"].add(Oe),X&&ge.cross.add(Oe))}for(const me of["up","down"])ge.in.has(me)&&ge.out.has(me)&&ge.cross.has(me)&&I.add(me)}if(I.size!==1)continue;const[F]=I,j=Math.max(...A.values()),$=F==="down"?j:0;if(B===$)continue;const Y=[...A.entries()].filter(([se])=>se!==0).sort((se,ge)=>se[1]-ge[1]),le=[...Array(j+1).keys()].filter(se=>se!==$),xe=new Map([[0,$]]);Y.forEach(([se],ge)=>xe.set(se,le[ge])),ve.set(C,xe)}}const q=b=>{var C;return(((C=ce.get(b))==null?void 0:C.size)??0)>1},V=b=>b.band??(b.node.lane||!q(`pool:${b.node.participant??""}`)?void 0:0),ne=new Map,Te=b=>ne.get(b.node.id)??V(b),Pe=new Set,L=new Set;{const b=new Map;for(const O of M)b.set(O.flow.target,(b.get(O.flow.target)??0)+1);const C=O=>{const B=[],I=new Set([O]),F=[O];for(;F.length;){const j=F.shift();B.push(j);for(const $ of M)$.flow.source!==j||I.has($.flow.target)||(b.get($.flow.target)??0)!==1||(I.add($.flow.target),F.push($.flow.target))}return B},A=(O,B)=>{var I;return((I=ve.get(O))==null?void 0:I.get(B))??B};for(const O of y){if(!O.node.type.endsWith("Gateway"))continue;const B=O.node.lane??`pool:${O.node.participant??""}`,I=ve.get(B);if(!I||I.size<2)continue;const F=Te(O);if(F===void 0||A(B,F)!==A(B,0))continue;const j=A(B,F),$=M.filter(me=>me.flow.source===O.node.id).map(me=>P.get(me.flow.target)).filter(me=>!!me&&(me.node.lane??`pool:${me.node.participant??""}`)===B),Y=$.filter(me=>{const Ce=Te(me);return Ce!==void 0&&A(B,Ce)===j&&(b.get(me.node.id)??0)===1}),le=$.some(me=>{const Ce=Te(me);return Ce!==void 0&&A(B,Ce)>j});if(Y.length!==1||!le)continue;const xe=new Set($.flatMap(me=>C(me.node.id)));if(!M.some(me=>me.flow.target===O.node.id&&xe.has(me.flow.source)))continue;const ge=new Map;for(const[me,Ce]of I)ge.set(me,Ce+1);ge.set(-1,0),ve.set(B,ge);for(const me of C(Y[0].node.id))P.has(me)&&(ne.set(me,-1),L.add(me));Pe.add(O.node.id)}}const E=(b,C)=>{var A;return((A=ve.get(b))==null?void 0:A.get(C))??C},x=(b,C,A,O)=>{const B=b?f(b):C?f(C):void 0;if(!B)return!1;const I=b?B.y+Math.min(B.height/2,pe):B.y+Q;return Math.abs(I+E(b??`pool:${C??""}`,A)*D-O)<=D/2},G=new Map;for(const[b,C]of ce){let A=0;for(const O of C)A=Math.max(A,E(b,O));G.set(b,A)}const U=b=>Me+D*b,Z=(b,C,A)=>{const O=u().children.filter(B=>!("waypoints"in B&&B.waypoints)&&B.id!==C&&typeof B.y=="number"&&B.y>=b);O.length&&n.moveElements(O,{x:0,y:A})},Re=(b,C,A)=>{const O=b.type==="bpmn:Participant"?b:void 0;if(!O||O.children.some(j=>j.type==="bpmn:Lane"))return;const B=A+C.height/2+Be-O.y;if(O.height>=B)return;const I=B-O.height,F=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:B}),Z(F,O.id,I)},Ze=(b,C)=>{const A=C-b.height;if(A<=0)return;const O=d(b)??b,B=[],I=$=>{B.push($);for(const Y of $.children??[])I(Y)};I(O);const F=b.y+b.height-10,j=l.calculateAdjustments(B,"y",A,F);l.makeSpace(j.movingShapes,j.resizingShapes,{x:0,y:A},"s",F)},dt=(b,C,A)=>{if(b){const F=p(b),j=U(C);if(F.height>=j)return;const $=j-F.height,Y=d(F),le=Y?Y.y+Y.height:F.y+F.height;Ze(F,j),Z(le,Y==null?void 0:Y.id,$);return}if(!A)return;const O=D*(C+1);if(A.height>=O)return;const B=O-A.height,I=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:O}),Z(I,A.id,B)},Vt=new Map;for(const b of M)Vt.set(b.flow.target,(Vt.get(b.flow.target)??0)+1);const wt=b=>(Vt.get(b)??0)<=1,ln=(b,C)=>{if(!b)return;const A=f(b);if(!A||A.height>=U(C))return;const O=A.y+A.height-10,B=d(A);if(B)return new Set((B.children??[]).filter(I=>I.type!=="bpmn:Lane"&&typeof I.y=="number"&&I.y>O).map(I=>I.id))},mn=(b,C,A)=>{if(!b)return!0;const O=f(b);return O?A-C.height/2>=O.y&&A+C.height/2<=O.y+O.height:!0},yn=h.map((b,C)=>({op:b,declared:C}));yn.sort((b,C)=>{const A=b.op.order??Number.POSITIVE_INFINITY,O=C.op.order??Number.POSITIVE_INFINITY;return A!==O?A-O:b.declared-C.declared});let Et=80;for(const b of o.getAll())b.parent===u()&&"height"in b&&typeof b.y=="number"&&(Et=Math.max(Et,b.y+b.height+60));for(const{op:b}of yn){const C=b.participant,A=y.filter(se=>se.node.participant===C.id).length,O=((B0=C.lanes)==null?void 0:B0.length)??0,B=Math.max(1200,A*160+300),I=(C.lanes??[]).map(se=>U(G.get(se.id)??0)),F=I.reduce((se,ge)=>se+ge,0);O&&F<300&&(I[O-1]+=300-F);const j=Math.max(300,D*((G.get(`pool:${C.id}`)??0)+1)),$=C.blackBox||A+O===0?120:O?Math.max(300,F):j,Y=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:C.id,name:C.name,...b.order!==void 0?{"bwl:poolOrder":b.order}:{},...C.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:B,height:$,isExpanded:!0}),le=n.createShape(Y,{x:100+B/2,y:Et+$/2},u()),xe=C.lanes??[];if(xe.length&&n.splitLane(le,xe.length),xe.length){const se=o.filter(ge=>{var me;return ge.type==="bpmn:Lane"&&((me=d(ge))==null?void 0:me.id)===C.id}).sort((ge,me)=>ge.y-me.y);if(se.forEach((ge,me)=>{const Ce=xe[me];Ce&&n.updateProperties(ge,{id:Ce.id,name:Ce.name})}),I.some(ge=>ge!==le.height/O)){let ge=le.y;se.forEach((me,Ce)=>{const ht=I[Ce];n.resizeShape(me,{x:me.x,y:ge,width:me.width,height:ht}),ge+=ht})}}Et=le.y+le.height+60}const un=b=>{var O;const C=P.get(b);if(C)return C.node.participant??"";const A=f(b);return A?A.type==="bpmn:Participant"?A.id:((O=d(A))==null?void 0:O.id)??"":""},hn=new Map,bo=b=>{let C=hn.get(b);return C||hn.set(b,C={nodes:[],flows:[]}),C};for(const b of y)bo(b.node.participant??"").nodes.push(b);for(const b of M)bo(un(b.flow.source)).flows.push(b);const Zn=b=>{var C;return i.create("bpmn:SequenceFlow",{id:b.id,name:b.name??((C=b.condition)==null?void 0:C.label)})},xi=(b,C,A)=>r.createShape({type:sc(b.type),businessObject:i.create(sc(b.type),{id:b.id,name:b.name,...C!==void 0?{"bwl:band":C}:{},...A!==void 0?{"bwl:afterColumn":A}:{}})}),_i=[...yn.map(({op:b})=>b.participant.id).filter(b=>hn.has(b)),...[...hn.keys()].filter(b=>!h.some(C=>C.participant.id===b))],Kt=b=>b.endsWith("Gateway");for(const b of _i){const C=hn.get(b),A=b?p(b):void 0,O=A?A.x+150:250;let B=A?A.y+80:120;const I=(X,ue,ee)=>{if(X){const de=p(X);return de.y+Math.min(de.height/2,pe)+E(X,ue??0)*D}return ue!==void 0&&A?A.y+Q+E(`pool:${b}`,ue)*D:ee},F=(X,ue,ee)=>{if(X){const de=p(X);return de.y+Math.min(de.height/2,pe)+ue*D}return A?A.y+Q+ue*D:ee},j=X=>X.participant?p(X.participant):u(),$=(X,ue,ee,de,Ve,We,Ct)=>{const Ft=ee!==void 0||de!==void 0,he=E(ee??`pool:${b}`,de??0);if((de===void 0||x(ee,b,de,Ct??Number.NaN))&&Ct!==void 0&&mn(ee,ue,Ct)&&!K(X,ue,Ve,Ct))return{x:Ve,y:Ct};if(Ft)for(let fe=0;fe<4;fe++){const Le=F(ee,he+fe,We);if(!K(X,ue,Ve,Le,ln(ee,he+fe)))return dt(ee,he+fe,A),{x:Ve,y:Le}}const ye=I(ee,de,We);Ft?dt(ee,he,A):Re(X,ue,ye);let ie=Ve;for(let fe=0;fe<64;fe++){const Le=K(X,ue,ie,ye);if(!Le)break;ie=Le.x+Le.width+H+ue.width/2}return{x:ie,y:ye}},Y=new Set(C.flows.map(X=>X.flow.target)),le=new Map,xe=X=>{if(X===void 0)return;const ue=o.get(X);if(!(!ue||typeof ue.x!="number"||typeof ue.width!="number"))return ue.x+ue.width+H};for(const X of C.nodes){if(Y.has(X.node.id))continue;const ue=xi(X.node,X.band,X.afterColumn),ee=V(X),de=X.node.lane?`${X.node.lane}|${ee??""}`:ee!==void 0?`band:${ee}`:"",Ve=j(X.node),We=le.get(de)??O,Ct=xe(X.afterColumn),Ft=Ct===void 0?We:Math.max(We,Ct),he=$(Ve,ue,X.node.lane,ee,Ft,B);n.createShape(ue,he,Ve),le.set(de,he.x+ue.width+H),!X.node.lane&&ee===void 0&&(B+=160)}const se=new Set,ge=new Map,me=new Map,Ce=new Map;if(b&&J.has(`pool:${b}`)){const X=new Map;for(const he of C.flows)X.set(he.flow.target,(X.get(he.flow.target)??0)+1);const ue=he=>I(he.node.lane,Te(he),Number.NaN),ee=new Set,de=he=>{var fe;const ye=(fe=P.get(he))==null?void 0:fe.node.participant;if(ye)return f(ye);const ie=f(he);if(ie)return ie.type==="bpmn:Participant"?ie:d(ie)},Ve=he=>{const ye=[],ie=new Set([he]),fe=[he];for(;fe.length;){const Le=fe.shift(),qe=P.get(Le);qe&&ye.push(qe);for(const ke of C.flows)ke.flow.source!==Le||ie.has(ke.flow.target)||(X.get(ke.flow.target)??0)!==1||(ie.add(ke.flow.target),fe.push(ke.flow.target))}return ye},We=he=>{if(!A)return;const ye=new Set(he.map(Le=>Le.node.id));let ie=!1,fe=!1;for(const Le of _){if(!ye.has(Le.flow.source))continue;const qe=de(Le.flow.target);!qe||qe.id===A.id||(qe.y<A.y?ie=!0:fe=!0)}return ie&&!fe?"up":fe&&!ie?"down":void 0};for(const he of C.nodes){if(!Kt(he.node.type))continue;const ye=I(he.node.lane,V(he),Number.NaN);if(Number.isNaN(ye))continue;const ie=[];for(const ke of C.flows){if(ke.flow.source!==he.node.id)continue;const He=P.get(ke.flow.target);if(!He||He.node.lane!==he.node.lane||(X.get(He.node.id)??0)!==1)continue;const Qe=V(He);if(Qe===void 0)continue;const we=I(He.node.lane,Qe,Number.NaN);if(Number.isNaN(we))continue;const lt=Ve(He.node.id),Ae=We(lt);Ae&&ie.push({subtree:lt,band:Qe,row:we,dir:Ae})}if(!ie.some(ke=>ke.dir==="up")||!ie.some(ke=>ke.dir==="down")||!ie.some(ke=>ke.dir==="up"&&ie.some(He=>He.dir==="down"&&He.row<ke.row)))continue;const Le=[...ie].sort((ke,He)=>ke.row-He.row);[...ie.filter(ke=>ke.dir==="up"),...ie.filter(ke=>ke.dir==="down")].sort((ke,He)=>ke.dir===He.dir?ke.row-He.row:ke.dir==="up"?-1:1).forEach((ke,He)=>{const Qe=Le[He].band;if(Qe!==ke.band){ee.add(he.node.id);for(const we of ke.subtree)V(we)===ke.band&&ne.set(we.node.id,Qe)}})}const Ct=he=>{if(!A)return;const ye=new Set(he.map(Le=>Le.node.id));let ie=!1,fe=!1;for(const Le of _){if(!ye.has(Le.flow.target))continue;const qe=de(Le.flow.source);!qe||qe.id===A.id||(qe.y<A.y?ie=!0:fe=!0)}return ie&&!fe?"up":fe&&!ie?"down":void 0};for(const he of C.nodes){if(!Kt(he.node.type))continue;const ye=he.node.lane??`pool:${b}`,ie=ve.get(ye);if(!ie||ie.size<2)continue;const fe=ie.get(0);if(fe===void 0)continue;const Le=Math.max(...ie.values()),qe=fe===Le&&fe!==0?"down":void 0;if(!qe)continue;const ke=[];for(const Ae of C.flows){if(Ae.flow.source!==he.node.id)continue;const St=P.get(Ae.flow.target);if(!St||St.node.lane!==he.node.lane||(X.get(St.node.id)??0)!==1)continue;const _t=Te(St);_t!==void 0&&ke.push({t:St,subtree:Ve(St.node.id),band:_t})}const He=ke.find(Ae=>(ie.get(Ae.band)??Ae.band)===fe);if(!He||Ct(He.subtree)===qe||We(He.subtree)===qe)continue;const Qe=ke.find(Ae=>Ae!==He&&Ct(Ae.subtree)===qe);if(!Qe)continue;const we=He.band,lt=Qe.band;for(const Ae of He.subtree)Te(Ae)===we&&ne.set(Ae.node.id,lt);for(const Ae of Qe.subtree)Te(Ae)===lt&&ne.set(Ae.node.id,we);ee.add(he.node.id)}for(const he of C.nodes){if(!Kt(he.node.type))continue;const ye=ue(he);if(Number.isNaN(ye)||w.some(ke=>{var He,Qe;return(((He=ke.placement)==null?void 0:He.anchor)??(ke.association?ke.association.source===ke.annotation.id?ke.association.target:ke.association.source:void 0))===he.node.id&&((Qe=ke.placement)==null?void 0:Qe.side.startsWith("bottom"))}))continue;let fe,Le=!1,qe;for(const ke of C.flows){if(ke.flow.source!==he.node.id)continue;const He=P.get(ke.flow.target);if(!He||!He.node.lane&&V(He)===void 0)continue;const Qe=ue(He);Number.isNaN(Qe)||(Math.abs(Qe-ye)<.5&&(Le=!0),Qe>ye?!fe||Qe>fe.row?fe={id:He.node.id,row:Qe,count:1}:Qe===fe.row&&fe.count++:Qe<ye&&He.node.lane===he.node.lane&&(!qe||Qe>qe.row?qe={op:He,row:Qe,count:1}:Qe===qe.row&&qe.count++))}fe&&fe.count===1&&(X.get(fe.id)??0)===1&&!ee.has(he.node.id)&&se.add(fe.id),!Le&&qe&&qe.count===1&&(X.get(qe.op.node.id)??0)===1&&!Pe.has(he.node.id)&&ge.set(qe.op.node.id,{lane:he.node.lane,band:Te(he)})}const Ft=new Map;for(const he of _)Ft.set(he.flow.target,[...Ft.get(he.flow.target)??[],he]);for(const he of C.nodes){const ye=Ft.get(he.node.id);if(!ye||ye.length!==1||!X.get(he.node.id)||!he.node.lane&&V(he)===void 0||L.has(he.node.id))continue;const ie=(N0=P.get(ye[0].flow.source))==null?void 0:N0.node.participant,fe=ie?f(ie):void 0;if(!fe||!A||fe.id===A.id)continue;const Le=he.node.lane??`pool:${b}`,qe=ve.get(Le);if(!qe)continue;const ke=qe.get(0)??0,He=(qe.get(Te(he)??0)??ke)-ke;if(He===0)continue;const Qe=fe.y<A.y;if(Qe&&He<0||!Qe&&He>0)continue;let we;for(const[lt,Ae]of qe){const St=Ae-ke;(Qe&&St<0&&(!we||St<we.row)||!Qe&&St>0&&(!we||St>we.row))&&(we={band:lt,row:St})}we&&me.set(he.node.id,{lane:he.node.lane,band:we.band})}}const ht=new Set;let Oe=0;for(;Oe++<C.nodes.length+2;){for(let ee=0;ee<C.nodes.length+C.flows.length+2;ee++){let de=!1;for(const Ve of C.flows){const We=Ve.flow;if(ht.has(We.id))continue;const Ct=f(We.source);if(!Ct)continue;const Ft=f(We.target),he=P.get(We.target);if(!Ft&&he){const ye=xi(he.node,he.band),ie=Te(he);if(he.node.lane||ie!==void 0){const fe=j(he.node),Le=Ct,qe=Le.x+(Ce.get(We.source)??0)+Le.width+H,ke=ge.get(We.target)??me.get(We.target),He=$(fe,ye,ke?ke.lane:he.node.lane,ke?ke.band:ie,se.has(We.target)?Le.x+Le.width/2:qe,Number.NaN,ke||!wt(We.target)?void 0:Le.y+Le.height/2),Qe=n.createShape(ye,He,fe);se.has(We.target)&&Ce.set(We.target,qe-(Qe.x+Qe.width/2)),n.connect(Ct,Qe,{type:"bpmn:SequenceFlow",businessObject:Zn(We)})}else s.append(Ct,ye,{connection:{type:"bpmn:SequenceFlow",businessObject:Zn(We)}})}else if(Ft)n.connect(Ct,Ft,{type:"bpmn:SequenceFlow",businessObject:Zn(We)});else continue;ht.add(We.id),de=!0}if(!de)break}const X=C.nodes.filter(ee=>!f(ee.node.id));if(!X.length)break;const ue=X[0];{const ee=xi(ue.node,ue.band),de=j(ue.node),Ve=V(ue);n.createShape(ee,$(de,ee,ue.node.lane,Ve,O,B),de),!ue.node.lane&&Ve===void 0&&(B+=160)}}}const wi=40,Ts=b=>{const C=()=>new Set(vt(Xe(o)).map(Y=>mt(Y))),A=C(),O=b.waypoints.map(Y=>({x:Y.x,y:Y.y})),B=b.label,I=B&&{x:B.x,y:B.y};n.layoutConnection(b,{waypoints:[]});const F=C(),j=[...F].filter(Y=>!A.has(Y)).length,$=[...A].filter(Y=>!F.has(Y)).length;j<=$||(n.updateWaypoints(b,O),B&&I&&(B.x!==I.x||B.y!==I.y)&&n.moveElements([B],{x:I.x-B.x,y:I.y-B.y}))},Qn=5,ct=10,xt=200,bu=new Set([...M.map(b=>b.flow.id),..._.map(b=>b.flow.id),...Xt(e,"sequenceFlow.update").map(b=>b.id),...Xt(e,"messageFlow.update").map(b=>b.id)].filter(b=>!!b)),RB=(b,C,A,O,B,I)=>{const F=new Set(b.map(X=>X.id)),j=Math.min(...b.map(X=>X.x))+C-ct,$=Math.max(...b.map(X=>X.x+X.width))+C+xt+ct,Y=Math.min(...b.map(X=>X.y+Math.min(0,...A)))-ct,le=Math.max(...b.map(X=>X.y+X.height+Math.max(0,...A)))+ct,xe=o.getAll().filter(X=>{if(X.type!=="bpmn:SequenceFlow"&&X.type!=="bpmn:MessageFlow")return!1;const ue=X;return bu.has(ue.id)||!ue.waypoints||ue.waypoints.length<2||[ue.source,ue.target].some(de=>!de||F.has(de.id)||de.x>=O)?!1:ue.waypoints.some((de,Ve)=>{const We=ue.waypoints[Ve+1];return!!We&&Math.max(de.x,We.x)>=j&&Math.min(de.x,We.x)<=$&&Math.max(de.y,We.y)>=Y&&Math.min(de.y,We.y)<=le})});if(!xe.length)return 0;const se=X=>{const ue=new Map;for(const ee of b)for(const de of A){const Ve={id:ee.id,type:ee.type,x:ee.x+C+X,y:ee.y+de,width:ee.width,height:ee.height};for(const We of xe){let Ct=1/0;for(let he=0;he+1<We.waypoints.length;he++)Ct=Math.min(Ct,Qs(We.waypoints[he],We.waypoints[he+1],Ve));const Ft=`${We.id}|${ee.id}`;ue.set(Ft,Math.min(ue.get(Ft)??1/0,Ct))}}return ue},ge=[...se(0)].filter(([,X])=>X<=Qn).map(([X])=>X);if(!ge.length)return 0;let me=0;for(let X=1;X<=xt;X++){const ue=se(X);if([...ue.values()].every(ee=>ee>Qn)&&ge.every(ee=>(ue.get(ee)??1/0)>=ct)){me=X;break}}if(!me)return 0;const Ce=Math.min(...b.map(X=>X.x))+C+me,ht=new Set(ge.map(X=>X.slice(0,X.indexOf("|"))));return xe.some(X=>X.type==="bpmn:SequenceFlow"&&ht.has(X.id)&&X.waypoints.some((ue,ee)=>{const de=X.waypoints[ee+1];if(!de||Math.min(ue.y,de.y)>I||Math.max(ue.y,de.y)<I||ue.y===de.y)return!1;const Ve=ue.x+(I-ue.y)*(de.x-ue.x)/(de.y-ue.y);return Ve>B&&Ve<Ce}))?0:me},xo=(b,C=()=>!0)=>{const A=f(b);if(!A)return[];const O=[A],B=new Set([b]);for(let I=0;I<O.length;I++){const F=O[I].id;for(const j of M){const $=j.flow.target;if(j.flow.source!==F||B.has($)||!P.has($))continue;B.add($);const Y=f($);Y&&C(Y)&&O.push(Y)}}return O},CB=(b,C=()=>!0)=>{const A=f(b);if(!A)return[];const O=[A],B=new Set([b]);for(let I=0;I<O.length;I++){const F=O[I].id;for(const j of M){const $=j.flow.source;if(j.flow.target!==F||B.has($)||!P.has($))continue;B.add($);const Y=f($);Y&&C(Y)&&O.push(Y)}}return O},Ui=30,fr=b=>!("waypoints"in b&&b.waypoints)&&b.type!=="bpmn:Lane"&&b.type!=="label"&&typeof b.x=="number",xu=(b,C)=>sp(n,b,C),ks=(b,C)=>{const A=new Set(b.flatMap(F=>F.subtree.map(j=>j.id)));for(const F of b){const j=(F.pool.children??[]).filter(fr).filter(Y=>!A.has(Y.id));if(F.subtree.some(Y=>j.some(le=>Y.x+C<le.x+le.width+Ui&&Y.x+C+Y.width+Ui>le.x&&Y.y<le.y+le.height&&Y.y+Y.height>le.y)))return null}const O=b.map(F=>F.pool.width),B=o.filter(F=>F.type==="label").map(F=>({label:F,x:F.x,y:F.y}));n.moveElements(b.flatMap(F=>F.subtree),{x:C,y:0});const I=b.map(F=>{const $=Math.max(...F.subtree.map(Y=>Y.x+Y.width))+Ug-(F.pool.x+F.pool.width);return $>0&&xu(F.pool,F.pool.width+$),$});return()=>{n.moveElements(b.flatMap(F=>F.subtree),{x:-C,y:0}),b.forEach((F,j)=>{I[j]>0&&xu(F.pool,O[j])});for(let F=0;F<3;F++){let j=0;for(const $ of B){const Y=$.x-$.label.x,le=$.y-$.label.y;Math.abs(Y)<=.5&&Math.abs(le)<=.5||(n.moveElements([$.label],{x:Y,y:le}),j++)}if(!j)break}}},rh=b=>{var B,I;const C=new Map,A=new Map;for(const F of o.getAll()){if(F.type!=="bpmn:Participant")continue;const j=F;(j.children??[]).length||(C.set(j.id,j),A.set(j.id,[]))}for(const F of o.getAll()){if(F.type!=="bpmn:MessageFlow")continue;const j=F,$=(B=j.source)==null?void 0:B.id,Y=(I=j.target)==null?void 0:I.id;$&&Y&&A.has($)&&A.get($).push(Y),$&&Y&&A.has(Y)&&A.get(Y).push($)}const O=[];for(const[F,j]of A)j.length&&j.every($=>b.has($))&&O.push(C.get(F));return O},d0=(b,C)=>{if(!b.length)return null;const A=new Set(b.map(F=>F.id)),O=o.getAll().filter(F=>F.type==="bpmn:Participant"&&!A.has(F.id));if(b.some(F=>O.some(j=>F.x+C<j.x+j.width+Ui&&F.x+C+F.width+Ui>j.x&&F.y<j.y+j.height&&F.y+F.height>j.y)))return null;const I=o.filter(F=>F.type==="label").map(F=>({label:F,x:F.x,y:F.y}));return n.moveElements(b,{x:C,y:0}),()=>{n.moveElements(b,{x:-C,y:0});for(let F=0;F<3;F++){let j=0;for(const $ of I){const Y=$.x-$.label.x,le=$.y-$.label.y;Math.abs(Y)<=.5&&Math.abs(le)<=.5||(n.moveElements([$.label],{x:Y,y:le}),j++)}if(!j)break}}},h0=()=>{let b=0;for(const C of o.getAll()){if(C.type!=="bpmn:DataInputAssociation"&&C.type!=="bpmn:DataOutputAssociation")continue;const A=C.waypoints??[];for(let O=1;O<A.length;O++)b+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return b},g0=()=>{let b=0;for(const C of o.getAll()){if(C.type!=="bpmn:Association")continue;const A=C.waypoints??[];for(let O=1;O<A.length;O++)b+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return b},MB=b=>{const C=[];for(const A of o.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const O=A;if(b.has(O.id))continue;const I=[...O.incoming??[],...O.outgoing??[]].filter($=>$.type==="bpmn:Association").map($=>$.source===O?$.target:$.source);if(!I.length||I.some($=>$===void 0))continue;const F=$=>{if(!("waypoints"in $&&$.waypoints))return[$.id];const Y=$,le=[Y.source,Y.target];return le.some(xe=>!xe)?[]:le.map(xe=>xe.id)},j=I.flatMap($=>F($));j.length&&j.every($=>b.has($))&&C.push(O)}return C},m0=()=>vt(Xe(o)).filter(b=>b.kind==="edge-crosses-shape").length,y0=b=>{const C=(b.children??[]).filter(fr);let A=0;for(let O=0;O<C.length;O++)for(let B=O+1;B<C.length;B++){const I=C[O],F=C[B];I.x<F.x+F.width&&I.x+I.width>F.x&&I.y<F.y+F.height&&I.y+I.height>F.y&&A++}return A},ba=()=>{const b=Xe(o),C=A=>A.length>=2&&(A.every(O=>Math.abs(O.x-A[0].x)<.01)||A.every(O=>Math.abs(O.y-A[0].y)<.01));return{messages:b.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:b.edges.filter(A=>C(A.waypoints)).length}},v0=b=>{const C=new Map;for(const O of o.getAll()){if(O.type!=="bpmn:MessageFlow")continue;const B=O;if(!B.waypoints||B.waypoints.length!==2)continue;const I=B.source,F=B.target;if(!I||!F)continue;const j=b.has(I.id);if(j===b.has(F.id))continue;const $=j?F:I,Y=d($);if(!Y||b.has($.id))continue;const le=C.get(Y.id);le?$.x<le.minX&&(le.minX=$.x):C.set(Y.id,{pool:Y,minX:$.x})}const A=[];for(const{pool:O,minX:B}of C.values()){const I=(O.children??[]).filter(F=>fr(F)&&!b.has(F.id)&&F.x>=B);I.length&&A.push({subtree:I,pool:O})}return A},AB=(b,C,A)=>{const O=new Map(C.map(F=>[F.pool.id,{subtree:[...F.subtree],pool:F.pool}])),B=new Set(b);for(const F of C)for(const j of F.subtree)B.add(j.id);let I=!1;for(;;){let F=0;for(const j of v0(B)){if(j.pool===A)continue;const $=O.get(j.pool.id);$?$.subtree.push(...j.subtree):O.set(j.pool.id,{subtree:[...j.subtree],pool:j.pool});for(const Y of j.subtree)B.add(Y.id);F+=j.subtree.length}if(!F)break;I=!0}return I?[...O.values()]:null},b0=new Map;for(const b of Xt(e,"sequenceFlow.update")){if(b.target===void 0)continue;const C=P.get(b.target);if(!C)continue;const A=f(b.target),O=f(b.id);if(!A||!O)continue;const B=b.source!==void 0?f(b.source):O.source,I=O.target;if(!B||!I||I.id===A.id)continue;const F=O.waypoints&&O.waypoints.length>=3&&Math.abs(O.waypoints[0].x-O.waypoints[1].x)<1&&Math.abs(O.waypoints[0].y-O.waypoints[1].y)>1?{x:O.waypoints[0].x,y:O.waypoints[0].y}:void 0,j=F?O.waypoints[1].y:void 0,$=F&&O.label?{x:O.label.x,y:O.label.y}:void 0,Y=$&&O.label&&Math.abs($.y+O.label.height/2-j)<=D/5&&$.x+O.label.width>F.x?$.x+O.label.width+6:void 0,le=(B.outgoing??[]).filter(we=>we.type==="bpmn:SequenceFlow"&&we.id!==O.id&&we.target&&!bu.has(we.id)),xe=new Set(le.map(we=>we.target.id)),se=we=>{const lt={type:"bpmn:Task",x:we.x+2,y:we.y+2,width:we.width-4,height:we.height-4};return le.find(Ae=>(Ae.waypoints??[]).some((St,_t)=>!!Ae.waypoints[_t+1]&&Qs(St,Ae.waypoints[_t+1],lt)===0))},ge=xo(b.target),me=new Set(ge.map(we=>we.id)),Ce=Math.min(...ge.map(we=>we.x)),ht=Math.max(...ge.map(we=>we.x+we.width)),Oe=B.x+B.width,X=A.y+A.height/2,ue=RB(ge,Oe+wi-Ce,[0,B.y+B.height/2-X,I.y+I.height/2-X],I.x,Oe,B.y+B.height/2),ee=Oe+wi+ue,de=(()=>{if(Y===void 0)return 0;const we=Oe+wi,lt=B.y+B.height/2-A.height/2,Ae={x:we,y:lt,width:ht-Ce,height:A.height},St=d(B);return((St==null?void 0:St.children)??[]).some(yt=>fr(yt)&&!me.has(yt.id)&&yt.id!==B.id&&yt.id!==I.id&&yt.type!=="bpmn:Group"&&yt.type!=="bpmn:Participant"&&yt.x<Ae.x+Ae.width&&yt.x+yt.width>Ae.x&&yt.y<Ae.y+Ae.height&&yt.y+yt.height>Ae.y)||se(Ae)?Math.max(0,Y-we):0})(),Ve=ht-Ce+wi*2+ue+de-(I.x-Oe);let We=[];if(Ve>0){const we=d(A),lt=(we==null?void 0:we.children)??[],Ae=rt=>rt.type==="bpmn:Lane";We=(()=>{const rt=new Set;for(const bt of lt)fr(bt)&&!me.has(bt.id)&&bt.id!==B.id&&bt.x>=I.x&&rt.add(bt.id);const et=[];for(const bt of lt){if(bt.type!=="bpmn:DataStoreReference"&&bt.type!=="bpmn:DataObjectReference")continue;const Ke=bt,kn=[...Ke.incoming??[],...Ke.outgoing??[]].filter(Yt=>Yt.type==="bpmn:DataInputAssociation"||Yt.type==="bpmn:DataOutputAssociation").map(Yt=>Yt.source===Ke?Yt.target:Yt.source);kn.length&&kn.every(Yt=>Yt!==void 0&&rt.has(Yt.id))&&et.push(Ke)}return et})();const _t=lt.filter(rt=>!("waypoints"in rt&&rt.waypoints)&&!Ae(rt)&&!me.has(rt.id)&&rt.id!==B.id&&rt.x>=I.x),yt=we?[we,...lt.filter(rt=>Ae(rt))]:[];if(_t.length){const rt=new Set(_t.map(Bt=>Bt.id)),et=v0(rt),bt=et.length?AB(rt,et,we):null,Ke=Bt=>{const je=new Set(rt);for(const gt of Bt)for(const Tt of gt.subtree)je.add(Tt.id);return MB(je)},Ot=Ke(et),kn=bt?Ke(bt):Ot,Yt=rh(rt),Ei=new Set(rt);for(const Bt of et)for(const je of Bt.subtree)Ei.add(je.id);const fh=et.length?rh(Ei):Yt,Ru=(()=>{if(!bt)return[];const Bt=new Set(rt);for(const je of bt)for(const gt of je.subtree)Bt.add(gt.id);return rh(Bt)})();n.createSpace(_t,yt,{x:Ve,y:0},"e",I.x-1);const Is=(Bt,je)=>{const gt=ba(),Tt=ks(Bt,Ve);if(!Tt)return!1;const In=je.length?d0(je,Ve):null,dr=ba();return dr.messages>gt.messages&&dr.lines>=gt.lines?!0:(In==null||In(),Tt(),!1)},Bs=bt?Is(bt,Ru):!1;let Ns=Bs;!Ns&&et.length&&(Ns=Is(et,fh));const _a=Bs?kn:Ot;if(!Ns){for(const Bt of et){const je=ba(),gt=ks([Bt],Ve);if(!gt)continue;const Tt=ba();(Tt.messages<=je.messages||Tt.lines<je.lines)&&gt()}if(Yt.length){const Bt=ba(),je=d0(Yt,Ve);if(je){const gt=ba();(gt.messages<=Bt.messages||gt.lines<Bt.lines)&&je()}}}if(_a.length){const Bt=()=>new Set(vt(Xe(o)).map(gt=>mt(gt))),je=gt=>{const Tt=g0(),In=Bt(),dr=gt.map(ot=>({a:ot,x:ot.x,y:ot.y})),qr=o.filter(ot=>ot.type==="label").map(ot=>({label:ot,x:ot.x,y:ot.y}));n.moveElements(gt,{x:Ve,y:0});const dh=[...Bt()].filter(ot=>!In.has(ot));if(g0()<Tt&&dh.length===0)return!0;for(const{a:ot,x:ai,y:Ai}of dr)(ot.x!==ai||ot.y!==Ai)&&n.moveElements([ot],{x:ai-ot.x,y:Ai-ot.y});for(const ot of qr){const ai=ot.x-ot.label.x,Ai=ot.y-ot.label.y;(ai!==0||Ai!==0)&&n.moveElements([ot.label],{x:ai,y:Ai})}return!1};if(!je(_a)&&_a.length>1)for(const gt of _a)je([gt])}}}const Ct=C.node.lane!==void 0?f(C.node.lane):C.node.participant!==void 0?f(C.node.participant):void 0,Ft=we=>{if(!Ct)return!0;const lt=we.y+we.height/2;return lt>=Ct.y&&lt<=Ct.y+Ct.height},he=!Ft(B)&&Ft(I)?I:B,ye=he.y+he.height/2,ie=ye-(A.y+A.height/2),fe=C.band!==void 0,Le=fe?[A]:ge,qe=(C.band===void 0||x(C.node.lane,C.node.participant,C.band,ye))&&wt(b.target)&&Le.every(we=>{var lt;return mn((lt=P.get(we.id))==null?void 0:lt.node.lane,we,we.y+we.height/2+ie)}),ke=we=>Math.abs(we.y+we.height/2-(A.y+A.height/2))<=D/2;if(qe&&fe){const we=Math.abs(ie)<=D/2?ge.filter(lt=>lt.id!==A.id&&ke(lt)):[];if(n.moveElements(ge,{x:ee-Ce,y:0}),n.moveElements([A],{x:0,y:ie}),we.length){const lt=()=>new Set(vt(Xe(o)).map(et=>mt(et))),Ae=lt(),St=o.filter(et=>et.type==="label").map(et=>({label:et,x:et.x,y:et.y}));n.moveElements(we,{x:0,y:ie});const _t=lt(),yt=[..._t].filter(et=>!Ae.has(et)).length,rt=[...Ae].filter(et=>!_t.has(et)).length;if(yt>rt){n.moveElements(we,{x:0,y:-ie});for(const et of St){const bt=et.x-et.label.x,Ke=et.y-et.label.y;(bt!==0||Ke!==0)&&n.moveElements([et.label],{x:bt,y:Ke})}}}}else n.moveElements(ge,{x:ee-Ce,y:qe?ie:0});const He=d(A);if(!qe&&C.node.lane===void 0&&C.band!==void 0&&He){const we=He.y+Q+E(`pool:${C.node.participant??""}`,C.band)*D,lt=we-(A.y+A.height/2);lt!==0&&!K(He,A,A.x+A.width/2,we,me)&&n.moveElements([A],{x:0,y:lt})}if(He){const we=(He.children??[]).filter(_t=>fr(_t)&&!me.has(_t.id)&&_t.type!=="bpmn:Group"&&_t.type!=="bpmn:Participant"),lt=(_t,yt,rt,et,bt)=>_t.x+yt<bt.x+bt.width+et&&_t.x+yt+_t.width+et>bt.x&&_t.y+rt<bt.y+bt.height+et&&_t.y+rt+_t.height+et>bt.y,Ae=we.find(_t=>lt(A,0,0,0,_t)),St=Ae?void 0:se(A);if(Ae||St){const _t=["bpmn:SequenceFlow","bpmn:MessageFlow","bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation"],yt=o.getAll().filter(je=>{if(!_t.includes(je.type))return!1;const gt=je;return bu.has(gt.id)||!gt.waypoints||gt.waypoints.length<2?!1:![gt.source,gt.target].some(Tt=>!Tt||me.has(Tt.id))}),rt=(je,gt,Tt)=>{var In;return mn((In=P.get(je.id))==null?void 0:In.node.lane,je,je.y+Tt+je.height/2)&&je.x+gt>=He.x&&je.x+gt+je.width<=He.x+He.width&&je.y+Tt>=He.y&&je.y+Tt+je.height<=He.y+He.height},et=(je,gt)=>ge.every(Tt=>rt(Tt,je,gt)&&!we.some(In=>lt(Tt,je,gt,ct,In))&&yt.every(In=>{const dr={id:Tt.id,type:Tt.type,x:Tt.x+je,y:Tt.y+gt,width:Tt.width,height:Tt.height};for(let qr=0;qr+1<In.waypoints.length;qr++)if(Qs(In.waypoints[qr],In.waypoints[qr+1],dr)<ct)return!1;return!0})),bt=A.y+A.height/2,Ke=[j,I.y+I.height/2].filter(je=>je!==void 0&&Math.abs(je-bt)>=1),Ot=Ae&&xe.has(Ae.id)?Ae:St==null?void 0:St.target,kn=Ot?Ot.x-A.x:0,Yt=Math.max(...ge.map(je=>je.x+je.width)),Ei=[...kn!==0?[kn]:[],...ue!==0?[-ue]:[],0],fh=Y===void 0?[]:Ei.map(je=>Math.max(je,Y-A.x)),Ru=je=>Yt+je+wi<=I.x,Is=[...new Set([...fh,...Ei])].filter(Ru),Bs=Ae&&xe.has(Ae.id)?[Ae.x+Ae.width+wi-A.x]:[],Ns=Y===void 0?[]:Bs.map(je=>Math.max(je,Y-A.x)),_a=[...new Set([...Ns,...Bs])].filter(je=>Ru(je)&&!Is.includes(je));let Bt;for(const je of[Is,_a]){for(const gt of Ke){for(const Tt of je)if(et(Tt,gt-bt)){Bt={dx:Tt,dy:gt-bt};break}if(Bt)break}if(Bt)break}if(Bt){const je=ot=>{const ai=ot;return[ai.edge,ai.other,...Array.isArray(ai.edges)?ai.edges:[]].some(Ai=>typeof Ai=="string"&&bu.has(Ai))},gt=()=>new Set(vt(Xe(o)).filter(ot=>!je(ot)).map(ot=>mt(ot))),Tt=gt(),In=o.filter(ot=>ot.type==="label").map(ot=>({label:ot,x:ot.x,y:ot.y}));n.moveElements(ge,{x:Bt.dx,y:Bt.dy});const dr=gt(),qr=[...dr].filter(ot=>!Tt.has(ot)).length,dh=[...Tt].filter(ot=>!dr.has(ot)).length;if(qr>dh){n.moveElements(ge,{x:-Bt.dx,y:-Bt.dy});for(const ot of In){const ai=ot.x-ot.label.x,Ai=ot.y-ot.label.y;(ai!==0||Ai!==0)&&n.moveElements([ot.label],{x:ai,y:Ai})}}else F&&b0.set(O.id,{exit:F,channelY:j,label:$})}}}{const we=new Set(ge.map(yt=>yt.id)),lt=new Set(M.map(yt=>yt.flow.id)),Ae=20,St=yt=>{const rt=yt.source,et=yt.target,bt=Math.min(rt.x,et.x)-Ae,Ke=Math.max(rt.x+rt.width,et.x+et.width)+Ae,Ot=Math.min(rt.y,et.y)-Ae,kn=Math.max(rt.y+rt.height,et.y+et.height)+Ae;return yt.waypoints.some(Yt=>Yt.x<bt||Yt.x>Ke||Yt.y<Ot||Yt.y>kn)},_t=new Map;for(const yt of ge)for(const rt of[...yt.incoming??[],...yt.outgoing??[]])rt.id!==b.id&&lt.has(rt.id)&&!(we.has(rt.source.id)&&we.has(rt.target.id))&&_t.set(rt.id,rt);for(const yt of _t.values())St(yt)&&Ts(yt)}const Qe=We.length?d(We[0]):void 0;if(Qe){const we={assoc:h0(),overlaps:y0(Qe),crosses:m0()},lt=We.map(Ke=>({st:Ke,x:Ke.x})),Ae=o.filter(Ke=>Ke.type==="label").map(Ke=>({label:Ke,x:Ke.x,y:Ke.y})),St=Math.min(...We.flatMap(Ke=>[...Ke.incoming??[],...Ke.outgoing??[]].filter(Ot=>Ot.type==="bpmn:DataInputAssociation"||Ot.type==="bpmn:DataOutputAssociation").map(Ot=>(Ot.source===Ke?Ot.target:Ot.source).x))),_t=new Set(We.map(Ke=>Ke.id)),yt=(Qe.children??[]).filter(fr).filter(Ke=>!_t.has(Ke.id));let rt=St;for(const Ke of[...We].sort((Ot,kn)=>Ot.x-kn.x)){let Ot=rt;for(let kn=0;kn<100;kn++){const Yt=yt.find(Ei=>Ot<Ei.x+Ei.width+Ui&&Ot+Ke.width+Ui>Ei.x&&Ke.y<Ei.y+Ei.height&&Ke.y+Ke.height>Ei.y);if(!Yt)break;Ot=Yt.x+Yt.width+Ui}Ot!==Ke.x&&n.moveElements([Ke],{x:Ot-Ke.x,y:0}),rt=Ot+Ke.width+Ui}const et=rt+150-(Qe.x+Qe.width);et>0&&xu(Qe,Qe.width+et);const bt={assoc:h0(),overlaps:y0(Qe),crosses:m0()};if(bt.assoc>=we.assoc||bt.overlaps>we.overlaps||bt.crosses>we.crosses){for(const{st:Ke,x:Ot}of lt)Ke.x!==Ot&&n.moveElements([Ke],{x:Ot-Ke.x,y:0});et>0&&xu(Qe,Qe.width-et);for(const Ke of Ae){const Ot=Ke.x-Ke.label.x,kn=Ke.y-Ke.label.y;(Ot!==0||kn!==0)&&n.moveElements([Ke.label],{x:Ot,y:kn})}}}}const x0=(b,C)=>{const A=C.target===b,O=p(C.source),B=p(C.target),I=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,B,C.id?{type:I,businessObject:i.create(I,{id:C.id})}:{type:I})},_0=100,w0=b=>{for(const C of h){if(!C.participant.blackBox)continue;const A=f(C.participant.id);if(!A)continue;const O=[];for(const I of _){const F=I.flow.source===C.participant.id?I.flow.target:I.flow.target===C.participant.id?I.flow.source:void 0,j=F?f(F):void 0;j&&typeof j.x=="number"&&j.type!=="bpmn:Participant"&&O.push(j)}if(!O.length)continue;if(!b&&C.order===void 0){const I=(()=>{var j;const F=new Map;for(const $ of O){const Y=d($);if(!Y)continue;const le=F.get(Y.id);le?le.n+=1:F.set(Y.id,{shape:Y,n:1})}return(j=[...F.values()].sort(($,Y)=>Y.n-$.n)[0])==null?void 0:j.shape})();if(I){const F=Y=>Y.reduce((le,xe)=>le+xe,0)/Y.length,j=F(O.map(Y=>Y.y+Y.height/2))<I.y+I.height/2,$=o.filter(Y=>Y.type==="bpmn:Participant"&&Y.id!==C.participant.id&&Y.id!==I.id).filter(Y=>j?Y.y+Y.height<=I.y+5:Y.y>=I.y+I.height-5);if($.length){const Y=[...$.reduce((ee,de)=>ee.set(de.y,(ee.get(de.y)??0)+1),new Map)].sort((ee,de)=>de[1]-ee[1]||(j?de[0]-ee[0]:ee[0]-de[0]))[0][0],le=Math.min(A.width,YS),xe=qS,se=O.map(ee=>ee.x+ee.width/2),ge=Math.round(F(se)-le/2),me=Math.max(...se)+_0,Ce=ee=>({x:ee,width:Math.max(le,me-ee)}),ht=$.filter(ee=>Math.min(ee.y+ee.height,Y+xe)-Math.max(ee.y,Y)>0),Oe=ee=>{const de=Ce(ee);return ht.some(Ve=>Ve.x<de.x+de.width&&de.x<Ve.x+Ve.width)},X=ee=>{const de=Ce(ee);return se.filter(Ve=>Ve>=de.x+10&&Ve<=de.x+de.width-10).length},ue=(()=>{if(!Oe(ge))return ge;const ee=X(ge);return ht.flatMap(de=>[de.x+de.width+Gg,de.x-Gg-le]).map(de=>Math.round(de)).filter(de=>!Oe(de)&&X(de)>=ee).sort((de,Ve)=>Math.abs(de-ge)-Math.abs(Ve-ge))[0]??ge})();if(ue!==A.x||Y!==A.y||le!==A.width||xe!==A.height){const ee=()=>new Set(vt(Xe(o)).map(he=>mt(he))),de=ee(),Ve={x:A.x,y:A.y,width:A.width,height:A.height};n.resizeShape(A,{x:ue,y:Y,width:le,height:xe});const We=ee(),Ct=[...We].filter(he=>!de.has(he)).length,Ft=[...de].filter(he=>!We.has(he)).length;Ct>Ft&&n.resizeShape(A,Ve)}}}}const B=Math.max(...O.map(I=>I.x+I.width/2))+_0;if(B>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:B-A.x,height:A.height}),!!b)for(const I of _){const F=f(I.flow.id),j=I.flow.source===C.participant.id?I.flow.target:I.flow.target===C.participant.id?I.flow.source:void 0,$=j?f(j):void 0;if(!F||!$||$.type==="bpmn:Participant")continue;const Y=$.x+$.width/2;if(Y<A.x+10||Y>A.x+A.width-10)continue;const le=A.y>$.y,xe=le?$.y+$.height:$.y,se=le?A.y:A.y+A.height,ge=I.flow.source===C.participant.id?[{x:Y,y:se},{x:Y,y:xe}]:[{x:Y,y:xe},{x:Y,y:se}],me=Xe(o),Ce={...me.edges.find(ht=>ht.id===I.flow.id),waypoints:ge};bn(Ce,ni(me)).length||n.updateWaypoints(F,ge)}}};w0(!1);for(const b of _){const C=b.flow;n.connect(p(C.source),p(C.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:C.id,name:C.name})})}{const A=new Set([...M.map($=>$.flow.id),..._.map($=>$.flow.id)].filter($=>!!$)),O=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,I=new Map,F=($,Y,le)=>{if(!$||!Y||typeof $.x!="number")return;const xe=B($,Y);if(!xe)return;let se=I.get($.id);se||I.set($.id,se=new Map),se.set(xe,[...se.get(xe)??[],le])};for(const $ of O){const Y=$.waypoints;!Y||Y.length<2||(F($.source,Y[0],{id:$.id,dir:"out"}),F($.target,Y[Y.length-1],{id:$.id,dir:"in"}))}const j=new Set;for(const[$,Y]of I){const le=f($);if(!le||typeof le.x!="number"||![...Y.values()].some(X=>{const ue=X.filter(ee=>ee.dir==="in");return X.length>=3&&ue.length>=1&&X.some(ee=>ee.dir==="out")&&ue.some(ee=>A.has(ee.id))}))continue;const se=d(le);if(!se||j.has(se.id)||(se.children??[]).some(X=>X.type==="bpmn:Lane"))continue;const ge=($0=Y.get("T"))!=null&&$0.length?(F0=Y.get("B"))!=null&&F0.length?void 0:"B":"T";if(!ge||(ge==="T"?le.y-se.y:se.y+se.height-(le.y+le.height))>=D)continue;const Ce=(se.children??[]).filter(X=>!("waypoints"in X&&X.waypoints)&&X.type!=="label"&&typeof X.x=="number"),ht=se.y+se.height;n.resizeShape(se,{x:se.x,y:se.y,width:se.width,height:se.height+D});const Oe=u().children.filter(X=>!("waypoints"in X&&X.waypoints)&&X.id!==se.id&&typeof X.y=="number"&&X.y>=ht);Oe.length&&n.moveElements(Oe,{x:0,y:D}),ge==="T"&&Ce.length&&n.moveElements(Ce,{x:0,y:D}),j.add(se.id)}}const oh=20,E0=4,PB=2,TB=[10,30,80],Ur=()=>{const b=Xe(o);return{bad:vt(b).filter(C=>C.kind==="edge-crosses-shape"||C.kind==="edge-overlap-opposite"||C.kind==="edge-overlap-mixed").length,crossings:ig(b),straight:b.edges.filter(C=>C.type==="bpmn:MessageFlow"&&C.waypoints.length===2).length}},xa=b=>{const C=Xe(o),A=C.edges.find(O=>O.id===b);return A?bn(A,ni(C)).length:0},_u=b=>xa(b)>0,wu=b=>Xe(o).edges.filter(C=>C.type==="bpmn:MessageFlow"&&C.id!==b&&C.waypoints.length===2).length,kB=(b,C,A)=>ks([{subtree:b,pool:C}],A),S0=(b,C)=>C.bad>b.bad||C.crossings>b.crossings&&C.straight<=b.straight&&C.bad>=b.bad,Eu=(b,C)=>S0(b,C)||C.straight<b.straight,Os=(b,C,A=()=>!0,O=S0)=>{const B=Ur(),I=ks(b,C);if(!I)return!1;const F=Ur();return O(B,F)||!A()?(I(),!1):!0},OB=(b,C,A,O=()=>!0)=>Os([{subtree:b,pool:C}],A,O),_o=b=>{var C;return!!((C=P.get(b))!=null&&C.node.participant)},Ds=new Map;for(const b of _){if(!_o(b.flow.target))continue;const C=Ds.get(b.flow.target)??[];C.push(b),Ds.set(b.flow.target,C)}const Su=[...Ds.keys()],ah=new Set(M.map(b=>b.flow.target)),R0=b=>yn.findIndex(({op:C})=>C.participant.id===b);Su.sort((b,C)=>{var B,I;const A=ah.has(b)?1:0,O=ah.has(C)?1:0;return A!==O?A-O:R0((B=P.get(b))==null?void 0:B.node.participant)-R0((I=P.get(C))==null?void 0:I.node.participant)});const Yr=b=>b.x+b.width/2,DB=b=>{const C=new Map;for(const B of o.getAll()){const I=B;if(!I.waypoints||!I.source||!I.target)continue;(C.get(I.source.id)??C.set(I.source.id,[]).get(I.source.id)).push(I.target.id)}const A=new Set([b]),O=[b];for(let B=0;B<O.length;B++)for(const I of C.get(O[B])??[])A.has(I)||(A.add(I),O.push(I));return A},LB=(b,C)=>{const A=DB(C);let O;for(const B of o.getAll()){const I=B;if(I.type!=="bpmn:MessageFlow"||!I.source||!I.target||I.target.id!==b||A.has(I.source.id))continue;const F=I.source;if(typeof F.x!="number"||F.type==="bpmn:Participant")continue;const j=Yr(F);(O===void 0||j>O)&&(O=j)}return O},sh=(b,C)=>{const A=f(b.flow.source);if(A)return A.type==="bpmn:Participant"?LB(A.id,C):Yr(A)},C0=b=>{let C;for(const A of Ds.get(b)??[]){const O=sh(A,b);O!==void 0&&(!C||O>C.cx)&&(C={op:A,cx:O})}return C==null?void 0:C.op},IB=b=>{const C=C0(b),A=f(b),O=C?sh(C,b):void 0;return A&&O!==void 0?O-Yr(A):void 0},BB=b=>{const C=IB(b);return C!==void 0&&Math.abs(C)<oh},ch=(b,C,A,O,B)=>{var I;for(let F=!0;F;){F=!1;for(const j of _){if(j.flow.id===A)continue;const $=C.has(j.flow.source),Y=C.has(j.flow.target);if($===Y||O($?j.flow.source:j.flow.target))continue;const le=$?j.flow.target:j.flow.source;if(B(le)||!_o(le))continue;const xe=f(j.flow.id);if(!(xe!=null&&xe.waypoints)||xe.waypoints.length!==2)continue;const se=f(le),ge=(I=P.get(le))==null?void 0:I.node.participant;if(!se||!ge)continue;const me=xo(le,Ce=>Ce.x>=se.x).filter(Ce=>!C.has(Ce.id));if(!(!me.length||me.some(Ce=>B(Ce.id)))){for(const Ce of me)C.add(Ce.id);b.set(ge,[...b.get(ge)??[],...me]),F=!0}}}return[...b].map(([F,j])=>({subtree:j,pool:p(F)}))},M0=(b,C,A,O,B)=>ch(new Map([[C,[...b]]]),new Set(b.map(I=>I.id)),O,I=>I===A,I=>I===B),lh=b=>{const C=C0(b);if(!C)return null;const A=f(b),O=f(C.flow.source),B=sh(C,b);if(!A||!O||B===void 0)return null;const I=B-Yr(A);if(I>=oh){const F=P.get(b).node.participant,j=xo(b,$=>$.x>=A.x);return{groups:M0(j,F,b,C.flow.id,C.flow.source),dx:I}}if(-I>=oh&&_o(C.flow.source)){const F=P.get(C.flow.source).node.participant,j=xo(C.flow.source,$=>$.x>=O.x&&!BB($.id));return{groups:M0(j,F,C.flow.source,C.flow.id,b),dx:-I}}return null},A0=()=>Su.map(b=>({id:b,plan:lh(b)})).filter(b=>!!b.plan).sort((b,C)=>Math.min(...b.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))-Math.min(...C.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))).map(b=>b.id);for(let b=0;b<3;b++){const C=Ur(),A=[];for(const B of A0()){const I=lh(B);if(!I)continue;const F=ks(I.groups,I.dx);F&&A.push(F)}if(!A.length)break;if(!Eu(C,Ur()))continue;for(const B of A.reverse())B();let O=!1;for(const B of A0()){const I=lh(B);I&&Os(I.groups,I.dx,()=>!0,Eu)&&(O=!0)}if(!O)break}for(const b of Su){if(ah.has(b))continue;const C=P.get(b);if(!C||C.node.lane!==void 0)continue;const A=V(C);if(A===void 0)continue;const O=f(b),B=O?d(O):void 0;if(!O||!B)continue;const I=B.y+Q+E(`pool:${C.node.participant??""}`,A)*D,F=I-(O.y+O.height/2);F!==0&&!K(B,O,O.x+O.width/2,I)&&n.moveElements([O],{x:0,y:F})}for(const b of Su.flatMap(C=>Ds.get(C)??[])){if(!_u(b.flow.id))continue;const C=f(b.flow.target);if(!C)continue;const A=p(P.get(b.flow.target).node.participant),O=xo(b.flow.target,j=>j.x>=C.x),B=C.width+H,I=xa(b.flow.id),F=wu(b.flow.id);for(let j=1;j<=E0;j++){const $=()=>xa(b.flow.id)<I&&wu(b.flow.id)>=F;if(OB(O,A,B*j,$))break}}const uh=_.map(b=>({id:b.flow.id,source:b.flow.source,target:b.flow.target,preexisting:!1})),P0=new Set(uh.map(b=>b.id));for(const b of o.filter(C=>C.type==="bpmn:MessageFlow"))P0.has(b.id)||!b.source||!b.target||b.source.type==="bpmn:Participant"!=(b.target.type==="bpmn:Participant")&&uh.push({id:b.id,source:b.source.id,target:b.target.id,preexisting:!0});for(const b of uh){if(!_u(b.id))continue;const C=f(b.source),A=f(b.target);if(!C||!A)continue;let O,B,I;if(b.preexisting){const[j,$]=C.type==="bpmn:Participant"?[A,C]:[C,A];if(O=Yr(j),O<$.x||O>$.x+$.width)continue;[B,I]=j.y<$.y?[j.y+j.height,$.y]:[$.y+$.height,j.y]}else{if(C.type==="bpmn:Participant"||A.type==="bpmn:Participant"||(O=C.x+C.width/2,Math.abs(O-(A.x+A.width/2))>15))continue;[B,I]=C.y<A.y?[C.y+C.height,A.y]:[A.y+A.height,C.y]}const F=[...P.values()].map(j=>f(j.node.id)).filter(j=>!!j&&j.id!==C.id&&j.id!==A.id).filter(j=>j.x<=O&&O<=j.x+j.width&&j.y+j.height>B&&j.y<I).sort((j,$)=>j.x-$.x);for(const j of F){const $=(j0=P.get(j.id))==null?void 0:j0.node.participant,Y=$?f($):void 0;if(!$||!Y)continue;const le=[...P.values()].filter(ue=>ue.node.participant===$).map(ue=>ue.node.id),xe=ue=>ue.map(ee=>f(ee)).filter(ee=>!!ee),ge=[CB(j.id,ue=>{var ee;return((ee=P.get(ue.id))==null?void 0:ee.node.participant)===$}),xe(le)].filter(ue=>ue.length).map(ue=>[{subtree:ue,pool:Y}]);if(b.preexisting){const ue=xe(le);ue.length&&ge.push(ch(new Map([[$,[...ue]]]),new Set(ue.map(ee=>ee.id)),b.id,()=>!1,ee=>ee===C.id||ee===A.id))}const me=j.width+H,Ce=xa(b.id),ht=wu(b.id),Oe=()=>xa(b.id)<Ce&&wu(b.id)>=ht;let X=!1;for(const ue of ge){for(let ee=1;ee<=E0;ee++)if(Os(ue,me*ee,Oe)){X=!0;break}if(X)break}if(!_u(b.id))break}}const T0=()=>{var C;const b=new Set;for(const A of vt(Xe(o)))A.kind!=="edge-crosses-shape"||P0.has(A.edge)||((C=f(A.edge))==null?void 0:C.type)==="bpmn:MessageFlow"&&b.add(`${A.edge}>${A.shape}`);return b},NB=(b,C)=>Ur().bad>=b&&[...T0()].some(A=>!C.has(A));for(const b of _){if(!_u(b.flow.id))continue;const C=f(b.flow.id);if(((H0=C==null?void 0:C.waypoints)==null?void 0:H0.length)!==2)continue;const A=f(b.flow.source),O=f(b.flow.target);if(!A||!O||A.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!_o(b.flow.source)||!_o(b.flow.target)||Math.abs(Yr(A)-Yr(O))>PB)continue;const B=Yr(A),I=C.waypoints.map(Ce=>Ce.y),[F,j]=[Math.min(...I),Math.max(...I)],$=ni(Xe(o)).filter(Ce=>Ce.id!==A.id&&Ce.id!==O.id&&Ce.x<B&&B<Ce.x+Ce.width&&F<Ce.y+Ce.height&&Ce.y<j);if(!$.length)continue;const Y=(z0=P.get(b.flow.source))==null?void 0:z0.node.participant,le=(G0=P.get(b.flow.target))==null?void 0:G0.node.participant;if(!Y||!le)continue;const xe=new Map;for(const[Ce,ht,Oe]of[[b.flow.source,A,Y],[b.flow.target,O,le]]){const X=xe.get(Oe)??[],ue=xo(Ce,ee=>ee.x>=ht.x).filter(ee=>!X.some(de=>de.id===ee.id));xe.set(Oe,[...X,...ue])}const se=new Set([...xe.values()].flat().map(Ce=>Ce.id)),ge=ch(xe,se,b.flow.id,Ce=>Ce===b.flow.source||Ce===b.flow.target,()=>!1),me=Math.max(...$.map(Ce=>Ce.x+Ce.width));for(const Ce of TB){const ht=me+Ce-B;if(ht<=0)continue;const Oe=Ur().bad,X=T0();if(Os(ge,ht,()=>{var ee,de;return xa(b.flow.id)===0&&((de=(ee=f(b.flow.id))==null?void 0:ee.waypoints)==null?void 0:de.length)===2&&!NB(Oe,X)},Eu))break}}{const b=A=>A.y+A.height/2,C=[];for(const A of P.keys()){if(!_o(A))continue;const O=M.filter(F=>F.flow.target===A);if(O.length!==1)continue;const B=f(O[0].flow.source),I=f(A);!B||!I||!P.has(B.id)||Math.abs(b(B)-b(I))>1||I.x-(B.x+B.width)<=H+1||C.push({id:A,pred:B,node:I})}C.sort((A,O)=>A.node.x-O.node.x);for(const{id:A}of C){const O=P.get(A),B=f(A),I=f(M.find(se=>se.flow.target===A).flow.source);if(!B||!I)continue;const F=B.x-(I.x+I.width);if(F<=H+1)continue;const j=p(O.node.participant),$=xo(A,se=>se.x>=B.x),Y=Ur(),le=kB($,j,-(F-H));if(!le)continue;const xe=Ur();(xe.bad>Y.bad||xe.crossings>=Y.crossings||xe.straight<Y.straight)&&le()}}w0(!0);for(const b of m){const C=b.associations??[],A=C.map(I=>I.source===b.dataStore.id?I.target:I.source).map(f).find(Boolean),O=A?d(A)??u():u(),B=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:Et+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:b.dataStore.id,name:b.dataStore.name})},B,O);for(const I of C)x0(b.dataStore.id,I)}for(const b of v){const A=p(b.association.target).type==="bpmn:DataStoreReference"?b.association.target:b.association.source;x0(A,b.association)}let k0=0;const wo=10,O0=40,$B=(b,C)=>{const A=C.map($=>d($)).filter($=>!!$);for(const $ of A){const Y=wo,le=$.y,xe=$.y+$.height,se=$.x,ge=$.x+$.width;if(Math.abs(b.y-le)<Y){const me=le+Y-b.y;b.y+=me,b.height-=me}if(Math.abs(b.y+b.height-xe)<Y&&(b.height=xe-Y-b.y),Math.abs(b.x-se)<Y){const me=se+Y-b.x;b.x+=me,b.width-=me}Math.abs(b.x+b.width-ge)<Y&&(b.width=ge-Y-b.x)}if(!A.length)return;const O=Math.min(...A.map($=>$.y)),B=Math.max(...A.map($=>$.y+$.height)),I=O-b.y,F=b.y+b.height-B,j=O0-wo;if(I>0!=F>0)if(I>0&&I<j){const $=I+wo;b.y+=$,b.height-=$}else F>0&&F<j&&(b.height-=F+wo)},FB=(b,C)=>{const A=wo,O=30,B=o.filter(I=>I.type==="bpmn:Group"&&I.id!==C);for(const I of B){const F=I.x,j=I.x+I.width,$=I.y,Y=I.y+I.height,le=b.y<Y&&$<b.y+b.height,xe=b.x<j&&F<b.x+b.width;if(le){if(Math.abs(b.x-j)<A){const se=Math.min(j+A-b.x,O);se>0&&b.width-se>0&&(b.x+=se,b.width-=se)}if(Math.abs(b.x+b.width-F)<A){const se=Math.min(b.x+b.width-(F-A),O);se>0&&b.width-se>0&&(b.width-=se)}}if(xe){if(Math.abs(b.y-Y)<A){const se=Math.min(Y+A-b.y,O);se>0&&b.height-se>0&&(b.y+=se,b.height-=se)}if(Math.abs(b.y+b.height-$)<A){const se=Math.min(b.y+b.height-($-A),O);se>0&&b.height-se>0&&(b.height-=se)}}}},ph=(b,C)=>{const A=O0,O=Math.min(...b.map($=>$.x))-A,B=Math.min(...b.map($=>$.y))-A,I=Math.max(...b.map($=>$.x+$.width))+A,F=Math.max(...b.map($=>$.y+$.height))+A,j={x:O,y:B,width:I-O,height:F-B};return $B(j,b),FB(j,C),j};for(const b of R){const C=(b.group.members??[]).map(f).filter(B=>!!B);let A;C.length?A=ph(C,b.group.id):(A={x:300+k0*350,y:40,width:300,height:200},k0++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:b.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());b.group.name&&n.updateLabel(O,b.group.name),(V0=b.group.members)!=null&&V0.length&&T(O,"bwl:Members",{refs:b.group.members.join(" ")})}{const b=o.filter(B=>!!B.waypoints),C=new Map,A=(B,I)=>{!B||!I||(C.has(B)||C.set(B,new Set),C.get(B).add(I))};for(const B of b){const I=(W0=B.source)==null?void 0:W0.id,F=(U0=B.target)==null?void 0:U0.id;A(I,F),((Y0=B.type)!=null&&Y0.includes("DataOutputAssociation")||(q0=B.type)!=null&&q0.includes("DataInputAssociation")||B.type==="bpmn:Association")&&A(F,I)}const O=o.filter(B=>B.type==="bpmn:Group");for(const B of O){const F=(((K0=B.businessObject.extensionElements)==null?void 0:K0.values)??[]).find(Oe=>Oe.$type==="bwl:Members"),j=((F==null?void 0:F.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const $=new Set(j),Y=[...j];for(;Y.length;){const Oe=Y.shift();for(const X of C.get(Oe)??[])$.has(X)||($.add(X),Y.push(X))}const le=B.x,xe=B.x+B.width,se=B.y,ge=B.y+B.height,me=Oe=>M.filter(X=>X.flow.target===Oe).length,Ce=Oe=>{var ue;const X=((ue=f(Oe))==null?void 0:ue.type)??"";if(X==="bpmn:StartEvent"&&me(Oe)===0)return!1;if(X.endsWith("Gateway")){const ee=M.filter(de=>de.flow.target===Oe).map(de=>de.flow.source);if(ee.length&&ee.every(de=>{var Ve;return((Ve=f(de))==null?void 0:Ve.type)==="bpmn:StartEvent"&&me(de)===0}))return!1}return!0},ht=o.filter(Oe=>fr(Oe)).filter(Oe=>Oe.type!=="bpmn:Group"&&Oe.type!=="bpmn:Participant"&&Oe.type!=="bpmn:TextAnnotation"&&!$.has(Oe.id)&&_o(Oe.id)&&Ce(Oe.id)&&Oe.x<xe&&Oe.x+Oe.width>le&&Oe.y<ge&&Oe.y+Oe.height>se);if(ht.length)for(const Oe of[-1,1]){const X=ht.filter(ye=>(ye.x+ye.width-le<=xe-ye.x?-1:1)===Oe);if(!X.length)continue;const ue=[];for(const ye of X){const ie=ue.find(fe=>fe.some(Le=>ye.y<Le.y+Le.height&&ye.y+ye.height>Le.y));ie?ie.push(ye):ue.push([ye])}const ee=new Map;for(const ye of ue){let ie=Oe<0?le-wo:xe+wo;for(const fe of[...ye].sort((Le,qe)=>Oe<0?qe.x-Le.x:Le.x-qe.x)){const Le=Oe<0?Math.min(fe.x,ie-fe.width):Math.max(fe.x,ie);ie=Oe<0?Le-Ui:Le+fe.width+Ui,Le!==fe.x&&Math.sign(Le-fe.x)===Oe&&ee.set(fe.id,Le-fe.x)}}const de=new Map,Ve=ye=>de.get(ye)===ye||!de.get(ye)?ye:Ve(de.get(ye));for(const ye of X)de.set(ye.id,ye.id);for(const ye of _){const ie=ee.has(ye.flow.source)?ye.flow.source:void 0,fe=ee.has(ye.flow.target)?ye.flow.target:void 0;if(!ie||!fe)continue;const Le=f(ye.flow.id);((X0=Le==null?void 0:Le.waypoints)==null?void 0:X0.length)===2&&de.set(Ve(ie),Ve(fe))}const We=new Map;for(const ye of X){if(!ee.has(ye.id))continue;const ie=Ve(ye.id);We.set(ie,[...We.get(ie)??[],ye])}const Ct=[...We.values()].sort((ye,ie)=>Oe<0?Math.min(...ye.map(fe=>fe.x))-Math.min(...ie.map(fe=>fe.x)):Math.max(...ie.map(fe=>fe.x))-Math.max(...ye.map(fe=>fe.x))),Ft=[];let he=!0;for(const ye of Ct){const ie=ye.map(qe=>ee.get(qe.id)??0).reduce((qe,ke)=>Math.abs(ke)>Math.abs(qe)?ke:qe,0),fe=new Map;let Le=!0;for(const qe of ye){const ke=d(qe);if(!ke){Le=!1;break}fe.has(ke.id)||fe.set(ke.id,{subtree:[],pool:ke}),fe.get(ke.id).subtree.push(qe)}Le&&Os([...fe.values()],ie,()=>!0,Eu)?Ft.push({shapes:ye,dx:ie}):he=!1}if(!he)for(const ye of Ft.reverse())n.moveElements(ye.shapes,{x:-ye.dx,y:0})}}}{const b=new Set([...R.map(C=>C.group.id),...Xt(e,"group.update").map(C=>C.id)]);for(const C of o.filter(A=>A.type==="bpmn:Group")){if(b.has(C.id))continue;const O=(((Z0=C.businessObject.extensionElements)==null?void 0:Z0.values)??[]).find(j=>j.$type==="bwl:Members"),B=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(f).filter(j=>!!j);!B.length||!B.some(j=>{const $=g.get(j.id);return!$||$.x!==j.x||$.y!==j.y})||!B.some(j=>j.x<C.x||j.y<C.y||j.x+j.width>C.x+C.width||j.y+j.height>C.y+C.height)||n.resizeShape(C,ph(B,C.id))}}{const C=new Map(Bo(Xe(o)).map(j=>[j.owner,j.rect])),A=o.filter(j=>!!j.waypoints),O=new Map,B=(j,$)=>{!j||!$||(O.has(j)||O.set(j,new Set),O.get(j).add($))};for(const j of A){const $=(Q0=j.source)==null?void 0:Q0.id,Y=(J0=j.target)==null?void 0:J0.id;B($,Y),((eE=j.type)!=null&&eE.includes("DataOutputAssociation")||(tE=j.type)!=null&&tE.includes("DataInputAssociation")||j.type==="bpmn:Association")&&B(Y,$)}const I=j=>M.filter($=>$.flow.target===j).length,F=j=>{var Y;const $=((Y=f(j))==null?void 0:Y.type)??"";if($==="bpmn:StartEvent"&&I(j)===0)return!1;if($.endsWith("Gateway")){const le=M.filter(xe=>xe.flow.target===j).map(xe=>xe.flow.source);if(le.length&&le.every(xe=>{var se;return((se=f(xe))==null?void 0:se.type)==="bpmn:StartEvent"&&I(xe)===0}))return!1}return!0};for(const j of o.filter($=>$.type==="bpmn:Group")){const Y=(((nE=j.businessObject.extensionElements)==null?void 0:nE.values)??[]).find(ie=>ie.$type==="bwl:Members"),le=((Y==null?void 0:Y.refs)??"").split(" ").filter(Boolean);if(!le.length)continue;const xe=le.map(f).filter(ie=>!!ie);if(!xe.length||!(R.some(ie=>ie.group.id===j.id)||Xt(e,"group.update").some(ie=>ie.id===j.id)||xe.some(ie=>{const fe=g.get(ie.id);return!fe||fe.x!==ie.x||fe.y!==ie.y})))continue;const ge=new Set(le),me=[...le];for(;me.length;){const ie=me.shift();for(const fe of O.get(ie)??[])ge.has(fe)||(ge.add(fe),me.push(fe))}const Ce=j.x,ht=j.x+j.width,Oe=j.y,X=j.y+j.height,ue=ie=>{const fe=C.get(ie.id),Le={x:ie.x,y:ie.y,width:ie.width,height:ie.height};return fe?[Le,{x:fe.x,y:fe.y,width:fe.width,height:fe.height}]:[Le]},ee=xe.flatMap(ue),de=Math.min(...ee.map(ie=>ie.x)),Ve=Math.max(...ee.map(ie=>ie.x+ie.width)),We=Math.min(...ee.map(ie=>ie.y)),Ct=Math.max(...ee.map(ie=>ie.y+ie.height)),Ft={L:de-Ce,R:ht-Ve,T:We-Oe,B:X-Ct},he=o.filter(ie=>fr(ie)).filter(ie=>ie.type!=="bpmn:Group"&&ie.type!=="bpmn:Participant"&&ie.type!=="bpmn:TextAnnotation"&&!ge.has(ie.id)&&F(ie.id)&&ie.x<ht&&ie.x+ie.width>Ce&&ie.y<X&&ie.y+ie.height>Oe);if(!he.length)continue;const ye={L:0,R:0,T:0,B:0};for(const ie of he){const fe=ue(ie),Le=Math.min(...fe.map(Ae=>Ae.x)),qe=Math.max(...fe.map(Ae=>Ae.x+Ae.width)),ke=Math.min(...fe.map(Ae=>Ae.y)),He=Math.max(...fe.map(Ae=>Ae.y+Ae.height)),Qe={L:qe-Ce,R:ht-Le,T:He-Oe,B:X-ke},we=["L","R","T","B"].filter(Ae=>Qe[Ae]<=Ft[Ae]+.001);if(!we.length)continue;const lt=we.reduce((Ae,St)=>Qe[St]<Qe[Ae]?St:Ae,we[0]);ye[lt]=Math.max(ye[lt],Math.min(Qe[lt]+10,Ft[lt]))}!ye.L&&!ye.R&&!ye.T&&!ye.B||n.resizeShape(j,{x:j.x+ye.L,y:j.y+ye.T,width:j.width-ye.L-ye.R,height:j.height-ye.T-ye.B})}}const D0=b=>{const C=b.waypoints;if(C!=null&&C.length){const O=C[Math.floor((C.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const A=b;return{x:A.x,y:A.y,width:A.width,height:A.height}};let Ls=0;const L0=12,I0=14,jB=15,HB=300,zB=b=>{const C=b.split(`
7
+ `),A=Math.max(...C.map(I=>Oo(I,L0))),O=Math.max(100,Math.min(HB,Math.ceil(A)+I0)),B=C.reduce((I,F)=>I+Math.max(1,Math.ceil((Oo(F,L0)+I0)/O)),0);return{width:O,height:Math.max(30,B*jB+10)}};for(const b of w){const C=b.association,A=((iE=b.placement)==null?void 0:iE.anchor)??(C?C.source===b.annotation.id?C.target:C.source:void 0),O=A?f(A):void 0,B=O?D0(O):void 0,I=zB(b.annotation.text??"");let F;if(B&&b.placement){const[le,xe]=cc[b.placement.side],se=b.placement.offset??50;F={x:B.x+B.width/2+le*(B.width/2+I.width/2+se),y:B.y+B.height/2+xe*(B.height/2+I.height/2+se)}}else B?(F={x:B.x+B.width/2+180+Ls%3*260,y:B.y-110-Ls%2*95},Ls++):(F={x:300+Ls*260,y:60},Ls++);const j=O?d(O)??u():u(),$=j;B&&typeof $.x=="number"&&typeof $.width=="number"&&$.type==="bpmn:Participant"&&(F=op(o,B,I,$,b.placement?{placement:b.placement}:{from:F}));const Y=n.createShape({type:"bpmn:TextAnnotation",width:I.width,height:I.height,businessObject:i.create("bpmn:TextAnnotation",{id:b.annotation.id,text:b.annotation.text})},F,j);if(C){const le=xe=>xe===b.annotation.id?Y:p(xe);n.connect(le(C.source),le(C.target),C.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:C.id})}:{type:"bpmn:Association"})}b.placement&&T(Y,"bwl:Placement",N(b.placement))}for(const b of Xt(e,"association.add")){const C=b.association;n.connect(p(C.source),p(C.target),C.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:C.id})}:{type:"bpmn:Association"})}for(const b of Xt(e,"node.update")){let C=p(b.id);if(b.type&&sc(b.type)!==C.type&&(C=c.replaceElement(C,{type:sc(b.type)})),b.name!==void 0&&n.updateProperties(C,{name:b.name??void 0}),b.lane||b.band!==void 0){b.band!==void 0&&n.updateProperties(C,{"bwl:band":b.band});const A=C.y+C.height/2,O=d(C),B=b.lane?p(b.lane):((O==null?void 0:O.children)??[]).find(F=>F.type==="bpmn:Lane"&&A>=F.y&&A<=F.y+F.height);b.band!==void 0&&dt(B==null?void 0:B.id,b.band,O);const I=B?B.y+(b.band===void 0?B.height/2:Math.min(B.height/2,pe)+E(B.id,b.band)*D):b.band!==void 0&&O?O.y+Q+E(`pool:${O.id}`,b.band)*D:void 0;if(I!==void 0){const F=I-A;F!==0&&n.moveElements([C],{x:0,y:F})}}}for(const b of Xt(e,"sequenceFlow.update")){const C=p(b.id);if(b.source!==void 0||b.target!==void 0){const A=C,O=b.source!==void 0?p(b.source):A.source,B=b.target!==void 0?p(b.target):A.target,I=$=>({x:$.x+$.width/2,y:$.y+$.height/2});n.reconnect(A,O,B,[I(O),I(B)]);const F=b0.get(A.id),j=B.y+B.height/2;if(F&&B.x>F.exit.x&&Math.abs(j-F.exit.y)>1){n.updateWaypoints(A,[F.exit,{x:F.exit.x,y:j},{x:B.x,y:j}]);const $=A.label;if($&&F.label){const le=Math.abs(F.label.y+$.height/2-F.channelY)<=D/5&&F.label.x+$.width>F.exit.x,xe=F.exit.x+6,se=B.x-6-$.width,ge=le?se>=xe?{x:Math.max(xe,Math.min(F.label.x,se)),y:F.label.y+(j-F.channelY)}:void 0:F.label;ge&&(ge.x!==$.x||ge.y!==$.y)&&n.moveElements([$],{x:ge.x-$.x,y:ge.y-$.y})}}else Math.abs(j-(O.y+O.height/2))>1&&Ts(A)}b.name!==void 0&&n.updateProperties(C,{name:b.name??void 0}),b.condition!==void 0&&n.updateProperties(C,{name:((rE=b.condition)==null?void 0:rE.label)??void 0})}for(const b of Xt(e,"messageFlow.update"))b.name!==void 0&&n.updateProperties(p(b.id),{name:b.name??void 0});for(const b of Xt(e,"dataStore.update"))b.name!==void 0&&n.updateProperties(p(b.id),{name:b.name??void 0});for(const b of Xt(e,"annotation.update")){const C=p(b.id);if(b.text!==void 0&&n.updateProperties(C,{text:b.text}),b.placement===null)T(C,"bwl:Placement",null);else if(b.placement){const A=p(b.placement.anchor),O=D0(A),B=d(A)??u(),I=typeof B.x=="number"&&typeof B.width=="number"&&B.type==="bpmn:Participant",[F,j]=cc[b.placement.side],$=b.placement.offset??50,Y={x:O.x+O.width/2+F*(O.width/2+C.width/2+$),y:O.y+O.height/2+j*(O.height/2+C.height/2+$)},le=I?op(o,O,{width:C.width,height:C.height},B,{placement:b.placement,selfId:b.id}):Y;n.moveElements([C],{x:le.x-(C.x+C.width/2),y:le.y-(C.y+C.height/2)}),T(C,"bwl:Placement",N(b.placement))}}for(const b of Xt(e,"group.update")){const C=p(b.id);if(b.name!==void 0&&n.updateLabel(C,b.name??""),b.members){const A=b.members.map(f).filter(O=>!!O);A.length&&n.resizeShape(C,ph(A,b.id)),T(C,"bwl:Members",{refs:b.members.join(" ")})}}}function ap(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 XS(e,t,n){var u,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>vt(p).filter(d=>!t.has(mt(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=Xe(i),c=o(s),l=[...new Set(c.flatMap(ap))].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 g=d.parent,h;for(;g;){if(g.type==="bpmn:Participant"){h=g;break}g=g.parent}if(!h){const pe=d.x+d.width/2,Me=d.y+d.height/2;h=i.getAll().find(Be=>{if(Be.type!=="bpmn:Participant")return!1;const it=Be;return typeof it.x=="number"&&typeof it.width=="number"&&pe>=it.x&&pe<=it.x+it.width&&Me>=it.y&&Me<=it.y+it.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const M=(((u=d.businessObject.extensionElements)==null?void 0:u.values)??[]).find(pe=>pe.$type==="bwl:Placement"),_=[...d.incoming??[],...d.outgoing??[]].find(pe=>pe.type==="bpmn:Association"),m=(M!=null&&M.anchor?i.get(M.anchor):void 0)??(_?((f=_.source)==null?void 0:f.id)===p?_.target:_.source:void 0);if(!m)continue;const v=m.waypoints,w=v!=null&&v.length?{x:v[Math.floor((v.length-1)/2)].x,y:v[Math.floor((v.length-1)/2)].y,width:0,height:0}:{x:m.x,y:m.y,width:m.width,height:m.height},R={width:d.width,height:d.height},P={x:d.x+d.width/2,y:d.y+d.height/2},T=M==null?void 0:M.side,N=[];T&&T in cc&&N.push(op(i,w,R,h,{placement:{side:T,offset:(M==null?void 0:M.offset)??null},selfId:p}));for(const[pe,Me]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Be=1;Be<=KS;Be++)N.push({x:P.x+pe*Vg*Be,y:P.y+Me*Vg*Be});const k={...s,edges:s.edges.filter(pe=>pe.id!==(_==null?void 0:_.id))},D=o(k),H=D.filter(pe=>ap(pe).includes(p)).length;if(!H)continue;let Q;for(const pe of N){const Me=pe.x-P.x,Be=pe.y-P.y;if(!Me&&!Be||pe.x-R.width/2<h.x||pe.x+R.width/2>h.x+h.width||pe.y-R.height/2<h.y||pe.y+R.height/2>h.y+h.height)continue;const it={...k,shapes:k.shapes.map(ve=>ve.id===p?{...ve,x:ve.x+Me,y:ve.y+Be}:ve)},K=o(it),J=K.filter(ve=>ap(ve).includes(p)).length;if(J>=H||K.length>D.length)continue;const ce=Math.abs(Me)+Math.abs(Be);if((!Q||J<Q.mine||J===Q.mine&&(K.length<Q.all||K.length===Q.all&&ce<Q.dist))&&(Q={x:pe.x,y:pe.y,mine:J,all:K.length,dist:ce}),Q.mine===0&&Q.all<D.length)break}Q&&r.moveElements([d],{x:Q.x-P.x,y:Q.y-P.y})}}const ZS=60;function sp(e,t,n,i){const r=t.x+t.width,o=[],a=c=>{for(const l of c.children??[])l.type==="bpmn:Lane"&&(o.push(l),a(l))};a(t),e.resizeShape(t,{x:t.x,y:t.y,width:n,height:t.height},void 0,i);const s=t.x+n;for(const c of o)Math.abs(c.x+c.width-r)<1&&e.resizeShape(c,{x:c.x,y:c.y,width:s-c.x,height:c.height},void 0,i)}function QS(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>vt(u).filter(f=>!t.has(mt(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 M of n.shapes)M.type!=="bpmn:Group"||p.has(M.id)||[...d].some(_=>{const m=s.get(_);return m&&c(M,m)})&&(p.add(M.id),y=!0);for(const M of n.shapes)M.type!=="bpmn:Participant"||d.has(M.id)||[...p].some(_=>{const m=s.get(_);return m&&c(m,M)})&&(d.add(M.id),y=!0);if(!y)break}const g=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 M=s.get(y);return M&&c(M,h)})).map(h=>h.id);return[...d,...p,...g]};for(let u=0;u<6;u++){const f=Xe(i),p=o(f),d=a(p);if(!d.length)return;const g=new Map(f.shapes.map(v=>[v.id,v]));let h=null;for(const v of d){if(v.kind!=="pool-overlap")continue;const[w,R]=v.pools,P=g.get(w),T=g.get(R);if(!P||!T)continue;const[N,k]=P.x<=T.x?[P,T]:[T,P];if(v.contained)continue;const D=s.get(N.id),H=s.get(k.id),Q=D&&H?Math.max(H.x-(D.x+D.width),0):ZS,pe=N.x+N.width+Q-k.x;if(pe<=0)continue;const Me=l(k.id).filter(Be=>i.get(Be));Me.length&&(!h||pe>h.dx)&&(h={movers:Me,dx:pe})}if(!h)return;const y=h.movers.map(v=>i.get(v)).filter(v=>!!v&&typeof v.x=="number");if(!y.length)return;const M=p.length,_=d.length;r.moveElements(y,{x:h.dx,y:0});const m=o(Xe(i));if(!(a(m).length<_&&m.length<=M)){r.moveElements(y,{x:-h.dx,y:0});return}}}const lc=.5,Ug=150;function JS(e,t){const{elementRegistry:n}=e,i=e.modeling,r=t.shapes.filter(m=>m.type==="bpmn:Participant");if(r.length<2)return;const o=r.map(m=>m.x+m.width),a=Math.max(...o);if(a-Math.min(...o)>lc)return;const s=r.map(m=>n.get(m.id)).filter(m=>!!m&&typeof m.x=="number");if(s.length<2)return;const c=new Map(r.map(m=>[m.id,m.x]));if(s.some(m=>Math.abs(m.x-c.get(m.id))>lc))return;const l=s.map(m=>m.x+m.width);if(Math.max(...l)-Math.min(...l)<=lc)return;const u=m=>m.x+m.width,f=m=>!!m&&typeof m.width=="number",p=m=>{const v={shapes:[],edges:[],lanes:[]},w=R=>{for(const P of R.children??[]){if("waypoints"in P&&P.waypoints){v.edges.push(P);continue}P.type!=="label"&&(P.type==="bpmn:Lane"?v.lanes.push(P):v.shapes.push(P),w(P))}};return w(m),v},d=new Map(s.map(m=>[m.id,p(m)]));let g=a;for(const m of s){const{shapes:v}=d.get(m.id),w=v.flatMap(R=>[u(R),...f(R.label)?[u(R.label)]:[]]);w.length&&(g=Math.max(g,Math.max(...w)+Ug))}const h=s.filter(m=>Math.abs(u(m)-g)>lc);if(!h.length)return;for(const m of h){const v=u(m),{shapes:w,edges:R,lanes:P}=d.get(m.id);if([...w.flatMap(k=>[u(k),...f(k.label)?[u(k.label)]:[]]),...R.flatMap(k=>[...k.waypoints.map(D=>D.x),...f(k.label)?[u(k.label)]:[]])].some(k=>k>g)||[...(m.incoming??[]).map(k=>k.waypoints[k.waypoints.length-1]),...(m.outgoing??[]).map(k=>k.waypoints[0])].some(k=>!k||k.x>g||Math.abs(k.x-v)<1))return;if(g>v){const k={x:v,y:m.y,width:g-v,height:m.height},D=new Set([m.id,...w.map(Q=>Q.id),...R.map(Q=>Q.id),...P.map(Q=>Q.id)]);if(n.getAll().some(Q=>{var Be;if("waypoints"in Q&&Q.waypoints||Q.type==="bpmn:Group"||!f(Q))return!1;const pe=Q.type==="label"?(Be=Q.labelTarget)==null?void 0:Be.id:Q.id;if(!pe||D.has(pe)||D.has(Q.id))return!1;const Me=Q;return Me.x<k.x+k.width&&Me.x+Me.width>k.x&&Me.y<k.y+k.height&&Me.y+Me.height>k.y}))return}}const y=()=>new Set(vt(Xe(n)).map(mt)),M=y(),_=h.map(m=>m.width);for(const m of h)sp(i,m,g-m.x,{layout:!1});[...y()].every(m=>M.has(m))||h.forEach((m,v)=>sp(i,m,_[v],{layout:!1}))}function eR(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>vt(l).filter(u=>!t.has(mt(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(R=>R.id!==l.id&&R.type!=="bpmn:Group"&&a(l,R));if(!f.length)continue;const p=f.map(R=>i.get(R.id)).filter(R=>!!R&&typeof R.x=="number");if(p.length!==f.length)continue;const d=s(f),g=s(p),h=g.l+(l.x-d.l),y=g.t+(l.y-d.t),M=g.r+(l.x+l.width-d.r),_=g.b+(l.y+l.height-d.b),m={x:h,y,width:M-h,height:_-y};if(m.width<=0||m.height<=0||Math.abs(m.x-u.x)<1&&Math.abs(m.y-u.y)<1&&Math.abs(m.width-u.width)<1&&Math.abs(m.height-u.height)<1)continue;const v=o(Xe(i)).length,w={x:u.x,y:u.y,width:u.width,height:u.height};r.resizeShape(u,m),o(Xe(i)).length>v&&r.resizeShape(u,w)}}const uc=20,pc=10;function tR(e,t,n,i){var f,p;const{elementRegistry:r}=e,o=e.modeling,a=d=>new Set(vt(d,{includeObservationOnly:!0}).filter(g=>g.kind==="edge-along-group-boundary").map(mt)),s=Xe(r),c=vt(s,{includeObservationOnly:!0}).filter(d=>d.kind==="edge-along-group-boundary"&&!t.has(mt(d)));if(!c.length)return;const l=new Map(n.shapes.map(d=>[d.id,d])),u=new Map;for(const d of c)u.set(d.group,[...u.get(d.group)??[],d]);for(const[d,g]of u){const h=s.shapes.find(Pe=>Pe.id===d);if(!((f=h==null?void 0:h.members)!=null&&f.length))continue;const y=l.get(d);if(!(!y||Math.abs(y.x-h.x)>=.5||Math.abs(y.y-h.y)>=.5||Math.abs(y.width-h.width)>=.5||Math.abs(y.height-h.height)>=.5))continue;const _=h.members.map(Pe=>r.get(Pe)).filter(Pe=>!!Pe&&typeof Pe.x=="number");if(!_.length)continue;const m=Math.min(..._.map(Pe=>Pe.x)),v=Math.min(..._.map(Pe=>Pe.y)),w=Math.max(..._.map(Pe=>Pe.x+Pe.width)),R=Math.max(..._.map(Pe=>Pe.y+Pe.height)),P=h.x,T=h.y,N=h.x+h.width,k=h.y+h.height;let D=P,H=T,Q=N,pe=k;for(const Pe of g){const L=s.edges.find(x=>x.id===Pe.edge);if(!L)continue;const E=L.endpoints.some(x=>{const G=s.shapes.find(Re=>Re.id===x);if(!G||G.container)return!1;const U=G.x+G.width/2,Z=G.y+G.height/2;return P<U&&U<N&&T<Z&&Z<k});for(const x of vn(L)){const G=x.axis==="v"?[T,k]:[P,N];Math.min(x.hi,G[1])-Math.max(x.lo,G[0])<Wu||(x.axis==="v"?P<x.at&&x.at<N:T<x.at&&x.at<k)&&E||(x.axis==="v"?(Math.abs(x.at-P)<=Do&&(D=Math.max(D,x.at+uc)),Math.abs(x.at-N)<=Do&&(Q=Math.min(Q,x.at-uc))):(Math.abs(x.at-T)<=Do&&(H=Math.max(H,x.at+uc)),Math.abs(x.at-k)<=Do&&(pe=Math.min(pe,x.at-uc))))}}if(D>m-pc&&(D=P),H>v-pc&&(H=T),Q<w+pc&&(Q=N),pe<R+pc&&(pe=k),D===P&&H===T&&Q===N&&pe===k)continue;const Me=r.get(d),Be={x:Me.x,y:Me.y,width:Me.width,height:Me.height},it=Xe(r),K=new Set(vt(it).map(mt)),J=a(it);o.resizeShape(Me,{x:D,y:H,width:Q-D,height:pe-H});let ce=Xe(r),ve=vt(ce).filter(Pe=>!K.has(mt(Pe)));const q=[];if(ve.length>0&&ve.every(Pe=>Pe.kind==="label-over-line"&&!i.has(Pe.edge)&&ce.edges.some(L=>L.id===Pe.edge))){for(const Pe of ve){if(Pe.kind!=="label-over-line")continue;const L=ce.edges.find(Z=>Z.id===Pe.edge),E=L&&ip(L,ce),x=(p=r.get(Pe.edge))==null?void 0:p.label;if(!E||!x)continue;const G=E.x-x.x,U=E.y-x.y;o.moveElements([x],{x:G,y:U}),q.push({label:x,dx:G,dy:U})}ce=Xe(r),ve=vt(ce).filter(Pe=>!K.has(mt(Pe)))}const ne=a(ce),Te=[...ne].some(Pe=>!J.has(Pe));if(ve.length||Te||ne.size>=J.size){for(const Pe of q.reverse())o.moveElements([Pe.label],{x:-Pe.dx,y:-Pe.dy});o.resizeShape(Me,Be)}}}function Yg(e,t,n=Wg){var m,v;const i=zg(e),r=Hg(t,hg(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=Xe(i.elementRegistry),s=new Set(vt(a).map(mt)),c=new Set(vt(a,{includeObservationOnly:!0}).map(mt)),l=new Set(a.edges.map(w=>w.id)),u=new Set(a.shapes.map(w=>w.id)),f=Js(a),p=f.length,d=new Set(f.map(([w,R])=>`${w}|${R}`)),g=new Map;for(const w of i.elementRegistry.filter(R=>"waypoints"in R&&!!R.waypoints))w.label&&g.set(w.id,{wps:w.waypoints.map(R=>({x:R.x,y:R.y})),label:{x:w.label.x,y:w.label.y},source:(m=w.source)==null?void 0:m.id,target:(v=w.target)==null?void 0:v.id});const h=e.get("commandStack");try{bh(h,()=>{n(t,i),QS(i,s,a),JS(i,a),eR(i,s,a),_g(i,l);const w=Ju(i,s);vg(i,d,l),kg(i,s,l),Sg(i,l),IS(i,l),Mg(i,s,l),FS(i,s,l),Ig(i,s,l),Lg(i,l),Ng(i,u),XS(i,s,u),Ju(i,s,w),tR(i,c,a,l),$g(i,s),Dg(i,g)})}catch(w){return{ok:!1,issues:[{kind:"lower-failed",message:w instanceof Error?w.message:String(w)}],findings:[],stats:o}}const y=Xe(i.elementRegistry),M=vt(y,{includeObservationOnly:!0}).filter(w=>!c.has(mt(w))),_=rg(y);return{ok:!0,issues:[],findings:M,stats:{edgeCrossings:{before:p,after:_.pairs.length,pairs:_.pairs,solidPairs:_.solidPairs,dashedPairs:_.dashedPairs,mixedPairs:_.mixedPairs,crossPoolMessages:_.crossPoolMessages}}}}function nR(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function qg(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Kg(e,t){const n=qg(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Xg(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function iR(e){return typeof e=="string"&&Mu.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 Zg(e){const t=e.rootElements??[],n=t.find(K=>K.$type==="bpmn:Collaboration"),i=new Map(t.filter(K=>K.$type==="bpmn:Process").map(K=>[K.id,K])),r=[],o=[],a=[],s=[],c=[],l=[],u={poolOrders:{},bands:{},placements:{},afterColumns:{}},f=[],p=[],d=[],g=[],h=[],y=[],M=[],_=new Set,m=new Set,v=K=>{K&&_.add(K)},w=K=>{_.add(K),m.add(K)},R=K=>{const J=Xg(K,"bwl:Placement");if(!J)return;const ce=typeof J.anchor=="string"?J.anchor:void 0;if(!ce||!iR(J.side))return;const ve=typeof J.offset=="number"?J.offset:void 0;h.push({owner:K.id,anchor:ce,side:J.side,...ve!==void 0?{offset:ve}:{}})},P=K=>{const J=Xg(K,"bwl:Members"),ce=typeof(J==null?void 0:J.refs)=="string"?J.refs.split(/\s+/).filter(Boolean):[];ce.length&&M.push({owner:K.id,refs:ce})},T=K=>{var J;for(const ce of K)switch(v(ce.id),ce.$type){case"bpmn:TextAnnotation":w(ce.id),s.push({id:ce.id,text:typeof ce.text=="string"?ce.text:""}),R(ce);break;case"bpmn:Association":d.push({id:ce.id,type:ce.$type,source:Ri(ce.sourceRef),target:Ri(ce.targetRef)});break;case"bpmn:Group":{w(ce.id);const ve=(J=ce.categoryValueRef)==null?void 0:J.value;c.push({id:ce.id,...typeof ve=="string"&&ve?{name:ve}:{}}),P(ce);break}default:l.push({id:ce.id,type:ce.$type,reason:"type-outside-mvp"})}},N=K=>{for(const J of K.flowElements??[])v(J.id),l.push({id:J.id,type:J.$type,reason:"inside-container"}),(J.flowElements??[]).length&&N(J);for(const J of K.artifacts??[])v(J.id),l.push({id:J.id,type:J.$type,reason:"inside-container"})},k=(K,J)=>{const ce=K.flowElements??[],ve=(K.laneSets??[]).flatMap(V=>V.lanes??[]),q=new Map;for(const V of ve){v(V.id);for(const ne of V.flowNodeRef??[]){const Te=Ri(ne);Te&&q.set(Te,V.id)}}for(const V of ce){if(v(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"){w(V.id),a.push({id:V.id,...V.name?{name:V.name}:{}});continue}const ne=nR(V.$type);if(!hh(ne)){l.push({id:V.id,type:V.$type,reason:"type-outside-mvp"});continue}w(V.id);const Te=ne==="boundaryEvent"?Ri(V.attachedToRef):void 0;o.push({id:V.id,type:ne,...V.name?{name:V.name}:{},...J?{participant:J}:{},...q.has(V.id)?{lane:q.get(V.id)}:{},...Te?{attachedTo:Te}:{}}),ne==="subProcess"&&N(V);const Pe=Kg(V,"bwl:band");Pe!==void 0&&(u.bands[V.id]=Pe);const L=qg(V,"bwl:afterColumn");typeof L=="string"&&L!==""&&y.push([V.id,L]);for(const E of V.dataOutputAssociations??[])v(E.id),g.push({id:E.id,type:E.$type,source:V.id,target:Ri(E.targetRef)});for(const E of V.dataInputAssociations??[])v(E.id),g.push({id:E.id,type:E.$type,source:Ri((E.sourceRef??[])[0]),target:V.id})}T(K.artifacts??[])};if(n){const K=new Set;for(const J of n.participants??[]){w(J.id);const ce=Ri(J.processRef);ce&&K.add(ce);const ve=ce?i.get(ce):void 0,q=((ve==null?void 0:ve.laneSets)??[]).flatMap(Pe=>Pe.lanes??[]),V=q.map(Pe=>({id:Pe.id,...Pe.name?{name:Pe.name}:{}}));for(const Pe of V)w(Pe.id);const ne=!ve||(ve.flowElements??[]).length===0&&q.length===0&&(ve.artifacts??[]).length===0;r.push({id:J.id,...J.name?{name:J.name}:{},...ne?{blackBox:!0}:{},...V.length?{lanes:V}:{}});const Te=Kg(J,"bwl:poolOrder");Te!==void 0&&(u.poolOrders[J.id]=Te),ve&&k(ve,J.id)}for(const J of n.messageFlows??[])v(J.id),p.push({id:J.id,source:Ri(J.sourceRef),target:Ri(J.targetRef),...typeof J.name=="string"&&J.name?{name:J.name}:{}});T(n.artifacts??[]);for(const[J,ce]of i)!K.has(J)&&(ce.flowElements??[]).length>0&&l.push({id:J,type:ce.$type,reason:"unreachable-process"})}else for(const K of i.values())k(K);const D=[],H=[],Q=[],pe=[],Me=(K,J)=>!!K&&!!J&&m.has(K)&&m.has(J);for(const K of f){if(!Me(K.source,K.target)){l.push({id:K.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}D.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),m.add(K.id)}for(const K of p){if(!Me(K.source,K.target)){l.push({id:K.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}H.push({id:K.id,source:K.source,target:K.target,...K.name?{name:K.name}:{}}),m.add(K.id)}for(const K of g){if(!Me(K.source,K.target)){l.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}pe.push({...K.id?{id:K.id}:{},source:K.source,target:K.target}),K.id&&m.add(K.id)}for(const K of d){if(!Me(K.source,K.target)){l.push({id:K.id??"",type:K.type,reason:"endpoint-outside-mvp"});continue}Q.push({...K.id?{id:K.id}:{},source:K.source,target:K.target})}const Be=new Map(c.map(K=>[K.id,K]));for(const{owner:K,refs:J}of M){const ce=J.filter(q=>_.has(q)),ve=Be.get(K);ve&&ce.length&&(ve.members=ce)}for(const K of h)_.has(K.anchor)&&(u.placements[K.owner]={anchor:K.anchor,side:K.side,...K.offset!==void 0?{offset:K.offset}:{}});for(const[K,J]of y)_.has(J)&&(u.afterColumns[K]=J);return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:D,...H.length?{messageFlows:H}:{},...a.length?{dataStores:a}:{},...pe.length?{dataAssociations:pe}:{},...s.length?{annotations:s}:{},...Q.length?{associations:Q}:{},...c.length?{groups:c}:{}},hints:u,omitted:l}}async function rR(e){const{definitions:t,warnings:n}=await To(e);return{...Zg(t),warnings:n}}const oR=new Set(["bpmn:ExclusiveGateway","bpmn:ParallelGateway","bpmn:InclusiveGateway","bpmn:EventBasedGateway","bpmn:ComplexGateway"]);function cp(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function aR(e){return cp(e.processRef)!==void 0}function sR(e){const t=new Set,n=r=>{const o=cp(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 cR(e){const t=[],n=i=>{for(const r of i.flowElements??[])oR.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 lR(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 lp(e){const t=[],n=e.rootElements??[],i=sR(e);for(const o of cR(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??[])aR(s)&&lR(o.get(cp(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 uR(e){const{definitions:t,warnings:n}=await To(e);return{issues:lp(t),warnings:n}}const pR=.5,fR=8,dR=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),fc=e=>{if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:""};function hR(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}=${fc(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=>`${fc(s)}:${typeof(s==null?void 0:s.value)=="string"?s.value:""}`).sort().join(",")}]`)}Array.isArray(t.flowNodeRef)&&n.push(`lane=[${t.flowNodeRef.map(fc).sort().join(",")}]`);const r=t.conditionExpression;return r&&typeof r.body=="string"&&n.push(`cond=${r.body}`),n.join("|")}function gR(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=fc(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 Qg(e){const t=gR(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:")&&!dR.has(s)&&n.set(c,{type:s,props:hR(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 Jg(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 em(e,t,n={}){const i=n.moveTolerance??pR,r=Qg(e),o=Qg(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||Jg(f.geometry,u.geometry,i)||Jg(f.label,u.label,n.labelTolerance??fR))&&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 mR(e,t,n={}){const[i,r]=await Promise.all([To(e),To(t)]);return{...em(i.definitions,r.definitions,n),warnings:[...i.warnings,...r.warnings]}}function yR(e){return new Set([...e.added,...e.modified])}function vR(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function tm(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Yg(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 bR=Symbol("bpmn-editor"),up={geometry:[],semantic:[]};function xR(){const e=be.ref(!1),t=be.ref(!0),n=be.ref(!1),i=be.shallowRef(up),r=be.shallowRef(void 0);let o,a;const s=()=>{if(!o){i.value=up;return}const p=vt(Xe(o.get("elementRegistry")),{includeObservationOnly:!0}),d=o.getDefinitions();i.value={geometry:p,semantic:d?lp(d):[]}},c=()=>{e.value=!0,s()};function l(p,d){p.get("canvas").getContainer().style.pointerEvents=d?"":"none";const g=p.get("keyboard");d?(a&&g.bind(a),a=void 0):a||(a=g.getBinding(),g.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),g=d==null?void 0:d.businessObject;if(!g)return;const h=typeof g.name=="string"&&g.name.trim()!==""?g.name:g.text;return{name:typeof h=="string"&&h.trim()!==""?h.trim():void 0,type:typeof g.$type=="string"?g.$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=up,r.value=void 0},setEditable(p){t.value=p,o&&l(o,p)},async applyAgentBatch(p,d){const g=u();n.value=!0;try{const h=await tm(g,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:Vu(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 Ee(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function _R(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var pp={exports:{}},nm;function wR(){if(nm)return pp.exports;nm=1;var e=pp.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},pp.exports}var ER=wR(),SR=_R(ER);function Di(e){if(!(this instanceof Di))return new Di(e);e=e||[128,36,1],this._seed=e.length?SR.rack(e[0],e[1],e[2]):e}Di.prototype.next=function(e){return this._seed(e||!0)},Di.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},Di.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Di.prototype.assigned=function(e){return this._seed.get(e)||!1},Di.prototype.unclaim=function(e){delete this._seed.hats[e]},Di.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 Lt(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 RR(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 Dn(e,...t){const n=e.style;return z(t,function(i){i&&z(i,function(r,o){n[o]=r})}),e}function An(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const CR=Object.prototype.toString;function $t(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 CR.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 dc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function to(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function MR(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var hc={},im;function AR(){if(im)return hc;im=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return hc.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},hc.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},hc}var rm=AR(),PR=MR(rm),Ge=RR({__proto__:null,default:PR},[rm]),om=["focus","blur"];function TR(e,t,n,i,r){return om.indexOf(n)!==-1&&(r=!0),Ge.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=to(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function kR(e,t,n,i){return om.indexOf(t)!==-1&&(i=!0),Ge.unbind(e,t,n,i)}var Gn={bind:TR,unbind:kR};function fp(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function Rt(e,t){return t=t||document,t.querySelector(e)}function gc(e,t){return t=t||document,t.querySelectorAll(e)}function Li(e){e.parentNode&&e.parentNode.removeChild(e)}function OR(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function DR(e,t){return t.appendChild(OR(e,t))}function Ue(e,t){return DR(t,e),e}var dp=2,am={"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":dp,"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":dp,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function LR(e,t){return am[t]?e.style[t]:e.getAttributeNS(null,t)}function sm(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=am[i];r?(r===dp&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function IR(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)sm(e,r,t[r])}function Se(e,t,n){if(typeof t=="string")if(n!==void 0)sm(e,t,n);else return LR(e,t);else IR(e,t);return e}const BR=Object.prototype.toString;function ut(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 BR.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 mc(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function cm(e){return e.cloneNode(!0)}var hp={svg:"http://www.w3.org/2000/svg"},lm='<svg xmlns="'+hp.svg+'"';function NR(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(hp.svg)===-1&&(e=lm+e.substring(4)):(e=lm+">"+e+"</svg>",t=!0);var n=$R(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function $R(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function De(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=NR(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(hp.svg,e),t&&Se(n,t),n}var gp=null;function um(){return gp===null&&(gp=De("svg")),gp}function pm(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function FR(e,t,n,i,r,o){var a=um().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return pm(a,e);case 6:return pm(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function Pa(e){return um().createSVGTransform()}var fm=/([&<>]{1})/g,jR=/([&<>\n\r"]{1})/g,HR={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function mp(e,t){function n(i,r){return HR[r]||r}return e.replace(t,n)}function dm(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(mp(e.textContent,fm));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,'="',mp(o.value,jR),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)dm(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",mp(e.nodeValue,fm),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function zR(e){for(var t=e.firstChild,n=[];t;)dm(t,n),t=t.nextSibling;return n.join("")}function hm(e,t){return zR(e)}function an(e){var t=e.parentNode;return t&&t.removeChild(e),e}function GR(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function VR(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(GR(e,i))}function Ta(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),VR(n,t)),n.consolidate()}const WR=/^class[ {]/;function UR(e){return WR.test(e.toString())}function yp(e){return Array.isArray(e)}function vp(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function yc(...e){e.length===1&&yp(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const YR=/constructor\s*[^(]*\(\s*([^)]*)\)/m,qR=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,KR=/\/\*([^*]*)\*\//m;function XR(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(UR(e)?YR:qR);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(KR);return(r&&r[1]||i).trim()})||[]}function gm(e,t){const n=t||{get:function(m,v){if(i.push(m),v===!1)return null;throw s(`No provider for "${m}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(m){const v=i.join(" -> ");return i.length=0,new Error(v?`${m} (Resolving: ${v})`:m)};function c(m,v){if(!r[m]&&m.includes(".")){const w=m.split(".");let R=c(w.shift());for(;w.length;)R=R[w.shift()];return R}if(vp(o,m))return o[m];if(vp(r,m)){if(i.indexOf(m)!==-1)throw i.push(m),s("Cannot resolve circular dependency!");return i.push(m),o[m]=r[m][0](r[m][1]),i.pop(),o[m]}return n.get(m,v)}function l(m,v){if(typeof v>"u"&&(v={}),typeof m!="function")if(yp(m))m=yc(m.slice());else throw s(`Cannot invoke "${m}". Expected a function!`);const R=(m.$inject||XR(m)).map(P=>vp(v,P)?v[P]:c(P));return{fn:m,dependencies:R}}function u(m){const{fn:v,dependencies:w}=l(m),R=Function.prototype.bind.call(v,null,...w);return new R}function f(m,v,w){const{fn:R,dependencies:P}=l(m,w);return R.apply(v,P)}function p(m){return yc(v=>m.get(v))}function d(m,v){if(v&&v.length){const w=Object.create(null),R=Object.create(null),P=[],T=[],N=[];let k,D,H,Q;for(let pe in r)k=r[pe],v.indexOf(pe)!==-1&&(k[2]==="private"?(D=P.indexOf(k[3]),D===-1?(H=k[3].createChild([],v),Q=p(H),P.push(k[3]),T.push(H),N.push(Q),w[pe]=[Q,pe,"private",H]):w[pe]=[N[D],pe,"private",T[D]]):w[pe]=[k[2],k[1]],R[pe]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&v.forEach(Me=>{k[1].$scope.indexOf(Me)!==-1&&(w[pe]=[k[2],k[1]],R[Me]=!0)});v.forEach(pe=>{if(!R[pe])throw new Error('No provider for "'+pe+'". Cannot use provider from the parent!')}),m.unshift(w)}return new gm(m,a)}const g={factory:f,type:u,value:function(m){return m}};function h(m,v){const w=m.__init__||[];return function(){w.forEach(R=>{typeof R=="string"?v.get(R):v.invoke(R)})}}function y(m){const v=m.__exports__;if(v){const w=m.__modules__,R=Object.keys(m).reduce((D,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&(D[H]=m[H]),D),Object.create(null)),P=(w||[]).concat(R),T=d(P),N=yc(function(D){return T.get(D)});v.forEach(function(D){r[D]=[N,D,"private",T]});const k=(m.__init__||[]).slice();return k.unshift(function(){T.init()}),m=Object.assign({},m,{__init__:k}),h(m,T)}return Object.keys(m).forEach(function(w){if(w==="__init__"||w==="__depends__")return;const R=m[w];if(R[2]==="private"){r[w]=R;return}const P=R[0],T=R[1];r[w]=[g[P],ZR(P,T),P]}),h(m,a)}function M(m,v){return m.indexOf(v)!==-1||(m=(v.__depends__||[]).reduce(M,m),m.indexOf(v)!==-1)?m:m.concat(v)}function _(m){const v=m.reduce(M,[]).map(y);let w=!1;return function(){w||(w=!0,v.forEach(R=>R()))}}this.get=c,this.invoke=f,this.instantiate=u,this.createChild=d,this.init=_(e)}function ZR(e,t){return e!=="value"&&yp(t)&&(t=yc(t.slice())),t}var QR=1e3;function Xi(e,t){var n=this;t=t||QR,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)})}Xi.prototype.canRender=function(e){},Xi.prototype.drawShape=function(e,t){},Xi.prototype.drawConnection=function(e,t){},Xi.prototype.getShapePath=function(e){},Xi.prototype.getConnectionPath=function(e){};function no(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function JR(e){return["M",e.x,e.y]}function bp(e){return["L",e.x,e.y]}function eC(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function tC(e,t){const n=e.length,i=[JR(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(bp(a));continue}const c=Math.min(t,xp(a.x-o.x,a.y-o.y),xp(s.x-a.x,s.y-a.y));if(!c){i.push(bp(a));continue}const l=vc(a,o,c),u=vc(a,o,c*.5),f=vc(a,s,c),p=vc(a,s,c*.5);i.push(bp(l)),i.push(eC(u,p,f))}return i}function vc(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=xp(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function xp(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ka(e,t,n){ze(t)&&(n=t,t=null),t||(t={});const i=De("path",t);return ze(n)&&(i.dataset.cornerRadius=String(n)),_p(i,e)}function _p(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return Se(e,{d:no(tC(t,n))}),e}function bc(e){var t=new Set(e);return nt(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function io(e,t,n){n=n||0,Ne(e)||(e=[e]),z(e,function(i,r){var o=t(i,r,n);Ne(o)&&o.length&&io(o,t,n+1)})}function wp(e,t,n){var i=new Set,r=new Set;return io(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 wp(e)}function nC(e,t,n){Xr(t)&&(t=!0),pn(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,z(u.incoming,c),z(u.outgoing,c),u.children}return io(e,l),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Zt(e,t){t=!!t,Ne(e)||(e=[e]);var n,i,r,o;return z(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 z(e,function(i){var r=i;r.waypoints&&(r=Zt(r)),!ze(t.y)&&r.x>t.x&&(n[i.id]=i),!ze(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(ze(t.width)&&ze(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!ze(t.width)||!ze(t.height))&&(n[i.id]=i)}),n}function mm(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function ym(e){return!!(e&&e.isFrame)}function Da(e,t){return W({},e||{},t||{})}var iC=1;function xr(e,t){Xi.call(this,e,iC),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}Ee(xr,Xi),xr.prototype.canRender=function(){return!0},xr.prototype.drawShape=function(t,n,i){var r=De("rect");return Se(r,{x:0,y:0,width:n.width||0,height:n.height||0}),ym(n)?Se(r,W({},this.FRAME_STYLE,i||{})):Se(r,W({},this.SHAPE_STYLE,i||{})),Ue(t,r),r},xr.prototype.drawConnection=function(t,n,i){var r=ka(n.waypoints,W({},this.CONNECTION_STYLE,i||{}));return Ue(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 no(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 no(o)},xr.$inject=["eventBus","styles"];function rC(){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){!Ne(n)&&!i&&(i=n,n=[]);var r=Hn(n,function(o,a){return W(o,e[a]||{})},{});return i?W(r,i):r},this.computeStyle=function(n,i,r){return Ne(i)||(r=i,i=[]),t.style(i||[],W({},r,n||{}))}}const oC={__init__:["defaultRenderer"],defaultRenderer:["type",xr],styles:["type",rC]};function Ut(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function qt(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 Ep(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 Sp(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 aC=2;function Zi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(sC(r,n))return o;return!1}function sC(e,t){const n=t[0];return Zr(t,function(i){return Math.abs(n[e]-i[e])<=aC})}function vm(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 Rp(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var cC=/,?([a-z]),?/gi,bm=parseFloat,Qt=Math,_r=Qt.PI,Ii=Qt.min,Bi=Qt.max,xm=Qt.pow,wr=Qt.abs,lC=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,uC=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,_m=Array.isArray||function(e){return e instanceof Array};function pC(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function fC(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 dC(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 pC(r,i)?(fC(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function hC(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(lC,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(uC,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 gC(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 mC(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 Cp(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(cC,"$1")}function yC(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 wm(e,t,n,i,r,o,a,s,c){var l=1-c,u=xm(l,3),f=xm(l,2),p=c*c,d=p*c,g=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:xc(g),y:xc(h)}}function Em(e){var t=EC(...e);return Cp(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 vC(e,t){return e=Cp(e),t=Cp(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 Sm(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 Rm(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,g=0;g<u;g++){var h=l*f[g]+l,y=Sm(h,e,n,r,a),M=Sm(h,t,i,o,s),_=y*y+M*M;d+=p[g]*Qt.sqrt(_)}return l*d}function bC(e,t,n,i,r,o,a,s){if(!(Bi(e,n)<Ii(r,a)||Ii(e,n)>Bi(r,a)||Bi(t,i)<Ii(o,s)||Ii(t,i)>Bi(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=xc(c/u),p=xc(l/u),d=+f.toFixed(2),g=+p.toFixed(2);if(!(d<+Ii(e,n).toFixed(2)||d>+Bi(e,n).toFixed(2)||d<+Ii(r,a).toFixed(2)||d>+Bi(r,a).toFixed(2)||g<+Ii(t,i).toFixed(2)||g>+Bi(t,i).toFixed(2)||g<+Ii(o,s).toFixed(2)||g>+Bi(o,s).toFixed(2)))return{x:f,y:p}}}}function xc(e){return Math.round(e*1e11)/1e11}function xC(e,t,n){var i=Em(e),r=Em(t);if(!vC(i,r))return[];var o=Rm(...e),a=Rm(...t),s=Mm(e)?1:~~(o/5)||1,c=Mm(t)?1:~~(a/5)||1,l=new Array(s+1),u=new Array(c+1),f={},p=[],d,g;for(d=0;d<s+1;d++){var h=wm(...e,d/s);l[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=wm(...t,d/c),u[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(g=0;g<c;g++){var y=l[d],M=l[d+1],_=u[g],m=u[g+1],v=wr(M.x-y.x)<.01?"y":"x",w=wr(m.x-_.x)<.01?"y":"x",R=bC(y.x,y.y,M.x,M.y,_.x,_.y,m.x,m.y),P;if(R){if(P=R.x.toFixed(9)+"#"+R.y.toFixed(9),f[P])continue;f[P]=!0;var T=y.t+wr((R[v]-y[v])/(M[v]-y[v]))*(M.t-y.t),N=_.t+wr((R[w]-_[w])/(m[w]-_[w]))*(m.t-_.t);T>=0&&T<=1&&N>=0&&N<=1&&p.push({x:R.x,y:R.y,t1:T,t2:N})}}return p}function Cm(e,t,n){e=Tm(e),t=Tm(t);for(var i,r,o,a,s,c,l,u,f,p,d=n?0:[],g=0,h=e.length;g<h;g++){var y=e[g];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 M=0,_=t.length;M<_;M++){var m=t[M];if(m[0]=="M")o=l=m[1],a=u=m[2];else{m[0]=="C"?(p=[o,a,...m.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,l,u,l,u],o=l,a=u);var v=xC(f,p);{for(var w=0,R=v.length;w<R;w++)v[w].segment1=g,v[w].segment2=M,v[w].bez1=f,v[w].bez2=p;d=d.concat(v)}}}}}return d}function _C(e){return _m(e)&&_m(e[0])}function wC(e){if(gC(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 g=0,h=l.length;g<h;g++)c[g]=l[g];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 Mm(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function _c(e,t,n,i){return[e,t,n,i,n,i]}function Am(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 Pm(e,t,n,i,r,o,a,s,c,l){var u=_r*120/180,f=_r/180*(+r||0),p=[],d,g=dC(function(L,E,x){var G=L*Qt.cos(x)-E*Qt.sin(x),U=L*Qt.sin(x)+E*Qt.cos(x);return{x:G,y:U}});if(l)P=l[0],T=l[1],w=l[2],R=l[3];else{d=g(e,t,-f),e=d.x,t=d.y,d=g(s,c,-f),s=d.x,c=d.y;var h=(e-s)/2,y=(t-c)/2,M=h*h/(n*n)+y*y/(i*i);M>1&&(M=Qt.sqrt(M),n=M*n,i=M*i);var _=n*n,m=i*i,v=(o==a?-1:1)*Qt.sqrt(wr((_*m-_*y*y-m*h*h)/(_*y*y+m*h*h))),w=v*n*y/i+(e+s)/2,R=v*-i*h/n+(t+c)/2,P=Qt.asin(((t-R)/i).toFixed(9)),T=Qt.asin(((c-R)/i).toFixed(9));P=e<w?_r-P:P,T=s<w?_r-T:T,P<0&&(P=_r*2+P),T<0&&(T=_r*2+T),a&&P>T&&(P=P-_r*2),!a&&T>P&&(T=T-_r*2)}var N=T-P;if(wr(N)>u){var k=T,D=s,H=c;T=P+u*(a&&T>P?1:-1),s=w+n*Qt.cos(T),c=R+i*Qt.sin(T),p=Pm(s,c,n,i,r,0,a,D,H,[T,k,w,R])}N=T-P;var Q=Qt.cos(P),pe=Qt.sin(P),Me=Qt.cos(T),Be=Qt.sin(T),it=Qt.tan(N/4),K=4/3*n*it,J=4/3*i*it,ce=[e,t],ve=[e+K*pe,t-J*Q],q=[s+K*Be,c-J*Me],V=[s,c];if(ve[0]=2*ce[0]-ve[0],ve[1]=2*ce[1]-ve[1],l)return[ve,q,V].concat(p);p=[ve,q,V].concat(p).join().split(",");for(var ne=[],Te=0,Pe=p.length;Te<Pe;Te++)ne[Te]=Te%2?g(p[Te-1],p[Te],f).y:g(p[Te],p[Te+1],f).x;return ne}function EC(e,t,n,i,r,o,a,s){for(var c=[],l=[[],[]],u,f,p,d,g,h,y,M,_=0;_<2;++_){if(_==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,M=Qt.sqrt(y),!(y<0)&&(g=(-f+M)/(2*u),0<g&&g<1&&c.push(g),h=(-f-M)/(2*u),0<h&&h<1&&c.push(h))}for(var m=c.length,v=m,w;m--;)d=c[m],w=1-d,l[0][m]=w*w*w*e+3*w*w*d*n+3*w*d*d*r+d*d*d*a,l[1][m]=w*w*w*t+3*w*w*d*i+3*w*d*d*o+d*d*d*s;return l[0][v]=e,l[1][v]=t,l[0][v+1]=a,l[1][v+1]=s,l[0].length=l[1].length=v+2,{x0:Ii(...l[0]),y0:Ii(...l[1]),x1:Bi(...l[0]),y1:Bi(...l[1])}}function Tm(e){if(_C(e)||(e=hC(e)),mC(e))return e;for(var t=yC(wC(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,g){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",...Pm(d.x,d.y,...p.slice(1))];break;case"S":g=="C"||g=="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":g=="Q"||g=="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",...Am(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",...Am(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",..._c(d.x,d.y,p[1],p[2])];break;case"H":p=["C",..._c(d.x,d.y,p[1],d.y)];break;case"V":p=["C",..._c(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",..._c(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 g=p[d];g.length;)o[d]="A",p.splice(d++,0,["C",...g.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=bm(u[f-4])||n.x,n.by=bm(u[f-3])||n.y}return t}function Mt(e){return pn(e)&&jn(e,"waypoints")}function Je(e){return pn(e)&&jn(e,"labelTarget")}function SC(e){return pn(e)&&So(e.parent)}function km(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Qi(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ie(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function wc(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function RC(e){return Qi({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function CC(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],g=d&&d.endLength||0,h=PC(p,u);l.push({start:p,end:u,startLength:g,endLength:g+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 $e(e){return Mt(e)?CC(e):RC(e)}function _n(e,t,n){n=n||0,pn(n)||(n={x:n,y:n});var i=Ie(e),r=Ie(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,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=MC(e,t);return i.length===1||i.length===2&&La(i[0],i[1])<1?Qi(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}),Qi(i[n?0:i.length-1])):null}function MC(e,t){return Cm(e,t)}function AC(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||Sp(i,r,n)?e.splice(t,1):t++;return e}function PC(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ec(e,t){return Math.round(e*t)/t}function Om(e){return ze(e)?e+"px":e}function TC(e){for(;e.parent;)e=e.parent;return e}function kC(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"),Dn(n,{position:"relative",overflow:"hidden",width:Om(e.width),height:Om(e.height)}),t.appendChild(n),n}function Dm(e,t,n){const i=De("g");ut(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const OC="base",Lm=0,DC=1,LC={shape:["x","y","width","height"],connection:["waypoints"]};function Fe(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}Fe.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Fe.prototype._init=function(e){const t=this._eventBus,n=this._container=kC(e),i=this._svg=De("svg");Se(i,{width:"100%",height:"100%"}),An(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")}),Ue(n,i);const r=this._viewport=Dm(i,"viewport");e.deferUpdate&&(this._viewboxChanged=ku(this._viewboxChanged,300)),this._restoreFocus=ku(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Fe.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},Fe.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Fe.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=mm(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Fe.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Fe.prototype.restoreFocus=function(){this._restoreFocus()},Fe.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Fe.prototype.isFocused=function(){return this._focused},Fe.prototype.getDefaultLayer=function(){return this.getLayer(OC,Lm)},Fe.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},Fe.prototype._getChildIndex=function(e){return Hn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Fe.prototype._createLayer=function(e,t){typeof t>"u"&&(t=DC);const n=this._getChildIndex(t);return{group:Dm(this._viewport,"layer-"+e,n),index:t,visible:!0}},Fe.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},Fe.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(an(n),t.visible=!1),n},Fe.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],an(t.group))},Fe.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Fe.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(TC(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Fe.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Fe.prototype._findPlaneForRoot=function(e){return kt(this._planes,function(t){return t.rootElement===e})},Fe.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Fe.prototype._resolveElements=function(e){return Ne(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Fe.prototype.getContainer=function(){return this._container},Fe.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(z([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),ut(r).add(t)):(e.markers.delete(t),ut(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Fe.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Fe.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Fe.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Fe.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Fe.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Fe.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,Lm);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Fe.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},Fe.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},Fe.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},Fe.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},Fe.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},Fe.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=LC[e];if(!Zr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Fe.prototype._setParent=function(e,t,n){qt(t.children,e,n),e.parent=t},Fe.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},Fe.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Fe.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Fe.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),Ut(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Fe.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Fe.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Fe.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Fe.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Fe.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Fe.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,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:FR(),s=Ec(r.a,1e3),c=Ec(-r.e||0,1e3),l=Ec(-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},Fe.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),Im(t,n)}),{x:n.e,y:n.f}},Fe.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(g=>g!=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=Ie(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=Ie(c);if(!(a.width<c.width&&a.height<c.height))u=a.x-c.x,f=a.y-c.y;else{const g=Math.max(0,s.right-p.right),h=Math.min(0,s.left-p.left),y=Math.max(0,s.bottom-p.bottom),M=Math.min(0,s.top-p.top);u=g||h,f=y||M}this.scroll({dx:-u*l,dy:-f*l})},Fe.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Ec(i.a,1e3)};function Im(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Fe.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},Fe.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,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),Im(this._viewport,u),u},Fe.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Fe.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},Fe.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Ho="data-element-id";function ii(e){this._elements={},this._eventBus=e}ii.$inject=["eventBus"],ii.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Se(t,Ho,i),n&&Se(n,Ho,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},ii.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Se(i.gfx,Ho,""),i.secondaryGfx&&Se(i.secondaryGfx,Ho,""),delete t[n])},ii.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)},ii.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&Se(t,Ho,i),t},ii.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&Se(e,Ho);var n=this._elements[t];return n&&n.element},ii.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},ii.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}},ii.prototype.getAll=function(){return this.filter(function(e){return e})},ii.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)})},ii.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},ii.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 IC(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 BC(e){return e.__refs_collection===!0}function NC(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Bm(e,t,n){var i=IC(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 $C(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 ci(e,t){if(!(this instanceof ci))return new ci(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}ci.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?Bm(this,t,e):$C(this,t,e)},ci.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return BC(n)||Bm(this,t,e),n},ci.prototype.ensureBound=function(e,t){NC(e,t)||this.bind(e,t)},ci.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},ci.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Ap=new ci({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Nm=new ci({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),$m=new ci({name:"attachers",collection:!0},{name:"host"}),Fm=new ci({name:"outgoing",collection:!0},{name:"source"}),jm=new ci({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)}}),Ap.bind(this,"parent"),Nm.bind(this,"labels"),Fm.bind(this,"outgoing"),jm.bind(this,"incoming")}function Ba(){zo.call(this),Ap.bind(this,"children"),$m.bind(this,"host"),$m.bind(this,"attachers")}Ee(Ba,zo);function Hm(){zo.call(this),Ap.bind(this,"children")}Ee(Hm,Ba);function zm(){Ba.call(this),Nm.bind(this,"labelTarget")}Ee(zm,Ba);function Gm(){zo.call(this),Fm.bind(this,"source"),jm.bind(this,"target")}Ee(Gm,zo);var FC={connection:Gm,shape:Ba,label:zm,root:Hm};function jC(e,t){var n=FC[e];if(!n)throw new Error("unknown type: <"+e+">");return W(new n,t)}function HC(e){return e instanceof zo}function Ji(){this._uid=12}Ji.prototype.createRoot=function(e){return this.create("root",e)},Ji.prototype.createLabel=function(e){return this.create("label",e)},Ji.prototype.createShape=function(e){return this.create("shape",e)},Ji.prototype.createConnection=function(e){return this.create("connection",e)},Ji.prototype.create=function(e,t){return t=W({},t||{}),t.id||(t.id=e+"_"+this._uid++),jC(e,t)};var Sc="__fn",Vm=1e3,zC=Array.prototype.slice;function Vn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}Vn.prototype.on=function(e,t,n,i){if(e=Ne(e)?e:[e],fn(t)&&(i=n,n=t,t=Vm),!ze(t))throw new Error("priority must be a number");var r=n;i&&(r=Bn(n,i),r[Sc]=n[Sc]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},Vn.prototype.once=function(e,t,n,i){var r=this;if(fn(t)&&(i=n,n=t,t=Vm),!ze(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[Sc]=n,this.on(e,t,o)},Vn.prototype.off=function(e,t){e=Ne(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},Vn.prototype.createEvent=function(e){var t=new Na;return t.init(e),t},Vn.prototype.fire=function(e,t){var n,i,r,o;if(o=zC.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}},Vn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},Vn.prototype._destroy=function(){this._listeners={}},Vn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Vn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=GC(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},Vn.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},Vn.prototype._getListeners=function(e){return this._listeners[e]},Vn.prototype._setListeners=function(e,t){this._listeners[e]=t},Vn.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[Sc]===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 GC(e,t){return e.apply(null,t)}function ro(e){return e.childNodes[0]}function VC(e){return e.parentNode.childNodes[1]}function Rc(e,t,n,i,r){var o=Pa();o.setTranslate(t,n);var a=Pa();a.setRotate(i||0,0,0);var s=Pa();s.setScale(1,1),Ta(e,[o,a,s])}function wn(e,t,n){var i=Pa();i.setTranslate(t,n),Ta(e,i)}function Wm(e,t){var n=Pa();n.setRotate(t,0,0),Ta(e,n)}function ri(e,t){this._eventBus=e,this._elementRegistry=t}ri.$inject=["eventBus","elementRegistry"],ri.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=VC(t),n||(n=De("g"),ut(n).add("djs-children"),Ue(t.parentNode,n))):n=t,n},ri.prototype._clear=function(e){var t=ro(e);return dc(t),t},ri.prototype._createContainer=function(e,t,n,i){var r=De("g");ut(r).add("djs-group"),typeof n<"u"?WC(r,t,t.childNodes[n]):Ue(t,r);var o=De("g");ut(o).add("djs-element"),ut(o).add("djs-"+e),i&&ut(o).add("djs-frame"),Ue(r,o);var a=De("g");return ut(a).add("djs-visual"),Ue(o,a),o},ri.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,ym(t))},ri.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Hn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),z(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;z(o,function(c){var l=n.getGraphics(c).parentNode;l===s?s=s.nextSibling:a.insertBefore(l,s)})}})},ri.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},ri.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},ri.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},ri.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},ri.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),wn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?Se(n,"display","none"):Se(n,"display","block")}},ri.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 UC={__depends__:[oC],__init__:["canvas"],canvas:["type",Fe],elementRegistry:["type",ii],elementFactory:["type",Ji],eventBus:["type",Vn],graphicsFactory:["type",ri]};function YC(e){var t=new gm(e);return t.init(),t}function qC(e){e=e||{};var t={config:["value",e]},n=[t,UC].concat(e.modules||[]);return YC(n)}function Sr(e,t){this._injector=t||qC(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 Pn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Nn(e,t){return e.$instanceOf(t)}function KC(e){return kt(e.rootElements,function(t){return Nn(t,"bpmn:Process")||Nn(t,"bpmn:Collaboration")})}function XC(e){var t={},n=[],i={};function r(q,V){return function(ne){q(ne,V)}}function o(q){t[q.id]=q}function a(q){return t[q.id]}function s(q,V){var ne=q.gfx;if(ne)throw new Error(`already rendered ${Pn(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 ne=i[q.id]&&s(q,V);return o(q),ne}catch(Te){u(Te.message,{element:q,error:Te}),console.error(`failed to import ${Pn(q)}`,Te)}}function u(q,V){e.error(q,V)}var f=this.registerDi=function(V){var ne=V.bpmnElement;ne?i[ne.id]?u(`multiple DI elements defined for ${Pn(ne)}`,{element:ne}):i[ne.id]=V:u(`no bpmnElement referenced in ${Pn(V)}`,{element:V})};function p(q){d(q.plane)}function d(q){f(q),z(q.planeElement,g)}function g(q){f(q)}this.handleDefinitions=function(V,ne){var Te=V.diagrams;if(ne&&Te.indexOf(ne)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!ne&&Te&&Te.length&&(ne=Te[0]),!ne)throw new Error("no diagram to display");i={},p(ne);var Pe=ne.plane;if(!Pe)throw new Error(`no plane for ${Pn(ne)}`);var L=Pe.bpmnElement;if(!L)if(L=KC(V),L)u(`correcting missing bpmnElement on ${Pn(Pe)} to ${Pn(L)}`),Pe.bpmnElement=L,f(Pe);else throw new Error("no process or collaboration to display");var E=c(L,Pe);if(Nn(L,"bpmn:Process")||Nn(L,"bpmn:SubProcess"))y(L,E);else if(Nn(L,"bpmn:Collaboration"))ce(L,E),M(V.rootElements,E);else throw new Error(`unsupported bpmnElement for ${Pn(Pe)}: ${Pn(L)}`);h(n)};var h=this.handleDeferred=function(){for(var V;n.length;)V=n.shift(),V()};function y(q,V){it(q,V),N(q.ioSpecification,V),T(q.artifacts,V),o(q)}function M(q,V){var ne=nt(q,function(Te){return!a(Te)&&Nn(Te,"bpmn:Process")&&Te.laneSets});ne.forEach(r(y,V))}function _(q,V){l(q,V)}function m(q,V){z(q,r(_,V))}function v(q,V){l(q,V)}function w(q,V){l(q,V)}function R(q,V){l(q,V)}function P(q,V){l(q,V)}function T(q,V){z(q,function(ne){Nn(ne,"bpmn:Association")?n.push(function(){P(ne,V)}):P(ne,V)})}function N(q,V){q&&(z(q.dataInputs,r(w,V)),z(q.dataOutputs,r(R,V)))}var k=this.handleSubProcess=function(V,ne){it(V,ne),T(V.artifacts,ne)};function D(q,V){var ne=l(q,V);Nn(q,"bpmn:SubProcess")&&k(q,ne||V),Nn(q,"bpmn:Activity")&&N(q.ioSpecification,V),n.push(function(){z(q.dataInputAssociations,r(v,V)),z(q.dataOutputAssociations,r(v,V))})}function H(q,V){l(q,V)}function Q(q,V){l(q,V)}function pe(q,V){n.push(function(){var ne=l(q,V);q.childLaneSet&&Me(q.childLaneSet,ne||V),ve(q)})}function Me(q,V){z(q.lanes,r(pe,V))}function Be(q,V){z(q,r(Me,V))}function it(q,V){K(q.flowElements,V),q.laneSets&&Be(q.laneSets,V)}function K(q,V){z(q,function(ne){Nn(ne,"bpmn:SequenceFlow")?n.push(function(){H(ne,V)}):Nn(ne,"bpmn:BoundaryEvent")?n.unshift(function(){D(ne,V)}):Nn(ne,"bpmn:FlowNode")?D(ne,V):Nn(ne,"bpmn:DataObject")||(Nn(ne,"bpmn:DataStoreReference")||Nn(ne,"bpmn:DataObjectReference")?Q(ne,V):u(`unrecognized flowElement ${Pn(ne)} in context ${Pn(V&&V.businessObject)}`,{element:ne,context:V}))})}function J(q,V){var ne=l(q,V),Te=q.processRef;Te&&y(Te,ne||V)}function ce(q,V){z(q.participants,r(J,V)),n.push(function(){m(q.messageFlows,V)}),T(q.artifacts,V)}function ve(q){z(q.flowNodeRef,function(V){var ne=V.get("lanes");ne&&ne.push(q)})}}function S(e,t){var n=ae(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function tt(e,t){return hr(t,function(n){return S(e,n)})}function ae(e){return e&&e.businessObject||e}function pt(e){return e&&e.di}function ZC(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,M){return i.add(h,y,M)},error:function(h,y){s.push({message:h,context:y})}},p=new XC(f);u=u||l.diagrams&&l.diagrams[0];var d=QC(l,u);if(!d)throw new Error("no diagram to display");z(d,function(h){p.handleDefinitions(l,h)});var g=u.plane.bpmnElement.id;o.setRootElement(o.findRoot(g+"_plane")||o.findRoot(g))}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 QC(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!S(n,"bpmn:Process")&&!S(n,"bpmn:Collaboration")&&(i=JC(n));var r;S(i,"bpmn:Collaboration")?r=i:r=kt(e.rootElements,function(l){if(S(l,"bpmn:Collaboration"))return kt(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=Um(o),s=[t],c=[n];return z(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 Um(e){var t=[];return z(e,function(n){n&&(t.push(n),t=t.concat(Um(n.flowElements)))}),t}function JC(e){for(var t=e;t;){if(S(t,"bpmn:Process"))return t;t=t.$parent}}var eM='<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>',Ym=eM,qm={verticalAlign:"middle"},Km={color:"#404040"},tM={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},nM={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},iM={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"},rM='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Ym+'</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>',Ni;function oM(){Ni=Lt(rM),Dn(Ni,tM),Dn(Rt("svg",Ni),qm),Dn(Rt(".backdrop",Ni),nM),Dn(Rt(".notice",Ni),iM),Dn(Rt(".link",Ni),Km,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function aM(){Ni||(oM(),Gn.bind(Ni,".backdrop","click",function(e){document.body.removeChild(Ni)})),document.body.appendChild(Ni)}const Cc=5,Xm="djs-outline-hidden";function jt(e){e=W({},cM,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),uM(this._container)}Ee(jt,Sr),jt.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||[]),Mc(s,o),s=sM(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},jt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},jt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Mc(o,[]),o}if(typeof t=="string"&&(i=lM(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Mc(o,[]),o}try{this.clear()}catch(o){throw Mc(o,[]),o}const{warnings:r}=await ZC(this,n,i);return{warnings:r}},jt.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},jt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=Rt(":scope > defs",i._svg),a=hm(r),s=o?"<defs>"+hm(o)+"</defs>":"",c=i.getContainer();$t(c).add(Xm);let l;try{l=r.getBBox()}finally{$t(c).remove(Xm)}const u=l.x-Cc,f=l.y-Cc,p=l.width+Cc*2,d=l.height+Cc*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}},jt.prototype._setDefinitions=function(e){this._definitions=e},jt.prototype.getModules=function(){return this._modules},jt.prototype.clear=function(){this.getDefinitions()&&Sr.prototype.clear.call(this)},jt.prototype.destroy=function(){Sr.prototype.destroy.call(this),Li(this._container)},jt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},jt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},jt.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=Rt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},jt.prototype.getDefinitions=function(){return this._definitions},jt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},jt.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(Ti(n,["additionalModules"]),{canvas:W({},n.canvas,{container:e}),modules:a});Sr.call(this,s),n&&n.container&&this.attachTo(n.container)},jt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},jt.prototype._createContainer=function(e){const t=Lt('<div class="bjs-container"></div>');return Dn(t,{width:Zg(e.width),height:Zg(e.height),position:e.position}),t},jt.prototype._createModdle=function(e){const t=W({},this._moddleExtensions,e.moddleExtensions);return new Hh(t)},jt.prototype._modules=[];function Mc(e,t){return e.warnings=t,e}function oM(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 aM={width:"100%",height:"100%",position:"relative"};function Zg(e){return e+(ze(e)?"px":"")}function sM(e,t){return t&&kt(e.diagrams,function(n){return n.id===t})||null}function cM(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Yg+"</a>",i=Lt(n);Dn(Rt("svg",i),qg),Dn(i,Kg,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ge.bind(i,"click",function(r){rM(),r.preventDefault()})}function zo(e){jt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ee(zo,jt),zo.prototype._createModdle=function(e){var t=jt.prototype._createModdle.call(this,e);return t.ids=new Di([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 st(e,t){return S(e,"bpmn:CallActivity")?!1:S(e,"bpmn:SubProcess")?(t=t||pt(e),t&&S(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):S(e,"bpmn:Participant")?!!ae(e).processRef:!0}function dn(e){if(!(!S(e,"bpmn:Participant")&&!S(e,"bpmn:Lane"))){var t=pt(e).isHorizontal;return t===void 0?!0:t}}function lM(e){return e&&ae(e).isInterrupting!==!1}function Tn(e){return e&&!!ae(e).triggeredByEvent}function Go(e,t){var n=ae(e).eventDefinitions;return hr(n,function(i){return S(i,t)})}function uM(e){return Go(e,"bpmn:ErrorEventDefinition")}function pM(e){return Go(e,"bpmn:EscalationEventDefinition")}function fM(e){return Go(e,"bpmn:CompensateEventDefinition")}var ro={width:90,height:20},Qg=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 Ac(e){return Je(e.label)}function dM(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=hM(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-=Qg:a+=Qg,{x:a,y:s}}function hM(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 Pp(e){return e.waypoints?dM(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 mM(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=Pp(t),i=ro),W({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Jg(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 gM(e){var t=e.categoryValueRef;return t&&t.value||""}function oi(e){var t=e.businessObject,n=Jg(t);if(n)return n==="categoryValueRef"?gM(t):t[n]||""}function yM(e,t){var n=e.businessObject,i=Jg(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function vM(e){return Je(e)&&Rr(e.labelTarget)}var Vo=7;function ey(e){let t=[];return z(e.incoming,n=>{S(n,"bpmn:Association")&&S(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),z(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 z(wp(e),n=>{z(ey(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 Tp="hsl(225, 10%, 15%)",bM="white";function $i(e,t){return hr(e.eventDefinitions,function(n){return n.$type===t})}function xM(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function _M(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function at(e,t,n){var i=pt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||bM}function _e(e,t,n){var i=pt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Tp}function Fa(e,t,n,i){var r=pt(e),o=r.get("label");return i||o&&o.get("color:color")||t||_e(e,n)}function ty(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 kp(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 wM(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 EM(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:li(e,t),height:Wn(e,t)}}function li(e,t={}){return jn(t,"width")?t.width:e.width}function Wn(e,t={}){return jn(t,"height")?t.height:e.height}var SM=new Di,RM=10,Pc=3,CM=1.5,Tc=10,MM=4,Wo=.95,AM=1,PM=.25;function oo(e,t,n,i,r,o,a){Xi.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(L){return n.computeStyle(L,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Tp,strokeWidth:2,fill:"white"})}function f(L){return n.computeStyle(L,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Tp,strokeWidth:2})}function p(L,E){var{ref:x={x:0,y:0},scale:G=1,element:U,parentGfx:Z=r._svg}=E,Re=Oe("marker",{id:L,viewBox:"0 0 20 20",refX:x.x,refY:x.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});Ue(Re,U);var Xe=Rt(":scope > defs",Z);Xe||(Xe=Oe("defs"),Ue(Z,Xe)),Ue(Xe,Re)}function d(L,E,x,G){var U=SM.nextPrefixed("marker-");return m(L,U,E,x,G),"url(#"+U+")"}function m(L,E,x,G,U){if(x==="sequenceflow-end"){var Z=Oe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:U,stroke:U,strokeWidth:1})});p(E,{element:Z,ref:{x:11,y:10},scale:.5,parentGfx:L})}if(x==="messageflow-start"){var Re=Oe("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(E,{element:Re,ref:{x:6,y:6},parentGfx:L})}if(x==="messageflow-end"){var Xe=Oe("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(E,{element:Xe,ref:{x:8.5,y:5},parentGfx:L})}if(x==="association-start"){var dt=Oe("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(E,{element:dt,ref:{x:1,y:10},scale:.5,parentGfx:L})}if(x==="association-end"){var Vt=Oe("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(E,{element:Vt,ref:{x:11,y:10},scale:.5,parentGfx:L})}if(x==="conditional-flow-marker"){var wt=Oe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:U})});p(E,{element:wt,ref:{x:-1,y:10},scale:.5,parentGfx:L})}if(x==="conditional-default-flow-marker"){var ln=Oe("path",{d:"M 6 4 L 10 16",...u({stroke:U,fill:"none"})});p(E,{element:ln,ref:{x:0,y:10},scale:.5,parentGfx:L})}}function h(L,E,x,G,U={}){pn(G)&&(U=G,G=0),G=G||0,U=u(U);var Z=E/2,Re=x/2,Xe=Oe("circle",{cx:Z,cy:Re,r:Math.round((E+x)/4-G),...U});return Ue(L,Xe),Xe}function y(L,E,x,G,U,Z){pn(U)&&(Z=U,U=0),U=U||0,Z=u(Z);var Re=Oe("rect",{x:U,y:U,width:E-U*2,height:x-U*2,rx:G,ry:G,...Z});return Ue(L,Re),Re}function C(L,E,x,G){var U=E/2,Z=x/2,Re=[{x:U,y:0},{x:E,y:Z},{x:U,y:x},{x:0,y:Z}],Xe=Re.map(function(Vt){return Vt.x+","+Vt.y}).join(" ");G=u(G);var dt=Oe("polygon",{...G,points:Xe});return Ue(L,dt),dt}function _(L,E,x,G){x=f(x);var U=ka(E,x,G);return Ue(L,U),U}function g(L,E,x){return _(L,E,x,5)}function v(L,E,x){x=f(x);var G=Oe("path",{...x,d:E});return Ue(L,G),G}function w(L,E,x,G){return v(E,x,W({"data-marker":L},G))}function R(L){return Pe[L]}function P(L){return function(E,x,G){return R(L)(E,x,G)}}var T={"bpmn:MessageEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.235,my:.315}}),Z=G?_e(E,c,x.stroke):at(E,s,x.fill),Re=G?at(E,s,x.fill):_e(E,c,x.stroke),Xe=v(L,U,{fill:Z,stroke:Re,strokeWidth:1});return Xe},"bpmn:TimerEventDefinition":function(L,E,x={}){var G=x.width||E.width,U=x.height||E.height,Z=x.width?1:2,Re=h(L,G,U,.2*U,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:Z}),Xe=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}});v(L,Xe,{stroke:_e(E,c,x.stroke),strokeWidth:Z});for(var dt=0;dt<12;dt++){var Vt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}}),wt=G/2,ln=U/2;v(L,Vt,{strokeWidth:1,stroke:_e(E,c,x.stroke),transform:"rotate("+dt*30+","+ln+","+wt+")"})}return Re},"bpmn:EscalationEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.5,my:.2}}),Z=G?_e(E,c,x.stroke):at(E,s,x.fill);return v(L,U,{fill:Z,stroke:_e(E,c,x.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(L,E,x={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.5,my:.222}});return v(L,G,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.57,my:.263}}),Z=G?_e(E,c,x.stroke):at(E,s,x.fill);return v(L,U,{fill:Z,stroke:_e(E,c,x.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.2,my:.722}}),Z=G?_e(E,c,x.stroke):at(E,s,x.fill);return v(L,U,{fill:Z,stroke:_e(E,c,x.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.638,my:-.055}}),Z=G?_e(E,c,x.stroke):"none",Re=v(L,U,{fill:Z,stroke:_e(E,c,x.stroke),strokeWidth:1});return Wg(Re,45),Re},"bpmn:CompensateEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.22,my:.5}}),Z=G?_e(E,c,x.stroke):at(E,s,x.fill);return v(L,U,{fill:Z,stroke:_e(E,c,x.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.5,my:.2}}),Z=G?_e(E,c,x.stroke):at(E,s,x.fill);return v(L,U,{strokeWidth:1,fill:Z,stroke:_e(E,c,x.stroke)})},"bpmn:MultipleEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.211,my:.36}}),Z=G?_e(E,c,x.stroke):at(E,s,x.fill);return v(L,U,{fill:Z,stroke:_e(E,c,x.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(L,E,x={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.458,my:.194}});return v(L,G,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(L,E,x={}){var G=h(L,E.width,E.height,8,{fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke),strokeWidth:4});return G}};function N(L,E,x={},G){var U=ae(L),Z=xM(U),Re=G||L;return U.get("eventDefinitions")&&U.get("eventDefinitions").length>1?U.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](E,Re,x,Z):T["bpmn:MultipleEventDefinition"](E,Re,x,Z):$i(U,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](E,Re,x,Z):$i(U,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](E,Re,x,Z):$i(U,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](E,Re,x,Z):$i(U,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](E,Re,x,Z):$i(U,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](E,Re,x,Z):$i(U,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](E,Re,x,Z):$i(U,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](E,Re,x,Z):$i(U,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](E,Re,x,Z):$i(U,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](E,Re,x,Z):$i(U,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](E,Re,x,Z):null}var k={ParticipantMultiplicityMarker:function(L,E,x={}){var G=li(E,x),U=Wn(E,x),Z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2-6)/G,my:(U-15)/U}});w("participant-multiplicity",L,Z,{strokeWidth:2,fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke)})},SubProcessMarker:function(L,E,x={}){var G=y(L,14,14,0,{strokeWidth:1,fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke)});wn(G,E.width/2-7.5,E.height-20);var U=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}});w("sub-process",L,U,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke)})},ParallelMarker:function(L,E,x){var G=li(E,x),U=Wn(E,x),Z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+x.parallel)/G,my:(U-20)/U}});w("parallel",L,Z,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke)})},SequentialMarker:function(L,E,x){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+x.seq)/E.width,my:(E.height-19)/E.height}});w("sequential",L,G,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke)})},CompensationMarker:function(L,E,x){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+x.compensation)/E.width,my:(E.height-13)/E.height}});w("compensation",L,G,{strokeWidth:1,fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke)})},LoopMarker:function(L,E,x){var G=li(E,x),U=Wn(E,x),Z=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+x.loop)/G,my:(U-7)/U}});w("loop",L,Z,{strokeWidth:1.5,fill:"none",stroke:_e(E,c,x.stroke),strokeMiterlimit:.5})},AdhocMarker:function(L,E,x){var G=li(E,x),U=Wn(E,x),Z=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+x.adhoc)/G,my:(U-15)/U}});w("adhoc",L,Z,{strokeWidth:1,fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke)})}};function D(L,E,x,G){k[L](E,x,G)}function H(L,E,x=[],G={}){G={fill:G.fill,stroke:G.stroke,width:li(E,G),height:Wn(E,G)};var U=ae(E),Z=x.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")&&x.push("CompensationMarker"),S(U,"bpmn:AdHocSubProcess")&&(x.push("AdhocMarker"),Z||W(G,{compensation:G.compensation-18}));var Re=U.get("loopCharacteristics"),Xe=Re&&Re.get("isSequential");Re&&(W(G,{compensation:G.compensation-18}),x.includes("AdhocMarker")&&W(G,{seq:-23,loop:-18,parallel:-24}),Xe===void 0&&x.push("LoopMarker"),Xe===!1&&x.push("ParallelMarker"),Xe===!0&&x.push("SequentialMarker")),x.includes("CompensationMarker")&&x.length===1&&W(G,{compensation:-8}),z(x,function(dt){D(dt,L,E,G)})}function Q(L,E,x={}){x=W({size:{width:100}},x);var G=o.createText(E||"",x);return ut(G).add("djs-label"),Ue(L,G),G}function pe(L,E,x,G={}){var U=ae(E),Z=ja({x:E.x,y:E.y,width:E.width,height:E.height},G);return Q(L,U.name,{align:x,box:Z,padding:7,style:{fill:Fa(E,l,c,G.stroke)}})}function Me(L,E,x={}){var G={width:E.width,height:E.height,x:E.width/2+E.x,y:E.height/2+E.y};return Q(L,oi(E),{box:G,style:W({},o.getExternalStyle(),{fill:Fa(E,l,c,x.stroke)})})}function Be(L,E,x,G={}){var U=dn(x),Z=Q(L,E,{box:{height:30,width:U?Wn(x,G):li(x,G)},align:"center-middle",style:{fill:Fa(x,l,c,G.stroke)}});if(U){var Re=-1*Wn(x,G);Rc(Z,0,-Re,270)}}function it(L,E,x={}){var{width:G,height:U}=ja(E,x);return y(L,G,U,Tc,{...x,fill:at(E,s,x.fill),fillOpacity:Wo,stroke:_e(E,c,x.stroke)})}function X(L,E,x={}){var G=ae(E),U=at(E,s,x.fill),Z=_e(E,c,x.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(x.markerEnd=d(L,"association-end",U,Z)),G.get("associationDirection")==="Both"&&(x.markerStart=d(L,"association-start",U,Z)),x=ft(x,["markerStart","markerEnd"]),g(L,E.waypoints,{...x,stroke:Z,strokeDasharray:"0, 5"})}function J(L,E,x={}){var G=at(E,s,x.fill),U=_e(E,c,x.stroke),Z=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}}),Re=v(L,Z,{fill:G,fillOpacity:Wo,stroke:U}),Xe=ae(E);if(_M(Xe)){var dt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.33,my:(E.height-18)/E.height}});v(L,dt,{strokeWidth:2,fill:G,stroke:U})}return Re}function le(L,E,x={}){return h(L,E.width,E.height,{fillOpacity:Wo,...x,fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke)})}function ve(L,E,x={}){return C(L,E.width,E.height,{fill:at(E,s,x.fill),fillOpacity:Wo,stroke:_e(E,c,x.stroke)})}function q(L,E,x={}){var G=y(L,li(E,x),Wn(E,x),0,{fill:at(E,s,x.fill),fillOpacity:x.fillOpacity||Wo,stroke:_e(E,c,x.stroke),strokeWidth:1.5}),U=ae(E);if(S(U,"bpmn:Lane")){var Z=U.get("name");Be(L,Z,E,x)}return G}function V(L,E,x={}){var G=it(L,E,x),U=st(E);if(Tn(E)&&(Se(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!U)){var Z=ae(E).flowElements||[],Re=Z.filter(Xe=>S(Xe,"bpmn:StartEvent"));Re.length===1&&ne(Re[0],L,x,E)}return pe(L,E,U?"center-top":"center-middle",x),U?H(L,E,void 0,x):H(L,E,["SubProcessMarker"],x),G}function ne(L,E,x,G){var U=22,Z={fill:at(G,s,x.fill),stroke:_e(G,c,x.stroke),width:U,height:U},Re=ae(L).isInterrupting,Xe=Re?0:3,dt=Re?1:1.2,Vt=20,wt=(U-Vt)/2,ln="translate("+wt+","+wt+")";h(E,Vt,Vt,{fill:Z.fill,stroke:Z.stroke,strokeWidth:dt,strokeDasharray:Xe,transform:ln}),N(L,E,Z,G)}function Te(L,E,x={}){var G=it(L,E,x);return pe(L,E,"center-middle",x),H(L,E,void 0,x),G}var Pe=this.handlers={"bpmn:AdHocSubProcess":function(L,E,x={}){return st(E)?x=ft(x,["fill","stroke","width","height"]):x=ft(x,["fill","stroke"]),V(L,E,x)},"bpmn:Association":function(L,E,x={}){return x=ft(x,["fill","stroke"]),X(L,E,x)},"bpmn:BoundaryEvent":function(L,E,x={}){var{renderIcon:G=!0}=x;x=ft(x,["fill","stroke"]);var U=ae(E),Z=U.get("cancelActivity");x={strokeWidth:1.5,fill:at(E,s,x.fill),fillOpacity:AM,stroke:_e(E,c,x.stroke)},Z||(x.strokeDasharray="6");var Re=le(L,E,x);return h(L,E.width,E.height,Pc,{...x,fill:"none"}),G&&N(E,L,x),Re},"bpmn:BusinessRuleTask":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=Te(L,E,x),U=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),Z=v(L,U);Se(Z,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1});var Re=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Xe=v(L,Re);return Se(Xe,{fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(L,E,x={}){return x=ft(x,["fill","stroke"]),V(L,E,{strokeWidth:5,...x})},"bpmn:ComplexGateway":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=ve(L,E,x),U=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.26}});return v(L,U,{fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=J(L,E,x);return v(L,G,{fill:"none",stroke:_e(E,c,x.stroke),strokeWidth:1}),U},"bpmn:DataInputAssociation":function(L,E,x={}){return x=ft(x,["fill","stroke"]),X(L,E,{...x,markerEnd:d(L,"association-end",at(E,s,x.fill),_e(E,c,x.stroke))})},"bpmn:DataObject":function(L,E,x={}){return x=ft(x,["fill","stroke"]),J(L,E,x)},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataOutput":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=J(L,E,x);return v(L,G,{strokeWidth:1,fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke)}),U},"bpmn:DataOutputAssociation":function(L,E,x={}){return x=ft(x,["fill","stroke"]),X(L,E,{...x,markerEnd:d(L,"association-end",at(E,s,x.fill),_e(E,c,x.stroke))})},"bpmn:DataStoreReference":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:0,my:.133}});return v(L,G,{fill:at(E,s,x.fill),fillOpacity:Wo,stroke:_e(E,c,x.stroke),strokeWidth:2})},"bpmn:EndEvent":function(L,E,x={}){var{renderIcon:G=!0}=x;x=ft(x,["fill","stroke"]);var U=le(L,E,{...x,strokeWidth:4});return G&&N(E,L,x),U},"bpmn:EventBasedGateway":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=ae(E),U=ve(L,E,x);h(L,E.width,E.height,E.height*.2,{fill:at(E,"none",x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1});var Z=G.get("eventGatewayType"),Re=!!G.get("instantiate");function Xe(){var Vt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:E.width,containerHeight:E.height,position:{mx:.36,my:.44}});v(L,Vt,{fill:"none",stroke:_e(E,c,x.stroke),strokeWidth:2})}if(Z==="Parallel"){var dt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}});v(L,dt,{fill:"none",stroke:_e(E,c,x.stroke),strokeWidth:1})}else Z==="Exclusive"&&(Re||h(L,E.width,E.height,E.height*.26,{fill:"none",stroke:_e(E,c,x.stroke),strokeWidth:1}),Xe());return U},"bpmn:ExclusiveGateway":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=ve(L,E,x),U=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}}),Z=pt(E);return Z.get("isMarkerVisible")&&v(L,U,{fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(L,E,x={}){return x=ft(x,["fill","stroke"]),ve(L,E,x)},"bpmn:Group":function(L,E,x={}){return x=ft(x,["fill","stroke","width","height"]),y(L,E.width,E.height,Tc,{stroke:_e(E,c,x.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:li(E,x),height:Wn(E,x)})},"bpmn:InclusiveGateway":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=ve(L,E,x);return h(L,E.width,E.height,E.height*.24,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(L,E,x={}){var{renderIcon:G=!0}=x;x=ft(x,["fill","stroke"]);var U=le(L,E,{...x,strokeWidth:1.5});return h(L,E.width,E.height,Pc,{fill:"none",stroke:_e(E,c,x.stroke),strokeWidth:1.5}),G&&N(E,L,x),U},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Lane":function(L,E,x={}){return x=ft(x,["fill","stroke","width","height"]),q(L,E,{...x,fillOpacity:PM})},"bpmn:ManualTask":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=Te(L,E,x),U=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return v(L,U,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=ae(E),U=pt(E),Z=at(E,s,x.fill),Re=_e(E,c,x.stroke),Xe=g(L,E.waypoints,{markerEnd:d(L,"messageflow-end",Z,Re),markerStart:d(L,"messageflow-start",Z,Re),stroke:Re,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var dt=Xe.getPointAtLength(Xe.getTotalLength()/2),Vt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:dt.x,y:dt.y}}),wt={strokeWidth:1};U.get("messageVisibleKind")==="initiating"?(wt.fill=Z,wt.stroke=Re):(wt.fill=Re,wt.stroke=Z);var ln=v(L,Vt,wt),gn=G.get("messageRef"),yn=gn.get("name"),Et=Q(L,yn,{align:"center-top",fitBox:!0,style:{fill:Re}}),un=ln.getBBox(),hn=Et.getBBox(),vo=dt.x-hn.width/2,Zn=dt.y+un.height/2+RM;Rc(Et,vo,Zn,0)}return Xe},"bpmn:ParallelGateway":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=ve(L,E,x),U=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.2}});return v(L,U,{fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke),strokeWidth:1}),G},"bpmn:Participant":function(L,E,x={}){x=ft(x,["fill","stroke","width","height"]);var G=q(L,E,x),U=st(E),Z=dn(E),Re=ae(E),Xe=Re.get("name");if(U){var dt=Z?[{x:30,y:0},{x:30,y:Wn(E,x)}]:[{x:0,y:30},{x:li(E,x),y:30}];_(L,dt,{stroke:_e(E,c,x.stroke),strokeWidth:CM}),Be(L,Xe,E,x)}else{var Vt=ja(E,x);Z||(Vt.height=li(E,x),Vt.width=Wn(E,x));var wt=Q(L,Xe,{box:Vt,align:"center-middle",style:{fill:Fa(E,l,c,x.stroke)}});if(!Z){var ln=-1*Wn(E,x);Rc(wt,0,-ln,270)}}return Re.get("participantMultiplicity")&&D("ParticipantMultiplicityMarker",L,E,x),G},"bpmn:ReceiveTask":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=ae(E),U=Te(L,E,x),Z;return G.get("instantiate")?(h(L,28,28,20*.22,{fill:at(E,s,x.fill),stroke:_e(E,c,x.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}}),v(L,Z,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1}),U},"bpmn:ScriptTask":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=Te(L,E,x),U=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return v(L,U,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=Te(L,E,x),U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return v(L,U,{fill:_e(E,c,x.stroke),stroke:at(E,s,x.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=at(E,s,x.fill),U=_e(E,c,x.stroke),Z=g(L,E.waypoints,{markerEnd:d(L,"sequenceflow-end",G,U),stroke:U}),Re=ae(E),{source:Xe}=E;if(Xe){var dt=ae(Xe);Re.get("conditionExpression")&&S(dt,"bpmn:Activity")&&Se(Z,{markerStart:d(L,"conditional-flow-marker",G,U)}),dt.get("default")&&(S(dt,"bpmn:Gateway")||S(dt,"bpmn:Activity"))&&dt.get("default")===Re&&Se(Z,{markerStart:d(L,"conditional-default-flow-marker",G,U)})}return Z},"bpmn:ServiceTask":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=Te(L,E,x);h(L,10,10,{fill:at(E,s,x.fill),stroke:"none",transform:"translate(6, 6)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});v(L,U,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1}),h(L,10,10,{fill:at(E,s,x.fill),stroke:"none",transform:"translate(11, 10)"});var Z=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return v(L,Z,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(L,E,x={}){var{renderIcon:G=!0}=x;x=ft(x,["fill","stroke"]);var U=ae(E);U.get("isInterrupting")||(x={...x,strokeDasharray:"6"});var Z=le(L,E,x);return G&&N(E,L,x),Z},"bpmn:SubProcess":function(L,E,x={}){return st(E)?x=ft(x,["fill","stroke","width","height"]):x=ft(x,["fill","stroke"]),V(L,E,x)},"bpmn:Task":function(L,E,x={}){return x=ft(x,["fill","stroke"]),Te(L,E,x)},"bpmn:TextAnnotation":function(L,E,x={}){x=ft(x,["fill","stroke"]);var{width:G,height:U}=ja(E,x),Z=y(L,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}});v(L,Re,{stroke:_e(E,c,x.stroke)});var Xe=ae(E),dt=Xe.get("text")||"";return Q(L,dt,{align:"left-top",box:ja(E,x),padding:Vo,style:{fill:Fa(E,l,c,x.stroke)}}),Z},"bpmn:Transaction":function(L,E,x={}){st(E)?x=ft(x,["fill","stroke","width","height"]):x=ft(x,["fill","stroke"]);var G=V(L,E,{strokeWidth:1.5,...x}),U=n.style(["no-fill","no-events"],{stroke:_e(E,c,x.stroke),strokeWidth:1.5}),Z=st(E);return Z||(x={}),y(L,li(E,x),Wn(E,x),Tc-Pc,Pc,U),G},"bpmn:UserTask":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=Te(L,E,x),U=15,Z=12,Re=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:Z}});v(L,Re,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:.5});var Xe=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:Z}});v(L,Xe,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:.5});var dt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:Z}});return v(L,dt,{fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke),strokeWidth:.5}),G},label:function(L,E,x={}){return Me(L,E,x)}};this._drawPath=v,this._renderer=R}Ee(oo,Xi),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 Je(e)?kp(e,MM):S(e,"bpmn:Event")?ty(e):S(e,"bpmn:Activity")?kp(e,Tc):S(e,"bpmn:Gateway")?wM(e):EM(e)};function ft(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var TM=0,kM={width:150,height:50};function OM(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function DM(e){return pn(e)?W({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Op=null;function LM(){return Op||(Op=document.createElement("canvas").getContext("2d")),Op}function IM(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(ny(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function ny(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function BM(e,t){var n=LM();if(!n)return{width:0,height:0};n.font=IM(t),"letterSpacing"in n&&(n.letterSpacing=ny(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 NM(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=BM(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return $M(e,r,i,o);r=jM(r,o.width,t)}}function $M(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 iy="­";function FM(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===iy)&&r.pop();break}var a=r[r.length-1];return a&&a===iy&&(r[r.length-1]="-"),r.join("")}function jM(e,t,n){var i=Math.max(e.length*(n/t),1),r=FM(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function kc(e){this._config=W({},{size:kM,padding:TM,style:{},align:"center-top"},e||{})}kc.prototype.createText=function(e,t){return this.layoutText(e,t).element},kc.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},kc.prototype.layoutText=function(e,t){for(var n=W({},this._config.size,t.box),i=W({},this._config.style,t.style),r=OM(t.align||this._config.align),o=DM(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=HM(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(NM(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Hn(l,function(y,C,_){return y+(s||C.height)},0)+o.top+o.bottom,p=Hn(l,function(y,C,_){return C.width>y?C.width:y},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||l[0].height)/4;var m=Oe("text");Se(m,i),z(l,function(y){var C;switch(d+=s||y.height,r.horizontal){case"left":C=o.left;break;case"right":C=(a?p:u)-o.right-y.width;break;default:C=Math.max(((a?p:u)-y.width)/2+o.left,0)}var _=Oe("tspan");Se(_,{x:C,y:d}),_.textContent=y.text,Ue(m,_)});var h={width:p,height:f};return{dimensions:h,element:m}};function HM(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var zM=12,GM=1.2,VM=40;function ry(e){var t=W({fontFamily:"Arial, sans-serif",fontSize:zM,fontWeight:"normal",lineHeight:GM},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=W({},t,{fontSize:n},e&&e.externalStyle||{}),r=new kc({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(VM,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}}ry.$inject=["config.textRenderer"];function WM(){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=KM(i.d,{mx:r,my:o,e:a});return f}}var UM=/\{([^{}]+)\}/g,YM=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function qM(e,t,n){var i=n;return t.replace(YM,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 KM(e,t){return String(e).replace(UM,function(n,i){return qM(n,i,t)})}const XM={__init__:["bpmnRenderer"],bpmnRenderer:["type",oo],textRenderer:["type",ry],pathMap:["type",WM]};function ZM(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Ha={translate:["value",ZM]};function Oc(e,t,n){return W({id:e.id,type:e.$type,businessObject:e,di:t},n)}function QM(e,t,n){var i=e.waypoint;return!i||i.length<2?[$e(t),$e(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function oy(e,t,n){return new Error(`element ${Pn(t)} referenced by ${Pn(e)}#${n} not yet drawn`)}function er(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}er.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],er.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(Oc(e,t,a)),this._canvas.addRootElement(i)}else if(S(t,"bpmndi:BPMNShape")){var s=!st(e,t),c=eA(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Oc(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")&&(JM(n,$e(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(Oc(e,t,{hidden:r,source:u,target:f,waypoints:QM(t,u,f)})),S(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${Pn(t)} for element ${Pn(e)}`);return Rr(e)&&oi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},er.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Pn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw oy(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},er.prototype.addLabel=function(e,t,n){var i,r,o;return i=mM(t,n),r=oi(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Oc(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!oi(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)},er.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?oy(e,i,t+"Ref"):new Error(`${Pn(e)}#${t} Ref not specified`)},er.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},er.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},er.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function JM(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 eA(e){return S(e,"bpmn:Group")}const ay={__depends__:[XM,{__depends__:[Ha],bpmnImporter:["type",er]}]};function za(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 Dp(e){return Math.log(e)/Math.log(10)}var tA=1e3;function oe(e){this._eventBus=e}oe.$inject=["eventBus"];function nA(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}oe.prototype.on=function(e,t,n,i,r,o){if((fn(t)||ze(t))&&(o=r,r=i,i=n,n=t,t=null),fn(n)&&(o=r,r=i,i=n,n=tA),pn(r)&&(o=r,r=!1),!fn(i))throw new Error("handlerFn must be a function");Ne(e)||(e=[e]);var a=this._eventBus;z(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?nA(i,o):i,o)})},oe.prototype.canExecute=tr("canExecute"),oe.prototype.preExecute=tr("preExecute"),oe.prototype.preExecuted=tr("preExecuted"),oe.prototype.execute=tr("execute"),oe.prototype.executed=tr("executed"),oe.prototype.postExecute=tr("postExecute"),oe.prototype.postExecuted=tr("postExecuted"),oe.prototype.revert=tr("revert"),oe.prototype.reverted=tr("reverted");function tr(e){return function(n,i,r,o,a){(fn(n)||ze(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Lp=["top","bottom","left","right"],Dc=10;function Ip(e,t){oe.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(Ac(r)&&!Mt(r)){var o=oA(r);o&&i(r,o)}}function i(r,o){var a=$e(r),s=r.label,c=$e(s);if(s.parent){var l=Ie(r),u;switch(o){case"top":u={x:a.x,y:l.top-Dc-s.height/2};break;case"left":u={x:l.left-Dc-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Dc+s.height/2};break;case"right":u={x:l.right+Dc+s.width/2,y:a.y};break}var f=Ci(u,c);t.moveShape(s,f)}}}Ee(Ip,oe),Ip.$inject=["eventBus","modeling"];function iA(e){var t=e.host,n=$e(e),i=_n(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Lp.filter(function(a){return r.indexOf(a)===-1});return o}function rA(e){var t=$e(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 sy(t,i)});return n}function oA(e){var t=$e(e.label),n=$e(e),i=sy(n,t);if(aA(i)){var r=rA(e);if(e.host){var o=iA(e);r=r.concat(o)}var a=Lp.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?_n(e.label,e)!=="intersect"?void 0:i:a[0]}}function sy(e,t){return _n(t,e,5)}function aA(e){return Lp.indexOf(e)!==-1}function Bp(e){oe.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)}Ee(Bp,oe),Bp.$inject=["eventBus"];var sA=1500;function Np(e,t,n){e.invoke(oe,this),this.preExecute("elements.delete",sA,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=nt(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 z(o,l=>{const u=new Set(So(Fo(Array.from(s),Zt(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ee(Np,oe),Np.$inject=["injector","eventBus","canvas"];function $p(e,t){e.invoke(oe,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=nt(r.incoming.concat(r.outgoing),function(a){return S(a,"bpmn:Association")});z(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ee($p,oe),$p.$inject=["injector","modeling"];function Uo(e,t){for(Fn(t)&&(t=[t]);e=e.parent;)if(tt(e,t))return e;return null}function cy(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 dn(n);if(tt(e,i))return dn(e);var r;for(r=ae(e);r&&!S(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ae(a);return s&&s.get("processRef")===r});return o?dn(o):!0}var ly=500;function Lc(e,t){t.invoke(oe,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ly,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return uy(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",ly,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];uy(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Lc.$inject=["bpmnReplace","injector"],Ee(Lc,oe),Lc.prototype._replaceShape=function(e,t){var n=cA(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function cA(e){var t=ae(e),n=t.eventDefinitions;return n&&n[0]}function uy(e,t){return!Je(e)&&tt(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Fp(e,t){oe.call(this,e);function n(i){return nt(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")&&z(o.outgoing,function(a){var s=a.target,c=n(s);S(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Fp.$inject=["eventBus","modeling"],Ee(Fp,oe);function py(e){return e.create("bpmn:Category")}function lA(e){return e.create("bpmn:CategoryValue")}function fy(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=lA(e)),n.$parent||(n.$parent=py(e)),n}function uA(e,t,n){return qt(t.get("categoryValue"),e),e.$parent=t,qt(n.get("rootElements"),t),t.$parent=n,e}function pA(e){var t=e.$parent;return t&&(Ut(t.get("categoryValue"),e),e.$parent=null),e}function fA(e){var t=e.$parent;return t&&(Ut(t.get("rootElements"),e),e.$parent=null),e}var dA=500;function jp(e,t,n){n.invoke(oe,this);function i(c){return t.filter(function(l){return S(l,"bpmn:Group")&&!l.labelTarget}).map(ae).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)&&fA(l),c&&!r(c,u)&&pA(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,ae(l))},!0),this.executed(["shape.move","shape.resize"],dA,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,ae(l))},!0),this.executed("group.updateRefs",function(c){dy(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){dy(c).forEach(function(l){s(l.categoryValue,l.category,ae(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ae(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}jp.$inject=["bpmnjs","elementRegistry","injector"],Ee(jp,oe);function dy(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Hp(e,t,n){oe.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 C=y.source,_=y.target;Yo(C)&&Ga(_)&&u(_)}function r(y){const C=y.connection,_=y.source,g=y.target;Yo(_)&&Ic(g)&&(l(g),p(_,[C]))}function o(y){const C=y.newTarget,_=y.oldSource,g=y.oldTarget;if(g!==C){const v=_;Ga(g)&&u(g),Yo(v)&&Ic(C)&&l(C)}}function a(y){const{element:C}=y;Ga(C)?(f(C),d(C)):Ic(C)&&m(C)}function s(y){const{newData:C,oldShape:_}=y;if(Yo(y.oldShape)&&C.eventDefinitionType!=="bpmn:CompensateEventDefinition"||C.type!=="bpmn:BoundaryEvent"){const g=_.outgoing.find(({target:v})=>Ga(v));g&&g.target&&(y._connectionTarget=g.target)}else if(!Yo(y.oldShape)&&C.eventDefinitionType==="bpmn:CompensateEventDefinition"&&C.type==="bpmn:BoundaryEvent"){const g=_.outgoing.find(({target:v})=>Ic(v));g&&g.target&&(y._connectionTarget=g.target),h(_)}}function c(y){const{_connectionTarget:C,newShape:_}=y;C&&t.connect(_,C)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function f(y){for(const C of y.incoming)n.canConnect(C.source,y)||t.removeConnection(C);for(const C of y.outgoing)n.canConnect(y,C.target)||t.removeConnection(C)}function p(y,C){y.outgoing.filter(v=>S(v,"bpmn:Association")).filter(v=>Ga(v.target)&&!C.includes(v)).forEach(v=>t.removeConnection(v))}function d(y){const C=y.attachers.slice();C.length&&t.removeElements(C)}function m(y){const C=y.incoming.filter(_=>Yo(_.source));t.removeElements(C)}function h(y){const C=y.outgoing.filter(_=>S(_,"bpmn:SequenceFlow"));t.removeElements(C)}}Ee(Hp,oe),Hp.$inject=["eventBus","modeling","bpmnRules"];function Ga(e){const t=ae(e);return t&&t.get("isForCompensation")}function Yo(e){return e&&S(e,"bpmn:BoundaryEvent")&&Go(e,"bpmn:CompensateEventDefinition")}function Ic(e){return e&&S(e,"bpmn:Activity")&&!Tn(e)}function zp(e){e.invoke(oe,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"))})}zp.$inject=["injector"],Ee(zp,oe);function Gp(e,t){oe.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}})}Gp.$inject=["eventBus","bpmnFactory"],Ee(Gp,oe);var Vp=20,Wp=20,hy=30,Bc=2e3;function Up(e,t,n){oe.call(this,t),t.on(["create.start","shape.move.start"],Bc,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")&&!Je(f)&&!Mt(f)});if(c.length){var l=Zt(c),u=hA(a,l);W(a,u),o.createConstraints=mA(a,l)}}}),t.on("create.start",Bc,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",Bc,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",Bc,function(r){var o=r.elements,a=r.parent,s=gA(o),c;s&&S(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ae(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=ae(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)&&ae(s).set("processRef",ae(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)&&ae(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)}Up.$inject=["canvas","eventBus","modeling"],Ee(Up,oe);function hA(e,t){t={width:t.width+Vp*2+hy,height:t.height+Wp*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 mA(e,t){return t=Ie(t),{bottom:t.top+e.height/2-Wp,left:t.right-e.width/2+Vp,top:t.bottom-e.height/2+Wp,right:t.left+e.width/2-Vp-hy}}function gA(e){return kt(e,function(t){return S(t,"bpmn:Participant")})}var my="__targetRef_placeholder";function Yp(e,t){oe.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],gy(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],gy(o));function n(a,s,c){var l=a.get("dataInputAssociations");return kt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=kt(c,function(u){return u.name===my});return!l&&s&&(l=t.create("bpmn:Property",{name:my}),qt(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,C;h&&h!==f&&r(h,l),d&&d!==f&&r(d,l),f?(C=i(f,!0),y.targetRef=C):y.targetRef=null}}Yp.$inject=["eventBus","bpmnFactory"],Ee(Yp,oe);function gy(e){return function(t){var n=t.context,i=n.connection;if(S(i,"bpmn:DataInputAssociation"))return e(t)}}function Nc(e){this._bpmnUpdater=e}Nc.$inject=["bpmnUpdater"],Nc.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),[]},Nc.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 qp(e,t,n,i){oe.call(this,i),t.registerHandler("dataStore.updateContainment",Nc);function r(){return n.filter(function(s){return S(s,"bpmn:Participant")&&ae(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:pt(s),newSemanticParent:u.processRef||u,newDiParent:pt(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:vA(u,"bpmn:Participant");a(l,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();tt(l,["bpmn:Participant","bpmn:SubProcess"])&&S(u,"bpmn:Collaboration")&&o(u).filter(function(f){return yA(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)})})}qp.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ee(qp,oe);function yA(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 vA(e,t){for(;e.parent;){if(S(e.parent,t))return e.parent;e=e.parent}}var $c=Math.max,Fc=Math.min,bA=20;function yy(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function xA(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 _A(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 jc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return ze(r)&&(i=(/top|left/.test(e)?Fc:$c)(i,r)),ze(o)&&(i=(/top|left/.test(e)?$c:Fc)(i,o)),i}function wA(e,t){if(!t)return e;var n=Ie(e);return wc({top:jc("top",n,t),right:jc("right",n,t),bottom:jc("bottom",n,t),left:jc("left",n,t)})}function EA(e,t,n,i){var r=Ie(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Ie(i):o,s={top:Fc(o.top,a.top),left:Fc(o.left,a.left),bottom:$c(o.bottom,a.bottom),right:$c(o.right,a.right)};return wc(s)}function Va(e,t){return typeof e<"u"?e:bA}function SA(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 RA(e){return!(e.waypoints||e.type==="label")}function vy(e,t){var n;if(e.length===void 0?n=nt(e.children,RA):n=e,n.length)return SA(Zt(n),t)}var Cr=Math.abs;function CA(e,t){return yy(Ie(t),Ie(e))}var MA=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],ui=30;function Hc(e,t){return t=t||[],e.children.filter(function(n){S(n,"bpmn:Lane")&&(Hc(n,t),t.push(n))}),t}function Mr(e){return e.children.filter(function(t){return S(t,"bpmn:Lane")})}function pi(e){return Uo(e,MA)||e}function AA(e,t){var n=pi(e),i=S(n,"bpmn:Process")?[]:[n],r=Hc(n,i),o=Ie(e),a=Ie(t),s=CA(e,t),c=[],l=dn(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=Ie(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:_A(u,{top:f,right:p,bottom:d,left:m})})}}),c}var PA=500;function Kp(e,t){oe.call(this,e);function n(i,r){var o=dn(i),a=Mr(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",PA,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))})}Kp.$inject=["eventBus","spaceTool"],Ee(Kp,oe);var by=500;function zc(e,t){t.invoke(oe,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",by,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return xy(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",by,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;xy(a,kA(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}zc.$inject=["bpmnReplace","injector"],Ee(zc,oe),zc.prototype._replaceShape=function(e){var t=TA(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function TA(e){var t=ae(e),n=t.eventDefinitions;return n&&n[0]}function xy(e,t){return!Je(e)&&S(e,"bpmn:BoundaryEvent")&&!t}function kA(e,t){return e.indexOf(t)!==-1}var Gc=Math.round,OA=Math.max;function DA(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 LA(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var _y=10;function IA(e,t){var n,i;for(n=0;i=e[n];n++)if(La(i,t)<=_y)return{point:e[n],bendpoint:!0,index:n};return null}function BA(e,t){var n=Cg(DA(t,_y),LA(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=OA(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Gc(i.x+r.x)/2,y:Gc(i.y+r.y)/2},index:i.segment2}:{point:{x:Gc(i.x),y:Gc(i.y)},index:i.segment2}:null}function Xp(e,t){return IA(e,t)||BA(e,t)}function Zp(e,t,n){oe.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(),C;ze(a.width)?C=$e(a):C=a;var _=Xp(s,C);if(_){if(c=s.slice(0,_.index),l=s.slice(_.index+(_.bendpoint?1:0)),!c.length||!l.length)return;u=_.bendpoint?s[_.index]:C,(c.length===1||!wy(r,c[c.length-1]))&&c.push(Ey(u)),(l.length===1||!wy(r,l[0]))&&l.unshift(Ey(u))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||C),d=o),t.canConnect(r,p,o)&&(d?m=n.connect(r,p,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||C),m=o));var g=[].concat(d&&nt(y,function(v){return v.source===d.source})||[],m&&nt(h,function(v){return v.target===m.target})||[]);g.length&&n.removeElements(g)}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=$e(c),u={x:l.x+s.x,y:l.y+s.y},f=kt(o.children,function(p){var d=t.canInsert(a,p);return d&&Xp(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)}Ee(Zp,oe),Zp.$inject=["eventBus","bpmnRules","modeling"];function wy(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 Ey(e){return W({},e)}function Qp(e,t){oe.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)})})}})}Qp.$inject=["eventBus","modeling"],Ee(Qp,oe);function qo(e){return S(e,"bpmn:SequenceFlow")}var Vc=1500,Sy=2e3;function Ry(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"],Vc,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;S(a,"bpmn:Lane")&&!tt(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=pi(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||tt(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"],Vc,function(i){var r=i.hover;S(r,"bpmn:Lane")&&(i.hover=pi(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Vc,function(i){var r=i.context,o=i.hover,a=r.type;S(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=pi(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Vc,function(i){var r=i.context,o=r.start;S(o,"bpmn:Lane")&&(r.start=pi(o)||o)}),t.on("shape.move.start",Sy,function(i){var r=i.shape;S(r,"bpmn:Lane")&&(i.shape=pi(r)||r)}),t.on("spaceTool.move",Sy,function(i){var r=i.hover;r&&S(r,"bpmn:Lane")&&(i.hover=pi(r))})}Ry.$inject=["elementRegistry","eventBus","canvas"];var Cy=770;function Jp(e,t,n,i){n.invoke(oe,this);function r(s,c){var l=ae(s),u=c.categoryValue||l.categoryValueRef;u||(u=fy(e,l));var f=c.category||u.$parent||py(e);l.categoryValueRef=u,u.$parent=f,c.categoryValue=u,c.category=f}function o(s,c){var l=ae(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=ae(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=ae(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&&!ae(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&&!ae(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||ae(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",Cy,function(s){var c=s.descriptor,l=s.element;if(!(!S(l,"bpmn:Group")||l.labelTarget)){var u=ae(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",Cy,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"],Ee(Jp,oe);function ef(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 My(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=ef(i,r,o,a),l=ef(i,r,o,s),u;c&&l?Ay(c,o)>Ay(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],$e(i.source)),t(r[r.length-1],r[r.length-2],$e(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}My.$inject=["eventBus"];function Ay(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function tf(e){oe.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=ae(i),o=pt(i);if(tt(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}tf.$inject=["eventBus"],Ee(tf,oe);function Py(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ty(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function NA(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 $A(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 nf(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=$A([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 ky(e,t){var n=nf(e,t),i={x:n.x-e.x,y:n.y-e.y};return Py(i)}function Wa(e,t){return Py({x:e.x-t.x,y:e.y-t.y})}var Oy=Math.sqrt,Dy=Math.min,FA=Math.max,Ly=Math.abs;function Iy(e){return Math.pow(e,2)}function Ua(e,t){return Oy(Iy(e.x-t.x)+Iy(e.y-t.y))}function jA(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],Ny(i,r)?l=[i]:(o=Ua(e,i),a=Ua(e,r),c=Dy(o,a),l=HA(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:Ny(i,l[0])?n:n+1}),l.length===2&&(s=GA(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 HA(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=Oy(d),h=-f+m,y=-f-m,C={x:e.x-r*h,y:e.y-o*h};if(d===0)return[C];var _={x:e.x-r*y,y:e.y-o*y};return[C,_].filter(function(g){return zA(g,e,t)})}function zA(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>=Dy(t,n)-Wc&&e<=FA(t,n)+Wc}function GA(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Wc=.1;function Ny(e,t){return Ly(e.x-t.x)<=Wc&&Ly(e.y-t.y)<=Wc}function VA(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=Fy(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=jA(e,n),c=s.segmentIndex,l=VA(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=jy(n,c),f=jy(t,l),p=s.position,d=UA(u,p),m=WA(u,f);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,C=n[y];if(t.indexOf(C)!==-1)return a;if(h===0){var _=t[y];return r=_.x-s.position.x,o=_.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=Fy(n,y))}var g={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},v=NA({x:e.x-p.x,y:e.y-p.y},m);return r=g.x+v.x-e.x,o=g.y+v.y-e.y,{point:Qi(g),delta:Qi({x:r,y:o})}}function Fy(e,t){var n=Wa(e[t-1],e[t]),i=Wa(e[t],e[t+1]),r=n/(n+i);return r}function WA(e,t){var n=Ty(e),i=Ty(t);return i-n}function jy(e,t){return[e[t],e[t+1]]}function UA(e,t){var n=Wa(e[0],e[1]),i=Wa(e[0],t);return n===0?0:i/n}function YA(e,t,n,i){var r=$e(e);return $y(r,t,n,i).delta}function Ya(e,t,n){var i=za(t),r=za(n),o=Ci(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Qi({x:r.x+a.x,y:r.y+a.y})}function Hy(e,t,n){var i=za(e),r=za(t),o=za(n),a=Ci(e,i),s=Ci(i,r),c=qA(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 Qi({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function qA(e,t,n){var i=Ie(t),r=Ie(n);if(KA(i,r))return null;var o=_n(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=_n(n,s),c!==o?null:a}function KA(e,t){return XA(e,t)||ZA(e,t)}function XA(e,t){return e.right!==t.right&&e.left!==t.left}function ZA(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var zy="name",Gy="text";function rf(e,t,n,i){oe.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ae(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(zy in l&&t.updateLabel(c,l[zy]),Gy in l&&S(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Gy]||"");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;Je(l)||!Rr(l)||oi(l)&&t.updateLabel(l,oi(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),YA(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=ae(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(!(!Je(c)||l.autoResize)){var u=s.newBounds,f=i.getDimensions(oi(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(Ac(c)){var f=c.label,p=$e(f),d=eP(u),m=JA(p,d),h=QA(m,u,l);t.moveShape(f,h)}})}Ee(rf,oe),rf.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function QA(e,t,n){var i=Ya(e,t,n);return Qi(Ci(i,e))}function JA(e,t){if(t.length){var n=tP(e,t);return nf(e,n)}}function eP(e){return[[{x:e.x,y:e.y},{x:e.x+(e.width||0),y:e.y}],[{x:e.x+(e.width||0),y:e.y},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y+(e.height||0)},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y},{x:e.x,y:e.y+(e.height||0)}]]}function tP(e,t){var n=t.map(function(r){return{line:r,distance:ky(e,r)}}),i=Pi(n,"distance");return i[0].line}function nP(e,t,n,i){return $y(e,t,n,i).point}function of(e,t){oe.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),nP(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)})})}Ee(of,oe),of.$inject=["eventBus","modeling"];function Uc(e,t,n){var i=qc(e),r=Wy(i,t),o=i[0];return r.length?r[r.length-1]:Ya(o.original||o,n,t)}function Yc(e,t,n){var i=qc(e),r=Wy(i,t),o=i[i.length-1];return r.length?r[0]:Ya(o.original||o,n,t)}function af(e,t,n){var i=qc(e),r=Vy(t,n),o=i[0];return Ya(o.original||o,r,t)}function sf(e,t,n){var i=qc(e),r=Vy(t,n),o=i[i.length-1];return Ya(o.original||o,r,t)}function Vy(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function qc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Wy(e,t){var n=Cn(e,rP);return nt(n,function(i){return iP(i,t)})}function iP(e,t){return _n(t,e,1)==="intersect"}function rP(e){return e.original||e}function cf(e,t){oe.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(oP(i,r)){var o=aP(i);o.incoming.forEach(function(a){var s=Yc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Uc(a,r,i);t.reconnectStart(a,r,s)})}},!0)}cf.$inject=["eventBus","modeling"],Ee(cf,oe);function oP(e,t){return S(e,"bpmn:Participant")&&st(e)&&S(t,"bpmn:Participant")&&!st(t)}function aP(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 sP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Uy(e){const t=ae(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:sP.some(i=>S(n[0],i))}function Yy(e){return S(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function lf(e,t){e.invoke(oe,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Uy(r))return;const a=Yy(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ae(i).get(a),l=ae(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}lf.$inject=["injector","modeling"],Ee(lf,oe);function uf(e,t){oe.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=pt(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}Ee(uf,oe),uf.$inject=["eventBus","modeling"];function pf(e,t,n){oe.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=cP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}Ee(pf,oe),pf.$inject=["eventBus","bpmnRules","modeling"];function Ko(e){return e.original||e}function cP(e,t){var n=ef(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 ff(e,t){oe.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)}ff.$inject=["eventBus","modeling"],Ee(ff,oe);function df(e,t,n,i){oe.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;z(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=kt(f.outgoing,Co({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})})}Ee(df,oe),df.$inject=["eventBus","modeling","bpmnRules","injector"];function Kc(e,t,n,i,r,o){i.invoke(oe,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=Hn(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=[];z(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})})}Ee(Kc,oe),Kc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;z(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)},Kc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var lP=1500,uP={width:140,height:120},hf={width:300,height:60},mf={width:60,height:300},Xc={width:300,height:150},Zc={width:150,height:300},qy={width:140,height:120},Ky={width:100,height:40};function Xy(e){e.on("resize.start",lP,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=mP(i,r,o)),S(i,"bpmn:SubProcess")&&st(i)&&(n.minDimensions=qy),S(i,"bpmn:TextAnnotation")&&(n.minDimensions=Ky)})}Xy.$inject=["eventBus"];var Ar=Math.abs,pP=Math.min,fP=Math.max;function Zy(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Xo(e,t,n){return Zy(e,t,n,pP)}function Zo(e,t,n){return Zy(e,t,n,fP)}var dP={top:20,left:50,right:20,bottom:20},hP={top:50,left:20,right:20,bottom:20};function mP(e,t,n){var i=pi(e),r=!0,o=!0,a=Hc(i,[i]),s=Ie(e),c={},l={},u=dn(e),f=u?hf:mf;/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=Ie(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&&Ar(s.top-h.bottom)<10&&Zo(c,"top",h.top+f.height),Ar(s.top-h.top)<5&&Xo(l,"top",h.bottom-f.height)),/e/.test(t)&&(n&&Ar(s.right-h.left)<10&&Xo(c,"right",h.right-f.width),Ar(s.right-h.right)<5&&Zo(l,"right",h.left+f.width)),/s/.test(t)&&(n&&Ar(s.bottom-h.top)<10&&Xo(c,"bottom",h.bottom-f.height),Ar(s.bottom-h.bottom)<5&&Zo(l,"bottom",h.top+f.height)),/w/.test(t)&&(n&&Ar(s.left-h.right)<10&&Zo(c,"left",h.left+f.width),Ar(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?dP:hP;return p.forEach(function(m){var h=Ie(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 Qy(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Qo(e){return e.originalEvent||e.srcEvent}function gf(e){Qy(e),Qy(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 Jy(){return/mac/i.test(navigator.platform)}function ev(e,t){return(Qo(e)||e).button===t}function Pr(e){return ev(e,0)}function gP(e){return ev(e,1)}function qa(e){var t=Qo(e)||e;return Pr(e)?Jy()?t.metaKey:t.ctrlKey:!1}function Qc(e){var t=Qo(e)||e;return Pr(e)&&t.shiftKey}var tv=1001;function nv(e,t){e.on("resize.start",tv+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",tv,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=kg(a),t.resizeLane(r,a,i.balanced)),!1})}nv.$inject=["eventBus","modeling"];var yP=500;function yf(e,t,n,i,r){n.invoke(oe,this);function o(u){return tt(u,["bpmn:ReceiveTask","bpmn:SendTask"])||vP(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var f=e.getDefinitions(),p=f.get("rootElements");return!!kt(p,Co({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(tt(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(tt(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=ae(f),d=c(p),m;d&&!a(d)&&(m=e.getDefinitions().get("rootElements"),qt(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=ae(p),m=c(d);m&&(f.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",yP,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)})}yf.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ee(yf,oe);function vP(e,t){return Ne(t)||(t=[t]),hr(t,function(n){return Go(e,n)})}var iv=Math.max;function rv(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return z(n,function(a){var s=a.id;S(a,"bpmn:Participant")&&(o[s]=xP(a,i,r)),S(a,"bpmn:Lane")&&(o[s]=dn(a)?hf:mf),S(a,"bpmn:SubProcess")&&st(a)&&(o[s]=qy),S(a,"bpmn:TextAnnotation")&&(o[s]=Ky),S(a,"bpmn:Group")&&(o[s]=uP)}),o})}rv.$inject=["eventBus"];function bP(e){return e==="x"}function xP(e,t,n){var i=dn(e);if(!EP(e))return i?Xc:Zc;var r=bP(t),o={};return r?i?o=Xc:o={width:wP(e,n,r),height:Zc.height}:i?o={width:Xc.width,height:_P(e,n,r)}:o=Zc,o}function _P(e,t,n){var i;return i=SP(e,t,n),iv(Xc.height,i)}function wP(e,t,n){var i;return i=RP(e,t,n),iv(Zc.width,i)}function EP(e){return!!Mr(e).length}function SP(e,t,n){var i=Mr(e),r;return r=vf(i,t,n),e.height-r.height+hf.height}function RP(e,t,n){var i=Mr(e),r;return r=vf(i,t,n),e.width-r.width+mf.width}function vf(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=Mr(r),o.length?vf(o,t,n):r}var ov="_plane";function av(e){var t=e.id;return CP(t)}function Fi(e){var t=e.id;return S(e,"bpmn:SubProcess")?sv(t):t}function so(e){return sv(e)}function Jc(e){var t=pt(e);return S(t,"bpmndi:BPMNPlane")}function sv(e){return e+ov}function CP(e){return e.replace(new RegExp(ov+"$"),"")}var cv=400,MP=600,lv={x:180,y:160};function nr(e,t,n,i,r,o,a){oe.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")&&!st(f)}function l(f){var p=f.shape,d=f.newRootElement,m=ae(p);d=s._addDiagram(d||m),f.newRootElement=e.addRootElement(d)}function u(f){var p=f.shape,d=ae(p);s._removeDiagram(d);var m=f.newRootElement=a.get(Fi(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;z(p,function(d){if(c(d)){var m=a.get(Fi(d));if(!(!m||!d.children||!d.children.length)){var h=uv(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")||!st(p)||z($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(Fi(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(Fi(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,m=e.findRoot(Fi(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(Jc(p)){a.updateId(p,so(y)),a.updateId(h,y);return}var C=a.get(so(h));C&&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(Jc(p)){a.updateId(p,so(h)),a.updateId(y,h);return}var C=a.get(so(y));C&&a.updateId(C,so(h))}}},!0),t.on("element.changed",function(f){var p=f.element;if(Jc(p)){var d=p,m=a.get(av(d));!m||m===d||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",cv,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(st(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",cv,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(st(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",MP,function(f){var p=f.shape;if(S(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(st(p))s._moveChildrenToShape(d.children.slice(),p),z($a(p.children),h=>{n.moveShape(h.annotation,{x:0,y:0},p.parent),z(h.associations,y=>{n.moveConnection(y,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var m=uv(p);s._moveChildrenToShape(m,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var m=Fi(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(pt(h),"bpmndi:BPMNPlane");if(y){var C=av(h),_=kt(m,function(g){return g.id===C});_&&(p.parent=_.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}Ee(nr,oe),nr.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:lv.x-r.x,y:lv.y-r.y};else{var a=$e(t),s=$e(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},nr.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(ey(e).map(i=>i.annotation));n.size&&z($a(e.children),i=>{n.has(i.annotation)&&z(i.associations,r=>{t.removeConnection(r)})})},nr.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},nr.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},nr.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:Fi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},nr.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=kt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},nr.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function AP(e){var t=[];return z($a(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function uv(e){return e.children.slice().concat(AP(e.children)).concat(PP(e))}function PP(e){return wp(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function bf(e,t){e.invoke(oe,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"))||!st(r))){var o=TP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}bf.$inject=["injector","modeling"],Ee(bf,oe);function TP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function xf(e,t){oe.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,oi(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}}})}Ee(xf,oe),xf.$inject=["eventBus","textRenderer"];function _f(e,t){oe.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(st(i))return;var r=Oa(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();z(s,function(l){o(l,!0)}),z(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,$e(i)):t.reconnectStart(a,i,$e(i)))}},!0)}Ee(_f,oe),_f.$inject=["eventBus","modeling"];var wf=500;function Ef(e,t,n){oe.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=kP(c).concat([a]),f=vy(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"],wf,function(a){var s=a.context,c=s.shape;S(c,"bpmn:SubProcess")&&(c.collapsed?pt(c).isExpanded=!1:(i(c.children),pt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],wf,function(a){var s=a.context,c=s.shape;c.collapsed?pt(c).isExpanded=!1:pt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],wf,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"})})}Ee(Ef,oe),Ef.$inject=["eventBus","elementFactory","modeling"];function kP(e){return e.filter(function(t){return!t.hidden})}function Sf(e,t,n,i){t.invoke(oe,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Je(a)||(S(a,"bpmn:Participant")&&st(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)})}Ee(Sf,oe),Sf.$inject=["canvas","injector","moddle","modeling"];function Rf(e,t){oe.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;OP(r,o)&&t.updateProperties(o,{default:null})})}Ee(Rf,oe),Rf.$inject=["eventBus","modeling"];function OP(e,t){if(!S(e,"bpmn:SequenceFlow"))return!1;var n=ae(t),i=ae(e);return n.get("default")===i}var DP=500,LP=5e3,pv=["shape.create","shape.delete","shape.move","shape.resize"],fv=[...pv,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Cf(e,t){oe.call(this,e);var n;function i(){return n=n||new IP,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(fv,LP,function(){i()}),this.postExecuted(fv,DP,function(){o()}),this.preExecute(pv,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))})}Cf.$inject=["eventBus","modeling"],Ee(Cf,oe);function IP(){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 BP=500,NP=5e3,dv=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],hv=[...dv,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Mf(e,t){oe.call(this,e);var n;function i(){return n=n||new $P,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(hv,NP,function(){i()}),this.postExecuted(hv,BP,function(){o()}),this.preExecute(dv,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"],Ee(Mf,oe);function $P(){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 Af(e,t){oe.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)FP(o)&&!HP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}Ee(Af,oe),Af.$inject=["eventBus","modeling"];function FP(e){const t=ae(e);return t&&t.isForCompensation}function jP(e){return e&&S(e,"bpmn:BoundaryEvent")&&Go(e,"bpmn:CompensateEventDefinition")}function HP(e){return e.incoming.filter(n=>jP(n.source)).length>0}const zP={__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",Ip],appendBehavior:["type",Bp],associationBehavior:["type",$p],attachEventBehavior:["type",Lc],artifactBehavior:["type",Np],boundaryEventBehavior:["type",Fp],categoryRootElementReferenceBehavior:["type",jp],compensateBoundaryEventBehaviour:["type",Hp],createBehavior:["type",zp],createDataObjectBehavior:["type",Gp],createParticipantBehavior:["type",Up],dataInputAssociationBehavior:["type",Yp],dataStoreBehavior:["type",qp],deleteLaneBehavior:["type",Kp],detachEventBehavior:["type",zc],dropOnFlowBehavior:["type",Zp],eventBasedGatewayBehavior:["type",Qp],fixHoverBehavior:["type",Ry],groupBehavior:["type",Jp],importDockingFix:["type",My],isHorizontalFix:["type",tf],labelBehavior:["type",rf],layoutConnectionBehavior:["type",of],messageFlowBehavior:["type",cf],nonInterruptingBehavior:["type",lf],removeElementBehavior:["type",pf],removeEmbeddedLabelBoundsBehavior:["type",uf],removeParticipantBehavior:["type",ff],replaceConnectionBehavior:["type",df],replaceElementBehaviour:["type",Kc],resizeBehavior:["type",Xy],resizeLaneBehavior:["type",nv],rootElementReferenceBehavior:["type",yf],spaceToolBehavior:["type",rv],subProcessPlaneBehavior:["type",nr],subProcessStartEventBehavior:["type",bf],textAnnotationBehavior:["type",xf],toggleCollapseConnectionBehaviour:["type",_f],toggleElementCollapseBehaviour:["type",Ef],unclaimIdBehavior:["type",Sf],unsetDefaultFlowBehavior:["type",Rf],updateFlowNodeRefsBehavior:["type",Cf],updateCategoryValueRefsBehavior:["type",Mf],setCompensationActivityAfterPasteBehavior:["type",Af]};function Pf(e){this._commandStack=e.get("commandStack",!1)}Pf.$inject=["injector"],Pf.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const ji={__init__:["rules"],rules:["type",Pf]};function fi(e){oe.call(this,e),this.init()}fi.$inject=["eventBus"],Ee(fi,oe),fi.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)})},fi.prototype.init=function(){};function mv(e,t){var n=_n(e,t,-15);return n!=="intersect"?n:null}function En(e){fi.call(this,e)}Ee(En,fi),En.$inject=["eventBus"],En.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return GP(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 tl(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return tl(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 Av(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Mt(i)&&!nl(t,i)?!1:Xr(t,function(r){return Mt(r)?tl(r.source,r.target,r):r.host?Ka(r,r.host,null,n):Df(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 wv(a)&&!n.includes(a.host)})?!1:Ka(n,t,null,i)||Cv(n,t,i)||Mv(n,t)||nl(n,t)}),this.addRule("shape.create",function(e){return Df(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 Dv(n,t)})},En.prototype.canConnectMessageFlow=kv,En.prototype.canConnectSequenceFlow=Ov,En.prototype.canConnectDataAssociation=Lf,En.prototype.canConnectAssociation=Pv,En.prototype.canConnectCompensationAssociation=Tv,En.prototype.canMove=Mv,En.prototype.canAttach=Ka,En.prototype.canReplace=Cv,En.prototype.canDrop=Jo,En.prototype.canInsert=nl,En.prototype.canCreate=Df,En.prototype.canConnect=tl,En.prototype.canResize=Av,En.prototype.canCopy=Dv;function GP(e){return Tf(e)?null:tt(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Tf(e){return!e||Je(e)}function gv(e){do{if(S(e,"bpmn:Process"))return ae(e);if(S(e,"bpmn:Participant"))return ae(e).processRef||ae(e)}while(e=e.parent)}function kf(e){return S(e,"bpmn:TextAnnotation")}function Of(e){return S(e,"bpmn:Group")&&!e.labelTarget}function yv(e){return S(e,"bpmn:BoundaryEvent")&&Hi(e,"bpmn:CompensateEventDefinition")}function el(e){return ae(e).isForCompensation}function VP(e,t){var n=gv(e),i=gv(t);return n===i}function WP(e){return S(e,"bpmn:InteractionNode")&&!S(e,"bpmn:BoundaryEvent")&&(!S(e,"bpmn:Event")||S(e,"bpmn:ThrowEvent")&&xv(e,"bpmn:MessageEventDefinition"))}function UP(e){return S(e,"bpmn:InteractionNode")&&!el(e)&&(!S(e,"bpmn:Event")||S(e,"bpmn:CatchEvent")&&xv(e,"bpmn:MessageEventDefinition"))&&!(S(e,"bpmn:BoundaryEvent")&&!Hi(e,"bpmn:MessageEventDefinition"))}function vv(e){for(var t=e;t=t.parent;){if(S(t,"bpmn:FlowElementsContainer"))return ae(t);if(S(t,"bpmn:Participant"))return ae(t).processRef}return null}function bv(e,t){var n=vv(e),i=vv(t);return n===i}function Hi(e,t){var n=ae(e);return!!kt(n.eventDefinitions||[],function(i){return S(i,t)})}function xv(e,t){var n=ae(e);return(n.eventDefinitions||[]).every(function(i){return S(i,t)})}function YP(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:EndEvent")&&!Tn(e)&&!(S(e,"bpmn:IntermediateThrowEvent")&&Hi(e,"bpmn:LinkEventDefinition"))&&!yv(e)&&!el(e)}function qP(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:StartEvent")&&!S(e,"bpmn:BoundaryEvent")&&!Tn(e)&&!(S(e,"bpmn:IntermediateCatchEvent")&&Hi(e,"bpmn:LinkEventDefinition"))&&!el(e)}function KP(e){return S(e,"bpmn:ReceiveTask")||S(e,"bpmn:IntermediateCatchEvent")&&(Hi(e,"bpmn:MessageEventDefinition")||Hi(e,"bpmn:TimerEventDefinition")||Hi(e,"bpmn:ConditionalEventDefinition")||Hi(e,"bpmn:SignalEventDefinition"))}function XP(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function _v(e,t){var n=XP(t);return n.indexOf(e)!==-1}function tl(e,t,n){if(Tf(e)||Tf(t))return null;if(!S(n,"bpmn:DataAssociation")){if(kv(e,t))return{type:"bpmn:MessageFlow"};if(Ov(e,t))return{type:"bpmn:SequenceFlow"}}var i=Lf(e,t);return i||(Tv(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Pv(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Jo(e,t){return Je(e)||Of(e)?!0:S(t,"bpmn:Participant")&&!st(t)?!1:S(e,"bpmn:Participant")?S(t,"bpmn:Process")||S(t,"bpmn:Collaboration"):tt(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")&&!ZP(e)?!1:S(e,"bpmn:FlowElement")&&!S(e,"bpmn:DataStoreReference")?S(t,"bpmn:FlowElementsContainer")?st(t):tt(t,["bpmn:Participant","bpmn:Lane"]):S(e,"bpmn:DataStoreReference")&&S(t,"bpmn:Collaboration")?hr(ae(t).get("participants"),function(n){return!!n.get("processRef")}):tt(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?tt(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 ZP(e){return ae(e).cancelActivity&&(Ev(e)||Sv(e))}function wv(e){return!Je(e)&&S(e,"bpmn:BoundaryEvent")}function QP(e){return S(e,"bpmn:Lane")}function JP(e){return wv(e)||S(e,"bpmn:IntermediateThrowEvent")&&Ev(e)?!0:S(e,"bpmn:IntermediateCatchEvent")&&Sv(e)}function Ev(e){var t=ae(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Sv(e){return Rv(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Rv(e,t){return t.some(function(n){return Hi(e,n)})}function eT(e){return S(e,"bpmn:ReceiveTask")&&kt(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 Je(r)||!JP(r)||Tn(t)||!S(t,"bpmn:Activity")||el(t)||i&&!mv(i,t)||eT(t)?!1:"attach"}function Cv(e,t,n){if(!t)return!1;var i={replacements:[]};return z(e,function(r){Tn(t)||S(r,"bpmn:StartEvent")&&r.type!=="label"&&Jo(r,t)&&(lM(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(uM(r)||pM(r)||fM(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Rv(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")||Hi(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 Mv(e,t){return hr(e,QP)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Jo(n,t)})}function Df(e,t,n,i){return t?Je(e)||Of(e)?!0:Jo(e,t)||nl(e,t):!1}function Av(e,t,n){return S(e,"bpmn:SubProcess")?st(e)&&(!t||t.width>=100&&t.height>=80):S(e,"bpmn:Lane")||S(e,"bpmn:Participant")?!0:kf(e)?n?n==="e"||n==="w":!0:Of(e)?!0:Je(e)?n?n==="e"||n==="w":!0:!1}function tT(e,t){var n=kf(e),i=kf(t);return(n||i)&&n!==i}function Pv(e,t){return _v(t,e)||_v(e,t)?!1:tT(e,t)?!0:!!Lf(e,t)}function Tv(e,t){return bv(e,t)&&yv(e)&&S(t,"bpmn:Activity")&&!iT(t,e)&&!Tn(t)}function kv(e,t){return Iv(e)&&!Iv(t)?!1:WP(e)&&UP(t)&&!VP(e,t)}function Ov(e,t){return YP(e)&&qP(t)&&bv(e,t)&&!(S(e,"bpmn:EventBasedGateway")&&!KP(t))}function Lf(e,t){return tt(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function nl(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:tt(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Je(t)&&S(e,"bpmn:FlowNode")&&!S(e,"bpmn:BoundaryEvent")&&Jo(e,t.parent)}function If(e,t){return e&&t&&e.indexOf(t)!==-1}function Dv(e,t){return Je(t)?!0:!(S(t,"bpmn:Lane")&&!If(e,t.parent)||S(t,"bpmn:MessageFlow")&&!nT(e,t))}function nT(e,t){var n=Lv(t.source),i=Lv(t.target);return If(e,n)&&If(e,i)}function Lv(e){for(;e;e=e.parent)if(S(e,"bpmn:Participant"))return e;return null}function Iv(e){return Uo(e,"bpmn:Process")||Uo(e,"bpmn:Collaboration")}function iT(e,t){return e.attachers.includes(t)}const rT={__depends__:[ji],__init__:["bpmnRules"],bpmnRules:["type",En]};var oT=2e3;function Bv(e,t){e.on("saveXML.start",oT,n);function n(){var i=t.getRootElements();z(i,function(r){var o=pt(r),a,s;a=Oa([r]),a=nt(a,function(c){return c!==r&&!c.labelTarget}),s=Cn(a,pt),o.set("planeElement",s)})}}Bv.$inject=["eventBus","canvas"];const aT={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Bv]};function il(e){oe.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)})}il.prototype.getOrdering=function(e,t){return null},Ee(il,oe);function Bf(e,t){il.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=kt(n,function(c){return tt(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&&!tt(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=wh(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}}}Bf.$inject=["eventBus","canvas"],Ee(Bf,il);const sT={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Bf]};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 cT={clipboard:["type",Xa]};var Nv=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",Nv,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Nv,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),lT(c)}}$v.$inject=["elementRegistry","eventBus","injector"];function lT(e){return eo(e,"svg, .djs-element",!0)}const uT={__init__:["hoverFix"],hoverFix:["type",$v]};function pT(e){return!0}function rl(e){return Pr(e)||gP(e)}var Fv=500;function jv(e,t,n){var i=this;function r(T,N,k){if(!s(T,N)){var D,H,Q;k?H=t.getGraphics(k):(D=N.delegateTarget||N.target,D&&(H=D,k=t.get(H))),!(!H||!k)&&(Q=e.fire(T,{element:k,gfx:H,originalEvent:N}),Q===!1&&(N.stopPropagation(),N.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,N){var k=l[T]||Pr;return!k(N)}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":pT,"element.mousedown":rl,"element.mouseup":rl,"element.click":rl,"element.dblclick":rl};function u(T,N,k){var D=c[T];if(!D)throw new Error("unmapped DOM event name <"+T+">");return r(D,N,k)}var f="svg, .djs-element";function p(T,N,k,D){var H=o[k]=function(Q){r(k,Q)};D&&(l[k]=D),H.$delegate=Gn.bind(T,f,N,H)}function d(T,N,k){var D=a(k);D&&Gn.unbind(T,N,D.$delegate)}function m(T){z(c,function(N,k){p(T,k,N)})}function h(T){z(c,function(N,k){d(T,k,N)})}e.on("canvas.destroy",function(T){h(T.svg)}),e.on("canvas.init",function(T){m(T.svg)}),e.on(["shape.added","connection.added"],function(T){var N=T.element,k=T.gfx;e.fire("interactionEvents.createHit",{element:N,gfx:k})}),e.on(["shape.changed","connection.changed"],Fv,function(T){var N=T.element,k=T.gfx;e.fire("interactionEvents.updateHit",{element:N,gfx:k})}),e.on("interactionEvents.createHit",Fv,function(T){var N=T.element,k=T.gfx;i.createDefaultHit(N,k)}),e.on("interactionEvents.updateHit",function(T){var N=T.element,k=T.gfx;i.updateDefaultHit(N,k)});var y=w("djs-hit djs-hit-stroke"),C=w("djs-hit djs-hit-click-stroke"),_=w("djs-hit djs-hit-all"),g=w("djs-hit djs-hit-no-move"),v={all:_,"click-stroke":C,stroke:y,"no-move":g};function w(T,N){return N=W({stroke:"white",strokeWidth:15},N||{}),n.cls(T,["no-fill","no-border"],N)}function R(T,N){var k=v[N];if(!k)throw new Error("invalid hit type <"+N+">");return Se(T,k),T}function P(T,N){Ue(T,N)}this.removeHits=function(T){var N=mc(".djs-hit",T);z(N,an)},this.createDefaultHit=function(T,N){var k=T.waypoints,D=T.isFrame,H;return k?this.createWaypointsHit(N,k):(H=D?"stroke":"all",this.createBoxHit(N,H,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,N){var k=ka(N);return R(k,"stroke"),P(T,k),k},this.createBoxHit=function(T,N,k){k=W({x:0,y:0},k);var D=Oe("rect");return R(D,N),Se(D,k),P(T,D),D},this.updateDefaultHit=function(T,N){var k=Rt(".djs-hit",N);if(k)return T.waypoints?_p(k,T.waypoints):Se(k,{width:T.width,height:T.height}),k},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}jv.$inject=["eventBus","elementRegistry","styles"];const ol={__init__:["interactionEvents"],interactionEvents:["type",jv]};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();Ne(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?z(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Hv="hover",zv="selected";function Gv(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,Hv)}),t.on("element.out",function(r){i(r.element,Hv)}),t.on("selection.changed",function(r){function o(l){i(l,zv)}function a(l){n(l,zv)}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)})}Gv.$inject=["canvas","eventBus"];function Vv(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;Ne(l)?t.select(l):t.select(s.filter(fT))}}),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=kt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Pr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Qc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Vv.$inject=["eventBus","selection","canvas","elementRegistry"];function fT(e){return!e.hidden}const di={__init__:["selectionVisuals","selectionBehavior"],__depends__:[ol],selection:["type",ea],selectionVisuals:["type",Gv],selectionBehavior:["type",Vv]};var dT=/^djs-cursor-.*$/;function al(e){var t=$t(document.body);t.removeMatching(dT),e&&t.add("djs-cursor-"+e)}function Wv(){al(null)}var hT=5e3;function Uv(e,t){t=t||"element.click";function n(){return!1}return e.once(t,hT,n),function(){e.off(t,n)}}var mT=["c","C"],gT=["v","V"],yT=["d","D"],vT=["x","X"],bT=["y","Y"],Yv=["z","Z"];function xT(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Un(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function sn(e,t){return e=Ne(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Nf(e){return e.shiftKey}function _T(e){return Un(e)&&sn(mT,e)}function wT(e){return Un(e)&&sn(gT,e)}function ET(e){return Un(e)&&sn(yT,e)}function ST(e){return Un(e)&&sn(vT,e)}function RT(e){return Un(e)&&!Nf(e)&&sn(Yv,e)}function CT(e){return Un(e)&&(sn(bT,e)||sn(Yv,e)&&Nf(e))}var ta=Math.round,qv="djs-drag-active";function co(e){e.preventDefault()}function MT(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function AT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Kv(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(g){var v=t.viewbox(),w=t._container.getBoundingClientRect();return{x:v.x+(g.x-w.left)/v.scale,y:v.y+(g.y-w.top)/v.scale}}function s(g,v){v=v||o;var w=e.createEvent(W({},v.payload,v.data,{isTouch:v.isTouch}));return e.fire("drag."+g,w)===!1?!1:e.fire(v.prefix+"."+g,w)}function c(g){var v=g.filter(function(w){return i.get(w.id)});v.length&&n.select(v)}function l(g,v){var w=o.payload,R=o.displacement,P=o.globalStart,T=ao(g),N=Ci(T,P),k=o.localStart,D=a(T),H=Ci(D,k);if(!o.active&&(v||AT(N)>o.threshold)){if(W(w,{x:ta(k.x+R.x),y:ta(k.y+R.y),dx:0,dy:0},{originalEvent:g}),s("start")===!1)return y();o.active=!0,o.keepSelection||(w.previousSelection=n.get(),n.select(null)),o.cursor&&al(o.cursor),t.addMarker(t.getRootElement(),qv)}gf(g),o.active&&(W(w,{x:ta(D.x+R.x),y:ta(D.y+R.y),dx:ta(H.x),dy:ta(H.y)},{originalEvent:g}),s("move"))}function u(g){var v,w=!0;o.active&&(g&&(o.payload.originalEvent=g,gf(g)),w=s("end")),w===!1&&s("rejected"),v=C(w!==!0),s("ended",v)}function f(g){sn("Escape",g)&&(co(g),y())}function p(g){var v;o.active&&(v=Uv(e),setTimeout(v,400),co(g)),u(g)}function d(g){l(g)}function m(g){var v=o.payload;v.hoverGfx=g.gfx,v.hover=g.element,s("hover")}function h(g){s("out");var v=o.payload;v.hoverGfx=null,v.hover=null}function y(g){var v;if(o){var w=o.active;w&&s("cancel"),v=C(g),w&&s("canceled",v)}}function C(g){var v,w;s("cleanup"),Wv(),o.trapClick?w=p:w=u,Ge.unbind(document,"mousemove",l),Ge.unbind(document,"dragstart",co),Ge.unbind(document,"selectstart",co),Ge.unbind(document,"mousedown",w,!0),Ge.unbind(document,"mouseup",w,!0),Ge.unbind(document,"keyup",f),Ge.unbind(document,"touchstart",d,!0),Ge.unbind(document,"touchcancel",y,!0),Ge.unbind(document,"touchmove",l,!0),Ge.unbind(document,"touchend",u,!0),e.off("element.hover",m),e.off("element.out",h),t.removeMarker(t.getRootElement(),qv);var R=o.payload.previousSelection;return g!==!1&&R&&!n.get().length&&c(R),v=o,o=null,v}function _(g,v,w,R){o&&y(!1),typeof v=="string"&&(R=w,w=v,v=null),R=W({},r,R||{});var P=R.data||{},T,N,k,D,H;if(R.trapClick?D=p:D=u,g?(T=Qo(g)||g,N=ao(g),gf(g),T.type==="dragstart"&&co(T)):(T=null,N={x:0,y:0}),k=a(N),v||(v=k),H=MT(T),o=W({prefix:w,data:P,payload:{},globalStart:N,displacement:Ci(v,k),localStart:k,isTouch:H},R),R.manual||(H?(Ge.bind(document,"touchstart",d,!0),Ge.bind(document,"touchcancel",y,!0),Ge.bind(document,"touchmove",l,!0),Ge.bind(document,"touchend",u,!0)):(Ge.bind(document,"mousemove",l),Ge.bind(document,"dragstart",co),Ge.bind(document,"selectstart",co),Ge.bind(document,"mousedown",D,!0),Ge.bind(document,"mouseup",D,!0)),Ge.bind(document,"keyup",f),e.on("element.hover",m),e.on("element.out",h)),s("init")===!1)return y(),!1;R.autoActivate&&l(g,!0)}e.on("diagram.destroy",y),this.init=_,this.move=l,this.hover=m,this.out=h,this.end=u,this.cancel=y,this.context=function(){return o},this.setOptions=function(g){W(r,g)}}Kv.$inject=["eventBus","canvas","selection","elementRegistry"];const ir={__depends__:[uT,di],dragging:["type",Kv]};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 TT=["marker-start","marker-mid","marker-end"],kT=["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=cg(n);return this._cloneMarkers(io(r),i),Se(r,this._styles.cls(i,[])),Ue(t,r),Se(r,"data-preview-support-element-id",e.id),r},Tr.prototype.addFrame=function(e,t){var n=Oe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ue(t,n),Se(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)}),IT(e)&&TT.forEach(function(r){if(Se(e,r)){var o=OT(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=Rt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||cg(n);s.id=o,ut(s).add(r);var c=Rt(":scope > defs",e);c||(c=Oe("defs"),Ue(e,c)),Ue(c,s);var l=LT(s.id);Se(t,i,l)};function OT(e,t,n){var i=DT(Se(e,t));return Rt("marker#"+i,n||document)}function DT(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function LT(e){return"url(#"+e+")"}function IT(e){return kT.indexOf(e.nodeName)!==-1}const ia={__init__:["previewSupport"],previewSupport:["type",Tr]};var BT="drop-ok",Xv="drop-not-ok",Zv="attach-ok",Qv="new-parent",Jv="create",NT=2e3;function eb(e,t,n,i,r){function o(c,l,u,f,p){if(!l)return!1;c=nt(c,function(_){var g=_.labelTarget;return!_.parent&&!(Je(_)&&c.indexOf(g)!==-1)});var d=kt(c,function(_){return!Mt(_)}),m=!1,h=!1,y=!1;nb(c)&&(m=r.allowed("shape.attach",{position:u,shape:d,target:l})),m||(nb(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 C=p.connectionTarget;return y||m?(d&&f&&(h=r.allowed("connection.create",{source:C===f?d:f,target:C===f?f:d,hints:{targetParent:l,targetAttach:m}})),{attach:m,connect:h}):y===null||m===null?null:!1}function a(c,l){[Zv,BT,Xv,Qv].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}tb(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,Zv):a(f,h?Qv:Xv))}),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,C=l.hints||{};if(m===!1||!d)return!1;tb(c);var _={x:c.x,y:c.y};y?f=i.appendShape(u,f,_,d,{attach:h,connection:y===!0?{}:y,connectionTarget:C.connectionTarget}):(p=i.createElements(p,_,d,W({},C,{attach:h})),f=kt(p,function(g){return!Mt(g)})),W(l,{elements:p,shape:f}),W(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===Jv&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],NT,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Ne(l)||(l=[l]);var f=kt(l,function(m){return!Mt(m)});if(f){u=W({elements:l,hints:{},shape:f},u||{}),z(l,function(m){ze(m.x)||(m.x=0),ze(m.y)||(m.y=0)});var p=nt(l,function(m){return!m.hidden}),d=Zt(p);z(l,function(m){Mt(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,Jv,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:l,context:u}})}}}eb.$inject=["canvas","dragging","eventBus","modeling","rules"];function tb(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 nb(e){return e&&e.length===1&&!Mt(e[0])}var $T=750;function ib(e,t,n,i,r){function o(a){var s=Oe("g");Se(s,r.cls("djs-drag-group",["no-events"]));var c=Oe("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),wn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",$T,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(),Ue(f,u)),wn(u,a.x,a.y)):an(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&an(c)})}ib.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const sl={__depends__:[ir,ia,ji,di],__init__:["create","createPreview"],create:["type",eb],createPreview:["type",ib]};function $f(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)})}$f.$inject=["eventBus"],$f.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||FT(0,0)};function FT(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",$f]};var rb=2e3;function Yn(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),jT(u)&&(l.priority=2,l.host=u.host.id),Mt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=HT(u)),Je(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),z(["x","y","width","height"],function(p){ze(u[p])&&(l[p]=u[p])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.elementsCopied",rb,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",rb,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;W(l,{createElementsBehavior:!1})})}Yn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Yn.prototype.copy=function(e,t={}){var n,i;return Ne(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Ne(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Yn.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})}}},Yn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Yn.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},Yn.prototype._getElementIdsFromTree=function(e){var t={};return z(e,function(n){z(n,function(i){i.id&&(t[i.id]=!0)})}),t},Yn.prototype._paste=function(e,t,n,i){z(e,function(o){ze(o.x)||(o.x=0),ze(o.y)||(o.y=0)});var r=Zt(e);return z(e,function(o){Mt(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))},Yn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return z(e,function(o,a){o=Pi(o,"priority"),z(o,function(s){var c=W({},Ti(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Mt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(Je(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},Yn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Ti(e,["id"]));return t},Yn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Ti(e,["id"]));return t},Yn.prototype.createShape=function(e){var t=this._elementFactory.createShape(Ti(e,["id"]));return t},Yn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Mt(e)&&(!n.has(e.source)||!n.has(e.target))||Je(e)&&!n.has(e.labelTarget))},Yn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=bc(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(Je(f))return;z(f.labels,function(y){c(y,d)});function m(y){y&&y.length&&z(y,function(C){z(C.labels,function(_){c(_,d)}),c(C,d)})}z([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}),z(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,u)){ab(f.element,e),u.delete(f.element);return}if(!s(f.element,e)){ab(f.element,e),u.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function jT(e){return!!e.host}function HT(e){return Cn(e.waypoints,function(t){return t=ob(t),t.original&&(t.original=ob(t.original)),t})}function ob(e){return W({},e)}function ab(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const zT={__depends__:[cT,sl,Za,ji],__init__:["copyPaste"],copyPaste:["type",Yn]};function Ff(e,t,n){Ne(n)||(n=[n]),z(n,function(i){Kr(e[i])||(t[i]=e[i])})}var jf=750;function sb(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",jf,function(c){var l=c.descriptor,u=c.element,f=ae(u);if(Je(u))return l;var p=l.businessObject=i(f,!0),d=l.di=i(pt(u),!0);d.bpmnElement=p,Ff(p,l,"name"),Ff(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=ae(c);return c.default&&(u[c.default]={element:f,property:"default"}),c.host&&(ae(c).attachedToRef=ae(l[c.host])),Ti(u,Hn(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(Je(u)){u.businessObject=ae(l[u.labelTarget]),u.di=pt(l[u.labelTarget]);return}f=u.businessObject=i(f),p=u.di=i(p),p.bpmnElement=f,Ff(u,f,["isExpanded","name"]),u.type=f.$type}),t.on("copyPaste.copyElement",jf,function(c){var l=c.descriptor,u=c.element;if(S(u,"bpmn:Participant")){var f=ae(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")&&z($a(u),f=>{u.push(f.annotation)})}),t.on("copyPaste.pasteElement",jf,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}sb.$inject=["bpmnFactory","eventBus","moddleCopy"];const GT=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],VT=["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 Pi(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=pn(r)&&r.$descriptor;if(a&&VT.includes(a))return o;if(a&&GT.includes(a)||a&&s&&!kt(s.properties,Co({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&&!Ne(n)&&(n=[n]),n=n||Hf(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Ne(r)&&(n=r),z(n,o=>{let a;jn(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 pn(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):Ne(e)?Hn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):pn(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 Hf(e,t){return Hn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const cb={__depends__:[zT],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",sb],moddleCopy:["type",Qa]};var lb=Math.round;function zf(e,t){this._modeling=e,this._eventBus=t}zf.$inject=["modeling","eventBus"],zf.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=lb(s+o/2),u=lb(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 ub(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}ub.$inject=["selection","eventBus"];const WT={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",ub],replace:["type",zf]};function UT(e,t,n){Ne(n)||(n=[n]),z(n,function(i){Kr(e[i])||(t[i]=e[i])})}var YT=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function qT(e,t){var n=e&&jn(e,"collapsed")?e.collapsed:!st(e),i;return t&&(jn(t,"collapsed")||jn(t,"isExpanded"))?i=jn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function pb(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,f=s.businessObject;if(cl(f)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&qT(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),UT(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var m=Hf(f.$descriptor),h=Hf(p.$descriptor,!0),y=KT(m,h);W(p,Si(c,YT));var C=nt(y,function(v){return v==="eventDefinitions"?fb(s,c.eventDefinitionType):v==="loopCharacteristics"?!Tn(p):jn(p,v)||v==="processRef"&&c.isExpanded===!1||v==="triggeredByEvent"?!1:v==="isForCompensation"?!Tn(p):!0});if(p=n.copyElement(f,p,C),c.eventDefinitionType&&(fb(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),S(f,"bpmn:Activity")){if(cl(f))d.isExpanded=st(s);else if(c&&jn(c,"isExpanded")){d.isExpanded=c.isExpanded;var _=t.getDefaultSize(p,{isExpanded:d.isExpanded});d.width=_.width,d.height=_.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}st(s)&&!S(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(cl(f)&&!cl(p)&&(l.moveChildren=!1),S(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var g=dn(s);pt(s).isHorizontal||(pt(d).isHorizontal=g),d.width=g?s.width:t.getDefaultSize(d).width,d.height=g?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,tt(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&tt(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}pb.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function cl(e){return S(e,"bpmn:SubProcess")}function fb(e,t){var n=ae(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 db={__depends__:[cb,WT,di],bpmnReplace:["type",pb]};var XT=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),z(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,XT,function(r){this._active&&(ZT(r)||this.setActive(null))},this)};function ZT(e){var t=e.originalEvent&&e.originalEvent.target;return t&&eo(t,'.group[data-group="tools"]')}const ll={__depends__:[ir],__init__:["toolManager"],toolManager:["type",lo]};function QT(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 JT(e,t){var n=[],i=new Set(e);z(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;z(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 e2(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 Gf=Math.abs,t2=Math.round,rr={x:"width",y:"height"},hb="crosshair",kr={n:"top",w:"left",s:"bottom",e:"right"},n2=1500,ul={n:"s",w:"e",s:"n",e:"w"},pl=20;function hi(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",n2,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&gb(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){gb(c);var h={x:0,y:0};h[u]=t2(c["d"+u]),s.makeSpace(p,d,h,f,m),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}hi.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],hi.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:hb,data:{context:{reactivate:n}},trapClick:!1})},hi.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:hb,data:{context:{}}})},hi.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},hi.prototype.init=function(e,t){var n=Gf(e.dx)>Gf(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Gf(i)<5)return!1;i<0&&(i*=-1),qa(e)&&(i*=-1);var o=QT(n,i),a=this._canvas.getRootElement();!Qc(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=i2(c,n,o,r,l);return W(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),al("resize-"+(n==="x"?"ew":"ns")),!0},hi.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 z(e,function(d){if(!(!d.parent||Je(d))){if(Mt(d)){u.push(d);return}var m=d[t],h=m+d[rr[t]];if(r2(d)&&(n>0&&$e(d)[t]>i||n<0&&$e(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}}}),z(o,function(d){var m=d.attachers;m&&z(m,function(h){f(h)})}),z(l,function(d){var m=d.host;(s.has(m)||c.has(m))&&f(d)}),z(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}},hi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},hi.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function mb(e){return{top:e.top-pl,right:e.right+pl,bottom:e.bottom+pl,left:e.left-pl}}function gb(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;ze(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),ze(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),ze(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),ze(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function i2(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 z(a,function(p){var d=p.attachers,m=p.children,h=Ie(p),y=nt(m,function(H){return!Mt(H)&&!Je(H)&&!u.has(H)&&!f.has(H)}),C=nt(m,function(H){return!Mt(H)&&!Je(H)&&u.has(H)}),_,g,v,w=[],R=[],P,T,N,k;y.length&&(g=mb(Ie(Zt(y))),_=i-h[kr[n]]+g[kr[n]],n==="n"?s.bottom=l=ze(l)?Math.min(l,_):_:n==="w"?s.right=l=ze(l)?Math.min(l,_):_:n==="s"?s.top=c=ze(c)?Math.max(c,_):_:n==="e"&&(s.left=c=ze(c)?Math.max(c,_):_)),C.length&&(v=mb(Ie(Zt(C))),_=i-v[kr[ul[n]]]+h[kr[ul[n]]],n==="n"?s.bottom=l=ze(l)?Math.min(l,_):_:n==="w"?s.right=l=ze(l)?Math.min(l,_):_:n==="s"?s.top=c=ze(c)?Math.max(c,_):_:n==="e"&&(s.left=c=ze(c)?Math.max(c,_):_)),d&&d.length&&(d.forEach(function(H){u.has(H)?w.push(H):R.push(H)}),w.length&&(P=Ie(Zt(w.map($e))),T=h[kr[ul[n]]]-(P[kr[ul[n]]]-i)),R.length&&(N=Ie(Zt(R.map($e))),k=N[kr[n]]-(h[kr[n]]-i)),n==="n"?(_=Math.min(T||1/0,k||1/0),s.bottom=l=ze(l)?Math.min(l,_):_):n==="w"?(_=Math.min(T||1/0,k||1/0),s.right=l=ze(l)?Math.min(l,_):_):n==="s"?(_=Math.max(T||-1/0,k||-1/0),s.top=c=ze(c)?Math.max(c,_):_):n==="e"&&(_=Math.max(T||-1/0,k||-1/0),s.left=c=ze(c)?Math.max(c,_):_));var D=r&&r[p.id];D&&(n==="n"?(_=i+p[rr[t]]-D[rr[t]],s.bottom=l=ze(l)?Math.min(l,_):_):n==="w"?(_=i+p[rr[t]]-D[rr[t]],s.right=l=ze(l)?Math.min(l,_):_):n==="s"?(_=i-p[rr[t]]+D[rr[t]],s.top=c=ze(c)?Math.max(c,_):_):n==="e"&&(_=i-p[rr[t]]+D[rr[t]],s.left=c=ze(c)?Math.max(c,_):_))}),s}}function r2(e){return!!e.host}var Vf="djs-dragging",yb="djs-resizing",o2=250,fl=Math.max;function vb(e,t,n,i,r){function o(a,s){z(a,function(c){r.addDragger(c,s),n.addMarker(c,Vf)})}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=Oe("g");Se(u,i.cls("djs-crosshair-group",["no-events"])),Ue(s,u);var f=Oe("path");Se(f,"d",l.x),ut(f).add("djs-crosshair"),Ue(u,f);var p=Oe("path");Se(p,"d",l.y),ut(p).add("djs-crosshair"),Ue(u,p),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;wn(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",o2,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=Oe("path"),Se(c,"d","M0,0 L0,0"),ut(c).add("djs-crosshair"),Ue(p,c),s.line=c;var d=Oe("g");Se(d,i.cls("djs-drag-group",["no-events"])),Ue(n.getActiveLayer(),d),o(u,d);var m=new Set(u);z(f,function(R){m.add(R)});var h=new Set,y=s.movingConnections=[];m.forEach(function(R){z(R.outgoing,function(P){h.has(P)||!Mt(P)||!m.has(P.target)||(h.add(P),y.push(P))})}),o(y,d),s.dragGroup=d}if(!s.frameGroup){var C=Oe("g");Se(C,i.cls("djs-frame-group",["no-events"])),Ue(n.getActiveLayer(),C);var _=[];z(f,function(R){var P=r.addFrame(R,C),T=P.getBBox();_.push({element:P,initialBounds:T}),n.addMarker(R,yb)}),s.frameGroup=C,s.frames=_}var g={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Se(c,{d:g[l]});var v={x:"y",y:"x"},w={x:a.dx,y:a.dy};w[v[s.axis]]=0,wn(s.dragGroup,w.x,w.y),z(s.frames,function(R){var P=R.element,T=R.initialBounds,N,k;s.direction==="e"?Se(P,{width:fl(T.width+w.x,5)}):(N=fl(T.width-w.x,5),Se(P,{width:N,x:T.x+T.width-N})),s.direction==="s"?Se(P,{height:fl(T.height+w.y,5)}):(k=fl(T.height-w.y,5),Se(P,{height:k,y:T.y+T.height-k}))})}}),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;z(c,function(m){n.removeMarker(m,Vf)}),z(l,function(m){n.removeMarker(m,Vf)}),p&&(an(f),an(p)),z(u,function(m){n.removeMarker(m,yb)}),d&&an(d)})}vb.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const a2={__init__:["spaceToolPreview"],__depends__:[ir,ji,ll,ia,Za],spaceTool:["type",hi],spaceToolPreview:["type",vb]};function dl(e,t){e.invoke(hi,this),this._canvas=t}dl.$inject=["injector","canvas"],Ee(dl,hi),dl.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=So(Fo(r.children.filter(l=>S(l,"bpmn:Artifact")),Zt(o))));const s=[...e,...a];var c=hi.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(S(l,"bpmn:TextAnnotation")||s2(l)&&(t==="y"&&dn(l)||t==="x"&&!dn(l)))}),c};function s2(e){return S(e,"bpmn:Participant")&&!ae(e).processRef}const bb={__depends__:[a2],spaceTool:["type",dl]};function Ht(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)}Ht.$inject=["eventBus","injector"],Ht.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()},Ht.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},Ht.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Ht.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()}},Ht.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()}},Ht.prototype.register=function(e,t){this._setHandler(e,t)},Ht.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)},Ht.prototype.canUndo=function(){return!!this._getUndoAction()},Ht.prototype.canRedo=function(){return!!this._getRedoAction()},Ht.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Ht.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Ht.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)})},Ht.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},Ht.prototype._createId=function(){return this._uid++},Ht.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Ht.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()},Ht.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)},Ht.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:Eh("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Ht.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Ne(e)?e:[e],t.dirty=t.dirty.concat(e))},Ht.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Ht.prototype._revertedAction=function(e){this._stackIdx--},Ht.prototype._getHandler=function(e){return this._handlerMap[e]},Ht.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 c2={commandStack:["type",Ht]};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 l2=250,xb=1400;function Wf(e,t,n){oe.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",xb,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=_b(a),o.validatedShapes=_b(s)}),i&&t.on("shape.move.start",l2,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",xb,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];z(s,function(l){z(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=Ep(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&&(qt(s.labels,a,c),a.labelTarget=s)})}Ee(Wf,oe),Wf.$inject=["injector","eventBus","modeling"];function _b(e){var t=new Set(e);return nt(e,function(n){return!t.has(n.labelTarget)})}const u2={__init__:["labelSupport"],labelSupport:["type",Wf]};var p2=251,wb=1401,Eb="attach-ok";function Uf(e,t,n,i,r){oe.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",wb,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=f2(c),s.validatedShapes=d2(l)}),o&&t.on("shape.move.start",p2,function(a){var s=a.context,c=s.shapes,l=Yf(c);z(l,function(u){o.makeDraggable(s,u,!0),z(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,Eb),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,Eb)}))}}),this.preExecuted("elements.move",wb,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Yf(l);z(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=nt(c,function(f){var p=f.host;return h2(f)&&!m2(c,p)}),z(u,function(f){r.updateAttachment(f,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;z(s,function(c){z(c.attachers,function(l){z(l.outgoing.slice(),function(u){var f=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});f||r.removeConnection(u)}),z(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&&z(l.attachers,function(u){var f=Hy(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&&z(f,function(d){var m=Hy(d,l,u);r.moveShape(d,m,d.parent),z(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)})}Ee(Uf,oe),Uf.$inject=["injector","eventBus","canvas","rules","modeling"];function Yf(e){return Pu(Cn(e,function(t){return t.attachers||[]}))}function f2(e){var t=Yf(e);return EE("id",e,t)}function d2(e){var t=Ro(e,"id");return nt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function h2(e){return!!e.host}function m2(e,t){return e.indexOf(t)!==-1}const g2={__depends__:[ji],__init__:["attachSupport"],attachSupport:["type",Uf]};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(gg(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 qf={__init__:["changeSupport"],changeSupport:["type",Sb]};function mi(e){this._model=e}mi.$inject=["moddle"],mi.prototype._needsId=function(e){return tt(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"])},mi.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":tt(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))},mi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},mi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},mi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",W({bpmnElement:e,bounds:this.createDiBounds()},t))},mi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},mi.prototype.createDiWaypoints=function(e){var t=this;return Cn(e,function(n){return t.createDiWaypoint(n)})},mi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Si(e,["x","y"]))},mi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",W({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},mi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",W({bpmnElement:e},t))};function qn(e,t,n){oe.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"],Kn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Kn(a));function s(d){var m=d.context,h=m.oldRoot,y=h.children;z(y,function(C){S(C,"bpmn:BaseElement")&&i.updateParent(C)})}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"],Kn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Kn(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"],Kn(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Kn(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Kn(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Kn(u)),this.executed("connection.reconnect",Kn(function(d){var m=d.context,h=m.connection,y=m.oldSource,C=m.newSource,_=ae(h),g=ae(y),v=ae(C);_.conditionExpression&&!tt(v,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=_.conditionExpression,delete _.conditionExpression),y!==C&&g.default===_&&(m.oldDefault=g.default,delete g.default)})),this.reverted("connection.reconnect",Kn(function(d){var m=d.context,h=m.connection,y=m.oldSource,C=m.newSource,_=ae(h),g=ae(y),v=ae(C);m.oldConditionExpression&&(_.conditionExpression=m.oldConditionExpression),m.oldDefault&&(g.default=m.oldDefault,delete v.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Kn(f)),this.reverted(["element.updateAttachment"],Kn(f)),this.executed("element.updateLabel",Kn(p)),this.reverted("element.updateLabel",Kn(p));function p(d){const{element:m}=d.context,h=oi(m),y=pt(m),C=y&&y.get("label");Rr(m)||Jc(m)||(h&&!C?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&C&&y.set("label",void 0))}}Ee(qn,oe),qn.$inject=["eventBus","bpmnFactory","connectionDocking"],qn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},qn.prototype.updateParent=function(e,t){if(!Je(e)&&!(S(e,"bpmn:DataStoreReference")&&e.parent&&S(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=pt(e),o=n&&n.businessObject,a=pt(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)}},qn.prototype.updateBounds=function(e){var t=pt(e),n=v2(e);if(n){var i=Ci(n,t.get("bounds"));W(n,{x:e.x+i.x,y:e.y+i.y})}var r=Je(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})},qn.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"),qt(r,e))}},qn.prototype.updateDiConnection=function(e,t,n){var i=pt(e),r=pt(t),o=pt(n);i.sourceElement&&i.sourceElement.bpmnElement!==ae(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ae(n)&&(i.targetElement=n&&o)},qn.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 y2(e){for(;e&&!S(e,"bpmn:Definitions");)e=e.$parent;return e}qn.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)},qn.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=y2(e.$parent||t),e.$parent&&(Ut(o.get("rootElements"),r),r.$parent=null),t&&(qt(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))}}},qn.prototype.updateConnectionWaypoints=function(e){var t=pt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},qn.prototype.updateConnection=function(e){var t=e.connection,n=ae(t),i=t.source,r=ae(i),o=t.target,a=ae(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)},qn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Kn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;S(i,"bpmn:BaseElement")&&e(t)}}function v2(e){if(S(e,"bpmn:Activity")){var t=pt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Dr(e,t){Ji.call(this),this._bpmnFactory=e,this._moddle=t}Ee(Dr,Ji),Dr.$inject=["bpmnFactory","moddle"],Dr.prototype._baseCreate=Ji.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(!x2(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=b2(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Kf(r,t,"isExpanded")),tt(i,["bpmn:Lane","bpmn:Participant"])&&(t=Kf(r,t,"isHorizontal")),S(i,"bpmn:SubProcess")&&(t.collapsed=!st(i,r)),S(i,"bpmn:ExclusiveGateway")&&(jn(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=ae(e);if(t=t||pt(e),S(n,"bpmn:SubProcess"))return st(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 st(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 pn(e)||(e={isExpanded:e}),e=W({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function b2(e,t,n){return z(n,function(i){t=Kf(e,t,i)}),t}function Kf(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Ti(t,[n]))}function x2(e){return tt(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function hl(e,t){this._modeling=e,this._canvas=t}hl.$inject=["modeling","canvas"],hl.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;z(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)})},hl.prototype.postExecute=function(e){};function ml(e){this._modeling=e}ml.$inject=["modeling"],ml.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},ml.prototype.postExecute=function(e){var t=e.hints||{};_2(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 _2(e,t){return hr(e.outgoing,function(n){return n.target===t})}function gl(e,t){this._canvas=e,this._layouter=t}gl.$inject=["canvas","layouter"],gl.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},gl.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var yl=Math.round;function Xf(e){this._modeling=e}Xf.$inject=["modeling"],Xf.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;z(t,function(f){ze(f.x)||(f.x=0),ze(f.y)||(f.y=0)});var s=nt(t,function(f){return!f.hidden}),c=Zt(s);z(t,function(f){Mt(f)&&(f.waypoints=Cn(f.waypoints,function(p){return{x:yl(p.x-c.x-c.width/2+r.x),y:yl(p.y-c.y-c.height/2+r.y)}})),W(f,{x:yl(f.x-c.x-c.width/2+r.x),y:yl(f.y-c.y-c.height/2+r.y)})});var l=new Set(bc(t)),u={};z(t,function(f){if(Mt(f)){u[f.id]=ze(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),Je(f)&&(p=Ti(p,["attach"])),u[f.id]=ze(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=So(u)};var Rb=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-Rb(t.width/2),y:n.y-Rb(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)}Ee(Ja,Lr),Ja.$inject=["canvas"];var w2=Lr.prototype.execute;Ja.prototype.execute=function(e){var t=e.shape;return S2(t),t.labelTarget=e.labelTarget,w2.call(this,e)};var E2=Lr.prototype.revert;Ja.prototype.revert=function(e){return e.shape.labelTarget=null,E2.call(this,e)};function S2(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=Ep(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,qt(n.children,t,i),this._canvas.addConnection(t,n),t};function Zf(e,t){this._modeling=e,this._elementRegistry=t}Zf.$inject=["modeling","elementRegistry"],Zf.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;z(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){Mt(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=Ep(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 qt(i.children,n,r),t.addShape(n,i),n};function vl(e){this._modeling=e}vl.$inject=["modeling"];var Cb={x:"y",y:"x"};vl.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(y,C){y.range.min=Math.min(C[i],y.range.min),y.range.max=Math.max(C[i]+C[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,C){var _={y:0};_[i]=y-a(C),_[i]&&(_[Cb[i]]=0,t.moveElements([C],_,C.parent))}var u=n[0],f=s(n),p=n[f],d,m,h=0;z(n,function(y,C){var _,g,v;if(y.elements.length<2){C&&C!==n.length-1&&(o(y,y.elements[0]),h+=c(y.range));return}_=Pi(y.elements,i),g=_[0],C===f&&(g=_[s(_)]),v=a(g),y.range=null,z(_,function(w){if(l(v,w),y.range===null){y.range={min:w[i],max:w[i]+w[r]};return}o(y,w)}),C&&C!==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)&&z(n,function(y,C){var _={},g;y===u||y===p||(g=n[C-1],y.range.max=0,z(y.elements,function(v,w){_[Cb[i]]=0,_[i]=g.range.max-v[i]+d,y.range.min!==v[i]&&(_[i]+=v[i]-y.range.min),_[i]&&t.moveElements([v],_,v.parent),y.range.max=Math.max(v[i]+v[r],w?y.range.max:0)}))})},vl.prototype.postExecute=function(e){};function bl(e,t){this._layouter=e,this._canvas=t}bl.$inject=["layouter","canvas"],bl.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},bl.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Qf(){}Qf.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),qt(i.children,t,r),t.parent=i,z(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},Qf.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),qt(i.children,t,r),t.parent=i,z(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=eC(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),z(a,function(f){o.moveShape(f,t,l[f.id]&&!u&&n,{recurse:!1,layout:!1})}),z(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&&af(f,f.source,t),connectionEnd:d&&sf(f,f.target,t)})})},ns.prototype.getClosure=function(e){return new Jf().addAll(e,!0)};function xl(e){this._helper=new ns(e)}xl.$inject=["modeling"],xl.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},xl.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=Si(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Ut(o.children,t),qt(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&&(z(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:sf(o,t,n)})}),z(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:af(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 qt(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 Ne(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||Mb(Ne(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Mb(Ne(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 Mb(e){return e.original||e}function or(e,t){this._modeling=e,this._rules=t}or.$inject=["modeling","rules"],or.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();z(p,function(m){var h=m.source,y=c(h,s,m);y&&t.reconnectEnd(m,s,Yc(m,s,u),a)}),z(d,function(m){var h=m.target,y=c(s,h,m);y&&t.reconnectStart(m,s,Uc(m,s,u),a)})},or.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},or.prototype.execute=function(e){},or.prototype.revert=function(e){},or.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},or.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},or.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&&(z(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Yc(o,n,i)})}),z(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Uc(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),z(r,function(s){a[s.id]=C2(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(JT(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;z(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;z(e,function(r){var o=e2(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);z(e,function(u){var f=u.source,p=u.target,d=R2(u),m=Pb(n),h={},y=c.has(f)||l.has(f),C=c.has(p)||l.has(p);y&&C?(d=Cn(d,function(_){return Tb(_,i,n)&&(_[m]=_[m]+t[m]),_.original&&Tb(_.original,i,n)&&(_.original[m]=_.original[m]+t[m]),_}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(y||C)&&(c.has(f)?h.connectionStart=af(u,f,t):c.has(p)?h.connectionEnd=sf(u,p,t):l.has(f)?h.connectionStart=Uc(u,f,a[f.id]):l.has(p)&&(h.connectionEnd=Yc(u,p,a[p.id])),s._modeling.layoutConnection(u,h))})};function Ab(e){return W({},e)}function R2(e){return Cn(e.waypoints,function(t){return t=Ab(t),t.original&&(t.original=Ab(t.original)),t})}function Pb(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Tb(e,t,n){var i=Pb(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 _l(e){this._modeling=e}_l.$inject=["modeling"],_l.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=kb(n),t.collapsed=!t.collapsed;var i=Ob(n,t.collapsed);return[t].concat(i)},_l.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 kb(e){var t={};return z(e,function(n){t[n.id]=n.hidden,n.children&&(t=W({},t,kb(n.children)))}),t}function Ob(e,t){var n=[];return z(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Ob(i.children,i.collapsed||t)))}),n}function Db(e,t){var n=[];return z(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Db(i.children,t)))}),n}function wl(e){this._modeling=e}wl.$inject=["modeling"],wl.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Lb(i,t),Ib(n,t),t.host=n,t},wl.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Lb(n,t),Ib(i,t,r),t};function Lb(e,t){return Ut(e&&e.attachers,t)}function Ib(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),qt(i,t,n)}}function ed(){}ed.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},ed.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function At(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}At.$inject=["eventBus","elementFactory","commandStack"],At.prototype.getHandlers=function(){return{"shape.append":ml,"shape.create":Lr,"shape.delete":ts,"shape.move":uo,"shape.resize":rs,"shape.replace":or,"shape.toggleCollapse":_l,spaceTool:Ir,"label.create":Ja,"connection.create":gl,"connection.delete":es,"connection.move":Qf,"connection.layout":bl,"connection.updateWaypoints":ed,"connection.reconnect":is,"elements.create":Xf,"elements.move":xl,"elements.delete":Zf,"elements.distribute":vl,"elements.align":hl,"element.updateAttachment":wl}},At.prototype.registerHandlers=function(e){z(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},At.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)},At.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},At.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)},At.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)},At.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},At.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},At.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},At.prototype.createElements=function(e,t,n,i,r){Ne(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},At.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},At.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},At.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},At.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},At.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},At.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},At.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},At.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},At.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},At.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)},At.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},At.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)},At.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,W(i,{docking:"source"}))},At.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,W(i,{docking:"target"}))},At.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},At.prototype._create=function(e,t){return FC(t)?t:this._elementFactory.create(e,t)},At.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||M2(n,Fs(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")?A2(e,t):[]};function M2(e,t){return Hn(t,function(n,i){return n[i]=e.get(i),n},{})}function Bb(e,t){z(t,function(n,i){e.set(i,n)})}function A2(e,t){return t.filter(function(n){return S(n,"bpmn:DataObjectReference")&&ae(n).dataObjectRef===e})}var as="default",ar="id",Nb="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=L2(e.properties),s=e.oldProperties||T2(t,a);return $b(a,o)&&(r.unclaim(o[ar]),i.updateId(t,a[ar]),r.claim(a[ar],o)),as in a&&(a[as]&&n.push(i.get(a[as].id)),o[as]&&n.push(i.get(o[as].id))),Fb(t,a),e.oldProperties=s,e.changed=n,n},ss.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ae(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 Fb(t,i),$b(n,r)&&(a.unclaim(n[ar]),o.updateId(t,i[ar]),a.claim(i[ar],r)),e.changed};function $b(e,t){return ar in e&&e[ar]!==t[ar]}function T2(e,t){var n=Fs(t),i=e.businessObject,r=pt(e);return Hn(n,function(o,a){return a!==Nb?o[a]=i.get(a):o[a]=k2(r,Fs(t.di)),o},{})}function k2(e,t){return Hn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Fb(e,t){var n=e.businessObject,i=pt(e);z(t,function(r,o){o!==Nb?n.set(o,r):i&&O2(i,r)})}function O2(e,t){z(t,function(n,i){e.set(i,n)})}var D2=["default"];function L2(e){var t=W({},e);return D2.forEach(function(n){n in e&&(t[n]=ae(t[n]))}),t}function El(e,t){this._canvas=e,this._modeling=t}El.$inject=["canvas","modeling"],El.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=pt(r);return t.setRootElement(n),t.removeRootElement(r),qt(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,[]},El.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=pt(n);return t.setRootElement(r),t.removeRootElement(n),Ut(a.rootElements,i),i.$parent=null,qt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function td(e,t){this._modeling=e,this._spaceTool=t}td.$inject=["modeling","spaceTool"],td.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=pi(i),a=o===i,s=a?i:i.parent,c=Mr(s),l=dn(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+ui,y:i.y,width:i.width-ui,height:i.height}:{x:i.x,y:i.y+ui,width:i.width,height:i.height-ui};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var f=[];no(o,function(v){return f.push(v),v.label&&f.push(v.label),v===i?[]:nt(v.children,function(w){return w!==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 C=t.calculateAdjustments(f,y,p,m),_=l?{x:0,y:p}:{x:p,y:0};t.makeSpace(C.movingShapes,C.resizingShapes,_,h,m);var g=l?{x:i.x+(a?ui:0),y:d-(r==="top"?120:0),width:i.width-(a?ui:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?ui:0),width:120,height:i.height-(a?ui:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},g,s)};function nd(e){this._modeling=e}nd.$inject=["modeling"],nd.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Mr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=dn(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+ui,y:n.y+p*c,width:n.width-ui,height:l}:{x:n.x+p*c,y:n.y+ui,width:l,height:n.height-ui},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=AA(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=Ie(e),r=Ie(t),o=yy(r,i),a=pi(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",id="lanes";function Sl(){}Sl.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,f){var p=Ie(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=pi(u);return r[f.id]||(r[f.id]=Hc(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=pi(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(id),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},Sl.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(id);n.remove.forEach(function(o){Ut(r,o),Ut(o.get(ls),i)}),n.add.forEach(function(o){qt(r,o),qt(o.get(ls),i)})}),[]},Sl.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(id);n.add.forEach(function(o){Ut(r,o),Ut(o.get(ls),i)}),n.remove.forEach(function(o){qt(r,o),qt(o.get(ls),i)})}),[]};var rd="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,v){if(g){var w=a.get(_);w||(w={},a.set(_,w)),!(v&&w.present)&&(!v&&w.past||(v?w.present={categoryValue:g,root:od(_)}:w.past={categoryValue:g}))}}function c(_){r.set(_,ae(_))}function l(){n.filter(function(_){return S(_,"bpmn:FlowElement")&&!Je(_)&&_.parent}).forEach(c)}function u(_){var g=ae(_),v=g.get("categoryValueRef");return v||(v=fy(i,g),o.push(I2(_,v))),v}function f(_){return _.reduce(function(g,v){var w=od(v),R=g.get(w);return R||(R=[],g.set(w,R)),R.push(v),g},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&l(),e.forEach(c),n.filter(function(_){return S(_,"bpmn:Group")&&!Je(_)&&_.parent}).forEach(function(_){var g=ae(_).get("categoryValueRef");if(!g){var v=od(_),w=p.get(v)||[],R=Fo(w,_),P=Object.keys(R).length>0;P&&(g=u(_))}s(_,g,!0)}),t.forEach(function(_){s(_.groupShape,_.categoryValue,!1)}),o.length&&l();var d=Array.from(r.keys()),m=Array.from(a.values()).reduce(function(_,g){return g.present&&_.add(g.present.categoryValue),g.past&&_.add(g.past.categoryValue),_},new Set),h=new Map,y=f(d);a.forEach(function(_,g){var v=_.present;if(v){var w=y.get(v.root)||[],R=Fo(w,g);w.forEach(function(P){if(R[P.id]){var T=h.get(P);T||(T=new Set,h.set(P,T)),T.add(v.categoryValue)}})}});var C=d.reduce(function(_,g){var v=r.get(g),w=v.get(rd),R=new Set(w),P=h.get(g)||new Set,T=Array.from(P).filter(function(k){return!R.has(k)}),N=w.filter(function(k){return m.has(k)&&!P.has(k)});return(T.length||N.length)&&_.push({businessObject:v,categoryValuesToAdd:T,categoryValuesToRemove:N}),_},[]);return{flowElements:C,groups:o}},us.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),B2(t.groups),$2(t.flowElements),[]},us.prototype.revert=function(e){var t=e.updates;return F2(t.flowElements),N2(t.groups),[]};function I2(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function B2(e){e.forEach(function(t){ae(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function N2(e){e.forEach(function(t){ae(t.groupShape).categoryValueRef=null})}function $2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(rd);t.categoryValuesToRemove.forEach(function(r){Ut(i,r)}),t.categoryValuesToAdd.forEach(function(r){qt(i,r,!0)})})}function F2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(rd);t.categoryValuesToAdd.forEach(function(r){Ut(i,r)}),t.categoryValuesToRemove.forEach(function(r){qt(i,r,!0)})})}function od(e){for(;e.parent;)e=e.parent;return e}function Rl(e){this._moddle=e}Rl.$inject=["moddle"],Rl.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),[]},Rl.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 j2={fill:void 0,stroke:void 0};function ad(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Fn(t)){var n=H2(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}ad.$inject=["commandStack"],ad.prototype.postExecute=function(e){var t=e.elements,n=e.colors||j2,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)}),z(t,function(o){var a=Mt(o)?Si(r,["border-color"]):r,s=pt(o);if(z2(a),Je(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(!tt(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function H2(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 z2(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var G2={width:0,height:0};function jb(e,t,n){function i(c,l){var u=c.label||c,f=c.labelTarget||c;return yM(u,l),[u,f]}function r(c){var l=c.element,u=l.businessObject,f=c.newLabel;if(!Je(l)&&Rr(l)&&!Ac(l)&&!Hb(f)){var p=7,d=Pp(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=oi(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(!(!Je(u)&&!S(u,"bpmn:TextAnnotation"))){if(Je(u)&&Hb(f)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var m=oi(l);typeof p>"u"&&(p=t.getExternalLabelBounds(u,m)),p&&e.resizeShape(u,p,G2)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}jb.$inject=["modeling","textRenderer","bpmnFactory"];function Hb(e){return!e||!e.trim()}function Sn(e,t,n,i){At.call(this,e,t,n),this._bpmnRules=i}Ee(Sn,At),Sn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Sn.prototype.getHandlers=function(){var e=At.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=os,e["element.updateProperties"]=ss,e["canvas.updateRoot"]=El,e["lane.add"]=td,e["lane.resize"]=cs,e["lane.split"]=nd,e["lane.updateRefs"]=Sl,e["group.updateRefs"]=us,e["id.updateClaim"]=Rl,e["element.setColor"]=ad,e["element.updateLabel"]=jb,e},Sn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Sn.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},Sn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Sn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Sn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Sn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Sn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Sn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Sn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Sn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Sn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Sn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Sn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Sn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function zb(){}zb.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||$e(t.source||e.source),t.connectionEnd||$e(t.target||e.target)]};var Cl=20,V2=5,Ml=Math.round,Gb=20,W2={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function U2(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function Y2(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Vb(e,t,n){var i=_n(t,e,V2),r=n.split(":")[0],o=Ml((t.x-e.x)/2+e.x),a=Ml((t.y-e.y)/2+e.y),s,c,l=Y2(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=U2(i,r),c=u?"h:v":"v:h",f?u?(p=a===e.y,s={x:e.x+Cl*(/l/.test(r)?-1:1),y:p?a+Cl:a}):(p=o===e.x,s={x:p?o+Cl:o,y:e.y+Cl*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:sd(e,s,c).concat(s),directions:c,turnNextDirections:p}}function q2(e,t,n){return Vb(e,t,n)}function K2(e,t,n){var i=Vb(t,e,Wb(n));return{waypoints:i.waypoints.slice().reverse(),directions:Wb(i.directions),turnNextDirections:i.turnNextDirections}}function X2(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=sd(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Wb(e){return e.split(":").reverse().join(":")}function Z2(e,t,n){var i=Ml((t.x-e.x)/2+e.x),r=Ml((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 sd(e,t,n){if(n=n||"h:h",!ak(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Yb(n)){var i=q2(e,t,n),r=K2(e,t,n),o=X2(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return Z2(e,t,n)}function Q2(e,t,n){var i=sd(e,t,n);return i.unshift(e),i.push(t),Kb(i)}function J2(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=_E(o,"straight")[0]||"h:h",s=W2[a]||0,c=_n(e,t,s),l=ok(c,a);n=n||$e(e),i=i||$e(t);var u=l.split(":"),f=qb(n,e,u[0],sk(c)),p=qb(i,t,u[1],c);return Q2(f,p,l)}function ek(e,t,n,i,r,o){Ne(n)&&(r=n,o=i,n=$e(e),i=$e(t)),o=W({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&nk(e,t,n,i,o),c||(c=o.connectionEnd&&rk(t,e,i,r),c)||(c=o.connectionStart&&ik(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:J2(e,t,n,i,o)}function tk(e,t,n){return e>=t&&e<=n}function Ub(e,t,n){var i={x:"width",y:"height"};return tk(t[e],n[e],n[e]+n[i[e]])}function nk(e,t,n,i,r){var o={},a,s;return s=_n(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Ub(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:Ub(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 ik(e,t,n,i){return cd(e,t,n,i)}function rk(e,t,n,i){var r=i.slice().reverse();return r=cd(e,t,n,r),r?r.reverse():null}function cd(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!kt(u,function(f,p){var d=u[p-1];return d&&La(f,d)<3})}function o(u,f,p){var d=Zi(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(vg(u[d],f,Gb)||vg(u[d],p,Gb))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=cd(e,t,n,l)),c&&Zi(c)?null:c}function ok(e,t){if(Yb(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 ak(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Yb(e){return e&&/t|r|b|l/.test(e)}function sk(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 qb(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 Kb(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return Sp(r,o,n,0)||t.push(n),t},[])}var ck=-10,lk=40,uk={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},pk={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},ld={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 Al(e){this._elementRegistry=e}Ee(Al,zb),Al.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=Xb(r&&r[0],n)),a||(a=Xb(r&&r[r.length-1],i)),(S(e,"bpmn:Association")||S(e,"bpmn:DataAssociation"))&&r&&!Zb(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=cy(n,s)?uk:pk;return S(e,"bpmn:MessageFlow")?c=dk(n,i,u):(S(e,"bpmn:SequenceFlow")||Zb(n,i))&&(n===i?c={preferredLayouts:bk(n,e,u)}:S(n,"bpmn:BoundaryEvent")?c={preferredLayouts:xk(n,i,a,u)}:fs(n)||fs(i)?c={preferredLayouts:u.subProcess,preserveDocking:mk(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=Kb(ek(n,i,o,a,r,c))),l||[o,a]};function fk(e){var t=e.host;return _n($e(e),t,ck)}function dk(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:hk(e,t)}}function hk(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 mk(e){return fs(e)?"target":"source"}function Xb(e,t){return e?e.original||e:$e(t)}function Zb(e,t){return S(t,"bpmn:Activity")&&S(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function fs(e){return S(e,"bpmn:SubProcess")&&st(e)}function po(e,t){return e===t}function gk(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 Qb(e,t){return ld[e]===t}function yk(e,t){var n=ra(e),i=ld[n];return t.indexOf(i)!==-1}function vk(e,t){var n=oa(e),i=ld[n];return t.indexOf(i)!==-1}function Jb(e){return e==="right"||e==="left"}function bk(e,t,n){var i=t.waypoints,r=i&&i.length&&_n(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function xk(e,t,n,i){var r=$e(e),o=$e(t),a=fk(e),s,c,l=po(e.host,t),u=gk(a,["top","right","bottom","left"]),f=_n(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return l?_k(a,u,e,t,n,i):(s=wk(a,f,u,i.isHorizontal),c=Ek(a,f,u,i.isHorizontal),[s+":"+c])}function _k(e,t,n,i,r,o){var a=t?e:o.isHorizontal?oa(e):ra(e),s=ps[a],c;return t?Jb(e)?c=ex("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=ex("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function ex(e,t,n,i){var r=lk;return!(ud(e,i,n,r)||ud(e,i,{x:n.x+n.width,y:n.y+n.height},r)||ud(e,i,$e(t),r))}function ud(e,t,n,i){return Math.abs(t[e]-n[e])<i}function wk(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)||Qb(o,s))return ps[r]}else if(po(o,s)||Qb(r,a))return ps[o];return ps[i?o:r]}function Ek(e,t,n,i){if(n)return Jb(e)?yk(e,t)||po(e,t)?"h":"v":vk(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"}Al.$inject=["elementRegistry"];function tx(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(tx(i)),o.push(tx(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 pd={__init__:["modeling","bpmnUpdater"],__depends__:[zP,rT,aT,sT,db,c2,u2,g2,di,qf,bb],bpmnFactory:["type",mi],bpmnUpdater:["type",qn],elementFactory:["type",Dr],modeling:["type",Sn],layouter:["type",Al],connectionDocking:["type",Br]};var Sk=10,nx=50,Rk=250;function fd(e,t,n,i){for(var r;r=Ck(e,n,t);)n=i(t,n,r);return n}function dd(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=Ak(e);return kt(r,function(o){if(o===n)return!1;var a=_n(o,i,Sk);return a==="intersect"})}function Mk(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||nx,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||Rk,c=t.reference||"start";o||(o=kk);function l(m,h){return r==="n"?c==="start"?Ie(m).top-Ie(h).bottom:c==="center"?Ie(m).top-$e(h).y:Ie(m).top-Ie(h).top:r==="w"?c==="start"?Ie(m).left-Ie(h).right:c==="center"?Ie(m).left-$e(h).x:Ie(m).left-Ie(h).left:r==="s"?c==="start"?Ie(h).top-Ie(m).bottom:c==="center"?$e(h).y-Ie(m).bottom:Ie(h).bottom-Ie(m).bottom:c==="start"?Ie(h).left-Ie(m).right:c==="center"?$e(h).x-Ie(m).right:Ie(h).right-Ie(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=Hn(p,function(m,h){var y=h.distance,C=h.weight;return y<0||y>s||(m[String(y)]||(m[String(y)]=0),m[String(y)]+=1*C,(!m.distance||m[m.distance]<m[String(y)])&&(m.distance=y)),m},{});return d.distance||i}function Ak(e){var t=hd(e);return e.host&&(t=t.concat(hd(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(hd(i))},[]))),t}function hd(e){return Tk(e).concat(Pk(e))}function Pk(e){return e.incoming.map(function(t){return t.source})}function Tk(e){return e.outgoing.map(function(t){return t.target})}function kk(){return!0}var Ok=100;function ix(e,t,n){e.on("autoPlace",Ok,function(i){var r=i.shape,o=i.source;return Dk(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}}ix.$inject=["eventBus","modeling","canvas"];function Dk(e,t,n){n||(n={});var i=n.defaultDistance||nx,r=$e(e),o=Ie(e);return{x:o.right+i+t.width/2,y:r.y}}function rx(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}rx.$inject=["eventBus","selection"];const Lk={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ix],autoPlaceSelectionBehavior:["type",rx]};function ox(e,t,n){var i=cy(e,n);if(S(t,"bpmn:TextAnnotation"))return Bk(e,t,i);if(tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return Nk(e,t,i);if(S(t,"bpmn:FlowNode"))return Ik(e,t,i)}function Ik(e,t,n){var i=Ie(e),r=$e(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=Mk(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=_n(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+ax(l,c,o)}:{x:r.x+ax(l,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return fd(e,t,u,dd(p))}function ax(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function Bk(e,t,n){var i=Ie(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};Mt(e)&&(r=$e(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 fd(e,t,r,dd(a))}function Nk(e,t,n){var i=Ie(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return fd(e,t,r,dd(a))}function sx(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return ox(r,i,t)})}sx.$inject=["eventBus","elementRegistry"];const Pl={__depends__:[Lk],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",sx]},cx=[ay,Ha,pd,Pl];function $k(e={}){Wh(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new zo({container:t,moddleExtensions:e.moddleExtensions??Us,additionalModules:[...cx,...e.additionalModules??[]]})}const lx={"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":"라벨","label-over-shape":"라벨","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":"그룹","edge-along-group-boundary":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},Fk={이:["이","가"],을:["을","를"],와:["과","와"]};function jk(e,t){const[n,i]=Fk[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 Hk={"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":"연관선"},zk="요소";function md(e){return(e&&Hk[e.type])??zk}const ux=20;function Gk(e){const t=e.replace(/\s+/g," ").trim();return t.length>ux?`${t.slice(0,ux)}…`:t}function Tl(e,t,n,i=""){const r=e(t),o=(r==null?void 0:r.name)===void 0?void 0:Gk(r.name),a=o===void 0?i+md(r):o,s=o===void 0?a:`「${o}」`;return n?s+jk(a,n).slice(a.length):s}function Vk(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&&md(o)===md(a);return[Tl(e,t,i),Tl(e,n,r,s?"다른 ":"")]}function Wk(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 Uk(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"label-over-shape":return[e.edge,e.shape];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"edge-along-group-boundary":return[e.edge,e.group];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const kl={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function Yk(e,t){const n=(r,o)=>Tl(t,r,o),i=(r,o,a,s)=>Vk(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"label-over-shape":return`${n(e.edge)}의 라벨이 ${n(e.shape)} 위에 ${e.depth}px 겹쳐 있습니다.`;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)}의 ${kl[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)}의 ${kl[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${kl[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${kl[e.side]} 테두리 ${e.inside?"안쪽":"바깥쪽"} ${e.distance}px 에 ${e.length}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 qk(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Tl(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const px="기타",gd={error:0,warning:1,info:2};function fx(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${gt(i)}`,source:"geometry",code:i.kind,severity:Wk(i),targetRefs:Uk(i),category:lx[i.kind]??px,message:Yk(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:lx[i.ruleId]??px,message:qk(i,t)});return n}function dx(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 yd(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 hx(e,t){const n=yd(e,t);return e.slice().sort((i,r)=>(n?Number(aa(r,t))-Number(aa(i,t)):0)||gd[i.severity]-gd[r.severity])}var Kk=new na("ov"),Xk=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=Zk(n.getContainer()),this._init()}mn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],mn.prototype.get=function(e){if(Fn(e)&&(e={id:e}),Fn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?nt(t.overlays,Co({type:e.type})):t.overlays.slice():[]}else return e.type?nt(this._overlays,Co({type:e.type})):e.id?this._overlays[e.id]:null},mn.prototype.add=function(e,t,n){if(pn(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)||[];Ne(t)||(t=[t]);var n=this;z(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(Li(i.html),Li(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(){Ol(this._overlayRoot)},mn.prototype.hide=function(){Ol(this._overlayRoot,!1)},mn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],dc(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}mx(n,i,r),An(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}mx(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},mn.prototype._createOverlayContainer=function(e){var t=Lt('<div class="djs-overlays" />');Dn(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(",")+")";gx(this._overlayRoot,n)},mn.prototype._getOverlayContainer=function(e,t){var n=kt(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)),Fn(i)&&(i=Lt(i)),o=this._getOverlayContainer(n),r=Lt('<div class="djs-overlay" data-overlay-id="'+t+'">'),Dn(r,{position:"absolute"}),r.appendChild(i),e.type&&$t(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Ol(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),Ol(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+")"),gx(o,s)},mn.prototype._updateOverlaysVisibilty=function(e){var t=this;z(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});z(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){Li(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",Xk,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(z(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&&$t(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 Zk(e){var t=Lt('<div class="djs-overlay-container" />');return Dn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function mx(e,t,n){Dn(e,{left:t+"px",top:n+"px"})}function Ol(e,t){e.style.display=t===!1?"none":""}function gx(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Dl={__init__:["overlays"],overlays:["type",mn]};function vd(e,t){t.invoke(oe,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}Ee(vd,oe),vd.$inject=["canvas","injector"];const Qk={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",vd]};function ds(e){return CSS.escape(e)}var Jk={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function yx(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return Jk[t]})}var eO="bjs-breadcrumbs-shown";function vx(e,t,n){var i=Lt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=$t(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=ae(l),f=kt(a,function(p){return p===u});f&&s()});function s(c){c&&(a=tO(c));var l=a.flatMap(function(f){var p=n.findRoot(Fi(f))||n.findRoot(f.id);if(!p&&S(f,"bpmn:Process")){var d=t.find(function(y){var C=ae(y);return C&&C.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var m=yx(f.name||f.id),h=Lt('<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(eO,u),l.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}vx.$inject=["eventBus","elementRegistry","canvas"];function tO(e){for(var t=ae(e),n=[],i=t;i;i=i.$parent)(S(i,"bpmn:SubProcess")||S(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function bx(e,t){var n=null,i=new nO;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})}bx.$inject=["eventBus","canvas"];function nO(){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 xx={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),rO(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=iO(e),i={x:n.x-xx.x,y:n.y-xx.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=_x(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 _x(e){return S(e,"bpmndi:BPMNDiagram")?e:_x(e.$parent)}function iO(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=Ie(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),wc(t)}function rO(e,t){var n=e.$parent;return!(!S(n,"bpmn:SubProcess")||n===t.bpmnElement||tt(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Ll=250,oO='<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>',aO="bjs-drilldown-empty";function Nr(e,t,n,i,r){oe.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",Ll,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Ll,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Ll,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"],Ll,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)})})}Ee(Nr,oe),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(Fi(e))},Nr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ae(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;$t(i.html).toggle(aO,!r)}},Nr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ae(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=Lt('<button type="button" class="bjs-drilldown">'+oO+"</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(Fi(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 sO={__depends__:[Dl,qf,Qk],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",vx],drilldownCentering:["type",bx],drilldownOverlayBehavior:["type",Nr],subprocessCompatibility:["type",fo]};function $r(e){jt.call(this,e)}Ee($r,jt),$r.prototype._modules=[ay,sO,Dl,di,Ha],$r.prototype._moddleExtensions={};var Il="keyboard.keydown",cO="keyboard.keyup",lO=1e3,wx="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 Ln(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(wx));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Ln.$inject=["config.keyboard","eventBus"],Ln.prototype._keydownHandler=function(e){this._keyHandler(e,Il)},Ln.prototype._keyupHandler=function(e){this._keyHandler(e,cO)},Ln.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Il,i),n&&e.preventDefault()}},Ln.prototype._isEventIgnored=function(e){return!1},Ln.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(wx)),this.unbind(),e=this._node=this._target,Ge.bind(e,"keydown",this._keydownHandler),Ge.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Ln.prototype.getBinding=function(){return this._node},Ln.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ge.unbind(e,"keydown",this._keydownHandler),Ge.unbind(e,"keyup",this._keyupHandler)),this._node=null},Ln.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Ln.prototype.addListener=function(e,t,n){fn(e)&&(n=t,t=e,e=lO),this._eventBus.on(n||Il,e,t)},Ln.prototype.removeListener=function(e,t){this._eventBus.off(t||Il,e)},Ln.prototype.hasModifier=xT,Ln.prototype.isCmd=Un,Ln.prototype.isShift=Nf,Ln.prototype.isKey=sn;var uO=500;function sa(e,t){var n=this;e.on("editorActions.init",uO,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(RT(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(_T(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(wT(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(ET(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(ST(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(sn(["+","Add","="],r)&&Un(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(sn(["-","Subtract"],r)&&Un(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(sn("0",r)&&Un(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 bd={__init__:["keyboard","keyboardBindings"],keyboard:["type",Ln],keyboardBindings:["type",sa]};var pO={moveSpeed:50,moveSpeedAccelerated:200};function Ex(e,t,n){var i=this;this._config=W({},pO,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})}}Ex.$inject=["config.keyboardMove","keyboard","canvas"];const Sx={__depends__:[bd],__init__:["keyboardMove"],keyboardMove:["type",Ex]};var fO=15;function Rx(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&&dO(f)>fO&&(n.dragging=!0,l===0&&Uv(e),al("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){Ge.unbind(document,"mousemove",r),Ge.unbind(document,"mouseup",o),n=null,Wv()}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)},Ge.bind(document,"mousemove",r),Ge.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Rx.$inject=["eventBus","canvas"];function dO(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Cx={__init__:["moveCanvas"],moveCanvas:["type",Rx]};function Mx(e,t){var n=Dp(e.min),i=Dp(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function hO(e,t){return Math.max(e.min,Math.min(e.max,t))}var mO=Math.sign||function(e){return e>=0?1:-1},xd={min:.2,max:4},Ax=10,gO=.1,yO=.75;function zi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Bn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||yO;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}zi.$inject=["config.zoomScroll","eventBus","canvas"],zi.prototype.scroll=function(t){this._canvas.scroll(t)},zi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},zi.prototype.zoom=function(t,n){var i=Mx(xd,Ax*2);this._totalDelta+=t,Math.abs(this._totalDelta)>gO&&(this._zoom(t,n,i),this._totalDelta=0)},zi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Jy()&&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))*mO(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)}},zi.prototype.stepZoom=function(t,n){var i=Mx(xd,Ax);this._zoom(t,n,i)},zi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Dp(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(hO(xd,s),t)},zi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Ge[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},zi.prototype._init=function(e){this.toggle(e)};const Px={__init__:["zoomScroll"],zoomScroll:["type",zi]};function hs(e){$r.call(this,e)}Ee(hs,$r),hs.prototype._navigationModules=[Sx,Cx,Px],hs.prototype._modules=[].concat($r.prototype._modules,hs.prototype._navigationModules);function _d(e){return e&&e[e.length-1]}function Tx(e){return e.y}function kx(e){return e.x}var vO={left:kx,center:kx,right:function(e){return e.x+e.width},top:Tx,middle:Tx,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=_d(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(z(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]=_d(c).center,o;l=t[0],t=Pi(t,function(p){return p[i]+p[r]}),u=_d(t),o[e]=f(l,u)}return o},ca.prototype.trigger=function(e,t){var n=this._modeling,i,r=nt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Ne(i)&&(r=i),!(r.length<2||!i)){var o=vO[t],a=Pi(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const bO={__init__:["alignElements"],alignElements:["type",ca]},xO=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=xO.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=_O();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 _O(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const wO={scheduler:["type",la]};var EO="djs-element-hidden",Bl=".entry",SO=1e3,Ox=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=Ne(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=Ne(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Jt.prototype._createContainer=function(){var e=Lt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Jt.prototype.registerProvider=function(e,t){t||(t=e,e=SO),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Jt.prototype.getEntries=function(e){var t=this._getProviders(),n=Ne(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return z(t,function(r){if(fn(r[n])){var o=r[n](e);fn(o)?i=o(i):z(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=An(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(fn(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;z(t,function(r,o){var a=r.group||"default",s=Lt(r.html||'<div class="entry" draggable="true"></div>'),c;An(s,"data-action",o),c=Rt("[data-group="+ds(a)+"]",n),c||(c=Lt('<div class="group"></div>'),An(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&CO(s,r.className),r.title&&An(s,"title",r.title),r.imageUrl&&(i=Lt("<img>"),An(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),$t(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=Lt('<div class="djs-context-pad"></div>');return Gn.bind(n,Bl,"click",function(i){t.trigger("click",i)}),Gn.bind(n,Bl,"dragstart",function(i){t.trigger("dragstart",i)}),Gn.bind(n,Bl,"mouseover",function(i){t.trigger("mouseover",i)}),Gn.bind(n,Bl,"mouseout",function(i){t.trigger("mouseout",i)}),Ge.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()&&AO(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 Ne(e)!==Ne(n)?!1:Ne(e)?e.length===n.length&&Xr(e,function(i){return n.includes(i)}):n===e},Jt.prototype.isShown=function(){return this.isOpen()&&$t(this._current.html).has("open")},Jt.prototype.show=function(){this.isOpen()&&($t(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Jt.prototype.hide=function(){this.isOpen()&&($t(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Jt.prototype._getPosition=function(e){if(!Ne(e)&&Mt(e)){var t=this._canvas.viewbox(),n=MO(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Ox*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Ox*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=Ne(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,EO)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Jt.prototype._getTargetBounds=function(e){var t=this,n=Ne(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=$t(e);t=Ne(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function MO(e){return e.waypoints[e.waypoints.length-1]}function AO(e,t){return e=Ne(e)?e:[e],t=Ne(t)?t:[t],e.length===t.length&&Xr(e,function(n){return t.includes(n)})}const Dx={__depends__:[ol,wO,Dl],contextPad:["type",Jt]};var Nl,zt,Lx,Fr,Ix,Bx,Nx,wd,$l,ms,$x,Ed,Sd,Rd,Fl={},jl=[],PO=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Hl=Array.isArray;function sr(e,t){for(var n in t)e[n]=t[n];return e}function Cd(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Fx(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?Nl.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 zl(e,a,i,r,null)}function zl(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??++Lx,__i:-1,__u:0};return r==null&&zt.vnode!=null&&zt.vnode(o),o}function Gl(e){return e.children}function Vl(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 TO(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=sr({},t);o.__v=t.__v+1,zt.vnode&&zt.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,Yx(i,o,r),t.__e=t.__=null,o.__e!=n&&jx(o)}}function jx(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}),jx(e)}function Hx(e){(!e.__d&&(e.__d=!0)&&Fr.push(e)&&!Wl.__r++||Ix!=zt.debounceRendering)&&((Ix=zt.debounceRendering)||Bx)(Wl)}function Wl(){try{for(var e,t=1;Fr.length;)Fr.length>t&&Fr.sort(Nx),e=Fr.shift(),t=Fr.length,TO(e)}finally{Fr.length=Wl.__r=0}}function zx(e,t,n,i,r,o,a,s,c,l,u){var f,p,d,m,h,y,C=i&&i.__k||jl,_=t.length;for(c=kO(n,t,C,c,_),f=0;f<_;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&C[d.__i]||Fl,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&&Ad(p.ref,null,d),u.push(d.ref,d.__c||m,d)),h==null&&m!=null&&(h=m),4&d.__u?(c=Gx(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 kO(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]=zl(null,a,null,null,null):Hl(a)?a=e.__k[o]=zl(Gl,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=zl(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=OO(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)),Kx(s,s));return i}function Gx(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=Gx(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 OO(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 Vx(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||PO.test(t)?n:n+"px"}function Ul(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||Vx(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Vx(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace($x,"$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]=Ed,e.addEventListener(t,o?Rd:Sd,o)):e.removeEventListener(t,o?Rd:Sd,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 Wx(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[$l]==null)t[$l]=Ed++;else if(t[$l]<n[ms])return;return n(zt.event?zt.event(t):t)}}}function Md(e,t,n,i,r,o,a,s,c,l){var u,f,p,d,m,h,y,C,_,g,v,w,R,P,T,N,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=zt.__b)&&u(t);e:if(typeof k=="function"){f=a.length;try{if(_=t.props,g=k.prototype&&k.prototype.render,v=(u=k.contextType)&&i[u.__c],w=u?v?v.props.value:u.__:i,n.__c?C=(p=t.__c=n.__c).__=p.__E:(g?t.__c=p=new k(_,w):(t.__c=p=new Vl(_,w),p.constructor=k,p.render=LO),v&&v.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),g&&p.__s==null&&(p.__s=p.state),g&&k.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=sr({},p.__s)),sr(p.__s,k.getDerivedStateFromProps(_,p.__s))),m=p.props,h=p.state,p.__v=t,d)g&&k.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),g&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(g&&k.getDerivedStateFromProps==null&&_!==m&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(_,w),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(_,p.__s,w)===!1){t.__v!=n.__v&&(p.props=_,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(D){D&&(D.__=t)}),jl.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=ho(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(_,p.__s,w),g&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(m,h,y)})}if(p.context=w,p.props=_,p.__P=e,p.__e=!1,R=zt.__r,P=0,g)p.state=p.__s,p.__d=!1,R&&R(t),u=p.render(p.props,p.state,p.context),jl.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,R&&R(t),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++P<25);p.state=p.__s,p.getChildContext!=null&&(i=sr(sr({},i),p.getChildContext())),g&&!d&&p.getSnapshotBeforeUpdate!=null&&(y=p.getSnapshotBeforeUpdate(m,h)),T=u!=null&&u.type===Gl&&u.key==null?qx(u.props.children):u,s=zx(e,Hl(T)?T:[T],t,n,i,r,o,a,s,c,l),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),C&&(p.__E=p.__=null)}catch(D){if(a.length=f,t.__v=null,c||o!=null){if(D.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(N=o.length;N--;)Cd(o[N])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),D.then||Ux(t),zt.__e(D,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=DO(n.__e,t,n,i,r,o,a,c,l);return(u=zt.diffed)&&u(t),128&t.__u?void 0:s}function Ux(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ux))}function Yx(e,t,n){for(var i=0;i<n.length;i++)Ad(n[i],n[++i],n[++i]);zt.__c&&zt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){zt.__e(o,r.__v)}})}function qx(e){return typeof e!="object"||e==null||e.__b>0?e:Hl(e)?e.map(qx):e.constructor!==void 0?null:sr({},e)}function DO(e,t,n,i,r,o,a,s,c){var l,u,f,p,d,m,h,y=n.props||Fl,C=t.props,_=t.type;if(_=="svg"?r="http://www.w3.org/2000/svg":_=="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==!!_&&(_?d.localName==_:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(_==null)return document.createTextNode(C);e=document.createElementNS(r,_,C.is&&C),s&&(zt.__m&&zt.__m(t,o),s=!1),o=null}if(_==null)y===C||s&&e.data==C||(e.data=C);else{if(o=_=="textarea"&&C.defaultValue!=null?null:o&&Nl.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 C||l=="value"&&"defaultValue"in C||l=="checked"&&"defaultChecked"in C||Ul(e,l,null,d,r);for(l in C)d=C[l],l=="children"?p=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?m=d:l=="checked"?h=d:s&&typeof d!="function"||y[l]===d||Ul(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=""),zx(t.type=="template"?e.content:e,Hl(p)?p:[p],t,n,i,_=="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--;)Cd(o[l]);s&&_!="textarea"||(l="value",_=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[l]||_=="progress"&&!m||_=="option"&&m!=y[l])&&Ul(e,l,m,y[l],r),l="checked",h!=null&&h!=e[l]&&Ul(e,l,h,y[l],r))}return e}function Ad(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){zt.__e(r,n)}}function Kx(e,t,n){var i,r;if(zt.unmount&&zt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Ad(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){zt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Kx(i[r],t,n||typeof e.type!="function");n||Cd(e.__e),e.__c=e.__=e.__e=void 0}function LO(e,t,n){return this.constructor(e,n)}function Xx(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),zt.__&&zt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Md(t,e=t.__k=Fx(Gl,null,[e]),r||Fl,Fl,t.namespaceURI,r?null:t.firstChild?Nl.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Yx(o,e,a),e.props.children=null}Nl=jl.slice,zt={__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}},Lx=0,Vl.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=sr({},this.state),typeof e=="function"&&(e=e(sr({},n),this.props)),e&&sr(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Hx(this))},Vl.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Hx(this))},Vl.prototype.render=Gl,Fr=[],Bx=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Nx=function(e,t){return e.__v.__b-t.__v.__b},Wl.__r=0,wd=Math.random().toString(8),$l="__d"+wd,ms="__a"+wd,$x=/(PointerCapture)$|Capture$/i,Ed=0,Sd=Wx(!1),Rd=Wx(!0);var Zx=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,Zx(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Qx=new Map;function IO(e){var t=Qx.get(this);return t||(t=new Map,Qx.set(this,t)),(t=Zx(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 Pt=IO.bind(Fx),ua,en,Pd,Jx,gs=0,e_=[],cn=zt,t_=cn.__b,n_=cn.__r,i_=cn.diffed,r_=cn.__c,o_=cn.unmount,a_=cn.__;function Yl(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 Td(e){return gs=1,BO(c_,e)}function BO(e,t,n){var i=Yl(ua++,2);if(i.t=e,!i.__c&&(i.__=[c_(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 ql(e,t){var n=Yl(ua++,3);!cn.__s&&Dd(n.__H,t)&&(n.__=e,n.u=t,en.__H.__h.push(n))}function kd(e,t){var n=Yl(ua++,4);!cn.__s&&Dd(n.__H,t)&&(n.__=e,n.u=t,en.__h.push(n))}function Kl(e){return gs=5,cr(function(){return{current:e}},[])}function cr(e,t){var n=Yl(ua++,7);return Dd(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ys(e,t){return gs=8,cr(function(){return e},t)}function NO(){for(var e;e=e_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Xl),t.__h.some(Od),t.__h=[]}catch(n){t.__h=[],cn.__e(n,e.__v)}}}cn.__b=function(e){en=null,t_&&t_(e)},cn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),a_&&a_(e,t)},cn.__r=function(e){n_&&n_(e),ua=0;var t=(en=e.__c).__H;t&&(Pd===en?(t.__h=[],en.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Xl),t.__h.some(Od),t.__h=[],ua=0)),Pd=en},cn.diffed=function(e){i_&&i_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(e_.push(t)!==1&&Jx===cn.requestAnimationFrame||((Jx=cn.requestAnimationFrame)||$O)(NO)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Pd=en=null},cn.__c=function(e,t){t.some(function(n){try{n.__h.some(Xl),n.__h=n.__h.filter(function(i){return!i.__||Od(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],cn.__e(i,n.__v)}}),r_&&r_(e,t)},cn.unmount=function(e){o_&&o_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Xl(i)}catch(r){t=r}}),n.__H=void 0,t&&cn.__e(t,n.__v))};var s_=typeof requestAnimationFrame=="function";function $O(e){var t,n=function(){clearTimeout(i),s_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);s_&&(t=requestAnimationFrame(n))}function Xl(e){var t=en,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),en=t}function Od(e){var t=en;e.__c=e.__(),en=t}function Dd(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function c_(e,t){return typeof t=="function"?t(e):t}function FO(e){const{navigationStack:t,setNavigationStack:n}=e,i=cr(()=>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 Pt`
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}},jt.prototype._setDefinitions=function(e){this._definitions=e},jt.prototype.getModules=function(){return this._modules},jt.prototype.clear=function(){this.getDefinitions()&&Sr.prototype.clear.call(this)},jt.prototype.destroy=function(){Sr.prototype.destroy.call(this),Li(this._container)},jt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},jt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},jt.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=Rt(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},jt.prototype.getDefinitions=function(){return this._definitions},jt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},jt.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(Ti(n,["additionalModules"]),{canvas:W({},n.canvas,{container:e}),modules:a});Sr.call(this,s),n&&n.container&&this.attachTo(n.container)},jt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},jt.prototype._createContainer=function(e){const t=Lt('<div class="bjs-container"></div>');return Dn(t,{width:Zm(e.width),height:Zm(e.height),position:e.position}),t},jt.prototype._createModdle=function(e){const t=W({},this._moddleExtensions,e.moddleExtensions);return new Hh(t)},jt.prototype._modules=[];function Mc(e,t){return e.warnings=t,e}function sM(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 cM={width:"100%",height:"100%",position:"relative"};function Zm(e){return e+(ze(e)?"px":"")}function lM(e,t){return t&&kt(e.diagrams,function(n){return n.id===t})||null}function uM(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Ym+"</a>",i=Lt(n);Dn(Rt("svg",i),qm),Dn(i,Km,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),Ge.bind(i,"click",function(r){aM(),r.preventDefault()})}function Go(e){jt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}Ee(Go,jt),Go.prototype._createModdle=function(e){var t=jt.prototype._createModdle.call(this,e);return t.ids=new Di([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 st(e,t){return S(e,"bpmn:CallActivity")?!1:S(e,"bpmn:SubProcess")?(t=t||pt(e),t&&S(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):S(e,"bpmn:Participant")?!!ae(e).processRef:!0}function dn(e){if(!(!S(e,"bpmn:Participant")&&!S(e,"bpmn:Lane"))){var t=pt(e).isHorizontal;return t===void 0?!0:t}}function pM(e){return e&&ae(e).isInterrupting!==!1}function Tn(e){return e&&!!ae(e).triggeredByEvent}function Vo(e,t){var n=ae(e).eventDefinitions;return hr(n,function(i){return S(i,t)})}function fM(e){return Vo(e,"bpmn:ErrorEventDefinition")}function dM(e){return Vo(e,"bpmn:EscalationEventDefinition")}function hM(e){return Vo(e,"bpmn:CompensateEventDefinition")}var oo={width:90,height:20},Qm=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 Ac(e){return Je(e.label)}function gM(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=mM(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-=Qm:a+=Qm,{x:a,y:s}}function mM(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 Pp(e){return e.waypoints?gM(e.waypoints):S(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+oo.height/2}:{x:e.x+e.width/2,y:e.y+e.height+oo.height/2}}function yM(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(oo.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Pp(t),i=oo),W({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Jm(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 vM(e){var t=e.categoryValueRef;return t&&t.value||""}function oi(e){var t=e.businessObject,n=Jm(t);if(n)return n==="categoryValueRef"?vM(t):t[n]||""}function bM(e,t){var n=e.businessObject,i=Jm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function xM(e){return Je(e)&&Rr(e.labelTarget)}var Wo=7;function ey(e){let t=[];return z(e.incoming,n=>{S(n,"bpmn:Association")&&S(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),z(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 z(wp(e),n=>{z(ey(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 Tp="hsl(225, 10%, 15%)",_M="white";function $i(e,t){return hr(e.eventDefinitions,function(n){return n.$type===t})}function wM(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function EM(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function at(e,t,n){var i=pt(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||_M}function _e(e,t,n){var i=pt(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Tp}function Fa(e,t,n,i){var r=pt(e),o=r.get("label");return i||o&&o.get("color:color")||t||_e(e,n)}function ty(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 no(r)}function kp(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 no(a)}function SM(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 no(s)}function RM(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 no(o)}function ja(e,t={}){return{width:li(e,t),height:Wn(e,t)}}function li(e,t={}){return jn(t,"width")?t.width:e.width}function Wn(e,t={}){return jn(t,"height")?t.height:e.height}var CM=new Di,MM=10,Pc=3,AM=1.5,Tc=10,PM=4,Uo=.95,TM=1,kM=.25;function ao(e,t,n,i,r,o,a){Xi.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,l=e&&e.defaultLabelColor;function u(L){return n.computeStyle(L,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Tp,strokeWidth:2,fill:"white"})}function f(L){return n.computeStyle(L,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Tp,strokeWidth:2})}function p(L,E){var{ref:x={x:0,y:0},scale:G=1,element:U,parentGfx:Z=r._svg}=E,Re=De("marker",{id:L,viewBox:"0 0 20 20",refX:x.x,refY:x.y,markerWidth:20*G,markerHeight:20*G,orient:"auto"});Ue(Re,U);var Ze=Rt(":scope > defs",Z);Ze||(Ze=De("defs"),Ue(Z,Ze)),Ue(Ze,Re)}function d(L,E,x,G){var U=CM.nextPrefixed("marker-");return g(L,U,E,x,G),"url(#"+U+")"}function g(L,E,x,G,U){if(x==="sequenceflow-end"){var Z=De("path",{d:"M 1 5 L 11 10 L 1 15 Z",...u({fill:U,stroke:U,strokeWidth:1})});p(E,{element:Z,ref:{x:11,y:10},scale:.5,parentGfx:L})}if(x==="messageflow-start"){var Re=De("circle",{cx:6,cy:6,r:3.5,...u({fill:G,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(E,{element:Re,ref:{x:6,y:6},parentGfx:L})}if(x==="messageflow-end"){var Ze=De("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(E,{element:Ze,ref:{x:8.5,y:5},parentGfx:L})}if(x==="association-start"){var dt=De("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(E,{element:dt,ref:{x:1,y:10},scale:.5,parentGfx:L})}if(x==="association-end"){var Vt=De("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(E,{element:Vt,ref:{x:11,y:10},scale:.5,parentGfx:L})}if(x==="conditional-flow-marker"){var wt=De("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...u({fill:G,stroke:U})});p(E,{element:wt,ref:{x:-1,y:10},scale:.5,parentGfx:L})}if(x==="conditional-default-flow-marker"){var ln=De("path",{d:"M 6 4 L 10 16",...u({stroke:U,fill:"none"})});p(E,{element:ln,ref:{x:0,y:10},scale:.5,parentGfx:L})}}function h(L,E,x,G,U={}){pn(G)&&(U=G,G=0),G=G||0,U=u(U);var Z=E/2,Re=x/2,Ze=De("circle",{cx:Z,cy:Re,r:Math.round((E+x)/4-G),...U});return Ue(L,Ze),Ze}function y(L,E,x,G,U,Z){pn(U)&&(Z=U,U=0),U=U||0,Z=u(Z);var Re=De("rect",{x:U,y:U,width:E-U*2,height:x-U*2,rx:G,ry:G,...Z});return Ue(L,Re),Re}function M(L,E,x,G){var U=E/2,Z=x/2,Re=[{x:U,y:0},{x:E,y:Z},{x:U,y:x},{x:0,y:Z}],Ze=Re.map(function(Vt){return Vt.x+","+Vt.y}).join(" ");G=u(G);var dt=De("polygon",{...G,points:Ze});return Ue(L,dt),dt}function _(L,E,x,G){x=f(x);var U=ka(E,x,G);return Ue(L,U),U}function m(L,E,x){return _(L,E,x,5)}function v(L,E,x){x=f(x);var G=De("path",{...x,d:E});return Ue(L,G),G}function w(L,E,x,G){return v(E,x,W({"data-marker":L},G))}function R(L){return Pe[L]}function P(L){return function(E,x,G){return R(L)(E,x,G)}}var T={"bpmn:MessageEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.235,my:.315}}),Z=G?_e(E,c,x.stroke):at(E,s,x.fill),Re=G?at(E,s,x.fill):_e(E,c,x.stroke),Ze=v(L,U,{fill:Z,stroke:Re,strokeWidth:1});return Ze},"bpmn:TimerEventDefinition":function(L,E,x={}){var G=x.width||E.width,U=x.height||E.height,Z=x.width?1:2,Re=h(L,G,U,.2*U,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:Z}),Ze=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}});v(L,Ze,{stroke:_e(E,c,x.stroke),strokeWidth:Z});for(var dt=0;dt<12;dt++){var Vt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:G,containerHeight:U,position:{mx:.5,my:.5}}),wt=G/2,ln=U/2;v(L,Vt,{strokeWidth:1,stroke:_e(E,c,x.stroke),transform:"rotate("+dt*30+","+ln+","+wt+")"})}return Re},"bpmn:EscalationEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.5,my:.2}}),Z=G?_e(E,c,x.stroke):at(E,s,x.fill);return v(L,U,{fill:Z,stroke:_e(E,c,x.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(L,E,x={}){var G=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.5,my:.222}});return v(L,G,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.57,my:.263}}),Z=G?_e(E,c,x.stroke):at(E,s,x.fill);return v(L,U,{fill:Z,stroke:_e(E,c,x.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.2,my:.722}}),Z=G?_e(E,c,x.stroke):at(E,s,x.fill);return v(L,U,{fill:Z,stroke:_e(E,c,x.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.638,my:-.055}}),Z=G?_e(E,c,x.stroke):"none",Re=v(L,U,{fill:Z,stroke:_e(E,c,x.stroke),strokeWidth:1});return Wm(Re,45),Re},"bpmn:CompensateEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.22,my:.5}}),Z=G?_e(E,c,x.stroke):at(E,s,x.fill);return v(L,U,{fill:Z,stroke:_e(E,c,x.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.5,my:.2}}),Z=G?_e(E,c,x.stroke):at(E,s,x.fill);return v(L,U,{strokeWidth:1,fill:Z,stroke:_e(E,c,x.stroke)})},"bpmn:MultipleEventDefinition":function(L,E,x={},G){var U=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.211,my:.36}}),Z=G?_e(E,c,x.stroke):at(E,s,x.fill);return v(L,U,{fill:Z,stroke:_e(E,c,x.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(L,E,x={}){var G=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:x.width||E.width,containerHeight:x.height||E.height,position:{mx:.458,my:.194}});return v(L,G,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(L,E,x={}){var G=h(L,E.width,E.height,8,{fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke),strokeWidth:4});return G}};function N(L,E,x={},G){var U=ae(L),Z=wM(U),Re=G||L;return U.get("eventDefinitions")&&U.get("eventDefinitions").length>1?U.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](E,Re,x,Z):T["bpmn:MultipleEventDefinition"](E,Re,x,Z):$i(U,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](E,Re,x,Z):$i(U,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](E,Re,x,Z):$i(U,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](E,Re,x,Z):$i(U,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](E,Re,x,Z):$i(U,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](E,Re,x,Z):$i(U,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](E,Re,x,Z):$i(U,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](E,Re,x,Z):$i(U,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](E,Re,x,Z):$i(U,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](E,Re,x,Z):$i(U,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](E,Re,x,Z):null}var k={ParticipantMultiplicityMarker:function(L,E,x={}){var G=li(E,x),U=Wn(E,x),Z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2-6)/G,my:(U-15)/U}});w("participant-multiplicity",L,Z,{strokeWidth:2,fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke)})},SubProcessMarker:function(L,E,x={}){var G=y(L,14,14,0,{strokeWidth:1,fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke)});wn(G,E.width/2-7.5,E.height-20);var U=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2-7.5)/E.width,my:(E.height-20)/E.height}});w("sub-process",L,U,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke)})},ParallelMarker:function(L,E,x){var G=li(E,x),U=Wn(E,x),Z=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+x.parallel)/G,my:(U-20)/U}});w("parallel",L,Z,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke)})},SequentialMarker:function(L,E,x){var G=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+x.seq)/E.width,my:(E.height-19)/E.height}});w("sequential",L,G,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke)})},CompensationMarker:function(L,E,x){var G=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:(E.width/2+x.compensation)/E.width,my:(E.height-13)/E.height}});w("compensation",L,G,{strokeWidth:1,fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke)})},LoopMarker:function(L,E,x){var G=li(E,x),U=Wn(E,x),Z=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+x.loop)/G,my:(U-7)/U}});w("loop",L,Z,{strokeWidth:1.5,fill:"none",stroke:_e(E,c,x.stroke),strokeMiterlimit:.5})},AdhocMarker:function(L,E,x){var G=li(E,x),U=Wn(E,x),Z=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:G,containerHeight:U,position:{mx:(G/2+x.adhoc)/G,my:(U-15)/U}});w("adhoc",L,Z,{strokeWidth:1,fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke)})}};function D(L,E,x,G){k[L](E,x,G)}function H(L,E,x=[],G={}){G={fill:G.fill,stroke:G.stroke,width:li(E,G),height:Wn(E,G)};var U=ae(E),Z=x.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")&&x.push("CompensationMarker"),S(U,"bpmn:AdHocSubProcess")&&(x.push("AdhocMarker"),Z||W(G,{compensation:G.compensation-18}));var Re=U.get("loopCharacteristics"),Ze=Re&&Re.get("isSequential");Re&&(W(G,{compensation:G.compensation-18}),x.includes("AdhocMarker")&&W(G,{seq:-23,loop:-18,parallel:-24}),Ze===void 0&&x.push("LoopMarker"),Ze===!1&&x.push("ParallelMarker"),Ze===!0&&x.push("SequentialMarker")),x.includes("CompensationMarker")&&x.length===1&&W(G,{compensation:-8}),z(x,function(dt){D(dt,L,E,G)})}function Q(L,E,x={}){x=W({size:{width:100}},x);var G=o.createText(E||"",x);return ut(G).add("djs-label"),Ue(L,G),G}function pe(L,E,x,G={}){var U=ae(E),Z=ja({x:E.x,y:E.y,width:E.width,height:E.height},G);return Q(L,U.name,{align:x,box:Z,padding:7,style:{fill:Fa(E,l,c,G.stroke)}})}function Me(L,E,x={}){var G={width:E.width,height:E.height,x:E.width/2+E.x,y:E.height/2+E.y};return Q(L,oi(E),{box:G,style:W({},o.getExternalStyle(),{fill:Fa(E,l,c,x.stroke)})})}function Be(L,E,x,G={}){var U=dn(x),Z=Q(L,E,{box:{height:30,width:U?Wn(x,G):li(x,G)},align:"center-middle",style:{fill:Fa(x,l,c,G.stroke)}});if(U){var Re=-1*Wn(x,G);Rc(Z,0,-Re,270)}}function it(L,E,x={}){var{width:G,height:U}=ja(E,x);return y(L,G,U,Tc,{...x,fill:at(E,s,x.fill),fillOpacity:Uo,stroke:_e(E,c,x.stroke)})}function K(L,E,x={}){var G=ae(E),U=at(E,s,x.fill),Z=_e(E,c,x.stroke);return(G.get("associationDirection")==="One"||G.get("associationDirection")==="Both")&&(x.markerEnd=d(L,"association-end",U,Z)),G.get("associationDirection")==="Both"&&(x.markerStart=d(L,"association-start",U,Z)),x=ft(x,["markerStart","markerEnd"]),m(L,E.waypoints,{...x,stroke:Z,strokeDasharray:"0, 5"})}function J(L,E,x={}){var G=at(E,s,x.fill),U=_e(E,c,x.stroke),Z=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}}),Re=v(L,Z,{fill:G,fillOpacity:Uo,stroke:U}),Ze=ae(E);if(EM(Ze)){var dt=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:.33,my:(E.height-18)/E.height}});v(L,dt,{strokeWidth:2,fill:G,stroke:U})}return Re}function ce(L,E,x={}){return h(L,E.width,E.height,{fillOpacity:Uo,...x,fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke)})}function ve(L,E,x={}){return M(L,E.width,E.height,{fill:at(E,s,x.fill),fillOpacity:Uo,stroke:_e(E,c,x.stroke)})}function q(L,E,x={}){var G=y(L,li(E,x),Wn(E,x),0,{fill:at(E,s,x.fill),fillOpacity:x.fillOpacity||Uo,stroke:_e(E,c,x.stroke),strokeWidth:1.5}),U=ae(E);if(S(U,"bpmn:Lane")){var Z=U.get("name");Be(L,Z,E,x)}return G}function V(L,E,x={}){var G=it(L,E,x),U=st(E);if(Tn(E)&&(Se(G,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!U)){var Z=ae(E).flowElements||[],Re=Z.filter(Ze=>S(Ze,"bpmn:StartEvent"));Re.length===1&&ne(Re[0],L,x,E)}return pe(L,E,U?"center-top":"center-middle",x),U?H(L,E,void 0,x):H(L,E,["SubProcessMarker"],x),G}function ne(L,E,x,G){var U=22,Z={fill:at(G,s,x.fill),stroke:_e(G,c,x.stroke),width:U,height:U},Re=ae(L).isInterrupting,Ze=Re?0:3,dt=Re?1:1.2,Vt=20,wt=(U-Vt)/2,ln="translate("+wt+","+wt+")";h(E,Vt,Vt,{fill:Z.fill,stroke:Z.stroke,strokeWidth:dt,strokeDasharray:Ze,transform:ln}),N(L,E,Z,G)}function Te(L,E,x={}){var G=it(L,E,x);return pe(L,E,"center-middle",x),H(L,E,void 0,x),G}var Pe=this.handlers={"bpmn:AdHocSubProcess":function(L,E,x={}){return st(E)?x=ft(x,["fill","stroke","width","height"]):x=ft(x,["fill","stroke"]),V(L,E,x)},"bpmn:Association":function(L,E,x={}){return x=ft(x,["fill","stroke"]),K(L,E,x)},"bpmn:BoundaryEvent":function(L,E,x={}){var{renderIcon:G=!0}=x;x=ft(x,["fill","stroke"]);var U=ae(E),Z=U.get("cancelActivity");x={strokeWidth:1.5,fill:at(E,s,x.fill),fillOpacity:TM,stroke:_e(E,c,x.stroke)},Z||(x.strokeDasharray="6");var Re=ce(L,E,x);return h(L,E.width,E.height,Pc,{...x,fill:"none"}),G&&N(E,L,x),Re},"bpmn:BusinessRuleTask":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=Te(L,E,x),U=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),Z=v(L,U);Se(Z,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1});var Re=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),Ze=v(L,Re);return Se(Ze,{fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke),strokeWidth:1}),G},"bpmn:CallActivity":function(L,E,x={}){return x=ft(x,["fill","stroke"]),V(L,E,{strokeWidth:5,...x})},"bpmn:ComplexGateway":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=ve(L,E,x),U=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.26}});return v(L,U,{fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke),strokeWidth:1}),G},"bpmn:DataInput":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=J(L,E,x);return v(L,G,{fill:"none",stroke:_e(E,c,x.stroke),strokeWidth:1}),U},"bpmn:DataInputAssociation":function(L,E,x={}){return x=ft(x,["fill","stroke"]),K(L,E,{...x,markerEnd:d(L,"association-end",at(E,s,x.fill),_e(E,c,x.stroke))})},"bpmn:DataObject":function(L,E,x={}){return x=ft(x,["fill","stroke"]),J(L,E,x)},"bpmn:DataObjectReference":P("bpmn:DataObject"),"bpmn:DataOutput":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=i.getRawPath("DATA_ARROW"),U=J(L,E,x);return v(L,G,{strokeWidth:1,fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke)}),U},"bpmn:DataOutputAssociation":function(L,E,x={}){return x=ft(x,["fill","stroke"]),K(L,E,{...x,markerEnd:d(L,"association-end",at(E,s,x.fill),_e(E,c,x.stroke))})},"bpmn:DataStoreReference":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:E.width,containerHeight:E.height,position:{mx:0,my:.133}});return v(L,G,{fill:at(E,s,x.fill),fillOpacity:Uo,stroke:_e(E,c,x.stroke),strokeWidth:2})},"bpmn:EndEvent":function(L,E,x={}){var{renderIcon:G=!0}=x;x=ft(x,["fill","stroke"]);var U=ce(L,E,{...x,strokeWidth:4});return G&&N(E,L,x),U},"bpmn:EventBasedGateway":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=ae(E),U=ve(L,E,x);h(L,E.width,E.height,E.height*.2,{fill:at(E,"none",x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1});var Z=G.get("eventGatewayType"),Re=!!G.get("instantiate");function Ze(){var Vt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:E.width,containerHeight:E.height,position:{mx:.36,my:.44}});v(L,Vt,{fill:"none",stroke:_e(E,c,x.stroke),strokeWidth:2})}if(Z==="Parallel"){var dt=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.474,my:.296}});v(L,dt,{fill:"none",stroke:_e(E,c,x.stroke),strokeWidth:1})}else Z==="Exclusive"&&(Re||h(L,E.width,E.height,E.height*.26,{fill:"none",stroke:_e(E,c,x.stroke),strokeWidth:1}),Ze());return U},"bpmn:ExclusiveGateway":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=ve(L,E,x),U=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:E.width,containerHeight:E.height,position:{mx:.32,my:.3}}),Z=pt(E);return Z.get("isMarkerVisible")&&v(L,U,{fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke),strokeWidth:1}),G},"bpmn:Gateway":function(L,E,x={}){return x=ft(x,["fill","stroke"]),ve(L,E,x)},"bpmn:Group":function(L,E,x={}){return x=ft(x,["fill","stroke","width","height"]),y(L,E.width,E.height,Tc,{stroke:_e(E,c,x.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:li(E,x),height:Wn(E,x)})},"bpmn:InclusiveGateway":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=ve(L,E,x);return h(L,E.width,E.height,E.height*.24,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:2.5}),G},"bpmn:IntermediateEvent":function(L,E,x={}){var{renderIcon:G=!0}=x;x=ft(x,["fill","stroke"]);var U=ce(L,E,{...x,strokeWidth:1.5});return h(L,E.width,E.height,Pc,{fill:"none",stroke:_e(E,c,x.stroke),strokeWidth:1.5}),G&&N(E,L,x),U},"bpmn:IntermediateCatchEvent":P("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":P("bpmn:IntermediateEvent"),"bpmn:Lane":function(L,E,x={}){return x=ft(x,["fill","stroke","width","height"]),q(L,E,{...x,fillOpacity:kM})},"bpmn:ManualTask":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=Te(L,E,x),U=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return v(L,U,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:.5}),G},"bpmn:MessageFlow":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=ae(E),U=pt(E),Z=at(E,s,x.fill),Re=_e(E,c,x.stroke),Ze=m(L,E.waypoints,{markerEnd:d(L,"messageflow-end",Z,Re),markerStart:d(L,"messageflow-start",Z,Re),stroke:Re,strokeDasharray:"10, 11",strokeWidth:1.5});if(G.get("messageRef")){var dt=Ze.getPointAtLength(Ze.getTotalLength()/2),Vt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:dt.x,y:dt.y}}),wt={strokeWidth:1};U.get("messageVisibleKind")==="initiating"?(wt.fill=Z,wt.stroke=Re):(wt.fill=Re,wt.stroke=Z);var ln=v(L,Vt,wt),mn=G.get("messageRef"),yn=mn.get("name"),Et=Q(L,yn,{align:"center-top",fitBox:!0,style:{fill:Re}}),un=ln.getBBox(),hn=Et.getBBox(),bo=dt.x-hn.width/2,Zn=dt.y+un.height/2+MM;Rc(Et,bo,Zn,0)}return Ze},"bpmn:ParallelGateway":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=ve(L,E,x),U=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:E.width,containerHeight:E.height,position:{mx:.46,my:.2}});return v(L,U,{fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke),strokeWidth:1}),G},"bpmn:Participant":function(L,E,x={}){x=ft(x,["fill","stroke","width","height"]);var G=q(L,E,x),U=st(E),Z=dn(E),Re=ae(E),Ze=Re.get("name");if(U){var dt=Z?[{x:30,y:0},{x:30,y:Wn(E,x)}]:[{x:0,y:30},{x:li(E,x),y:30}];_(L,dt,{stroke:_e(E,c,x.stroke),strokeWidth:AM}),Be(L,Ze,E,x)}else{var Vt=ja(E,x);Z||(Vt.height=li(E,x),Vt.width=Wn(E,x));var wt=Q(L,Ze,{box:Vt,align:"center-middle",style:{fill:Fa(E,l,c,x.stroke)}});if(!Z){var ln=-1*Wn(E,x);Rc(wt,0,-ln,270)}}return Re.get("participantMultiplicity")&&D("ParticipantMultiplicityMarker",L,E,x),G},"bpmn:ReceiveTask":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=ae(E),U=Te(L,E,x),Z;return G.get("instantiate")?(h(L,28,28,20*.22,{fill:at(E,s,x.fill),stroke:_e(E,c,x.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}}),v(L,Z,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1}),U},"bpmn:ScriptTask":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=Te(L,E,x),U=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return v(L,U,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1}),G},"bpmn:SendTask":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=Te(L,E,x),U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return v(L,U,{fill:_e(E,c,x.stroke),stroke:at(E,s,x.fill),strokeWidth:1}),G},"bpmn:SequenceFlow":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=at(E,s,x.fill),U=_e(E,c,x.stroke),Z=m(L,E.waypoints,{markerEnd:d(L,"sequenceflow-end",G,U),stroke:U}),Re=ae(E),{source:Ze}=E;if(Ze){var dt=ae(Ze);Re.get("conditionExpression")&&S(dt,"bpmn:Activity")&&Se(Z,{markerStart:d(L,"conditional-flow-marker",G,U)}),dt.get("default")&&(S(dt,"bpmn:Gateway")||S(dt,"bpmn:Activity"))&&dt.get("default")===Re&&Se(Z,{markerStart:d(L,"conditional-default-flow-marker",G,U)})}return Z},"bpmn:ServiceTask":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=Te(L,E,x);h(L,10,10,{fill:at(E,s,x.fill),stroke:"none",transform:"translate(6, 6)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});v(L,U,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1}),h(L,10,10,{fill:at(E,s,x.fill),stroke:"none",transform:"translate(11, 10)"});var Z=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return v(L,Z,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:1}),G},"bpmn:StartEvent":function(L,E,x={}){var{renderIcon:G=!0}=x;x=ft(x,["fill","stroke"]);var U=ae(E);U.get("isInterrupting")||(x={...x,strokeDasharray:"6"});var Z=ce(L,E,x);return G&&N(E,L,x),Z},"bpmn:SubProcess":function(L,E,x={}){return st(E)?x=ft(x,["fill","stroke","width","height"]):x=ft(x,["fill","stroke"]),V(L,E,x)},"bpmn:Task":function(L,E,x={}){return x=ft(x,["fill","stroke"]),Te(L,E,x)},"bpmn:TextAnnotation":function(L,E,x={}){x=ft(x,["fill","stroke"]);var{width:G,height:U}=ja(E,x),Z=y(L,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}});v(L,Re,{stroke:_e(E,c,x.stroke)});var Ze=ae(E),dt=Ze.get("text")||"";return Q(L,dt,{align:"left-top",box:ja(E,x),padding:Wo,style:{fill:Fa(E,l,c,x.stroke)}}),Z},"bpmn:Transaction":function(L,E,x={}){st(E)?x=ft(x,["fill","stroke","width","height"]):x=ft(x,["fill","stroke"]);var G=V(L,E,{strokeWidth:1.5,...x}),U=n.style(["no-fill","no-events"],{stroke:_e(E,c,x.stroke),strokeWidth:1.5}),Z=st(E);return Z||(x={}),y(L,li(E,x),Wn(E,x),Tc-Pc,Pc,U),G},"bpmn:UserTask":function(L,E,x={}){x=ft(x,["fill","stroke"]);var G=Te(L,E,x),U=15,Z=12,Re=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:Z}});v(L,Re,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:.5});var Ze=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:Z}});v(L,Ze,{fill:at(E,s,x.fill),stroke:_e(E,c,x.stroke),strokeWidth:.5});var dt=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:Z}});return v(L,dt,{fill:_e(E,c,x.stroke),stroke:_e(E,c,x.stroke),strokeWidth:.5}),G},label:function(L,E,x={}){return Me(L,E,x)}};this._drawPath=v,this._renderer=R}Ee(ao,Xi),ao.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],ao.prototype.canRender=function(e){return S(e,"bpmn:BaseElement")},ao.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},ao.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},ao.prototype.getShapePath=function(e){return Je(e)?kp(e,PM):S(e,"bpmn:Event")?ty(e):S(e,"bpmn:Activity")?kp(e,Tc):S(e,"bpmn:Gateway")?SM(e):RM(e)};function ft(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var OM=0,DM={width:150,height:50};function LM(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function IM(e){return pn(e)?W({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Op=null;function BM(){return Op||(Op=document.createElement("canvas").getContext("2d")),Op}function NM(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(ny(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function ny(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function $M(e,t){var n=BM();if(!n)return{width:0,height:0};n.font=NM(t),"letterSpacing"in n&&(n.letterSpacing=ny(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 FM(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=$M(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return jM(e,r,i,o);r=zM(r,o.width,t)}}function jM(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 iy="­";function HM(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===iy)&&r.pop();break}var a=r[r.length-1];return a&&a===iy&&(r[r.length-1]="-"),r.join("")}function zM(e,t,n){var i=Math.max(e.length*(n/t),1),r=HM(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function kc(e){this._config=W({},{size:DM,padding:OM,style:{},align:"center-top"},e||{})}kc.prototype.createText=function(e,t){return this.layoutText(e,t).element},kc.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},kc.prototype.layoutText=function(e,t){for(var n=W({},this._config.size,t.box),i=W({},this._config.style,t.style),r=LM(t.align||this._config.align),o=IM(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=GM(i),c=e.split(/\u00AD?\r?\n/),l=[],u=n.width-o.left-o.right;c.length;)l.push(FM(c,u,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Hn(l,function(y,M,_){return y+(s||M.height)},0)+o.top+o.bottom,p=Hn(l,function(y,M,_){return M.width>y?M.width:y},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||l[0].height)/4;var g=De("text");Se(g,i),z(l,function(y){var M;switch(d+=s||y.height,r.horizontal){case"left":M=o.left;break;case"right":M=(a?p:u)-o.right-y.width;break;default:M=Math.max(((a?p:u)-y.width)/2+o.left,0)}var _=De("tspan");Se(_,{x:M,y:d}),_.textContent=y.text,Ue(g,_)});var h={width:p,height:f};return{dimensions:h,element:g}};function GM(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var VM=12,WM=1.2,UM=40;function ry(e){var t=W({fontFamily:"Arial, sans-serif",fontSize:VM,fontWeight:"normal",lineHeight:WM},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=W({},t,{fontSize:n},e&&e.externalStyle||{}),r=new kc({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,oo.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(UM,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}}ry.$inject=["config.textRenderer"];function YM(){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=ZM(i.d,{mx:r,my:o,e:a});return f}}var qM=/\{([^{}]+)\}/g,KM=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function XM(e,t,n){var i=n;return t.replace(KM,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 ZM(e,t){return String(e).replace(qM,function(n,i){return XM(n,i,t)})}const QM={__init__:["bpmnRenderer"],bpmnRenderer:["type",ao],textRenderer:["type",ry],pathMap:["type",YM]};function JM(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const Ha={translate:["value",JM]};function Oc(e,t,n){return W({id:e.id,type:e.$type,businessObject:e,di:t},n)}function eA(e,t,n){var i=e.waypoint;return!i||i.length<2?[$e(t),$e(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function oy(e,t,n){return new Error(`element ${Pn(t)} referenced by ${Pn(e)}#${n} not yet drawn`)}function er(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}er.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],er.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(Oc(e,t,a)),this._canvas.addRootElement(i)}else if(S(t,"bpmndi:BPMNShape")){var s=!st(e,t),c=nA(e);r=n&&(n.hidden||n.collapsed);var l=t.bounds;i=this._elementFactory.createShape(Oc(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")&&(tA(n,$e(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(Oc(e,t,{hidden:r,source:u,target:f,waypoints:eA(t,u,f)})),S(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${Pn(t)} for element ${Pn(e)}`);return Rr(e)&&oi(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},er.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${Pn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw oy(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},er.prototype.addLabel=function(e,t,n){var i,r,o;return i=yM(t,n),r=oi(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Oc(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!oi(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)},er.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?oy(e,i,t+"Ref"):new Error(`${Pn(e)}#${t} Ref not specified`)},er.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},er.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},er.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function tA(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 nA(e){return S(e,"bpmn:Group")}const ay={__depends__:[QM,{__depends__:[Ha],bpmnImporter:["type",er]}]};function za(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 Dp(e){return Math.log(e)/Math.log(10)}var iA=1e3;function oe(e){this._eventBus=e}oe.$inject=["eventBus"];function rA(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}oe.prototype.on=function(e,t,n,i,r,o){if((fn(t)||ze(t))&&(o=r,r=i,i=n,n=t,t=null),fn(n)&&(o=r,r=i,i=n,n=iA),pn(r)&&(o=r,r=!1),!fn(i))throw new Error("handlerFn must be a function");Ne(e)||(e=[e]);var a=this._eventBus;z(e,function(s){var c=["commandStack",s,t].filter(function(l){return l}).join(".");a.on(c,n,r?rA(i,o):i,o)})},oe.prototype.canExecute=tr("canExecute"),oe.prototype.preExecute=tr("preExecute"),oe.prototype.preExecuted=tr("preExecuted"),oe.prototype.execute=tr("execute"),oe.prototype.executed=tr("executed"),oe.prototype.postExecute=tr("postExecute"),oe.prototype.postExecuted=tr("postExecuted"),oe.prototype.revert=tr("revert"),oe.prototype.reverted=tr("reverted");function tr(e){return function(n,i,r,o,a){(fn(n)||ze(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Lp=["top","bottom","left","right"],Dc=10;function Ip(e,t){oe.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(Ac(r)&&!Mt(r)){var o=sA(r);o&&i(r,o)}}function i(r,o){var a=$e(r),s=r.label,c=$e(s);if(s.parent){var l=Ie(r),u;switch(o){case"top":u={x:a.x,y:l.top-Dc-s.height/2};break;case"left":u={x:l.left-Dc-s.width/2,y:a.y};break;case"bottom":u={x:a.x,y:l.bottom+Dc+s.height/2};break;case"right":u={x:l.right+Dc+s.width/2,y:a.y};break}var f=Ci(u,c);t.moveShape(s,f)}}}Ee(Ip,oe),Ip.$inject=["eventBus","modeling"];function oA(e){var t=e.host,n=$e(e),i=_n(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Lp.filter(function(a){return r.indexOf(a)===-1});return o}function aA(e){var t=$e(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 sy(t,i)});return n}function sA(e){var t=$e(e.label),n=$e(e),i=sy(n,t);if(cA(i)){var r=aA(e);if(e.host){var o=oA(e);r=r.concat(o)}var a=Lp.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?_n(e.label,e)!=="intersect"?void 0:i:a[0]}}function sy(e,t){return _n(t,e,5)}function cA(e){return Lp.indexOf(e)!==-1}function Bp(e){oe.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)}Ee(Bp,oe),Bp.$inject=["eventBus"];var lA=1500;function Np(e,t,n){e.invoke(oe,this),this.preExecute("elements.delete",lA,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=nt(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 z(o,l=>{const u=new Set(Ro(jo(Array.from(s),Zt(l))));c=c.union(u),s=s.difference(u)}),Array.from(c)}}Ee(Np,oe),Np.$inject=["injector","eventBus","canvas"];function $p(e,t){e.invoke(oe,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=nt(r.incoming.concat(r.outgoing),function(a){return S(a,"bpmn:Association")});z(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}Ee($p,oe),$p.$inject=["injector","modeling"];function Yo(e,t){for(Fn(t)&&(t=[t]);e=e.parent;)if(tt(e,t))return e;return null}function cy(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 dn(n);if(tt(e,i))return dn(e);var r;for(r=ae(e);r&&!S(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ae(a);return s&&s.get("processRef")===r});return o?dn(o):!0}var ly=500;function Lc(e,t){t.invoke(oe,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",ly,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return uy(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",ly,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];uy(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Lc.$inject=["bpmnReplace","injector"],Ee(Lc,oe),Lc.prototype._replaceShape=function(e,t){var n=uA(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function uA(e){var t=ae(e),n=t.eventDefinitions;return n&&n[0]}function uy(e,t){return!Je(e)&&tt(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Fp(e,t){oe.call(this,e);function n(i){return nt(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")&&z(o.outgoing,function(a){var s=a.target,c=n(s);S(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Fp.$inject=["eventBus","modeling"],Ee(Fp,oe);function py(e){return e.create("bpmn:Category")}function pA(e){return e.create("bpmn:CategoryValue")}function fy(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=pA(e)),n.$parent||(n.$parent=py(e)),n}function fA(e,t,n){return qt(t.get("categoryValue"),e),e.$parent=t,qt(n.get("rootElements"),t),t.$parent=n,e}function dA(e){var t=e.$parent;return t&&(Ut(t.get("categoryValue"),e),e.$parent=null),e}function hA(e){var t=e.$parent;return t&&(Ut(t.get("rootElements"),e),e.$parent=null),e}var gA=500;function jp(e,t,n){n.invoke(oe,this);function i(c){return t.filter(function(l){return S(l,"bpmn:Group")&&!l.labelTarget}).map(ae).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&&fA(c,l,e.getDefinitions())}function s(c,l,u){l&&!o(l,u)&&hA(l),c&&!r(c,u)&&dA(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,ae(l))},!0),this.executed(["shape.move","shape.resize"],gA,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,ae(l))},!0),this.executed("group.updateRefs",function(c){dy(c).forEach(function(l){a(l.categoryValue,l.category)})},!0),this.reverted("group.updateRefs",function(c){dy(c).forEach(function(l){s(l.categoryValue,l.category,ae(l.groupShape))})},!0),this.executed("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||s(c.categoryValue,c.category,ae(l))},!0),this.reverted("shape.delete",function(c){var l=c.shape;!S(l,"bpmn:Group")||l.labelTarget||a(c.categoryValue,c.category)},!0)}jp.$inject=["bpmnjs","elementRegistry","injector"],Ee(jp,oe);function dy(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Hp(e,t,n){oe.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 M=y.source,_=y.target;qo(M)&&Ga(_)&&u(_)}function r(y){const M=y.connection,_=y.source,m=y.target;qo(_)&&Ic(m)&&(l(m),p(_,[M]))}function o(y){const M=y.newTarget,_=y.oldSource,m=y.oldTarget;if(m!==M){const v=_;Ga(m)&&u(m),qo(v)&&Ic(M)&&l(M)}}function a(y){const{element:M}=y;Ga(M)?(f(M),d(M)):Ic(M)&&g(M)}function s(y){const{newData:M,oldShape:_}=y;if(qo(y.oldShape)&&M.eventDefinitionType!=="bpmn:CompensateEventDefinition"||M.type!=="bpmn:BoundaryEvent"){const m=_.outgoing.find(({target:v})=>Ga(v));m&&m.target&&(y._connectionTarget=m.target)}else if(!qo(y.oldShape)&&M.eventDefinitionType==="bpmn:CompensateEventDefinition"&&M.type==="bpmn:BoundaryEvent"){const m=_.outgoing.find(({target:v})=>Ic(v));m&&m.target&&(y._connectionTarget=m.target),h(_)}}function c(y){const{_connectionTarget:M,newShape:_}=y;M&&t.connect(_,M)}function l(y){t.updateProperties(y,{isForCompensation:!0})}function u(y){t.updateProperties(y,{isForCompensation:void 0})}function f(y){for(const M of y.incoming)n.canConnect(M.source,y)||t.removeConnection(M);for(const M of y.outgoing)n.canConnect(y,M.target)||t.removeConnection(M)}function p(y,M){y.outgoing.filter(v=>S(v,"bpmn:Association")).filter(v=>Ga(v.target)&&!M.includes(v)).forEach(v=>t.removeConnection(v))}function d(y){const M=y.attachers.slice();M.length&&t.removeElements(M)}function g(y){const M=y.incoming.filter(_=>qo(_.source));t.removeElements(M)}function h(y){const M=y.outgoing.filter(_=>S(_,"bpmn:SequenceFlow"));t.removeElements(M)}}Ee(Hp,oe),Hp.$inject=["eventBus","modeling","bpmnRules"];function Ga(e){const t=ae(e);return t&&t.get("isForCompensation")}function qo(e){return e&&S(e,"bpmn:BoundaryEvent")&&Vo(e,"bpmn:CompensateEventDefinition")}function Ic(e){return e&&S(e,"bpmn:Activity")&&!Tn(e)}function zp(e){e.invoke(oe,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"))})}zp.$inject=["injector"],Ee(zp,oe);function Gp(e,t){oe.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}})}Gp.$inject=["eventBus","bpmnFactory"],Ee(Gp,oe);var Vp=20,Wp=20,hy=30,Bc=2e3;function Up(e,t,n){oe.call(this,t),t.on(["create.start","shape.move.start"],Bc,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")&&!Je(f)&&!Mt(f)});if(c.length){var l=Zt(c),u=mA(a,l);W(a,u),o.createConstraints=yA(a,l)}}}),t.on("create.start",Bc,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",Bc,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",Bc,function(r){var o=r.elements,a=r.parent,s=vA(o),c;s&&S(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ae(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=ae(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)&&ae(s).set("processRef",ae(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)&&ae(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)}Up.$inject=["canvas","eventBus","modeling"],Ee(Up,oe);function mA(e,t){t={width:t.width+Vp*2+hy,height:t.height+Wp*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 yA(e,t){return t=Ie(t),{bottom:t.top+e.height/2-Wp,left:t.right-e.width/2+Vp,top:t.bottom-e.height/2+Wp,right:t.left+e.width/2-Vp-hy}}function vA(e){return kt(e,function(t){return S(t,"bpmn:Participant")})}var gy="__targetRef_placeholder";function Yp(e,t){oe.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],my(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],my(o));function n(a,s,c){var l=a.get("dataInputAssociations");return kt(l,function(u){return u!==c&&u.targetRef===s})}function i(a,s){var c=a.get("properties"),l=kt(c,function(u){return u.name===gy});return!l&&s&&(l=t.create("bpmn:Property",{name:gy}),qt(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,g=s.oldTarget||s.target,h=g&&g.businessObject,y=c.businessObject,M;h&&h!==f&&r(h,l),d&&d!==f&&r(d,l),f?(M=i(f,!0),y.targetRef=M):y.targetRef=null}}Yp.$inject=["eventBus","bpmnFactory"],Ee(Yp,oe);function my(e){return function(t){var n=t.context,i=n.connection;if(S(i,"bpmn:DataInputAssociation"))return e(t)}}function Nc(e){this._bpmnUpdater=e}Nc.$inject=["bpmnUpdater"],Nc.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),[]},Nc.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 qp(e,t,n,i){oe.call(this,i),t.registerHandler("dataStore.updateContainment",Nc);function r(){return n.filter(function(s){return S(s,"bpmn:Participant")&&ae(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:pt(s),newSemanticParent:u.processRef||u,newDiParent:pt(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:xA(u,"bpmn:Participant");a(l,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,l=c.shape,u=e.getRootElement();tt(l,["bpmn:Participant","bpmn:SubProcess"])&&S(u,"bpmn:Collaboration")&&o(u).filter(function(f){return bA(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)})})}qp.$inject=["canvas","commandStack","elementRegistry","eventBus"],Ee(qp,oe);function bA(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 xA(e,t){for(;e.parent;){if(S(e.parent,t))return e.parent;e=e.parent}}var $c=Math.max,Fc=Math.min,_A=20;function yy(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function wA(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 EA(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 jc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return ze(r)&&(i=(/top|left/.test(e)?Fc:$c)(i,r)),ze(o)&&(i=(/top|left/.test(e)?$c:Fc)(i,o)),i}function SA(e,t){if(!t)return e;var n=Ie(e);return wc({top:jc("top",n,t),right:jc("right",n,t),bottom:jc("bottom",n,t),left:jc("left",n,t)})}function RA(e,t,n,i){var r=Ie(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Ie(i):o,s={top:Fc(o.top,a.top),left:Fc(o.left,a.left),bottom:$c(o.bottom,a.bottom),right:$c(o.right,a.right)};return wc(s)}function Va(e,t){return typeof e<"u"?e:_A}function CA(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 MA(e){return!(e.waypoints||e.type==="label")}function vy(e,t){var n;if(e.length===void 0?n=nt(e.children,MA):n=e,n.length)return CA(Zt(n),t)}var Cr=Math.abs;function AA(e,t){return yy(Ie(t),Ie(e))}var PA=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],ui=30;function Hc(e,t){return t=t||[],e.children.filter(function(n){S(n,"bpmn:Lane")&&(Hc(n,t),t.push(n))}),t}function Mr(e){return e.children.filter(function(t){return S(t,"bpmn:Lane")})}function pi(e){return Yo(e,PA)||e}function TA(e,t){var n=pi(e),i=S(n,"bpmn:Process")?[]:[n],r=Hc(n,i),o=Ie(e),a=Ie(t),s=AA(e,t),c=[],l=dn(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,g=l?s.left:0,h=Ie(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&&(g=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&&(g=a.right-h.left),Cr(h.right-o.right)<5&&(p=a.right-h.right)),(f||p||d||g)&&c.push({shape:u,newBounds:EA(u,{top:f,right:p,bottom:d,left:g})})}}),c}var kA=500;function Kp(e,t){oe.call(this,e);function n(i,r){var o=dn(i),a=Mr(r),s=[],c=[],l=[],u=[];if(io(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,g,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&&(g=t.calculateAdjustments(l,"x",f,i.x-10),t.makeSpace(g.movingShapes,g.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",kA,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))})}Kp.$inject=["eventBus","spaceTool"],Ee(Kp,oe);var by=500;function zc(e,t){t.invoke(oe,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",by,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return xy(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",by,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;xy(a,DA(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}zc.$inject=["bpmnReplace","injector"],Ee(zc,oe),zc.prototype._replaceShape=function(e){var t=OA(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function OA(e){var t=ae(e),n=t.eventDefinitions;return n&&n[0]}function xy(e,t){return!Je(e)&&S(e,"bpmn:BoundaryEvent")&&!t}function DA(e,t){return e.indexOf(t)!==-1}var Gc=Math.round,LA=Math.max;function IA(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 BA(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var _y=10;function NA(e,t){var n,i;for(n=0;i=e[n];n++)if(La(i,t)<=_y)return{point:e[n],bendpoint:!0,index:n};return null}function $A(e,t){var n=Cm(IA(t,_y),BA(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=LA(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:Gc(i.x+r.x)/2,y:Gc(i.y+r.y)/2},index:i.segment2}:{point:{x:Gc(i.x),y:Gc(i.y)},index:i.segment2}:null}function Xp(e,t){return NA(e,t)||$A(e,t)}function Zp(e,t,n){oe.call(this,e);function i(r,o,a){var s=o.waypoints,c,l,u,f,p,d,g,h=r.outgoing.slice(),y=r.incoming.slice(),M;ze(a.width)?M=$e(a):M=a;var _=Xp(s,M);if(_){if(c=s.slice(0,_.index),l=s.slice(_.index+(_.bendpoint?1:0)),!c.length||!l.length)return;u=_.bendpoint?s[_.index]:M,(c.length===1||!wy(r,c[c.length-1]))&&c.push(Ey(u)),(l.length===1||!wy(r,l[0]))&&l.unshift(Ey(u))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||M),d=o),t.canConnect(r,p,o)&&(d?g=n.connect(r,p,{type:o.type,waypoints:l}):(n.reconnectStart(o,r,l||M),g=o));var m=[].concat(d&&nt(y,function(v){return v.source===d.source})||[],g&&nt(h,function(v){return v.target===g.target})||[]);m.length&&n.removeElements(m)}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=$e(c),u={x:l.x+s.x,y:l.y+s.y},f=kt(o.children,function(p){var d=t.canInsert(a,p);return d&&Xp(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)}Ee(Zp,oe),Zp.$inject=["eventBus","bpmnRules","modeling"];function wy(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 Ey(e){return W({},e)}function Qp(e,t){oe.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)})})}})}Qp.$inject=["eventBus","modeling"],Ee(Qp,oe);function Ko(e){return S(e,"bpmn:SequenceFlow")}var Vc=1500,Sy=2e3;function Ry(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"],Vc,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;S(a,"bpmn:Lane")&&!tt(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=pi(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||tt(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"],Vc,function(i){var r=i.hover;S(r,"bpmn:Lane")&&(i.hover=pi(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],Vc,function(i){var r=i.context,o=i.hover,a=r.type;S(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=pi(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],Vc,function(i){var r=i.context,o=r.start;S(o,"bpmn:Lane")&&(r.start=pi(o)||o)}),t.on("shape.move.start",Sy,function(i){var r=i.shape;S(r,"bpmn:Lane")&&(i.shape=pi(r)||r)}),t.on("spaceTool.move",Sy,function(i){var r=i.hover;r&&S(r,"bpmn:Lane")&&(i.hover=pi(r))})}Ry.$inject=["elementRegistry","eventBus","canvas"];var Cy=770;function Jp(e,t,n,i){n.invoke(oe,this);function r(s,c){var l=ae(s),u=c.categoryValue||l.categoryValueRef;u||(u=fy(e,l));var f=c.category||u.$parent||py(e);l.categoryValueRef=u,u.$parent=f,c.categoryValue=u,c.category=f}function o(s,c){var l=ae(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=ae(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=ae(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&&!ae(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&&!ae(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||ae(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",Cy,function(s){var c=s.descriptor,l=s.element;if(!(!S(l,"bpmn:Group")||l.labelTarget)){var u=ae(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",Cy,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"],Ee(Jp,oe);function ef(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 My(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=ef(i,r,o,a),l=ef(i,r,o,s),u;c&&l?Ay(c,o)>Ay(l,o)?u=l:u=c:u=c||l,i.original=u}function n(i){var r=i.waypoints;t(r[0],r[1],$e(i.source)),t(r[r.length-1],r[r.length-2],$e(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}My.$inject=["eventBus"];function Ay(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function tf(e){oe.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=ae(i),o=pt(i);if(tt(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}tf.$inject=["eventBus"],Ee(tf,oe);function Py(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ty(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function FA(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 jA(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 nf(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=jA([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 ky(e,t){var n=nf(e,t),i={x:n.x-e.x,y:n.y-e.y};return Py(i)}function Wa(e,t){return Py({x:e.x-t.x,y:e.y-t.y})}var Oy=Math.sqrt,Dy=Math.min,HA=Math.max,Ly=Math.abs;function Iy(e){return Math.pow(e,2)}function Ua(e,t){return Oy(Iy(e.x-t.x)+Iy(e.y-t.y))}function zA(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],Ny(i,r)?l=[i]:(o=Ua(e,i),a=Ua(e,r),c=Dy(o,a),l=GA(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:Ny(i,l[0])?n:n+1}),l.length===2&&(s=WA(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 GA(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 g=Oy(d),h=-f+g,y=-f-g,M={x:e.x-r*h,y:e.y-o*h};if(d===0)return[M];var _={x:e.x-r*y,y:e.y-o*y};return[M,_].filter(function(m){return VA(m,e,t)})}function VA(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>=Dy(t,n)-Wc&&e<=HA(t,n)+Wc}function WA(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var Wc=.1;function Ny(e,t){return Ly(e.x-t.x)<=Wc&&Ly(e.y-t.y)<=Wc}function UA(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=Fy(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=zA(e,n),c=s.segmentIndex,l=UA(n,t,s,i);if(l<0||l>t.length-2||l===null)return a;var u=jy(n,c),f=jy(t,l),p=s.position,d=qA(u,p),g=YA(u,f);if(s.type==="bendpoint"){var h=t.length-n.length,y=s.bendpointIndex,M=n[y];if(t.indexOf(M)!==-1)return a;if(h===0){var _=t[y];return r=_.x-s.position.x,o=_.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=Fy(n,y))}var m={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},v=FA({x:e.x-p.x,y:e.y-p.y},g);return r=m.x+v.x-e.x,o=m.y+v.y-e.y,{point:Qi(m),delta:Qi({x:r,y:o})}}function Fy(e,t){var n=Wa(e[t-1],e[t]),i=Wa(e[t],e[t+1]),r=n/(n+i);return r}function YA(e,t){var n=Ty(e),i=Ty(t);return i-n}function jy(e,t){return[e[t],e[t+1]]}function qA(e,t){var n=Wa(e[0],e[1]),i=Wa(e[0],t);return n===0?0:i/n}function KA(e,t,n,i){var r=$e(e);return $y(r,t,n,i).delta}function Ya(e,t,n){var i=za(t),r=za(n),o=Ci(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Qi({x:r.x+a.x,y:r.y+a.y})}function Hy(e,t,n){var i=za(e),r=za(t),o=za(n),a=Ci(e,i),s=Ci(i,r),c=XA(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 Qi({x:u.x+a.x-e.x,y:u.y+a.y-e.y})}function XA(e,t,n){var i=Ie(t),r=Ie(n);if(ZA(i,r))return null;var o=_n(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=_n(n,s),c!==o?null:a}function ZA(e,t){return QA(e,t)||JA(e,t)}function QA(e,t){return e.right!==t.right&&e.left!==t.left}function JA(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var zy="name",Gy="text";function rf(e,t,n,i){oe.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ae(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,l=s.properties;if(zy in l&&t.updateLabel(c,l[zy]),Gy in l&&S(c,"bpmn:TextAnnotation")){var u=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},l[Gy]||"");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;Je(l)||!Rr(l)||oi(l)&&t.updateLabel(l,oi(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),KA(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=ae(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(!(!Je(c)||l.autoResize)){var u=s.newBounds,f=i.getDimensions(oi(c)||"",{box:u,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=u.y!==c.y,g=c.y+c.height;s.newBounds={width:u.width,height:p,x:u.x,y:d?g-p:u.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,l=s.newBounds,u=s.oldBounds;if(Ac(c)){var f=c.label,p=$e(f),d=nP(u),g=tP(p,d),h=eP(g,u,l);t.moveShape(f,h)}})}Ee(rf,oe),rf.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function eP(e,t,n){var i=Ya(e,t,n);return Qi(Ci(i,e))}function tP(e,t){if(t.length){var n=iP(e,t);return nf(e,n)}}function nP(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:ky(e,r)}}),i=Pi(n,"distance");return i[0].line}function rP(e,t,n,i){return $y(e,t,n,i).point}function of(e,t){oe.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),rP(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)})})}Ee(of,oe),of.$inject=["eventBus","modeling"];function Uc(e,t,n){var i=qc(e),r=Wy(i,t),o=i[0];return r.length?r[r.length-1]:Ya(o.original||o,n,t)}function Yc(e,t,n){var i=qc(e),r=Wy(i,t),o=i[i.length-1];return r.length?r[0]:Ya(o.original||o,n,t)}function af(e,t,n){var i=qc(e),r=Vy(t,n),o=i[0];return Ya(o.original||o,r,t)}function sf(e,t,n){var i=qc(e),r=Vy(t,n),o=i[i.length-1];return Ya(o.original||o,r,t)}function Vy(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function qc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Wy(e,t){var n=Cn(e,aP);return nt(n,function(i){return oP(i,t)})}function oP(e,t){return _n(t,e,1)==="intersect"}function aP(e){return e.original||e}function cf(e,t){oe.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(sP(i,r)){var o=cP(i);o.incoming.forEach(function(a){var s=Yc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=Uc(a,r,i);t.reconnectStart(a,r,s)})}},!0)}cf.$inject=["eventBus","modeling"],Ee(cf,oe);function sP(e,t){return S(e,"bpmn:Participant")&&st(e)&&S(t,"bpmn:Participant")&&!st(t)}function cP(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 lP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Uy(e){const t=ae(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:lP.some(i=>S(n[0],i))}function Yy(e){return S(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function lf(e,t){e.invoke(oe,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Uy(r))return;const a=Yy(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ae(i).get(a),l=ae(r).get(a);c!==l&&t.updateProperties(r,{[a]:c})})}lf.$inject=["injector","modeling"],Ee(lf,oe);function uf(e,t){oe.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=pt(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}Ee(uf,oe),uf.$inject=["eventBus","modeling"];function pf(e,t,n){oe.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=uP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}Ee(pf,oe),pf.$inject=["eventBus","bpmnRules","modeling"];function Xo(e){return e.original||e}function uP(e,t){var n=ef(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 ff(e,t){oe.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)}ff.$inject=["eventBus","modeling"],Ee(ff,oe);function df(e,t,n,i){oe.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,g;d=n.canConnect(f,p),!(!d||d.type===u.type)&&(g=t.connect(f,p,{type:d.type,associationDirection:d.associationDirection,waypoints:u.waypoints.slice()}),u.parent&&t.removeConnection(u),l.connection=g,r&&s(u,g))}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;z(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=kt(f.outgoing,Mo({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})})}Ee(df,oe),df.$inject=["eventBus","modeling","bpmnRules","injector"];function Kc(e,t,n,i,r,o){i.invoke(oe,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=Hn(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=[];z(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})})}Ee(Kc,oe),Kc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;z(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)},Kc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var pP=1500,fP={width:140,height:120},hf={width:300,height:60},gf={width:60,height:300},Xc={width:300,height:150},Zc={width:150,height:300},qy={width:140,height:120},Ky={width:100,height:40};function Xy(e){e.on("resize.start",pP,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=yP(i,r,o)),S(i,"bpmn:SubProcess")&&st(i)&&(n.minDimensions=qy),S(i,"bpmn:TextAnnotation")&&(n.minDimensions=Ky)})}Xy.$inject=["eventBus"];var Ar=Math.abs,dP=Math.min,hP=Math.max;function Zy(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Zo(e,t,n){return Zy(e,t,n,dP)}function Qo(e,t,n){return Zy(e,t,n,hP)}var gP={top:20,left:50,right:20,bottom:20},mP={top:50,left:20,right:20,bottom:20};function yP(e,t,n){var i=pi(e),r=!0,o=!0,a=Hc(i,[i]),s=Ie(e),c={},l={},u=dn(e),f=u?hf:gf;/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(g){var h=Ie(g);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&&Ar(s.top-h.bottom)<10&&Qo(c,"top",h.top+f.height),Ar(s.top-h.top)<5&&Zo(l,"top",h.bottom-f.height)),/e/.test(t)&&(n&&Ar(s.right-h.left)<10&&Zo(c,"right",h.right-f.width),Ar(s.right-h.right)<5&&Qo(l,"right",h.left+f.width)),/s/.test(t)&&(n&&Ar(s.bottom-h.top)<10&&Zo(c,"bottom",h.bottom-f.height),Ar(s.bottom-h.bottom)<5&&Qo(l,"bottom",h.top+f.height)),/w/.test(t)&&(n&&Ar(s.left-h.right)<10&&Qo(c,"left",h.left+f.width),Ar(s.left-h.left)<5&&Zo(l,"left",h.right-f.width))});var p=i.children.filter(function(g){return!g.hidden&&!g.waypoints&&(S(g,"bpmn:FlowElement")||S(g,"bpmn:Artifact"))}),d=u?gP:mP;return p.forEach(function(g){var h=Ie(g);/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 Qy(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Jo(e){return e.originalEvent||e.srcEvent}function mf(e){Qy(e),Qy(Jo(e))}function so(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 Jy(){return/mac/i.test(navigator.platform)}function ev(e,t){return(Jo(e)||e).button===t}function Pr(e){return ev(e,0)}function vP(e){return ev(e,1)}function qa(e){var t=Jo(e)||e;return Pr(e)?Jy()?t.metaKey:t.ctrlKey:!1}function Qc(e){var t=Jo(e)||e;return Pr(e)&&t.shiftKey}var tv=1001;function nv(e,t){e.on("resize.start",tv+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",tv,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=km(a),t.resizeLane(r,a,i.balanced)),!1})}nv.$inject=["eventBus","modeling"];var bP=500;function yf(e,t,n,i,r){n.invoke(oe,this);function o(u){return tt(u,["bpmn:ReceiveTask","bpmn:SendTask"])||xP(u,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(u){var f=e.getDefinitions(),p=f.get("rootElements");return!!kt(p,Mo({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(tt(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(tt(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=ae(f),d=c(p),g;d&&!a(d)&&(g=e.getDefinitions().get("rootElements"),qt(g,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=ae(p),g=c(d);g&&(f.referencedRootElement=g)}}),t.on("copyPaste.pasteElement",bP,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)})}yf.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],Ee(yf,oe);function xP(e,t){return Ne(t)||(t=[t]),hr(t,function(n){return Vo(e,n)})}var iv=Math.max;function rv(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return z(n,function(a){var s=a.id;S(a,"bpmn:Participant")&&(o[s]=wP(a,i,r)),S(a,"bpmn:Lane")&&(o[s]=dn(a)?hf:gf),S(a,"bpmn:SubProcess")&&st(a)&&(o[s]=qy),S(a,"bpmn:TextAnnotation")&&(o[s]=Ky),S(a,"bpmn:Group")&&(o[s]=fP)}),o})}rv.$inject=["eventBus"];function _P(e){return e==="x"}function wP(e,t,n){var i=dn(e);if(!RP(e))return i?Xc:Zc;var r=_P(t),o={};return r?i?o=Xc:o={width:SP(e,n,r),height:Zc.height}:i?o={width:Xc.width,height:EP(e,n,r)}:o=Zc,o}function EP(e,t,n){var i;return i=CP(e,t,n),iv(Xc.height,i)}function SP(e,t,n){var i;return i=MP(e,t,n),iv(Zc.width,i)}function RP(e){return!!Mr(e).length}function CP(e,t,n){var i=Mr(e),r;return r=vf(i,t,n),e.height-r.height+hf.height}function MP(e,t,n){var i=Mr(e),r;return r=vf(i,t,n),e.width-r.width+gf.width}function vf(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=Mr(r),o.length?vf(o,t,n):r}var ov="_plane";function av(e){var t=e.id;return AP(t)}function Fi(e){var t=e.id;return S(e,"bpmn:SubProcess")?sv(t):t}function co(e){return sv(e)}function Jc(e){var t=pt(e);return S(t,"bpmndi:BPMNPlane")}function sv(e){return e+ov}function AP(e){return e.replace(new RegExp(ov+"$"),"")}var cv=400,PP=600,lv={x:180,y:160};function nr(e,t,n,i,r,o,a){oe.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")&&!st(f)}function l(f){var p=f.shape,d=f.newRootElement,g=ae(p);d=s._addDiagram(d||g),f.newRootElement=e.addRootElement(d)}function u(f){var p=f.shape,d=ae(p);s._removeDiagram(d);var g=f.newRootElement=a.get(Fi(d));e.removeRootElement(g)}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;z(p,function(d){if(c(d)){var g=a.get(Fi(d));if(!(!g||!d.children||!d.children.length)){var h=uv(d);s._showRecursively(h),s._moveChildrenToShape(h,g)}}})},!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")||!st(p)||z($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(Fi(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(Fi(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,g=e.findRoot(Fi(p));if(!(!d||!g)){var h=d.children;n.moveElements(h,{x:0,y:0},g)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(S(p,"bpmn:SubProcess")){var d=f.properties,g=f.oldProperties,h=g.id,y=d.id;if(h!==y){if(Jc(p)){a.updateId(p,co(y)),a.updateId(h,y);return}var M=a.get(co(h));M&&a.updateId(co(h),co(y))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(S(p,"bpmn:SubProcess")){var d=f.properties,g=f.oldProperties,h=g.id,y=d.id;if(h!==y){if(Jc(p)){a.updateId(p,co(h)),a.updateId(y,h);return}var M=a.get(co(y));M&&a.updateId(M,co(h))}}},!0),t.on("element.changed",function(f){var p=f.element;if(Jc(p)){var d=p,g=a.get(av(d));!g||g===d||t.fire("element.changed",{element:g})}}),this.executed("shape.toggleCollapse",cv,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(st(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",cv,function(f){var p=f.shape;S(p,"bpmn:SubProcess")&&(st(p)?u(f):(l(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",PP,function(f){var p=f.shape;if(S(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(st(p))s._moveChildrenToShape(d.children.slice(),p),z($a(p.children),h=>{n.moveShape(h.annotation,{x:0,y:0},p.parent),z(h.associations,y=>{n.moveConnection(y,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var g=uv(p);s._moveChildrenToShape(g,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var g=Fi(p),h=a.get(g);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,g=f.elements,h=d.parent,y=S(pt(h),"bpmndi:BPMNPlane");if(y){var M=av(h),_=kt(g,function(m){return m.id===M});_&&(p.parent=_.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}Ee(nr,oe),nr.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:lv.x-r.x,y:lv.y-r.y};else{var a=$e(t),s=$e(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},nr.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(ey(e).map(i=>i.annotation));n.size&&z($a(e.children),i=>{n.has(i.annotation)&&z(i.associations,r=>{t.removeConnection(r)})})},nr.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},nr.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},nr.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:Fi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},nr.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=kt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},nr.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function TP(e){var t=[];return z($a(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function uv(e){return e.children.slice().concat(TP(e.children)).concat(kP(e))}function kP(e){return wp(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function bf(e,t){e.invoke(oe,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"))||!st(r))){var o=OP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}bf.$inject=["injector","modeling"],Ee(bf,oe);function OP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function xf(e,t){oe.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,oi(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}}})}Ee(xf,oe),xf.$inject=["eventBus","textRenderer"];function _f(e,t){oe.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(st(i))return;var r=Oa(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();z(s,function(l){o(l,!0)}),z(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,$e(i)):t.reconnectStart(a,i,$e(i)))}},!0)}Ee(_f,oe),_f.$inject=["eventBus","modeling"];var wf=500;function Ef(e,t,n){oe.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=DP(c).concat([a]),f=vy(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"],wf,function(a){var s=a.context,c=s.shape;S(c,"bpmn:SubProcess")&&(c.collapsed?pt(c).isExpanded=!1:(i(c.children),pt(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],wf,function(a){var s=a.context,c=s.shape;c.collapsed?pt(c).isExpanded=!1:pt(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],wf,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"})})}Ee(Ef,oe),Ef.$inject=["eventBus","elementFactory","modeling"];function DP(e){return e.filter(function(t){return!t.hidden})}function Sf(e,t,n,i){t.invoke(oe,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Je(a)||(S(a,"bpmn:Participant")&&st(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)})}Ee(Sf,oe),Sf.$inject=["canvas","injector","moddle","modeling"];function Rf(e,t){oe.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;LP(r,o)&&t.updateProperties(o,{default:null})})}Ee(Rf,oe),Rf.$inject=["eventBus","modeling"];function LP(e,t){if(!S(e,"bpmn:SequenceFlow"))return!1;var n=ae(t),i=ae(e);return n.get("default")===i}var IP=500,BP=5e3,pv=["shape.create","shape.delete","shape.move","shape.resize"],fv=[...pv,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Cf(e,t){oe.call(this,e);var n;function i(){return n=n||new NP,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(fv,BP,function(){i()}),this.postExecuted(fv,IP,function(){o()}),this.preExecute(pv,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))})}Cf.$inject=["eventBus","modeling"],Ee(Cf,oe);function NP(){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 $P=500,FP=5e3,dv=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],hv=[...dv,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Mf(e,t){oe.call(this,e);var n;function i(){return n=n||new jP,n.enter(),n}function r(){if(!n)throw new Error("out of bounds release");return n}function o(){if(!n)throw new Error("out of bounds release");var a=n.leave();return a&&(t.updateCategoryValueRefs(Array.from(n.affectedFlowElements),Array.from(n.affectedGroupEntries.values())),n=null),a}this.preExecute(hv,FP,function(){i()}),this.postExecuted(hv,$P,function(){o()}),this.preExecute(dv,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"],Ee(Mf,oe);function jP(){this.affectedFlowElements=new Set,this.affectedGroupEntries=new Map,this.counter=0,this.addFlowElement=function(e){this.affectedFlowElements.add(e)},this.addGroup=function(e){this.affectedGroupEntries.has(e)||this.affectedGroupEntries.set(e,{categoryValue:e.businessObject.categoryValueRef,groupShape:e})},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function Af(e,t){oe.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)HP(o)&&!GP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}Ee(Af,oe),Af.$inject=["eventBus","modeling"];function HP(e){const t=ae(e);return t&&t.isForCompensation}function zP(e){return e&&S(e,"bpmn:BoundaryEvent")&&Vo(e,"bpmn:CompensateEventDefinition")}function GP(e){return e.incoming.filter(n=>zP(n.source)).length>0}const VP={__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",Ip],appendBehavior:["type",Bp],associationBehavior:["type",$p],attachEventBehavior:["type",Lc],artifactBehavior:["type",Np],boundaryEventBehavior:["type",Fp],categoryRootElementReferenceBehavior:["type",jp],compensateBoundaryEventBehaviour:["type",Hp],createBehavior:["type",zp],createDataObjectBehavior:["type",Gp],createParticipantBehavior:["type",Up],dataInputAssociationBehavior:["type",Yp],dataStoreBehavior:["type",qp],deleteLaneBehavior:["type",Kp],detachEventBehavior:["type",zc],dropOnFlowBehavior:["type",Zp],eventBasedGatewayBehavior:["type",Qp],fixHoverBehavior:["type",Ry],groupBehavior:["type",Jp],importDockingFix:["type",My],isHorizontalFix:["type",tf],labelBehavior:["type",rf],layoutConnectionBehavior:["type",of],messageFlowBehavior:["type",cf],nonInterruptingBehavior:["type",lf],removeElementBehavior:["type",pf],removeEmbeddedLabelBoundsBehavior:["type",uf],removeParticipantBehavior:["type",ff],replaceConnectionBehavior:["type",df],replaceElementBehaviour:["type",Kc],resizeBehavior:["type",Xy],resizeLaneBehavior:["type",nv],rootElementReferenceBehavior:["type",yf],spaceToolBehavior:["type",rv],subProcessPlaneBehavior:["type",nr],subProcessStartEventBehavior:["type",bf],textAnnotationBehavior:["type",xf],toggleCollapseConnectionBehaviour:["type",_f],toggleElementCollapseBehaviour:["type",Ef],unclaimIdBehavior:["type",Sf],unsetDefaultFlowBehavior:["type",Rf],updateFlowNodeRefsBehavior:["type",Cf],updateCategoryValueRefsBehavior:["type",Mf],setCompensationActivityAfterPasteBehavior:["type",Af]};function Pf(e){this._commandStack=e.get("commandStack",!1)}Pf.$inject=["injector"],Pf.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const ji={__init__:["rules"],rules:["type",Pf]};function fi(e){oe.call(this,e),this.init()}fi.$inject=["eventBus"],Ee(fi,oe),fi.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)})},fi.prototype.init=function(){};function gv(e,t){var n=_n(e,t,-15);return n!=="intersect"?n:null}function En(e){fi.call(this,e)}Ee(En,fi),En.$inject=["eventBus"],En.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return WP(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 tl(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return tl(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 Av(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return Mt(i)&&!nl(t,i)?!1:Zr(t,function(r){return Mt(r)?tl(r.source,r.target,r):r.host?Ka(r,r.host,null,n):Df(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 wv(a)&&!n.includes(a.host)})?!1:Ka(n,t,null,i)||Cv(n,t,i)||Mv(n,t)||nl(n,t)}),this.addRule("shape.create",function(e){return Df(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 Dv(n,t)})},En.prototype.canConnectMessageFlow=kv,En.prototype.canConnectSequenceFlow=Ov,En.prototype.canConnectDataAssociation=Lf,En.prototype.canConnectAssociation=Pv,En.prototype.canConnectCompensationAssociation=Tv,En.prototype.canMove=Mv,En.prototype.canAttach=Ka,En.prototype.canReplace=Cv,En.prototype.canDrop=ea,En.prototype.canInsert=nl,En.prototype.canCreate=Df,En.prototype.canConnect=tl,En.prototype.canResize=Av,En.prototype.canCopy=Dv;function WP(e){return Tf(e)?null:tt(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Tf(e){return!e||Je(e)}function mv(e){do{if(S(e,"bpmn:Process"))return ae(e);if(S(e,"bpmn:Participant"))return ae(e).processRef||ae(e)}while(e=e.parent)}function kf(e){return S(e,"bpmn:TextAnnotation")}function Of(e){return S(e,"bpmn:Group")&&!e.labelTarget}function yv(e){return S(e,"bpmn:BoundaryEvent")&&Hi(e,"bpmn:CompensateEventDefinition")}function el(e){return ae(e).isForCompensation}function UP(e,t){var n=mv(e),i=mv(t);return n===i}function YP(e){return S(e,"bpmn:InteractionNode")&&!S(e,"bpmn:BoundaryEvent")&&(!S(e,"bpmn:Event")||S(e,"bpmn:ThrowEvent")&&xv(e,"bpmn:MessageEventDefinition"))}function qP(e){return S(e,"bpmn:InteractionNode")&&!el(e)&&(!S(e,"bpmn:Event")||S(e,"bpmn:CatchEvent")&&xv(e,"bpmn:MessageEventDefinition"))&&!(S(e,"bpmn:BoundaryEvent")&&!Hi(e,"bpmn:MessageEventDefinition"))}function vv(e){for(var t=e;t=t.parent;){if(S(t,"bpmn:FlowElementsContainer"))return ae(t);if(S(t,"bpmn:Participant"))return ae(t).processRef}return null}function bv(e,t){var n=vv(e),i=vv(t);return n===i}function Hi(e,t){var n=ae(e);return!!kt(n.eventDefinitions||[],function(i){return S(i,t)})}function xv(e,t){var n=ae(e);return(n.eventDefinitions||[]).every(function(i){return S(i,t)})}function KP(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:EndEvent")&&!Tn(e)&&!(S(e,"bpmn:IntermediateThrowEvent")&&Hi(e,"bpmn:LinkEventDefinition"))&&!yv(e)&&!el(e)}function XP(e){return S(e,"bpmn:FlowNode")&&!S(e,"bpmn:StartEvent")&&!S(e,"bpmn:BoundaryEvent")&&!Tn(e)&&!(S(e,"bpmn:IntermediateCatchEvent")&&Hi(e,"bpmn:LinkEventDefinition"))&&!el(e)}function ZP(e){return S(e,"bpmn:ReceiveTask")||S(e,"bpmn:IntermediateCatchEvent")&&(Hi(e,"bpmn:MessageEventDefinition")||Hi(e,"bpmn:TimerEventDefinition")||Hi(e,"bpmn:ConditionalEventDefinition")||Hi(e,"bpmn:SignalEventDefinition"))}function QP(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function _v(e,t){var n=QP(t);return n.indexOf(e)!==-1}function tl(e,t,n){if(Tf(e)||Tf(t))return null;if(!S(n,"bpmn:DataAssociation")){if(kv(e,t))return{type:"bpmn:MessageFlow"};if(Ov(e,t))return{type:"bpmn:SequenceFlow"}}var i=Lf(e,t);return i||(Tv(e,t)?{type:"bpmn:Association",associationDirection:"One"}:Pv(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function ea(e,t){return Je(e)||Of(e)?!0:S(t,"bpmn:Participant")&&!st(t)?!1:S(e,"bpmn:Participant")?S(t,"bpmn:Process")||S(t,"bpmn:Collaboration"):tt(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")&&!JP(e)?!1:S(e,"bpmn:FlowElement")&&!S(e,"bpmn:DataStoreReference")?S(t,"bpmn:FlowElementsContainer")?st(t):tt(t,["bpmn:Participant","bpmn:Lane"]):S(e,"bpmn:DataStoreReference")&&S(t,"bpmn:Collaboration")?hr(ae(t).get("participants"),function(n){return!!n.get("processRef")}):tt(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?tt(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 JP(e){return ae(e).cancelActivity&&(Ev(e)||Sv(e))}function wv(e){return!Je(e)&&S(e,"bpmn:BoundaryEvent")}function eT(e){return S(e,"bpmn:Lane")}function tT(e){return wv(e)||S(e,"bpmn:IntermediateThrowEvent")&&Ev(e)?!0:S(e,"bpmn:IntermediateCatchEvent")&&Sv(e)}function Ev(e){var t=ae(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Sv(e){return Rv(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Rv(e,t){return t.some(function(n){return Hi(e,n)})}function nT(e){return S(e,"bpmn:ReceiveTask")&&kt(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 Je(r)||!tT(r)||Tn(t)||!S(t,"bpmn:Activity")||el(t)||i&&!gv(i,t)||nT(t)?!1:"attach"}function Cv(e,t,n){if(!t)return!1;var i={replacements:[]};return z(e,function(r){Tn(t)||S(r,"bpmn:StartEvent")&&r.type!=="label"&&ea(r,t)&&(pM(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(fM(r)||dM(r)||hM(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),Rv(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")||Hi(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")&&Ka(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function Mv(e,t){return hr(e,eT)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return ea(n,t)})}function Df(e,t,n,i){return t?Je(e)||Of(e)?!0:ea(e,t)||nl(e,t):!1}function Av(e,t,n){return S(e,"bpmn:SubProcess")?st(e)&&(!t||t.width>=100&&t.height>=80):S(e,"bpmn:Lane")||S(e,"bpmn:Participant")?!0:kf(e)?n?n==="e"||n==="w":!0:Of(e)?!0:Je(e)?n?n==="e"||n==="w":!0:!1}function iT(e,t){var n=kf(e),i=kf(t);return(n||i)&&n!==i}function Pv(e,t){return _v(t,e)||_v(e,t)?!1:iT(e,t)?!0:!!Lf(e,t)}function Tv(e,t){return bv(e,t)&&yv(e)&&S(t,"bpmn:Activity")&&!oT(t,e)&&!Tn(t)}function kv(e,t){return Iv(e)&&!Iv(t)?!1:YP(e)&&qP(t)&&!UP(e,t)}function Ov(e,t){return KP(e)&&XP(t)&&bv(e,t)&&!(S(e,"bpmn:EventBasedGateway")&&!ZP(t))}function Lf(e,t){return tt(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&tt(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function nl(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:tt(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Je(t)&&S(e,"bpmn:FlowNode")&&!S(e,"bpmn:BoundaryEvent")&&ea(e,t.parent)}function If(e,t){return e&&t&&e.indexOf(t)!==-1}function Dv(e,t){return Je(t)?!0:!(S(t,"bpmn:Lane")&&!If(e,t.parent)||S(t,"bpmn:MessageFlow")&&!rT(e,t))}function rT(e,t){var n=Lv(t.source),i=Lv(t.target);return If(e,n)&&If(e,i)}function Lv(e){for(;e;e=e.parent)if(S(e,"bpmn:Participant"))return e;return null}function Iv(e){return Yo(e,"bpmn:Process")||Yo(e,"bpmn:Collaboration")}function oT(e,t){return e.attachers.includes(t)}const aT={__depends__:[ji],__init__:["bpmnRules"],bpmnRules:["type",En]};var sT=2e3;function Bv(e,t){e.on("saveXML.start",sT,n);function n(){var i=t.getRootElements();z(i,function(r){var o=pt(r),a,s;a=Oa([r]),a=nt(a,function(c){return c!==r&&!c.labelTarget}),s=Cn(a,pt),o.set("planeElement",s)})}}Bv.$inject=["eventBus","canvas"];const cT={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Bv]};function il(e){oe.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)})}il.prototype.getOrdering=function(e,t){return null},Ee(il,oe);function Bf(e,t){il.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=kt(n,function(c){return tt(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&&!tt(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=wh(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}}}Bf.$inject=["eventBus","canvas"],Ee(Bf,il);const lT={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Bf]};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 uT={clipboard:["type",Xa]};var Nv=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",Nv,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Nv,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=so(a),c=document.elementFromPoint(s.x,s.y),pT(c)}}$v.$inject=["elementRegistry","eventBus","injector"];function pT(e){return to(e,"svg, .djs-element",!0)}const fT={__init__:["hoverFix"],hoverFix:["type",$v]};function dT(e){return!0}function rl(e){return Pr(e)||vP(e)}var Fv=500;function jv(e,t,n){var i=this;function r(T,N,k){if(!s(T,N)){var D,H,Q;k?H=t.getGraphics(k):(D=N.delegateTarget||N.target,D&&(H=D,k=t.get(H))),!(!H||!k)&&(Q=e.fire(T,{element:k,gfx:H,originalEvent:N}),Q===!1&&(N.stopPropagation(),N.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,N){var k=l[T]||Pr;return!k(N)}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":dT,"element.mousedown":rl,"element.mouseup":rl,"element.click":rl,"element.dblclick":rl};function u(T,N,k){var D=c[T];if(!D)throw new Error("unmapped DOM event name <"+T+">");return r(D,N,k)}var f="svg, .djs-element";function p(T,N,k,D){var H=o[k]=function(Q){r(k,Q)};D&&(l[k]=D),H.$delegate=Gn.bind(T,f,N,H)}function d(T,N,k){var D=a(k);D&&Gn.unbind(T,N,D.$delegate)}function g(T){z(c,function(N,k){p(T,k,N)})}function h(T){z(c,function(N,k){d(T,k,N)})}e.on("canvas.destroy",function(T){h(T.svg)}),e.on("canvas.init",function(T){g(T.svg)}),e.on(["shape.added","connection.added"],function(T){var N=T.element,k=T.gfx;e.fire("interactionEvents.createHit",{element:N,gfx:k})}),e.on(["shape.changed","connection.changed"],Fv,function(T){var N=T.element,k=T.gfx;e.fire("interactionEvents.updateHit",{element:N,gfx:k})}),e.on("interactionEvents.createHit",Fv,function(T){var N=T.element,k=T.gfx;i.createDefaultHit(N,k)}),e.on("interactionEvents.updateHit",function(T){var N=T.element,k=T.gfx;i.updateDefaultHit(N,k)});var y=w("djs-hit djs-hit-stroke"),M=w("djs-hit djs-hit-click-stroke"),_=w("djs-hit djs-hit-all"),m=w("djs-hit djs-hit-no-move"),v={all:_,"click-stroke":M,stroke:y,"no-move":m};function w(T,N){return N=W({stroke:"white",strokeWidth:15},N||{}),n.cls(T,["no-fill","no-border"],N)}function R(T,N){var k=v[N];if(!k)throw new Error("invalid hit type <"+N+">");return Se(T,k),T}function P(T,N){Ue(T,N)}this.removeHits=function(T){var N=gc(".djs-hit",T);z(N,an)},this.createDefaultHit=function(T,N){var k=T.waypoints,D=T.isFrame,H;return k?this.createWaypointsHit(N,k):(H=D?"stroke":"all",this.createBoxHit(N,H,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,N){var k=ka(N);return R(k,"stroke"),P(T,k),k},this.createBoxHit=function(T,N,k){k=W({x:0,y:0},k);var D=De("rect");return R(D,N),Se(D,k),P(T,D),D},this.updateDefaultHit=function(T,N){var k=Rt(".djs-hit",N);if(k)return T.waypoints?_p(k,T.waypoints):Se(k,{width:T.width,height:T.height}),k},this.fire=r,this.triggerMouseEvent=u,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}jv.$inject=["eventBus","elementRegistry","styles"];const ol={__init__:["interactionEvents"],interactionEvents:["type",jv]};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();Ne(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?z(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Hv="hover",zv="selected";function Gv(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,Hv)}),t.on("element.out",function(r){i(r.element,Hv)}),t.on("selection.changed",function(r){function o(l){i(l,zv)}function a(l){n(l,zv)}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)})}Gv.$inject=["canvas","eventBus"];function Vv(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;Ne(l)?t.select(l):t.select(s.filter(hT))}}),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=kt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(Pr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=Qc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Vv.$inject=["eventBus","selection","canvas","elementRegistry"];function hT(e){return!e.hidden}const di={__init__:["selectionVisuals","selectionBehavior"],__depends__:[ol],selection:["type",ta],selectionVisuals:["type",Gv],selectionBehavior:["type",Vv]};var gT=/^djs-cursor-.*$/;function al(e){var t=$t(document.body);t.removeMatching(gT),e&&t.add("djs-cursor-"+e)}function Wv(){al(null)}var mT=5e3;function Uv(e,t){t=t||"element.click";function n(){return!1}return e.once(t,mT,n),function(){e.off(t,n)}}var yT=["c","C"],vT=["v","V"],bT=["d","D"],xT=["x","X"],_T=["y","Y"],Yv=["z","Z"];function wT(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Un(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function sn(e,t){return e=Ne(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Nf(e){return e.shiftKey}function ET(e){return Un(e)&&sn(yT,e)}function ST(e){return Un(e)&&sn(vT,e)}function RT(e){return Un(e)&&sn(bT,e)}function CT(e){return Un(e)&&sn(xT,e)}function MT(e){return Un(e)&&!Nf(e)&&sn(Yv,e)}function AT(e){return Un(e)&&(sn(_T,e)||sn(Yv,e)&&Nf(e))}var na=Math.round,qv="djs-drag-active";function lo(e){e.preventDefault()}function PT(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function TT(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Kv(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(m){var v=t.viewbox(),w=t._container.getBoundingClientRect();return{x:v.x+(m.x-w.left)/v.scale,y:v.y+(m.y-w.top)/v.scale}}function s(m,v){v=v||o;var w=e.createEvent(W({},v.payload,v.data,{isTouch:v.isTouch}));return e.fire("drag."+m,w)===!1?!1:e.fire(v.prefix+"."+m,w)}function c(m){var v=m.filter(function(w){return i.get(w.id)});v.length&&n.select(v)}function l(m,v){var w=o.payload,R=o.displacement,P=o.globalStart,T=so(m),N=Ci(T,P),k=o.localStart,D=a(T),H=Ci(D,k);if(!o.active&&(v||TT(N)>o.threshold)){if(W(w,{x:na(k.x+R.x),y:na(k.y+R.y),dx:0,dy:0},{originalEvent:m}),s("start")===!1)return y();o.active=!0,o.keepSelection||(w.previousSelection=n.get(),n.select(null)),o.cursor&&al(o.cursor),t.addMarker(t.getRootElement(),qv)}mf(m),o.active&&(W(w,{x:na(D.x+R.x),y:na(D.y+R.y),dx:na(H.x),dy:na(H.y)},{originalEvent:m}),s("move"))}function u(m){var v,w=!0;o.active&&(m&&(o.payload.originalEvent=m,mf(m)),w=s("end")),w===!1&&s("rejected"),v=M(w!==!0),s("ended",v)}function f(m){sn("Escape",m)&&(lo(m),y())}function p(m){var v;o.active&&(v=Uv(e),setTimeout(v,400),lo(m)),u(m)}function d(m){l(m)}function g(m){var v=o.payload;v.hoverGfx=m.gfx,v.hover=m.element,s("hover")}function h(m){s("out");var v=o.payload;v.hoverGfx=null,v.hover=null}function y(m){var v;if(o){var w=o.active;w&&s("cancel"),v=M(m),w&&s("canceled",v)}}function M(m){var v,w;s("cleanup"),Wv(),o.trapClick?w=p:w=u,Ge.unbind(document,"mousemove",l),Ge.unbind(document,"dragstart",lo),Ge.unbind(document,"selectstart",lo),Ge.unbind(document,"mousedown",w,!0),Ge.unbind(document,"mouseup",w,!0),Ge.unbind(document,"keyup",f),Ge.unbind(document,"touchstart",d,!0),Ge.unbind(document,"touchcancel",y,!0),Ge.unbind(document,"touchmove",l,!0),Ge.unbind(document,"touchend",u,!0),e.off("element.hover",g),e.off("element.out",h),t.removeMarker(t.getRootElement(),qv);var R=o.payload.previousSelection;return m!==!1&&R&&!n.get().length&&c(R),v=o,o=null,v}function _(m,v,w,R){o&&y(!1),typeof v=="string"&&(R=w,w=v,v=null),R=W({},r,R||{});var P=R.data||{},T,N,k,D,H;if(R.trapClick?D=p:D=u,m?(T=Jo(m)||m,N=so(m),mf(m),T.type==="dragstart"&&lo(T)):(T=null,N={x:0,y:0}),k=a(N),v||(v=k),H=PT(T),o=W({prefix:w,data:P,payload:{},globalStart:N,displacement:Ci(v,k),localStart:k,isTouch:H},R),R.manual||(H?(Ge.bind(document,"touchstart",d,!0),Ge.bind(document,"touchcancel",y,!0),Ge.bind(document,"touchmove",l,!0),Ge.bind(document,"touchend",u,!0)):(Ge.bind(document,"mousemove",l),Ge.bind(document,"dragstart",lo),Ge.bind(document,"selectstart",lo),Ge.bind(document,"mousedown",D,!0),Ge.bind(document,"mouseup",D,!0)),Ge.bind(document,"keyup",f),e.on("element.hover",g),e.on("element.out",h)),s("init")===!1)return y(),!1;R.autoActivate&&l(m,!0)}e.on("diagram.destroy",y),this.init=_,this.move=l,this.hover=g,this.out=h,this.end=u,this.cancel=y,this.context=function(){return o},this.setOptions=function(m){W(r,m)}}Kv.$inject=["eventBus","canvas","selection","elementRegistry"];const ir={__depends__:[fT,di],dragging:["type",Kv]};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 kT=new ia("ps");var OT=["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=cm(n);return this._cloneMarkers(ro(r),i),Se(r,this._styles.cls(i,[])),Ue(t,r),Se(r,"data-preview-support-element-id",e.id),r},Tr.prototype.addFrame=function(e,t){var n=De("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Ue(t,n),Se(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)}),NT(e)&&OT.forEach(function(r){if(Se(e,r)){var o=LT(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,kT.next()].join("-"),a=Rt("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||cm(n);s.id=o,ut(s).add(r);var c=Rt(":scope > defs",e);c||(c=De("defs"),Ue(e,c)),Ue(c,s);var l=BT(s.id);Se(t,i,l)};function LT(e,t,n){var i=IT(Se(e,t));return Rt("marker#"+i,n||document)}function IT(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function BT(e){return"url(#"+e+")"}function NT(e){return DT.indexOf(e.nodeName)!==-1}const ra={__init__:["previewSupport"],previewSupport:["type",Tr]};var $T="drop-ok",Xv="drop-not-ok",Zv="attach-ok",Qv="new-parent",Jv="create",FT=2e3;function eb(e,t,n,i,r){function o(c,l,u,f,p){if(!l)return!1;c=nt(c,function(_){var m=_.labelTarget;return!_.parent&&!(Je(_)&&c.indexOf(m)!==-1)});var d=kt(c,function(_){return!Mt(_)}),g=!1,h=!1,y=!1;nb(c)&&(g=r.allowed("shape.attach",{position:u,shape:d,target:l})),g||(nb(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 M=p.connectionTarget;return y||g?(d&&f&&(h=r.allowed("connection.create",{source:M===f?d:f,target:M===f?f:d,hints:{targetParent:l,targetAttach:g}})),{attach:g,connect:h}):y===null||g===null?null:!1}function a(c,l){[Zv,$T,Xv,Qv].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}tb(c);var g={x:c.x,y:c.y},h=l.canExecute=f&&o(u,f,g,p,d);f&&h!==null&&(l.target=f,h&&h.attach?a(f,Zv):a(f,h?Qv:Xv))}),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,g=l.canExecute,h=g&&g.attach,y=g&&g.connect,M=l.hints||{};if(g===!1||!d)return!1;tb(c);var _={x:c.x,y:c.y};y?f=i.appendShape(u,f,_,d,{attach:h,connection:y===!0?{}:y,connectionTarget:M.connectionTarget}):(p=i.createElements(p,_,d,W({},M,{attach:h})),f=kt(p,function(m){return!Mt(m)})),W(l,{elements:p,shape:f}),W(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===Jv&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],FT,function(){n.off("elements.changed",s)})}),this.start=function(c,l,u){Ne(l)||(l=[l]);var f=kt(l,function(g){return!Mt(g)});if(f){u=W({elements:l,hints:{},shape:f},u||{}),z(l,function(g){ze(g.x)||(g.x=0),ze(g.y)||(g.y=0)});var p=nt(l,function(g){return!g.hidden}),d=Zt(p);z(l,function(g){Mt(g)&&(g.waypoints=Cn(g.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),W(g,{x:g.x-d.x-d.width/2,y:g.y-d.y-d.height/2})}),t.init(c,Jv,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:l,context:u}})}}}eb.$inject=["canvas","dragging","eventBus","modeling","rules"];function tb(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 nb(e){return e&&e.length===1&&!Mt(e[0])}var jT=750;function ib(e,t,n,i,r){function o(a){var s=De("g");Se(s,r.cls("djs-drag-group",["no-events"]));var c=De("g");return a.forEach(function(l){var u;l.hidden||(l.waypoints?(u=n._createContainer("connection",c),n.drawConnection(ro(u),l)):(u=n._createContainer("shape",c),n.drawShape(ro(u),l),wn(u,l.x,l.y)),i.addDragger(l,s,u))}),s}t.on("create.move",jT,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(),Ue(f,u)),wn(u,a.x,a.y)):an(u)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&an(c)})}ib.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const sl={__depends__:[ir,ra,ji,di],__init__:["create","createPreview"],create:["type",eb],createPreview:["type",ib]};function $f(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)})}$f.$inject=["eventBus"],$f.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||HT(0,0)};function HT(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",$f]};var rb=2e3;function Yn(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),zT(u)&&(l.priority=2,l.host=u.host.id),Mt(u)&&(l.priority=3,l.source=u.source.id,l.target=u.target.id,l.waypoints=GT(u)),Je(u)&&(l.priority=4,l.labelTarget=u.labelTarget.id),z(["x","y","width","height"],function(p){ze(u[p])&&(l[p]=u[p])}),l.hidden=u.hidden,l.collapsed=u.collapsed}),r.on("copyPaste.elementsCopied",rb,function(c){var l;((l=c.hints)==null?void 0:l.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",rb,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var l=c.hints;W(l,{createElementsBehavior:!1})})}Yn.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Yn.prototype.copy=function(e,t={}){var n,i;return Ne(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Ne(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Yn.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})}}},Yn.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Yn.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},Yn.prototype._getElementIdsFromTree=function(e){var t={};return z(e,function(n){z(n,function(i){i.id&&(t[i.id]=!0)})}),t},Yn.prototype._paste=function(e,t,n,i){z(e,function(o){ze(o.x)||(o.x=0),ze(o.y)||(o.y=0)});var r=Zt(e);return z(e,function(o){Mt(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))},Yn.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return z(e,function(o,a){o=Pi(o,"priority"),z(o,function(s){var c=W({},Ti(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var l;if(Mt(c)){c.source=i[s.source],c.target=i[s.target],l=i[s.id]=t.createConnection(c),r.push(l);return}if(Je(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},Yn.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(Ti(e,["id"]));return t},Yn.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(Ti(e,["id"]));return t},Yn.prototype.createShape=function(e){var t=this._elementFactory.createShape(Ti(e,["id"]));return t},Yn.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(Mt(e)&&(!n.has(e.source)||!n.has(e.target))||Je(e)&&!n.has(e.labelTarget))},Yn.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=bc(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 g={element:f,depth:p};r.push(g),o.set(f,g);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}io(a,function(f,p,d){if(Je(f))return;z(f.labels,function(y){c(y,d)});function g(y){y&&y.length&&z(y,function(M){z(M.labels,function(_){c(_,d)}),c(M,d)})}z([f.attachers,f.incoming,f.outgoing],g),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}),z(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,u)){ab(f.element,e),u.delete(f.element);return}if(!s(f.element,e)){ab(f.element,e),u.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function zT(e){return!!e.host}function GT(e){return Cn(e.waypoints,function(t){return t=ob(t),t.original&&(t.original=ob(t.original)),t})}function ob(e){return W({},e)}function ab(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const VT={__depends__:[uT,sl,Za,ji],__init__:["copyPaste"],copyPaste:["type",Yn]};function Ff(e,t,n){Ne(n)||(n=[n]),z(n,function(i){Xr(e[i])||(t[i]=e[i])})}var jf=750;function sb(e,t,n){function i(c,l){var u=e.create(c.$type);return n.copyElement(c,u,null,l)}t.on("copyPaste.copyElement",jf,function(c){var l=c.descriptor,u=c.element,f=ae(u);if(Je(u))return l;var p=l.businessObject=i(f,!0),d=l.di=i(pt(u),!0);d.bpmnElement=p,Ff(p,l,"name"),Ff(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=ae(c);return c.default&&(u[c.default]={element:f,property:"default"}),c.host&&(ae(c).attachedToRef=ae(l[c.host])),Ti(u,Hn(u,function(p,d,g){var h=d.element,y=d.property;return g===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(Je(u)){u.businessObject=ae(l[u.labelTarget]),u.di=pt(l[u.labelTarget]);return}f=u.businessObject=i(f),p=u.di=i(p),p.bpmnElement=f,Ff(u,f,["isExpanded","name"]),u.type=f.$type}),t.on("copyPaste.copyElement",jf,function(c){var l=c.descriptor,u=c.element;if(S(u,"bpmn:Participant")){var f=ae(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")&&z($a(u),f=>{u.push(f.annotation)})}),t.on("copyPaste.pasteElement",jf,function(c){var l=c.cache,u=c.descriptor;a(l,s(u,l,o(l)))})}sb.$inject=["bpmnFactory","eventBus","moddleCopy"];const WT=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],UT=["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 Pi(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=pn(r)&&r.$descriptor;if(a&&UT.includes(a))return o;if(a&&WT.includes(a)||a&&s&&!kt(s.properties,Mo({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&&!Ne(n)&&(n=[n]),n=n||Hf(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Ne(r)&&(n=r),z(n,o=>{let a;jn(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 pn(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):Ne(e)?Hn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):pn(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 Hf(e,t){return Hn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const cb={__depends__:[VT],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",sb],moddleCopy:["type",Qa]};var lb=Math.round;function zf(e,t){this._modeling=e,this._eventBus=t}zf.$inject=["modeling","eventBus"],zf.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=lb(s+o/2),u=lb(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 ub(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}ub.$inject=["selection","eventBus"];const YT={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",ub],replace:["type",zf]};function qT(e,t,n){Ne(n)||(n=[n]),z(n,function(i){Xr(e[i])||(t[i]=e[i])})}var KT=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function XT(e,t){var n=e&&jn(e,"collapsed")?e.collapsed:!st(e),i;return t&&(jn(t,"collapsed")||jn(t,"isExpanded"))?i=jn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function pb(e,t,n,i,r,o){function a(s,c,l){l=l||{};var u=c.type,f=s.businessObject;if(cl(f)&&(u==="bpmn:SubProcess"||u==="bpmn:AdHocSubProcess")&&XT(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),qT(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var g=Hf(f.$descriptor),h=Hf(p.$descriptor,!0),y=ZT(g,h);W(p,Si(c,KT));var M=nt(y,function(v){return v==="eventDefinitions"?fb(s,c.eventDefinitionType):v==="loopCharacteristics"?!Tn(p):jn(p,v)||v==="processRef"&&c.isExpanded===!1||v==="triggeredByEvent"?!1:v==="isForCompensation"?!Tn(p):!0});if(p=n.copyElement(f,p,M),c.eventDefinitionType&&(fb(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),S(f,"bpmn:Activity")){if(cl(f))d.isExpanded=st(s);else if(c&&jn(c,"isExpanded")){d.isExpanded=c.isExpanded;var _=t.getDefaultSize(p,{isExpanded:d.isExpanded});d.width=_.width,d.height=_.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}st(s)&&!S(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(cl(f)&&!cl(p)&&(l.moveChildren=!1),S(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):l.moveChildren=!1;var m=dn(s);pt(s).isHorizontal||(pt(d).isHorizontal=m),d.width=m?s.width:t.getDefaultSize(d).width,d.height=m?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,tt(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&tt(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}pb.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function cl(e){return S(e,"bpmn:SubProcess")}function fb(e,t){var n=ae(e);return t&&n.get("eventDefinitions").some(function(i){return S(i,t)})}function ZT(e,t){return e.filter(function(n){return t.includes(n)})}const db={__depends__:[cb,YT,di],bpmnReplace:["type",pb]};var QT=250;function uo(e){this._eventBus=e,this._tools=[],this._active=null}uo.$inject=["eventBus"],uo.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)},uo.prototype.isActive=function(e){return e&&this._active===e},uo.prototype.length=function(e){return this._tools.length},uo.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},uo.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),z(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,QT,function(r){this._active&&(JT(r)||this.setActive(null))},this)};function JT(e){var t=e.originalEvent&&e.originalEvent.target;return t&&to(t,'.group[data-group="tools"]')}const ll={__depends__:[ir],__init__:["toolManager"],toolManager:["type",uo]};function e2(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 t2(e,t){var n=[],i=new Set(e);z(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;z(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 n2(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 Gf=Math.abs,i2=Math.round,rr={x:"width",y:"height"},hb="crosshair",kr={n:"top",w:"left",s:"bottom",e:"right"},r2=1500,ul={n:"s",w:"e",s:"n",e:"w"},pl=20;function hi(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",r2,function(c){var l=c.context,u=l.initialized;u||(u=l.initialized=s.init(c,l)),u&&mb(c)}),n.on("spaceTool.end",function(c){var l=c.context,u=l.axis,f=l.direction,p=l.movingShapes,d=l.resizingShapes,g=l.start;if(l.initialized){mb(c);var h={x:0,y:0};h[u]=i2(c["d"+u]),s.makeSpace(p,d,h,f,g),n.once("spaceTool.ended",function(y){s.activateSelection(y.originalEvent,!0,!0)})}})}hi.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],hi.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:hb,data:{context:{reactivate:n}},trapClick:!1})},hi.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:hb,data:{context:{}}})},hi.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},hi.prototype.init=function(e,t){var n=Gf(e.dx)>Gf(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Gf(i)<5)return!1;i<0&&(i*=-1),qa(e)&&(i*=-1);var o=e2(n,i),a=this._canvas.getRootElement();!Qc(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=o2(c,n,o,r,l);return W(t,c,{axis:n,direction:o,spaceToolConstraints:u,start:r}),al("resize-"+(n==="x"?"ew":"ns")),!0},hi.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 g=d.label;g&&!s.has(g)&&(s.add(g),o.push(g))}function p(d){c.has(d)||(c.add(d),a.push(d))}return z(e,function(d){if(!(!d.parent||Je(d))){if(Mt(d)){u.push(d);return}var g=d[t],h=g+d[rr[t]];if(a2(d)&&(n>0&&$e(d)[t]>i||n<0&&$e(d)[t]<i)){l.push(d);return}if(n>0&&g>i||n<0&&h<i){f(d);return}if(g<i&&h>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),z(o,function(d){var g=d.attachers;g&&z(g,function(h){f(h)})}),z(l,function(d){var g=d.host;(s.has(g)||c.has(g))&&f(d)}),z(u,function(d){var g=d.source,h=d.target,y=d.label;(s.has(g)||c.has(g))&&(s.has(h)||c.has(h))&&y&&f(y)}),{movingShapes:o,resizingShapes:a}},hi.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},hi.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function gb(e){return{top:e.top-pl,right:e.right+pl,bottom:e.bottom+pl,left:e.left-pl}}function mb(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;ze(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),ze(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),ze(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),ze(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function o2(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 z(a,function(p){var d=p.attachers,g=p.children,h=Ie(p),y=nt(g,function(H){return!Mt(H)&&!Je(H)&&!u.has(H)&&!f.has(H)}),M=nt(g,function(H){return!Mt(H)&&!Je(H)&&u.has(H)}),_,m,v,w=[],R=[],P,T,N,k;y.length&&(m=gb(Ie(Zt(y))),_=i-h[kr[n]]+m[kr[n]],n==="n"?s.bottom=l=ze(l)?Math.min(l,_):_:n==="w"?s.right=l=ze(l)?Math.min(l,_):_:n==="s"?s.top=c=ze(c)?Math.max(c,_):_:n==="e"&&(s.left=c=ze(c)?Math.max(c,_):_)),M.length&&(v=gb(Ie(Zt(M))),_=i-v[kr[ul[n]]]+h[kr[ul[n]]],n==="n"?s.bottom=l=ze(l)?Math.min(l,_):_:n==="w"?s.right=l=ze(l)?Math.min(l,_):_:n==="s"?s.top=c=ze(c)?Math.max(c,_):_:n==="e"&&(s.left=c=ze(c)?Math.max(c,_):_)),d&&d.length&&(d.forEach(function(H){u.has(H)?w.push(H):R.push(H)}),w.length&&(P=Ie(Zt(w.map($e))),T=h[kr[ul[n]]]-(P[kr[ul[n]]]-i)),R.length&&(N=Ie(Zt(R.map($e))),k=N[kr[n]]-(h[kr[n]]-i)),n==="n"?(_=Math.min(T||1/0,k||1/0),s.bottom=l=ze(l)?Math.min(l,_):_):n==="w"?(_=Math.min(T||1/0,k||1/0),s.right=l=ze(l)?Math.min(l,_):_):n==="s"?(_=Math.max(T||-1/0,k||-1/0),s.top=c=ze(c)?Math.max(c,_):_):n==="e"&&(_=Math.max(T||-1/0,k||-1/0),s.left=c=ze(c)?Math.max(c,_):_));var D=r&&r[p.id];D&&(n==="n"?(_=i+p[rr[t]]-D[rr[t]],s.bottom=l=ze(l)?Math.min(l,_):_):n==="w"?(_=i+p[rr[t]]-D[rr[t]],s.right=l=ze(l)?Math.min(l,_):_):n==="s"?(_=i-p[rr[t]]+D[rr[t]],s.top=c=ze(c)?Math.max(c,_):_):n==="e"&&(_=i-p[rr[t]]+D[rr[t]],s.left=c=ze(c)?Math.max(c,_):_))}),s}}function a2(e){return!!e.host}var Vf="djs-dragging",yb="djs-resizing",s2=250,fl=Math.max;function vb(e,t,n,i,r){function o(a,s){z(a,function(c){r.addDragger(c,s),n.addMarker(c,Vf)})}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=De("g");Se(u,i.cls("djs-crosshair-group",["no-events"])),Ue(s,u);var f=De("path");Se(f,"d",l.x),ut(f).add("djs-crosshair"),Ue(u,f);var p=De("path");Se(p,"d",l.y),ut(p).add("djs-crosshair"),Ue(u,p),c.crosshairGroup=u}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;wn(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",s2,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=De("path"),Se(c,"d","M0,0 L0,0"),ut(c).add("djs-crosshair"),Ue(p,c),s.line=c;var d=De("g");Se(d,i.cls("djs-drag-group",["no-events"])),Ue(n.getActiveLayer(),d),o(u,d);var g=new Set(u);z(f,function(R){g.add(R)});var h=new Set,y=s.movingConnections=[];g.forEach(function(R){z(R.outgoing,function(P){h.has(P)||!Mt(P)||!g.has(P.target)||(h.add(P),y.push(P))})}),o(y,d),s.dragGroup=d}if(!s.frameGroup){var M=De("g");Se(M,i.cls("djs-frame-group",["no-events"])),Ue(n.getActiveLayer(),M);var _=[];z(f,function(R){var P=r.addFrame(R,M),T=P.getBBox();_.push({element:P,initialBounds:T}),n.addMarker(R,yb)}),s.frameGroup=M,s.frames=_}var m={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};Se(c,{d:m[l]});var v={x:"y",y:"x"},w={x:a.dx,y:a.dy};w[v[s.axis]]=0,wn(s.dragGroup,w.x,w.y),z(s.frames,function(R){var P=R.element,T=R.initialBounds,N,k;s.direction==="e"?Se(P,{width:fl(T.width+w.x,5)}):(N=fl(T.width-w.x,5),Se(P,{width:N,x:T.x+T.width-N})),s.direction==="s"?Se(P,{height:fl(T.height+w.y,5)}):(k=fl(T.height-w.y,5),Se(P,{height:k,y:T.y+T.height-k}))})}}),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;z(c,function(g){n.removeMarker(g,Vf)}),z(l,function(g){n.removeMarker(g,Vf)}),p&&(an(f),an(p)),z(u,function(g){n.removeMarker(g,yb)}),d&&an(d)})}vb.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const c2={__init__:["spaceToolPreview"],__depends__:[ir,ji,ll,ra,Za],spaceTool:["type",hi],spaceToolPreview:["type",vb]};function dl(e,t){e.invoke(hi,this),this._canvas=t}dl.$inject=["injector","canvas"],Ee(dl,hi),dl.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Ro(jo(r.children.filter(l=>S(l,"bpmn:Artifact")),Zt(o))));const s=[...e,...a];var c=hi.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(l){return!(S(l,"bpmn:TextAnnotation")||l2(l)&&(t==="y"&&dn(l)||t==="x"&&!dn(l)))}),c};function l2(e){return S(e,"bpmn:Participant")&&!ae(e).processRef}const bb={__depends__:[c2],spaceTool:["type",dl]};function Ht(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)}Ht.$inject=["eventBus","injector"],Ht.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()},Ht.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},Ht.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Ht.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()}},Ht.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()}},Ht.prototype.register=function(e,t){this._setHandler(e,t)},Ht.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)},Ht.prototype.canUndo=function(){return!!this._getUndoAction()},Ht.prototype.canRedo=function(){return!!this._getRedoAction()},Ht.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Ht.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Ht.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)})},Ht.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},Ht.prototype._createId=function(){return this._uid++},Ht.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Ht.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()},Ht.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)},Ht.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:Eh("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Ht.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Ne(e)?e:[e],t.dirty=t.dirty.concat(e))},Ht.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Ht.prototype._revertedAction=function(e){this._stackIdx--},Ht.prototype._getHandler=function(e){return this._handlerMap[e]},Ht.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 u2={commandStack:["type",Ht]};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 p2=250,xb=1400;function Wf(e,t,n){oe.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",xb,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=_b(a),o.validatedShapes=_b(s)}),i&&t.on("shape.move.start",p2,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",xb,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];z(s,function(l){z(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=Ep(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&&(qt(s.labels,a,c),a.labelTarget=s)})}Ee(Wf,oe),Wf.$inject=["injector","eventBus","modeling"];function _b(e){var t=new Set(e);return nt(e,function(n){return!t.has(n.labelTarget)})}const f2={__init__:["labelSupport"],labelSupport:["type",Wf]};var d2=251,wb=1401,Eb="attach-ok";function Uf(e,t,n,i,r){oe.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",wb,function(a){var s=a.context,c=s.shapes,l=s.validatedShapes;s.shapes=h2(c),s.validatedShapes=g2(l)}),o&&t.on("shape.move.start",d2,function(a){var s=a.context,c=s.shapes,l=Yf(c);z(l,function(u){o.makeDraggable(s,u,!0),z(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,Eb),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(u,Eb)}))}}),this.preExecuted("elements.move",wb,function(a){var s=a.context,c=s.closure,l=s.shapes,u=Yf(l);z(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=nt(c,function(f){var p=f.host;return m2(f)&&!y2(c,p)}),z(u,function(f){r.updateAttachment(f,l)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;z(s,function(c){z(c.attachers,function(l){z(l.outgoing.slice(),function(u){var f=i.allowed("connection.reconnect",{connection:u,source:u.source,target:u.target});f||r.removeConnection(u)}),z(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&&z(l.attachers,function(u){var f=Hy(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&&z(f,function(d){var g=Hy(d,l,u);r.moveShape(d,g,d.parent),z(d.labels,function(h){r.moveShape(h,g,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)})}Ee(Uf,oe),Uf.$inject=["injector","eventBus","canvas","rules","modeling"];function Yf(e){return Pu(Cn(e,function(t){return t.attachers||[]}))}function h2(e){var t=Yf(e);return RE("id",e,t)}function g2(e){var t=Co(e,"id");return nt(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function m2(e){return!!e.host}function y2(e,t){return e.indexOf(t)!==-1}const v2={__depends__:[ji],__init__:["attachSupport"],attachSupport:["type",Uf]};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(mm(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 qf={__init__:["changeSupport"],changeSupport:["type",Sb]};function gi(e){this._model=e}gi.$inject=["moddle"],gi.prototype._needsId=function(e){return tt(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"])},gi.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":tt(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))},gi.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},gi.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},gi.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",W({bpmnElement:e,bounds:this.createDiBounds()},t))},gi.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},gi.prototype.createDiWaypoints=function(e){var t=this;return Cn(e,function(n){return t.createDiWaypoint(n)})},gi.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Si(e,["x","y"]))},gi.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",W({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},gi.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",W({bpmnElement:e},t))};function qn(e,t,n){oe.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var g=d.context,h=g.hints||{},y;!g.cropped&&h.createElementsBehavior!==!1&&(y=g.connection,y.waypoints=n.getCroppedWaypoints(y),g.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var g=d.context;i.updateParent(g.shape||g.connection,g.oldParent)}function a(d){var g=d.context,h=g.shape||g.connection,y=g.parent||g.newParent;i.updateParent(h,y)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Kn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Kn(a));function s(d){var g=d.context,h=g.oldRoot,y=h.children;z(y,function(M){S(M,"bpmn:BaseElement")&&i.updateParent(M)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var g=d.context.shape;S(g,"bpmn:BaseElement")&&i.updateBounds(g)}this.executed(["shape.move","shape.create","shape.resize"],Kn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Kn(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"],Kn(l)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Kn(l));function u(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Kn(u)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Kn(u)),this.executed("connection.reconnect",Kn(function(d){var g=d.context,h=g.connection,y=g.oldSource,M=g.newSource,_=ae(h),m=ae(y),v=ae(M);_.conditionExpression&&!tt(v,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(g.oldConditionExpression=_.conditionExpression,delete _.conditionExpression),y!==M&&m.default===_&&(g.oldDefault=m.default,delete m.default)})),this.reverted("connection.reconnect",Kn(function(d){var g=d.context,h=g.connection,y=g.oldSource,M=g.newSource,_=ae(h),m=ae(y),v=ae(M);g.oldConditionExpression&&(_.conditionExpression=g.oldConditionExpression),g.oldDefault&&(m.default=g.oldDefault,delete v.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Kn(f)),this.reverted(["element.updateAttachment"],Kn(f)),this.executed("element.updateLabel",Kn(p)),this.reverted("element.updateLabel",Kn(p));function p(d){const{element:g}=d.context,h=oi(g),y=pt(g),M=y&&y.get("label");Rr(g)||Jc(g)||(h&&!M?y.set("label",t.create("bpmndi:BPMNLabel")):!h&&M&&y.set("label",void 0))}}Ee(qn,oe),qn.$inject=["eventBus","bpmnFactory","connectionDocking"],qn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},qn.prototype.updateParent=function(e,t){if(!Je(e)&&!(S(e,"bpmn:DataStoreReference")&&e.parent&&S(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=pt(e),o=n&&n.businessObject,a=pt(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)}},qn.prototype.updateBounds=function(e){var t=pt(e),n=x2(e);if(n){var i=Ci(n,t.get("bounds"));W(n,{x:e.x+i.x,y:e.y+i.y})}var r=Je(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})},qn.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"),qt(r,e))}},qn.prototype.updateDiConnection=function(e,t,n){var i=pt(e),r=pt(t),o=pt(n);i.sourceElement&&i.sourceElement.bpmnElement!==ae(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ae(n)&&(i.targetElement=n&&o)},qn.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 b2(e){for(;e&&!S(e,"bpmn:Definitions");)e=e.$parent;return e}qn.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)},qn.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=b2(e.$parent||t),e.$parent&&(Ut(o.get("rootElements"),r),r.$parent=null),t&&(qt(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))}}},qn.prototype.updateConnectionWaypoints=function(e){var t=pt(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},qn.prototype.updateConnection=function(e){var t=e.connection,n=ae(t),i=t.source,r=ae(i),o=t.target,a=ae(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)},qn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Kn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;S(i,"bpmn:BaseElement")&&e(t)}}function x2(e){if(S(e,"bpmn:Activity")){var t=pt(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function Dr(e,t){Ji.call(this),this._bpmnFactory=e,this._moddle=t}Ee(Dr,Ji),Dr.$inject=["bpmnFactory","moddle"],Dr.prototype._baseCreate=Ji.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},oo,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(!w2(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=_2(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Kf(r,t,"isExpanded")),tt(i,["bpmn:Lane","bpmn:Participant"])&&(t=Kf(r,t,"isHorizontal")),S(i,"bpmn:SubProcess")&&(t.collapsed=!st(i,r)),S(i,"bpmn:ExclusiveGateway")&&(jn(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=ae(e);if(t=t||pt(e),S(n,"bpmn:SubProcess"))return st(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 st(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 pn(e)||(e={isExpanded:e}),e=W({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function _2(e,t,n){return z(n,function(i){t=Kf(e,t,i)}),t}function Kf(e,t,n){return t[n]===void 0?t:(e[n]=t[n],Ti(t,[n]))}function w2(e){return tt(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function hl(e,t){this._modeling=e,this._canvas=t}hl.$inject=["modeling","canvas"],hl.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;z(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)})},hl.prototype.postExecute=function(e){};function gl(e){this._modeling=e}gl.$inject=["modeling"],gl.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},gl.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 ml(e,t){this._canvas=e,this._layouter=t}ml.$inject=["canvas","layouter"],ml.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},ml.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var yl=Math.round;function Xf(e){this._modeling=e}Xf.$inject=["modeling"],Xf.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;z(t,function(f){ze(f.x)||(f.x=0),ze(f.y)||(f.y=0)});var s=nt(t,function(f){return!f.hidden}),c=Zt(s);z(t,function(f){Mt(f)&&(f.waypoints=Cn(f.waypoints,function(p){return{x:yl(p.x-c.x-c.width/2+r.x),y:yl(p.y-c.y-c.height/2+r.y)}})),W(f,{x:yl(f.x-c.x-c.width/2+r.x),y:yl(f.y-c.y-c.height/2+r.y)})});var l=new Set(bc(t)),u={};z(t,function(f){if(Mt(f)){u[f.id]=ze(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),Je(f)&&(p=Ti(p,["attach"])),u[f.id]=ze(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=Ro(u)};var Rb=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-Rb(t.width/2),y:n.y-Rb(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)}Ee(Ja,Lr),Ja.$inject=["canvas"];var S2=Lr.prototype.execute;Ja.prototype.execute=function(e){var t=e.shape;return C2(t),t.labelTarget=e.labelTarget,S2.call(this,e)};var R2=Lr.prototype.revert;Ja.prototype.revert=function(e){return e.shape.labelTarget=null,R2.call(this,e)};function C2(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=Ep(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,qt(n.children,t,i),this._canvas.addConnection(t,n),t};function Zf(e,t){this._modeling=e,this._elementRegistry=t}Zf.$inject=["modeling","elementRegistry"],Zf.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;z(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){Mt(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=Ep(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 qt(i.children,n,r),t.addShape(n,i),n};function vl(e){this._modeling=e}vl.$inject=["modeling"];var Cb={x:"y",y:"x"};vl.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(y,M){y.range.min=Math.min(M[i],y.range.min),y.range.max=Math.max(M[i]+M[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,M){var _={y:0};_[i]=y-a(M),_[i]&&(_[Cb[i]]=0,t.moveElements([M],_,M.parent))}var u=n[0],f=s(n),p=n[f],d,g,h=0;z(n,function(y,M){var _,m,v;if(y.elements.length<2){M&&M!==n.length-1&&(o(y,y.elements[0]),h+=c(y.range));return}_=Pi(y.elements,i),m=_[0],M===f&&(m=_[s(_)]),v=a(m),y.range=null,z(_,function(w){if(l(v,w),y.range===null){y.range={min:w[i],max:w[i]+w[r]};return}o(y,w)}),M&&M!==n.length-1&&(h+=c(y.range))}),g=Math.abs(p.range.min-u.range.max),d=Math.round((g-h)/(n.length-1)),!(d<n.length-1)&&z(n,function(y,M){var _={},m;y===u||y===p||(m=n[M-1],y.range.max=0,z(y.elements,function(v,w){_[Cb[i]]=0,_[i]=m.range.max-v[i]+d,y.range.min!==v[i]&&(_[i]+=v[i]-y.range.min),_[i]&&t.moveElements([v],_,v.parent),y.range.max=Math.max(v[i]+v[r],w?y.range.max:0)}))})},vl.prototype.postExecute=function(e){};function bl(e,t){this._layouter=e,this._canvas=t}bl.$inject=["layouter","canvas"],bl.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},bl.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function Qf(){}Qf.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),qt(i.children,t,r),t.parent=i,z(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},Qf.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),qt(i.children,t,r),t.parent=i,z(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=nC(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),z(a,function(f){o.moveShape(f,t,l[f.id]&&!u&&n,{recurse:!1,layout:!1})}),z(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&&af(f,f.source,t),connectionEnd:d&&sf(f,f.target,t)})})},ns.prototype.getClosure=function(e){return new Jf().addAll(e,!0)};function xl(e){this._helper=new ns(e)}xl.$inject=["modeling"],xl.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},xl.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 po(e){this._modeling=e,this._helper=new ns(e)}po.$inject=["modeling"],po.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=Ut(o.children,t),qt(i.children,t,r),W(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},po.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(z(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:sf(o,t,n)})}),z(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:af(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},po.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return qt(n.children,t,i),W(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},po.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},po.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 Ne(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||Mb(Ne(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||Mb(Ne(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 Mb(e){return e.original||e}function or(e,t){this._modeling=e,this._rules=t}or.$inject=["modeling","rules"],or.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(g,h,y){return i.allowed("connection.reconnect",{connection:y,source:g,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();z(p,function(g){var h=g.source,y=c(h,s,g);y&&t.reconnectEnd(g,s,Yc(g,s,u),a)}),z(d,function(g){var h=g.target,y=c(s,h,g);y&&t.reconnectStart(g,s,Uc(g,s,u),a)})},or.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},or.prototype.execute=function(e){},or.prototype.revert=function(e){},or.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},or.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},or.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&&(z(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:Yc(o,n,i)})}),z(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:Uc(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),z(r,function(s){a[s.id]=A2(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(t2(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;z(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;z(e,function(r){var o=n2(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);z(e,function(u){var f=u.source,p=u.target,d=M2(u),g=Pb(n),h={},y=c.has(f)||l.has(f),M=c.has(p)||l.has(p);y&&M?(d=Cn(d,function(_){return Tb(_,i,n)&&(_[g]=_[g]+t[g]),_.original&&Tb(_.original,i,n)&&(_.original[g]=_.original[g]+t[g]),_}),s._modeling.updateWaypoints(u,d,{labelBehavior:!1})):(y||M)&&(c.has(f)?h.connectionStart=af(u,f,t):c.has(p)?h.connectionEnd=sf(u,p,t):l.has(f)?h.connectionStart=Uc(u,f,a[f.id]):l.has(p)&&(h.connectionEnd=Yc(u,p,a[p.id])),s._modeling.layoutConnection(u,h))})};function Ab(e){return W({},e)}function M2(e){return Cn(e.waypoints,function(t){return t=Ab(t),t.original&&(t.original=Ab(t.original)),t})}function Pb(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function Tb(e,t,n){var i=Pb(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function A2(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function _l(e){this._modeling=e}_l.$inject=["modeling"],_l.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=kb(n),t.collapsed=!t.collapsed;var i=Ob(n,t.collapsed);return[t].concat(i)},_l.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 kb(e){var t={};return z(e,function(n){t[n.id]=n.hidden,n.children&&(t=W({},t,kb(n.children)))}),t}function Ob(e,t){var n=[];return z(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(Ob(i.children,i.collapsed||t)))}),n}function Db(e,t){var n=[];return z(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(Db(i.children,t)))}),n}function wl(e){this._modeling=e}wl.$inject=["modeling"],wl.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Lb(i,t),Ib(n,t),t.host=n,t},wl.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Lb(n,t),Ib(i,t,r),t};function Lb(e,t){return Ut(e&&e.attachers,t)}function Ib(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),qt(i,t,n)}}function ed(){}ed.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},ed.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function At(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}At.$inject=["eventBus","elementFactory","commandStack"],At.prototype.getHandlers=function(){return{"shape.append":gl,"shape.create":Lr,"shape.delete":ts,"shape.move":po,"shape.resize":rs,"shape.replace":or,"shape.toggleCollapse":_l,spaceTool:Ir,"label.create":Ja,"connection.create":ml,"connection.delete":es,"connection.move":Qf,"connection.layout":bl,"connection.updateWaypoints":ed,"connection.reconnect":is,"elements.create":Xf,"elements.move":xl,"elements.delete":Zf,"elements.distribute":vl,"elements.align":hl,"element.updateAttachment":wl}},At.prototype.registerHandlers=function(e){z(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},At.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)},At.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},At.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)},At.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)},At.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},At.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},At.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},At.prototype.createElements=function(e,t,n,i,r){Ne(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},At.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},At.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},At.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},At.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},At.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},At.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},At.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},At.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},At.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},At.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)},At.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},At.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)},At.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,W(i,{docking:"source"}))},At.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,W(i,{docking:"target"}))},At.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},At.prototype._create=function(e,t){return HC(t)?t:this._elementFactory.create(e,t)},At.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||P2(n,Fs(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")?T2(e,t):[]};function P2(e,t){return Hn(t,function(n,i){return n[i]=e.get(i),n},{})}function Bb(e,t){z(t,function(n,i){e.set(i,n)})}function T2(e,t){return t.filter(function(n){return S(n,"bpmn:DataObjectReference")&&ae(n).dataObjectRef===e})}var as="default",ar="id",Nb="di",k2={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=B2(e.properties),s=e.oldProperties||O2(t,a);return $b(a,o)&&(r.unclaim(o[ar]),i.updateId(t,a[ar]),r.claim(a[ar],o)),as in a&&(a[as]&&n.push(i.get(a[as].id)),o[as]&&n.push(i.get(o[as].id))),Fb(t,a),e.oldProperties=s,e.changed=n,n},ss.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ae(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,k2)}},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 Fb(t,i),$b(n,r)&&(a.unclaim(n[ar]),o.updateId(t,i[ar]),a.claim(i[ar],r)),e.changed};function $b(e,t){return ar in e&&e[ar]!==t[ar]}function O2(e,t){var n=Fs(t),i=e.businessObject,r=pt(e);return Hn(n,function(o,a){return a!==Nb?o[a]=i.get(a):o[a]=D2(r,Fs(t.di)),o},{})}function D2(e,t){return Hn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Fb(e,t){var n=e.businessObject,i=pt(e);z(t,function(r,o){o!==Nb?n.set(o,r):i&&L2(i,r)})}function L2(e,t){z(t,function(n,i){e.set(i,n)})}var I2=["default"];function B2(e){var t=W({},e);return I2.forEach(function(n){n in e&&(t[n]=ae(t[n]))}),t}function El(e,t){this._canvas=e,this._modeling=t}El.$inject=["canvas","modeling"],El.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=pt(r);return t.setRootElement(n),t.removeRootElement(r),qt(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,[]},El.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=pt(n);return t.setRootElement(r),t.removeRootElement(n),Ut(a.rootElements,i),i.$parent=null,qt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function td(e,t){this._modeling=e,this._spaceTool=t}td.$inject=["modeling","spaceTool"],td.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=pi(i),a=o===i,s=a?i:i.parent,c=Mr(s),l=dn(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+ui,y:i.y,width:i.width-ui,height:i.height}:{x:i.x,y:i.y+ui,width:i.width,height:i.height-ui};n.createShape({type:"bpmn:Lane",isHorizontal:l},u,s)}var f=[];io(o,function(v){return f.push(v),v.label&&f.push(v.label),v===i?[]:nt(v.children,function(w){return w!==i})});var p,d,g,h,y;r==="top"?(p=-120,d=i.y,g=d+10,h="n",y="y"):r==="left"?(p=-120,d=i.x,g=d+10,h="w",y="x"):r==="bottom"?(p=120,d=i.y+i.height,g=d-10,h="s",y="y"):r==="right"&&(p=120,d=i.x+i.width,g=d-10,h="e",y="x");var M=t.calculateAdjustments(f,y,p,g),_=l?{x:0,y:p}:{x:p,y:0};t.makeSpace(M.movingShapes,M.resizingShapes,_,h,g);var m=l?{x:i.x+(a?ui:0),y:d-(r==="top"?120:0),width:i.width-(a?ui:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?ui:0),width:120,height:i.height-(a?ui:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:l},m,s)};function nd(e){this._modeling=e}nd.$inject=["modeling"],nd.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Mr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=dn(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+ui,y:n.y+p*c,width:n.width-ui,height:l}:{x:n.x+p*c,y:n.y+ui,width:l,height:n.height-ui},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=TA(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=Ie(e),r=Ie(t),o=yy(r,i),a=pi(e),s=[],c=[];io(a,function(g){return s.push(g),(S(g,"bpmn:Lane")||S(g,"bpmn:Participant"))&&c.push(g),g.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",id="lanes";function Sl(){}Sl.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(u,f){var p=Ie(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=pi(u);return r[f.id]||(r[f.id]=Hc(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=pi(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(id),d=p.slice(),g=l(u);i.push({flowNode:f,remove:d,add:g})}),t.forEach(function(u){var f=u.businessObject;u.parent||f.get(ls).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Sl.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(id);n.remove.forEach(function(o){Ut(r,o),Ut(o.get(ls),i)}),n.add.forEach(function(o){qt(r,o),qt(o.get(ls),i)})}),[]},Sl.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(id);n.add.forEach(function(o){Ut(r,o),Ut(o.get(ls),i)}),n.remove.forEach(function(o){qt(r,o),qt(o.get(ls),i)})}),[]};var rd="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(_,m,v){if(m){var w=a.get(_);w||(w={},a.set(_,w)),!(v&&w.present)&&(!v&&w.past||(v?w.present={categoryValue:m,root:od(_)}:w.past={categoryValue:m}))}}function c(_){r.set(_,ae(_))}function l(){n.filter(function(_){return S(_,"bpmn:FlowElement")&&!Je(_)&&_.parent}).forEach(c)}function u(_){var m=ae(_),v=m.get("categoryValueRef");return v||(v=fy(i,m),o.push(N2(_,v))),v}function f(_){return _.reduce(function(m,v){var w=od(v),R=m.get(w);return R||(R=[],m.set(w,R)),R.push(v),m},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&l(),e.forEach(c),n.filter(function(_){return S(_,"bpmn:Group")&&!Je(_)&&_.parent}).forEach(function(_){var m=ae(_).get("categoryValueRef");if(!m){var v=od(_),w=p.get(v)||[],R=jo(w,_),P=Object.keys(R).length>0;P&&(m=u(_))}s(_,m,!0)}),t.forEach(function(_){s(_.groupShape,_.categoryValue,!1)}),o.length&&l();var d=Array.from(r.keys()),g=Array.from(a.values()).reduce(function(_,m){return m.present&&_.add(m.present.categoryValue),m.past&&_.add(m.past.categoryValue),_},new Set),h=new Map,y=f(d);a.forEach(function(_,m){var v=_.present;if(v){var w=y.get(v.root)||[],R=jo(w,m);w.forEach(function(P){if(R[P.id]){var T=h.get(P);T||(T=new Set,h.set(P,T)),T.add(v.categoryValue)}})}});var M=d.reduce(function(_,m){var v=r.get(m),w=v.get(rd),R=new Set(w),P=h.get(m)||new Set,T=Array.from(P).filter(function(k){return!R.has(k)}),N=w.filter(function(k){return g.has(k)&&!P.has(k)});return(T.length||N.length)&&_.push({businessObject:v,categoryValuesToAdd:T,categoryValuesToRemove:N}),_},[]);return{flowElements:M,groups:o}},us.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),$2(t.groups),j2(t.flowElements),[]},us.prototype.revert=function(e){var t=e.updates;return H2(t.flowElements),F2(t.groups),[]};function N2(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function $2(e){e.forEach(function(t){ae(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function F2(e){e.forEach(function(t){ae(t.groupShape).categoryValueRef=null})}function j2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(rd);t.categoryValuesToRemove.forEach(function(r){Ut(i,r)}),t.categoryValuesToAdd.forEach(function(r){qt(i,r,!0)})})}function H2(e){e.forEach(function(t){var n=t.businessObject,i=n.get(rd);t.categoryValuesToAdd.forEach(function(r){Ut(i,r)}),t.categoryValuesToRemove.forEach(function(r){qt(i,r,!0)})})}function od(e){for(;e.parent;)e=e.parent;return e}function Rl(e){this._moddle=e}Rl.$inject=["moddle"],Rl.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),[]},Rl.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 z2={fill:void 0,stroke:void 0};function ad(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Fn(t)){var n=G2(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}ad.$inject=["commandStack"],ad.prototype.postExecute=function(e){var t=e.elements,n=e.colors||z2,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)}),z(t,function(o){var a=Mt(o)?Si(r,["border-color"]):r,s=pt(o);if(V2(a),Je(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(!tt(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function G2(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 V2(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 jb(e,t,n){function i(c,l){var u=c.label||c,f=c.labelTarget||c;return bM(u,l),[u,f]}function r(c){var l=c.element,u=l.businessObject,f=c.newLabel;if(!Je(l)&&Rr(l)&&!Ac(l)&&!Hb(f)){var p=7,d=Pp(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=oi(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(!(!Je(u)&&!S(u,"bpmn:TextAnnotation"))){if(Je(u)&&Hb(f)){d.removeShape!==!1&&e.removeShape(u,{unsetLabel:!1});return}var g=oi(l);typeof p>"u"&&(p=t.getExternalLabelBounds(u,g)),p&&e.resizeShape(u,p,W2)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}jb.$inject=["modeling","textRenderer","bpmnFactory"];function Hb(e){return!e||!e.trim()}function Sn(e,t,n,i){At.call(this,e,t,n),this._bpmnRules=i}Ee(Sn,At),Sn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Sn.prototype.getHandlers=function(){var e=At.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=os,e["element.updateProperties"]=ss,e["canvas.updateRoot"]=El,e["lane.add"]=td,e["lane.resize"]=cs,e["lane.split"]=nd,e["lane.updateRefs"]=Sl,e["group.updateRefs"]=us,e["id.updateClaim"]=Rl,e["element.setColor"]=ad,e["element.updateLabel"]=jb,e},Sn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Sn.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),!!n)return this.createConnection(e,t,n,e.parent,i)},Sn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Sn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Sn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Sn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Sn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Sn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Sn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Sn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Sn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},Sn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Sn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Sn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function zb(){}zb.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||$e(t.source||e.source),t.connectionEnd||$e(t.target||e.target)]};var Cl=20,U2=5,Ml=Math.round,Gb=20,Y2={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function q2(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function K2(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Vb(e,t,n){var i=_n(t,e,U2),r=n.split(":")[0],o=Ml((t.x-e.x)/2+e.x),a=Ml((t.y-e.y)/2+e.y),s,c,l=K2(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=q2(i,r),c=u?"h:v":"v:h",f?u?(p=a===e.y,s={x:e.x+Cl*(/l/.test(r)?-1:1),y:p?a+Cl:a}):(p=o===e.x,s={x:p?o+Cl:o,y:e.y+Cl*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:sd(e,s,c).concat(s),directions:c,turnNextDirections:p}}function X2(e,t,n){return Vb(e,t,n)}function Z2(e,t,n){var i=Vb(t,e,Wb(n));return{waypoints:i.waypoints.slice().reverse(),directions:Wb(i.directions),turnNextDirections:i.turnNextDirections}}function Q2(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=sd(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Wb(e){return e.split(":").reverse().join(":")}function J2(e,t,n){var i=Ml((t.x-e.x)/2+e.x),r=Ml((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 sd(e,t,n){if(n=n||"h:h",!ck(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Yb(n)){var i=X2(e,t,n),r=Z2(e,t,n),o=Q2(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return J2(e,t,n)}function ek(e,t,n){var i=sd(e,t,n);return i.unshift(e),i.push(t),Kb(i)}function tk(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=EE(o,"straight")[0]||"h:h",s=Y2[a]||0,c=_n(e,t,s),l=sk(c,a);n=n||$e(e),i=i||$e(t);var u=l.split(":"),f=qb(n,e,u[0],lk(c)),p=qb(i,t,u[1],c);return ek(f,p,l)}function nk(e,t,n,i,r,o){Ne(n)&&(r=n,o=i,n=$e(e),i=$e(t)),o=W({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&rk(e,t,n,i,o),c||(c=o.connectionEnd&&ak(t,e,i,r),c)||(c=o.connectionStart&&ok(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:tk(e,t,n,i,o)}function ik(e,t,n){return e>=t&&e<=n}function Ub(e,t,n){var i={x:"width",y:"height"};return ik(t[e],n[e],n[e]+n[i[e]])}function rk(e,t,n,i,r){var o={},a,s;return s=_n(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Ub(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:Ub(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 ok(e,t,n,i){return cd(e,t,n,i)}function ak(e,t,n,i){var r=i.slice().reverse();return r=cd(e,t,n,r),r?r.reverse():null}function cd(e,t,n,i){function r(u){return u.length<3?!0:u.length>4?!1:!!kt(u,function(f,p){var d=u[p-1];return d&&La(f,d)<3})}function o(u,f,p){var d=Zi(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(vm(u[d],f,Gb)||vm(u[d],p,Gb))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=cd(e,t,n,l)),c&&Zi(c)?null:c}function sk(e,t){if(Yb(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 ck(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Yb(e){return e&&/t|r|b|l/.test(e)}function lk(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 qb(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 Kb(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return Sp(r,o,n,0)||t.push(n),t},[])}var uk=-10,pk=40,fk={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},dk={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},ld={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 Al(e){this._elementRegistry=e}Ee(Al,zb),Al.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=Xb(r&&r[0],n)),a||(a=Xb(r&&r[r.length-1],i)),(S(e,"bpmn:Association")||S(e,"bpmn:DataAssociation"))&&r&&!Zb(n,i))return[].concat([o],r.slice(1,-1),[a]);var u=cy(n,s)?fk:dk;return S(e,"bpmn:MessageFlow")?c=gk(n,i,u):(S(e,"bpmn:SequenceFlow")||Zb(n,i))&&(n===i?c={preferredLayouts:_k(n,e,u)}:S(n,"bpmn:BoundaryEvent")?c={preferredLayouts:wk(n,i,a,u)}:fs(n)||fs(i)?c={preferredLayouts:u.subProcess,preserveDocking:yk(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=Kb(nk(n,i,o,a,r,c))),l||[o,a]};function hk(e){var t=e.host;return _n($e(e),t,uk)}function gk(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:mk(e,t)}}function mk(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 yk(e){return fs(e)?"target":"source"}function Xb(e,t){return e?e.original||e:$e(t)}function Zb(e,t){return S(t,"bpmn:Activity")&&S(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function fs(e){return S(e,"bpmn:SubProcess")&&st(e)}function fo(e,t){return e===t}function vk(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 Qb(e,t){return ld[e]===t}function bk(e,t){var n=oa(e),i=ld[n];return t.indexOf(i)!==-1}function xk(e,t){var n=aa(e),i=ld[n];return t.indexOf(i)!==-1}function Jb(e){return e==="right"||e==="left"}function _k(e,t,n){var i=t.waypoints,r=i&&i.length&&_n(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function wk(e,t,n,i){var r=$e(e),o=$e(t),a=hk(e),s,c,l=fo(e.host,t),u=vk(a,["top","right","bottom","left"]),f=_n(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=Sk(a,f,u,i.isHorizontal),c=Rk(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=ps[a],c;return t?Jb(e)?c=ex("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=ex("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function ex(e,t,n,i){var r=pk;return!(ud(e,i,n,r)||ud(e,i,{x:n.x+n.width,y:n.y+n.height},r)||ud(e,i,$e(t),r))}function ud(e,t,n,i){return Math.abs(t[e]-n[e])<i}function Sk(e,t,n,i){if(n)return ps[e];var r=aa(e),o=oa(e),a=aa(t),s=oa(t);if(i){if(fo(r,a)||Qb(o,s))return ps[r]}else if(fo(o,s)||Qb(r,a))return ps[o];return ps[i?o:r]}function Rk(e,t,n,i){if(n)return Jb(e)?bk(e,t)||fo(e,t)?"h":"v":xk(e,t)||fo(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?fo(r,a)?"h":"v":fo(o,s)?"v":"h"}Al.$inject=["elementRegistry"];function tx(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(tx(i)),o.push(tx(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 pd={__init__:["modeling","bpmnUpdater"],__depends__:[VP,aT,cT,lT,db,u2,f2,v2,di,qf,bb],bpmnFactory:["type",gi],bpmnUpdater:["type",qn],elementFactory:["type",Dr],modeling:["type",Sn],layouter:["type",Al],connectionDocking:["type",Br]};var Ck=10,nx=50,Mk=250;function fd(e,t,n,i){for(var r;r=Ak(e,n,t);)n=i(t,n,r);return n}function dd(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 Ak(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=Tk(e);return kt(r,function(o){if(o===n)return!1;var a=_n(o,i,Ck);return a==="intersect"})}function Pk(e,t){t||(t={});function n(g){return g.source===e?1:-1}var i=t.defaultDistance||nx,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||Mk,c=t.reference||"start";o||(o=Dk);function l(g,h){return r==="n"?c==="start"?Ie(g).top-Ie(h).bottom:c==="center"?Ie(g).top-$e(h).y:Ie(g).top-Ie(h).top:r==="w"?c==="start"?Ie(g).left-Ie(h).right:c==="center"?Ie(g).left-$e(h).x:Ie(g).left-Ie(h).left:r==="s"?c==="start"?Ie(h).top-Ie(g).bottom:c==="center"?$e(h).y-Ie(g).bottom:Ie(h).bottom-Ie(g).bottom:c==="start"?Ie(h).left-Ie(g).right:c==="center"?$e(h).x-Ie(g).right:Ie(h).right-Ie(g).right}var u=e.incoming.filter(o).map(function(g){var h=a(g),y=h<0?l(g.source,e):l(e,g.source);return{id:g.source.id,distance:y,weight:h}}),f=e.outgoing.filter(o).map(function(g){var h=a(g),y=h>0?l(e,g.target):l(g.target,e);return{id:g.target.id,distance:y,weight:h}}),p=u.concat(f).reduce(function(g,h){return g[h.id+"__weight_"+h.weight]=h,g},{}),d=Hn(p,function(g,h){var y=h.distance,M=h.weight;return y<0||y>s||(g[String(y)]||(g[String(y)]=0),g[String(y)]+=1*M,(!g.distance||g[g.distance]<g[String(y)])&&(g.distance=y)),g},{});return d.distance||i}function Tk(e){var t=hd(e);return e.host&&(t=t.concat(hd(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(hd(i))},[]))),t}function hd(e){return Ok(e).concat(kk(e))}function kk(e){return e.incoming.map(function(t){return t.source})}function Ok(e){return e.outgoing.map(function(t){return t.target})}function Dk(){return!0}var Lk=100;function ix(e,t,n){e.on("autoPlace",Lk,function(i){var r=i.shape,o=i.source;return Ik(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}}ix.$inject=["eventBus","modeling","canvas"];function Ik(e,t,n){n||(n={});var i=n.defaultDistance||nx,r=$e(e),o=Ie(e);return{x:o.right+i+t.width/2,y:r.y}}function rx(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}rx.$inject=["eventBus","selection"];const Bk={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ix],autoPlaceSelectionBehavior:["type",rx]};function ox(e,t,n){var i=cy(e,n);if(S(t,"bpmn:TextAnnotation"))return $k(e,t,i);if(tt(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return Fk(e,t,i);if(S(t,"bpmn:FlowNode"))return Nk(e,t,i)}function Nk(e,t,n){var i=Ie(e),r=$e(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=Pk(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=_n(e,e.host,-25),l.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var u=n?{x:i.right+a+t.width/2,y:r.y+ax(l,c,o)}:{x:r.x+ax(l,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return fd(e,t,u,dd(p))}function ax(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function $k(e,t,n){var i=Ie(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};Mt(e)&&(r=$e(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 fd(e,t,r,dd(a))}function Fk(e,t,n){var i=Ie(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},a=n?{x:o}:{y:o};return fd(e,t,r,dd(a))}function sx(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return ox(r,i,t)})}sx.$inject=["eventBus","elementRegistry"];const Pl={__depends__:[Bk],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",sx]},cx=[ay,Ha,pd,Pl];function jk(e={}){Wh(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new Go({container:t,moddleExtensions:e.moddleExtensions??Us,additionalModules:[...cx,...e.additionalModules??[]]})}const lx={"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":"라벨","label-over-shape":"라벨","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":"그룹","edge-along-group-boundary":"그룹","pool-overlap":"풀","CHK-FLOW-1":"구조","CHK-POOL-1":"풀"},Hk={이:["이","가"],을:["을","를"],와:["과","와"]};function zk(e,t){const[n,i]=Hk[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 Gk={"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":"연관선"},Vk="요소";function gd(e){return(e&&Gk[e.type])??Vk}const ux=20;function Wk(e){const t=e.replace(/\s+/g," ").trim();return t.length>ux?`${t.slice(0,ux)}…`:t}function Tl(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+gd(r):o,s=o===void 0?a:`「${o}」`;return n?s+zk(a,n).slice(a.length):s}function Uk(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&&gd(o)===gd(a);return[Tl(e,t,i),Tl(e,n,r,s?"다른 ":"")]}function Yk(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 qk(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"label-over-shape":return[e.edge,e.shape];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"edge-along-group-boundary":return[e.edge,e.group];case"pool-name-over-label":return[e.pool,e.label];case"pool-overlap":return[...e.pools]}}const kl={top:"위",bottom:"아래",left:"왼쪽",right:"오른쪽"};function Kk(e,t){const n=(r,o)=>Tl(t,r,o),i=(r,o,a,s)=>Uk(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"label-over-shape":return`${n(e.edge)}의 라벨이 ${n(e.shape)} 위에 ${e.depth}px 겹쳐 있습니다.`;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)}의 ${kl[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)}의 ${kl[e.side]}을(를) ${Math.round(e.depth)}px 가릅니다.`;case"edge-along-group-boundary":return e.distance===0?`${n(e.edge,"이")} ${n(e.group)}의 ${kl[e.side]} 테두리 위를 ${e.length}px 겹쳐 흐릅니다.`:`${n(e.edge,"이")} ${n(e.group)}의 ${kl[e.side]} 테두리 ${e.inside?"안쪽":"바깥쪽"} ${e.distance}px 에 ${e.length}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 Xk(e,t){switch(e.ruleId){case"CHK-FLOW-1":return`${Tl(t,e.targetRefs[0])}에 연결된 선이 하나도 없습니다 — 분기·합류가 없는 게이트웨이는 의미가 정해지지 않습니다.`;case"CHK-POOL-1":return`이 문서에 내용이 없는 풀 ${e.targetRefs.length}개가 펼친 형태로 그려져 있습니다 — 이 문서에서 내용을 그리지 않는 풀은 접힌 형태(블랙박스)가 의미에 맞습니다.`;default:return e.ruleId}}const px="기타",md={error:0,warning:1,info:2};function fx(e,t){const n=[];for(const i of e.geometry)n.push({key:`g:${mt(i)}`,source:"geometry",code:i.kind,severity:Yk(i),targetRefs:qk(i),category:lx[i.kind]??px,message:Kk(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:lx[i.ruleId]??px,message:Xk(i,t)});return n}function dx(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 yd(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 hx(e,t){const n=yd(e,t);return e.slice().sort((i,r)=>(n?Number(sa(r,t))-Number(sa(i,t)):0)||md[i.severity]-md[r.severity])}var Zk=new ia("ov"),Qk=500;function gn(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=Zk,this._overlayDefaults=W({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=Jk(n.getContainer()),this._init()}gn.$inject=["config.overlays","eventBus","canvas","elementRegistry"],gn.prototype.get=function(e){if(Fn(e)&&(e={id:e}),Fn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?nt(t.overlays,Mo({type:e.type})):t.overlays.slice():[]}else return e.type?nt(this._overlays,Mo({type:e.type})):e.id?this._overlays[e.id]:null},gn.prototype.add=function(e,t,n){if(pn(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)||[];Ne(t)||(t=[t]);var n=this;z(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(Li(i.html),Li(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(){Ol(this._overlayRoot)},gn.prototype.hide=function(){Ol(this._overlayRoot,!1)},gn.prototype.clear=function(){this._overlays={},this._overlayContainers=[],dc(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}gx(n,i,r),An(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}gx(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},gn.prototype._createOverlayContainer=function(e){var t=Lt('<div class="djs-overlays" />');Dn(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(",")+")";mx(this._overlayRoot,n)},gn.prototype._getOverlayContainer=function(e,t){var n=kt(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)),Fn(i)&&(i=Lt(i)),o=this._getOverlayContainer(n),r=Lt('<div class="djs-overlay" data-overlay-id="'+t+'">'),Dn(r,{position:"absolute"}),r.appendChild(i),e.type&&$t(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Ol(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),Ol(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+")"),mx(o,s)},gn.prototype._updateOverlaysVisibilty=function(e){var t=this;z(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});z(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){Li(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",Qk,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(z(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&&$t(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 Jk(e){var t=Lt('<div class="djs-overlay-container" />');return Dn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function gx(e,t,n){Dn(e,{left:t+"px",top:n+"px"})}function Ol(e,t){e.style.display=t===!1?"none":""}function mx(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Dl={__init__:["overlays"],overlays:["type",gn]};function vd(e,t){t.invoke(oe,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}Ee(vd,oe),vd.$inject=["canvas","injector"];const eO={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",vd]};function ds(e){return CSS.escape(e)}var tO={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function yx(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return tO[t]})}var nO="bjs-breadcrumbs-shown";function vx(e,t,n){var i=Lt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=$t(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var l=c.element,u=ae(l),f=kt(a,function(p){return p===u});f&&s()});function s(c){c&&(a=iO(c));var l=a.flatMap(function(f){var p=n.findRoot(Fi(f))||n.findRoot(f.id);if(!p&&S(f,"bpmn:Process")){var d=t.find(function(y){var M=ae(y);return M&&M.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var g=yx(f.name||f.id),h=Lt('<li><span class="bjs-crumb"><a title="'+g+'">'+g+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(p)}),h});i.innerHTML="";var u=l.length>1;o.toggle(nO,u),l.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}vx.$inject=["eventBus","elementRegistry","canvas"];function iO(e){for(var t=ae(e),n=[],i=t;i;i=i.$parent)(S(i,"bpmn:SubProcess")||S(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function bx(e,t){var n=null,i=new rO;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})}bx.$inject=["eventBus","canvas"];function rO(){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 xx={x:180,y:160};function ho(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}ho.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)})}},ho.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),aO(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},ho.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=oO(e),i={x:n.x-xx.x,y:n.y-xx.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)})},ho.prototype._moveToDiPlane=function(e,t){var n=_x(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},ho.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},ho.$inject=["eventBus","moddle"];function _x(e){return S(e,"bpmndi:BPMNDiagram")?e:_x(e.$parent)}function oO(e){var t={top:1/0,right:-1/0,bottom:-1/0,left:1/0};return e.planeElement.forEach(function(n){if(n.bounds){var i=Ie(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),wc(t)}function aO(e,t){var n=e.$parent;return!(!S(n,"bpmn:SubProcess")||n===t.bpmnElement||tt(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Ll=250,sO='<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>',cO="bjs-drilldown-empty";function Nr(e,t,n,i,r){oe.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",Ll,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Ll,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Ll,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"],Ll,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)})})}Ee(Nr,oe),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(Fi(e))},Nr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ae(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;$t(i.html).toggle(cO,!r)}},Nr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ae(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=Lt('<button type="button" class="bjs-drilldown">'+sO+"</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(Fi(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 lO={__depends__:[Dl,qf,eO],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",vx],drilldownCentering:["type",bx],drilldownOverlayBehavior:["type",Nr],subprocessCompatibility:["type",ho]};function $r(e){jt.call(this,e)}Ee($r,jt),$r.prototype._modules=[ay,lO,Dl,di,Ha],$r.prototype._moddleExtensions={};var Il="keyboard.keydown",uO="keyboard.keyup",pO=1e3,wx="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 Ln(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(wx));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}Ln.$inject=["config.keyboard","eventBus"],Ln.prototype._keydownHandler=function(e){this._keyHandler(e,Il)},Ln.prototype._keyupHandler=function(e){this._keyHandler(e,uO)},Ln.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Il,i),n&&e.preventDefault()}},Ln.prototype._isEventIgnored=function(e){return!1},Ln.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(wx)),this.unbind(),e=this._node=this._target,Ge.bind(e,"keydown",this._keydownHandler),Ge.bind(e,"keyup",this._keyupHandler),this._fire("bind")},Ln.prototype.getBinding=function(){return this._node},Ln.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Ge.unbind(e,"keydown",this._keydownHandler),Ge.unbind(e,"keyup",this._keyupHandler)),this._node=null},Ln.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Ln.prototype.addListener=function(e,t,n){fn(e)&&(n=t,t=e,e=pO),this._eventBus.on(n||Il,e,t)},Ln.prototype.removeListener=function(e,t){this._eventBus.off(t||Il,e)},Ln.prototype.hasModifier=wT,Ln.prototype.isCmd=Un,Ln.prototype.isShift=Nf,Ln.prototype.isKey=sn;var fO=500;function ca(e,t){var n=this;e.on("editorActions.init",fO,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(MT(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(AT(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(ST(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(RT(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(CT(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(sn(["+","Add","="],r)&&Un(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(sn(["-","Subtract"],r)&&Un(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(sn("0",r)&&Un(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 bd={__init__:["keyboard","keyboardBindings"],keyboard:["type",Ln],keyboardBindings:["type",ca]};var dO={moveSpeed:50,moveSpeedAccelerated:200};function Ex(e,t,n){var i=this;this._config=W({},dO,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})}}Ex.$inject=["config.keyboardMove","keyboard","canvas"];const Sx={__depends__:[bd],__init__:["keyboardMove"],keyboardMove:["type",Ex]};var hO=15;function Rx(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=so(s),f=Ci(u,c);if(!n.dragging&&gO(f)>hO&&(n.dragging=!0,l===0&&Uv(e),al("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){Ge.unbind(document,"mousemove",r),Ge.unbind(document,"mouseup",o),n=null,Wv()}function a(s){if(!to(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:so(s)},Ge.bind(document,"mousemove",r),Ge.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}Rx.$inject=["eventBus","canvas"];function gO(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const Cx={__init__:["moveCanvas"],moveCanvas:["type",Rx]};function Mx(e,t){var n=Dp(e.min),i=Dp(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function mO(e,t){return Math.max(e.min,Math.min(e.max,t))}var yO=Math.sign||function(e){return e>=0?1:-1},xd={min:.2,max:4},Ax=10,vO=.1,bO=.75;function zi(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Bn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||bO;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}zi.$inject=["config.zoomScroll","eventBus","canvas"],zi.prototype.scroll=function(t){this._canvas.scroll(t)},zi.prototype.reset=function(){this._canvas.zoom("fit-viewport")},zi.prototype.zoom=function(t,n){var i=Mx(xd,Ax*2);this._totalDelta+=t,Math.abs(this._totalDelta)>vO&&(this._zoom(t,n,i),this._totalDelta=0)},zi.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Jy()&&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))*yO(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)}},zi.prototype.stepZoom=function(t,n){var i=Mx(xd,Ax);this._zoom(t,n,i)},zi.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Dp(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(mO(xd,s),t)},zi.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&Ge[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},zi.prototype._init=function(e){this.toggle(e)};const Px={__init__:["zoomScroll"],zoomScroll:["type",zi]};function hs(e){$r.call(this,e)}Ee(hs,$r),hs.prototype._navigationModules=[Sx,Cx,Px],hs.prototype._modules=[].concat($r.prototype._modules,hs.prototype._navigationModules);function _d(e){return e&&e[e.length-1]}function Tx(e){return e.y}function kx(e){return e.x}var xO={left:kx,center:kx,right:function(e){return e.x+e.width},top:Tx,middle:Tx,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=_d(t),o[e]=u[i]+u[r];else if(this._isType(e,["center","middle"])){if(z(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]=_d(c).center,o;l=t[0],t=Pi(t,function(p){return p[i]+p[r]}),u=_d(t),o[e]=f(l,u)}return o},la.prototype.trigger=function(e,t){var n=this._modeling,i,r=nt(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Ne(i)&&(r=i),!(r.length<2||!i)){var o=xO[t],a=Pi(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const _O={__init__:["alignElements"],alignElements:["type",la]},wO=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=wO.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 SO={scheduler:["type",ua]};var RO="djs-element-hidden",Bl=".entry",CO=1e3,Ox=8,MO=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=Ne(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=Ne(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Jt.prototype._createContainer=function(){var e=Lt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Jt.prototype.registerProvider=function(e,t){t||(t=e,e=CO),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Jt.prototype.getEntries=function(e){var t=this._getProviders(),n=Ne(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return z(t,function(r){if(fn(r[n])){var o=r[n](e);fn(o)?i=o(i):z(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=An(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},MO);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(fn(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;z(t,function(r,o){var a=r.group||"default",s=Lt(r.html||'<div class="entry" draggable="true"></div>'),c;An(s,"data-action",o),c=Rt("[data-group="+ds(a)+"]",n),c||(c=Lt('<div class="group"></div>'),An(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&AO(s,r.className),r.title&&An(s,"title",r.title),r.imageUrl&&(i=Lt("<img>"),An(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),$t(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=Lt('<div class="djs-context-pad"></div>');return Gn.bind(n,Bl,"click",function(i){t.trigger("click",i)}),Gn.bind(n,Bl,"dragstart",function(i){t.trigger("dragstart",i)}),Gn.bind(n,Bl,"mouseover",function(i){t.trigger("mouseover",i)}),Gn.bind(n,Bl,"mouseout",function(i){t.trigger("mouseout",i)}),Ge.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()&&TO(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 Ne(e)!==Ne(n)?!1:Ne(e)?e.length===n.length&&Zr(e,function(i){return n.includes(i)}):n===e},Jt.prototype.isShown=function(){return this.isOpen()&&$t(this._current.html).has("open")},Jt.prototype.show=function(){this.isOpen()&&($t(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Jt.prototype.hide=function(){this.isOpen()&&($t(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Jt.prototype._getPosition=function(e){if(!Ne(e)&&Mt(e)){var t=this._canvas.viewbox(),n=PO(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+Ox*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+Ox*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=Ne(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,RO)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Jt.prototype._getTargetBounds=function(e){var t=this,n=Ne(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 AO(e,t){var n=$t(e);t=Ne(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function PO(e){return e.waypoints[e.waypoints.length-1]}function TO(e,t){return e=Ne(e)?e:[e],t=Ne(t)?t:[t],e.length===t.length&&Zr(e,function(n){return t.includes(n)})}const Dx={__depends__:[ol,SO,Dl],contextPad:["type",Jt]};var Nl,zt,Lx,Fr,Ix,Bx,Nx,wd,$l,gs,$x,Ed,Sd,Rd,Fl={},jl=[],kO=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Hl=Array.isArray;function sr(e,t){for(var n in t)e[n]=t[n];return e}function Cd(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Fx(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?Nl.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 zl(e,a,i,r,null)}function zl(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??++Lx,__i:-1,__u:0};return r==null&&zt.vnode!=null&&zt.vnode(o),o}function Gl(e){return e.children}function Vl(e,t){this.props=e,this.context=t}function go(e,t){if(t==null)return e.__?go(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"?go(e):null}function OO(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=sr({},t);o.__v=t.__v+1,zt.vnode&&zt.vnode(o),Md(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??go(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Yx(i,o,r),t.__e=t.__=null,o.__e!=n&&jx(o)}}function jx(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}),jx(e)}function Hx(e){(!e.__d&&(e.__d=!0)&&Fr.push(e)&&!Wl.__r++||Ix!=zt.debounceRendering)&&((Ix=zt.debounceRendering)||Bx)(Wl)}function Wl(){try{for(var e,t=1;Fr.length;)Fr.length>t&&Fr.sort(Nx),e=Fr.shift(),t=Fr.length,OO(e)}finally{Fr.length=Wl.__r=0}}function zx(e,t,n,i,r,o,a,s,c,l,u){var f,p,d,g,h,y,M=i&&i.__k||jl,_=t.length;for(c=DO(n,t,M,c,_),f=0;f<_;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&M[d.__i]||Fl,d.__i=f,y=Md(e,d,p,r,o,a,s,c,l,u),g=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&Ad(p.ref,null,d),u.push(d.ref,d.__c||g,d)),h==null&&g!=null&&(h=g),4&d.__u?(c=Gx(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&y!==void 0?c=y:g&&(c=g.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]=zl(null,a,null,null,null):Hl(a)?a=e.__k[o]=zl(Gl,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=zl(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=LO(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=go(s)),Kx(s,s));return i}function Gx(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=Gx(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=go(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function LO(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 Vx(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||kO.test(t)?n:n+"px"}function Ul(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||Vx(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Vx(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace($x,"$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]=Ed,e.addEventListener(t,o?Rd:Sd,o)):e.removeEventListener(t,o?Rd:Sd,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 Wx(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[$l]==null)t[$l]=Ed++;else if(t[$l]<n[gs])return;return n(zt.event?zt.event(t):t)}}}function Md(e,t,n,i,r,o,a,s,c,l){var u,f,p,d,g,h,y,M,_,m,v,w,R,P,T,N,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(u=zt.__b)&&u(t);e:if(typeof k=="function"){f=a.length;try{if(_=t.props,m=k.prototype&&k.prototype.render,v=(u=k.contextType)&&i[u.__c],w=u?v?v.props.value:u.__:i,n.__c?M=(p=t.__c=n.__c).__=p.__E:(m?t.__c=p=new k(_,w):(t.__c=p=new Vl(_,w),p.constructor=k,p.render=BO),v&&v.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),m&&p.__s==null&&(p.__s=p.state),m&&k.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=sr({},p.__s)),sr(p.__s,k.getDerivedStateFromProps(_,p.__s))),g=p.props,h=p.state,p.__v=t,d)m&&k.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),m&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(m&&k.getDerivedStateFromProps==null&&_!==g&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(_,w),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(_,p.__s,w)===!1){t.__v!=n.__v&&(p.props=_,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(D){D&&(D.__=t)}),jl.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=go(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(_,p.__s,w),m&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(g,h,y)})}if(p.context=w,p.props=_,p.__P=e,p.__e=!1,R=zt.__r,P=0,m)p.state=p.__s,p.__d=!1,R&&R(t),u=p.render(p.props,p.state,p.context),jl.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,R&&R(t),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++P<25);p.state=p.__s,p.getChildContext!=null&&(i=sr(sr({},i),p.getChildContext())),m&&!d&&p.getSnapshotBeforeUpdate!=null&&(y=p.getSnapshotBeforeUpdate(g,h)),T=u!=null&&u.type===Gl&&u.key==null?qx(u.props.children):u,s=zx(e,Hl(T)?T:[T],t,n,i,r,o,a,s,c,l),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),M&&(p.__E=p.__=null)}catch(D){if(a.length=f,t.__v=null,c||o!=null){if(D.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(N=o.length;N--;)Cd(o[N])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),D.then||Ux(t),zt.__e(D,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=IO(n.__e,t,n,i,r,o,a,c,l);return(u=zt.diffed)&&u(t),128&t.__u?void 0:s}function Ux(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ux))}function Yx(e,t,n){for(var i=0;i<n.length;i++)Ad(n[i],n[++i],n[++i]);zt.__c&&zt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){zt.__e(o,r.__v)}})}function qx(e){return typeof e!="object"||e==null||e.__b>0?e:Hl(e)?e.map(qx):e.constructor!==void 0?null:sr({},e)}function IO(e,t,n,i,r,o,a,s,c){var l,u,f,p,d,g,h,y=n.props||Fl,M=t.props,_=t.type;if(_=="svg"?r="http://www.w3.org/2000/svg":_=="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==!!_&&(_?d.localName==_:d.nodeType==3)){e=d,o[l]=null;break}}if(e==null){if(_==null)return document.createTextNode(M);e=document.createElementNS(r,_,M.is&&M),s&&(zt.__m&&zt.__m(t,o),s=!1),o=null}if(_==null)y===M||s&&e.data==M||(e.data=M);else{if(o=_=="textarea"&&M.defaultValue!=null?null:o&&Nl.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 M||l=="value"&&"defaultValue"in M||l=="checked"&&"defaultChecked"in M||Ul(e,l,null,d,r);for(l in M)d=M[l],l=="children"?p=d:l=="dangerouslySetInnerHTML"?u=d:l=="value"?g=d:l=="checked"?h=d:s&&typeof d!="function"||y[l]===d||Ul(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=""),zx(t.type=="template"?e.content:e,Hl(p)?p:[p],t,n,i,_=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&go(n,0),s,c),o!=null)for(l=o.length;l--;)Cd(o[l]);s&&_!="textarea"||(l="value",_=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[l]||_=="progress"&&!g||_=="option"&&g!=y[l])&&Ul(e,l,g,y[l],r),l="checked",h!=null&&h!=e[l]&&Ul(e,l,h,y[l],r))}return e}function Ad(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){zt.__e(r,n)}}function Kx(e,t,n){var i,r;if(zt.unmount&&zt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Ad(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){zt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Kx(i[r],t,n||typeof e.type!="function");n||Cd(e.__e),e.__c=e.__=e.__e=void 0}function BO(e,t,n){return this.constructor(e,n)}function Xx(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),zt.__&&zt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Md(t,e=t.__k=Fx(Gl,null,[e]),r||Fl,Fl,t.namespaceURI,r?null:t.firstChild?Nl.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Yx(o,e,a),e.props.children=null}Nl=jl.slice,zt={__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}},Lx=0,Vl.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=sr({},this.state),typeof e=="function"&&(e=e(sr({},n),this.props)),e&&sr(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Hx(this))},Vl.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Hx(this))},Vl.prototype.render=Gl,Fr=[],Bx=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Nx=function(e,t){return e.__v.__b-t.__v.__b},Wl.__r=0,wd=Math.random().toString(8),$l="__d"+wd,gs="__a"+wd,$x=/(PointerCapture)$|Capture$/i,Ed=0,Sd=Wx(!1),Rd=Wx(!0);var Zx=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,Zx(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Qx=new Map;function NO(e){var t=Qx.get(this);return t||(t=new Map,Qx.set(this,t)),(t=Zx(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 Pt=NO.bind(Fx),pa,en,Pd,Jx,ms=0,e_=[],cn=zt,t_=cn.__b,n_=cn.__r,i_=cn.diffed,r_=cn.__c,o_=cn.unmount,a_=cn.__;function Yl(e,t){cn.__h&&cn.__h(en,e,ms||t),ms=0;var n=en.__H||(en.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Td(e){return ms=1,$O(c_,e)}function $O(e,t,n){var i=Yl(pa++,2);if(i.t=e,!i.__c&&(i.__=[c_(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 g=d.__[0];d.__=d.__N,d.__N=void 0,g!==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 ql(e,t){var n=Yl(pa++,3);!cn.__s&&Dd(n.__H,t)&&(n.__=e,n.u=t,en.__H.__h.push(n))}function kd(e,t){var n=Yl(pa++,4);!cn.__s&&Dd(n.__H,t)&&(n.__=e,n.u=t,en.__h.push(n))}function Kl(e){return ms=5,cr(function(){return{current:e}},[])}function cr(e,t){var n=Yl(pa++,7);return Dd(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function ys(e,t){return ms=8,cr(function(){return e},t)}function FO(){for(var e;e=e_.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Xl),t.__h.some(Od),t.__h=[]}catch(n){t.__h=[],cn.__e(n,e.__v)}}}cn.__b=function(e){en=null,t_&&t_(e)},cn.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),a_&&a_(e,t)},cn.__r=function(e){n_&&n_(e),pa=0;var t=(en=e.__c).__H;t&&(Pd===en?(t.__h=[],en.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Xl),t.__h.some(Od),t.__h=[],pa=0)),Pd=en},cn.diffed=function(e){i_&&i_(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(e_.push(t)!==1&&Jx===cn.requestAnimationFrame||((Jx=cn.requestAnimationFrame)||jO)(FO)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Pd=en=null},cn.__c=function(e,t){t.some(function(n){try{n.__h.some(Xl),n.__h=n.__h.filter(function(i){return!i.__||Od(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],cn.__e(i,n.__v)}}),r_&&r_(e,t)},cn.unmount=function(e){o_&&o_(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{Xl(i)}catch(r){t=r}}),n.__H=void 0,t&&cn.__e(t,n.__v))};var s_=typeof requestAnimationFrame=="function";function jO(e){var t,n=function(){clearTimeout(i),s_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);s_&&(t=requestAnimationFrame(n))}function Xl(e){var t=en,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),en=t}function Od(e){var t=en;e.__c=e.__(),en=t}function Dd(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function c_(e,t){return typeof t=="function"?t(e):t}function HO(e){const{navigationStack:t,setNavigationStack:n}=e,i=cr(()=>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 Pt`
12
12
  <div class="djs-popup-breadcrumbs">
13
13
  ${r&&Pt`
14
14
  <button
@@ -41,7 +41,7 @@
41
41
  </span>
42
42
  `}
43
43
  </div>
44
- `}function l_(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=l_(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=l_(e))&&(i&&(i+=" "),i+=t);return i}function jO(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=cr(()=>HO(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Pt`
44
+ `}function l_(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=l_(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=l_(e))&&(i&&(i+=" "),i+=t);return i}function zO(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=cr(()=>GO(t),[t]),s=l=>l.action&&!l.disabled,c=(l,u)=>{if(s(u))return n(l,u)};return Pt`
45
45
  <div class="djs-popup-header">
46
46
  <h3 class="djs-popup-title" title=${o}>${o}</h3>
47
47
  ${a.map(l=>Pt`
@@ -50,7 +50,7 @@
50
50
  ${l.entries.map(u=>Pt`
51
51
  <li key=${u.id}>
52
52
  <${s(u)?"button":"span"}
53
- class=${zO(u,u===i)}
53
+ class=${VO(u,u===i)}
54
54
  onClick=${f=>c(f,u)}
55
55
  title=${u.title||u.label}
56
56
  data-id=${u.id}
@@ -70,7 +70,7 @@
70
70
  </ul>
71
71
  `)}
72
72
  </div>
73
- `}function HO(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 zO(e,t){return Zl("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function u_(e,t){return`${e}-entry-${t.id}`}function GO(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 Pt`
73
+ `}function GO(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 VO(e,t){return Zl("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function u_(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 Pt`
74
74
  <li
75
75
  class=${Zl("entry",{selected:i,disabled:n.disabled})}
76
76
  data-id=${n.id}
@@ -131,7 +131,7 @@
131
131
  </div>
132
132
  `}
133
133
  </li>
134
- `}function VO(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,f=Kl();kd(()=>{if(!r||!r.current)return;const h=f.current;if(!h)return;const y=h.querySelector(".selected");y&&WO(y)},[t]);const p=()=>{r.current=!1},d=h=>{r.current||n(h)},m=()=>{r.current||n(null)};return Pt`
134
+ `}function UO(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:l,...u}=e,f=Kl();kd(()=>{if(!r||!r.current)return;const h=f.current;if(!h)return;const y=h.querySelector(".selected");y&&YO(y)},[t]);const p=()=>{r.current=!1},d=h=>{r.current||n(h)},g=()=>{r.current||n(null)};return Pt`
135
135
  <div
136
136
  class="djs-popup-results"
137
137
  ref=${f}
@@ -155,24 +155,24 @@
155
155
  aria-labelledby=${h.name?p_(o,h):void 0}
156
156
  >
157
157
  ${h.entries.map(y=>Pt`
158
- <${GO}
158
+ <${WO}
159
159
  key=${y.id}
160
160
  idPrefix=${o}
161
161
  entry=${y}
162
162
  selected=${y===t}
163
163
  onMouseEnter=${()=>d(y)}
164
- onMouseLeave=${m}
164
+ onMouseLeave=${g}
165
165
  ...${u}
166
166
  />
167
167
  `)}
168
168
  </ul>
169
169
  `)}
170
170
  </div>
171
- `}function p_(e,t){return`${e}-group-${t.id}`}function WO(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const UO=new na("djs-popup");function YO(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]=Td([]);ql(()=>{y([])},[p]);const[C,_]=Td(""),g=C.trim().length>0,v=cr(()=>XO(p),[p]),w=cr(()=>rn(l)?v.length>5:!1,[l,v]),R=cr(()=>{const q=h.length?h[h.length-1].entries:p;return w?g?f(v.filter(({searchable:V})=>V!==!1),C,{keys:["label","search","description"]}).map(({item:V})=>V):q.filter(({rank:V=0})=>V>=0):q},[w,g,v,C,f,h,p]),P=cr(()=>g?R.length?[{id:"default",entries:R}]:[]:ZO(R),[R,g]),[T,N]=Td(R[0]),k=Kl(null),D=Kl(!1),H=cr(()=>UO.next(),[]),Q=`${H}-results`,pe=T&&u_(H,T);ql(()=>{const q=k.current;q&&R.includes(q)?N(q):N(R[0]),k.current=null},[R]);const Me=ys(q=>{const V=KO(P);let Te=V.indexOf(T)+q;Te<0&&(Te=V.length-1),Te>=V.length&&(Te=0),D.current=!0,N(V[Te])},[P,T]),Be=ys(q=>{q>0&&T&&T.entries&&(D.current=!0,y(V=>[...V,T])),q<0&&h.length>0&&(D.current=!0,k.current=h[h.length+q],y(V=>V.slice(0,q)))},[T,h]),it=ys((q,V,ne)=>{if(!(!V||V.disabled))return V.entries?(q.preventDefault(),Be(1)):n(q,V,ne)},[n,Be]),X=ys(q=>{if(q.key==="Enter"&&T){const V=q.target;return!!eo(V,"a, button",!0)||T.disabled?void 0:it(q,T)}if(q.key==="Backspace"){const V=q.target;if(!(fp(V,"input")&&V.value!==""))return Be(-1),q.preventDefault()}if(q.key==="ArrowUp")return Me(-1),q.preventDefault();if(q.key==="ArrowDown")return Me(1),q.preventDefault();if(q.key==="ArrowRight")return Be(1),q.preventDefault();if(q.key==="ArrowLeft")return Be(-1),q.preventDefault()},[T,Me,Be,it]),J=ys(q=>{fp(q.target,"input")&&_(()=>q.target.value)},[_]);ql(()=>(d(),()=>{m()}),[]);const le=!g&&h.length>0,ve=(a||r.length>0)&&!le;return Pt`
171
+ `}function p_(e,t){return`${e}-group-${t.id}`}function YO(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const qO=new ia("djs-popup");function KO(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:g}=e,[h,y]=Td([]);ql(()=>{y([])},[p]);const[M,_]=Td(""),m=M.trim().length>0,v=cr(()=>QO(p),[p]),w=cr(()=>rn(l)?v.length>5:!1,[l,v]),R=cr(()=>{const q=h.length?h[h.length-1].entries:p;return w?m?f(v.filter(({searchable:V})=>V!==!1),M,{keys:["label","search","description"]}).map(({item:V})=>V):q.filter(({rank:V=0})=>V>=0):q},[w,m,v,M,f,h,p]),P=cr(()=>m?R.length?[{id:"default",entries:R}]:[]:JO(R),[R,m]),[T,N]=Td(R[0]),k=Kl(null),D=Kl(!1),H=cr(()=>qO.next(),[]),Q=`${H}-results`,pe=T&&u_(H,T);ql(()=>{const q=k.current;q&&R.includes(q)?N(q):N(R[0]),k.current=null},[R]);const Me=ys(q=>{const V=ZO(P);let Te=V.indexOf(T)+q;Te<0&&(Te=V.length-1),Te>=V.length&&(Te=0),D.current=!0,N(V[Te])},[P,T]),Be=ys(q=>{q>0&&T&&T.entries&&(D.current=!0,y(V=>[...V,T])),q<0&&h.length>0&&(D.current=!0,k.current=h[h.length+q],y(V=>V.slice(0,q)))},[T,h]),it=ys((q,V,ne)=>{if(!(!V||V.disabled))return V.entries?(q.preventDefault(),Be(1)):n(q,V,ne)},[n,Be]),K=ys(q=>{if(q.key==="Enter"&&T){const V=q.target;return!!to(V,"a, button",!0)||T.disabled?void 0:it(q,T)}if(q.key==="Backspace"){const V=q.target;if(!(fp(V,"input")&&V.value!==""))return Be(-1),q.preventDefault()}if(q.key==="ArrowUp")return Me(-1),q.preventDefault();if(q.key==="ArrowDown")return Me(1),q.preventDefault();if(q.key==="ArrowRight")return Be(1),q.preventDefault();if(q.key==="ArrowLeft")return Be(-1),q.preventDefault()},[T,Me,Be,it]),J=ys(q=>{fp(q.target,"input")&&_(()=>q.target.value)},[_]);ql(()=>(d(),()=>{g()}),[]);const ce=!m&&h.length>0,ve=(a||r.length>0)&&!ce;return Pt`
172
172
  <${f_}
173
173
  onClose=${t}
174
174
  onKeyup=${J}
175
- onKeydown=${X}
175
+ onKeydown=${K}
176
176
  className=${i}
177
177
  position=${o}
178
178
  width=${s}
@@ -180,7 +180,7 @@
180
180
  navigationStack=${h}
181
181
  >
182
182
  ${ve&&Pt`
183
- <${jO}
183
+ <${zO}
184
184
  headerEntries=${r}
185
185
  onSelect=${n}
186
186
  selectedEntry=${T}
@@ -188,8 +188,8 @@
188
188
  title=${a}
189
189
  />
190
190
  `}
191
- ${le&&Pt`
192
- <${FO}
191
+ ${ce&&Pt`
192
+ <${HO}
193
193
  navigationStack=${h}
194
194
  setNavigationStack=${y}
195
195
  />
@@ -215,13 +215,13 @@
215
215
  </div>
216
216
  `}
217
217
 
218
- ${g&&Pt`
218
+ ${m&&Pt`
219
219
  <div class="djs-popup-search-count" aria-live="polite">
220
220
  ${R.length} ${R.length===1?"result":"results"} found
221
221
  </div>
222
222
  `}
223
223
 
224
- <${VO}
224
+ <${UO}
225
225
  groupedEntries=${P}
226
226
  selectedEntry=${T}
227
227
  setSelectedEntry=${N}
@@ -255,13 +255,13 @@
255
255
  </div>
256
256
  `}
257
257
  ${u&&R.length===0&&Pt`
258
- <div class="djs-popup-no-results">${fn(u)?u(C):u}</div>
258
+ <div class="djs-popup-no-results">${fn(u)?u(M):u}</div>
259
259
  `}
260
260
  </${f_}>
261
- `}function f_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Kl();return kd(()=>{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]),kd(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),ql(()=>{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)}},[]),Pt`
261
+ `}function f_(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=Kl();return kd(()=>{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]),kd(()=>{const l=c.current;if(!l)return;(l.querySelector("input")||l.querySelector('[role="listbox"]')||l).focus()},[a]),ql(()=>{const l=f=>{if(f.key==="Escape")return f.preventDefault(),t()},u=f=>{if(!to(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)}},[]),Pt`
262
262
  <div
263
263
  class=${Zl("djs-popup",r)}
264
- style=${qO(e)}
264
+ style=${XO(e)}
265
265
  onKeydown=${n}
266
266
  onKeyup=${i}
267
267
  ref=${c}
@@ -269,10 +269,10 @@
269
269
  >
270
270
  ${o}
271
271
  </div>
272
- `}function qO(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 XO(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function ZO(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 QO="data-id",d_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],JO=1e3;function Gt(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()})}Gt.$inject=["config.popupMenu","eventBus","canvas","search"],Gt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=h_(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),l=this._updateScale(this._current.container);Xx(Pt`
273
- <${YO}
272
+ `}function XO(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 ZO(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function QO(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function JO(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 eD="data-id",d_=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],tD=1e3;function Gt(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()})}Gt.$inject=["config.popupMenu","eventBus","canvas","search"],Gt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=h_(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),l=this._updateScale(this._current.container);Xx(Pt`
273
+ <${KO}
274
274
  onClose=${p=>this.close(p)}
275
- onSelect=${(p,d,m)=>this.trigger(p,d,m)}
275
+ onSelect=${(p,d,g)=>this.trigger(p,d,g)}
276
276
  position=${c}
277
277
  className=${t}
278
278
  entries=${a}
@@ -284,7 +284,7 @@
284
284
  searchFn=${this._search}
285
285
  ...${{...o}}
286
286
  />
287
- `,this._current.container)},Gt.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()},Gt.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()},Gt.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)}},Gt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Gt.prototype.reset=function(){const e=this._current.container;Xx(null,e),Li(e)},Gt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Gt.prototype._onOpened=function(){this._emit("opened")},Gt.prototype._onClosed=function(){this._emit("closed")},Gt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Lt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Gt.prototype._bindAutoClose=function(){this._eventBus.once(d_,this.close,this)},Gt.prototype._unbindAutoClose=function(){this._eventBus.off(d_,this.close,this)},Gt.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},Gt.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}},Gt.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},Gt.prototype.registerProvider=function(e,t,n){n||(n=t,t=JO),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Gt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Gt.prototype._getEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuEntries){z(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Ti(o,["id"])});return}var r=i.getPopupMenuEntries(e);fn(r)?n=r(n):z(r,function(o,a){n[a]=o})}),n},Gt.prototype._getHeaderEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;z(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Ti(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);fn(r)?n=r(n):z(r,function(o,a){n[a]=o})}),n},Gt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>fn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Gt.prototype.isOpen=function(){return!!this._current},Gt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=eo(e.delegateTarget||e.target,".entry",!0),o=An(r,QO);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(fn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Gt.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 h_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=h_(r.entries,[...t,...m_(r.search)]):t.length&&(r.search=[...t,...m_(r.search)]),r})}function m_(e){return e?Ne(e)?e:[e]:[]}function eD(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=tD(o,r,i);return a?{item:o,tokens:a}:[]}).sort(nD(i))}function tD(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Ne(s)?s.reduce((u,f)=>{const{tokens:p,matchedWords:d}=x_(f,t);return{tokens:[...u.tokens,p],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):x_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function nD(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=iD(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=g_;continue}const s=rD(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=g_;continue}}return i}}function iD(e,t){return y_(t)-y_(e)}const g_=.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 y_(e){const t=e.reduce((s,c)=>s+v_(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 v_(e){if(Ne(e))return Math.max(...e.map(v_));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 b_(e=""){return Ne(e)?e.join(", "):e}function rD(e,t){return b_(e).localeCompare(b_(t))}function x_(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(oD),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)),C=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:C,start:d,end:m,all:h});const _=h?t:[u];for(const g of _)i[g.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function oD(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const __={search:["value",eD]},Ld={__depends__:[__],__init__:["popupMenu"],popupMenu:["type",Gt]};var w_={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},Gt.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()},Gt.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()},Gt.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)}},Gt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Gt.prototype.reset=function(){const e=this._current.container;Xx(null,e),Li(e)},Gt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Gt.prototype._onOpened=function(){this._emit("opened")},Gt.prototype._onClosed=function(){this._emit("closed")},Gt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=Lt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Gt.prototype._bindAutoClose=function(){this._eventBus.once(d_,this.close,this)},Gt.prototype._unbindAutoClose=function(){this._eventBus.off(d_,this.close,this)},Gt.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},Gt.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}},Gt.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},Gt.prototype.registerProvider=function(e,t,n){n||(n=t,t=tD),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Gt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Gt.prototype._getEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuEntries){z(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Ti(o,["id"])});return}var r=i.getPopupMenuEntries(e);fn(r)?n=r(n):z(r,function(o,a){n[a]=o})}),n},Gt.prototype._getHeaderEntries=function(e,t){var n={};return z(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;z(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=Ti(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);fn(r)?n=r(n):z(r,function(o,a){n[a]=o})}),n},Gt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>fn(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Gt.prototype.isOpen=function(){return!!this._current},Gt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=to(e.delegateTarget||e.target,".entry",!0),o=An(r,eD);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(fn(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Gt.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 h_(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=h_(r.entries,[...t,...g_(r.search)]):t.length&&(r.search=[...t,...g_(r.search)]),r})}function g_(e){return e?Ne(e)?e:[e]:[]}function nD(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=iD(o,r,i);return a?{item:o,tokens:a}:[]}).sort(rD(i))}function iD(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:l}=Ne(s)?s.reduce((u,f)=>{const{tokens:p,matchedWords:d}=x_(f,t);return{tokens:[...u.tokens,p],matchedWords:{...u.matchedWords,...d}}},{matchedWords:{},tokens:[]}):x_(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...l}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function rD(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=oD(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=m_;continue}const s=aD(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=m_;continue}}return i}}function oD(e,t){return y_(t)-y_(e)}const m_=.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 y_(e){const t=e.reduce((s,c)=>s+v_(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 v_(e){if(Ne(e))return Math.max(...e.map(v_));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 b_(e=""){return Ne(e)?e.join(", "):e}function aD(e,t){return b_(e).localeCompare(b_(t))}function x_(e,t){var l;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(sD),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,g=p===e.length,h=!!((l=s.groups)!=null&&l.all),y=d||/\s/.test(e.charAt(f-1)),M=g||/\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:M,start:d,end:g,all:h});const _=h?t:[u];for(const m of _)i[m.toLowerCase()]=!0;c=s.index+u.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function sD(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const __={search:["value",nD]},Ld={__depends__:[__],__init__:["popupMenu"],popupMenu:["type",Gt]};var w_={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>`},aD=900;function fa(e,t,n,i){e.registerProvider(aD,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">${w_.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 sD=["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 z(sD,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:w_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Ql(e){fi.call(this,e)}Ql.$inject=["eventBus"],Ee(Ql,fi),Ql.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=nt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=bc(n),n.length<2?!1:n})};const cD={__depends__:[bO,Dx,Ld],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",fa],alignElementsMenuProvider:["type",vs],bpmnAlignElements:["type",Ql]};function lr(e,t,n,i){oe.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=Pu(So(a.closure.topLevel)),c=a.hints,l=c?c.autoResize:!0;if(l!==!1){var u=Ro(s,function(f){return f.parent.id});z(u,function(f,p){Ne(l)&&(f=f.filter(function(d){return kt(l,Co({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)})}lr.$inject=["eventBus","elementRegistry","modeling","rules"],Ee(lr,oe),lr.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Ie(Zt(e)),o=Ie(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),wc(W({},o,a))},lr.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(lD(i,t)){var r=uD(Si(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},lr.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},lr.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},lr.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function lD(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function uD(e,t){var n="";return e=Ie(e),t=Ie(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function Jl(e){e.invoke(lr,this)}Jl.$inject=["injector"],Ee(Jl,lr),Jl.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){fi.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}bs.$inject=["eventBus"],Ee(bs,fi),bs.prototype.canResize=function(e,t){return!1};function eu(e,t){bs.call(this,e),this._modeling=t}Ee(eu,bs),eu.$inject=["eventBus","modeling"],eu.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 z(e,function(i){if(S(i,"bpmn:Lane")||Je(i)){n=!1;return}}),n};const pD={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Jl],bpmnAutoResizeProvider:["type",eu]};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++)fD(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 fD(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 dD={__depends__:[ir],__init__:["autoScroll"],autoScroll:["type",da]};var E_="djs-bendpoint",S_="djs-segment-dragger";function hD(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 Id(e,t,n){var i=hD(e,n),r=Xp(t,i);return r}function Bd(e,t){var n=Oe("g");ut(n).add(E_),Ue(e,n);var i=Oe("circle");Se(i,{cx:0,cy:0,r:4}),ut(i).add("djs-visual"),Ue(n,i);var r=Oe("circle");return Se(r,{cx:0,cy:0,r:10}),ut(r).add("djs-hit"),Ue(n,r),t&&ut(n).add(t),n}function mD(e,t,n,i){var r=Oe("g");Ue(e,r);var o=18,a=6,s=11,c=yD(t,n,i),l=a+s,u=Oe("rect");Se(u,{x:-o/2,y:-a/2,width:o,height:a}),ut(u).add("djs-visual"),Ue(r,u);var f=Oe("rect");return Se(f,{x:-c/2,y:-l/2,width:c,height:l}),ut(f).add("djs-hit"),Ue(r,f),Wg(r,i==="v"?90:0),r}function R_(e,t,n){var i=Oe("g"),r=Rp(t,n),o=Zi(t,n);return Ue(e,i),mD(i,t,n,o),ut(i).add(S_),ut(i).add(o==="h"?"horizontal":"vertical"),wn(i,r.x,r.y),i}function Nd(e){return Math.abs(Math.round(e*2/3))}function gD(e,t){var n=vD(e,t);return nf(e,n)}function yD(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Nd(n==="h"?i:r)}function vD(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=ky(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function C_(e,t,n,i,r){function o(g,v,w){var R=g.index,P=g.point,T,N,k,D,H,Q;return R<=0||g.bendpoint?!1:(T=v[R-1],N=v[R],k=Rp(T,N),D=Zi(T,N),H=Math.abs(P.x-k.x),Q=Math.abs(P.y-k.y),D&&H<=w&&Q<=w)}function a(g,v){var w=g.waypoints,R,P,T,N;return v.index<=0||v.bendpoint||(R={start:w[v.index-1],end:w[v.index]},P=Zi(R.start,R.end),!P)?null:(P==="h"?T=R.end.x-R.start.x:T=R.end.y-R.start.y,N=Nd(T)/2,N)}function s(g,v){var w=v.waypoints,R=Id(t,w,g),P;if(R){P=a(v,R);var T;if(o(R,w,P)?T=r.start(g,v,R.index):T=i.start(g,v,R.index,!R.bendpoint),T!==!1)return!0}}function c(g,v,w){Ge.bind(g,v,function(R){n.triggerMouseEvent(v,R,w),R.stopPropagation()})}function l(g,v){var w=t.getLayer("overlays"),R=Rt('.djs-bendpoints[data-element-id="'+ds(g.id)+'"]',w);return!R&&v&&(R=Oe("g"),Se(R,{"data-element-id":g.id}),ut(R).add("djs-bendpoints"),Ue(w,R),c(R,"mousedown",g),c(R,"click",g),c(R,"dblclick",g)),R}function u(g,v){return Rt('.djs-segment-dragger[data-segment-idx="'+g+'"]',v)}function f(g,v){v.waypoints.forEach(function(w,R){var P=Bd(g);Ue(g,P),wn(P,w.x,w.y)}),Bd(g,"floating")}function p(g,v){for(var w=v.waypoints,R,P,T,N=1;N<w.length;N++)R=w[N-1],P=w[N],Zi(R,P)&&(T=R_(g,R,P),Se(T,{"data-segment-idx":N}),c(T,"mousemove",v))}function d(g){z(mc("."+E_,g),function(v){an(v)})}function m(g){z(mc("."+S_,g),function(v){an(v)})}function h(g){var v=l(g);return v||(v=l(g,!0),f(v,g),p(v,g)),v}function y(g){var v=l(g);v&&(m(v),d(v),p(v,g),f(v,g))}function C(g,v){var w=Rt(".floating",g),R=v.point;w&&(wn(w,R.x,R.y),ut(w).add("positioned"))}function _(g,v,w){var R=u(v.index,g),P=w[v.index-1],T=w[v.index],N=v.point,k=Rp(P,T),D=Zi(P,T),H,Q;R&&(H=bD(R),Q={x:N.x-k.x,y:N.y-k.y},D==="v"&&(Q={x:Q.y,y:Q.x}),wn(H,Q.x,Q.y))}e.on("connection.changed",function(g){y(g.element)}),e.on("connection.remove",function(g){var v=l(g.element);v&&an(v)}),e.on("element.marker.update",function(g){var v=g.element,w;v.waypoints&&(w=h(v),g.add?ut(w).add(g.marker):ut(w).remove(g.marker))}),e.on("element.mousemove",function(g){var v=g.element,w=v.waypoints,R,P;if(w){if(R=l(v,!0),P=Id(t,w,g.originalEvent),!P)return;C(R,P),P.bendpoint||_(R,P,w)}}),e.on("element.mousedown",function(g){if(Pr(g)){var v=g.originalEvent,w=g.element;if(w.waypoints)return s(v,w)}}),e.on("selection.changed",function(g){var v=g.newSelection,w=v[0];w&&w.waypoints&&h(w)}),e.on("element.hover",function(g){var v=g.element;v.waypoints&&h(v)}),e.on("element.out",function(g){var v=g.element;if(v.waypoints){var w=l(v);if(w){var R=Rt(".floating",w);R&&ut(R).remove("positioned")}}}),e.on("element.updateId",function(g){var v=g.element,w=g.newId;if(v.waypoints){var R=l(v);R&&Se(R,{"data-element-id":w})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}C_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function bD(e){return Rt(".djs-visual",e)}var M_=Math.round,mo="reconnectStart",go="reconnectEnd",xs="updateWaypoints";function $d(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||{},C={x:M_(a.x),y:M_(a.y)};if(!c)return!1;h===xs?(f?p.splice(l,0,C):p[l]=C,y.bendpointMove={insert:f,bendpointIndex:l},p=this.cropWaypoints(u,p),o.updateWaypoints(u,CC(p),y)):(h===mo?(y.docking="source",tu(s)&&(y.docking="target",y.newWaypoints=p.reverse())):h===go&&(y.docking="target",tu(s)&&(y.docking="source",y.newWaypoints=p.reverse())),o.reconnect(u,d,m,C,y))},this)}$d.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],$d.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function tu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===mo)return t&&i&&t===i&&n!==i;if(r===go)return t&&n&&t===n&&n!==i}var xD="reconnectStart",_D="reconnectEnd",A_="updateWaypoints",_s="connect-ok",nu="connect-not-ok",P_="connect-hover",T_="djs-updating",k_="djs-dragging",O_=1100;function D_(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=Bd(i.getLayer("overlays"));ut(p).add("djs-dragging"),i.addMarker(c,k_),i.addMarker(c,T_)}),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,P_),l===A_)return;s?(i.removeMarker(c,nu),i.addMarker(c,_s)):s===!1&&(i.removeMarker(c,_s),i.addMarker(c,nu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],O_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,P_),i.removeMarker(s,c?_s:nu))}),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},C=a.hints||{},_={};r&&(C.connectionStart&&(_.connectionStart=C.connectionStart),C.connectionEnd&&(_.connectionEnd=C.connectionEnd),f===xD?tu(a)?(_.connectionEnd=_.connectionEnd||y,_.source=m,_.target=u||d,h=h.reverse()):(_.connectionStart=_.connectionStart||y,_.source=u||d,_.target=m):f===_D?tu(a)?(_.connectionStart=_.connectionStart||y,_.source=u||m,_.target=d,h=h.reverse()):(_.connectionEnd=_.connectionEnd||y,_.source=d,_.target=u||m):(_.noCropping=!0,_.noLayout=!0,h[c]=y),f===A_&&(h=e.cropWaypoints(p,h)),_.waypoints=h,r.drawPreview(a,s,_)),wn(l,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],O_,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,T_),i.removeMarker(s,k_),l&&(i.removeMarker(l,_s),i.removeMarker(l,u?_s:nu)),r&&r.cleanUp(a)})}D_.$inject=["bendpointMove","injector","eventBus","canvas"];var L_="connect-hover",I_="djs-updating";function B_(e,t,n){return Fd(e,t,e[t]+n)}function Fd(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function wD(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 Fd(t,i,s)}function N_(e){return e==="x"?"y":"x"}function $_(e,t,n){var i,r;return e.original?e.original:(i=$e(t),r=N_(n),Fd(e,r,i[r]))}function F_(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,C=d,_=p.waypoints,g=_[y],v=_[C],w=Id(n,_,f),R,P,T;if(R=Zi(g,v),!!R)return P=R==="v"?"x":"y",y===0&&(g=$_(g,p.source,P)),C===_.length-1&&(v=$_(v,p.target,P)),w?T=w.point:T={x:(g.x+v.x)/2,y:(g.y+v.y)/2},m={connection:p,segmentStartIndex:y,segmentEndIndex:C,segmentStart:g,segmentEnd:v,axis:P,dragPosition:T},i.init(f,T,"connectionSegment.move",{cursor:P==="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],C=f.segmentEndIndex+p,_=m[C],g=N_(f.axis),v=wD(d,y,_,g);wn(f.draggerGfx,v.x,v.y)}function u(f,p){var d=0,m=f.filter(function(h,y){return Sp(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=R_(m,p.segmentStart,p.segmentEnd),ut(p.draggerGfx).add("djs-dragging"),n.addMarker(d,I_)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,m=p.segmentStartIndex,h=p.segmentEndIndex,y=p.segmentStart,C=p.segmentEnd,_=p.axis,g=p.originalWaypoints.slice(),v=B_(y,_,f["d"+_]),w=B_(C,_,f["d"+_]),R=g.length,P=0;g[m]=v,g[h]=w;var T,N;m<2&&(T=_n(d.source,v),m===1?T==="intersect"&&(g.shift(),g[0]=v,P--):T!=="intersect"&&(g.unshift(y),P++)),h>R-3&&(N=_n(d.target,w),h===R-2?N==="intersect"&&(g.pop(),g[g.length-1]=w):N!=="intersect"&&g.push(C)),p.newWaypoints=d.waypoints=s(d,g),l(p,P,f),p.newSegmentStartIndex=m+P,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,L_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,L_)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&an(p.draggerGfx),n.removeMarker(d,I_)}),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(w){return{original:w.original,x:Math.round(w.x),y:Math.round(w.y)}});var y=u(m,h),C=y.waypoints,_=s(d,C),g=y.segmentOffset,v={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:h+g}};o.updateWaypoints(d,_,v)})}F_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var ED=Math.abs,j_=Math.round;function SD(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],ED(r-e)<=n)return r}function H_(e){return{x:e.x,y:e.y}}function z_(e){return{x:e.x+e.width,y:e.y+e.height}}function gi(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:j_(e.x+e.width/2),y:j_(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 G_(e){return e.children||[]}var RD=Math.abs,V_=Math.round,jd=10;function W_(e){function t(o,a){if(Ne(o)){for(var s=o.length;s--;)if(RD(o[s]-a)<=jd)return o[s]}else{o=+o;var c=a%o;if(c<jd)return a-c;if(c>o-jd)return a-c+o}return a}function n(o,a){if(o.waypoints)return gD(a,o);if(o.width)return{x:V_(o.width/2+o.x),y:V_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,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:[]},z(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:[]},z(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);!Mt(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)}})}W_.$inject=["eventBus"];const CD={__depends__:[ir,ji],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",C_],bendpointMove:["type",$d],bendpointMovePreview:["type",D_],connectionSegmentMove:["type",F_],bendpointSnapping:["type",W_]};function U_(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),!Eo(u)){if(u!==!1){s.source=c,s.target=l;return}u=s.canExecute=o(c,l),!Eo(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:Hd(s)?u:l,connectionEnd:Hd(s)?l:u};pn(c)&&(d=c),s.connection=n.connect(f,p,d,m)}),this.start=function(a,s,c,l){pn(c)||(l=c,c=$e(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}U_.$inject=["eventBus","dragging","modeling","rules"];function Hd(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var MD=1100,AD=900,Y_="connect-ok",q_="connect-not-ok";function K_(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;Hd(o)&&(m=d,h=p),i.drawPreview(o,a,{source:c||l,target:f||s,connectionStart:m,connectionEnd:h})}),t.on("connect.hover",AD,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?Y_:q_)}),t.on(["connect.out","connect.cleanup"],MD,function(r){var o=r.hover;o&&(n.removeMarker(o,Y_),n.removeMarker(o,q_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}K_.$inject=["injector","eventBus","canvas"];const zd={__depends__:[di,ji,ir],__init__:["connectPreview"],connect:["type",U_],connectPreview:["type",K_]};var PD="djs-dragger";function ur(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)}ur.$inject=["injector","canvas","graphicsFactory","elementFactory"],ur.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()),gc(i),r||(r=e.getConnection=TD(function(h,y,C){return m.getConnection(h,y,C)})),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?$e(o):c,a?$e(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)"})},ur.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||$e(n),o=t.connectionEnd||$e(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Ue(e,s)},ur.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]},ur.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&an(e.connectionPreviewGfx)},ur.prototype.getConnection=function(e){var t=kD(e);return this._elementFactory.createConnection(t)},ur.prototype.createConnectionPreviewGfx=function(){var e=Oe("g");return Se(e,{pointerEvents:"none"}),ut(e).add(PD),Ue(this._canvas.getActiveLayer(),e),e},ur.prototype.createNoopConnection=function(e,t){return ka([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function TD(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 kD(e){return pn(e)?e:{}}const OD={__init__:["connectionPreview"],connectionPreview:["type",ur]},iu="complex-preview";class X_{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(iu);n.filter(s=>!DD(s)).forEach(s=>{let c;Mt(s)?(c=this._graphicsFactory._createContainer("connection",Oe("g")),this._graphicsFactory.drawConnection(io(c),s)):(c=this._graphicsFactory._createContainer("shape",Oe("g")),this._graphicsFactory.drawShape(io(c),s),wn(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);Mt(s)?wn(l,c.x,c.y):wn(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",Oe("g"));this._graphicsFactory.drawShape(io(l),s,{width:c.width,height:c.height}),wn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){gc(this._canvas.getLayer(iu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(iu)}hide(){this._canvas.hideLayer(iu)}}X_.$inject=["canvas","graphicsFactory","previewSupport"];function DD(e){return e.hidden}const LD={__depends__:[ia],__init__:["complexPreview"],complexPreview:["type",X_]},Z_=Math.round;function ru(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}ru.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=o.createShape(W({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;W(l,{x:u.x-Z_(l.width/2),y:u.y-Z_(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=>!Eo(d))})},ru.prototype.cleanUp=function(){this._complexPreview.cleanUp()},ru.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const ID={__depends__:[Pl,LD,pd],__init__:["appendPreview"],appendPreview:["type",ru]};var Q_=Math.min,J_=Math.max;function Gd(e){e.preventDefault()}function ws(e){e.stopPropagation()}function BD(e){return e.nodeType===Node.TEXT_NODE}function ND(e){return[].slice.call(e)}function Mi(e){this.container=e.container,this.parent=Lt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Rt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Bn(this.autoResize,this),this.handlePaste=Bn(this.handlePaste,this)}Mi.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,Ge.bind(a,"keydown",this.keyHandler),Ge.bind(a,"mousedown",ws),Ge.bind(a,"paste",r.handlePaste),Ge.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ge.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Mi.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)}},Mi.prototype.insertText=function(e){e=$D(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Mi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=ND(a.childNodes),c,l;if(BD(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&&Li(m)}),c=n,l=r+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Mi.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})}},Mi.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=Lt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,f=function(m){Gd(m),ws(m),s=m.clientX,c=m.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Ge.bind(document,"mousemove",p),Ge.bind(document,"mouseup",d)},p=function(m){Gd(m),ws(m);var h=Q_(J_(l+m.clientX-s,i),o),y=Q_(J_(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){Gd(m),ws(m),Ge.unbind(document,"mousemove",p,!1),Ge.unbind(document,"mouseup",d,!1)};Ge.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)},Mi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ge.unbind(t,"keydown",this.keyHandler),Ge.unbind(t,"mousedown",ws),Ge.unbind(t,"input",this.autoResize),Ge.unbind(t,"paste",this.handlePaste),Ge.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Li(n)),Li(e)},Mi.prototype.getValue=function(){return this.content.innerText.trim()},Mi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Mi.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 $D(e){return e.replace(/\r\n|\r|\n/g,`
316
- `)}function Xn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Mi({container:t.getContainer(),keyHandler:Bn(this._handleKey,this),resizeHandler:Bn(this._handleResize,this),focusoutHandler:Bn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Xn.$inject=["eventBus","canvas"],Xn.prototype.registerProvider=function(e){this._providers.push(e)},Xn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Xn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Xn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Xn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Xn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Xn.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()}},Xn.prototype.getValue=function(){return this._textbox.getValue()},Xn.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()},Xn.prototype._handleResize=function(e){this._fire("resize",e)},Xn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Xn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=kt(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 ew={__depends__:[ol],__init__:["directEditing"],directEditing:["type",Xn]};function FD(e){return function(t){var n=t.target,i=ae(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===st(e);return!o||!a||!s||!c}}const jD={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 re(e,t={}){var n=jD[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var HD=[re("none-start-event",{actionName:"replace-with-none-start"}),re("none-intermediate-throwing"),re("none-end-event",{actionName:"replace-with-none-end"}),re("message-start"),re("timer-start"),re("conditional-start"),re("signal-start")],zD=[re("none-start-event",{actionName:"replace-with-none-start"}),re("none-intermediate-throwing"),re("none-end-event",{actionName:"replace-with-none-end"})],GD=[re("none-start-event",{actionName:"replace-with-none-start"}),re("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),re("none-end-event",{actionName:"replace-with-none-end"}),re("message-intermediate-catch"),re("message-intermediate-throw"),re("timer-intermediate-catch"),re("escalation-intermediate-throw"),re("conditional-intermediate-catch"),re("link-intermediate-catch"),re("link-intermediate-throw"),re("compensation-intermediate-throw"),re("signal-intermediate-catch"),re("signal-intermediate-throw")],VD=[re("none-start-event",{actionName:"replace-with-none-start"}),re("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),re("none-end-event",{actionName:"replace-with-none-end"}),re("message-end"),re("escalation-end"),re("error-end"),re("cancel-end"),re("compensation-end"),re("signal-end"),re("terminate-end")],WD=[re("exclusive-gateway"),re("parallel-gateway"),re("inclusive-gateway"),re("complex-gateway"),re("event-based-gateway")],UD=[re("transaction"),re("event-subprocess"),re("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),re("collapsed-subprocess")],YD=[re("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),re("transaction"),re("event-subprocess"),re("collapsed-ad-hoc-subprocess")],tw=[re("transaction"),re("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),re("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),re("event-subprocess")],qD=tw,nw=[re("task"),re("user-task"),re("service-task"),re("send-task"),re("receive-task"),re("manual-task"),re("rule-task"),re("script-task"),re("call-activity"),re("collapsed-subprocess"),re("expanded-subprocess"),re("collapsed-ad-hoc-subprocess"),re("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],KD=[re("data-store-reference")],XD=[re("data-object-reference")],ZD=[re("message-boundary"),re("timer-boundary"),re("escalation-boundary"),re("conditional-boundary"),re("error-boundary"),re("cancel-boundary"),re("signal-boundary"),re("compensation-boundary"),re("non-interrupting-message-boundary"),re("non-interrupting-timer-boundary"),re("non-interrupting-escalation-boundary"),re("non-interrupting-conditional-boundary"),re("non-interrupting-signal-boundary")],QD=[re("message-start"),re("timer-start"),re("conditional-start"),re("signal-start"),re("error-start"),re("escalation-start"),re("compensation-start"),re("non-interrupting-message-start"),re("non-interrupting-timer-start"),re("non-interrupting-conditional-start"),re("non-interrupting-signal-start"),re("non-interrupting-escalation-start")],JD=[{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"}],eL=[re("expanded-pool"),re("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],tL={"bpmn:MessageEventDefinition":[re("message-start"),re("message-intermediate-catch"),re("message-intermediate-throw"),re("message-end")],"bpmn:TimerEventDefinition":[re("timer-start"),re("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[re("conditional-start"),re("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[re("signal-start"),re("signal-intermediate-catch"),re("signal-intermediate-throw"),re("signal-end")],"bpmn:ErrorEventDefinition":[re("error-start"),re("error-end")],"bpmn:EscalationEventDefinition":[re("escalation-start"),re("escalation-intermediate-throw"),re("escalation-end")],"bpmn:CompensateEventDefinition":[re("compensation-start"),re("compensation-intermediate-throw"),re("compensation-end")]};const iw={"start-event-non-interrupting":`
315
+ </svg>`},cD=900;function da(e,t,n,i){e.registerProvider(cD,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">${w_.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 lD=["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 z(lD,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:w_[o],action:function(){t.trigger(e,o),i.close()}}}),r};function Ql(e){fi.call(this,e)}Ql.$inject=["eventBus"],Ee(Ql,fi),Ql.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=nt(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=bc(n),n.length<2?!1:n})};const uD={__depends__:[_O,Dx,Ld],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",da],alignElementsMenuProvider:["type",vs],bpmnAlignElements:["type",Ql]};function lr(e,t,n,i){oe.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=Pu(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});z(u,function(f,p){Ne(l)&&(f=f.filter(function(d){return kt(l,Mo({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)})}lr.$inject=["eventBus","elementRegistry","modeling","rules"],Ee(lr,oe),lr.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Ie(Zt(e)),o=Ie(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),wc(W({},o,a))},lr.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(pD(i,t)){var r=fD(Si(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},lr.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},lr.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},lr.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function pD(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function fD(e,t){var n="";return e=Ie(e),t=Ie(t),e.top>t.top&&(n=n.concat("n")),e.right<t.right&&(n=n.concat("w")),e.bottom<t.bottom&&(n=n.concat("s")),e.left>t.left&&(n=n.concat("e")),n}function Jl(e){e.invoke(lr,this)}Jl.$inject=["injector"],Ee(Jl,lr),Jl.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){fi.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}bs.$inject=["eventBus"],Ee(bs,fi),bs.prototype.canResize=function(e,t){return!1};function eu(e,t){bs.call(this,e),this._modeling=t}Ee(eu,bs),eu.$inject=["eventBus","modeling"],eu.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 z(e,function(i){if(S(i,"bpmn:Lane")||Je(i)){n=!1;return}}),n};const dD={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Jl],bpmnAutoResizeProvider:["type",eu]};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++)hD(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 hD(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=so(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const gD={__depends__:[ir],__init__:["autoScroll"],autoScroll:["type",ha]};var E_="djs-bendpoint",S_="djs-segment-dragger";function mD(e,t){var n=so(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 Id(e,t,n){var i=mD(e,n),r=Xp(t,i);return r}function Bd(e,t){var n=De("g");ut(n).add(E_),Ue(e,n);var i=De("circle");Se(i,{cx:0,cy:0,r:4}),ut(i).add("djs-visual"),Ue(n,i);var r=De("circle");return Se(r,{cx:0,cy:0,r:10}),ut(r).add("djs-hit"),Ue(n,r),t&&ut(n).add(t),n}function yD(e,t,n,i){var r=De("g");Ue(e,r);var o=18,a=6,s=11,c=bD(t,n,i),l=a+s,u=De("rect");Se(u,{x:-o/2,y:-a/2,width:o,height:a}),ut(u).add("djs-visual"),Ue(r,u);var f=De("rect");return Se(f,{x:-c/2,y:-l/2,width:c,height:l}),ut(f).add("djs-hit"),Ue(r,f),Wm(r,i==="v"?90:0),r}function R_(e,t,n){var i=De("g"),r=Rp(t,n),o=Zi(t,n);return Ue(e,i),yD(i,t,n,o),ut(i).add(S_),ut(i).add(o==="h"?"horizontal":"vertical"),wn(i,r.x,r.y),i}function Nd(e){return Math.abs(Math.round(e*2/3))}function vD(e,t){var n=xD(e,t);return nf(e,n)}function bD(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Nd(n==="h"?i:r)}function xD(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=ky(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function C_(e,t,n,i,r){function o(m,v,w){var R=m.index,P=m.point,T,N,k,D,H,Q;return R<=0||m.bendpoint?!1:(T=v[R-1],N=v[R],k=Rp(T,N),D=Zi(T,N),H=Math.abs(P.x-k.x),Q=Math.abs(P.y-k.y),D&&H<=w&&Q<=w)}function a(m,v){var w=m.waypoints,R,P,T,N;return v.index<=0||v.bendpoint||(R={start:w[v.index-1],end:w[v.index]},P=Zi(R.start,R.end),!P)?null:(P==="h"?T=R.end.x-R.start.x:T=R.end.y-R.start.y,N=Nd(T)/2,N)}function s(m,v){var w=v.waypoints,R=Id(t,w,m),P;if(R){P=a(v,R);var T;if(o(R,w,P)?T=r.start(m,v,R.index):T=i.start(m,v,R.index,!R.bendpoint),T!==!1)return!0}}function c(m,v,w){Ge.bind(m,v,function(R){n.triggerMouseEvent(v,R,w),R.stopPropagation()})}function l(m,v){var w=t.getLayer("overlays"),R=Rt('.djs-bendpoints[data-element-id="'+ds(m.id)+'"]',w);return!R&&v&&(R=De("g"),Se(R,{"data-element-id":m.id}),ut(R).add("djs-bendpoints"),Ue(w,R),c(R,"mousedown",m),c(R,"click",m),c(R,"dblclick",m)),R}function u(m,v){return Rt('.djs-segment-dragger[data-segment-idx="'+m+'"]',v)}function f(m,v){v.waypoints.forEach(function(w,R){var P=Bd(m);Ue(m,P),wn(P,w.x,w.y)}),Bd(m,"floating")}function p(m,v){for(var w=v.waypoints,R,P,T,N=1;N<w.length;N++)R=w[N-1],P=w[N],Zi(R,P)&&(T=R_(m,R,P),Se(T,{"data-segment-idx":N}),c(T,"mousemove",v))}function d(m){z(gc("."+E_,m),function(v){an(v)})}function g(m){z(gc("."+S_,m),function(v){an(v)})}function h(m){var v=l(m);return v||(v=l(m,!0),f(v,m),p(v,m)),v}function y(m){var v=l(m);v&&(g(v),d(v),p(v,m),f(v,m))}function M(m,v){var w=Rt(".floating",m),R=v.point;w&&(wn(w,R.x,R.y),ut(w).add("positioned"))}function _(m,v,w){var R=u(v.index,m),P=w[v.index-1],T=w[v.index],N=v.point,k=Rp(P,T),D=Zi(P,T),H,Q;R&&(H=_D(R),Q={x:N.x-k.x,y:N.y-k.y},D==="v"&&(Q={x:Q.y,y:Q.x}),wn(H,Q.x,Q.y))}e.on("connection.changed",function(m){y(m.element)}),e.on("connection.remove",function(m){var v=l(m.element);v&&an(v)}),e.on("element.marker.update",function(m){var v=m.element,w;v.waypoints&&(w=h(v),m.add?ut(w).add(m.marker):ut(w).remove(m.marker))}),e.on("element.mousemove",function(m){var v=m.element,w=v.waypoints,R,P;if(w){if(R=l(v,!0),P=Id(t,w,m.originalEvent),!P)return;M(R,P),P.bendpoint||_(R,P,w)}}),e.on("element.mousedown",function(m){if(Pr(m)){var v=m.originalEvent,w=m.element;if(w.waypoints)return s(v,w)}}),e.on("selection.changed",function(m){var v=m.newSelection,w=v[0];w&&w.waypoints&&h(w)}),e.on("element.hover",function(m){var v=m.element;v.waypoints&&h(v)}),e.on("element.out",function(m){var v=m.element;if(v.waypoints){var w=l(v);if(w){var R=Rt(".floating",w);R&&ut(R).remove("positioned")}}}),e.on("element.updateId",function(m){var v=m.element,w=m.newId;if(v.waypoints){var R=l(v);R&&Se(R,{"data-element-id":w})}}),this.addHandles=h,this.updateHandles=y,this.getBendpointsContainer=l,this.getSegmentDragger=u}C_.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function _D(e){return Rt(".djs-visual",e)}var M_=Math.round,mo="reconnectStart",yo="reconnectEnd",xs="updateWaypoints";function $d(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,g;!l&&c===0?g=mo:!l&&c===d.length-1?g=yo:g=xs;var h=g===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:g}}})},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 g=p===xs?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(g,{connection:c,source:p===mo?f:l,target:p===yo?f:u}),d){s.source=p===mo?f:l,s.target=p===yo?f:u;return}d===!1&&(d=s.allowed=r.allowed(g,{connection:c,source:p===yo?f:u,target:p===mo?f:l})),d&&(s.source=p===yo?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,g=s.target,h=s.type,y=s.hints||{},M={x:M_(a.x),y:M_(a.y)};if(!c)return!1;h===xs?(f?p.splice(l,0,M):p[l]=M,y.bendpointMove={insert:f,bendpointIndex:l},p=this.cropWaypoints(u,p),o.updateWaypoints(u,AC(p),y)):(h===mo?(y.docking="source",tu(s)&&(y.docking="target",y.newWaypoints=p.reverse())):h===yo&&(y.docking="target",tu(s)&&(y.docking="source",y.newWaypoints=p.reverse())),o.reconnect(u,d,g,M,y))},this)}$d.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],$d.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};function tu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===mo)return t&&i&&t===i&&n!==i;if(r===yo)return t&&n&&t===n&&n!==i}var wD="reconnectStart",ED="reconnectEnd",A_="updateWaypoints",_s="connect-ok",nu="connect-not-ok",P_="connect-hover",T_="djs-updating",k_="djs-dragging",O_=1100;function D_(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=Bd(i.getLayer("overlays"));ut(p).add("djs-dragging"),i.addMarker(c,k_),i.addMarker(c,T_)}),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,P_),l===A_)return;s?(i.removeMarker(c,nu),i.addMarker(c,_s)):s===!1&&(i.removeMarker(c,_s),i.addMarker(c,nu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],O_,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,P_),i.removeMarker(s,c?_s:nu))}),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,g=p.target,h=p.waypoints.slice(),y={x:o.x,y:o.y},M=a.hints||{},_={};r&&(M.connectionStart&&(_.connectionStart=M.connectionStart),M.connectionEnd&&(_.connectionEnd=M.connectionEnd),f===wD?tu(a)?(_.connectionEnd=_.connectionEnd||y,_.source=g,_.target=u||d,h=h.reverse()):(_.connectionStart=_.connectionStart||y,_.source=u||d,_.target=g):f===ED?tu(a)?(_.connectionStart=_.connectionStart||y,_.source=u||g,_.target=d,h=h.reverse()):(_.connectionEnd=_.connectionEnd||y,_.source=d,_.target=u||g):(_.noCropping=!0,_.noLayout=!0,h[c]=y),f===A_&&(h=e.cropWaypoints(p,h)),_.waypoints=h,r.drawPreview(a,s,_)),wn(l,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],O_,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,T_),i.removeMarker(s,k_),l&&(i.removeMarker(l,_s),i.removeMarker(l,u?_s:nu)),r&&r.cleanUp(a)})}D_.$inject=["bendpointMove","injector","eventBus","canvas"];var L_="connect-hover",I_="djs-updating";function B_(e,t,n){return Fd(e,t,e[t]+n)}function Fd(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function SD(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 Fd(t,i,s)}function N_(e){return e==="x"?"y":"x"}function $_(e,t,n){var i,r;return e.original?e.original:(i=$e(t),r=N_(n),Fd(e,r,i[r]))}function F_(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var g,h=n.getGraphics(p),y=d-1,M=d,_=p.waypoints,m=_[y],v=_[M],w=Id(n,_,f),R,P,T;if(R=Zi(m,v),!!R)return P=R==="v"?"x":"y",y===0&&(m=$_(m,p.source,P)),M===_.length-1&&(v=$_(v,p.target,P)),w?T=w.point:T={x:(m.x+v.x)/2,y:(m.y+v.y)/2},g={connection:p,segmentStartIndex:y,segmentEndIndex:M,segmentStart:m,segmentEnd:v,axis:P,dragPosition:T},i.init(f,T,"connectionSegment.move",{cursor:P==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:h,context:g}})};function s(f,p){if(!a)return p;var d=f.waypoints,g;return f.waypoints=p,g=a.getCroppedWaypoints(f),f.waypoints=d,g}function c(f){r.update("connection",f.connection,f.connectionGfx)}function l(f,p,d){var g=f.newWaypoints,h=f.segmentStartIndex+p,y=g[h],M=f.segmentEndIndex+p,_=g[M],m=N_(f.axis),v=SD(d,y,_,m);wn(f.draggerGfx,v.x,v.y)}function u(f,p){var d=0,g=f.filter(function(h,y){return Sp(f[y-1],f[y+1],h)?(d=y<=p?d-1:d,!1):!0});return{waypoints:g,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,g=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=R_(g,p.segmentStart,p.segmentEnd),ut(p.draggerGfx).add("djs-dragging"),n.addMarker(d,I_)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,g=p.segmentStartIndex,h=p.segmentEndIndex,y=p.segmentStart,M=p.segmentEnd,_=p.axis,m=p.originalWaypoints.slice(),v=B_(y,_,f["d"+_]),w=B_(M,_,f["d"+_]),R=m.length,P=0;m[g]=v,m[h]=w;var T,N;g<2&&(T=_n(d.source,v),g===1?T==="intersect"&&(m.shift(),m[0]=v,P--):T!=="intersect"&&(m.unshift(y),P++)),h>R-3&&(N=_n(d.target,w),h===R-2?N==="intersect"&&(m.pop(),m[m.length-1]=w):N!=="intersect"&&m.push(M)),p.newWaypoints=d.waypoints=s(d,m),l(p,P,f),p.newSegmentStartIndex=g+P,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,L_)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,L_)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&an(p.draggerGfx),n.removeMarker(d,I_)}),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,g=p.newWaypoints,h=p.newSegmentStartIndex;g=g.map(function(w){return{original:w.original,x:Math.round(w.x),y:Math.round(w.y)}});var y=u(g,h),M=y.waypoints,_=s(d,M),m=y.segmentOffset,v={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:h+m}};o.updateWaypoints(d,_,v)})}F_.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var RD=Math.abs,j_=Math.round;function CD(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],RD(r-e)<=n)return r}function H_(e){return{x:e.x,y:e.y}}function z_(e){return{x:e.x+e.width,y:e.y+e.height}}function mi(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:j_(e.x+e.width/2),y:j_(e.y+e.height/2)}}function ga(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 G_(e){return e.children||[]}var MD=Math.abs,V_=Math.round,jd=10;function W_(e){function t(o,a){if(Ne(o)){for(var s=o.length;s--;)if(MD(o[s]-a)<=jd)return o[s]}else{o=+o;var c=a%o;if(c<jd)return a-c;if(c>o-jd)return a-c+o}return a}function n(o,a){if(o.waypoints)return vD(a,o);if(o.width)return{x:V_(o.width/2+o.x),y:V_(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,l=c.waypoints,u=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,g=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:[]},z(h,function(y){y&&(y=y.original||y,g==="y"&&s.horizontal.push(y.y),g==="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:[]},z(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);!Mt(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 g=u-p,h=f-d;W(o,{dx:o.dx-g,dy:o.dy-h,x:o.x-g,y:o.y-h}),(g||s.vertical.indexOf(u)!==-1)&&tn(o,"x",p),(h||s.horizontal.indexOf(f)!==-1)&&tn(o,"y",d)}})}W_.$inject=["eventBus"];const AD={__depends__:[ir,ji],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",C_],bendpointMove:["type",$d],bendpointMovePreview:["type",D_],connectionSegmentMove:["type",F_],bendpointSnapping:["type",W_]};function U_(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,g={connectionStart:Hd(s)?u:l,connectionEnd:Hd(s)?l:u};pn(c)&&(d=c),s.connection=n.connect(f,p,d,g)}),this.start=function(a,s,c,l){pn(c)||(l=c,c=$e(s)),t.init(a,"connect",{autoActivate:l,data:{shape:s,context:{start:s,connectionStart:c}}})}}U_.$inject=["eventBus","dragging","modeling","rules"];function Hd(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var PD=1100,TD=900,Y_="connect-ok",q_="connect-not-ok";function K_(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},g=p,h=d;Hd(o)&&(g=d,h=p),i.drawPreview(o,a,{source:c||l,target:f||s,connectionStart:g,connectionEnd:h})}),t.on("connect.hover",TD,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?Y_:q_)}),t.on(["connect.out","connect.cleanup"],PD,function(r){var o=r.hover;o&&(n.removeMarker(o,Y_),n.removeMarker(o,q_))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}K_.$inject=["injector","eventBus","canvas"];const zd={__depends__:[di,ji,ir],__init__:["connectPreview"],connect:["type",U_],connectPreview:["type",K_]};var kD="djs-dragger";function ur(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)}ur.$inject=["injector","canvas","graphicsFactory","elementFactory"],ur.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,g=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),mc(i),r||(r=e.getConnection=OD(function(h,y,M){return g.getConnection(h,y,M)})),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?$e(o):c,a?$e(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)"})},ur.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||$e(n),o=t.connectionEnd||$e(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);Ue(e,s)},ur.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]},ur.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&an(e.connectionPreviewGfx)},ur.prototype.getConnection=function(e){var t=DD(e);return this._elementFactory.createConnection(t)},ur.prototype.createConnectionPreviewGfx=function(){var e=De("g");return Se(e,{pointerEvents:"none"}),ut(e).add(kD),Ue(this._canvas.getActiveLayer(),e),e},ur.prototype.createNoopConnection=function(e,t){return ka([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function OD(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 pn(e)?e:{}}const LD={__init__:["connectionPreview"],connectionPreview:["type",ur]},iu="complex-preview";class X_{constructor(t,n,i){this._canvas=t,this._graphicsFactory=n,this._previewSupport=i,this._markers=[]}create(t){this.cleanUp();const{created:n=[],moved:i=[],removed:r=[],resized:o=[]}=t,a=this._canvas.getLayer(iu);n.filter(s=>!ID(s)).forEach(s=>{let c;Mt(s)?(c=this._graphicsFactory._createContainer("connection",De("g")),this._graphicsFactory.drawConnection(ro(c),s)):(c=this._graphicsFactory._createContainer("shape",De("g")),this._graphicsFactory.drawShape(ro(c),s),wn(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);Mt(s)?wn(l,c.x,c.y):wn(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",De("g"));this._graphicsFactory.drawShape(ro(l),s,{width:c.width,height:c.height}),wn(l,c.x,c.y),this._previewSupport.addDragger(s,a,l)})}cleanUp(){mc(this._canvas.getLayer(iu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(iu)}hide(){this._canvas.hideLayer(iu)}}X_.$inject=["canvas","graphicsFactory","previewSupport"];function ID(e){return e.hidden}const BD={__depends__:[ra],__init__:["complexPreview"],complexPreview:["type",X_]},Z_=Math.round;function ru(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}ru.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,l=o.createShape(W({type:t},n)),u=a.fire("autoPlace",{source:e,shape:l});if(!u)return;W(l,{x:u.x-Z_(l.width/2),y:u.y-Z_(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))})},ru.prototype.cleanUp=function(){this._complexPreview.cleanUp()},ru.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const ND={__depends__:[Pl,BD,pd],__init__:["appendPreview"],appendPreview:["type",ru]};var Q_=Math.min,J_=Math.max;function Gd(e){e.preventDefault()}function ws(e){e.stopPropagation()}function $D(e){return e.nodeType===Node.TEXT_NODE}function FD(e){return[].slice.call(e)}function Mi(e){this.container=e.container,this.parent=Lt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Rt("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Bn(this.autoResize,this),this.handlePaste=Bn(this.handlePaste,this)}Mi.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,Ge.bind(a,"keydown",this.keyHandler),Ge.bind(a,"mousedown",ws),Ge.bind(a,"paste",r.handlePaste),Ge.bind(a,"focusout",this.focusoutHandler),i.autoResize&&Ge.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},Mi.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)}},Mi.prototype.insertText=function(e){e=jD(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},Mi.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=FD(a.childNodes),c,l;if($D(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(g,h){h===p?g.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>p&&h<=d&&Li(g)}),c=n,l=r+e.length}c&&l!==void 0&&setTimeout(function(){self.setSelection(c,l)})},Mi.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})}},Mi.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=Lt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,l,u,f=function(g){Gd(g),ws(g),s=g.clientX,c=g.clientY;var h=t.getBoundingClientRect();l=h.width,u=h.height,Ge.bind(document,"mousemove",p),Ge.bind(document,"mouseup",d)},p=function(g){Gd(g),ws(g);var h=Q_(J_(l+g.clientX-s,i),o),y=Q_(J_(u+g.clientY-c,r),a);t.style.width=h+"px",t.style.height=y+"px",e.resizeHandler({width:l,height:u,dx:g.clientX-s,dy:g.clientY-c})},d=function(g){Gd(g),ws(g),Ge.unbind(document,"mousemove",p,!1),Ge.unbind(document,"mouseup",d,!1)};Ge.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)},Mi.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Ge.unbind(t,"keydown",this.keyHandler),Ge.unbind(t,"mousedown",ws),Ge.unbind(t,"input",this.autoResize),Ge.unbind(t,"paste",this.handlePaste),Ge.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),Li(n)),Li(e)},Mi.prototype.getValue=function(){return this.content.innerText.trim()},Mi.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},Mi.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 jD(e){return e.replace(/\r\n|\r|\n/g,`
316
+ `)}function Xn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Mi({container:t.getContainer(),keyHandler:Bn(this._handleKey,this),resizeHandler:Bn(this._handleResize,this),focusoutHandler:Bn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Xn.$inject=["eventBus","canvas"],Xn.prototype.registerProvider=function(e){this._providers.push(e)},Xn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Xn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Xn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Xn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Xn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Xn.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()}},Xn.prototype.getValue=function(){return this._textbox.getValue()},Xn.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()},Xn.prototype._handleResize=function(e){this._fire("resize",e)},Xn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Xn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=kt(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 ew={__depends__:[ol],__init__:["directEditing"],directEditing:["type",Xn]};function HD(e){return function(t){var n=t.target,i=ae(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===st(e);return!o||!a||!s||!c}}const zD={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 re(e,t={}){var n=zD[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var GD=[re("none-start-event",{actionName:"replace-with-none-start"}),re("none-intermediate-throwing"),re("none-end-event",{actionName:"replace-with-none-end"}),re("message-start"),re("timer-start"),re("conditional-start"),re("signal-start")],VD=[re("none-start-event",{actionName:"replace-with-none-start"}),re("none-intermediate-throwing"),re("none-end-event",{actionName:"replace-with-none-end"})],WD=[re("none-start-event",{actionName:"replace-with-none-start"}),re("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),re("none-end-event",{actionName:"replace-with-none-end"}),re("message-intermediate-catch"),re("message-intermediate-throw"),re("timer-intermediate-catch"),re("escalation-intermediate-throw"),re("conditional-intermediate-catch"),re("link-intermediate-catch"),re("link-intermediate-throw"),re("compensation-intermediate-throw"),re("signal-intermediate-catch"),re("signal-intermediate-throw")],UD=[re("none-start-event",{actionName:"replace-with-none-start"}),re("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),re("none-end-event",{actionName:"replace-with-none-end"}),re("message-end"),re("escalation-end"),re("error-end"),re("cancel-end"),re("compensation-end"),re("signal-end"),re("terminate-end")],YD=[re("exclusive-gateway"),re("parallel-gateway"),re("inclusive-gateway"),re("complex-gateway"),re("event-based-gateway")],qD=[re("transaction"),re("event-subprocess"),re("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),re("collapsed-subprocess")],KD=[re("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),re("transaction"),re("event-subprocess"),re("collapsed-ad-hoc-subprocess")],tw=[re("transaction"),re("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),re("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),re("event-subprocess")],XD=tw,nw=[re("task"),re("user-task"),re("service-task"),re("send-task"),re("receive-task"),re("manual-task"),re("rule-task"),re("script-task"),re("call-activity"),re("collapsed-subprocess"),re("expanded-subprocess"),re("collapsed-ad-hoc-subprocess"),re("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],ZD=[re("data-store-reference")],QD=[re("data-object-reference")],JD=[re("message-boundary"),re("timer-boundary"),re("escalation-boundary"),re("conditional-boundary"),re("error-boundary"),re("cancel-boundary"),re("signal-boundary"),re("compensation-boundary"),re("non-interrupting-message-boundary"),re("non-interrupting-timer-boundary"),re("non-interrupting-escalation-boundary"),re("non-interrupting-conditional-boundary"),re("non-interrupting-signal-boundary")],eL=[re("message-start"),re("timer-start"),re("conditional-start"),re("signal-start"),re("error-start"),re("escalation-start"),re("compensation-start"),re("non-interrupting-message-start"),re("non-interrupting-timer-start"),re("non-interrupting-conditional-start"),re("non-interrupting-signal-start"),re("non-interrupting-escalation-start")],tL=[{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"}],nL=[re("expanded-pool"),re("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],iL={"bpmn:MessageEventDefinition":[re("message-start"),re("message-intermediate-catch"),re("message-intermediate-throw"),re("message-end")],"bpmn:TimerEventDefinition":[re("timer-start"),re("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[re("conditional-start"),re("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[re("signal-start"),re("signal-intermediate-catch"),re("signal-intermediate-throw"),re("signal-end")],"bpmn:ErrorEventDefinition":[re("error-start"),re("error-end")],"bpmn:EscalationEventDefinition":[re("escalation-start"),re("escalation-intermediate-throw"),re("escalation-end")],"bpmn:CompensateEventDefinition":[re("compensation-start"),re("compensation-intermediate-throw"),re("compensation-end")]};const iw={"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 yi(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()}yi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],yi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},yi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Ne(e)||!n.allowed("shape.replace",{element:e}))return{};var a=FD(e);return S(t,"bpmn:DataObjectReference")?this._createEntries(e,KD):S(t,"bpmn:DataStoreReference")&&!S(e.parent,"bpmn:Collaboration")?this._createEntries(e,XD):(S(t,"bpmn:Event")&&!S(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=tL[r]||[],!Tn(t.$parent)&&S(t.$parent,"bpmn:SubProcess")&&(i=nt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),S(t,"bpmn:StartEvent")&&!S(t.$parent,"bpmn:SubProcess")?(o=nt(HD.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Participant")?(o=nt(eL,function(c){return st(e)!==c.target.isExpanded}),this._createEntries(e,o)):S(t,"bpmn:StartEvent")&&Tn(t.$parent)?(o=nt(QD.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=nt(zD.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:EndEvent")?(o=nt(VD.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=nt(ZD,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=nt(GD.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Gateway")?(o=nt(WD,a),this._createEntries(e,o)):S(t,"bpmn:Transaction")?(o=nt(tw,a),this._createEntries(e,o)):Tn(t)&&st(e)?(o=nt(qD,a),this._createEntries(e,o)):S(t,"bpmn:AdHocSubProcess")&&st(e)?(o=nt(YD,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&st(e)?(o=nt(UD,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&!st(e)?(o=nt(nw,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,JD):S(t,"bpmn:FlowNode")?(o=nt(nw,a),this._createEntries(e,o)):{})},yi.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)}),Uy(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},yi.prototype._createEntries=function(e,t){var n={},i=this;return z(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},yi.prototype._createSequenceFlowEntries=function(e,t){var n=ae(e),i={},r=this._modeling,o=this._moddle,a=this;return z(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},yi.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}},yi.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=ae(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"}}}},yi.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}}},yi.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}}},yi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ae(e),i=this,r=Yy(e),o=S(e,"bpmn:BoundaryEvent")?iw["intermediate-event-non-interrupting"]:iw["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 nL={__depends__:[Ld,db,Pl],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",yi]};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 Ne(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(g,v){r.start(g,v)}function d(g,v){n.removeElements([v])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(g){var v=5,w=t.getPad(g).html,R=w.getBoundingClientRect(),P={x:R.left,y:R.bottom+v};return P}function y(g,v,w,R){function P(k,D){var H=i.createShape(W({type:g},R));o.start(k,H,{source:D})}var T=s?function(k,D){var H=i.createShape(W({type:g},R));s.append(D,H)}:P,N=s?function(k,D){return l.create(D,g,R),()=>{l.cleanUp()}}:null;return{group:"model",className:v,title:w,action:{dragstart:P,click:T,hover:N}}}function C(g){return function(v,w){n.splitLane(w,g),t.open(w,!0)}}if(tt(f,["bpmn:Lane","bpmn:Participant"])&&st(e)){var _=Mr(e);W(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(g,v){n.addLane(v,"top")}}}}),_.length<2&&((dn(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:C(2)}}}),(dn(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:C(3)}}})),W(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(g,v){n.addLane(v,"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"})}):rw(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&&!rw(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(g,v){var w=W(h(v),{cursor:{x:g.x,y:g.y}});a.open(v,"bpmn-replace",w,{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"))}),tt(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}}}),tt(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 rw(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return z(o,function(a){a.$type===n&&(r=!0)}),i&&r}const iL={__depends__:[ID,ew,Dx,di,zd,sl,nL],__init__:["contextPadProvider"],contextPadProvider:["type",Es]};var rL={horizontal:["x","width"],vertical:["y","height"]},ow=5;function pr(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Ne(i)?i:i?n:[]})}pr.$inject=["modeling","rules"],pr.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},pr.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},pr.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(z(t,function(o){r=o(r,n,i)}),r):e},pr.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 z(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},pr.prototype._setOrientation=function(e){var t=rL[e];this._axis=t[0],this._dimension=t[1]},pr.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)},pr.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+ow,max:t+n-ow}};const oL={__init__:["distributeElements"],distributeElements:["type",pr]};function ou(e){fi.call(this,e)}ou.$inject=["eventBus"],Ee(ou,fi),ou.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=nt(t,function(n){var i=tt(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=bc(t),t.length<3?!1:t})};var aw={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function yi(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()}yi.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],yi.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},yi.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Ne(e)||!n.allowed("shape.replace",{element:e}))return{};var a=HD(e);return S(t,"bpmn:DataObjectReference")?this._createEntries(e,ZD):S(t,"bpmn:DataStoreReference")&&!S(e.parent,"bpmn:Collaboration")?this._createEntries(e,QD):(S(t,"bpmn:Event")&&!S(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=iL[r]||[],!Tn(t.$parent)&&S(t.$parent,"bpmn:SubProcess")&&(i=nt(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),S(t,"bpmn:StartEvent")&&!S(t.$parent,"bpmn:SubProcess")?(o=nt(GD.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Participant")?(o=nt(nL,function(c){return st(e)!==c.target.isExpanded}),this._createEntries(e,o)):S(t,"bpmn:StartEvent")&&Tn(t.$parent)?(o=nt(eL.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=nt(VD.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:EndEvent")?(o=nt(UD.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=nt(JD,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=nt(WD.concat(i),a),this._createEntries(e,o)):S(t,"bpmn:Gateway")?(o=nt(YD,a),this._createEntries(e,o)):S(t,"bpmn:Transaction")?(o=nt(tw,a),this._createEntries(e,o)):Tn(t)&&st(e)?(o=nt(XD,a),this._createEntries(e,o)):S(t,"bpmn:AdHocSubProcess")&&st(e)?(o=nt(KD,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&st(e)?(o=nt(qD,a),this._createEntries(e,o)):S(t,"bpmn:SubProcess")&&!st(e)?(o=nt(nw,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,tL):S(t,"bpmn:FlowNode")?(o=nt(nw,a),this._createEntries(e,o)):{})},yi.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)}),Uy(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},yi.prototype._createEntries=function(e,t){var n={},i=this;return z(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},yi.prototype._createSequenceFlowEntries=function(e,t){var n=ae(e),i={},r=this._modeling,o=this._moddle,a=this;return z(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},yi.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}},yi.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=ae(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"}}}},yi.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}}},yi.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}}},yi.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ae(e),i=this,r=Yy(e),o=S(e,"bpmn:BoundaryEvent")?iw["intermediate-event-non-interrupting"]:iw["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 rL={__depends__:[Ld,db,Pl],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",yi]};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 g=d.context,h=g.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 Ne(t)?Zr(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,g()),u;var f=e.businessObject;function p(m,v){r.start(m,v)}function d(m,v){n.removeElements([v])}function g(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(m){var v=5,w=t.getPad(m).html,R=w.getBoundingClientRect(),P={x:R.left,y:R.bottom+v};return P}function y(m,v,w,R){function P(k,D){var H=i.createShape(W({type:m},R));o.start(k,H,{source:D})}var T=s?function(k,D){var H=i.createShape(W({type:m},R));s.append(D,H)}:P,N=s?function(k,D){return l.create(D,m,R),()=>{l.cleanUp()}}:null;return{group:"model",className:v,title:w,action:{dragstart:P,click:T,hover:N}}}function M(m){return function(v,w){n.splitLane(w,m),t.open(w,!0)}}if(tt(f,["bpmn:Lane","bpmn:Participant"])&&st(e)){var _=Mr(e);W(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(m,v){n.addLane(v,"top")}}}}),_.length<2&&((dn(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:M(2)}}}),(dn(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:M(3)}}})),W(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(m,v){n.addLane(v,"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"})}):rw(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&&!rw(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(m,v){var w=W(h(v),{cursor:{x:m.x,y:m.y}});a.open(v,"bpmn-replace",w,{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"))}),tt(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}}}),tt(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,g()),u};function rw(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return z(o,function(a){a.$type===n&&(r=!0)}),i&&r}const oL={__depends__:[ND,ew,Dx,di,zd,sl,rL],__init__:["contextPadProvider"],contextPadProvider:["type",Es]};var aL={horizontal:["x","width"],vertical:["y","height"]},ow=5;function pr(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Ne(i)?i:i?n:[]})}pr.$inject=["modeling","rules"],pr.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},pr.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},pr.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(z(t,function(o){r=o(r,n,i)}),r):e},pr.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 z(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},pr.prototype._setOrientation=function(e){var t=aL[e];this._axis=t[0],this._dimension=t[1]},pr.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)},pr.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+ow,max:t+n-ow}};const sL={__init__:["distributeElements"],distributeElements:["type",pr]};function ou(e){fi.call(this,e)}ou.$inject=["eventBus"],Ee(ou,fi),ou.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=nt(t,function(n){var i=tt(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=bc(t),t.length<3?!1:t})};var aw={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>`},aL=900;function Ss(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",aL,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:aw.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:aw.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const sL={__depends__:[Ld,oL],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ou],distributeElementsMenuProvider:["type",Ss]};var sw="is not a registered action",cL="is already registered";function vi(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}vi.$inject=["eventBus","injector"],vi.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=Ne(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&&(Ne(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)})},vi.prototype.trigger=function(e,t){if(!this._actions[e])throw Vd(e,sw);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},vi.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);z(e,function(i,r){n._registerAction(r,i)})},vi.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Vd(e,cL);this._actions[e]=t},vi.prototype.unregister=function(e){if(!this.isRegistered(e))throw Vd(e,sw);this._actions[e]=void 0},vi.prototype.getActions=function(){return Object.keys(this._actions)},vi.prototype.isRegistered=function(e){return!!this._actions[e]};function Vd(e,t){return new Error(e+" "+t)}const lL={__init__:["editorActions"],editorActions:["type",vi]};function au(e){e.invoke(vi,this)}Ee(au,vi),au.$inject=["injector"],au.prototype._registerDefaultActions=function(e){vi.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=[],C=m.type;h.length&&(y=nt(h,function(_){return!S(_,"bpmn:Lane")}),l.trigger(y,C))}),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(C){return S(C.parent,"bpmn:Collaboration")}):y=n.filter(function(C){return C!==m&&!S(C.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 uL={__depends__:[lL],editorActions:["type",au]};function cw(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;tt(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}cw.$inject=["eventBus"];function yo(e,t){oe.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;Fn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}yo.$inject=["eventBus","gridSnapping","modeling"],Ee(yo,oe),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 pL=2e3;function lw(e,t){e.on(["spaceTool.move","spaceTool.end"],pL,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)}})}lw.$inject=["eventBus","gridSnapping"];const fL={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",yo],gridSnappingSpaceToolBehavior:["type",lw]};var su=10;function Wd(e,t,n){return n||(n="round"),Math[n](e/t)*t}var dL=1200,hL=800;function jr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",hL,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"],dL,function(o){var a=o.originalEvent;if(!(!r.active||a&&Un(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},f=gL(o,l,e);f&&(u.offset=f);var p=mL(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 su},jr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Wd(e,su);var i,r;return t&&t.min&&(i=t.min,ze(i)&&(i=Wd(i+n,su,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,ze(r)&&(r=Wd(r+n,su,"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 mL(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(cu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,l=r.max;return c&&(cu(t)?pw(s)?a.x.max=c.left:a.x.min=c.right:uw(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(cu(t)?pw(s)?a.x.min=l.left:a.x.max=l.right:uw(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function gL(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&ze(s[t])||(s||(s=o.snapOffset={}),ze(s[t])||(s[t]=0),!r)||(n.get(r.id)||(cu(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function cu(e){return e==="x"}function uw(e){return e.indexOf("n")!==-1}function pw(e){return e.indexOf("w")!==-1}const yL={__depends__:[fL],__init__:["gridSnapping"],gridSnapping:["type",jr]};var vL=2e3;function fw(e,t,n){e.on("autoPlace",vL,function(i){var r=i.source,o=$e(r),a=i.shape,s=ox(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")&&(bL(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}fw.$inject=["eventBus","gridSnapping","elementRegistry"];function bL(e){return e==="x"}var xL=1750;function dw(e,t,n){t.on(["create.start","shape.move.start"],xL,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}))}})}dw.$inject=["canvas","eventBus","gridSnapping"];var _L=3e3;function lu(e,t,n){oe.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],_L,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||wL(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}lu.$inject=["eventBus","gridSnapping","modeling"],Ee(lu,oe),lu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=RL(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function wL(e){return e.length>3}function EL(e){return e==="h"}function SL(e){return e==="v"}function RL(e,t,n){var i=Zi(t,n),r={};return EL(i)&&(r.y=e.snapValue(t.y)),SL(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__:[yL,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",fw],gridSnappingParticipantBehavior:["type",dw],gridSnappingLayoutConnectionBehavior:["type",lu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",cw]};var ML=30,hw=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 st(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(S(r,"bpmn:SubProcess"))return st(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=dn(e)?{width:ML,height:e.height}:{width:e.width,height:hw};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:hw}),!0};const AL={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Rs]};function uu(e){e.invoke(sa,this)}Ee(uu,sa),uu.$inject=["injector"],uu.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__:[bd],__init__:["keyboardBindings"],keyboardBindings:["type",uu]};var TL={moveSpeed:1,moveSpeedAccelerated:10},kL=1500,mw="left",gw="up",yw="right",vw="down",OL={ArrowLeft:mw,Left:mw,ArrowUp:gw,Up:gw,ArrowRight:yw,Right:yw,ArrowDown:vw,Down:vw},DL={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 bw(e,t,n,i,r){var o=this;this._config=W({},TL,e||{}),t.addListener(kL,function(a){var s=a.keyEvent,c=OL[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=DL[a](l),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,u)}}}bw.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const LL={__depends__:[bd,di],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",bw]};var xw=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=xA(u,f,l),c.newBounds=wA(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:Ie(u)})}function s(c){var l=c.shape,u=c.canExecute,f=c.newBounds;if(u){if(f=kg(f),!IL(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=Si(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,_w(t,o),"resize",{autoActivate:!0,cursor:BL(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:xw,height:xw},r=vy(t,e.childrenBoxPadding),EA(n,t,i,r)},Cs.$inject=["eventBus","rules","modeling","dragging"];function IL(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function _w(e,t){var n=$e(e),i=Ie(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function BL(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 ww="djs-resizing",Ew="resize-not-ok",NL=500;function Sw(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,ww)),s.width>5&&Se(c,{x:s.x,width:s.width}),s.height>5&&Se(c,{y:s.y,height:s.height}),o.canExecute?ut(c).remove(Ew):ut(c).add(Ew)}function r(o){var a=o.shape,s=o.frame;s&&an(o.frame),t.removeMarker(a,ww)}e.on("resize.move",NL,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Sw.$inject=["eventBus","canvas","previewSupport"];var pu=-6,fu=8,du=20,Ms="djs-resizer",$L=["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&&z(a,Bn(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){Pr(o)&&i.activate(o,e,n)}Ge.bind(t,"mousedown",r),Ge.bind(t,"touchstart",r)},Hr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=FL(i),a=Oe("g");ut(a).add(Ms),ut(a).add(Ms+"-"+e.id),ut(a).add(Ms+"-"+i),Ue(r,a);var s=Oe("rect");Se(s,{x:-fu/2+o.x,y:-fu/2+o.y,width:fu,height:fu}),ut(s).add(Ms+"-visual"),Ue(a,s);var c=Oe("rect");return Se(c,{x:-du/2+o.x,y:-du/2+o.y,width:du,height:du}),ut(c).add(Ms+"-hit"),Ue(a,c),Rc(a,t,n),a},Hr.prototype.createResizer=function(e,t){var n=_w(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Hr.prototype.addResizer=function(e){var t=this;Mt(e)||z($L,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Hr.prototype.removeResizers=function(){var e=this._getResizersParent();gc(e)},Hr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Hr.$inject=["eventBus","canvas","selection","resize"];function FL(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-pu:e.indexOf("w")!==-1&&(t.x=pu),e.indexOf("s")!==-1?t.y=-pu:e.indexOf("n")!==-1&&(t.y=pu),t}const Rw={__depends__:[ji,ir,ia],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Cs],resizePreview:["type",Sw],resizeHandles:["type",Hr]};var jL=2e3;function As(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"],jL,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||tt(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}As.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],As.prototype.activate=function(e){var t=oi(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}),(tt(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Cw(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}},As.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")||GL(e)){var m=dn(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(zL(e)){var y=dn(e),C=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,C),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)"})}(tt(e,["bpmn:Task","bpmn:CallActivity"])||Cw(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"})),HL(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 _=1,g=i.width+2*_;if(n.labelTarget&&(W(o,{width:g,height:i.height+2*_,x:i.x-_,y:i.y-_}),W(d,{fontSize:l+"px",lineHeight:u})),Rr(n)&&!Ac(n)&&!Je(n)){var v=Pp(e),w=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),R=l,P=ro.width*a+2*_;W(o,{width:P,height:R+2*_,x:w.x-P/2,y:w.y-R/2-_}),W(d,{fontSize:l+"px",lineHeight:u})}return S(e,"bpmn:TextAnnotation")&&(W(o,{width:i.width+2*_,height:i.height+2*_,x:i.x-_,y:i.y-_,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}},As.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}),VL(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function Cw(e){return S(e,"bpmn:SubProcess")&&!st(e)}function HL(e){return S(e,"bpmn:SubProcess")&&st(e)}function zL(e){return S(e,"bpmn:Participant")&&!st(e)}function GL(e){return S(e,"bpmn:Participant")&&st(e)}function VL(e){return!e||!e.trim()}var Mw="djs-element-hidden",Aw="djs-label-hidden";function Pw(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=Oe("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=Oe("path");Se(f,{d:u,strokeWidth:2,stroke:WL(o)}),Ue(s,f),Ue(r,s),wn(s,o.x,o.y)}S(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Mw):(S(o,"bpmn:Task")||S(o,"bpmn:CallActivity")||S(o,"bpmn:SubProcess")||S(o,"bpmn:Participant")||S(o,"bpmn:Lane"))&&t.addMarker(o,Aw)}),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}});Se(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,Mw),t.removeMarker(o,Aw)),o=void 0,a=void 0,s&&(an(s),s=void 0)})}Pw.$inject=["eventBus","canvas","pathMap"];function WL(e,t){var n=pt(e);return n.get("stroke")||t||"black"}const UL={__depends__:[qf,Rw,ew],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",As],labelEditingPreview:["type",Pw]};var YL=500,qL=1e3;function Gi(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){wC(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){z(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],YL,function(o){var a=o.element,s=o.gfx,c=Rt(".djs-outline",s);c&&i.updateOutline(a,c)})}Gi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Rt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Ue(t,n),this.updateOutline(e,n)),n},Gi.prototype._createOutlineGfx=function(){var e=Oe("rect");return Se(e,W({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Gi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Gi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&z(i,function(r){n=n||r.updateOutline(t,e)}),n||Se(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Gi.prototype.updateConnectionOutline=function(e,t){var n=Zt(t);Se(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Gi.prototype.registerProvider=function(e,t){t||(t=e,e=qL),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Gi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Gi.prototype.getOutline=function(e){var t,n=this._getProviders();return z(n,function(i){fn(i.getOutline)&&(t=t||i.getOutline(e))}),t},Gi.$inject=["eventBus","styles","elementRegistry"];var hu=6;function Ud(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)})}Ud.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");gc(t);var n=e.length>1,i=this._canvas.getContainer();if(ut(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=KL(Zt(e)),o=Oe("rect");Se(o,W({rx:3},r)),ut(o).add("djs-selection-outline"),Ue(t,o)}},Ud.$inject=["eventBus","canvas","selection"];function KL(e){return{x:e.x-hu,y:e.y-hu,width:e.width+hu*2,height:e.height+hu*2}}const Yd={__depends__:[di],__init__:["outline","multiSelectionOutline"],outline:["type",Gi],multiSelectionOutline:["type",Ud]},Tw=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],kw={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},XL=15,mu=2;function Ow(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=>tt(m,Tw));if(p.length===1){const m=p[0];Je(m)?a(m,m.labelTarget):(d=m.labels)!=null&&d.length&&a(m.labels[0],m)}if(p.length===2){const m=p.find(Je),h=p.find(y=>{var C;return(C=y.labels)==null?void 0:C.includes(m)});m&&h&&a(m,h)}}),e.on("shape.changed",function({element:f}){var p;!tt(f,Tw)||!u(f)||(Je(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=ka([$e(p),$e(f)],kw),m=d.getAttribute("d"),y=r.isSelected(f)?c(f):l(f),C=Ia(y,m);if(!C)return;const g=r.isSelected(p)?c(p):l(p),v=Ia(g,m)||$e(p);Wa(v,C)<XL||(_p(d,[v,C]),Ue(o,d))}function s(){mc(`.${kw.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")-mu,y:f.y+zr(p,"y")-mu,width:zr(p,"width")+mu*2,height:zr(p,"height")+mu*2};return kp(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 ty(m)}}function l(f){return n.getShapePath(f)}function u(f){return r.isSelected(f)}}Ow.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function zr(e,t){return parseFloat(Se(e,t)||0)}const ZL={__depends__:[di,Yd],__init__:["labelLink"],labelLink:["type",Ow]};var QL=new na("tt");function JL(e){var t=Lt('<div class="djs-tooltip-container" />');return Dn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function eI(e,t,n){Dn(e,{left:t+"px",top:n+"px"})}function qd(e,t){e.style.display=t===!1?"none":""}var Dw="djs-tooltip",Kd="."+Dw;function $n(e,t){this._eventBus=e,this._canvas=t,this._ids=QL,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=JL(t.getContainer());var n=this;Gn.bind(this._tooltipRoot,Kd,"mousedown",function(i){i.stopPropagation()}),Gn.bind(this._tooltipRoot,Kd,"mouseover",function(i){n.trigger("mouseover",i)}),Gn.bind(this._tooltipRoot,Kd,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}$n.$inject=["eventBus","canvas"],$n.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},$n.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(An(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},$n.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},$n.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},$n.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)}},$n.prototype.remove=function(e){var t=this.get(e);t&&(Li(t.html),Li(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},$n.prototype.show=function(){qd(this._tooltipRoot)},$n.prototype.hide=function(){qd(this._tooltipRoot,!1)},$n.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},$n.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)),Fn(n)&&(n=Lt(n)),i=Lt('<div data-tooltip-id="'+t+'" class="'+Dw+'">'),Dn(i,{position:"absolute"}),i.appendChild(n),e.type&&$t(i).add("djs-tooltip-"+e.type),e.className&&$t(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},$n.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;eI(n,t.x,t.y)},$n.prototype._updateTooltipVisibilty=function(e){z(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),qd(i,r))})},$n.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 tI={__init__:["tooltips"],tooltips:["type",$n]};var nI="flow elements must be children of pools/participants",iI="Data object must be placed within a pool/participant.";function Lw(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(nI)):S(a,"bpmn:DataObjectReference")&&i(r,n(iI)))})}Lw.$inject=["eventBus","tooltips","translate"];const rI={__depends__:[tI],__init__:["modelingFeedback"],modelingFeedback:["type",Lw]};var oI=500,aI=1250,sI=1500,gu=Math.round;function cI(e){return{x:e.x+gu(e.width/2),y:e.y+gu(e.height/2)}}function Iw(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",sI,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=lI(u),W(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",aI,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=o(l),!u)return!1}),e.on("shape.move.move",oI,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=gu(l.x),l.y=gu(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(Pr(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(pn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!ut(s.target).has("djs-hit-no-move")){var f=cI(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}Iw.$inject=["eventBus","dragging","modeling","selection","rules"];function lI(e){var t=Ro(e,"id");return nt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Bw=499,Xd="djs-dragging",Nw="drop-ok",$w="drop-not-ok",Fw="new-parent",jw="attach-ok";function Hw(e,t,n,i){function r(c){var l=o(c),u=uI(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){[jw,Nw,$w,Fw].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,Xd),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",Bw,function(c){var l=c.context,u=l.shapes,f=l.allDraggedElements,p=r(u);if(!l.dragGroup){var d=Oe("g");Se(d,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();Ue(m,d),l.dragGroup=d}p.forEach(function(h){i.addDragger(h,l.dragGroup)}),f?f=Pu([f,o(u)]):f=o(u),z(f,function(h){t.addMarker(h,Xd)}),l.allDraggedElements=f,l.differentParents=pI(u)}),e.on("shape.move.move",Bw,function(c){var l=c.context,u=l.dragGroup,f=l.target,p=l.shape.parent,d=l.canExecute;f&&(d==="attach"?a(f,jw):l.canExecute&&p&&f.id!==p.id?a(f,Fw):a(f,l.canExecute?Nw:$w)),wn(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;z(u,function(p){t.removeMarker(p,Xd)}),f&&an(f)}),this.makeDraggable=s}Hw.$inject=["eventBus","canvas","styles","previewSupport"];function uI(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=nt(e,function(i){return Mt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function pI(e){return wE(Ro(e,function(t){return t.parent&&t.parent.id}))!==1}const fI={__depends__:[ol,di,Yd,ji,ir,ia],__init__:["move","movePreview"],move:["type",Iw],movePreview:["type",Hw]};var zw=".djs-palette-toggle",Gw=".entry",dI=zw+", "+Gw,Zd="djs-palette-",hI="shown",Qd="open",Vw="two-column",mI=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=mI),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(yI,{})},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=Lt(nn.HTML_MARKUP);n.appendChild(i),$t(n).add(Zd+hI),Gn.bind(i,dI,"click",function(r){var o=r.delegateTarget;if(fp(o,zw))return e.toggle();e.trigger("click",r)}),Ge.bind(i,"mousedown",function(r){r.stopPropagation()}),Gn.bind(i,Gw,"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=$t(n),a=$t(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Vw,r),a.toggle(Zd+Vw,r),"open"in e&&(o.toggle(Qd,e.open),a.toggle(Zd+Qd,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},nn.prototype._update=function(){var e=Rt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();dc(e),z(t,function(n,i){var r=n.group||"default",o=Rt("[data-group="+ds(r)+"]",e);o||(o=Lt('<div class="group"></div>'),An(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Lt(a);if(o.appendChild(s),!n.separator&&(An(s,"data-action",i),n.title&&An(s,"title",n.title),n.className&&gI(s,n.className),n.imageUrl)){var c=Lt("<img>");An(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=An(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(fn(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=Rt(".djs-palette-entries",this._container),this._toolsContainer=Rt("[data-group=tools]",t)),n=this._toolsContainer,z(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=$t(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},nn.prototype.isOpen=function(){return $t(this._container).has(Qd)},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 gI(e,t){var n=$t(e),i=Ne(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function yI(e,t){var n=t.getPaletteEntries();return fn(n)?n(e):(z(n,function(i,r){e[r]=i}),e)}const vI={__init__:["palette"],palette:["type",nn]};var Ww="crosshair",Uw="selected",bI="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=Oe("rect");Se(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Ue(p,d),l(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&Se(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,Uw);for(const y of m)h.has(y)||t.addMarker(y,Uw)}},remove:function(f){this.update(f),f.frame&&an(f.frame),l(!1)}};function l(f){ut(t.getContainer()).toggle(bI,f)}function u(f){var p=i.getAll();return new Set(So(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=Yw(f),p.add=Qc(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=Yw(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(Qc(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:Ww,data:{context:{}},keepSelection:!0})},Gr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Ww,data:{context:{}},keepSelection:!0})},Gr.prototype._select=function(e){this._selection.select(e)},Gr.prototype.select=function(e,t,n=[]){var i=So(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 Yw(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 xI={__depends__:[ll,Za],__init__:["lassoTool"],lassoTool:["type",Gr]};var Jd=1500,qw="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",Jd,function(c){if(qa(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Jd,function(c){if(!(!Kw(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(Jd,function(c){!Kw(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:qw,data:{context:n||{}}})},ma.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:qw,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 Kw(e){return sn("Space",e)}const _I={__depends__:[ll,Za],__init__:["handTool"],handTool:["type",ma]};var Xw="connect-ok",Zw="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?Xw:Zw))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?Xw:Zw)}),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 wI={__depends__:[zd,ji,ir,ll,Za],globalConnect:["type",ga]};function eh(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)}eh.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],eh.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(C){var _=n.createShape(W({type:f},h));t.start(C,_)}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 EI={__depends__:[vI,sl,bb,xI,_I,wI,Ha],__init__:["paletteProvider"],paletteProvider:["type",eh]};var SI=250;function th(e,t,n,i,r){oe.call(this,e);function o(s){var c=s.canExecute.replacements;z(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=Rt('[data-element-id="'+ds(p.id)+'"]',s.dragGroup);m&&Se(m,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;z(c,function(l,u){var f=Rt('[data-element-id="'+ds(u)+'"]',s.dragGroup);f&&Se(f,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",SI,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?o(c):a(c)})}th.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ee(th,oe);const RI={__depends__:[ia],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",th]};var CI=1250,nh=40,MI=20,AI=10,Qw=20,Jw=["x","y"],PI=Math.abs;function e0(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&&Un(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&TI(t,o,LI(o)),o&&DI(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=gi(r),tt(o,["bpmn:Event","bpmn:Gateway"])&&t0(t,gi(o)),tt(o,["bpmn:Task","bpmn:SubProcess"])&&kI(t,o),S(a,"bpmn:BoundaryEvent")&&s===a.host&&OI(t)):n0(i,"bpmn:MessageFlow")?(S(r,"bpmn:Event")&&(n.connectionStart=gi(r)),S(o,"bpmn:Event")&&t0(t,gi(o))):n.connectionStart=n.initialConnectionStart)})}e0.$inject=["eventBus"];function TI(e,t,n){Jw.forEach(function(i){var r=i0(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 kI(e,t){var n=gi(t);Jw.forEach(function(i){II(e,t,i)&&tn(e,i,n[i])})}function OI(e){var t=e.context,n=t.source,i=t.target;if(!BI(t)){var r=gi(n),o=_n(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])<nh&&(c>r[s]?l=r[s]+nh:l=r[s]-nh,tn(e,s,l))})}}function t0(e,t){tn(e,"x",t.x),tn(e,"y",t.y)}function n0(e,t){return e&&e.type===t}function DI(e,t){return hr(t,function(n){return n0(e,n)})}function i0(e,t){return e==="x"?t.width:t.height}function LI(e){return S(e,"bpmn:Task")?AI:MI}function II(e,t,n){return e[n]>t[n]+Qw&&e[n]<t[n]+i0(n,t)-Qw}function BI(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 yu,n.initDefaults(this._defaultSnaps)),n};function yu(){this._snapValues={}}yu.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},yu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&SD(e[n],r[n],i)},yu.prototype.initDefaults=function(e){var t=this;z(e||{},function(n,i){z(n,function(r){t.add(i,r)})})};var NI=1250;function Vi(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"],NI,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Un(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()})}Vi.$inject=["elementRegistry","eventBus","snapping"],Vi.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=gi(i,e):o={x:e.x+gi(i).x,y:e.y+gi(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}),Je(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},Vi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return z(i,function(r){if(Je(r)){Je(t)&&e.add("mid",gi(r));return}if(Mt(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);z(o,function(a){e.add("mid",a)});return}e.add("mid",gi(r))}),!ze(t.x)||!ze(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",gi(t)),e},Vi.prototype.getSnapTargets=function(e,t){return G_(t).filter(function(n){return!$I(n)})};function $I(e){return!!e.hidden}var r0=1500;function ya(e,t){t.invoke(Vi,this),e.on(["create.move","create.end"],r0,zI),e.on(["create.move","create.end","shape.move.move","shape.move.end"],r0,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!ha(n)&&FI(n,o)})}Ee(ya,Vi),ya.$inject=["eventBus","injector"],ya.prototype.initSnap=function(e){var t=Vi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return z(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",a0(o,i,e))}),z(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",a0(o,i,e))}),S(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},ya.prototype.addSnapTargetPoints=function(e,t,n){Vi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);z(i,function(o){(HI(o)||jI([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",H_(o)),e.add("bottom-right",z_(o)))});var r=this._elementRegistry;return z(t.incoming,function(o){if(r.get(t.id)){o0(i,o.source)||e.add("mid",$e(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),z(t.outgoing,function(o){if(r.get(t.id)){o0(i,o.target)||e.add("mid",$e(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 Vi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!S(n,"bpmn:Lane")})};function FI(e,t){var n=Ie(t),i=mv(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=$e(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 jI(e,t){return e.every(function(n){return S(n,t)})}function HI(e){return S(e,"bpmn:SubProcess")&&st(e)?!0:S(e,"bpmn:Participant")}function zI(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 o0(e,t){return e.indexOf(t)!==-1}function a0(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var GI=1250;function Ps(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],GI,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Un(i.originalEvent))&&!ha(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,o,a,s),l.initialized=!0),UI(s)&&tn(i,"x",i.x),YI(s)&&tn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ps.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=s0(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ps.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return z(r,function(o){e.add("corner",z_(o)),e.add("corner",H_(o))}),e.add("corner",s0(t,i)),e},Ps.$inject=["eventBus","snapping"],Ps.prototype.getSnapTargets=function(e,t){return G_(t).filter(function(n){return!VI(n,e)&&!Mt(n)&&!WI(n)&&!Je(n)})};function s0(e,t){var n=$e(e),i=Ie(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function VI(e,t){return e.host===t}function WI(e){return!!e.hidden}function UI(e){return e==="n"||e==="s"}function YI(e){return e==="e"||e==="w"}var qI=7,KI=1e3;function Wr(e){this._canvas=e,this._asyncHide=ku(Bn(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")};z(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(z(["x","y"],function(l){var u;o[l]||(u=t.snap(c,a,l,qI),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),z(["x","y"],function(a){var s=o[a];pn(s)&&tn(e,a,s.originValue)})},Wr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Oe("path");return Se(n,{d:"M0,0 L0,0"}),ut(n).add("djs-snap-line"),Ue(t,n),{update:function(i){ze(i)?e==="horizontal"?Se(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Se(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Se(n,{display:"none"})}}},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(){z(this._snapLines,function(e){e.update()})};const XI={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Vi],resizeSnapping:["type",Ps],snapping:["type",Wr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",e0],createMoveSnapping:["type",ya]};var c0=300;function Ye(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=Rt(Ye.INPUT_SELECTOR,this._container),this._resultsContainer=Rt(Ye.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ye.$inject=["canvas","eventBus","selection","translate"],Ye.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Gn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ye.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ye.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ye.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ye.INPUT_SELECTOR,"keydown",function(n){sn("ArrowUp",n)&&n.preventDefault(),sn("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ye.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)})},Ye.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Gn.unbind(e.el,e.type,e.listener)})},Ye.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=Rt(Ye.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ye.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ye.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},Ye.prototype._clearResults=function(){dc(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ye.prototype._getCurrentResult=function(){return Rt(Ye.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ye.prototype._createResultNode=function(e,t){var n=Lt(Ye.RESULT_HTML);return e.primaryTokens.length>0&&l0(n,e.primaryTokens,Ye.RESULT_PRIMARY_HTML),l0(n,e.secondaryTokens,Ye.RESULT_SECONDARY_HTML),An(n,Ye.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ye.prototype.registerProvider=function(e){this._searchProvider=e},Ye.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,$t(this._canvas.getContainer()).add("djs-search-open"),$t(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ye.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,$t(this._canvas.getContainer()).remove("djs-search-open"),$t(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ye.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ye.prototype.isOpen=function(){return this._open},Ye.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&$t(t).remove(Ye.RESULT_SELECTED_CLASS);var n=An(e,Ye.RESULT_ID_ATTRIBUTE),i=this._results[n].element;$t(e).add(Ye.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:c0}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ye.prototype._select=function(e){var t=An(e,Ye.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:c0}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ye.prototype._getBoxHtml=function(){const e=Lt(Ye.BOX_HTML),t=Rt(Ye.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function l0(e,t,n){var i=ZI(t),r=Lt(n);r.innerHTML=i,e.appendChild(r)}function ZI(e){var t="";return e.forEach(function(n){var i=yx(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Ye.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ye.CONTAINER_SELECTOR=".djs-search-container",Ye.INPUT_SELECTOR=".djs-search-input input",Ye.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ye.RESULT_SELECTOR=".djs-search-result",Ye.RESULT_SELECTED_CLASS="djs-search-result-selected",Ye.RESULT_SELECTED_SELECTOR="."+Ye.RESULT_SELECTED_CLASS,Ye.RESULT_ID_ATTRIBUTE="data-result-id",Ye.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ye.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
+ </svg>`},cL=900;function Ss(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",cL,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:aw.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:aw.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const lL={__depends__:[Ld,sL],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ou],distributeElementsMenuProvider:["type",Ss]};var sw="is not a registered action",uL="is already registered";function vi(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}vi.$inject=["eventBus","injector"],vi.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=Ne(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&&(Ne(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)})},vi.prototype.trigger=function(e,t){if(!this._actions[e])throw Vd(e,sw);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},vi.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);z(e,function(i,r){n._registerAction(r,i)})},vi.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Vd(e,uL);this._actions[e]=t},vi.prototype.unregister=function(e){if(!this.isRegistered(e))throw Vd(e,sw);this._actions[e]=void 0},vi.prototype.getActions=function(){return Object.keys(this._actions)},vi.prototype.isRegistered=function(e){return!!this._actions[e]};function Vd(e,t){return new Error(e+" "+t)}const pL={__init__:["editorActions"],editorActions:["type",vi]};function au(e){e.invoke(vi,this)}Ee(au,vi),au.$inject=["injector"],au.prototype._registerDefaultActions=function(e){vi.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 g=t.getRootElement(),h=n.filter(function(y){return y!==g});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(g){var h=i.get(),y=g.type;h.length&&c.trigger(h,y)}),i&&l&&this._registerAction("alignElements",function(g){var h=i.get(),y=[],M=g.type;h.length&&(y=nt(h,function(_){return!S(_,"bpmn:Lane")}),l.trigger(y,M))}),i&&p&&this._registerAction("setColor",function(g){var h=i.get();h.length&&p.setColor(h,g)}),i&&u&&this._registerAction("directEditing",function(){var g=i.get();g.length&&u.activate(g[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var g=t.getRootElement(),h,y;S(g,"bpmn:Collaboration")?y=n.filter(function(M){return S(M.parent,"bpmn:Collaboration")}):y=n.filter(function(M){return M!==g&&!S(M.parent,"bpmn:SubProcess")}),h=Zt(y),p.moveElements(y,{x:-h.x,y:-h.y},g)}),i&&d&&this._registerAction("replaceElement",function(g){d.triggerEntry("replace","click",g)})};const fL={__depends__:[pL],editorActions:["type",au]};function cw(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;tt(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}cw.$inject=["eventBus"];function vo(e,t){oe.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;Fn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}vo.$inject=["eventBus","gridSnapping","modeling"],Ee(vo,oe),vo.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},vo.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},vo.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},vo.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 dL=2e3;function lw(e,t){e.on(["spaceTool.move","spaceTool.end"],dL,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)}})}lw.$inject=["eventBus","gridSnapping"];const hL={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",vo],gridSnappingSpaceToolBehavior:["type",lw]};var su=10;function Wd(e,t,n){return n||(n="round"),Math[n](e/t)*t}var gL=1200,mL=800;function jr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",mL,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"],gL,function(o){var a=o.originalEvent;if(!(!r.active||a&&Un(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(l){var u={},f=vL(o,l,e);f&&(u.offset=f);var p=yL(o,l);p&&W(u,p),ga(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 su},jr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Wd(e,su);var i,r;return t&&t.min&&(i=t.min,ze(i)&&(i=Wd(i+n,su,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,ze(r)&&(r=Wd(r+n,su,"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 yL(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={}),a[t]||(a[t]={});var s=n.direction;i&&(cu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,l=r.max;return c&&(cu(t)?pw(s)?a.x.max=c.left:a.x.min=c.right:uw(s)?a.y.max=c.top:a.y.min=c.bottom),l&&(cu(t)?pw(s)?a.x.min=l.left:a.x.max=l.right:uw(s)?a.y.min=l.top:a.y.max=l.bottom),a[t]}function vL(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&ze(s[t])||(s||(s=o.snapOffset={}),ze(s[t])||(s[t]=0),!r)||(n.get(r.id)||(cu(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2),!a)||(t==="x"?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2)),s[t]}function cu(e){return e==="x"}function uw(e){return e.indexOf("n")!==-1}function pw(e){return e.indexOf("w")!==-1}const bL={__depends__:[hL],__init__:["gridSnapping"],gridSnapping:["type",jr]};var xL=2e3;function fw(e,t,n){e.on("autoPlace",xL,function(i){var r=i.source,o=$e(r),a=i.shape,s=ox(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")&&(_L(c)?l.offset=-a.width/2:l.offset=-a.height/2),s[c]=t.snapValue(s[c],l))}),s})}fw.$inject=["eventBus","gridSnapping","elementRegistry"];function _L(e){return e==="x"}var wL=1750;function dw(e,t,n){t.on(["create.start","shape.move.start"],wL,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}))}})}dw.$inject=["canvas","eventBus","gridSnapping"];var EL=3e3;function lu(e,t,n){oe.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],EL,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||SL(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}lu.$inject=["eventBus","gridSnapping","modeling"],Ee(lu,oe),lu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=ML(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function SL(e){return e.length>3}function RL(e){return e==="h"}function CL(e){return e==="v"}function ML(e,t,n){var i=Zi(t,n),r={};return RL(i)&&(r.y=e.snapValue(t.y)),CL(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=W({},t,r),n=W({},n,r)),[t,n]}const AL={__depends__:[bL,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",fw],gridSnappingParticipantBehavior:["type",dw],gridSnappingLayoutConnectionBehavior:["type",lu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",cw]};var PL=30,hw=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 st(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(S(r,"bpmn:SubProcess"))return st(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=dn(e)?{width:PL,height:e.height}:{width:e.width,height:hw};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:hw}),!0};const TL={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Rs]};function uu(e){e.invoke(ca,this)}Ee(uu,ca),uu.$inject=["injector"],uu.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 kL={__depends__:[bd],__init__:["keyboardBindings"],keyboardBindings:["type",uu]};var OL={moveSpeed:1,moveSpeedAccelerated:10},DL=1500,gw="left",mw="up",yw="right",vw="down",LL={ArrowLeft:gw,Left:gw,ArrowUp:mw,Up:mw,ArrowRight:yw,Right:yw,ArrowDown:vw,Down:vw},IL={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 bw(e,t,n,i,r){var o=this;this._config=W({},OL,e||{}),t.addListener(DL,function(a){var s=a.keyEvent,c=LL[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=IL[a](l),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,u)}}}bw.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const BL={__depends__:[bd,di],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",bw]};var xw=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=wA(u,f,l),c.newBounds=SA(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:Ie(u)})}function s(c){var l=c.shape,u=c.canExecute,f=c.newBounds;if(u){if(f=km(f),!NL(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=Si(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,_w(t,o),"resize",{autoActivate:!0,cursor:$L(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:xw,height:xw},r=vy(t,e.childrenBoxPadding),RA(n,t,i,r)},Cs.$inject=["eventBus","rules","modeling","dragging"];function NL(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function _w(e,t){var n=$e(e),i=Ie(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function $L(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 ww="djs-resizing",Ew="resize-not-ok",FL=500;function Sw(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,ww)),s.width>5&&Se(c,{x:s.x,width:s.width}),s.height>5&&Se(c,{y:s.y,height:s.height}),o.canExecute?ut(c).remove(Ew):ut(c).add(Ew)}function r(o){var a=o.shape,s=o.frame;s&&an(o.frame),t.removeMarker(a,ww)}e.on("resize.move",FL,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}Sw.$inject=["eventBus","canvas","previewSupport"];var pu=-6,fu=8,du=20,Ms="djs-resizer",jL=["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&&z(a,Bn(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){Pr(o)&&i.activate(o,e,n)}Ge.bind(t,"mousedown",r),Ge.bind(t,"touchstart",r)},Hr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=HL(i),a=De("g");ut(a).add(Ms),ut(a).add(Ms+"-"+e.id),ut(a).add(Ms+"-"+i),Ue(r,a);var s=De("rect");Se(s,{x:-fu/2+o.x,y:-fu/2+o.y,width:fu,height:fu}),ut(s).add(Ms+"-visual"),Ue(a,s);var c=De("rect");return Se(c,{x:-du/2+o.x,y:-du/2+o.y,width:du,height:du}),ut(c).add(Ms+"-hit"),Ue(a,c),Rc(a,t,n),a},Hr.prototype.createResizer=function(e,t){var n=_w(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},Hr.prototype.addResizer=function(e){var t=this;Mt(e)||z(jL,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},Hr.prototype.removeResizers=function(){var e=this._getResizersParent();mc(e)},Hr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Hr.$inject=["eventBus","canvas","selection","resize"];function HL(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-pu:e.indexOf("w")!==-1&&(t.x=pu),e.indexOf("s")!==-1?t.y=-pu:e.indexOf("n")!==-1&&(t.y=pu),t}const Rw={__depends__:[ji,ir,ra],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Cs],resizePreview:["type",Sw],resizeHandles:["type",Hr]};var zL=2e3;function As(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"],zL,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||tt(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}As.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],As.prototype.activate=function(e){var t=oi(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}),(tt(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Cw(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}},As.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")||WL(e)){var g=dn(e),h=g?{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:g?"rotate(-90deg)":null})}if(VL(e)){var y=dn(e),M=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,M),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)"})}(tt(e,["bpmn:Task","bpmn:CallActivity"])||Cw(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"})),GL(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 _=1,m=i.width+2*_;if(n.labelTarget&&(W(o,{width:m,height:i.height+2*_,x:i.x-_,y:i.y-_}),W(d,{fontSize:l+"px",lineHeight:u})),Rr(n)&&!Ac(n)&&!Je(n)){var v=Pp(e),w=t.getAbsoluteBBox({x:v.x,y:v.y,width:0,height:0}),R=l,P=oo.width*a+2*_;W(o,{width:P,height:R+2*_,x:w.x-P/2,y:w.y-R/2-_}),W(d,{fontSize:l+"px",lineHeight:u})}return S(e,"bpmn:TextAnnotation")&&(W(o,{width:i.width+2*_,height:i.height+2*_,x:i.x-_,y:i.y-_,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}},As.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}),UL(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function Cw(e){return S(e,"bpmn:SubProcess")&&!st(e)}function GL(e){return S(e,"bpmn:SubProcess")&&st(e)}function VL(e){return S(e,"bpmn:Participant")&&!st(e)}function WL(e){return S(e,"bpmn:Participant")&&st(e)}function UL(e){return!e||!e.trim()}var Mw="djs-element-hidden",Aw="djs-label-hidden";function Pw(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=De("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=De("path");Se(f,{d:u,strokeWidth:2,stroke:YL(o)}),Ue(s,f),Ue(r,s),wn(s,o.x,o.y)}S(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,Mw):(S(o,"bpmn:Task")||S(o,"bpmn:CallActivity")||S(o,"bpmn:SubProcess")||S(o,"bpmn:Participant")||S(o,"bpmn:Lane"))&&t.addMarker(o,Aw)}),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}});Se(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var l=c.active;l&&(t.removeMarker(l.element.label||l.element,Mw),t.removeMarker(o,Aw)),o=void 0,a=void 0,s&&(an(s),s=void 0)})}Pw.$inject=["eventBus","canvas","pathMap"];function YL(e,t){var n=pt(e);return n.get("stroke")||t||"black"}const qL={__depends__:[qf,Rw,ew],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",As],labelEditingPreview:["type",Pw]};var KL=500,XL=1e3;function Gi(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){SC(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){z(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],KL,function(o){var a=o.element,s=o.gfx,c=Rt(".djs-outline",s);c&&i.updateOutline(a,c)})}Gi.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=Rt(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),Ue(t,n),this.updateOutline(e,n)),n},Gi.prototype._createOutlineGfx=function(){var e=De("rect");return Se(e,W({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Gi.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Gi.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&z(i,function(r){n=n||r.updateOutline(t,e)}),n||Se(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Gi.prototype.updateConnectionOutline=function(e,t){var n=Zt(t);Se(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Gi.prototype.registerProvider=function(e,t){t||(t=e,e=XL),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Gi.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Gi.prototype.getOutline=function(e){var t,n=this._getProviders();return z(n,function(i){fn(i.getOutline)&&(t=t||i.getOutline(e))}),t},Gi.$inject=["eventBus","styles","elementRegistry"];var hu=6;function Ud(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)})}Ud.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");mc(t);var n=e.length>1,i=this._canvas.getContainer();if(ut(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=ZL(Zt(e)),o=De("rect");Se(o,W({rx:3},r)),ut(o).add("djs-selection-outline"),Ue(t,o)}},Ud.$inject=["eventBus","canvas","selection"];function ZL(e){return{x:e.x-hu,y:e.y-hu,width:e.width+hu*2,height:e.height+hu*2}}const Yd={__depends__:[di],__init__:["outline","multiSelectionOutline"],outline:["type",Gi],multiSelectionOutline:["type",Ud]},Tw=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],kw={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},QL=15,gu=2;function Ow(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(g=>tt(g,Tw));if(p.length===1){const g=p[0];Je(g)?a(g,g.labelTarget):(d=g.labels)!=null&&d.length&&a(g.labels[0],g)}if(p.length===2){const g=p.find(Je),h=p.find(y=>{var M;return(M=y.labels)==null?void 0:M.includes(g)});g&&h&&a(g,h)}}),e.on("shape.changed",function({element:f}){var p;!tt(f,Tw)||!u(f)||(Je(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=ka([$e(p),$e(f)],kw),g=d.getAttribute("d"),y=r.isSelected(f)?c(f):l(f),M=Ia(y,g);if(!M)return;const m=r.isSelected(p)?c(p):l(p),v=Ia(m,g)||$e(p);Wa(v,M)<QL||(_p(d,[v,M]),Ue(o,d))}function s(){gc(`.${kw.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")-gu,y:f.y+zr(p,"y")-gu,width:zr(p,"width")+gu*2,height:zr(p,"height")+gu*2};return kp(d,zr(p,"rx"))}if(p.cx){const d=zr(p,"r"),g={x:f.x+zr(p,"cx")-d,y:f.y+zr(p,"cy")-d,width:d*2,height:d*2};return ty(g)}}function l(f){return n.getShapePath(f)}function u(f){return r.isSelected(f)}}Ow.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function zr(e,t){return parseFloat(Se(e,t)||0)}const JL={__depends__:[di,Yd],__init__:["labelLink"],labelLink:["type",Ow]};var eI=new ia("tt");function tI(e){var t=Lt('<div class="djs-tooltip-container" />');return Dn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function nI(e,t,n){Dn(e,{left:t+"px",top:n+"px"})}function qd(e,t){e.style.display=t===!1?"none":""}var Dw="djs-tooltip",Kd="."+Dw;function $n(e,t){this._eventBus=e,this._canvas=t,this._ids=eI,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=tI(t.getContainer());var n=this;Gn.bind(this._tooltipRoot,Kd,"mousedown",function(i){i.stopPropagation()}),Gn.bind(this._tooltipRoot,Kd,"mouseover",function(i){n.trigger("mouseover",i)}),Gn.bind(this._tooltipRoot,Kd,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}$n.$inject=["eventBus","canvas"],$n.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},$n.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(An(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},$n.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},$n.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},$n.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)}},$n.prototype.remove=function(e){var t=this.get(e);t&&(Li(t.html),Li(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},$n.prototype.show=function(){qd(this._tooltipRoot)},$n.prototype.hide=function(){qd(this._tooltipRoot,!1)},$n.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},$n.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)),Fn(n)&&(n=Lt(n)),i=Lt('<div data-tooltip-id="'+t+'" class="'+Dw+'">'),Dn(i,{position:"absolute"}),i.appendChild(n),e.type&&$t(i).add("djs-tooltip-"+e.type),e.className&&$t(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},$n.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;nI(n,t.x,t.y)},$n.prototype._updateTooltipVisibilty=function(e){z(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),qd(i,r))})},$n.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",$n]};var rI="flow elements must be children of pools/participants",oI="Data object must be placed within a pool/participant.";function Lw(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(rI)):S(a,"bpmn:DataObjectReference")&&i(r,n(oI)))})}Lw.$inject=["eventBus","tooltips","translate"];const aI={__depends__:[iI],__init__:["modelingFeedback"],modelingFeedback:["type",Lw]};var sI=500,cI=1250,lI=1500,mu=Math.round;function uI(e){return{x:e.x+mu(e.width/2),y:e.y+mu(e.height/2)}}function Iw(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",lI,function(s){var c=s.context,l=s.shape,u=i.get().slice();u.indexOf(l)===-1&&(u=[l]),u=pI(u),W(c,{shapes:u,validatedShapes:u,shape:l})}),e.on("shape.move.start",cI,function(s){var c=s.context,l=c.validatedShapes,u;if(u=c.canExecute=o(l),!u)return!1}),e.on("shape.move.move",sI,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=mu(l.x),l.y=mu(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(Pr(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(pn(l)&&(u=l,l=!1),!(c.waypoints||!c.parent)&&!ut(s.target).has("djs-hit-no-move")){var f=uI(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}Iw.$inject=["eventBus","dragging","modeling","selection","rules"];function pI(e){var t=Co(e,"id");return nt(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var Bw=499,Xd="djs-dragging",Nw="drop-ok",$w="drop-not-ok",Fw="new-parent",jw="attach-ok";function Hw(e,t,n,i){function r(c){var l=o(c),u=fI(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){[jw,Nw,$w,Fw].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,Xd),c.allDraggedElements?c.allDraggedElements.push(l):c.allDraggedElements=[l]}e.on("shape.move.start",Bw,function(c){var l=c.context,u=l.shapes,f=l.allDraggedElements,p=r(u);if(!l.dragGroup){var d=De("g");Se(d,n.cls("djs-drag-group",["no-events"]));var g=t.getActiveLayer();Ue(g,d),l.dragGroup=d}p.forEach(function(h){i.addDragger(h,l.dragGroup)}),f?f=Pu([f,o(u)]):f=o(u),z(f,function(h){t.addMarker(h,Xd)}),l.allDraggedElements=f,l.differentParents=dI(u)}),e.on("shape.move.move",Bw,function(c){var l=c.context,u=l.dragGroup,f=l.target,p=l.shape.parent,d=l.canExecute;f&&(d==="attach"?a(f,jw):l.canExecute&&p&&f.id!==p.id?a(f,Fw):a(f,l.canExecute?Nw:$w)),wn(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;z(u,function(p){t.removeMarker(p,Xd)}),f&&an(f)}),this.makeDraggable=s}Hw.$inject=["eventBus","canvas","styles","previewSupport"];function fI(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=nt(e,function(i){return Mt(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function dI(e){return SE(Co(e,function(t){return t.parent&&t.parent.id}))!==1}const hI={__depends__:[ol,di,Yd,ji,ir,ra],__init__:["move","movePreview"],move:["type",Iw],movePreview:["type",Hw]};var zw=".djs-palette-toggle",Gw=".entry",gI=zw+", "+Gw,Zd="djs-palette-",mI="shown",Qd="open",Vw="two-column",yI=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=yI),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(bI,{})},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=Lt(nn.HTML_MARKUP);n.appendChild(i),$t(n).add(Zd+mI),Gn.bind(i,gI,"click",function(r){var o=r.delegateTarget;if(fp(o,zw))return e.toggle();e.trigger("click",r)}),Ge.bind(i,"mousedown",function(r){r.stopPropagation()}),Gn.bind(i,Gw,"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=$t(n),a=$t(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(Vw,r),a.toggle(Zd+Vw,r),"open"in e&&(o.toggle(Qd,e.open),a.toggle(Zd+Qd,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},nn.prototype._update=function(){var e=Rt(".djs-palette-entries",this._container),t=this._entries=this.getEntries();dc(e),z(t,function(n,i){var r=n.group||"default",o=Rt("[data-group="+ds(r)+"]",e);o||(o=Lt('<div class="group"></div>'),An(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=Lt(a);if(o.appendChild(s),!n.separator&&(An(s,"data-action",i),n.title&&An(s,"title",n.title),n.className&&vI(s,n.className),n.imageUrl)){var c=Lt("<img>");An(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=An(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(fn(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=Rt(".djs-palette-entries",this._container),this._toolsContainer=Rt("[data-group=tools]",t)),n=this._toolsContainer,z(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=$t(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},nn.prototype.isOpen=function(){return $t(this._container).has(Qd)},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 vI(e,t){var n=$t(e),i=Ne(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function bI(e,t){var n=t.getPaletteEntries();return fn(n)?n(e):(z(n,function(i,r){e[r]=i}),e)}const xI={__init__:["palette"],palette:["type",nn]};var Ww="crosshair",Uw="selected",_I="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=De("rect");Se(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Ue(p,d),l(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&Se(p,{x:d.x,y:d.y,width:d.width,height:d.height});var g=f.marked,h=f.lastMarked;if(g&&h){for(const y of h)g.has(y)||t.removeMarker(y,Uw);for(const y of g)h.has(y)||t.addMarker(y,Uw)}},remove:function(f){this.update(f),f.frame&&an(f.frame),l(!1)}};function l(f){ut(t.getContainer()).toggle(_I,f)}function u(f){var p=i.getAll();return new Set(Ro(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=Yw(f),p.add=Qc(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=Yw(f),g=u(d),h=p.initialMarked.union(g);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(Qc(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:Ww,data:{context:{}},keepSelection:!0})},Gr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Ww,data:{context:{}},keepSelection:!0})},Gr.prototype._select=function(e){this._selection.select(e)},Gr.prototype.select=function(e,t,n=[]){var i=Ro(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 Yw(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 wI={__depends__:[ll,Za],__init__:["lassoTool"],lassoTool:["type",Gr]};var Jd=1500,qw="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",Jd,function(c){if(qa(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(Jd,function(c){if(!(!Kw(c.keyEvent)||a.isActive())){var l=a._mouse.getLastMoveEvent();a.activateMove(l,!!l)}},"keyboard.keydown"),s&&s.addListener(Jd,function(c){!Kw(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:qw,data:{context:n||{}}})},ma.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:qw,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 Kw(e){return sn("Space",e)}const EI={__depends__:[ll,Za],__init__:["handTool"],handTool:["type",ma]};var Xw="connect-ok",Zw="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?Xw:Zw))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var l=c.context.startTarget,u=c.context.canStartConnect;l&&i.removeMarker(l,u?Xw:Zw)}),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 SI={__depends__:[zd,ji,ir,ll,Za],globalConnect:["type",ya]};function eh(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)}eh.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],eh.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,g,h){function y(M){var _=n.createShape(W({type:f},h));t.start(M,_)}return{group:p,className:d,title:g,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 RI={__depends__:[xI,sl,bb,wI,EI,SI,Ha],__init__:["paletteProvider"],paletteProvider:["type",eh]};var CI=250;function th(e,t,n,i,r){oe.call(this,e);function o(s){var c=s.canExecute.replacements;z(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 g=Rt('[data-element-id="'+ds(p.id)+'"]',s.dragGroup);g&&Se(g,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[u]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;z(c,function(l,u){var f=Rt('[data-element-id="'+ds(u)+'"]',s.dragGroup);f&&Se(f,{display:"inline"}),l.remove(),c[u]&&delete c[u]})}e.on("shape.move.move",CI,function(s){var c=s.context,l=c.canExecute;c.visualReplacements||(c.visualReplacements={}),l&&l.replacements?o(c):a(c)})}th.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],Ee(th,oe);const MI={__depends__:[ra],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",th]};var AI=1250,nh=40,PI=20,TI=10,Qw=20,Jw=["x","y"],kI=Math.abs;function e0(e){e.on(["connect.hover","connect.move","connect.end"],AI,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Un(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&OI(t,o,BI(o)),o&&II(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=mi(r),tt(o,["bpmn:Event","bpmn:Gateway"])&&t0(t,mi(o)),tt(o,["bpmn:Task","bpmn:SubProcess"])&&DI(t,o),S(a,"bpmn:BoundaryEvent")&&s===a.host&&LI(t)):n0(i,"bpmn:MessageFlow")?(S(r,"bpmn:Event")&&(n.connectionStart=mi(r)),S(o,"bpmn:Event")&&t0(t,mi(o))):n.connectionStart=n.initialConnectionStart)})}e0.$inject=["eventBus"];function OI(e,t,n){Jw.forEach(function(i){var r=i0(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=mi(t);Jw.forEach(function(i){NI(e,t,i)&&tn(e,i,n[i])})}function LI(e){var t=e.context,n=t.source,i=t.target;if(!$I(t)){var r=mi(n),o=_n(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;kI(c-r[s])<nh&&(c>r[s]?l=r[s]+nh:l=r[s]-nh,tn(e,s,l))})}}function t0(e,t){tn(e,"x",t.x),tn(e,"y",t.y)}function n0(e,t){return e&&e.type===t}function II(e,t){return hr(t,function(n){return n0(e,n)})}function i0(e,t){return e==="x"?t.width:t.height}function BI(e){return S(e,"bpmn:Task")?TI:PI}function NI(e,t,n){return e[n]>t[n]+Qw&&e[n]<t[n]+i0(n,t)-Qw}function $I(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 yu,n.initDefaults(this._defaultSnaps)),n};function yu(){this._snapValues={}}yu.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),n.x.indexOf(t.x)===-1&&n.x.push(t.x),n.y.indexOf(t.y)===-1&&n.y.push(t.y)},yu.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&CD(e[n],r[n],i)},yu.prototype.initDefaults=function(e){var t=this;z(e||{},function(n,i){z(n,function(r){t.add(i,r)})})};var FI=1250;function Vi(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"],FI,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Un(r.originalEvent))&&!(ga(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()})}Vi.$inject=["elementRegistry","eventBus","snapping"],Vi.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=mi(i,e):o={x:e.x+mi(i).x,y:e.y+mi(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}),Je(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},Vi.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return z(i,function(r){if(Je(r)){Je(t)&&e.add("mid",mi(r));return}if(Mt(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);z(o,function(a){e.add("mid",a)});return}e.add("mid",mi(r))}),!ze(t.x)||!ze(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",mi(t)),e},Vi.prototype.getSnapTargets=function(e,t){return G_(t).filter(function(n){return!jI(n)})};function jI(e){return!!e.hidden}var r0=1500;function va(e,t){t.invoke(Vi,this),e.on(["create.move","create.end"],r0,VI),e.on(["create.move","create.end","shape.move.move","shape.move.end"],r0,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!ga(n)&&HI(n,o)})}Ee(va,Vi),va.$inject=["eventBus","injector"],va.prototype.initSnap=function(e){var t=Vi.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return z(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",a0(o,i,e))}),z(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",a0(o,i,e))}),S(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},va.prototype.addSnapTargetPoints=function(e,t,n){Vi.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);z(i,function(o){(GI(o)||zI([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",H_(o)),e.add("bottom-right",z_(o)))});var r=this._elementRegistry;return z(t.incoming,function(o){if(r.get(t.id)){o0(i,o.source)||e.add("mid",$e(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),z(t.outgoing,function(o){if(r.get(t.id)){o0(i,o.target)||e.add("mid",$e(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 Vi.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!S(n,"bpmn:Lane")})};function HI(e,t){var n=Ie(t),i=gv(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=$e(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 zI(e,t){return e.every(function(n){return S(n,t)})}function GI(e){return S(e,"bpmn:SubProcess")&&st(e)?!0:S(e,"bpmn:Participant")}function VI(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 o0(e,t){return e.indexOf(t)!==-1}function a0(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var WI=1250;function Ps(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],WI,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Un(i.originalEvent))&&!ga(i)){var l=c.pointsForTarget(a);l.initialized||(l=n.addSnapTargetPoints(l,o,a,s),l.initialized=!0),qI(s)&&tn(i,"x",i.x),KI(s)&&tn(i,"y",i.y),t.snap(i,l)}}),e.on(["resize.cleanup"],function(){t.hide()})}Ps.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=s0(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Ps.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return z(r,function(o){e.add("corner",z_(o)),e.add("corner",H_(o))}),e.add("corner",s0(t,i)),e},Ps.$inject=["eventBus","snapping"],Ps.prototype.getSnapTargets=function(e,t){return G_(t).filter(function(n){return!UI(n,e)&&!Mt(n)&&!YI(n)&&!Je(n)})};function s0(e,t){var n=$e(e),i=Ie(e),r={x:n.x,y:n.y};return t.indexOf("n")!==-1?r.y=i.top:t.indexOf("s")!==-1&&(r.y=i.bottom),t.indexOf("e")!==-1?r.x=i.right:t.indexOf("w")!==-1&&(r.x=i.left),r}function UI(e,t){return e.host===t}function YI(e){return!!e.hidden}function qI(e){return e==="n"||e==="s"}function KI(e){return e==="e"||e==="w"}var XI=7,ZI=1e3;function Wr(e){this._canvas=e,this._asyncHide=ku(Bn(this.hide,this),ZI)}Wr.$inject=["canvas"],Wr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:ga(e,"x"),y:ga(e,"y")};z(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(z(["x","y"],function(l){var u;o[l]||(u=t.snap(c,a,l,XI),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),z(["x","y"],function(a){var s=o[a];pn(s)&&tn(e,a,s.originValue)})},Wr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=De("path");return Se(n,{d:"M0,0 L0,0"}),ut(n).add("djs-snap-line"),Ue(t,n),{update:function(i){ze(i)?e==="horizontal"?Se(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):Se(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):Se(n,{display:"none"})}}},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(){z(this._snapLines,function(e){e.update()})};const QI={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Vi],resizeSnapping:["type",Ps],snapping:["type",Wr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",e0],createMoveSnapping:["type",va]};var c0=300;function Ye(e,t,n,i){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=i,this._container=this._getBoxHtml(),this._searchInput=Rt(Ye.INPUT_SELECTOR,this._container),this._resultsContainer=Rt(Ye.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}Ye.$inject=["canvas","eventBus","selection","translate"],Ye.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Gn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,Ye.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,Ye.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,Ye.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,Ye.INPUT_SELECTOR,"keydown",function(n){sn("ArrowUp",n)&&n.preventDefault(),sn("ArrowDown",n)&&n.preventDefault()}),t(this._container,Ye.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)})},Ye.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Gn.unbind(e.el,e.type,e.listener)})},Ye.prototype._search=function(e){var t=this;if(this._clearResults(),!!e.trim()){var n=this._searchProvider.find(e);if(n=n.filter(function(r){return!t._canvas.getRootElements().includes(r.element)}),!n.length){this._selection.select(null);return}n.forEach(function(r){var o=r.element.id,a=t._createResultNode(r,o);t._results[o]={element:r.element,node:a}});var i=Rt(Ye.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},Ye.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Ye.prototype._scrollToNode=function(e){if(!(!e||e===this._getCurrentResult())){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},Ye.prototype._clearResults=function(){dc(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},Ye.prototype._getCurrentResult=function(){return Rt(Ye.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Ye.prototype._createResultNode=function(e,t){var n=Lt(Ye.RESULT_HTML);return e.primaryTokens.length>0&&l0(n,e.primaryTokens,Ye.RESULT_PRIMARY_HTML),l0(n,e.secondaryTokens,Ye.RESULT_SECONDARY_HTML),An(n,Ye.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Ye.prototype.registerProvider=function(e){this._searchProvider=e},Ye.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,$t(this._canvas.getContainer()).add("djs-search-open"),$t(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Ye.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,$t(this._canvas.getContainer()).remove("djs-search-open"),$t(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},Ye.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Ye.prototype.isOpen=function(){return this._open},Ye.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&$t(t).remove(Ye.RESULT_SELECTED_CLASS);var n=An(e,Ye.RESULT_ID_ATTRIBUTE),i=this._results[n].element;$t(e).add(Ye.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:c0}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Ye.prototype._select=function(e){var t=An(e,Ye.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:c0}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},Ye.prototype._getBoxHtml=function(){const e=Lt(Ye.BOX_HTML),t=Rt(Ye.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function l0(e,t,n){var i=JI(t),r=Lt(n);r.innerHTML=i,e.appendChild(r)}function JI(e){var t="";return e.forEach(function(n){var i=yx(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+Ye.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}Ye.CONTAINER_SELECTOR=".djs-search-container",Ye.INPUT_SELECTOR=".djs-search-input input",Ye.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Ye.RESULT_SELECTOR=".djs-search-result",Ye.RESULT_SELECTED_CLASS="djs-search-result-selected",Ye.RESULT_SELECTED_SELECTOR="."+Ye.RESULT_SELECTED_CLASS,Ye.RESULT_ID_ATTRIBUTE="data-result-id",Ye.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Ye.BOX_HTML=`<div class="djs-search-container djs-scrollable">
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>`,Ye.RESULT_HTML='<div class="djs-search-result"></div>',Ye.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ye.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const QI={__depends__:[Ha,Dl,di],searchPad:["type",Ye]};function ih(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}ih.$inject=["elementRegistry","searchPad","canvas","search"],ih.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Je(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:oi(i),id:i.id})),e,{keys:["label","id"]}).map(JI)};function JI(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const eB={__depends__:[QI,__],__init__:["bpmnSearch"],bpmnSearch:["type",ih]},tB="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",nB="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",iB={width:36,height:50},rB={width:50,height:50};function u0(e,t,n){return Oe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const bi=5;function vu(e,t){this._styles=t,e.registerProvider(this)}vu.$inject=["outline","styles"],vu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(vM(e))return n=Oe("rect"),Se(n,W({x:-bi,y:-bi,rx:4,width:e.width+bi*2,height:e.height+bi*2},t)),n;if(!Je(e))return S(e,"bpmn:Gateway")?(n=Oe("rect"),W(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Se(n,W({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):tt(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Oe("rect"),Se(n,W({x:-bi,y:-bi,rx:14,width:e.width+bi*2,height:e.height+bi*2},t))):S(e,"bpmn:EndEvent")?(n=Oe("circle"),Se(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+bi+1},t))):S(e,"bpmn:Event")?(n=Oe("circle"),Se(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+bi},t))):S(e,"bpmn:DataObjectReference")&&p0(e,"bpmn:DataObjectReference")?n=u0(tB,{x:-6,y:-6},t):S(e,"bpmn:DataStoreReference")&&p0(e,"bpmn:DataStoreReference")&&(n=u0(nB,{x:-6,y:-6},t)),n},vu.prototype.updateOutline=function(e,t){if(!Je(e))return tt(e,["bpmn:SubProcess","bpmn:Group"])?(Se(t,{width:e.width+bi*2,height:e.height+bi*2}),!0):!!tt(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function p0(e,t){var n;return t==="bpmn:DataObjectReference"?n=iB:t==="bpmn:DataStoreReference"&&(n=rB),e.width===n.width&&e.height===n.height}const oB={__depends__:[Yd],__init__:["outlineProvider"],outlineProvider:["type",vu]};var aB='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function Wi(e){zo.call(this,e)}Ee(Wi,zo),Wi.Viewer=$r,Wi.NavigatedViewer=hs,Wi.prototype.createDiagram=function(){return this.importXML(aB)},Wi.prototype._interactionModules=[Sx,Cx,Px],Wi.prototype._modelingModules=[cD,Pl,dD,pD,CD,zd,OD,iL,cb,sl,sL,uL,CL,AL,PL,LL,UL,ZL,pd,rI,fI,EI,RI,Rw,XI,eB,oB],Wi.prototype._modules=[].concat($r.prototype._modules,Wi.prototype._interactionModules,Wi.prototype._modelingModules);const sB=be.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=be.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),f=Vu(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 be.onMounted(async()=>{a=new Wi({container:o.value,moddleExtensions:Us}),i.xml&&await s(i.xml),r("ready")}),be.watch(()=>i.xml,l=>{l&&a&&s(l)}),be.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(be.openBlock(),be.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),f0=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n},cB=f0(sB,[["__scopeId","data-v-a9b41c97"]]),lB=["title","aria-expanded"],uB=["title","onClick"],pB={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},fB={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},dB={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},hB={key:0,class:"bwl-validation__body"},mB={key:0,class:"bwl-validation__empty"},gB={key:1,class:"bwl-validation__empty"},yB={key:2,class:"bwl-validation__list"},vB=["onClick"],bB={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},xB={class:"bwl-validation__msg"},_B=["title"],wB=f0(be.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=be.computed(()=>fx(n.issues.value,n.describeElement)),r=be.computed(()=>dx(i.value)),o=m=>aa(m,n.changeScope.value),a=be.computed(()=>yd(i.value,n.changeScope.value)),s=be.ref({error:!0,warning:!0,info:!0}),c=be.computed(()=>hx(i.value.filter(m=>s.value[m.severity]),n.changeScope.value)),l=be.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)=>(be.openBlock(),be.createElementBlock("section",{class:be.normalizeClass(["bwl-validation",{"is-open":l.value}])},[be.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[be.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(be.openBlock(),be.createElementBlock("svg",{class:be.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[be.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=be.createElementVNode("span",null,"검증",-1))],8,lB),be.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=be.withModifiers(()=>{},["stop"]))},[(be.openBlock(),be.createElementBlock(be.Fragment,null,be.renderList(u,y=>be.createElementVNode("button",{key:y,type:"button",class:be.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${f[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:C=>p(y)},[(be.openBlock(),be.createElementBlock("svg",pB,[h[4]||(h[4]=be.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(be.openBlock(),be.createElementBlock("path",fB)):(be.openBlock(),be.createElementBlock("path",dB))])),be.createElementVNode("span",null,be.toDisplayString(r.value[y]),1)],10,uB)),64))])]),l.value?(be.openBlock(),be.createElementBlock("div",hB,[i.value.length===0?(be.openBlock(),be.createElementBlock("p",mB,"발견된 문제가 없습니다.")):c.value.length===0?(be.openBlock(),be.createElementBlock("p",gB," 선택한 심각도에 해당하는 항목이 없습니다. ")):(be.openBlock(),be.createElementBlock("ul",yB,[(be.openBlock(!0),be.createElementBlock(be.Fragment,null,be.renderList(c.value,y=>(be.openBlock(),be.createElementBlock("li",{key:y.key,class:be.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:C=>d(y)},[h[5]||(h[5]=be.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&o(y)?(be.openBlock(),be.createElementBlock("span",bB,"이번 변경")):be.createCommentVNode("",!0),be.createElementVNode("span",xB,be.toDisplayString(y.message),1),be.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},be.toDisplayString(y.category),9,_B)],10,vB))),128))]))])):be.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]);ee.ADDABLE_FLOW_NODE_TYPES=$s,ee.APPLY_BPMN_OPS_SCHEMA=vE,ee.BPMN_MODDLE_EXTENSIONS=Us,ee.BWL_MODDLE_SCHEMA=yh,ee.BWL_NS=gh,ee.BWL_PREFIX=Cu,ee.BWL_SIDES=Mu,ee.BpmnModelerView=cB,ee.BpmnValidationPanel=wB,ee.EDITOR=yR,ee.FLOW_LABEL_INDENT=Zh,ee.GROUP_BORDER_MIN_RUN=Wu,ee.GROUP_BORDER_NEAR=Oo,ee.HEADLESS_BPMN_MODULES=cx,ee.HEADLESS_TEXT_METRICS=To,ee.I18N_NS=X1,ee.I18N_PREFIX=zh,ee.IR_FLOW_NODE_TYPES=qr,ee.LABEL_FORK_MARGIN=qu,ee.LABEL_SHAPE_MIN_DEPTH=lm,ee.SEVERITY_ORDER=gd,ee.SYMBOLIC_OP_KINDS=xh,ee.SYMBOLIC_OP_SCHEMA=_h,ee.UNDO_EPISODE_COMMAND=Au,ee.applyBpmnOpBatch=tg,ee.applyBpmnOps=Ym,ee.approximateTextWidth=ko,ee.auditBpmnGeometry=fm,ee.auditBpmnGeometryXml=ES,ee.auditBpmnSemantics=lp,ee.auditBpmnSemanticsXml=cR,ee.auditGeometry=bt,ee.auditTargetsOf=ni,ee.axisSegmentsOf=vn,ee.blackBoxNameRect=Uu,ee.buildBpmnOpBatch=gR,ee.buildRegistryIndex=hm,ee.containerBoundarySegments=Ca,ee.countBySeverity=dx,ee.createBpmnEditorController=vR,ee.createBpmnModdle=Gh,ee.createHeadlessBpmnModeler=$k,ee.crossedShapesOf=bn,ee.crossingCost=ti,ee.describeProcess=Zm,ee.describeProcessXml=nR,ee.diffBpmnElements=eg,ee.diffBpmnElementsXml=hR,ee.edgeCrossCount=Aa,ee.edgeCrossingPairsOf=Js,ee.edgeCrossingStatsOf=rm,ee.executeAsUndoEpisode=bh,ee.followMovedEdgeLabels=Dm,ee.forwardThreePointCandidates=nc,ee.geometryFindingKey=gt,ee.installHeadlessBpmnDom=Wh,ee.isAddableFlowNodeType=mh,ee.isChangeScopeMixed=yd,ee.isEdgeOverlapFinding=Yu,ee.isInChangeScope=aa,ee.isIrFlowNodeType=hh,ee.labelRectsOf=Io,ee.labelShapeDepth=um,ee.lineCrossesLabel=qi,ee.lineThroughLabel=Jh,ee.lineThroughShapeLabel=cm,ee.loadBpmnXml=Po,ee.lowerOps=Wm,ee.oppositeOverlapCount=lS,ee.oppositeOverlapOf=Xh,ee.planBackEdgeBoundaryClearance=Em,ee.planCrossPoolRoute=xm,ee.planEdgeRepair=Qu,ee.planLabelLineClearance=ip,ee.planLabelPlacement=Om,ee.planMiddleSegmentShifts=gm,ee.planOppositeOverlapRepair=Rm,ee.planSegmentDetours=tc,ee.planShapeLabelClearance=Bm,ee.redockIntroducedDetachedEndpoints=$m,ee.repairIntroducedBoundaryHugging=Sm,ee.repairIntroducedCrossings=Ju,ee.repairIntroducedEdgeCrossings=vm,ee.repairIntroducedFakeMerges=Mm,ee.repairIntroducedLabelLines=Lm,ee.repairIntroducedOppositeOverlaps=km,ee.repairIntroducedShapeLabelLines=Nm,ee.repairIntroducedSharedSegmentLabels=Im,ee.rerouteIntroducedCrossPoolEdges=_m,ee.resolverServicesOf=zm,ee.saveBpmnXml=Z1,ee.sceneCrossingCost=im,ee.sceneFromDefinitions=pm,ee.sceneFromRegistry=Qe,ee.segmentShapeClearance=Qs,ee.shapesUnderLabel=ec,ee.sharedSegmentUnderLabel=Zs,ee.sharedSpansOf=Xs,ee.sortPanelIssues=hx,ee.toPanelIssues=fx,ee.touchedElements=mR,ee.unreadableOverlapCount=ei,ee.unreadableOverlapOf=Do,ee.validateOps=Hm,ee.warningMessages=Vu,Object.defineProperty(ee,Symbol.toStringTag,{value:"Module"})}));
343
+ </div>`,Ye.RESULT_HTML='<div class="djs-search-result"></div>',Ye.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Ye.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const eB={__depends__:[Ha,Dl,di],searchPad:["type",Ye]};function ih(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}ih.$inject=["elementRegistry","searchPad","canvas","search"],ih.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Je(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:oi(i),id:i.id})),e,{keys:["label","id"]}).map(tB)};function tB(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const nB={__depends__:[eB,__],__init__:["bpmnSearch"],bpmnSearch:["type",ih]},iB="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",rB="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",oB={width:36,height:50},aB={width:50,height:50};function u0(e,t,n){return De("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const bi=5;function vu(e,t){this._styles=t,e.registerProvider(this)}vu.$inject=["outline","styles"],vu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(xM(e))return n=De("rect"),Se(n,W({x:-bi,y:-bi,rx:4,width:e.width+bi*2,height:e.height+bi*2},t)),n;if(!Je(e))return S(e,"bpmn:Gateway")?(n=De("rect"),W(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Se(n,W({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):tt(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=De("rect"),Se(n,W({x:-bi,y:-bi,rx:14,width:e.width+bi*2,height:e.height+bi*2},t))):S(e,"bpmn:EndEvent")?(n=De("circle"),Se(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+bi+1},t))):S(e,"bpmn:Event")?(n=De("circle"),Se(n,W({cx:e.width/2,cy:e.height/2,r:e.width/2+bi},t))):S(e,"bpmn:DataObjectReference")&&p0(e,"bpmn:DataObjectReference")?n=u0(iB,{x:-6,y:-6},t):S(e,"bpmn:DataStoreReference")&&p0(e,"bpmn:DataStoreReference")&&(n=u0(rB,{x:-6,y:-6},t)),n},vu.prototype.updateOutline=function(e,t){if(!Je(e))return tt(e,["bpmn:SubProcess","bpmn:Group"])?(Se(t,{width:e.width+bi*2,height:e.height+bi*2}),!0):!!tt(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function p0(e,t){var n;return t==="bpmn:DataObjectReference"?n=oB:t==="bpmn:DataStoreReference"&&(n=aB),e.width===n.width&&e.height===n.height}const sB={__depends__:[Yd],__init__:["outlineProvider"],outlineProvider:["type",vu]};var cB='<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>';function Wi(e){Go.call(this,e)}Ee(Wi,Go),Wi.Viewer=$r,Wi.NavigatedViewer=hs,Wi.prototype.createDiagram=function(){return this.importXML(cB)},Wi.prototype._interactionModules=[Sx,Cx,Px],Wi.prototype._modelingModules=[uD,Pl,gD,dD,AD,zd,LD,oL,cb,sl,lL,fL,AL,TL,kL,BL,qL,JL,pd,aI,hI,RI,MI,Rw,QI,nB,sB],Wi.prototype._modules=[].concat($r.prototype._modules,Wi.prototype._interactionModules,Wi.prototype._modelingModules);const lB=be.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=be.ref();let a;async function s(l){if(!a)throw new Error("modeler not mounted");try{const{warnings:u}=await a.importXML(l),f=Vu(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 be.onMounted(async()=>{a=new Wi({container:o.value,moddleExtensions:Us}),i.xml&&await s(i.xml),r("ready")}),be.watch(()=>i.xml,l=>{l&&a&&s(l)}),be.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(l,u)=>(be.openBlock(),be.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),f0=(e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n},uB=f0(lB,[["__scopeId","data-v-a9b41c97"]]),pB=["title","aria-expanded"],fB=["title","onClick"],dB={viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},hB={key:0,d:"M5.6 5.6l4.8 4.8M10.4 5.6l-4.8 4.8",stroke:"currentColor","stroke-width":"1.5"},gB={key:1,d:"M8 4.6v0.2M8 7v4.4",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round"},mB={key:0,class:"bwl-validation__body"},yB={key:0,class:"bwl-validation__empty"},vB={key:1,class:"bwl-validation__empty"},bB={key:2,class:"bwl-validation__list"},xB=["onClick"],_B={key:0,class:"bwl-validation__scope",title:"이번 변경이 만들거나 건드린 요소"},wB={class:"bwl-validation__msg"},EB=["title"],SB=f0(be.defineComponent({__name:"BpmnValidationPanel",props:{controller:{}},setup(e){const n=e.controller,i=be.computed(()=>fx(n.issues.value,n.describeElement)),r=be.computed(()=>dx(i.value)),o=g=>sa(g,n.changeScope.value),a=be.computed(()=>yd(i.value,n.changeScope.value)),s=be.ref({error:!0,warning:!0,info:!0}),c=be.computed(()=>hx(i.value.filter(g=>s.value[g.severity]),n.changeScope.value)),l=be.ref(!1),u=["error","warning","info"],f={error:"오류",warning:"경고",info:"정보"};function p(g){if(!l.value){l.value=!0;return}s.value[g]=!s.value[g]}function d(g){const h=g.targetRefs[0];h&&n.requestFocus(h)}return(g,h)=>(be.openBlock(),be.createElementBlock("section",{class:be.normalizeClass(["bwl-validation",{"is-open":l.value}])},[be.createElementVNode("header",{class:"bwl-validation__head",onClick:h[1]||(h[1]=y=>l.value=!l.value)},[be.createElementVNode("button",{type:"button",class:"bwl-validation__toggle",title:l.value?"접기":"펼치기","aria-expanded":l.value},[(be.openBlock(),be.createElementBlock("svg",{class:be.normalizeClass(["bwl-validation__chevron",{"is-open":l.value}]),viewBox:"0 0 16 16",width:"13",height:"13","aria-hidden":"true"},[...h[2]||(h[2]=[be.createElementVNode("path",{d:"M6 3l5 5-5 5",fill:"none",stroke:"currentColor","stroke-width":"1.6"},null,-1)])],2)),h[3]||(h[3]=be.createElementVNode("span",null,"검증",-1))],8,pB),be.createElementVNode("div",{class:"bwl-validation__counts",onClick:h[0]||(h[0]=be.withModifiers(()=>{},["stop"]))},[(be.openBlock(),be.createElementBlock(be.Fragment,null,be.renderList(u,y=>be.createElementVNode("button",{key:y,type:"button",class:be.normalizeClass(["bwl-validation__count",[`is-${y}`,{"is-off":!s.value[y]}]]),title:l.value?`${f[y]} ${s.value[y]?"숨기기":"보이기"}`:"검증 패널 펼치기",onClick:M=>p(y)},[(be.openBlock(),be.createElementBlock("svg",dB,[h[4]||(h[4]=be.createElementVNode("circle",{cx:"8",cy:"8",r:"6.4",fill:"none",stroke:"currentColor","stroke-width":"1.5"},null,-1)),y==="error"?(be.openBlock(),be.createElementBlock("path",hB)):(be.openBlock(),be.createElementBlock("path",gB))])),be.createElementVNode("span",null,be.toDisplayString(r.value[y]),1)],10,fB)),64))])]),l.value?(be.openBlock(),be.createElementBlock("div",mB,[i.value.length===0?(be.openBlock(),be.createElementBlock("p",yB,"발견된 문제가 없습니다.")):c.value.length===0?(be.openBlock(),be.createElementBlock("p",vB," 선택한 심각도에 해당하는 항목이 없습니다. ")):(be.openBlock(),be.createElementBlock("ul",bB,[(be.openBlock(!0),be.createElementBlock(be.Fragment,null,be.renderList(c.value,y=>(be.openBlock(),be.createElementBlock("li",{key:y.key,class:be.normalizeClass(["bwl-validation__item",[`is-${y.severity}`,{"is-clickable":y.targetRefs.length>0}]]),onClick:M=>d(y)},[h[5]||(h[5]=be.createElementVNode("span",{class:"bwl-validation__dot","aria-hidden":"true"},null,-1)),a.value&&o(y)?(be.openBlock(),be.createElementBlock("span",_B,"이번 변경")):be.createCommentVNode("",!0),be.createElementVNode("span",wB,be.toDisplayString(y.message),1),be.createElementVNode("span",{class:"bwl-validation__cat",title:y.code},be.toDisplayString(y.category),9,EB)],10,xB))),128))]))])):be.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-60e8b1a9"]]);te.ADDABLE_FLOW_NODE_TYPES=$s,te.APPLY_BPMN_OPS_SCHEMA=xE,te.BPMN_MODDLE_EXTENSIONS=Us,te.BWL_MODDLE_SCHEMA=yh,te.BWL_NS=mh,te.BWL_PREFIX=Cu,te.BWL_SIDES=Mu,te.BpmnModelerView=uB,te.BpmnValidationPanel=SB,te.EDITOR=bR,te.FLOW_LABEL_INDENT=Zh,te.GROUP_BORDER_MIN_RUN=Wu,te.GROUP_BORDER_NEAR=Do,te.HEADLESS_BPMN_MODULES=cx,te.HEADLESS_TEXT_METRICS=ko,te.I18N_NS=Q1,te.I18N_PREFIX=zh,te.IR_FLOW_NODE_TYPES=Kr,te.LABEL_FORK_MARGIN=qu,te.LABEL_SHAPE_MIN_DEPTH=lg,te.SEVERITY_ORDER=md,te.SYMBOLIC_OP_KINDS=xh,te.SYMBOLIC_OP_SCHEMA=_h,te.UNDO_EPISODE_COMMAND=Au,te.applyBpmnOpBatch=tm,te.applyBpmnOps=Yg,te.approximateTextWidth=Oo,te.auditBpmnGeometry=fg,te.auditBpmnGeometryXml=RS,te.auditBpmnSemantics=lp,te.auditBpmnSemanticsXml=uR,te.auditGeometry=vt,te.auditTargetsOf=ni,te.axisSegmentsOf=vn,te.blackBoxNameRect=Uu,te.buildBpmnOpBatch=vR,te.buildRegistryIndex=hg,te.containerBoundarySegments=Ca,te.countBySeverity=dx,te.createBpmnEditorController=xR,te.createBpmnModdle=Gh,te.createHeadlessBpmnModeler=jk,te.crossedShapesOf=bn,te.crossingCost=ti,te.describeProcess=Zg,te.describeProcessXml=rR,te.diffBpmnElements=em,te.diffBpmnElementsXml=mR,te.edgeCrossCount=Aa,te.edgeCrossingPairsOf=Js,te.edgeCrossingStatsOf=rg,te.executeAsUndoEpisode=bh,te.followMovedEdgeLabels=Dg,te.forwardThreePointCandidates=nc,te.geometryFindingKey=mt,te.installHeadlessBpmnDom=Wh,te.isAddableFlowNodeType=gh,te.isChangeScopeMixed=yd,te.isEdgeOverlapFinding=Yu,te.isInChangeScope=sa,te.isIrFlowNodeType=hh,te.labelRectsOf=Bo,te.labelShapeDepth=ug,te.lineCrossesLabel=qi,te.lineThroughLabel=Jh,te.lineThroughShapeLabel=cg,te.loadBpmnXml=To,te.lowerOps=Wg,te.oppositeOverlapCount=pS,te.oppositeOverlapOf=Xh,te.planBackEdgeBoundaryClearance=Eg,te.planCrossPoolRoute=xg,te.planEdgeRepair=Qu,te.planLabelLineClearance=ip,te.planLabelPlacement=Og,te.planMiddleSegmentShifts=mg,te.planOppositeOverlapRepair=Rg,te.planSegmentDetours=tc,te.planShapeLabelClearance=Bg,te.redockIntroducedDetachedEndpoints=$g,te.repairIntroducedBoundaryHugging=Sg,te.repairIntroducedCrossings=Ju,te.repairIntroducedEdgeCrossings=vg,te.repairIntroducedFakeMerges=Mg,te.repairIntroducedLabelLines=Lg,te.repairIntroducedOppositeOverlaps=kg,te.repairIntroducedShapeLabelLines=Ng,te.repairIntroducedSharedSegmentLabels=Ig,te.rerouteIntroducedCrossPoolEdges=_g,te.resolverServicesOf=zg,te.saveBpmnXml=J1,te.sceneCrossingCost=ig,te.sceneFromDefinitions=pg,te.sceneFromRegistry=Xe,te.segmentShapeClearance=Qs,te.shapesUnderLabel=ec,te.sharedSegmentUnderLabel=Zs,te.sharedSpansOf=Xs,te.sortPanelIssues=hx,te.toPanelIssues=fx,te.touchedElements=yR,te.unreadableOverlapCount=ei,te.unreadableOverlapOf=Lo,te.validateOps=Hg,te.warningMessages=Vu,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})}));