@g1cloud/bpmn-modeler-next 5.0.0-alpha.67 → 5.0.0-alpha.68

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,16 @@
1
- (function(se,Ot){typeof exports=="object"&&typeof module<"u"?Ot(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Ot):(se=typeof globalThis<"u"?globalThis:se||self,Ot(se.BpmnModeler={},se.Vue))})(this,(function(se,Ot){"use strict";var _L=Object.defineProperty;var wL=(se,Ot,Rr)=>Ot in se?_L(se,Ot,{enumerable:!0,configurable:!0,writable:!0,value:Rr}):se[Ot]=Rr;var Zr=(se,Ot,Rr)=>wL(se,typeof Ot!="symbol"?Ot+"":Ot,Rr);const Rr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent"],rs=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function ld(e){return Rr.includes(e)}function pd(e){return rs.includes(e)}const fd="http://g1project.net/spec/bpmn/bwl/1.0",Lu="bwl",Iu=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],dd={name:"bwl-hints",uri:fd,prefix:Lu,xml:{tagAlias:"lowerCase"},types:[{name:"Placement",superClass:["Element"],properties:[{name:"anchor",isAttr:!0,type:"String"},{name:"side",isAttr:!0,type:"String"},{name:"offset",isAttr:!0,type:"Real"}]},{name:"Members",superClass:["Element"],properties:[{name:"refs",isAttr:!0,type:"String"}]},{name:"BandHint",extends:["bpmn:FlowNode"],properties:[{name:"band",isAttr:!0,type:"Integer"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]}]},Bu="bwl.undoEpisode",hd=new WeakSet;function D0(e){hd.has(e)||(e.register(Bu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),hd.add(e))}function md(e,t){D0(e);const n={run:t};if(e.execute(Bu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const gd=["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"],L0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},I0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},B0={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},N0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ).",properties:{id:{type:"string"},type:{type:"string",enum:[...rs]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},$0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},F0={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},j0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},H0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},z0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},G0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},V0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},W0={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},U0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...Iu]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function sn(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Y0={"participant.add":sn("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":sn("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":sn("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":sn("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:[...rs]},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":sn("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":sn("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":sn("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":sn("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":sn("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":sn("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":sn("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":sn("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":sn("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":sn("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":sn("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":sn("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":sn("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},yd={anyOf:gd.map(e=>Y0[e])},q0={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:I0,irParticipant:B0,irNode:N0,irFlowCondition:$0,irSequenceFlow:F0,irMessageFlow:j0,irDataStore:H0,irDataAssociation:z0,irTextAnnotation:G0,irAssociation:V0,irGroup:W0,bwlPlacement:U0,nullableString:L0,symbolicOp:yd}};function Nu(e){return Array.prototype.concat.apply([],e)}const qo=Object.prototype.toString,K0=Object.prototype.hasOwnProperty;function Cr(e){return e===void 0}function Ft(e){return e!==void 0}function Qr(e){return e==null}function De(e){return qo.call(e)==="[object Array]"}function Wt(e){return qo.call(e)==="[object Object]"}function Be(e){return qo.call(e)==="[object Number]"}function Ut(e){const t=qo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Cn(e){return qo.call(e)==="[object String]"}function X0(e){if(!De(e))throw new Error("must supply array")}function Pn(e,t){return!Qr(e)&&K0.call(e,t)}function pt(e,t){const n=as(t);let i;return N(e,function(r,o){if(n(r,o))return i=r,!1}),i}function vd(e,t){const n=as(t);let i=De(e)?-1:void 0;return N(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ue(e,t){const n=as(t);let i=[];return N(e,function(r,o){n(r,o)&&i.push(r)}),i}function N(e,t){let n,i;if(Cr(e))return;const r=De(e)?tw:ew;for(let o in e)if(Pn(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function Z0(e,t){if(Cr(e))return[];X0(e);const n=as(t);return e.filter(function(i,r){return!n(i,r)})}function An(e,t,n){return N(e,function(i,r){n=t(n,i,r)}),n}function Pr(e,t){return!!An(e,function(n,i,r){return n&&t(i,r)},!0)}function Yi(e,t){return!!pt(e,t)}function cn(e,t){let n=[];return N(e,function(i,r){n.push(t(i,r))}),n}function os(e){return e&&Object.keys(e)||[]}function Q0(e){return os(e).length}function Jr(e){return cn(e,t=>t)}function eo(e,t,n={}){return t=$u(t),N(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function bd(e,...t){e=$u(e);let n={};return N(t,r=>eo(r,e,n)),cn(n,function(r,o){return r[0]})}const J0=bd;function li(e,t){t=$u(t);let n=[];return N(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 to(e){return function(t){return Pr(e,function(n,i){return t[i]===n})}}function $u(e){return Ut(e)?e:t=>t[e]}function as(e){return Ut(e)?e:t=>t===e}function ew(e){return e}function tw(e){return Number(e)}function Fu(e,t){let n,i,r,o;function a(f){let p=Date.now(),d=f?0:o+t-p;if(d>0)return s(d);e.apply(r,i),c()}function s(f){n=setTimeout(a,f)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...f){o=Date.now(),i=f,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function wn(e,t){return e.bind(t)}function V(e,...t){return Object.assign(e,...t)}function nw(e,t,n){let i=e;return N(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];Ft(a)&&Qr(s)&&(s=i[r]=isNaN(+a)?{}:[]),Cr(a)?Cr(n)?delete i[r]:i[r]=n:i=s}),e}function ai(e,t){let n={},i=Object(e);return N(t,function(r){r in i&&(n[r]=e[r])}),n}function pi(e,t){let n={},i=Object(e);return N(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function ju(){}ju.prototype.get=function(e){return this.$model.properties.get(this,e)},ju.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function xd(e,t){this.model=e,this.properties=t}xd.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(ju.prototype);N(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}),N(a,wn(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 iw=V(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),_d=V(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function Hu(e,t){var n=_d[e];return n?n(t):t}function zu(e){return!!iw[e]}function wd(e){return!!_d[e]}function un(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 Fn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName=Object.create(null),this.properties=[],this.propertiesByName=Object.create(null)}Fn.prototype.build=function(){return ai(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},Fn.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)},Fn.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},Fn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=un(r[0],i),a=un(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},Fn.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},Fn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},Fn.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},Fn.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},Fn.prototype.assertNotTrait=function(e){if((e.extends||[]).length)throw new Error(`cannot create <${e.name}> extending <${e.extends}>`)},Fn.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")},Fn.prototype.hasProperty=function(e){return this.propertiesByName[e]},Fn.prototype.addTrait=function(e,t){t&&this.assertNotTrait(e);var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(N(e.properties,wn(function(o){o=V({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function qi(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,N(e,wn(this.registerPackage,this))}qi.prototype.getPackage=function(e){return this.packageMap[e]},qi.prototype.getPackages=function(){return this.packages},qi.prototype.registerPackage=function(e){e=V({},e);var t=this.packageMap;Ed(t,e,"prefix"),Ed(t,e,"uri"),N(e.types,wn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},qi.prototype.registerType=function(e,t){e=V({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:V({},e.meta||{})});var n=un(e.name,t.prefix),i=n.name,r=Object.create(null);N(e.properties,wn(function(o){var a=un(o.name,n.prefix),s=a.name;zu(o.type)||(o.type=un(o.type,a.prefix).name),V(o,{ns:a,name:s}),r[s]=o},this)),V(e,{ns:n,name:i,propertiesByName:r}),N(e.extends,wn(function(o){var a=un(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},qi.prototype.mapTypes=function(e,t,n){var i=zu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=un(c,zu(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");N(i.superClass,n?a:s),t(i,!n),N(i.traits,a)},qi.prototype.getEffectiveDescriptor=function(e){var t=un(e),n=new Fn(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},qi.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Ed(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Ar(e){this.model=e}Ar.prototype.set=function(e,t,n){if(!Cn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;rw(n)?i?delete e[r]:delete e.$attrs[Gu(t)]:i?r in e?e[r]=n:Sd(e,i,n):e.$attrs[Gu(t)]=n},Ar.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Gu(t)];var i=n.name;return!e[i]&&n.isMany&&Sd(e,n,[]),e[i]},Ar.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=V({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Ar.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Ar.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Ar.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 rw(e){return typeof e>"u"}function Sd(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Gu(e){return e.replace(/^:/,"")}function Un(e,t={}){this.properties=new Ar(this),this.factory=new xd(this,this.properties),this.registry=new qi(e,this.properties),this.typeCache=Object.create(null),this.config=t}Un.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Un.prototype.getType=function(e){var t=this.typeCache,n=Cn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Un.prototype.createAny=function(e,t,n){var i=un(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){nw(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),N(n,function(a,s){Wt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Un.prototype.getPackage=function(e){return this.registry.getPackage(e)},Un.prototype.getPackages=function(){return this.registry.getPackages()},Un.prototype.getElementDescriptor=function(e){return e.$descriptor},Un.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Un.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Un.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Rd=String.fromCharCode,ow=Object.prototype.hasOwnProperty,aw=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Ko={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Ko).forEach(function(e){Ko[e.toUpperCase()]=Ko[e]});function sw(e,t,n,i){return i?ow.call(Ko,i)?Ko[i]:"&"+i+";":Rd(t||parseInt(n,16))}function Tr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(aw,sw):e}var Cd="non-whitespace outside of root node";function Ki(e){return new Error(e)}function cw(e){return"missing namespace for prefix <"+e+">"}function ss(e){return{get:e,enumerable:!0}}function uw(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Pd=Symbol("nameCache");function Vu(e){return e+"$uri"}function lw(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Vu(i)]=n;return t}function cs(){return{line:0,column:0}}function pw(e){throw e}function Ad(e){if(!this)return new Ad(e);var t=e&&e.proxy,n,i,r,o,a=pw,s,c,u,l,f=cs,p=!1,d=!1,m="",h=!1,g=!1,y=null,v=!1,b,x,C,P;function O(D){D instanceof Error||(D=Ki(D)),y=D,a(D,f)}function A(D){s&&(D instanceof Error||(D=Ki(D)),s(D,f))}this.on=function(D,H){if(typeof H!="function")throw Ki("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":l=H;break;case"question":u=H;break;case"comment":c=H;break;default:throw Ki("unsupported event: "+D)}return this},this.ns=function(D){if(typeof D>"u"&&(D={}),typeof D!="object")throw Ki("required args <nsMap={}>");var H=Object.create(null),ae;for(ae in D)H[ae]=D[ae];return g=!0,P=H,this};function I(){b=g?[]:null,x=g?lw(P):null,C=[],f=cs,v=!1,y=null,d=!1,m=""}this.parse=function(D){if(typeof D!="string")throw Ki("required args <xml=string>");if(p)throw Ki("parse during stream; call end() first");return I(),k(D),f=cs,v=!1,y},this.write=function(D){if(typeof D!="string")throw Ki("required args <xml=string>");return p||(I(),p=!0),y||(m=k(m+D,!0)||""),this},this.end=function(){return p||I(),p=!1,y||k(m),m="",f=cs,v=!1,y},this.stop=function(){v=!0};function k(D,H=!1){var ae=null,ye=null,We,Fe=0,q=!1,ue=!1,oe=0,le=0,Me,W,Y,J,Te,ft,M,S,w,z="",U=0,Q;function Ee(it,St){var dn=it.indexOf(":");if(dn===-1)return it;var Kt=x[it.substring(0,dn)];return Kt?St===Kt?it.substr(dn+1):Kt+it.substr(dn):(A(cw(it.substring(0,dn))),null)}function ze(){if(Q!==null)return Q;var it,St,dn=g&&x.xmlns,Kt=g&&h?[]:null,dt=U,Mt=z,on=Mt.length,Vo,$n,oi,an,Vt,_n={},Pi=new Set,hn,tt,rt;e:for(;dt<on;dt++)if(hn=!1,tt=Mt.charCodeAt(dt),!(tt===32||tt<14&&tt>8)){for((tt<65||tt>122||tt>90&&tt<97)&&tt!==95&&tt!==58&&(A("illegal first char attribute name"),hn=!0),rt=dt+1;rt<on;rt++)if(tt=Mt.charCodeAt(rt),!(tt>96&&tt<123||tt>64&&tt<91||tt>47&&tt<59||tt===46||tt===45||tt===95)){if(tt===32||tt<14&&tt>8){A("missing attribute value"),dt=rt;continue e}if(tt===61)break;A("illegal attribute name char"),hn=!0}if(Vt=Mt.substring(dt,rt),Vt==="xmlns:xmlns"&&(A("illegal declaration of xmlns"),hn=!0),tt=Mt.charCodeAt(rt+1),tt===34)rt=Mt.indexOf('"',dt=rt+2),rt===-1&&(rt=Mt.indexOf("'",dt),rt!==-1&&(A("attribute value quote missmatch"),hn=!0));else if(tt===39)rt=Mt.indexOf("'",dt=rt+2),rt===-1&&(rt=Mt.indexOf('"',dt),rt!==-1&&(A("attribute value quote missmatch"),hn=!0));else for(A("missing attribute value quotes"),hn=!0,rt=rt+1;rt<on&&(tt=Mt.charCodeAt(rt+1),!(tt===32||tt<14&&tt>8));rt++);for(rt===-1&&(A("missing closing quotes"),rt=on,hn=!0),hn||(oi=Mt.substring(dt,rt)),dt=rt;rt+1<on&&(tt=Mt.charCodeAt(rt+1),!(tt===32||tt<14&&tt>8));rt++)dt===rt&&(A("illegal character after attribute end"),hn=!0);if(dt=rt+1,hn)continue e;if(Pi.has(Vt)){A("attribute <"+Vt+"> already defined");continue}if(Pi.add(Vt),!g){_n[Vt]=oi;continue}if(h){if($n=Vt==="xmlns"?"xmlns":Vt.charCodeAt(0)===120&&Vt.substr(0,6)==="xmlns:"?Vt.substr(6):null,$n!==null){if(it=Tr(oi),St=Vu($n),an=P[it],!an){if($n==="xmlns"||St in x&&x[St]!==it)do an="ns"+Fe++;while(typeof x[an]<"u");else an=$n;P[it]=an}x[$n]!==an&&(Vo||(x=uw(x),Vo=!0),x[$n]=an,$n==="xmlns"&&(x[Vu(an)]=it,dn=an),x[St]=it),_n[Vt]=oi;continue}Kt.push(Vt,oi);continue}Vt=Ee(Vt,dn),Vt!==null&&(_n[Vt]=oi)}if(h)for(dt=0,on=Kt.length;dt<on;dt++)Vt=Ee(Kt[dt++],dn),oi=Kt[dt],Vt!==null&&(_n[Vt]=oi);return Q=_n}function et(){for(var it=/(\r\n|\r|\n)/g,St=0,dn=0,Kt=0,dt=le,Mt,on;oe>=Kt&&(Mt=it.exec(D),!(!Mt||(dt=Mt[0].length+Mt.index,dt>oe)));)St+=1,Kt=dt;return oe==-1?(dn=dt,on=D.substring(le)):le===0?on=D.substring(le,oe):(dn=oe-Kt,on=le==-1?D.substring(oe):D.substring(oe,le+1)),{data:on,line:St,column:dn}}for(f=et,t&&(w=Object.create({},{name:ss(function(){return M}),originalName:ss(function(){return S}),attrs:ss(ze),ns:ss(function(){return x})}));le!==-1;){if(D.charCodeAt(le)===60?oe=le:oe=D.indexOf("<",le),oe===-1){if(H)return D.substring(le);if(C.length)return O("unexpected end of file");if(!d)return O("missing start tag");le<D.length&&D.substring(le).trim()&&A(Cd);return}if(d||(d=!0),le!==oe){if(C.length){if(n&&(n(D.substring(le,oe),Tr,f),v))return}else if(D.substring(le,oe).trim()&&(A(Cd),v))return}if(J=D.charCodeAt(oe+1),J===33){if(Y=D.charCodeAt(oe+2),Y===91&&D.substr(oe+3,6)==="CDATA["){if(le=D.indexOf("]]>",oe),le===-1)return H?D.substring(oe):O("unclosed cdata");if(o&&(o(D.substring(oe+9,le),f),v))return;le+=3;continue}if(Y===45&&D.charCodeAt(oe+3)===45){if(le=D.indexOf("-->",oe),le===-1)return H?D.substring(oe):O("unclosed comment");if(c&&(c(D.substring(oe+4,le),Tr,f),v))return;le+=3;continue}}if(J===63){if(le=D.indexOf("?>",oe),le===-1)return H?D.substring(oe):O("unclosed question");if(u&&(u(D.substring(oe,le+2),f),v))return;le+=2;continue}for(Me=oe+1;;Me++){if(Te=D.charCodeAt(Me),isNaN(Te))return H?D.substring(oe):(le=-1,O("unclosed tag"));if(Te===34)Y=D.indexOf('"',Me+1),Me=Y!==-1?Y:Me;else if(Te===39)Y=D.indexOf("'",Me+1),Me=Y!==-1?Y:Me;else if(Te===62){le=Me;break}}if(J===33){if(l&&(l(D.substring(oe,le+1),Tr,f),v))return;le+=1;continue}if(Q={},J===47){if(q=!1,ue=!0,!C.length)return O("missing open tag");if(Me=M=C.pop(),Y=oe+2+Me.length,D.substring(oe+2,Y)!==Me)return O("closing tag mismatch");for(;Y<le;Y++)if(J=D.charCodeAt(Y),!(J===32||J>8&&J<14))return O("close tag")}else{if(D.charCodeAt(le-1)===47?(Me=M=D.substring(oe+1,le-1),q=!0,ue=!0):(Me=M=D.substring(oe+1,le),q=!0,ue=!1),!(J>96&&J<123||J>64&&J<91||J===95||J===58))return O("illegal first char nodeName");for(Y=1,W=Me.length;Y<W;Y++)if(J=Me.charCodeAt(Y),!(J>96&&J<123||J>64&&J<91||J>47&&J<59||J===45||J===95||J==46)){if(J===32||J<14&&J>8){M=Me.substring(0,Y),Q=null;break}return O("invalid nodeName")}ue||C.push(M)}if(g){We=x,q&&(ue||b.push(We),Q===null&&(h=Me.indexOf("xmlns",Y)!==-1)&&(U=Y,z=Me,ze(),h=!1)),S=M,ye!==x&&(ae=x[Pd],ae===void 0&&(ae=x[Pd]=Object.create(null)),ye=x);var Pt=ae[M];if(Pt!==void 0)M=Pt;else{if(J=M.indexOf(":"),J!==-1){if(ft=x[M.substring(0,J)],!ft)return O("missing namespace on <"+S+">");M=M.substr(J+1)}else ft=x.xmlns;ft&&(M=ft+":"+M),ae[S]=M}}if(q&&(U=Y,z=Me,i&&(t?i(w,Tr,ue,f):i(M,ze,Tr,ue,f),v)))return;if(ue){if(r&&(r(t?w:M,Tr,q,f),v))return;g&&(q?x=We:x=b.pop())}le+=1}}}function Td(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var Wu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Md="property";function kd(e){return e.xml&&e.xml.serialize}function fw(e){const t=kd(e);return t!==Md&&(t||null)}function dw(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Od(e,t){return Td(t)?e.prefix+":"+dw(e.localName):e.name}function hw(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 mw(e,t,n){const i=un(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=un(r);var a=n.getPackage(o.prefix);return hw(o,a)}function Xi(e){return new Error(e)}function Ai(e){return e.$descriptor}function gw(e){V(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Xi("expected element");var n=this.elementsById,i=Ai(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 Xi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Xo(){}Xo.prototype.handleEnd=function(){},Xo.prototype.handleText=function(){},Xo.prototype.handleNode=function(){};function Uu(){}Uu.prototype=Object.create(Xo.prototype),Uu.prototype.handleNode=function(){return this};function no(){}no.prototype=Object.create(Xo.prototype),no.prototype.handleText=function(e){this.body=(this.body||"")+e};function Zo(e,t){this.property=e,this.context=t}Zo.prototype=Object.create(no.prototype),Zo.prototype.handleNode=function(e){if(this.element)throw Xi("expected no sub nodes");return this.element=this.createReference(e),this},Zo.prototype.handleEnd=function(){this.element.id=this.body},Zo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Yu(e,t){this.element=t,this.propertyDesc=e}Yu.prototype=Object.create(no.prototype),Yu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Hu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function us(){}us.prototype=Object.create(no.prototype),us.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 gn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}gn.prototype=Object.create(us.prototype),gn.prototype.addReference=function(e){this.context.addReference(e)},gn.prototype.handleText=function(e){var t=this.element,n=Ai(t),i=n.bodyProperty;if(!i)throw Xi("unexpected body text <"+e+">");no.prototype.handleText.call(this,e)},gn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ai(t),i=n.bodyProperty;i&&e!==void 0&&(e=Hu(i.type,e),t.set(i.name,e))},gn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ai(n),r=this.context,o=new n({}),a=this.model,s;return N(t,function(c,u){var l=i.propertiesByName[u],f;l&&l.isReference?l.isMany?(f=c.split(" "),N(f,function(p){r.addReference({element:o,property:l.ns.name,id:p})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Hu(l.type,c):u==="xmlns"?u=":"+u:(s=un(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},gn.prototype.getPropertyForNode=function(e){var t=e.name,n=un(t),i=this.type,r=this.model,o=Ai(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=fw(s);if(u){const l=e.attributes[u];if(l){const f=mw(l,e.ns,r),p=r.getType(f);return V({},s,{effectiveType:Ai(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Od(n,c),l=r.getType(u);if(s=pt(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&l.hasType(f.type)}),s)return V({},s,{effectiveType:Ai(l).name})}else if(s=pt(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Xi("unrecognized element <"+n.name+">")},gn.prototype.toString=function(){return"ElementDescriptor["+Ai(this.type).name+"]"},gn.prototype.valueHandler=function(e,t){return new Yu(e,t)},gn.prototype.referenceHandler=function(e){return new Zo(e,this.context)},gn.prototype.handler=function(e){return e==="Element"?new io(this.model,e,this.context):new gn(this.model,e,this.context)},gn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,wd(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(V(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function qu(e,t,n){gn.call(this,e,t,n)}qu.prototype=Object.create(gn.prototype),qu.prototype.createElement=function(e){var t=e.name,n=un(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Od(n,o)||t;if(!r.hasType(a))throw Xi("unexpected element <"+e.originalName+">");return gn.prototype.createElement.call(this,e)};function io(e,t,n){this.model=e,this.context=n}io.prototype=Object.create(us.prototype),io.prototype.createElement=function(e){var t=e.name,n=un(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},io.prototype.handleChild=function(e){var t=new io(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},io.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Ku(e){e instanceof Un&&(e={model:e}),V(this,{lax:!1},e)}Ku.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof gn?(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 gw(V({},t,{rootHandler:i})),s=new Ad({proxy:!0}),c=yw();i.context=a,c.push(i);function u(C,P,O){var A=P(),I=A.line,k=A.column,D=A.data;D.charAt(0)==="<"&&D.indexOf(" ")!==-1&&(D=D.slice(0,D.indexOf(" "))+">");var H="unparsable content "+(D?D+" ":"")+`detected
1
+ (function(se,Lt){typeof exports=="object"&&typeof module<"u"?Lt(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],Lt):(se=typeof globalThis<"u"?globalThis:se||self,Lt(se.BpmnModeler={},se.Vue))})(this,(function(se,Lt){"use strict";var AL=Object.defineProperty;var TL=(se,Lt,Cr)=>Lt in se?AL(se,Lt,{enumerable:!0,configurable:!0,writable:!0,value:Cr}):se[Lt]=Cr;var Jr=(se,Lt,Cr)=>TL(se,typeof Lt!="symbol"?Lt+"":Lt,Cr);const Cr=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway","subProcess","boundaryEvent"],ss=["startEvent","endEvent","userTask","serviceTask","task","sendTask","receiveTask","exclusiveGateway","parallelGateway"];function dd(e){return Cr.includes(e)}function hd(e){return ss.includes(e)}const md="http://g1project.net/spec/bpmn/bwl/1.0",Nu="bwl",$u=["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"],gd={name:"bwl-hints",uri:md,prefix:Nu,xml:{tagAlias:"lowerCase"},types:[{name:"Placement",superClass:["Element"],properties:[{name:"anchor",isAttr:!0,type:"String"},{name:"side",isAttr:!0,type:"String"},{name:"offset",isAttr:!0,type:"Real"}]},{name:"Members",superClass:["Element"],properties:[{name:"refs",isAttr:!0,type:"String"}]},{name:"BandHint",extends:["bpmn:FlowNode"],properties:[{name:"band",isAttr:!0,type:"Integer"}]},{name:"PoolOrderHint",extends:["bpmn:Participant"],properties:[{name:"poolOrder",isAttr:!0,type:"Integer"}]}]},Fu="bwl.undoEpisode",yd=new WeakSet;function N0(e){yd.has(e)||(e.register(Fu,{preExecute(t){try{t.run()}catch(n){t.error=n}}}),yd.add(e))}function vd(e,t){N0(e);const n={run:t};if(e.execute(Fu,n),n.error!==void 0)throw e.canUndo()&&e.undo(),n.error}const bd=["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"],$0={description:"생략 = 보존, null = 제거.",anyOf:[{type:"string"},{type:"null"}]},F0={type:"object",description:"레인. 배열 선언 순서 = 풀 내 상→하 순서.",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},j0={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},H0={type:"object",description:"플로우 노드. 좌표는 지정하지 않는다 — 배치는 resolver 가 결정한다. ⚠ type 집합은 **읽을 수 있는 것보다 좁다** — describe 는 subProcess·boundaryEvent 도 노드로 내지만 그 둘을 새로 만드는 배치는 미실증이라 여기서 받지 않는다(B-87 ⓐ).",properties:{id:{type:"string"},type:{type:"string",enum:[...ss]},name:{type:"string"},participant:{type:"string",description:"소속 풀 id(협업 문서)."},lane:{type:"string",description:"소속 레인 id(풀 정의에 선언된 것)."}},required:["id","type"],additionalProperties:!1},z0={type:"object",description:"분기 조건 — 게이트웨이가 아닌 플로우에 붙인다. MVP 는 label 만.",properties:{label:{type:"string"}},required:["label"],additionalProperties:!1},G0={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},V0={type:"object",description:"메시지 플로우(풀 경계를 넘는 연결 — 노드 또는 블랙박스 풀 자체가 끝점).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"},name:{type:"string"}},required:["id","source","target"],additionalProperties:!1},W0={type:"object",properties:{id:{type:"string"},name:{type:"string"}},required:["id"],additionalProperties:!1},U0={type:"object",description:"데이터 입출력 연관. 방향 = source→target(태스크→스토어 = 쓰기, 스토어→태스크 = 읽기).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},Y0={type:"object",properties:{id:{type:"string"},text:{type:"string"}},required:["id","text"],additionalProperties:!1},q0={type:"object",description:"연관선(주석 ↔ 요소).",properties:{id:{type:"string"},source:{type:"string"},target:{type:"string"}},required:["source","target"],additionalProperties:!1},K0={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},X0={type:"object",description:"주석 방위 힌트 — 앵커 요소 기준 상대 배치. 있으면 결정적 배치, 없으면 휴리스틱.",properties:{anchor:{type:"string",description:"기준 요소 id."},side:{type:"string",enum:[...$u]},offset:{type:"number",description:"앵커 가장자리 → 주석 가장자리 간격(px). 생략 시 50."}},required:["anchor","side"],additionalProperties:!1};function un(e,t){return{type:"object",description:t.description,properties:{kind:{const:e},...t.properties},required:["kind",...t.required??[]],additionalProperties:!1}}const Z0={"participant.add":un("participant.add",{description:"풀 추가. order = 풀 세로 순서 힌트 — **작을수록 위**(생략 시 op 순서가 곧 배치 순서). 값은 상대 순서만 쓰므로 1,2,3… 연속이든 10,20,30 간격이든 같다.",properties:{participant:{$ref:"#/$defs/irParticipant"},order:{type:"integer"}},required:["participant"]}),"participant.update":un("participant.update",{description:"풀 이름/레인 갱신. lanes 는 전체 재선언(생략 = 보존) — 기존 레인을 유지하려면 함께 다시 나열한다.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},lanes:{type:"array",items:{$ref:"#/$defs/irLane"}}},required:["id"]}),"node.add":un("node.add",{description:'플로우 노드 추가. band = 가로 밴드 순번 힌트(주 흐름 0, 갈래 1, 2…) — 위/아래가 아니라 "주 흐름에서 몇 번째 갈래"다. 행 배치(어느 갈래가 위/아래인지)는 호스트가 정한다(대칭·메시지 방향). 레인이 있으면 그 레인 안의 밴드다 — 한 레인 안에서 게이트웨이 출구를 갈라 놓을 때 쓴다. 컨테이너(풀·레인)는 밴드 수만큼 자란다.',properties:{node:{$ref:"#/$defs/irNode"},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["node"]}),"node.update":un("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:[...ss]},band:{type:"integer",description:"0 이상 정수(음수는 payload-invalid 로 거부)."}},required:["id"]}),"sequenceFlow.add":un("sequenceFlow.add",{description:"시퀀스 플로우 추가. 분기 조건은 게이트웨이가 아닌 플로우의 condition 에 싣는다.",properties:{flow:{$ref:"#/$defs/irSequenceFlow"}},required:["flow"]}),"sequenceFlow.update":un("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":un("messageFlow.add",{description:"메시지 플로우 추가(풀 경계를 넘는 연결).",properties:{flow:{$ref:"#/$defs/irMessageFlow"}},required:["flow"]}),"messageFlow.update":un("messageFlow.update",{description:"메시지 플로우 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataStore.add":un("dataStore.add",{description:"데이터 스토어 추가(+ 입출력 연관 동반 가능).",properties:{dataStore:{$ref:"#/$defs/irDataStore"},associations:{type:"array",items:{$ref:"#/$defs/irDataAssociation"}}},required:["dataStore"]}),"dataStore.update":un("dataStore.update",{description:"데이터 스토어 이름 갱신.",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"}},required:["id"]}),"dataAssociation.add":un("dataAssociation.add",{description:"기존 노드 ↔ 기존 데이터 스토어의 입출력 연관 추가.",properties:{association:{$ref:"#/$defs/irDataAssociation"}},required:["association"]}),"association.add":un("association.add",{description:"주석 ↔ 요소 연관 추가(한쪽 끝은 주석). 주석 신설과 함께면 annotation.add 의 association 을 쓰고, 이 op 는 추가 연관(한 주석에 여러 연관)용.",properties:{association:{$ref:"#/$defs/irAssociation"}},required:["association"]}),"annotation.add":un("annotation.add",{description:"텍스트 주석 추가. association 으로 대상 요소와 연결하고, placement 로 방위를 지정하면 결정적 배치된다.",properties:{annotation:{$ref:"#/$defs/irTextAnnotation"},association:{$ref:"#/$defs/irAssociation"},placement:{$ref:"#/$defs/bwlPlacement"}},required:["annotation"]}),"annotation.update":un("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":un("group.add",{description:"그룹 추가 — 바운즈는 members 의 bbox 로 산출되므로 좌표를 지정하지 않는다.",properties:{group:{$ref:"#/$defs/irGroup"}},required:["group"]}),"group.update":un("group.update",{description:"그룹 이름/멤버 갱신. members 는 전체 재선언(생략 = 보존).",properties:{id:{type:"string"},name:{$ref:"#/$defs/nullableString"},members:{type:"array",items:{type:"string"}}},required:["id"]}),"element.remove":un("element.remove",{description:"요소 제거(카테고리 무관). 부착된 연결선은 함께 제거된다.",properties:{id:{type:"string"}},required:["id"]})},xd={anyOf:bd.map(e=>Z0[e])},Q0={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:F0,irParticipant:j0,irNode:H0,irFlowCondition:z0,irSequenceFlow:G0,irMessageFlow:V0,irDataStore:W0,irDataAssociation:U0,irTextAnnotation:Y0,irAssociation:q0,irGroup:K0,bwlPlacement:X0,nullableString:$0,symbolicOp:xd}};function ju(e){return Array.prototype.concat.apply([],e)}const Xo=Object.prototype.toString,J0=Object.prototype.hasOwnProperty;function Pr(e){return e===void 0}function Ht(e){return e!==void 0}function eo(e){return e==null}function Le(e){return Xo.call(e)==="[object Array]"}function Yt(e){return Xo.call(e)==="[object Object]"}function Ne(e){return Xo.call(e)==="[object Number]"}function qt(e){const t=Xo.call(e);return t==="[object Function]"||t==="[object AsyncFunction]"||t==="[object GeneratorFunction]"||t==="[object AsyncGeneratorFunction]"||t==="[object Proxy]"}function Pn(e){return Xo.call(e)==="[object String]"}function ew(e){if(!Le(e))throw new Error("must supply array")}function An(e,t){return!eo(e)&&J0.call(e,t)}function ft(e,t){const n=us(t);let i;return $(e,function(r,o){if(n(r,o))return i=r,!1}),i}function _d(e,t){const n=us(t);let i=Le(e)?-1:void 0;return $(e,function(r,o){if(n(r,o))return i=o,!1}),i}function Ue(e,t){const n=us(t);let i=[];return $(e,function(r,o){n(r,o)&&i.push(r)}),i}function $(e,t){let n,i;if(Pr(e))return;const r=Le(e)?ow:rw;for(let o in e)if(An(e,o)&&(n=e[o],i=t(n,r(o)),i===!1))return n}function tw(e,t){if(Pr(e))return[];ew(e);const n=us(t);return e.filter(function(i,r){return!n(i,r)})}function Tn(e,t,n){return $(e,function(i,r){n=t(n,i,r)}),n}function Ar(e,t){return!!Tn(e,function(n,i,r){return n&&t(i,r)},!0)}function qi(e,t){return!!ft(e,t)}function ln(e,t){let n=[];return $(e,function(i,r){n.push(t(i,r))}),n}function cs(e){return e&&Object.keys(e)||[]}function nw(e){return cs(e).length}function to(e){return ln(e,t=>t)}function no(e,t,n={}){return t=Hu(t),$(e,function(i){let r=t(i)||"_",o=n[r];o||(o=n[r]=[]),o.push(i)}),n}function wd(e,...t){e=Hu(e);let n={};return $(t,r=>no(r,e,n)),ln(n,function(r,o){return r[0]})}const iw=wd;function pi(e,t){t=Hu(t);let n=[];return $(e,function(i,r){let o=t(i,r),a={d:o,v:i};for(var s=0;s<n.length;s++){let{d:c}=n[s];if(o<c){n.splice(s,0,a);return}}n.push(a)}),ln(n,i=>i.v)}function io(e){return function(t){return Ar(e,function(n,i){return t[i]===n})}}function Hu(e){return qt(e)?e:t=>t[e]}function us(e){return qt(e)?e:t=>t===e}function rw(e){return e}function ow(e){return Number(e)}function zu(e,t){let n,i,r,o;function a(f){let p=Date.now(),d=f?0:o+t-p;if(d>0)return s(d);e.apply(r,i),c()}function s(f){n=setTimeout(a,f)}function c(){n&&clearTimeout(n),n=o=i=r=void 0}function u(){n&&a(!0),c()}function l(...f){o=Date.now(),i=f,r=this,n||s(t)}return l.flush=u,l.cancel=c,l}function Sn(e,t){return e.bind(t)}function V(e,...t){return Object.assign(e,...t)}function aw(e,t,n){let i=e;return $(t,function(r,o){if(typeof r!="number"&&typeof r!="string")throw new Error("illegal key type: "+typeof r+". Key should be of type number or string.");if(r==="constructor")throw new Error("illegal key: constructor");if(r==="__proto__")throw new Error("illegal key: __proto__");let a=t[o+1],s=i[r];Ht(a)&&eo(s)&&(s=i[r]=isNaN(+a)?{}:[]),Pr(a)?Pr(n)?delete i[r]:i[r]=n:i=s}),e}function si(e,t){let n={},i=Object(e);return $(t,function(r){r in i&&(n[r]=e[r])}),n}function fi(e,t){let n={},i=Object(e);return $(i,function(r,o){t.indexOf(o)===-1&&(n[o]=r)}),n}function Gu(){}Gu.prototype.get=function(e){return this.$model.properties.get(this,e)},Gu.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};function Ed(e,t){this.model=e,this.properties=t}Ed.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Gu.prototype);$(e.properties,function(a){!a.isMany&&a.default!==void 0&&(i[a.name]=a.default)}),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(a){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),$(a,Sn(function(s,c){this.set(c,s)},this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var sw=V(Object.create(null),{String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0}),Sd=V(Object.create(null),{String:function(e){return e},Boolean:function(e){return e==="true"},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e)}});function Vu(e,t){var n=Sd[e];return n?n(t):t}function Wu(e){return!!sw[e]}function Rd(e){return!!Sd[e]}function pn(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=pn(r[0],i),a=pn(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||($(e.properties,Sn(function(o){o=V({},o,{name:o.ns.localName,inherited:t}),Object.defineProperty(o,"definedBy",{value:e});var a=o.replaces,s=o.redefines;a||s?this.redefineProperty(o,a||s,a):(o.isBody&&this.setBodyProperty(o),o.isId&&this.setIdProperty(o),this.addProperty(o))},this)),i.push(e),n[r]=e)};function Ki(e,t){this.packageMap=Object.create(null),this.typeMap=Object.create(null),this.packages=[],this.properties=t,$(e,Sn(this.registerPackage,this))}Ki.prototype.getPackage=function(e){return this.packageMap[e]},Ki.prototype.getPackages=function(){return this.packages},Ki.prototype.registerPackage=function(e){e=V({},e);var t=this.packageMap;Cd(t,e,"prefix"),Cd(t,e,"uri"),$(e.types,Sn(function(n){this.registerType(n,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Ki.prototype.registerType=function(e,t){e=V({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:V({},e.meta||{})});var n=pn(e.name,t.prefix),i=n.name,r=Object.create(null);$(e.properties,Sn(function(o){var a=pn(o.name,n.prefix),s=a.name;Wu(o.type)||(o.type=pn(o.type,a.prefix).name),V(o,{ns:a,name:s}),r[s]=o},this)),V(e,{ns:n,name:i,propertiesByName:r}),$(e.extends,Sn(function(o){var a=pn(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},Ki.prototype.mapTypes=function(e,t,n){var i=Wu(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(c,u){var l=pn(c,Wu(c)?"":e.prefix);r.mapTypes(l,t,u)}function a(c){return o(c,!0)}function s(c){return o(c,!1)}if(!i)throw new Error("unknown type <"+e.name+">");$(i.superClass,n?a:s),t(i,!n),$(i.traits,a)},Ki.prototype.getEffectiveDescriptor=function(e){var t=pn(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},Ki.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};function Cd(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function Tr(e){this.model=e}Tr.prototype.set=function(e,t,n){if(!Pn(t)||!t.length)throw new TypeError("property name must be a non-empty string");var i=this.getProperty(e,t),r=i&&i.name;cw(n)?i?delete e[r]:delete e.$attrs[Uu(t)]:i?r in e?e[r]=n:Pd(e,i,n):e.$attrs[Uu(t)]=n},Tr.prototype.get=function(e,t){var n=this.getProperty(e,t);if(!n)return e.$attrs[Uu(t)];var i=n.name;return!e[i]&&n.isMany&&Pd(e,n,[]),e[i]},Tr.prototype.define=function(e,t,n){if(!n.writable){var i=n.value;n=V({},n,{get:function(){return i}}),delete n.value}Object.defineProperty(e,t,n)},Tr.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Tr.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},Tr.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 cw(e){return typeof e>"u"}function Pd(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function Uu(e){return e.replace(/^:/,"")}function Yn(e,t={}){this.properties=new Tr(this),this.factory=new Ed(this,this.properties),this.registry=new Ki(e,this.properties),this.typeCache=Object.create(null),this.config=t}Yn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},Yn.prototype.getType=function(e){var t=this.typeCache,n=Pn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},Yn.prototype.createAny=function(e,t,n){var i=pn(e),r={$type:e,$instanceOf:function(a){return a===this.$type},get:function(a){return this[a]},set:function(a,s){aw(this,[a],s)}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"get",{enumerable:!1,writable:!0}),this.properties.define(r,"set",{enumerable:!1,writable:!0}),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),this.properties.define(r,"$instanceOf",{enumerable:!1,writable:!0}),$(n,function(a,s){Yt(a)&&a.value!==void 0?r[a.name]=a.value:r[s]=a}),r},Yn.prototype.getPackage=function(e){return this.registry.getPackage(e)},Yn.prototype.getPackages=function(){return this.registry.getPackages()},Yn.prototype.getElementDescriptor=function(e){return e.$descriptor},Yn.prototype.hasType=function(e,t){t===void 0&&(t=e,e=this);var n=e.$model.getElementDescriptor(e);return t in n.allTypesByName},Yn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},Yn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var Ad=String.fromCharCode,uw=Object.prototype.hasOwnProperty,lw=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/ig,Zo={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};Object.keys(Zo).forEach(function(e){Zo[e.toUpperCase()]=Zo[e]});function pw(e,t,n,i){return i?uw.call(Zo,i)?Zo[i]:"&"+i+";":Ad(t||parseInt(n,16))}function Mr(e){return e.length>3&&e.indexOf("&")!==-1?e.replace(lw,pw):e}var Td="non-whitespace outside of root node";function Xi(e){return new Error(e)}function fw(e){return"missing namespace for prefix <"+e+">"}function ls(e){return{get:e,enumerable:!0}}function dw(e){var t=Object.create(null),n;for(n in e)t[n]=e[n];return t}var Md=Symbol("nameCache");function Yu(e){return e+"$uri"}function hw(e){var t=Object.create(null),n,i;for(n in e)i=e[n],t[i]=i,t[Yu(i)]=n;return t}function ps(){return{line:0,column:0}}function mw(e){throw e}function kd(e){if(!this)return new kd(e);var t=e&&e.proxy,n,i,r,o,a=mw,s,c,u,l,f=ps,p=!1,d=!1,m="",h=!1,g=!1,y=null,v=!1,b,x,C,P;function D(L){L instanceof Error||(L=Xi(L)),y=L,a(L,f)}function T(L){s&&(L instanceof Error||(L=Xi(L)),s(L,f))}this.on=function(L,H){if(typeof H!="function")throw Xi("required args <name, cb>");switch(L){case"openTag":i=H;break;case"text":n=H;break;case"closeTag":r=H;break;case"error":a=H;break;case"warn":s=H;break;case"cdata":o=H;break;case"attention":l=H;break;case"question":u=H;break;case"comment":c=H;break;default:throw Xi("unsupported event: "+L)}return this},this.ns=function(L){if(typeof L>"u"&&(L={}),typeof L!="object")throw Xi("required args <nsMap={}>");var H=Object.create(null),ae;for(ae in L)H[ae]=L[ae];return g=!0,P=H,this};function I(){b=g?[]:null,x=g?hw(P):null,C=[],f=ps,v=!1,y=null,d=!1,m=""}this.parse=function(L){if(typeof L!="string")throw Xi("required args <xml=string>");if(p)throw Xi("parse during stream; call end() first");return I(),k(L),f=ps,v=!1,y},this.write=function(L){if(typeof L!="string")throw Xi("required args <xml=string>");return p||(I(),p=!0),y||(m=k(m+L,!0)||""),this},this.end=function(){return p||I(),p=!1,y||k(m),m="",f=ps,v=!1,y},this.stop=function(){v=!0};function k(L,H=!1){var ae=null,ye=null,We,Fe=0,q=!1,ue=!1,oe=0,le=0,ke,W,Y,J,Te,dt,M,S,w,z="",U=0,Q;function we(it,Ct){var gn=it.indexOf(":");if(gn===-1)return it;var Zt=x[it.substring(0,gn)];return Zt?Ct===Zt?it.substr(gn+1):Zt+it.substr(gn):(T(fw(it.substring(0,gn))),null)}function ze(){if(Q!==null)return Q;var it,Ct,gn=g&&x.xmlns,Zt=g&&h?[]:null,ht=U,kt=z,sn=kt.length,Uo,Fn,ai,cn,Ut,En={},Ai=new Set,yn,tt,ot;e:for(;ht<sn;ht++)if(yn=!1,tt=kt.charCodeAt(ht),!(tt===32||tt<14&&tt>8)){for((tt<65||tt>122||tt>90&&tt<97)&&tt!==95&&tt!==58&&(T("illegal first char attribute name"),yn=!0),ot=ht+1;ot<sn;ot++)if(tt=kt.charCodeAt(ot),!(tt>96&&tt<123||tt>64&&tt<91||tt>47&&tt<59||tt===46||tt===45||tt===95)){if(tt===32||tt<14&&tt>8){T("missing attribute value"),ht=ot;continue e}if(tt===61)break;T("illegal attribute name char"),yn=!0}if(Ut=kt.substring(ht,ot),Ut==="xmlns:xmlns"&&(T("illegal declaration of xmlns"),yn=!0),tt=kt.charCodeAt(ot+1),tt===34)ot=kt.indexOf('"',ht=ot+2),ot===-1&&(ot=kt.indexOf("'",ht),ot!==-1&&(T("attribute value quote missmatch"),yn=!0));else if(tt===39)ot=kt.indexOf("'",ht=ot+2),ot===-1&&(ot=kt.indexOf('"',ht),ot!==-1&&(T("attribute value quote missmatch"),yn=!0));else for(T("missing attribute value quotes"),yn=!0,ot=ot+1;ot<sn&&(tt=kt.charCodeAt(ot+1),!(tt===32||tt<14&&tt>8));ot++);for(ot===-1&&(T("missing closing quotes"),ot=sn,yn=!0),yn||(ai=kt.substring(ht,ot)),ht=ot;ot+1<sn&&(tt=kt.charCodeAt(ot+1),!(tt===32||tt<14&&tt>8));ot++)ht===ot&&(T("illegal character after attribute end"),yn=!0);if(ht=ot+1,yn)continue e;if(Ai.has(Ut)){T("attribute <"+Ut+"> already defined");continue}if(Ai.add(Ut),!g){En[Ut]=ai;continue}if(h){if(Fn=Ut==="xmlns"?"xmlns":Ut.charCodeAt(0)===120&&Ut.substr(0,6)==="xmlns:"?Ut.substr(6):null,Fn!==null){if(it=Mr(ai),Ct=Yu(Fn),cn=P[it],!cn){if(Fn==="xmlns"||Ct in x&&x[Ct]!==it)do cn="ns"+Fe++;while(typeof x[cn]<"u");else cn=Fn;P[it]=cn}x[Fn]!==cn&&(Uo||(x=dw(x),Uo=!0),x[Fn]=cn,Fn==="xmlns"&&(x[Yu(cn)]=it,gn=cn),x[Ct]=it),En[Ut]=ai;continue}Zt.push(Ut,ai);continue}Ut=we(Ut,gn),Ut!==null&&(En[Ut]=ai)}if(h)for(ht=0,sn=Zt.length;ht<sn;ht++)Ut=we(Zt[ht++],gn),ai=Zt[ht],Ut!==null&&(En[Ut]=ai);return Q=En}function et(){for(var it=/(\r\n|\r|\n)/g,Ct=0,gn=0,Zt=0,ht=le,kt,sn;oe>=Zt&&(kt=it.exec(L),!(!kt||(ht=kt[0].length+kt.index,ht>oe)));)Ct+=1,Zt=ht;return oe==-1?(gn=ht,sn=L.substring(le)):le===0?sn=L.substring(le,oe):(gn=oe-Zt,sn=le==-1?L.substring(oe):L.substring(oe,le+1)),{data:sn,line:Ct,column:gn}}for(f=et,t&&(w=Object.create({},{name:ls(function(){return M}),originalName:ls(function(){return S}),attrs:ls(ze),ns:ls(function(){return x})}));le!==-1;){if(L.charCodeAt(le)===60?oe=le:oe=L.indexOf("<",le),oe===-1){if(H)return L.substring(le);if(C.length)return D("unexpected end of file");if(!d)return D("missing start tag");le<L.length&&L.substring(le).trim()&&T(Td);return}if(d||(d=!0),le!==oe){if(C.length){if(n&&(n(L.substring(le,oe),Mr,f),v))return}else if(L.substring(le,oe).trim()&&(T(Td),v))return}if(J=L.charCodeAt(oe+1),J===33){if(Y=L.charCodeAt(oe+2),Y===91&&L.substr(oe+3,6)==="CDATA["){if(le=L.indexOf("]]>",oe),le===-1)return H?L.substring(oe):D("unclosed cdata");if(o&&(o(L.substring(oe+9,le),f),v))return;le+=3;continue}if(Y===45&&L.charCodeAt(oe+3)===45){if(le=L.indexOf("-->",oe),le===-1)return H?L.substring(oe):D("unclosed comment");if(c&&(c(L.substring(oe+4,le),Mr,f),v))return;le+=3;continue}}if(J===63){if(le=L.indexOf("?>",oe),le===-1)return H?L.substring(oe):D("unclosed question");if(u&&(u(L.substring(oe,le+2),f),v))return;le+=2;continue}for(ke=oe+1;;ke++){if(Te=L.charCodeAt(ke),isNaN(Te))return H?L.substring(oe):(le=-1,D("unclosed tag"));if(Te===34)Y=L.indexOf('"',ke+1),ke=Y!==-1?Y:ke;else if(Te===39)Y=L.indexOf("'",ke+1),ke=Y!==-1?Y:ke;else if(Te===62){le=ke;break}}if(J===33){if(l&&(l(L.substring(oe,le+1),Mr,f),v))return;le+=1;continue}if(Q={},J===47){if(q=!1,ue=!0,!C.length)return D("missing open tag");if(ke=M=C.pop(),Y=oe+2+ke.length,L.substring(oe+2,Y)!==ke)return D("closing tag mismatch");for(;Y<le;Y++)if(J=L.charCodeAt(Y),!(J===32||J>8&&J<14))return D("close tag")}else{if(L.charCodeAt(le-1)===47?(ke=M=L.substring(oe+1,le-1),q=!0,ue=!0):(ke=M=L.substring(oe+1,le),q=!0,ue=!1),!(J>96&&J<123||J>64&&J<91||J===95||J===58))return D("illegal first char nodeName");for(Y=1,W=ke.length;Y<W;Y++)if(J=ke.charCodeAt(Y),!(J>96&&J<123||J>64&&J<91||J>47&&J<59||J===45||J===95||J==46)){if(J===32||J<14&&J>8){M=ke.substring(0,Y),Q=null;break}return D("invalid nodeName")}ue||C.push(M)}if(g){We=x,q&&(ue||b.push(We),Q===null&&(h=ke.indexOf("xmlns",Y)!==-1)&&(U=Y,z=ke,ze(),h=!1)),S=M,ye!==x&&(ae=x[Md],ae===void 0&&(ae=x[Md]=Object.create(null)),ye=x);var Tt=ae[M];if(Tt!==void 0)M=Tt;else{if(J=M.indexOf(":"),J!==-1){if(dt=x[M.substring(0,J)],!dt)return D("missing namespace on <"+S+">");M=M.substr(J+1)}else dt=x.xmlns;dt&&(M=dt+":"+M),ae[S]=M}}if(q&&(U=Y,z=ke,i&&(t?i(w,Mr,ue,f):i(M,ze,Mr,ue,f),v)))return;if(ue){if(r&&(r(t?w:M,Mr,q,f),v))return;g&&(q?x=We:x=b.pop())}le+=1}}}function Od(e){return e.xml&&e.xml.tagAlias==="lowerCase"}var qu={xsi:"http://www.w3.org/2001/XMLSchema-instance",xml:"http://www.w3.org/XML/1998/namespace"},Dd="property";function Ld(e){return e.xml&&e.xml.serialize}function gw(e){const t=Ld(e);return t!==Dd&&(t||null)}function yw(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Id(e,t){return Od(t)?e.prefix+":"+yw(e.localName):e.name}function vw(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 bw(e,t,n){const i=pn(e,t.xmlns),r=`${t[i.prefix]||i.prefix}:${i.localName}`,o=pn(r);var a=n.getPackage(o.prefix);return vw(o,a)}function Zi(e){return new Error(e)}function Ti(e){return e.$descriptor}function xw(e){V(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(t){this.references.push(t)},this.addElement=function(t){if(!t)throw Zi("expected element");var n=this.elementsById,i=Ti(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 Zi("duplicate ID <"+o+">");n[o]=t}},this.addWarning=function(t){this.warnings.push(t)}}function Qo(){}Qo.prototype.handleEnd=function(){},Qo.prototype.handleText=function(){},Qo.prototype.handleNode=function(){};function Ku(){}Ku.prototype=Object.create(Qo.prototype),Ku.prototype.handleNode=function(){return this};function ro(){}ro.prototype=Object.create(Qo.prototype),ro.prototype.handleText=function(e){this.body=(this.body||"")+e};function Jo(e,t){this.property=e,this.context=t}Jo.prototype=Object.create(ro.prototype),Jo.prototype.handleNode=function(e){if(this.element)throw Zi("expected no sub nodes");return this.element=this.createReference(e),this},Jo.prototype.handleEnd=function(){this.element.id=this.body},Jo.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}};function Xu(e,t){this.element=t,this.propertyDesc=e}Xu.prototype=Object.create(ro.prototype),Xu.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=Vu(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)};function fs(){}fs.prototype=Object.create(ro.prototype),fs.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 vn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}vn.prototype=Object.create(fs.prototype),vn.prototype.addReference=function(e){this.context.addReference(e)},vn.prototype.handleText=function(e){var t=this.element,n=Ti(t),i=n.bodyProperty;if(!i)throw Zi("unexpected body text <"+e+">");ro.prototype.handleText.call(this,e)},vn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ti(t),i=n.bodyProperty;i&&e!==void 0&&(e=Vu(i.type,e),t.set(i.name,e))},vn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ti(n),r=this.context,o=new n({}),a=this.model,s;return $(t,function(c,u){var l=i.propertiesByName[u],f;l&&l.isReference?l.isMany?(f=c.split(" "),$(f,function(p){r.addReference({element:o,property:l.ns.name,id:p})})):r.addReference({element:o,property:l.ns.name,id:c}):(l?c=Vu(l.type,c):u==="xmlns"?u=":"+u:(s=pn(u,i.ns.prefix),a.getPackage(s.prefix)&&r.addWarning({message:"unknown attribute <"+u+">",element:o,property:u,value:c})),o.set(u,c))}),o},vn.prototype.getPropertyForNode=function(e){var t=e.name,n=pn(t),i=this.type,r=this.model,o=Ti(i),a=n.name,s=o.propertiesByName[a];if(s&&!s.isAttr){const u=gw(s);if(u){const l=e.attributes[u];if(l){const f=bw(l,e.ns,r),p=r.getType(f);return V({},s,{effectiveType:Ti(p).name})}}return s}var c=r.getPackage(n.prefix);if(c){const u=Id(n,c),l=r.getType(u);if(s=ft(o.properties,function(f){return!f.isVirtual&&!f.isReference&&!f.isAttribute&&l.hasType(f.type)}),s)return V({},s,{effectiveType:Ti(l).name})}else if(s=ft(o.properties,function(u){return!u.isReference&&!u.isAttribute&&u.type==="Element"}),s)return s;throw Zi("unrecognized element <"+n.name+">")},vn.prototype.toString=function(){return"ElementDescriptor["+Ti(this.type).name+"]"},vn.prototype.valueHandler=function(e,t){return new Xu(e,t)},vn.prototype.referenceHandler=function(e){return new Jo(e,this.context)},vn.prototype.handler=function(e){return e==="Element"?new oo(this.model,e,this.context):new vn(this.model,e,this.context)},vn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,Rd(n))return this.valueHandler(t,i);t.isReference?r=this.referenceHandler(t).handleNode(e):r=this.handler(n).handleNode(e);var o=r.element;return o!==void 0&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(V(o,{element:i}),this.context.addReference(o)):o.$parent=i),r};function Zu(e,t,n){vn.call(this,e,t,n)}Zu.prototype=Object.create(vn.prototype),Zu.prototype.createElement=function(e){var t=e.name,n=pn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Id(n,o)||t;if(!r.hasType(a))throw Zi("unexpected element <"+e.originalName+">");return vn.prototype.createElement.call(this,e)};function oo(e,t,n){this.model=e,this.context=n}oo.prototype=Object.create(fs.prototype),oo.prototype.createElement=function(e){var t=e.name,n=pn(t),i=n.prefix,r=e.ns[i+"$uri"],o=e.attributes;return this.model.createAny(t,r,o)},oo.prototype.handleChild=function(e){var t=new oo(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},oo.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)};function Qu(e){e instanceof Yn&&(e={model:e}),V(this,{lax:!1},e)}Qu.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof vn?(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 xw(V({},t,{rootHandler:i})),s=new kd({proxy:!0}),c=_w();i.context=a,c.push(i);function u(C,P,D){var T=P(),I=T.line,k=T.column,L=T.data;L.charAt(0)==="<"&&L.indexOf(" ")!==-1&&(L=L.slice(0,L.indexOf(" "))+">");var H="unparsable content "+(L?L+" ":"")+`detected
2
2
  line: `+I+`
3
3
  column: `+k+`
4
- nested error: `+C.message;if(O)return a.addWarning({message:H,error:C}),!0;throw Xi(H)}function l(C,P){return u(C,P,!0)}function f(){var C=a.elementsById,P=a.references,O,A;for(O=0;A=P[O];O++){var I=A.element,k=C[A.id],D=Ai(I).propertiesByName[A.property];if(k||a.addWarning({message:"unresolved reference <"+A.id+">",element:A.element,property:A.property,value:A.id}),D.isMany){var H=I.get(D.name),ae=H.indexOf(A);ae===-1&&(ae=H.length),k?H[ae]=k:H.splice(ae,1)}else I.set(D.name,k)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,m=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function g(C){if(d.test(C)){var P=m.exec(C),O=P&&P[1];!O||h.test(O)||a.addWarning({message:"unsupported document encoding <"+O+">, falling back to UTF-8"})}}function y(C,P){var O=c.peek();try{c.push(O.handleNode(C))}catch(A){u(A,P,o)&&c.push(new Uu)}}function v(C,P){try{c.peek().handleText(C)}catch(O){l(O,P)}}function b(C,P){C.trim()&&v(C,P)}var x=r.getPackages().reduce(function(C,P){return C[P.uri]=P.prefix,C},Object.entries(Wu).reduce(function(C,[P,O]){return C[O]=P,C},r.config&&r.config.nsMap||{}));return s.ns(x).on("openTag",function(C,P,O,A){var I=C.attrs||{},k=Object.keys(I).reduce(function(H,ae){var ye=P(I[ae]);return H[ae]=ye,H},{}),D={name:C.name,originalName:C.originalName,attributes:k,ns:C.ns};y(D,A)}).on("question",g).on("closeTag",p).on("cdata",v).on("text",function(C,P,O){b(P(C),O)}).on("error",u).on("warn",l),new Promise(function(C,P){var O;try{s.parse(e),f()}catch(H){O=H}var A=i.element;!O&&!A&&(O=Xi("failed to parse document as <"+i.type.$descriptor.name+">"));var I=a.warnings,k=a.references,D=a.elementsById;return O?(O.warnings=I,P(O)):C({rootElement:A,elementsById:D,references:k,warnings:I})})},Ku.prototype.handler=function(e){return new qu(this.model,e)};function yw(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var vw=`<?xml version="1.0" encoding="UTF-8"?>
5
- `,bw=/<|>|'|"|&|\n\r|\n/g,Dd=/<|>|&/g;function fi(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}fi.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},fi.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},fi.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},fi.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)},fi.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},fi.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},fi.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},fi.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},fi.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 xw(e){return e.charAt(0).toLowerCase()+e.slice(1)}function _w(e,t){return Td(t)?xw(e):e}function Ld(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Id(e){return Cn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function ww(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 Ew(e,t){return t.isGeneric?V({localName:t.ns.localName},e):V({localName:_w(t.ns.localName,t.$pkg)},e)}function Sw(e,t){return V({localName:t.ns.localName},e)}function Rw(e){var t=e.$descriptor;return Ue(t.properties,function(n){var i=n.name;if(n.isVirtual||!Pn(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var Cw={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},Pw={"<":"lt",">":"gt","&":"amp"};function Bd(e,t,n){return e=Cn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function Aw(e){return Bd(e,bw,Cw)}function Tw(e){return Bd(e,Dd,Pw)}function Mw(e){return Ue(e,function(t){return t.isAttr})}function kw(e){return Ue(e,function(t){return!t.isAttr})}function Xu(e){this.tagName=e}Xu.prototype.build=function(e){return this.element=e,this},Xu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function Mr(){}Mr.prototype.serializeValue=Mr.prototype.serializeTo=function(e){e.append(this.escape?Tw(this.value):this.value)},Mr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Dd)!==-1&&(this.escape=!0),this};function Zu(e){this.tagName=e}Ld(Zu,Mr),Zu.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function vt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}vt.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=Rw(e),this.parseAttributes(Mw(r)),this.parseContainments(kw(r))),this.parseGenericAttributes(e,i),this},vt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return Ew(t,e)},vt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return Sw(t,e)},vt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},vt.prototype.nsAttributeName=function(e){var t;if(Cn(e)?t=un(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:V({localName:t.localName},n)},vt.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}))},vt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new Mr().build({type:"String"},t));var n=e.$children;n&&N(n,i=>{this.body.push(new vt(this).build(i))})},vt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=un(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)}},vt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return N(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},vt.prototype.parseGenericAttributes=function(e,t){var n=this;N(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)}})},vt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;N(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new Mr().build(r,o[0]));else if(wd(r.type))N(o,function(u){n.push(new Zu(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)N(o,function(u){n.push(new Xu(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=kd(r);N(o,function(u){var l;c?c===Md?l=new vt(t,r):l=new ls(t,r,c):l=new vt(t),n.push(l.build(u))})}})},vt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new fi(i):t=i),t},vt.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},vt.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},vt.prototype.parseAttributes=function(e){var t=this,n=this.element;N(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];N(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},vt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Id(e)},vt.prototype.addAttribute=function(e,t){var n=this.attrs;Cn(t)&&(t=Aw(t));var i=vd(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)},vt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=ww(n).concat(t)),N(t,function(i){e.append(" ").append(Id(i.name)).append('="').append(i.value).append('"')})},vt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Mr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),N(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function ls(e,t,n){vt.call(this,e,t),this.serialization=n}Ld(ls,vt),ls.prototype.parseNsAttributes=function(e){var t=vt.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},ls.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function Ow(){this.value="",this.write=function(e){this.value+=e}}function Dw(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 Lw(e){e=V({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new Ow,o=new Dw(r,e.format);e.preamble&&o.append(vw);var a=new vt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(Iw(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function Iw(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in Wu)n[i]=Wu[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 ps(e,t){Un.call(this,e,t)}ps.prototype=Object.create(Un.prototype),ps.prototype.fromXML=function(e,t,n){Cn(t)||(n=t,t="bpmn:Definitions");var i=new Ku(V({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},ps.prototype.toXML=function(e,t){var n=new Lw(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var Bw="BPMN20",Nw="http://www.omg.org/spec/BPMN/20100524/MODEL",$w="bpmn",Fw=[],jw=[{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"}]}],Hw=[{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"}]}],zw={tagAlias:"lowerCase",typePrefix:"t"},Gw={name:Bw,uri:Nw,prefix:$w,associations:Fw,types:jw,enumerations:Hw,xml:zw},Vw="BPMNDI",Ww="http://www.omg.org/spec/BPMN/20100524/DI",Uw="bpmndi",Yw=[{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"]}],qw=[{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"}]}],Kw=[],Xw={name:Vw,uri:Ww,prefix:Uw,types:Yw,enumerations:qw,associations:Kw},Zw="DC",Qw="http://www.omg.org/spec/DD/20100524/DC",Jw="dc",eE=[{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}]}],tE=[],nE={name:Zw,uri:Qw,prefix:Jw,types:eE,associations:tE},iE="DI",rE="http://www.omg.org/spec/DD/20100524/DI",oE="di",aE=[{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"}]}],sE=[],cE={tagAlias:"lowerCase"},uE={name:iE,uri:rE,prefix:oE,types:aE,associations:sE,xml:cE},lE="bpmn.io colors for BPMN",pE="http://bpmn.io/schema/bpmn/biocolor/1.0",fE="bioc",dE=[{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"}]}],hE=[],mE=[],gE={name:lE,uri:pE,prefix:fE,types:dE,enumerations:hE,associations:mE},yE="BPMN in Color",vE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",bE="color",xE=[{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"}]}],_E=[],wE=[],EE={name:yE,uri:vE,prefix:bE,types:xE,enumerations:_E,associations:wE};const SE={bpmn:Gw,bpmndi:Xw,dc:nE,di:uE,bioc:gE,color:EE};function Nd(e,t){const n=V({},SE,e);return new ps(n,t)}const RE={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"}},CE="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",$d="i18n",fs={[$d]:RE,[Lu]:dd};function Fd(){return Nd(fs)}const jd=Fd();async function Qu(e){const{rootElement:t,warnings:n}=await jd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function PE(e){const{xml:t}=await jd.toXML(e,{format:!0});return t}function Ju(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ro={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},AE=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function TE(e){const t=ro;return AE.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*TE(i);return n}function Hd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&ME(e),kE(e),OE(e),DE(e)}function ME(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*ro.ascentEm,fontBoundingBoxDescent:o*ro.descentEm,actualBoundingBoxAscent:o*ro.ascentEm,actualBoundingBoxDescent:o*ro.descentEm}}};t.getContext=()=>n}function kE(e){if(e.SVGMatrix)return;class t{constructor(){Zr(this,"a",1);Zr(this,"b",0);Zr(this,"c",0);Zr(this,"d",1);Zr(this,"e",0);Zr(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 OE(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,f=Math.cos(l),p=Math.sin(l);a.a=f,a.b=p,a.c=-p,a.d=f,a.e=c-f*c+p*u,a.f=u-p*c-f*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function DE(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 ds=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),LE=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),IE=1,el=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),BE=2;function En(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const zd=20,hs=5,Gd=3,NE=8,Vd=12,$E=Vd*1.2;function tl(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>oo(o,Vd))),r=n.length*$E;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const Wd=1;function yn(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 ao(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 yn(e))for(const s of yn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>Wd)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const u=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);u>=zd&&(!n||u>n.length)&&(n={axis:a.axis,length:u,kind:c})}return n}function nl(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Ud(e,t){const n=ao(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function FE(e,t){let n=0;for(const i of t)i.id!==e.id&&Ud(e,i)&&n++;return n}function jn(e,t){let n=0;for(const i of t)i.id!==e.id&&ao(e,i)&&n++;return n}const Yd=15,qd=20;function jE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-qd||t.at>n[1]+qd)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 il=20;function ms(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>Wd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<zd||n.push([r-il,o+il])}return n}function gs(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of yn(e)){const o=jE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of ms(r,yn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const HE=1,zE=(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 GE(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,f=1;const p=(d,m)=>{if(m===0)return d<=0;const h=d/m;if(m>0){if(h>f)return!1;h>l&&(l=h)}else{if(h<l)return!1;h<f&&(f=h)}return!0};return p(r-e.x,c)&&p(e.x-a,-c)&&p(o-e.y,u)&&p(e.y-s,-u)&&f>l}function rl(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 VE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,so=1;function Ti(e,t){const n=e.x+so,i=e.x+e.width-so,r=e.y+so,o=e.y+e.height-so;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 Qo(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 Kd(e,t){const n=e.label;if(!n)return null;if(yn(e).some(i=>Ti(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(yn(i).some(r=>Ti(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Qo(i).some(r=>Ti(n,r)))return i.id;return null}function Qt(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(GE(e.waypoints[o],e.waypoints[o+1],r,BE)){i.push(r);break}}return i}function WE(e,t,n,i){const r=(u,l,f)=>(l.x-u.x)*(f.y-u.y)-(l.y-u.y)*(f.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Xd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function Jo(e,t){let n=0;for(const i of t){if(i.id===e.id||Xd(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++)WE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function Hn(e,t){let n=0;for(const i of t)i.id===e.id||Xd(e,i)||Jo(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function Zd(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++)Jo(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function ys(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(Jo(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 Qd(e){const t=ys(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let r=0,o=0;for(const[a,s]of t){const c=i.get(a),u=i.get(s);if(!c||!u)continue;const l=n(c.type),f=n(u.type);l==="solid"&&f==="solid"?r++:l==="dashed"&&f==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:UE(e)}}function UE(e){const t=e.shapes.filter(r=>r.type==="bpmn:Participant");if(t.length<3)return 0;const n=r=>{const o=e.shapes.find(a=>a.id===r);if(o)return t.find(a=>o.x>=a.x&&o.y>=a.y&&o.x+o.width<=a.x+a.width&&o.y+o.height<=a.y+a.height)};let i=0;for(const r of e.edges){if(r.type!=="bpmn:MessageFlow"||r.endpoints.length<2)continue;const o=n(r.endpoints[0]),a=n(r.endpoints[1]);if(!o||!a||o.id===a.id)continue;const s=Math.min(o.y,a.y),c=Math.max(o.y+o.height,a.y+a.height);t.some(u=>u.id!==o.id&&u.id!==a.id&&u.y>s&&u.y+u.height<c)&&i++}return i}function Jd(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!el.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 eh(e){var n;const t=(n=yt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=yt(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 th=e=>e?{members:e}:{},zn=e=>e.shapes.filter(t=>!t.container);function YE(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const r=i.endpoints.find(a=>a!==e.id),o=r?n.get(r):void 0;if(o){if(o.container)return o.id;if(o.parent)return o.parent}}}function nh(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(yn(i).some(r=>Ti(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(Qo(i).some(r=>Ti(n,r)))return i.id;return null}function co(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function vn(e){const t=[],n=e.shapes.filter(y=>!y.container);for(const y of e.edges)for(const v of Qt(y,n))t.push({kind:"edge-crosses-shape",edge:y.id,shape:v.id});const i=e.shapes.filter(y=>y.container&&LE.has(y.type));if(i.length){const y=(v,b)=>{const x=e.shapes.find(C=>C.id===b);return!!x&&x.x>=v.x&&x.y>=v.y&&x.x+x.width<=v.x+v.width&&x.y+x.height<=v.y+v.height};for(const v of e.edges)for(const b of Qt(v,i))v.endpoints.includes(b.id)||v.endpoints.some(x=>y(b,x))||t.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:b.id})}const r=e.shapes.filter(y=>y.type==="bpmn:Participant");for(let y=0;y<r.length;y++)for(let v=y+1;v<r.length;v++){const b=r[y],x=r[v];if(b.x+b.width<=x.x||x.x+x.width<=b.x||b.y+b.height<=x.y||x.y+x.height<=b.y)continue;const C=(P,O)=>P.x<=O.x&&P.y<=O.y&&P.x+P.width>=O.x+O.width&&P.y+P.height>=O.y+O.height;t.push({kind:"pool-overlap",pools:[b.id,x.id],contained:C(b,x)||C(x,b)})}const o=n.filter(y=>!y.attached);for(let y=0;y<o.length;y++)for(let v=y+1;v<o.length;v++){const b=o[y],x=o[v];if(!rl(b,x,IE))continue;const C=b.id<x.id?[b.id,x.id]:[x.id,b.id];t.push({kind:"shape-overlap",shapes:C,identical:VE(b,x)})}const a=e.shapes.filter(y=>y.type==="bpmn:Group"&&Array.isArray(y.members)&&y.members.length>0);for(let y=0;y<a.length;y++)for(let v=y+1;v<a.length;v++){const b=a[y],x=a[v],C=Math.min(b.x+b.width,x.x+x.width)-Math.max(b.x,x.x),P=Math.min(b.y+b.height,x.y+x.height)-Math.max(b.y,x.y);if(C<=hs||P<=hs)continue;const O=b.id<x.id?[b.id,x.id]:[x.id,b.id],A=new Set(x.members);if(b.members.some(k=>A.has(k))){const k=Jd(e,a,{x:Math.max(b.x,x.x),y:Math.max(b.y,x.y),right:Math.min(b.x+b.width,x.x+x.width),bottom:Math.min(b.y+b.height,x.y+x.height)});k.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:O,shapes:k});continue}const I=b.x<=x.x&&b.y<=x.y&&b.x+b.width>=x.x+x.width&&b.y+b.height>=x.y+x.height?b.id:x.x<=b.x&&x.y<=b.y&&x.x+x.width>=b.x+b.width&&x.y+x.height>=b.y+b.height?x.id:void 0;t.push({kind:"group-overlap-unintended",groups:O,...I?{container:I}:{}})}const s=new Set(a.flatMap(y=>[...y.members])),c=y=>e.shapes.filter(v=>!v.container&&!el.has(v.type)&&v.x>=y.x&&v.y>=y.y&&v.x+v.width<=y.x+y.width&&v.y+v.height<=y.y+y.height);for(const y of a){const v=c(y);if(!v.length)continue;const b=new Set(y.members),x=v.filter(C=>!b.has(C.id));x.some(C=>s.has(C.id))&&(x.length*2<v.length||t.push({kind:"group-overlap-unreadable",reason:"minority",group:y.id,shapes:x.map(C=>C.id).sort()}))}for(const y of a){const v=new Set(c(y).map(A=>A.id)),b=new Set(y.members),x=new Set([...v].filter(A=>!b.has(A)&&s.has(A)));if(!x.size)continue;let C=!1,P=!1,O=!1;for(const A of e.edges){if(A.type!=="bpmn:SequenceFlow"||!A.source||!A.target)continue;const I=x.has(A.source),k=x.has(A.target);!I&&k&&!v.has(A.source)?C=!0:I&&!k&&!v.has(A.target)?P=!0:I&&k&&(O=!0)}C&&P&&O&&t.push({kind:"group-overlap-unreadable",reason:"throughpass",group:y.id,shapes:[...x].sort()})}const u=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<u.length;y++)for(let v=y+1;v<u.length;v++)for(let b=v+1;b<u.length;b++){const x=[u[y],u[v],u[b]],C={x:Math.max(...x.map(A=>A.x)),y:Math.max(...x.map(A=>A.y)),right:Math.min(...x.map(A=>A.x+A.width)),bottom:Math.min(...x.map(A=>A.y+A.height))};if(C.right-C.x<=hs||C.bottom-C.y<=hs)continue;const P=Jd(e,[],C);if(!P.length)continue;const O=x.map(A=>A.id).sort();t.push({kind:"group-stack-unreadable",groups:O,shapes:P})}for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||el.has(v.type)||v.width<=0||v.height<=0)continue;const b=[["top",y.y,"h",y.x,y.x+y.width],["bottom",y.y+y.height,"h",y.x,y.x+y.width],["left",y.x,"v",y.y,y.y+y.height],["right",y.x+y.width,"v",y.y,y.y+y.height]];for(const[x,C,P,O,A]of b){const I=P==="h"?v.x:v.y,k=P==="h"?v.x+v.width:v.y+v.height;if(!(I<A&&O<k))continue;const D=P==="h"?v.y:v.x,H=P==="h"?v.y+v.height:v.x+v.width;if(!(D<C&&C<H))continue;const ae=Math.min(C-D,H-C);ae<NE||t.push({kind:"group-cuts-shape",group:y.id,shape:v.id,side:x,depth:ae})}}const l=e.shapes.filter(y=>y.container&&y.type!=="bpmn:Group"&&y.type!=="bpmn:Lane");for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of l){const b=y.x<v.x+v.width&&v.x<y.x+y.width,x=y.y<v.y+v.height&&v.y<y.y+y.height,C=[["top",y.y,v.y,b],["bottom",y.y+y.height,v.y+v.height,b],["left",y.x,v.x,x],["right",y.x+y.width,v.x+v.width,x]];for(const[P,O,A,I]of C)I&&Math.abs(O-A)<=Gd&&t.push({kind:"group-on-container-boundary",group:y.id,container:v.id,side:P})}const f=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<f.length;y++)for(let v=y+1;v<f.length;v++){const b=f[y],x=f[v],C=b.x<x.x+x.width&&x.x<b.x+b.width,P=b.y<x.y+x.height&&x.y<b.y+b.height,O=[["x",b.x+b.width,x.x,P],["x",x.x+x.width,b.x,P],["y",b.y+b.height,x.y,C],["y",x.y+x.height,b.y,C]];for(const[A,I,k,D]of O)if(D&&Math.abs(I-k)<=Gd){t.push({kind:"group-on-group-boundary",groups:b.id<x.id?[b.id,x.id]:[x.id,b.id],axis:A});break}}for(let y=0;y<e.edges.length;y++)for(let v=y+1;v<e.edges.length;v++){const b=e.edges[y],x=e.edges[v],C=ao(b,x);if(!C)continue;const P=b.id<x.id?[b.id,x.id]:[x.id,b.id];t.push({kind:C.kind==="opposite"?"edge-overlap-opposite":C.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:P,axis:C.axis,length:Math.round(C.length)})}for(const y of e.edges){if(!y.label)continue;const v=gs(y,e.edges);v&&t.push({kind:"label-on-shared-segment",edge:y.id,other:v.other,axis:v.axis})}for(const y of e.edges){if(!y.label)continue;const v=Kd(y,e);v&&t.push({kind:"label-over-line",edge:y.id,line:v})}const p=new Set(n.map(y=>y.id)),d=e.shapes.filter(y=>y.type==="bpmn:Participant"&&y.label);for(const y of[...n,...d.filter(v=>!p.has(v.id))]){if(!y.label)continue;const v=nh(y,e);v&&t.push({kind:"label-over-line",edge:y.id,line:v})}const m=new Set(e.shapes.filter(y=>y.type==="bpmn:TextAnnotation").map(y=>y.id));for(const y of d)for(const{owner:v,rect:b}of co(e))v===y.id||m.has(v)||rl(y.label,b,so)&&t.push({kind:"pool-name-over-label",pool:y.id,label:v});const h=co(e);for(const y of n)if(y.type==="bpmn:TextAnnotation")for(const{owner:v,rect:b}of h)v!==y.id&&rl(y,b,so)&&t.push({kind:"annotation-over-label",annotation:y.id,label:v});const g=new Map(e.shapes.map(y=>[y.id,y]));for(const y of n){const v=y.parent??YE(y,e,g);if(!v)continue;const b=g.get(v);!b||!b.container||zE(b,y,HE)||t.push({kind:"shape-outside-container",shape:y.id,container:b.id})}return t.sort((y,v)=>En(y).localeCompare(En(v)))}const yt=e=>typeof e=="object"&&e!==null?e:void 0,Rt=e=>typeof e=="number"?e:0,Mi=e=>{const t=yt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function qE(e){const t=yt(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=Mi(o);a&&n.push(a)}}return n}function KE(e){const t=yt(e);if(!t)return{};const n=Array.isArray(t.sourceRef)?void 0:Mi(t.sourceRef),i=Array.isArray(t.targetRef)?void 0:Mi(t.targetRef);return n&&i?{source:n,target:i}:{}}function XE(e,t){const n=yt(e.$parent);if(!n)return;const i=typeof n.$type=="string"?n.$type:"";if(i==="bpmn:Process"){const r=Mi(n);return r?t.get(r):void 0}if(ds.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return Mi(n)}function ih(e){var a,s,c,u,l;const t=[],n=[],i=((a=yt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=yt(e))==null?void 0:s.rootElements)??[]){const p=yt(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const m=yt(d),h=Mi(m),g=Mi(m==null?void 0:m.processRef);h&&g?r.set(g,h):h&&o.add(h)}}for(const f of i){const p=yt((c=yt(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const m of d){const h=yt(m);if(!h)continue;const g=yt(h.bpmnElement),y=typeof(g==null?void 0:g.id)=="string"?g.id:void 0;if(!y)continue;const v=typeof(g==null?void 0:g.$type)=="string"?g.$type:"",b=yt(h.bounds);if(b){const C=h.isExpanded===!1&&v!=="bpmn:Participant",P=yt((u=yt(h.label))==null?void 0:u.bounds),O={id:y,type:v,x:Rt(b.x),y:Rt(b.y),width:Rt(b.width),height:Rt(b.height),container:ds.has(v)&&!C,attached:(g==null?void 0:g.attachedToRef)!==void 0,...g?{parent:XE(g,r)}:{},...P?{label:{x:Rt(P.x),y:Rt(P.y),width:Rt(P.width),height:Rt(P.height)}}:{},...v==="bpmn:Group"?th(eh(g)):{}},A=h.isHorizontal!==!1,I=typeof(g==null?void 0:g.name)=="string"?g.name:"";o.has(y)&&A&&I&&(O.label=tl(O,I)),t.push(O);continue}const x=h.waypoint;if(Array.isArray(x)){const C=yt((l=yt(h.label))==null?void 0:l.bounds);n.push({id:y,type:v,waypoints:x.map(P=>{var O,A;return{x:Rt((O=yt(P))==null?void 0:O.x),y:Rt((A=yt(P))==null?void 0:A.y)}}),endpoints:qE(g),...KE(g),...C?{label:{x:Rt(C.x),y:Rt(C.y),width:Rt(C.width),height:Rt(C.height)}}:{}})}}}return{shapes:t,edges:n}}function rh(e){return vn(ih(e))}async function ZE(e){const{definitions:t,warnings:n}=await Qu(e);return{findings:rh(t),warnings:n}}function nt(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=yt(o.label),g=Mi(o.source),y=Mi(o.target);n.push({id:o.id,type:a,waypoints:s.map(v=>({x:Rt(v.x),y:Rt(v.y)})),endpoints:[g,y].filter(v=>!!v),...g&&y?{source:g,target:y}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Rt(h.y),width:Rt(h.width),height:Rt(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=yt(o.businessObject),u=yt(o.label);let l=yt(o.parent);for(;l&&l.type==="bpmn:Lane";)l=yt(l.parent);const f=typeof(l==null?void 0:l.type)=="string"?l.type:"",p=l&&ds.has(f)&&f!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Rt(o.width),height:Rt(o.height),container:ds.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:Rt(u.y),width:Rt(u.width),height:Rt(u.height)}}:{},...a==="bpmn:Group"?th(eh(c)):{}},m=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&m&&((i=yt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=tl(d,m)),t.push(d)}return{shapes:t,edges:n}}const QE={"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 JE(e,t){const n=QE[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function oh(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function ah(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 JE(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&oh(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?oh(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 ol=20,e1=4,ht=(e,t)=>Math.abs(e-t)<.5;function vs(e,t,n,i=ol){if(ht(e.y,t.y)&&!ht(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=u=>[{x:a,y:e.y},{x:a,y:u},{x:s,y:u},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(ht(e.x,t.x)&&!ht(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=u=>[{x:e.x,y:a},{x:u,y:a},{x:u,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function sh(e,t,n,i=ol){if(n.length<2)return null;if(ht(e.y,t.y)&&!ht(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,u=e.x<t.x?s:a,l=Math.min(...n.map(d=>d.y))-i,f=Math.max(...n.map(d=>d.y+d.height))+i,p=d=>[{x:c,y:e.y},{x:c,y:d},{x:u,y:d},{x:u,y:e.y}];return[p(l),p(f)]}if(ht(e.x,t.x)&&!ht(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,u=e.y<t.y?s:a,l=Math.min(...n.map(d=>d.x))-i,f=Math.max(...n.map(d=>d.x+d.width))+i,p=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:u},{x:e.x,y:u}];return[p(l),p(f)]}return null}function ch(e,t,n=ol){if(e.length!==4)return null;const[i,r,o,a]=e;if(ht(i.y,r.y)&&ht(r.x,o.x)&&ht(o.y,a.y)){const s=c=>[i,{x:c,y:i.y},{x:c,y:a.y},a];return[s(t.x-n),s(t.x+t.width+n)]}if(ht(i.x,r.x)&&ht(r.y,o.y)&&ht(o.x,a.x)){const s=c=>[i,{x:i.x,y:c},{x:a.x,y:c},a];return[s(t.y-n),s(t.y+t.height+n)]}return null}function bs(e,t){if(e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const uh=30,t1=[0,-25,25,-40,40];function n1(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+uh:s-uh,u=a?i.y+i.height:i.y,l=n.x+n.width/2,f=i.x+i.width/2;return t1.map(p=>[{x:l,y:s},{x:l,y:c},{x:f+p,y:c},{x:f+p,y:u}])}const al=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],uo=(e,t,n)=>Qt({...e,waypoints:t},n).length;function sl(e,t,n,i){let r=[...e.waypoints],o=uo(e,r,t);if(o===0)return null;let a=!1;for(const f of bs(e,t))if(uo(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(yn),c=f=>yn({...e,waypoints:f}).some(p=>ms(p,s).length>0),u=n1(e,t).filter(f=>uo(e,f,t)===0);if(u.length)return u.find(f=>!c(f))??u[0];const l=f=>!n||f.every(p=>p.x>=n.x&&p.x<=n.x+n.width&&p.y>=n.y&&p.y<=n.y+n.height);if(e.endpoints.length===2&&r.length>2){const f=t.find(d=>d.id===e.endpoints[0]),p=t.find(d=>d.id===e.endpoints[1]);if(f&&p&&ht(f.y+f.height/2,p.y+p.height/2)){const d=[r[0],r[r.length-1]];if(ht(d[0].y,d[1].y)&&!ht(d[0].x,d[1].x)){const m=t.filter(v=>!e.endpoints.includes(v.id)&&Qt({...e,waypoints:d},[v]).length>0),h=m.length>=2?sh(d[0],d[1],m):null,y=(h?h.map(v=>[d[0],...v,d[1]]):m.length===1?(vs(d[0],d[1],m[0])??[]).map(v=>[d[0],...v,d[1]]):m.length===0?[d]:[]).filter(v=>uo(e,v,t)===0&&v.length<=r.length).sort((v,b)=>Number(l(b))-Number(l(v)));if(y.length)return y.find(v=>!c(v))??y[0]}}}for(let f=0;f+1<r.length;f++){const p=r[f],d=r[f+1],m=t.filter(y=>!e.endpoints.includes(y.id)&&Qt({...e,waypoints:[p,d]},[y]).length>0);if(m.length<2)continue;const h=sh(p,d,m);if(!h)continue;const g=h.map(y=>al(r,f,y)).filter(y=>uo(e,y,t)===0).sort((y,v)=>Number(l(v))-Number(l(y)));if(g.length)return g.find(y=>!c(y))??g[0]}for(let f=0;f<e1&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const m=r[d],h=r[d+1];for(const g of t){if(e.endpoints.includes(g.id)||Qt({...e,waypoints:[m,h]},[g]).length===0)continue;const y=vs(m,h,g),v=y?y.map(x=>al(r,d,x)):ch(r,g)??[];if(!v.length)continue;const b=[...v].sort((x,C)=>Number(l(C))-Number(l(x)));for(const x of b){const C=uo(e,x,t);if(C<o){r=x,o=C,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function cl(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=zn(o),s=new Set,c=vn(o).filter(l=>l.kind==="edge-crosses-shape"&&!t.has(En(l)));if(!c.length)return s;const u=new Map;for(const l of c){if(l.kind!=="edge-crosses-shape"||u.has(l.edge))continue;const f=o.edges.find(p=>p.id===l.edge);f&&u.set(l.edge,f)}for(const[l,f]of u){if(n&&!n.has(l))continue;const p=i.get(l);if(!p)continue;const d=p.parent,m=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=sl(f,a,m,o.edges);if(!h){Qt(f,a).some(b=>b.type==="bpmn:TextAnnotation")&&s.add(l);continue}const g=o.edges.filter(b=>b.id!==l),y=jn(f,g);jn({...f,waypoints:h},g)>y||r.updateWaypoints(p,h)}return s}const i1=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},ul=(e,t)=>Jo(e,[t])>0;function lh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=zn(o);let s=o;const c=new Set(vn(o).map(En));for(const[u,l]of ys(o))if(!t.has(`${u}|${l}`))for(const[f,p]of[[u,l],[l,u]]){if(n.has(f))continue;const d=s.edges.find(I=>I.id===f),m=s.edges.find(I=>I.id===p);if(!d||!m)continue;const h=i.get(f);if(!h)continue;const g=h.parent,y=g&&typeof g.x=="number"&&typeof g.width=="number"?{x:g.x,y:g.y,width:g.width,height:g.height}:void 0,v=i1(m),b=[...bs(d,a)??[]],x=sl(d,[...a,...v],y,o.edges);x&&b.push(x);for(let I=0;I+1<d.waypoints.length;I++)for(const k of v)for(const D of vs(d.waypoints[I],d.waypoints[I+1],k)??[])b.push(al(d.waypoints,I,D));const C=s.edges.filter(I=>I.id!==f),P=I=>({...s,edges:s.edges.map(k=>k.id===f?{...k,waypoints:I}:k)}),O=I=>!y||I.every(k=>k.x>=y.x&&k.x<=y.x+y.width&&k.y>=y.y&&k.y<=y.y+y.height),A=b.find(I=>{const k={...d,waypoints:I};return ul(k,m)||!O(I)||C.some(D=>D.id!==p&&!ul(d,D)&&ul(k,D))?!1:vn(P(I)).every(D=>c.has(En(D)))});if(A){r.updateWaypoints(h,A),s=P(A);break}}}const r1=10;function ph(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 fh(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=ph(i,n),a=ph(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter(H=>H.id!==o.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=u.y).sort((H,ae)=>H.y-ae.y);if(!l.length)return null;const f=l[0],p=l[l.length-1],d=(c.y+c.height+f.y)/2,m=(p.y+p.height+u.y)/2,h=s?d:m,g=s?m:d,y=e.waypoints[0],v=e.waypoints[e.waypoints.length-1],b=zn(t),x=t.edges.filter(H=>H.id!==e.id),C=Hn(e,x),P=Qt(e,b).length;if(C===0&&P===0||P===0&&e.waypoints.length===2)return null;const O=Math.min(...l.map(H=>H.x)),A=Math.max(...l.map(H=>H.x+H.width)),I=(y.x+v.x)/2,k=H=>H.filter((ae,ye)=>ye===0||!(ht(ae.x,H[ye-1].x)&&ht(ae.y,H[ye-1].y)));let D;for(let H=O;H<=A;H+=r1){const ae=k([y,{x:y.x,y:h},{x:H,y:h},{x:H,y:g},{x:v.x,y:g},v]),ye={...e,waypoints:ae};if(Qt(ye,b).length>0)continue;const We=Hn(ye,x),Fe=Math.abs(H-I);(!D||We<D.cross||We===D.cross&&Fe<D.detour)&&(D={pts:ae,cross:We,detour:Fe})}return D&&(P>0?D.cross<=C:D.cross<C)?D.pts:null}function dh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=nt(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=fh(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const di=[25,-25,40,-40],lo=35;function o1(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)-lo:Math.max(e.y+e.height,t.y+t.height)+lo;for(const u of[0,...di])if(!(Math.abs(u)>=e.width/2-5))for(const l of[0,...di]){if(Math.abs(l)>=t.width/2-5)continue;const f=n+u,p=i+l;r.push({pts:[{x:f,y:a},{x:f,y:c},{x:p,y:c},{x:p,y:s}],cost:Math.abs(l)+Math.abs(u)})}}return r}function xs(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(i.x+i.width>n.x)return[];const r=n.y+n.height/2;if(r>=i.y&&r<=i.y+i.height)return o1(n,i);const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-lo:n.y+n.height+lo,f=[];for(const v of[0,...di]){if(Math.abs(v)>=i.width/2-5)continue;const b=o+v;f.push({pts:[{x:n.x,y:r},{x:b,y:r},{x:b,y:c}],cost:Math.abs(v)});for(const x of[0,...di]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;f.push({pts:[{x:C,y:u},{x:C,y:l},{x:b,y:l},{x:b,y:c}],cost:Math.abs(v)+Math.abs(x)})}}const p=50,d=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const v of[0,...di]){if(Math.abs(v)>=n.width/2-5)continue;const b=a+v;f.push({pts:[{x:b,y:m},{x:b,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(v)})}const h=60,g=s?i.y+i.height:i.y,y=s?i.y+i.height+lo:i.y-lo;for(const v of[0,...di]){if(Math.abs(v)>=i.width/2-5)continue;const b=o+v;for(const x of[0,...di]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;f.push({pts:[{x:C,y:m},{x:C,y},{x:b,y},{x:b,y:g}],cost:h+Math.abs(v)+Math.abs(x)})}}return f}const _s=30;function hh(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=ht(i.y,r.y)&&!ht(i.x,r.x),a=ht(i.x,r.x)&&!ht(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)<_s||Math.abs(i.y-(s.y+s.height))<_s)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)<_s||Math.abs(i.x-(s.x+s.width))<_s)return!0}}return!1}const ws=40;function a1(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-ws,a=r.x+r.width+ws,s=r.y-ws,c=r.y+r.height+ws;for(let u=1;u<e.length-2;u++){const l=e[u],f=e[u+1],p={x:Math.min(l.x,f.x),y:Math.min(l.y,f.y)},d={x:Math.max(l.x,f.x),y:Math.max(l.y,f.y)};if(p.x<a&&d.x>o&&p.y<c&&d.y>s){i++;break}}}return i}function mh(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(P=>P.container),i=new Map(t.shapes.map(P=>[P.id,P])),r=zn(t),o=t.edges.filter(P=>P.id!==e.id),a=jn(e,o),s=Hn(e,o),c=P=>a1(P,t.shapes,e.endpoints)+(hh(P,n)?1:0),u=c(e.waypoints),l=P=>{if(!P)return;const O=P.x+P.width/2,A=P.y+P.height/2;return n.find(I=>I.type==="bpmn:Lane"&&O>=I.x&&O<=I.x+I.width&&A>=I.y&&A<=I.y+I.height)},f=l(i.get(e.endpoints[0]??"")),p=l(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,m=P=>{if(!d||!p)return!1;for(let O=1;O<P.length-2;O++){const A=P[O],I=P[O+1];if(ht(A.y,I.y)&&!ht(A.x,I.x)&&A.y>p.y&&A.y<p.y+p.height)return!0}return!1},h=m(e.waypoints),y=(P=>{if(!P)return;const O=P.x+P.width/2,A=P.y+P.height/2;return n.filter(I=>I.type==="bpmn:Participant"&&O>=I.x&&O<=I.x+I.width&&A>=I.y&&A<=I.y+I.height).sort((I,k)=>I.width*I.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),v=P=>{if(!y)return 0;let O=0;for(let A=1;A<P.length-1;A++){const I=P[A];(I.x<y.x||I.x>y.x+y.width||I.y<y.y||I.y>y.y+y.height)&&O++}return O},b=v(e.waypoints);if(!hh(e.waypoints,n)&&!(d&&!h)&&b===0)return null;const x=P=>P.reduce((O,A,I)=>I?O+Math.abs(A.x-P[I-1].x)+Math.abs(A.y-P[I-1].y):0,0);let C;for(const{pts:P,cost:O}of xs(e,i)){const A={...e,waypoints:P};if(Qt(A,r).length>0)continue;const I=jn(A,o);if(I>a)continue;const k=v(P);if(k>b)continue;const D=k<b&&I===0;if(!D&&Hn(A,o)>s)continue;const H=c(P),ae=m(P);if(!D&&!(ae&&!h)&&H>=u)continue;const We=ae?0:1,Fe=x(P);(!C||k<C.out||k===C.out&&(We<C.lane||We===C.lane&&(I<C.opp||I===C.opp&&(H<C.sc||H===C.sc&&(O<C.cost||O===C.cost&&Fe<C.len)))))&&(C={pts:P,out:k,sc:H,lane:We,opp:I,cost:O,len:Fe})}return(C==null?void 0:C.pts)??null}function s1(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=nt(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=zn(a),u=a.edges.filter(d=>d.id!==o),l=Qt(s,c).length,f=jn(s,u),p=Hn(s,u);for(const d of bs(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const m={...s,waypoints:d};if(Qt(m,c).length>l||jn(m,u)>f||Hn(m,u)>p)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function gh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=nt(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=mh(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function ll(e,t){const n=e.waypoints;if(n.length<3)return[];const i=[],r=t.get(e.endpoints[0]??""),o=t.get(e.endpoints[1]??""),a=ht(n[0].x,n[1].x)&&!ht(n[0].y,n[1].y),s=ht(n[n.length-1].x,n[n.length-2].x)&&!ht(n[n.length-1].y,n[n.length-2].y);for(const c of di){if(a&&r&&Math.abs(c)<r.width/2-5){const u=n.map(l=>({...l}));u[0].x+=c,u[1].x+=c,i.push({pts:u,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const u=n.map(l=>({...l}));u[u.length-1].x+=c,u[u.length-2].x+=c,i.push({pts:u,cost:Math.abs(c)})}}return i}function c1(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const r=i.y+i.height<=n.y,o=n.y+n.height<=i.y;if(!r&&!o)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,u=n.y+n.height/2,l=i.x+i.width/2,f=i.y+i.height/2,p=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,m=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,g=[];for(const y of[0,...di])Math.abs(y)<i.width/2-5&&g.push({pts:[{x:p,y:u},{x:l+y,y:u},{x:l+y,y:h}],cost:Math.abs(y)}),Math.abs(y)<i.height/2-5&&g.push({pts:[{x:c,y:d},{x:c,y:f+y},{x:m,y:f+y}],cost:Math.abs(y)});return g}function pl(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const r=Math.max(n.x,i.x),o=Math.min(n.x+n.width,i.x+i.width);if(o-r<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,u=a?i.y+i.height:i.y,l=(r+o)/2,f=[];for(const p of[0,...di]){const d=l+p;d<=r||d>=o||f.push({pts:[{x:d,y:c},{x:d,y:u}],cost:Math.abs(p)})}return f}function yh(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=zn(t),r=t.edges.filter(d=>d.id!==e.id),o=jn(e,r);if(o===0)return null;const a=Hn(e,r);let s;const c=d=>d.reduce((m,h,g)=>g?m+Math.abs(h.x-d[g-1].x)+Math.abs(h.y-d[g-1].y):0,0),u=3,l=d=>{const m=d[0],h=d[d.length-1],g=Math.hypot(h.x-m.x,h.y-m.y);return g>=1&&c(d)/g>=u?1:0},f=l(e.waypoints),p=[...xs(e,n),...pl(e,n),...ll(e,n)];for(const{pts:d,cost:m}of p){const h={...e,waypoints:d};if(Qt(h,i).length>0)continue;const g=jn(h,r),y=Hn(h,r),v=o-g+(f-l(d));if(g>=o||y-a>v)continue;const b=c(d);(!s||g<s.opposite||g===s.opposite&&(y<s.cross||y===s.cross&&(m<s.cost||m===s.cost&&b<s.len)))&&(s={pts:d,opposite:g,cross:y,cost:m,len:b})}return(s==null?void 0:s.pts)??null}function vh(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=ao(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function u1(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=zn(t),r=t.edges.filter(p=>p.id!==e.id),o=vh(e,r);if(o===0)return null;const a=jn(e,r),s=Hn(e,r),c=p=>p.reduce((d,m,h)=>h?d+Math.abs(m.x-p[h-1].x)+Math.abs(m.y-p[h-1].y):0,0),u=2;let l;const f=[...xs(e,n),...pl(e,n),...c1(e,n),...ll(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(Qt(m,i).length>0)continue;const h=vh(m,r);if(h>=o)continue;const g=jn(m,r);if(g-h>a-o)continue;const y=Hn(m,r);if(y-s>(o-h)*u)continue;const v=c(p);(!l||h<l.fake||h===l.fake&&(g<l.unreadable||g===l.unreadable&&(y<l.cross||y===l.cross&&(d<l.cost||d===l.cost&&v<l.length))))&&(l={pts:p,fake:h,unreadable:g,cross:y,cost:d,length:v})}return(l==null?void 0:l.pts)??null}function bh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=vn(nt(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(En(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=nt(i),u=c.edges.find(p=>p.id===s);if(!u)continue;const l=u1(u,c);if(!l)continue;const f=i.get(s);f&&r.updateWaypoints(f,l)}}function xh(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 _h(e,t,n){var u;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((u=ao(e,t))==null?void 0:u.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(l=>l&&(l===o||l===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:xh(e,n)&&xh(t,n)}function wh(e,t,n){let i=0;for(const r of t)r.id!==e.id&&_h(e,r,n)&&i++;return i}function l1(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=zn(t),r=t.edges.filter(p=>p.id!==e.id),o=wh(e,r,n);if(o===0)return null;const a=jn(e,r),s=Hn(e,r),c=p=>p.reduce((d,m,h)=>h?d+Math.abs(m.x-p[h-1].x)+Math.abs(m.y-p[h-1].y):0,0),u=2;let l;const f=[...xs(e,n),...pl(e,n),...ll(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(Qt(m,i).length>0)continue;const h=wh(m,r,n);if(h>=o)continue;const g=jn(m,r);if(g-h>a-o)continue;const y=Hn(m,r);if(y-s>(o-h)*u)continue;const v=c(p);(!l||h<l.chain||h===l.chain&&(g<l.unreadable||g===l.unreadable&&(y<l.cross||y===l.cross&&(d<l.cost||d===l.cost&&v<l.length))))&&(l={pts:p,chain:h,unreadable:g,cross:y,cost:d,length:v})}return(l==null?void 0:l.pts)??null}function p1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=new Map(o.shapes.map(u=>[u.id,u])),s=vn(o).filter(u=>u.kind==="edge-overlap-opposite"&&!t.has(En(u)));if(!s.length)return;const c=new Set;for(const u of s){if(u.kind!=="edge-overlap-opposite")continue;const[l,f]=u.edges.map(p=>o.edges.find(d=>d.id===p));if(!(!l||!f||!_h(l,f,a)))for(const p of u.edges)n.has(p)||c.add(p)}for(const u of[...c].sort()){const l=nt(i),f=l.edges.find(m=>m.id===u);if(!f)continue;const p=l1(f,l);if(!p)continue;const d=i.get(u);d&&r.updateWaypoints(d,p)}}function Eh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=vn(o).filter(l=>nl(l)&&!t.has(En(l)));if(!a.length)return;const s=new Set;for(const l of a)if(nl(l))for(const f of l.edges)n.has(f)||s.add(f);const c=l=>{var f;return((f=o.edges.find(p=>p.id===l))==null?void 0:f.type)??""},u=[...s].sort((l,f)=>{const p=c(l)==="bpmn:SequenceFlow"?0:1,d=c(f)==="bpmn:SequenceFlow"?0:1;return p!==d?p-d:l.localeCompare(f)});for(const l of u){const f=nt(i),p=f.edges.find(h=>h.id===l);if(!p)continue;const d=yh(p,f);if(!d)continue;const m=i.get(l);m&&r.updateWaypoints(m,d)}}const f1=10,d1=(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 Sh(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!gs(e,i))return null;const r=zn(t),o=i.flatMap(yn);for(const a of yn(e)){let s=[[a.lo,a.hi]];for(const[d,m]of ms(a,o))s=s.flatMap(([h,g])=>{const y=[];return d>h&&y.push([h,Math.min(g,d)]),m<g&&y.push([Math.max(h,m),g]),y.filter(([v,b])=>b>v)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,m])=>m-d>=c+f1*2);if(!u)continue;const l=(u[0]+u[1])/2,f=a.axis==="h"?{x:l,y:a.at-Yd}:{x:a.at+Tn+n.width/2,y:l},p={x:f.x-n.width/2,y:f.y-n.height/2,width:n.width,height:n.height};if(!gs({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&d1(p,d)))return p}return null}const Tn=8;function Rh(e,t){const n=e.label;if(!n)return null;const i=yn(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(yn),...t.shapes.filter(p=>p.container).flatMap(Qo)],u=p=>!c.some(d=>Ti(p,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Tn,f=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const p of[s.at+Tn,s.at-Tn-n.width])for(const d of f){const m=n.y+d;if(m<s.lo||m+n.height>s.hi)continue;const h={...n,x:p,y:m};if(u(h))return h}else for(const p of[s.at-Tn-n.height,s.at+Tn])for(const d of f){const m=n.x+d;if(m<s.lo||m+n.width>s.hi)continue;const h={...n,x:m,y:p};if(u(h))return h}return null}function Ch(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=Rh(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 Ph(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=vn(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(En(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(p=>p.id===s.edge);if(!c)continue;const u=Sh(c,o);if(!u)continue;const l=i.get(s.edge),f=l==null?void 0:l.label;f&&r.moveElements([f],{x:u.x-f.x,y:u.y-f.y})}}function Ah(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(yn),...t.shapes.filter(p=>p.container).flatMap(Qo)],r=i.filter(p=>Ti(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=co(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=>Ti(p,d))&&!o.some(d=>s(p,d))&&!a.some(d=>s(p,d)),u=[];for(const p of r)p.axis==="h"?u.push({...n,y:p.at-Tn-n.height},{...n,y:p.at+Tn}):u.push({...n,x:p.at-Tn-n.width},{...n,x:p.at+Tn});const l=e.x+e.width/2,f=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Tn},{...n,x:l-n.width/2,y:e.y-Tn-n.height},{...n,x:e.x+e.width+Tn,y:f-n.height/2},{...n,x:e.x-Tn-n.width,y:f-n.height/2}),u.find(c)??null}function Th(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=Ah(o,nt(n));if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}const h1=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Mh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),kh={"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}]},Es=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),fl=e=>typeof e=="string"&&e!=="";function m1(e){const t=[];function n(i,r,o,a){if(a===null){fl(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!Es(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)fl(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a;if(!Es(i)||!fl(i.kind)||!(i.kind in kh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const s of kh[i.kind]){const c=s.path.endsWith("[]"),u=c?s.path.slice(0,-2):s.path,l=u.split(".");let f=i;for(const d of l.slice(0,-1)){if(!Es(f))break;f=f[d]}if(!Es(f))continue;const p=f[l[l.length-1]];if(!(p===void 0&&s.optional)&&!(p===null&&s.optional)){if(!c){n(r,s.path,p,s.shape);continue}if(!Array.isArray(p)){t.push({kind:"payload-invalid",opIndex:r,field:s.path});continue}p.forEach((d,m)=>n(r,`${u}[${m}]`,d,s.shape))}}if(i.kind==="node.add"||i.kind==="node.update"){const s=i.band;s!==void 0&&(!Number.isInteger(s)||s<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"});const c=i.kind==="node.add"?(o=i.node)==null?void 0:o.type:i.type;typeof c=="string"&&!pd(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 Oh(e,t){const n=m1(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,m){if(!h1.test(d)){i.push({kind:"id-invalid",opIndex:p,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:p,id:d});return}r.set(d,{...m,opIndex:p})}e.forEach((p,d)=>{var m;switch(p.kind){case"participant.add":a(d,p.participant.id,{category:"participant",lanes:(p.participant.lanes??[]).map(h=>h.id)});for(const h of p.participant.lanes??[])a(d,h.id,{category:"lane"});break;case"node.add":a(d,p.node.id,{category:"flowNode",participant:p.node.participant});break;case"sequenceFlow.add":a(d,p.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,p.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,p.dataStore.id,{category:"dataStore"});for(const h of p.associations??[])h.id&&a(d,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":p.association.id&&a(d,p.association.id,{category:"dataAssociation"});break;case"association.add":p.association.id&&a(d,p.association.id,{category:"association"});break;case"annotation.add":a(d,p.annotation.id,{category:"annotation"}),(m=p.association)!=null&&m.id&&a(d,p.association.id,{category:"association"});break;case"group.add":a(d,p.group.id,{category:"group"});break;case"participant.update":if(p.lanes){o.set(p.id,p.lanes.map(h=>h.id));for(const h of p.lanes)t.categoryOf(h.id)===void 0&&a(d,h.id,{category:"lane"})}break}});const s=p=>{var d;return((d=r.get(p))==null?void 0:d.category)??t.categoryOf(p)},c=p=>{const d=r.get(p);return d?d.category==="participant"?p:d.participant:t.categoryOf(p)==="participant"?p:t.participantOf(p)};function u(p,d,m,h){const g=s(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:m});return}if(h&&!h.includes(g)){i.push({kind:"ref-category",opIndex:p,ref:d,role:m,expected:h.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(p=>p.kind==="participant.add");return e.forEach((p,d)=>{var m;switch(p.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:g}=p.node;if(h===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:p.node.id});break}if(u(d,h,"participant",["participant"])===void 0)break;g!==void 0&&((((m=r.get(h))==null?void 0:m.lanes)??o.get(h)??t.lanesOf(h)).includes(g)||i.push({kind:"lane-unknown",opIndex:d,lane:g,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:g,target:y,name:v,condition:b}=p.flow,x=u(d,g,"source",["flowNode"]),C=u(d,y,"target",["flowNode"]);x&&C&&c(g)!==c(y)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),v!==void 0&&b!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:g,target:y}=p.flow,v=u(d,g,"source",["flowNode","participant"]),b=u(d,y,"target",["flowNode","participant"]);if(v&&b){const x=c(g),C=c(y);x!==void 0&&x===C&&i.push({kind:"message-flow-same-pool",opIndex:d,id:h})}break}case"dataStore.add":{for(const h of p.associations??[]){if([h.source,h.target].filter(v=>v===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const y=h.source===p.dataStore.id?h.target:h.source;u(d,y,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:g}=p.association,y=u(d,h,"source"),v=u(d,g,"target");if(y&&v){const b=new Set([y,v]);b.has("dataStore")&&b.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:g})}break}case"association.add":{const{id:h,source:g,target:y}=p.association,v=u(d,g,"source"),b=u(d,y,"target");v&&b&&v!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${g}->${y}`});break}case"annotation.add":{if(p.association){const{source:h,target:g}=p.association;if(h!==p.annotation.id&&g!==p.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:p.annotation.id});else{const y=h===p.annotation.id?g:h;u(d,y,"association")}}p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.add":{for(const h of p.group.members??[]){const g=u(d,h,"member");g&&Mh.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(f(d,p.id,"participant")===void 0)break;if(p.lanes){const h=t.lanesOf(p.id),g=p.lanes.map(v=>v.id);for(const v of h)g.includes(v)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.id,lane:v});for(const v of g)t.categoryOf(v)!==void 0&&!h.includes(v)&&i.push({kind:"id-duplicate",opIndex:d,id:v});const y=g.filter(v=>h.includes(v));y.length===h.length&&y.some((v,b)=>v!==h[b])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:p.id})}break}case"node.update":{if(f(d,p.id,"flowNode")===void 0)break;if(p.lane!==void 0){const h=t.participantOf(p.id);(h?o.get(h)??t.lanesOf(h):[]).includes(p.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:p.lane,participant:h??""})}break}case"sequenceFlow.update":{if(f(d,p.id,"sequenceFlow")===void 0)break;if(p.name!==void 0&&p.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:p.id}),p.source!==void 0||p.target!==void 0){const h=p.source===void 0||u(d,p.source,"source",["flowNode"])!==void 0,g=p.target===void 0||u(d,p.target,"target",["flowNode"])!==void 0,y=t.endpointsOf(p.id),v=p.source??(y==null?void 0:y.source),b=p.target??(y==null?void 0:y.target);h&&g&&v!==void 0&&b!==void 0&&new Set([c(v),c(b),c(p.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:p.id})}break}case"messageFlow.update":f(d,p.id,"messageFlow");break;case"dataStore.update":f(d,p.id,"dataStore");break;case"annotation.update":{if(f(d,p.id,"annotation")===void 0)break;p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.update":{if(f(d,p.id,"group")===void 0)break;for(const h of p.members??[]){const g=u(d,h,"member");g&&Mh.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:g})}break}case"element.remove":{f(d,p.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:p.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function f(p,d,m){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:p,id:d});return}const h=t.categoryOf(d);if(h===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:"target"});return}if(m&&h!==m){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:m,actual:h});return}return h}}function Dh(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function Ss(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const Rs={"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]},Jt=10,Lh=40,g1=10;function dl(e,t,n,i,r){const o=n,a=(k,D)=>{const[H,ae]=Rs[k];let ye={x:t.x+t.width/2+H*(t.width/2+o.width/2+D),y:t.y+t.height/2+ae*(t.height/2+o.height/2+D)};const We=i.x+Jt+o.width/2,Fe=i.x+i.width-Jt-o.width/2,q=i.y+Jt+o.height/2,ue=i.y+i.height-Jt-o.height/2,oe={x:Math.min(Fe,Math.max(We,ye.x)),y:Math.min(ue,Math.max(q,ye.y))};return(oe.x!==ye.x||oe.y!==ye.y)&&(ye=Math.abs(oe.x-(t.x+t.width/2))<(t.width+o.width)/2+Jt&&Math.abs(oe.y-(t.y+t.height/2))<(t.height+o.height)/2+Jt?{x:t.x+t.width+Jt+o.width/2,y:oe.y}:oe),ye},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=nt(e),u=k=>{var H,ae;if(!r.selfId)return!1;const D=e.get(k);return!!D&&(((H=D.source)==null?void 0:H.id)===r.selfId||((ae=D.target)==null?void 0:ae.id)===r.selfId)},l=c.edges.filter(k=>!u(k.id)).flatMap(yn),f=co(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),p=k=>({x0:k.x-o.width/2-Jt,x1:k.x+o.width/2+Jt,y0:k.y-o.height/2-Jt,y1:k.y+o.height/2+Jt}),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 l.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)},g=c.shapes.filter(k=>k.type==="bpmn:Group").flatMap(k=>[{axis:"h",at:k.y,lo:k.x,hi:k.x+k.width},{axis:"h",at:k.y+k.height,lo:k.x,hi:k.x+k.width},{axis:"v",at:k.x,lo:k.y,hi:k.y+k.height},{axis:"v",at:k.x+k.width,lo:k.y,hi:k.y+k.height}]),y=k=>{const D=p(k);return g.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)},v=k=>d(k)||m(k)||h(k)||y(k),b=k=>k.x-o.width/2>=i.x&&k.x+o.width/2<=i.x+i.width&&k.y-o.height/2>=i.y&&k.y+o.height/2<=i.y+i.height;if(r.placement){const k=Fe=>Fe.startsWith("top")?Fe.replace(/^top/,"bottom"):Fe.replace(/^bottom/,"top"),D=Fe=>Fe.endsWith("left")?Fe.replace(/left$/,"right"):Fe.replace(/right$/,"left"),H=r.placement.side,ae=[H,k(H),D(H),k(D(H)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ye=r.placement.offset??50;let We=a(H,ye);if(v(We)){const Fe=new Set;for(const q of ae){if(Fe.has(q))continue;Fe.add(q);const ue=a(q,ye);if(b(ue)&&!v(ue)){We=ue;break}}}return We}const x=r.from,C=i.x+Jt+o.width/2,P=i.x+i.width-Jt-o.width/2,O=i.y+Jt+o.height/2,A=i.y+i.height-Jt-o.height/2;let I={x:Math.min(P,Math.max(C,x.x)),y:Math.min(A,Math.max(O,x.y))};if(v(I)){const k=(t.width+o.width)/2+Jt,H=[{x:I.x+k,y:I.y},{x:I.x-k,y:I.y},{x:I.x,y:I.y-o.height-Jt},{x:I.x,y:I.y+o.height+Jt}].filter(b).find(ae=>!v(ae));H&&(I=H)}return I}function Yt(e,t){return e.filter(n=>n.kind===t)}function Ih(e,t){var l0,p0,f0,d0,h0,m0,g0,y0,v0,b0,x0,_0,w0,E0,S0,R0,C0,P0,A0,T0,M0,k0,O0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=_=>o.get(_),f=_=>{const R=l(_);if(!R)throw new Error(`하강 참조 해소 실패: ${_}`);return R},p=_=>{let R=_.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},d=new Map;for(const _ of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))d.set(_.id,{x:_.x,y:_.y});const m=Yt(e,"participant.add"),h=Yt(e,"node.add"),g=Yt(e,"sequenceFlow.add"),y=Yt(e,"messageFlow.add"),v=Yt(e,"dataStore.add"),b=Yt(e,"dataAssociation.add"),x=Yt(e,"annotation.add"),C=Yt(e,"group.add"),P=new Map(h.map(_=>[_.node.id,_])),O=(_,R,T)=>{var j;const L=_.businessObject,$=(((j=L.extensionElements)==null?void 0:j.values)??[]).filter(G=>G.$type!==R),B=T?[...$,i.create(R,T)]:$;if(!B.length){L.extensionElements&&n.updateProperties(_,{extensionElements:void 0});return}const F=i.create("bpmn:ExtensionElements",{values:B});B.forEach(G=>{G.$parent=F}),n.updateProperties(_,{extensionElements:F})},A=_=>({anchor:_.anchor,side:_.side,..._.offset!==void 0?{offset:_.offset}:{}});for(const _ of Yt(e,"element.remove")){const R=l(_.id);R&&n.removeElements([R])}const I=_=>o.filter(R=>{var T;return R.type==="bpmn:Lane"&&((T=p(R))==null?void 0:T.id)===_}).sort((R,T)=>R.y-T.y);for(const _ of Yt(e,"participant.update")){const R=f(_.id);if(_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),!_.lanes)continue;const T=I(_.id);if(!T.length){n.splitLane(R,_.lanes.length),I(_.id).forEach(($,B)=>{const F=_.lanes[B];F&&n.updateProperties($,{id:F.id,name:F.name})});continue}const L=new Set(T.map($=>$.id));_.lanes.forEach(($,B)=>{if(L.has($.id)){n.updateProperties(f($.id),{name:$.name});return}const F=B===0?n.addLane(I(_.id)[0],"top"):n.addLane(f(_.lanes[B-1].id),"bottom");n.updateProperties(F,{id:$.id,name:$.name})})}const k=150,D=130,H=80,ae=90,ye=180,We=30,Fe=30,q=(_,R,T,L,$)=>{const B=T-R.width/2,F=L-R.height/2;return(_.children??[]).find(j=>!("waypoints"in j&&j.waypoints)&&j.type!=="bpmn:Lane"&&j.type!=="label"&&!($!=null&&$.has(j.id))&&typeof j.x=="number"&&B<j.x+j.width+Fe&&B+R.width+Fe>j.x&&F<j.y+j.height&&F+R.height>j.y)},ue=new Set;for(const _ of m){ue.add(`pool:${_.participant.id}`);for(const R of _.participant.lanes??[])ue.add(R.id)}const oe=new Map;for(const _ of h){const R=_.node.lane??`pool:${_.node.participant??""}`;let T=oe.get(R);T||oe.set(R,T=new Set([0])),_.band!==void 0&&T.add(_.band)}const le=new Map;for(const[_,R]of oe){if(!ue.has(_))continue;const T=[...R].sort((B,F)=>B-F),L=T.map((B,F)=>F===0?0:F%2===1?Math.ceil(F/2):-(F/2)),$=Math.min(...L);le.set(_,new Map(T.map((B,F)=>[B,L[F]-$])))}{const _=new Map;for(const R of m)(R.participant.lanes??[]).forEach((T,L)=>_.set(T.id,L));for(const[R,T]of le){if(!_.has(R)||T.size<2)continue;const L=_.get(R),$=T.get(0)??0,B=new Set;for(const re of h){if(re.node.lane!==R||(re.band??0)!==0||!re.node.type.endsWith("Gateway"))continue;const Oe={in:new Set,out:new Set,cross:new Set};for(const be of g){const Ce=be.flow.source===re.node.id;if(!Ce&&be.flow.target!==re.node.id)continue;const ut=P.get(Ce?be.flow.target:be.flow.source);if(!ut||ut.node.participant!==re.node.participant||!ut.node.lane)continue;let ce,ve=!1;if(ut.node.lane!==R){const de=_.get(ut.node.lane);if(de===void 0)continue;ce=de>L?"down":"up",ve=!0}else{const de=T.get(ut.band??0)??$;ce=de>$?"down":de<$?"up":void 0}ce&&(Oe[Ce?"out":"in"].add(ce),ve&&Oe.cross.add(ce))}for(const be of["up","down"])Oe.in.has(be)&&Oe.out.has(be)&&Oe.cross.has(be)&&B.add(be)}if(B.size!==1)continue;const[F]=B,j=Math.max(...T.values()),G=F==="down"?j:0;if($===G)continue;const K=[...T.entries()].filter(([re])=>re!==0).sort((re,Oe)=>re[1]-Oe[1]),pe=[...Array(j+1).keys()].filter(re=>re!==G),Re=new Map([[0,G]]);K.forEach(([re],Oe)=>Re.set(re,pe[Oe])),le.set(R,Re)}}const Me=_=>{var R;return(((R=oe.get(_))==null?void 0:R.size)??0)>1},W=_=>_.band??(_.node.lane||!Me(`pool:${_.node.participant??""}`)?void 0:0),Y=new Map,J=_=>Y.get(_.node.id)??W(_),Te=new Set,ft=new Set;{const _=new Map;for(const L of g)_.set(L.flow.target,(_.get(L.flow.target)??0)+1);const R=L=>{const $=[],B=new Set([L]),F=[L];for(;F.length;){const j=F.shift();$.push(j);for(const G of g)G.flow.source!==j||B.has(G.flow.target)||(_.get(G.flow.target)??0)!==1||(B.add(G.flow.target),F.push(G.flow.target))}return $},T=(L,$)=>{var B;return((B=le.get(L))==null?void 0:B.get($))??$};for(const L of h){if(!L.node.type.endsWith("Gateway"))continue;const $=L.node.lane??`pool:${L.node.participant??""}`,B=le.get($);if(!B||B.size<2)continue;const F=J(L);if(F===void 0||T($,F)!==T($,0))continue;const j=T($,F),G=g.filter(be=>be.flow.source===L.node.id).map(be=>P.get(be.flow.target)).filter(be=>!!be&&(be.node.lane??`pool:${be.node.participant??""}`)===$),K=G.filter(be=>{const Ce=J(be);return Ce!==void 0&&T($,Ce)===j&&(_.get(be.node.id)??0)===1}),pe=G.some(be=>{const Ce=J(be);return Ce!==void 0&&T($,Ce)>j});if(K.length!==1||!pe)continue;const Re=new Set(G.flatMap(be=>R(be.node.id)));if(!g.some(be=>be.flow.target===L.node.id&&Re.has(be.flow.source)))continue;const Oe=new Map;for(const[be,Ce]of B)Oe.set(be,Ce+1);Oe.set(-1,0),le.set($,Oe);for(const be of R(K[0].node.id))P.has(be)&&(Y.set(be,-1),ft.add(be));Te.add(L.node.id)}}const M=(_,R)=>{var T;return((T=le.get(_))==null?void 0:T.get(R))??R},S=(_,R,T,L)=>{const $=_?l(_):R?l(R):void 0;if(!$)return!1;const B=_?$.y+Math.min($.height/2,ae):$.y+H;return Math.abs(B+M(_??`pool:${R??""}`,T)*k-L)<=k/2},w=new Map;for(const[_,R]of oe){let T=0;for(const L of R)T=Math.max(T,M(_,L));w.set(_,T)}const z=_=>ye+k*_,U=(_,R,T)=>{const L=u().children.filter($=>!("waypoints"in $&&$.waypoints)&&$.id!==R&&typeof $.y=="number"&&$.y>=_);L.length&&n.moveElements(L,{x:0,y:T})},Q=(_,R,T)=>{const L=_.type==="bpmn:Participant"?_:void 0;if(!L||L.children.some(j=>j.type==="bpmn:Lane"))return;const $=T+R.height/2+We-L.y;if(L.height>=$)return;const B=$-L.height,F=L.y+L.height;n.resizeShape(L,{x:L.x,y:L.y,width:L.width,height:$}),U(F,L.id,B)},Ee=(_,R,T)=>{if(_){const F=f(_),j=z(R);if(F.height>=j)return;const G=j-F.height,K=p(F),pe=K?K.y+K.height:F.y+F.height;n.resizeLane(F,{x:F.x,y:F.y,width:F.width,height:j},!1),U(pe,K==null?void 0:K.id,G);return}if(!T)return;const L=k*(R+1);if(T.height>=L)return;const $=L-T.height,B=T.y+T.height;n.resizeShape(T,{x:T.x,y:T.y,width:T.width,height:L}),U(B,T.id,$)},ze=new Map;for(const _ of g)ze.set(_.flow.target,(ze.get(_.flow.target)??0)+1);const et=_=>(ze.get(_)??0)<=1,Pt=(_,R,T)=>{if(!_)return!0;const L=l(_);return L?T-R.height/2>=L.y&&T+R.height/2<=L.y+L.height:!0},it=m.map((_,R)=>({op:_,declared:R}));it.sort((_,R)=>{const T=_.op.order??Number.POSITIVE_INFINITY,L=R.op.order??Number.POSITIVE_INFINITY;return T!==L?T-L:_.declared-R.declared});let St=80;for(const _ of o.getAll())_.parent===u()&&"height"in _&&typeof _.y=="number"&&(St=Math.max(St,_.y+_.height+60));for(const{op:_}of it){const R=_.participant,T=h.filter(re=>re.node.participant===R.id).length,L=((l0=R.lanes)==null?void 0:l0.length)??0,$=Math.max(1200,T*160+300),B=(R.lanes??[]).map(re=>z(w.get(re.id)??0)),F=B.reduce((re,Oe)=>re+Oe,0);L&&F<300&&(B[L-1]+=300-F);const j=Math.max(300,k*((w.get(`pool:${R.id}`)??0)+1)),G=R.blackBox||T+L===0?120:L?Math.max(300,F):j,K=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,..._.order!==void 0?{"bwl:poolOrder":_.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:$,height:G,isExpanded:!0}),pe=n.createShape(K,{x:100+$/2,y:St+G/2},u()),Re=R.lanes??[];if(Re.length&&n.splitLane(pe,Re.length),Re.length){const re=o.filter(Oe=>{var be;return Oe.type==="bpmn:Lane"&&((be=p(Oe))==null?void 0:be.id)===R.id}).sort((Oe,be)=>Oe.y-be.y);if(re.forEach((Oe,be)=>{const Ce=Re[be];Ce&&n.updateProperties(Oe,{id:Ce.id,name:Ce.name})}),B.some(Oe=>Oe!==pe.height/L)){let Oe=pe.y;re.forEach((be,Ce)=>{const ut=B[Ce];n.resizeShape(be,{x:be.x,y:Oe,width:be.width,height:ut}),Oe+=ut})}}St=pe.y+pe.height+60}const dn=_=>{var L;const R=P.get(_);if(R)return R.node.participant??"";const T=l(_);return T?T.type==="bpmn:Participant"?T.id:((L=p(T))==null?void 0:L.id)??"":""},Kt=new Map,dt=_=>{let R=Kt.get(_);return R||Kt.set(_,R={nodes:[],flows:[]}),R};for(const _ of h)dt(_.node.participant??"").nodes.push(_);for(const _ of g)dt(dn(_.flow.source)).flows.push(_);const Mt=_=>{var R;return i.create("bpmn:SequenceFlow",{id:_.id,name:_.name??((R=_.condition)==null?void 0:R.label)})},on=(_,R)=>r.createShape({type:Ss(_.type),businessObject:i.create(Ss(_.type),{id:_.id,name:_.name,...R!==void 0?{"bwl:band":R}:{}})}),Vo=[...it.map(({op:_})=>_.participant.id).filter(_=>Kt.has(_)),...[...Kt.keys()].filter(_=>!m.some(R=>R.participant.id===_))],$n=_=>_.endsWith("Gateway");for(const _ of Vo){const R=Kt.get(_),T=_?f(_):void 0,L=T?T.x+150:250;let $=T?T.y+80:120;const B=(ce,ve,de)=>{if(ce){const he=f(ce);return he.y+Math.min(he.height/2,ae)+M(ce,ve??0)*k}return ve!==void 0&&T?T.y+H+M(`pool:${_}`,ve)*k:de},F=(ce,ve,de)=>{if(ce){const he=f(ce);return he.y+Math.min(he.height/2,ae)+ve*k}return T?T.y+H+ve*k:de},j=ce=>ce.participant?f(ce.participant):u(),G=(ce,ve,de,he,Ye,Je,kt)=>{const Xt=de!==void 0||he!==void 0,Se=M(de??`pool:${_}`,he??0);if((he===void 0||S(de,_,he,kt??Number.NaN))&&kt!==void 0&&Pt(de,ve,kt)&&!q(ce,ve,Ye,kt))return{x:Ye,y:kt};if(Xt)for(let X=0;X<4;X++){const Z=F(de,Se+X,Je);if(!q(ce,ve,Ye,Z))return Ee(de,Se+X,T),{x:Ye,y:Z}}const ke=B(de,he,Je);Xt?Ee(de,Se,T):Q(ce,ve,ke);let ne=Ye;for(let X=0;X<64;X++){const Z=q(ce,ve,ne,ke);if(!Z)break;ne=Z.x+Z.width+D+ve.width/2}return{x:ne,y:ke}},K=new Set(R.flows.map(ce=>ce.flow.target)),pe=new Map;for(const ce of R.nodes){if(K.has(ce.node.id))continue;const ve=on(ce.node,ce.band),de=W(ce),he=ce.node.lane?`${ce.node.lane}|${de??""}`:de!==void 0?`band:${de}`:"",Ye=j(ce.node),Je=G(Ye,ve,ce.node.lane,de,pe.get(he)??L,$);n.createShape(ve,Je,Ye),pe.set(he,Je.x+ve.width+D),!ce.node.lane&&de===void 0&&($+=160)}const Re=new Set,re=new Map,Oe=new Map,be=new Map;if(_&&ue.has(`pool:${_}`)){const ce=new Map;for(const Se of R.flows)ce.set(Se.flow.target,(ce.get(Se.flow.target)??0)+1);const ve=Se=>B(Se.node.lane,J(Se),Number.NaN),de=new Set,he=Se=>{var X;const ke=(X=P.get(Se))==null?void 0:X.node.participant;if(ke)return l(ke);const ne=l(Se);if(ne)return ne.type==="bpmn:Participant"?ne:p(ne)},Ye=Se=>{const ke=[],ne=new Set([Se]),X=[Se];for(;X.length;){const Z=X.shift(),fe=P.get(Z);fe&&ke.push(fe);for(const me of R.flows)me.flow.source!==Z||ne.has(me.flow.target)||(ce.get(me.flow.target)??0)!==1||(ne.add(me.flow.target),X.push(me.flow.target))}return ke},Je=Se=>{if(!T)return;const ke=new Set(Se.map(Z=>Z.node.id));let ne=!1,X=!1;for(const Z of y){if(!ke.has(Z.flow.source))continue;const fe=he(Z.flow.target);!fe||fe.id===T.id||(fe.y<T.y?ne=!0:X=!0)}return ne&&!X?"up":X&&!ne?"down":void 0};for(const Se of R.nodes){if(!$n(Se.node.type))continue;const ke=B(Se.node.lane,W(Se),Number.NaN);if(Number.isNaN(ke))continue;const ne=[];for(const me of R.flows){if(me.flow.source!==Se.node.id)continue;const xe=P.get(me.flow.target);if(!xe||xe.node.lane!==Se.node.lane||(ce.get(xe.node.id)??0)!==1)continue;const Ne=W(xe);if(Ne===void 0)continue;const lt=B(xe.node.lane,Ne,Number.NaN);if(Number.isNaN(lt))continue;const mn=Ye(xe.node.id),At=Je(mn);At&&ne.push({subtree:mn,band:Ne,row:lt,dir:At})}if(!ne.some(me=>me.dir==="up")||!ne.some(me=>me.dir==="down")||!ne.some(me=>me.dir==="up"&&ne.some(xe=>xe.dir==="down"&&xe.row<me.row)))continue;const Z=[...ne].sort((me,xe)=>me.row-xe.row);[...ne.filter(me=>me.dir==="up"),...ne.filter(me=>me.dir==="down")].sort((me,xe)=>me.dir===xe.dir?me.row-xe.row:me.dir==="up"?-1:1).forEach((me,xe)=>{const Ne=Z[xe].band;if(Ne!==me.band){de.add(Se.node.id);for(const lt of me.subtree)W(lt)===me.band&&Y.set(lt.node.id,Ne)}})}const kt=Se=>{if(!T)return;const ke=new Set(Se.map(Z=>Z.node.id));let ne=!1,X=!1;for(const Z of y){if(!ke.has(Z.flow.target))continue;const fe=he(Z.flow.source);!fe||fe.id===T.id||(fe.y<T.y?ne=!0:X=!0)}return ne&&!X?"up":X&&!ne?"down":void 0};for(const Se of R.nodes){if(!$n(Se.node.type))continue;const ke=Se.node.lane??`pool:${_}`,ne=le.get(ke);if(!ne||ne.size<2)continue;const X=ne.get(0);if(X===void 0)continue;const Z=Math.max(...ne.values()),fe=X===Z&&X!==0?"down":void 0;if(!fe)continue;const me=[];for(const At of R.flows){if(At.flow.source!==Se.node.id)continue;const gt=P.get(At.flow.target);if(!gt||gt.node.lane!==Se.node.lane||(ce.get(gt.node.id)??0)!==1)continue;const is=J(gt);is!==void 0&&me.push({t:gt,subtree:Ye(gt.node.id),band:is})}const xe=me.find(At=>(ne.get(At.band)??At.band)===X);if(!xe||kt(xe.subtree)===fe||Je(xe.subtree)===fe)continue;const Ne=me.find(At=>At!==xe&&kt(At.subtree)===fe);if(!Ne)continue;const lt=xe.band,mn=Ne.band;for(const At of xe.subtree)J(At)===lt&&Y.set(At.node.id,mn);for(const At of Ne.subtree)J(At)===mn&&Y.set(At.node.id,lt);de.add(Se.node.id)}for(const Se of R.nodes){if(!$n(Se.node.type))continue;const ke=ve(Se);if(Number.isNaN(ke)||x.some(me=>{var xe,Ne;return(((xe=me.placement)==null?void 0:xe.anchor)??(me.association?me.association.source===me.annotation.id?me.association.target:me.association.source:void 0))===Se.node.id&&((Ne=me.placement)==null?void 0:Ne.side.startsWith("bottom"))}))continue;let X,Z=!1,fe;for(const me of R.flows){if(me.flow.source!==Se.node.id)continue;const xe=P.get(me.flow.target);if(!xe||!xe.node.lane&&W(xe)===void 0)continue;const Ne=ve(xe);Number.isNaN(Ne)||(Math.abs(Ne-ke)<.5&&(Z=!0),Ne>ke?!X||Ne>X.row?X={id:xe.node.id,row:Ne,count:1}:Ne===X.row&&X.count++:Ne<ke&&xe.node.lane===Se.node.lane&&(!fe||Ne>fe.row?fe={op:xe,row:Ne,count:1}:Ne===fe.row&&fe.count++))}X&&X.count===1&&(ce.get(X.id)??0)===1&&!de.has(Se.node.id)&&Re.add(X.id),!Z&&fe&&fe.count===1&&(ce.get(fe.op.node.id)??0)===1&&!Te.has(Se.node.id)&&re.set(fe.op.node.id,{lane:Se.node.lane,band:J(Se)})}const Xt=new Map;for(const Se of y)Xt.set(Se.flow.target,[...Xt.get(Se.flow.target)??[],Se]);for(const Se of R.nodes){const ke=Xt.get(Se.node.id);if(!ke||ke.length!==1||!ce.get(Se.node.id)||!Se.node.lane&&W(Se)===void 0||ft.has(Se.node.id))continue;const ne=(p0=P.get(ke[0].flow.source))==null?void 0:p0.node.participant,X=ne?l(ne):void 0;if(!X||!T||X.id===T.id)continue;const Z=Se.node.lane??`pool:${_}`,fe=le.get(Z);if(!fe)continue;const me=fe.get(0)??0,xe=(fe.get(J(Se)??0)??me)-me;if(xe===0)continue;const Ne=X.y<T.y;if(Ne&&xe<0||!Ne&&xe>0)continue;let lt;for(const[mn,At]of fe){const gt=At-me;(Ne&&gt<0&&(!lt||gt<lt.row)||!Ne&&gt>0&&(!lt||gt>lt.row))&&(lt={band:mn,row:gt})}lt&&Oe.set(Se.node.id,{lane:Se.node.lane,band:lt.band})}}const Ce=new Set;let ut=0;for(;ut++<R.nodes.length+2;){for(let de=0;de<R.nodes.length+R.flows.length+2;de++){let he=!1;for(const Ye of R.flows){const Je=Ye.flow;if(Ce.has(Je.id))continue;const kt=l(Je.source);if(!kt)continue;const Xt=l(Je.target),Se=P.get(Je.target);if(!Xt&&Se){const ke=on(Se.node,Se.band),ne=J(Se);if(Se.node.lane||ne!==void 0){const X=j(Se.node),Z=kt,fe=Z.x+(be.get(Je.source)??0)+Z.width+D,me=re.get(Je.target)??Oe.get(Je.target),xe=G(X,ke,me?me.lane:Se.node.lane,me?me.band:ne,Re.has(Je.target)?Z.x+Z.width/2:fe,Number.NaN,me||!et(Je.target)?void 0:Z.y+Z.height/2),Ne=n.createShape(ke,xe,X);Re.has(Je.target)&&be.set(Je.target,fe-(Ne.x+Ne.width/2)),n.connect(kt,Ne,{type:"bpmn:SequenceFlow",businessObject:Mt(Je)})}else s.append(kt,ke,{connection:{type:"bpmn:SequenceFlow",businessObject:Mt(Je)}})}else if(Xt)n.connect(kt,Xt,{type:"bpmn:SequenceFlow",businessObject:Mt(Je)});else continue;Ce.add(Je.id),he=!0}if(!he)break}const ce=R.nodes.filter(de=>!l(de.node.id));if(!ce.length)break;const ve=ce[0];{const de=on(ve.node,ve.band),he=j(ve.node),Ye=W(ve);n.createShape(de,G(he,de,ve.node.lane,Ye,L,$),he),!ve.node.lane&&Ye===void 0&&($+=160)}}}const oi=40,an=(_,R=()=>!0)=>{const T=l(_);if(!T)return[];const L=[T],$=new Set([_]);for(let B=0;B<L.length;B++){const F=L[B].id;for(const j of g){const G=j.flow.target;if(j.flow.source!==F||$.has(G)||!P.has(G))continue;$.add(G);const K=l(G);K&&R(K)&&L.push(K)}}return L},Vt=(_,R=()=>!0)=>{const T=l(_);if(!T)return[];const L=[T],$=new Set([_]);for(let B=0;B<L.length;B++){const F=L[B].id;for(const j of g){const G=j.flow.source;if(j.flow.target!==F||$.has(G)||!P.has(G))continue;$.add(G);const K=l(G);K&&R(K)&&L.push(K)}}return L},_n=30,Pi=_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number",hn=(_,R)=>{const T=new Set(_.flatMap(F=>F.subtree.map(j=>j.id)));for(const F of _){const j=(F.pool.children??[]).filter(Pi).filter(K=>!T.has(K.id));if(F.subtree.some(K=>j.some(pe=>K.x+R<pe.x+pe.width+_n&&K.x+R+K.width+_n>pe.x&&K.y<pe.y+pe.height&&K.y+K.height>pe.y)))return null}const L=_.map(F=>F.pool.width),$=o.filter(F=>F.type==="label").map(F=>({label:F,x:F.x,y:F.y}));n.moveElements(_.flatMap(F=>F.subtree),{x:R,y:0});const B=_.map(F=>{const G=Math.max(...F.subtree.map(K=>K.x+K.width))+150-(F.pool.x+F.pool.width);return G>0&&n.resizeShape(F.pool,{x:F.pool.x,y:F.pool.y,width:F.pool.width+G,height:F.pool.height}),G});return()=>{n.moveElements(_.flatMap(F=>F.subtree),{x:-R,y:0}),_.forEach((F,j)=>{B[j]>0&&n.resizeShape(F.pool,{x:F.pool.x,y:F.pool.y,width:L[j],height:F.pool.height})});for(let F=0;F<3;F++){let j=0;for(const G of $){const K=G.x-G.label.x,pe=G.y-G.label.y;Math.abs(K)<=.5&&Math.abs(pe)<=.5||(n.moveElements([G.label],{x:K,y:pe}),j++)}if(!j)break}}},tt=_=>{var $,B;const R=new Map,T=new Map;for(const F of o.getAll()){if(F.type!=="bpmn:Participant")continue;const j=F;(j.children??[]).length||(R.set(j.id,j),T.set(j.id,[]))}for(const F of o.getAll()){if(F.type!=="bpmn:MessageFlow")continue;const j=F,G=($=j.source)==null?void 0:$.id,K=(B=j.target)==null?void 0:B.id;G&&K&&T.has(G)&&T.get(G).push(K),G&&K&&T.has(K)&&T.get(K).push(G)}const L=[];for(const[F,j]of T)j.length&&j.every(G=>_.has(G))&&L.push(R.get(F));return L},rt=(_,R)=>{if(!_.length)return null;const T=new Set(_.map(F=>F.id)),L=o.getAll().filter(F=>F.type==="bpmn:Participant"&&!T.has(F.id));if(_.some(F=>L.some(j=>F.x+R<j.x+j.width+_n&&F.x+R+F.width+_n>j.x&&F.y<j.y+j.height&&F.y+F.height>j.y)))return null;const B=o.filter(F=>F.type==="label").map(F=>({label:F,x:F.x,y:F.y}));return n.moveElements(_,{x:R,y:0}),()=>{n.moveElements(_,{x:-R,y:0});for(let F=0;F<3;F++){let j=0;for(const G of B){const K=G.x-G.label.x,pe=G.y-G.label.y;Math.abs(K)<=.5&&Math.abs(pe)<=.5||(n.moveElements([G.label],{x:K,y:pe}),j++)}if(!j)break}}},W_=()=>{let _=0;for(const R of o.getAll()){if(R.type!=="bpmn:DataInputAssociation"&&R.type!=="bpmn:DataOutputAssociation")continue;const T=R.waypoints??[];for(let L=1;L<T.length;L++)_+=Math.hypot(T[L].x-T[L-1].x,T[L].y-T[L-1].y)}return _},U_=()=>vn(nt(o)).filter(_=>_.kind==="edge-crosses-shape").length,Y_=_=>{const R=(_.children??[]).filter(Pi);let T=0;for(let L=0;L<R.length;L++)for(let $=L+1;$<R.length;$++){const B=R[L],F=R[$];B.x<F.x+F.width&&B.x+B.width>F.x&&B.y<F.y+F.height&&B.y+B.height>F.y&&T++}return T},Wo=()=>{const _=nt(o),R=T=>T.length>=2&&(T.every(L=>Math.abs(L.x-T[0].x)<.01)||T.every(L=>Math.abs(L.y-T[0].y)<.01));return{messages:_.edges.filter(T=>T.type==="bpmn:MessageFlow"&&T.waypoints.length===2).length,lines:_.edges.filter(T=>R(T.waypoints)).length}},sL=_=>{const R=$=>{const B=[$],F=new Set([$.id]);for(let j=0;j<B.length;j++)for(const G of B[j].outgoing??[]){if(G.type!=="bpmn:SequenceFlow")continue;const K=G.target;!K||F.has(K.id)||_.has(K.id)||!Pi(K)||K.x<$.x||(F.add(K.id),B.push(K))}return B},T=new Set(_),L=[];for(const $ of o.getAll()){if($.type!=="bpmn:MessageFlow")continue;const B=$;if(!B.waypoints||B.waypoints.length!==2)continue;const F=B.source,j=B.target;if(!F||!j)continue;const G=_.has(F.id);if(G===_.has(j.id))continue;const K=G?j:F,pe=p(K);if(!pe||T.has(K.id))continue;const Re=R(K).filter(re=>!T.has(re.id));if(Re.length){for(const re of Re)T.add(re.id);L.push({subtree:Re,pool:pe})}}return L};for(const _ of Yt(e,"sequenceFlow.update")){if(_.target===void 0)continue;const R=P.get(_.target);if(!R)continue;const T=l(_.target),L=l(_.id);if(!T||!L)continue;const $=_.source!==void 0?l(_.source):L.source,B=L.target;if(!$||!B||B.id===T.id)continue;const F=an(_.target),j=new Set(F.map(he=>he.id)),G=Math.min(...F.map(he=>he.x)),K=Math.max(...F.map(he=>he.x+he.width)),pe=$.x+$.width,Re=K-G+oi*2-(B.x-pe);let re=[];if(Re>0){const he=p(T),Ye=(he==null?void 0:he.children)??[],Je=ke=>ke.type==="bpmn:Lane";re=(()=>{const ke=new Set;for(const X of Ye)Pi(X)&&!j.has(X.id)&&X.id!==$.id&&X.x>=B.x&&ke.add(X.id);const ne=[];for(const X of Ye){if(X.type!=="bpmn:DataStoreReference"&&X.type!=="bpmn:DataObjectReference")continue;const Z=X,me=[...Z.incoming??[],...Z.outgoing??[]].filter(xe=>xe.type==="bpmn:DataInputAssociation"||xe.type==="bpmn:DataOutputAssociation").map(xe=>xe.source===Z?xe.target:xe.source);me.length&&me.every(xe=>xe!==void 0&&ke.has(xe.id))&&ne.push(Z)}return ne})();const Xt=Ye.filter(ke=>!("waypoints"in ke&&ke.waypoints)&&!Je(ke)&&!j.has(ke.id)&&ke.id!==$.id&&ke.x>=B.x),Se=he?[he,...Ye.filter(ke=>Je(ke))]:[];if(Xt.length){const ke=new Set(Xt.map(xe=>xe.id)),ne=sL(ke),X=tt(ke),Z=new Set(ke);for(const xe of ne)for(const Ne of xe.subtree)Z.add(Ne.id);const fe=ne.length?tt(Z):X;n.createSpace(Xt,Se,{x:Re,y:0},"e",B.x-1);let me=!1;if(ne.length){const xe=Wo(),Ne=hn(ne,Re);if(Ne){const lt=fe.length?rt(fe,Re):null,mn=Wo();mn.messages>xe.messages&&mn.lines>=xe.lines?me=!0:(lt==null||lt(),Ne())}}if(!me){for(const xe of ne){const Ne=Wo(),lt=hn([xe],Re);if(!lt)continue;const mn=Wo();(mn.messages<=Ne.messages||mn.lines<Ne.lines)&&lt()}if(X.length){const xe=Wo(),Ne=rt(X,Re);if(Ne){const lt=Wo();(lt.messages<=xe.messages||lt.lines<xe.lines)&&Ne()}}}}}const Oe=$.y+$.height/2,be=Oe-(T.y+T.height/2),Ce=R.band!==void 0,ut=Ce?[T]:F,ce=(R.band===void 0||S(R.node.lane,R.node.participant,R.band,Oe))&&et(_.target)&&ut.every(he=>{var Ye;return Pt((Ye=P.get(he.id))==null?void 0:Ye.node.lane,he,he.y+he.height/2+be)});ce&&Ce?(n.moveElements(F,{x:pe+oi-G,y:0}),n.moveElements([T],{x:0,y:be})):n.moveElements(F,{x:pe+oi-G,y:ce?be:0});const ve=p(T);if(!ce&&R.node.lane===void 0&&R.band!==void 0&&ve){const he=ve.y+H+M(`pool:${R.node.participant??""}`,R.band)*k,Ye=he-(T.y+T.height/2);Ye!==0&&!q(ve,T,T.x+T.width/2,he,j)&&n.moveElements([T],{x:0,y:Ye})}const de=re.length?p(re[0]):void 0;if(de){const he={assoc:W_(),overlaps:Y_(de),crosses:U_()},Ye=re.map(Z=>({st:Z,x:Z.x})),Je=o.filter(Z=>Z.type==="label").map(Z=>({label:Z,x:Z.x,y:Z.y})),kt=Math.min(...re.flatMap(Z=>[...Z.incoming??[],...Z.outgoing??[]].filter(fe=>fe.type==="bpmn:DataInputAssociation"||fe.type==="bpmn:DataOutputAssociation").map(fe=>(fe.source===Z?fe.target:fe.source).x))),Xt=new Set(re.map(Z=>Z.id)),Se=(de.children??[]).filter(Pi).filter(Z=>!Xt.has(Z.id));let ke=kt;for(const Z of[...re].sort((fe,me)=>fe.x-me.x)){let fe=ke;for(let me=0;me<100;me++){const xe=Se.find(Ne=>fe<Ne.x+Ne.width+_n&&fe+Z.width+_n>Ne.x&&Z.y<Ne.y+Ne.height&&Z.y+Z.height>Ne.y);if(!xe)break;fe=xe.x+xe.width+_n}fe!==Z.x&&n.moveElements([Z],{x:fe-Z.x,y:0}),ke=fe+Z.width+_n}const ne=ke+150-(de.x+de.width);ne>0&&n.resizeShape(de,{x:de.x,y:de.y,width:de.width+ne,height:de.height});const X={assoc:W_(),overlaps:Y_(de),crosses:U_()};if(X.assoc>=he.assoc||X.overlaps>he.overlaps||X.crosses>he.crosses){for(const{st:Z,x:fe}of Ye)Z.x!==fe&&n.moveElements([Z],{x:fe-Z.x,y:0});ne>0&&n.resizeShape(de,{x:de.x,y:de.y,width:de.width-ne,height:de.height});for(const Z of Je){const fe=Z.x-Z.label.x,me=Z.y-Z.label.y;(fe!==0||me!==0)&&n.moveElements([Z.label],{x:fe,y:me})}}}}const q_=(_,R)=>{const T=R.target===_,L=f(R.source),$=f(R.target),B=T?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(L,$,R.id?{type:B,businessObject:i.create(B,{id:R.id})}:{type:B})},cL=100,K_=_=>{for(const R of m){if(!R.participant.blackBox)continue;const T=l(R.participant.id);if(!T)continue;const L=[];for(const B of y){const F=B.flow.source===R.participant.id?B.flow.target:B.flow.target===R.participant.id?B.flow.source:void 0,j=F?l(F):void 0;j&&typeof j.x=="number"&&j.type!=="bpmn:Participant"&&L.push(j)}if(!L.length)continue;const $=Math.max(...L.map(B=>B.x+B.width/2))+cL;if($>T.x+T.width&&n.resizeShape(T,{x:T.x,y:T.y,width:$-T.x,height:T.height}),!!_)for(const B of y){const F=l(B.flow.id),j=B.flow.source===R.participant.id?B.flow.target:B.flow.target===R.participant.id?B.flow.source:void 0,G=j?l(j):void 0;if(!F||!G||G.type==="bpmn:Participant")continue;const K=G.x+G.width/2;if(K<T.x+10||K>T.x+T.width-10)continue;const pe=T.y>G.y,Re=pe?G.y+G.height:G.y,re=pe?T.y:T.y+T.height,Oe=B.flow.source===R.participant.id?[{x:K,y:re},{x:K,y:Re}]:[{x:K,y:Re},{x:K,y:re}],be=nt(o),Ce={...be.edges.find(ut=>ut.id===B.flow.id),waypoints:Oe};Qt(Ce,zn(be)).length||n.updateWaypoints(F,Oe)}}};K_(!1);for(const _ of y){const R=_.flow;n.connect(f(R.source),f(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const T=new Set([...g.map(G=>G.flow.id),...y.map(G=>G.flow.id)].filter(G=>!!G)),L=o.filter(G=>!!G.waypoints),$=(G,K)=>Math.abs(K.x-G.x)<2?"L":Math.abs(K.x-(G.x+G.width))<2?"R":Math.abs(K.y-G.y)<2?"T":Math.abs(K.y-(G.y+G.height))<2?"B":void 0,B=new Map,F=(G,K,pe)=>{if(!G||!K||typeof G.x!="number")return;const Re=$(G,K);if(!Re)return;let re=B.get(G.id);re||B.set(G.id,re=new Map),re.set(Re,[...re.get(Re)??[],pe])};for(const G of L){const K=G.waypoints;!K||K.length<2||(F(G.source,K[0],{id:G.id,dir:"out"}),F(G.target,K[K.length-1],{id:G.id,dir:"in"}))}const j=new Set;for(const[G,K]of B){const pe=l(G);if(!pe||typeof pe.x!="number"||![...K.values()].some(ve=>{const de=ve.filter(he=>he.dir==="in");return ve.length>=3&&de.length>=1&&ve.some(he=>he.dir==="out")&&de.some(he=>T.has(he.id))}))continue;const re=p(pe);if(!re||j.has(re.id)||(re.children??[]).some(ve=>ve.type==="bpmn:Lane"))continue;const Oe=(f0=K.get("T"))!=null&&f0.length?(d0=K.get("B"))!=null&&d0.length?void 0:"B":"T";if(!Oe||(Oe==="T"?pe.y-re.y:re.y+re.height-(pe.y+pe.height))>=k)continue;const Ce=(re.children??[]).filter(ve=>!("waypoints"in ve&&ve.waypoints)&&ve.type!=="label"&&typeof ve.x=="number"),ut=re.y+re.height;n.resizeShape(re,{x:re.x,y:re.y,width:re.width,height:re.height+k});const ce=u().children.filter(ve=>!("waypoints"in ve&&ve.waypoints)&&ve.id!==re.id&&typeof ve.y=="number"&&ve.y>=ut);ce.length&&n.moveElements(ce,{x:0,y:k}),Oe==="T"&&Ce.length&&n.moveElements(Ce,{x:0,y:k}),j.add(re.id)}}const od=20,X_=4,uL=2,lL=[10,30,80],Uo=()=>{const _=nt(o);return{bad:vn(_).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:Zd(_),straight:_.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Yo=_=>{const R=nt(o),T=R.edges.find(L=>L.id===_);return T?Qt(T,zn(R)).length:0},Mu=_=>Yo(_)>0,ku=_=>nt(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==_&&R.waypoints.length===2).length,pL=(_,R,T)=>hn([{subtree:_,pool:R}],T),Z_=(_,R)=>R.bad>_.bad||R.crossings>_.crossings&&R.straight<=_.straight&&R.bad>=_.bad,Ou=(_,R)=>Z_(_,R)||R.straight<_.straight,Du=(_,R,T=()=>!0,L=Z_)=>{const $=Uo(),B=hn(_,R);if(!B)return!1;const F=Uo();return L($,F)||!T()?(B(),!1):!0},Q_=(_,R,T,L=()=>!0)=>Du([{subtree:_,pool:R}],T,L),qr=_=>{var R;return!!((R=P.get(_))!=null&&R.node.participant)},ts=new Map;for(const _ of y){if(!qr(_.flow.target))continue;const R=ts.get(_.flow.target)??[];R.push(_),ts.set(_.flow.target,R)}const ad=[...ts.keys()],J_=new Set(g.map(_=>_.flow.target)),e0=_=>it.findIndex(({op:R})=>R.participant.id===_);ad.sort((_,R)=>{var $,B;const T=J_.has(_)?1:0,L=J_.has(R)?1:0;return T!==L?T-L:e0(($=P.get(_))==null?void 0:$.node.participant)-e0((B=P.get(R))==null?void 0:B.node.participant)});const Kr=_=>_.x+_.width/2,fL=_=>{const R=new Map;for(const $ of o.getAll()){const B=$;if(!B.waypoints||!B.source||!B.target)continue;(R.get(B.source.id)??R.set(B.source.id,[]).get(B.source.id)).push(B.target.id)}const T=new Set([_]),L=[_];for(let $=0;$<L.length;$++)for(const B of R.get(L[$])??[])T.has(B)||(T.add(B),L.push(B));return T},dL=(_,R)=>{const T=fL(R);let L;for(const $ of o.getAll()){const B=$;if(B.type!=="bpmn:MessageFlow"||!B.source||!B.target||B.target.id!==_||T.has(B.source.id))continue;const F=B.source;if(typeof F.x!="number"||F.type==="bpmn:Participant")continue;const j=Kr(F);(L===void 0||j>L)&&(L=j)}return L},sd=(_,R)=>{const T=l(_.flow.source);if(T)return T.type==="bpmn:Participant"?dL(T.id,R):Kr(T)},t0=_=>{let R;for(const T of ts.get(_)??[]){const L=sd(T,_);L!==void 0&&(!R||L>R.cx)&&(R={op:T,cx:L})}return R==null?void 0:R.op},hL=_=>{const R=t0(_),T=l(_),L=R?sd(R,_):void 0;return T&&L!==void 0?L-Kr(T):void 0},mL=_=>{const R=hL(_);return R!==void 0&&Math.abs(R)<od},n0=(_,R,T,L,$)=>{var B;for(let F=!0;F;){F=!1;for(const j of y){if(j.flow.id===T)continue;const G=R.has(j.flow.source),K=R.has(j.flow.target);if(G===K||L(G?j.flow.source:j.flow.target))continue;const pe=G?j.flow.target:j.flow.source;if($(pe)||!qr(pe))continue;const Re=l(j.flow.id);if(!(Re!=null&&Re.waypoints)||Re.waypoints.length!==2)continue;const re=l(pe),Oe=(B=P.get(pe))==null?void 0:B.node.participant;if(!re||!Oe)continue;const be=an(pe,Ce=>Ce.x>=re.x).filter(Ce=>!R.has(Ce.id));if(!(!be.length||be.some(Ce=>$(Ce.id)))){for(const Ce of be)R.add(Ce.id);_.set(Oe,[..._.get(Oe)??[],...be]),F=!0}}}return[..._].map(([F,j])=>({subtree:j,pool:f(F)}))},i0=(_,R,T,L,$)=>n0(new Map([[R,[..._]]]),new Set(_.map(B=>B.id)),L,B=>B===T,B=>B===$),cd=_=>{const R=t0(_);if(!R)return null;const T=l(_),L=l(R.flow.source),$=sd(R,_);if(!T||!L||$===void 0)return null;const B=$-Kr(T);if(B>=od){const F=P.get(_).node.participant,j=an(_,G=>G.x>=T.x);return{groups:i0(j,F,_,R.flow.id,R.flow.source),dx:B}}if(-B>=od&&qr(R.flow.source)){const F=P.get(R.flow.source).node.participant,j=an(R.flow.source,G=>G.x>=L.x&&!mL(G.id));return{groups:i0(j,F,R.flow.source,R.flow.id,_),dx:-B}}return null},r0=()=>ad.map(_=>({id:_,plan:cd(_)})).filter(_=>!!_.plan).sort((_,R)=>Math.min(..._.plan.groups.flatMap(T=>T.subtree.map(L=>L.x)))-Math.min(...R.plan.groups.flatMap(T=>T.subtree.map(L=>L.x)))).map(_=>_.id);for(let _=0;_<3;_++){const R=Uo(),T=[];for(const $ of r0()){const B=cd($);if(!B)continue;const F=hn(B.groups,B.dx);F&&T.push(F)}if(!T.length)break;if(!Ou(R,Uo()))continue;for(const $ of T.reverse())$();let L=!1;for(const $ of r0()){const B=cd($);B&&Du(B.groups,B.dx,()=>!0,Ou)&&(L=!0)}if(!L)break}for(const _ of ad.flatMap(R=>ts.get(R)??[])){if(!Mu(_.flow.id))continue;const R=l(_.flow.target);if(!R)continue;const T=f(P.get(_.flow.target).node.participant),L=an(_.flow.target,j=>j.x>=R.x),$=R.width+D,B=Yo(_.flow.id),F=ku(_.flow.id);for(let j=1;j<=X_;j++){const G=()=>Yo(_.flow.id)<B&&ku(_.flow.id)>=F;if(Q_(L,T,$*j,G))break}}for(const _ of y){if(!Mu(_.flow.id))continue;const R=l(_.flow.source),T=l(_.flow.target);if(!R||!T||R.type==="bpmn:Participant"||T.type==="bpmn:Participant")continue;const L=R.x+R.width/2;if(Math.abs(L-(T.x+T.width/2))>15)continue;const[$,B]=R.y<T.y?[R.y+R.height,T.y]:[T.y+T.height,R.y],F=[...P.values()].map(j=>l(j.node.id)).filter(j=>!!j&&j.id!==R.id&&j.id!==T.id).filter(j=>j.x<=L&&L<=j.x+j.width&&j.y+j.height>$&&j.y<B).sort((j,G)=>j.x-G.x);for(const j of F){const G=(h0=P.get(j.id))==null?void 0:h0.node.participant,K=G?l(G):void 0;if(!K)continue;const pe=[...P.values()].filter(de=>de.node.participant===G).map(de=>de.node.id),Re=de=>de.map(he=>l(he)).filter(he=>!!he),Oe=[Vt(j.id,de=>{var he;return((he=P.get(de.id))==null?void 0:he.node.participant)===G}),Re(pe)].filter(de=>de.length),be=j.width+D,Ce=Yo(_.flow.id),ut=ku(_.flow.id),ce=()=>Yo(_.flow.id)<Ce&&ku(_.flow.id)>=ut;let ve=!1;for(const de of Oe){for(let he=1;he<=X_;he++)if(Q_(de,K,be*he,ce)){ve=!0;break}if(ve)break}if(!Mu(_.flow.id))break}}for(const _ of y){if(!Mu(_.flow.id))continue;const R=l(_.flow.id);if(((m0=R==null?void 0:R.waypoints)==null?void 0:m0.length)!==2)continue;const T=l(_.flow.source),L=l(_.flow.target);if(!T||!L||T.type==="bpmn:Participant"||L.type==="bpmn:Participant"||!qr(_.flow.source)||!qr(_.flow.target)||Math.abs(Kr(T)-Kr(L))>uL)continue;const $=Kr(T),B=R.waypoints.map(Ce=>Ce.y),[F,j]=[Math.min(...B),Math.max(...B)],G=zn(nt(o)).filter(Ce=>Ce.id!==T.id&&Ce.id!==L.id&&Ce.x<$&&$<Ce.x+Ce.width&&F<Ce.y+Ce.height&&Ce.y<j);if(!G.length)continue;const K=(g0=P.get(_.flow.source))==null?void 0:g0.node.participant,pe=(y0=P.get(_.flow.target))==null?void 0:y0.node.participant;if(!K||!pe)continue;const Re=new Map;for(const[Ce,ut,ce]of[[_.flow.source,T,K],[_.flow.target,L,pe]]){const ve=Re.get(ce)??[],de=an(Ce,he=>he.x>=ut.x).filter(he=>!ve.some(Ye=>Ye.id===he.id));Re.set(ce,[...ve,...de])}const re=new Set([...Re.values()].flat().map(Ce=>Ce.id)),Oe=n0(Re,re,_.flow.id,Ce=>Ce===_.flow.source||Ce===_.flow.target,()=>!1),be=Math.max(...G.map(Ce=>Ce.x+Ce.width));for(const Ce of lL){const ut=be+Ce-$;if(ut<=0)continue;if(Du(Oe,ut,()=>{var ve,de;return Yo(_.flow.id)===0&&((de=(ve=l(_.flow.id))==null?void 0:ve.waypoints)==null?void 0:de.length)===2},Ou))break}}{const _=T=>T.y+T.height/2,R=[];for(const T of P.keys()){if(!qr(T))continue;const L=g.filter(F=>F.flow.target===T);if(L.length!==1)continue;const $=l(L[0].flow.source),B=l(T);!$||!B||!P.has($.id)||Math.abs(_($)-_(B))>1||B.x-($.x+$.width)<=D+1||R.push({id:T,pred:$,node:B})}R.sort((T,L)=>T.node.x-L.node.x);for(const{id:T}of R){const L=P.get(T),$=l(T),B=l(g.find(re=>re.flow.target===T).flow.source);if(!$||!B)continue;const F=$.x-(B.x+B.width);if(F<=D+1)continue;const j=f(L.node.participant),G=an(T,re=>re.x>=$.x),K=Uo(),pe=pL(G,j,-(F-D));if(!pe)continue;const Re=Uo();(Re.bad>K.bad||Re.crossings>=K.crossings||Re.straight<K.straight)&&pe()}}K_(!0);for(const _ of v){const R=_.associations??[],T=R.map(B=>B.source===_.dataStore.id?B.target:B.source).map(l).find(Boolean),L=T?p(T)??u():u(),$=T?{x:T.x+T.width/2,y:T.y+T.height+110}:{x:200,y:St+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:_.dataStore.id,name:_.dataStore.name})},$,L);for(const B of R)q_(_.dataStore.id,B)}for(const _ of b){const T=f(_.association.target).type==="bpmn:DataStoreReference"?_.association.target:_.association.source;q_(T,_.association)}let o0=0;const Xr=10,a0=40,gL=(_,R)=>{const T=R.map(G=>p(G)).filter(G=>!!G);for(const G of T){const K=Xr,pe=G.y,Re=G.y+G.height,re=G.x,Oe=G.x+G.width;if(Math.abs(_.y-pe)<K){const be=pe+K-_.y;_.y+=be,_.height-=be}if(Math.abs(_.y+_.height-Re)<K&&(_.height=Re-K-_.y),Math.abs(_.x-re)<K){const be=re+K-_.x;_.x+=be,_.width-=be}Math.abs(_.x+_.width-Oe)<K&&(_.width=Oe-K-_.x)}if(!T.length)return;const L=Math.min(...T.map(G=>G.y)),$=Math.max(...T.map(G=>G.y+G.height)),B=L-_.y,F=_.y+_.height-$,j=a0-Xr;if(B>0!=F>0)if(B>0&&B<j){const G=B+Xr;_.y+=G,_.height-=G}else F>0&&F<j&&(_.height-=F+Xr)},yL=(_,R)=>{const T=Xr,L=30,$=o.filter(B=>B.type==="bpmn:Group"&&B.id!==R);for(const B of $){const F=B.x,j=B.x+B.width,G=B.y,K=B.y+B.height,pe=_.y<K&&G<_.y+_.height,Re=_.x<j&&F<_.x+_.width;if(pe){if(Math.abs(_.x-j)<T){const re=Math.min(j+T-_.x,L);re>0&&_.width-re>0&&(_.x+=re,_.width-=re)}if(Math.abs(_.x+_.width-F)<T){const re=Math.min(_.x+_.width-(F-T),L);re>0&&_.width-re>0&&(_.width-=re)}}if(Re){if(Math.abs(_.y-K)<T){const re=Math.min(K+T-_.y,L);re>0&&_.height-re>0&&(_.y+=re,_.height-=re)}if(Math.abs(_.y+_.height-G)<T){const re=Math.min(_.y+_.height-(G-T),L);re>0&&_.height-re>0&&(_.height-=re)}}}},ud=(_,R)=>{const T=a0,L=Math.min(..._.map(G=>G.x))-T,$=Math.min(..._.map(G=>G.y))-T,B=Math.max(..._.map(G=>G.x+G.width))+T,F=Math.max(..._.map(G=>G.y+G.height))+T,j={x:L,y:$,width:B-L,height:F-$};return gL(j,_),yL(j,R),j};for(const _ of C){const R=(_.group.members??[]).map(l).filter($=>!!$);let T;R.length?T=ud(R,_.group.id):(T={x:300+o0*350,y:40,width:300,height:200},o0++);const L=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:_.group.id}),width:T.width,height:T.height},{x:T.x+T.width/2,y:T.y+T.height/2},u());_.group.name&&n.updateLabel(L,_.group.name),(v0=_.group.members)!=null&&v0.length&&O(L,"bwl:Members",{refs:_.group.members.join(" ")})}{const _=o.filter($=>!!$.waypoints),R=new Map,T=($,B)=>{!$||!B||(R.has($)||R.set($,new Set),R.get($).add(B))};for(const $ of _){const B=(b0=$.source)==null?void 0:b0.id,F=(x0=$.target)==null?void 0:x0.id;T(B,F),((_0=$.type)!=null&&_0.includes("DataOutputAssociation")||(w0=$.type)!=null&&w0.includes("DataInputAssociation")||$.type==="bpmn:Association")&&T(F,B)}const L=o.filter($=>$.type==="bpmn:Group");for(const $ of L){const F=(((E0=$.businessObject.extensionElements)==null?void 0:E0.values)??[]).find(ce=>ce.$type==="bwl:Members"),j=((F==null?void 0:F.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const G=new Set(j),K=[...j];for(;K.length;){const ce=K.shift();for(const ve of R.get(ce)??[])G.has(ve)||(G.add(ve),K.push(ve))}const pe=$.x,Re=$.x+$.width,re=$.y,Oe=$.y+$.height,be=ce=>g.filter(ve=>ve.flow.target===ce).length,Ce=ce=>{var de;const ve=((de=l(ce))==null?void 0:de.type)??"";if(ve==="bpmn:StartEvent"&&be(ce)===0)return!1;if(ve.endsWith("Gateway")){const he=g.filter(Ye=>Ye.flow.target===ce).map(Ye=>Ye.flow.source);if(he.length&&he.every(Ye=>{var Je;return((Je=l(Ye))==null?void 0:Je.type)==="bpmn:StartEvent"&&be(Ye)===0}))return!1}return!0},ut=o.filter(ce=>Pi(ce)).filter(ce=>ce.type!=="bpmn:Group"&&ce.type!=="bpmn:Participant"&&ce.type!=="bpmn:TextAnnotation"&&!G.has(ce.id)&&qr(ce.id)&&Ce(ce.id)&&ce.x<Re&&ce.x+ce.width>pe&&ce.y<Oe&&ce.y+ce.height>re);if(ut.length)for(const ce of[-1,1]){const ve=ut.filter(ne=>(ne.x+ne.width-pe<=Re-ne.x?-1:1)===ce);if(!ve.length)continue;const de=[];for(const ne of ve){const X=de.find(Z=>Z.some(fe=>ne.y<fe.y+fe.height&&ne.y+ne.height>fe.y));X?X.push(ne):de.push([ne])}const he=new Map;for(const ne of de){let X=ce<0?pe-Xr:Re+Xr;for(const Z of[...ne].sort((fe,me)=>ce<0?me.x-fe.x:fe.x-me.x)){const fe=ce<0?Math.min(Z.x,X-Z.width):Math.max(Z.x,X);X=ce<0?fe-_n:fe+Z.width+_n,fe!==Z.x&&Math.sign(fe-Z.x)===ce&&he.set(Z.id,fe-Z.x)}}const Ye=new Map,Je=ne=>Ye.get(ne)===ne||!Ye.get(ne)?ne:Je(Ye.get(ne));for(const ne of ve)Ye.set(ne.id,ne.id);for(const ne of y){const X=he.has(ne.flow.source)?ne.flow.source:void 0,Z=he.has(ne.flow.target)?ne.flow.target:void 0;if(!X||!Z)continue;const fe=l(ne.flow.id);((S0=fe==null?void 0:fe.waypoints)==null?void 0:S0.length)===2&&Ye.set(Je(X),Je(Z))}const kt=new Map;for(const ne of ve){if(!he.has(ne.id))continue;const X=Je(ne.id);kt.set(X,[...kt.get(X)??[],ne])}const Xt=[...kt.values()].sort((ne,X)=>ce<0?Math.min(...ne.map(Z=>Z.x))-Math.min(...X.map(Z=>Z.x)):Math.max(...X.map(Z=>Z.x))-Math.max(...ne.map(Z=>Z.x))),Se=[];let ke=!0;for(const ne of Xt){const X=ne.map(me=>he.get(me.id)??0).reduce((me,xe)=>Math.abs(xe)>Math.abs(me)?xe:me,0),Z=new Map;let fe=!0;for(const me of ne){const xe=p(me);if(!xe){fe=!1;break}Z.has(xe.id)||Z.set(xe.id,{subtree:[],pool:xe}),Z.get(xe.id).subtree.push(me)}fe&&Du([...Z.values()],X,()=>!0,Ou)?Se.push({shapes:ne,dx:X}):ke=!1}if(!ke)for(const ne of Se.reverse())n.moveElements(ne.shapes,{x:-ne.dx,y:0})}}}{const _=new Set([...C.map(R=>R.group.id),...Yt(e,"group.update").map(R=>R.id)]);for(const R of o.filter(T=>T.type==="bpmn:Group")){if(_.has(R.id))continue;const L=(((R0=R.businessObject.extensionElements)==null?void 0:R0.values)??[]).find(j=>j.$type==="bwl:Members"),$=((L==null?void 0:L.refs)??"").split(" ").filter(Boolean).map(l).filter(j=>!!j);!$.length||!$.some(j=>{const G=d.get(j.id);return!G||G.x!==j.x||G.y!==j.y})||!$.some(j=>j.x<R.x||j.y<R.y||j.x+j.width>R.x+R.width||j.y+j.height>R.y+R.height)||n.resizeShape(R,ud($,R.id))}}{const R=new Map(co(nt(o)).map(j=>[j.owner,j.rect])),T=o.filter(j=>!!j.waypoints),L=new Map,$=(j,G)=>{!j||!G||(L.has(j)||L.set(j,new Set),L.get(j).add(G))};for(const j of T){const G=(C0=j.source)==null?void 0:C0.id,K=(P0=j.target)==null?void 0:P0.id;$(G,K),((A0=j.type)!=null&&A0.includes("DataOutputAssociation")||(T0=j.type)!=null&&T0.includes("DataInputAssociation")||j.type==="bpmn:Association")&&$(K,G)}const B=j=>g.filter(G=>G.flow.target===j).length,F=j=>{var K;const G=((K=l(j))==null?void 0:K.type)??"";if(G==="bpmn:StartEvent"&&B(j)===0)return!1;if(G.endsWith("Gateway")){const pe=g.filter(Re=>Re.flow.target===j).map(Re=>Re.flow.source);if(pe.length&&pe.every(Re=>{var re;return((re=l(Re))==null?void 0:re.type)==="bpmn:StartEvent"&&B(Re)===0}))return!1}return!0};for(const j of o.filter(G=>G.type==="bpmn:Group")){const K=(((M0=j.businessObject.extensionElements)==null?void 0:M0.values)??[]).find(X=>X.$type==="bwl:Members"),pe=((K==null?void 0:K.refs)??"").split(" ").filter(Boolean);if(!pe.length)continue;const Re=pe.map(l).filter(X=>!!X);if(!Re.length||!(C.some(X=>X.group.id===j.id)||Yt(e,"group.update").some(X=>X.id===j.id)||Re.some(X=>{const Z=d.get(X.id);return!Z||Z.x!==X.x||Z.y!==X.y})))continue;const Oe=new Set(pe),be=[...pe];for(;be.length;){const X=be.shift();for(const Z of L.get(X)??[])Oe.has(Z)||(Oe.add(Z),be.push(Z))}const Ce=j.x,ut=j.x+j.width,ce=j.y,ve=j.y+j.height,de=X=>{const Z=R.get(X.id),fe={x:X.x,y:X.y,width:X.width,height:X.height};return Z?[fe,{x:Z.x,y:Z.y,width:Z.width,height:Z.height}]:[fe]},he=Re.flatMap(de),Ye=Math.min(...he.map(X=>X.x)),Je=Math.max(...he.map(X=>X.x+X.width)),kt=Math.min(...he.map(X=>X.y)),Xt=Math.max(...he.map(X=>X.y+X.height)),Se={L:Ye-Ce,R:ut-Je,T:kt-ce,B:ve-Xt},ke=o.filter(X=>Pi(X)).filter(X=>X.type!=="bpmn:Group"&&X.type!=="bpmn:Participant"&&X.type!=="bpmn:TextAnnotation"&&!Oe.has(X.id)&&F(X.id)&&X.x<ut&&X.x+X.width>Ce&&X.y<ve&&X.y+X.height>ce);if(!ke.length)continue;const ne={L:0,R:0,T:0,B:0};for(const X of ke){const Z=de(X),fe=Math.min(...Z.map(gt=>gt.x)),me=Math.max(...Z.map(gt=>gt.x+gt.width)),xe=Math.min(...Z.map(gt=>gt.y)),Ne=Math.max(...Z.map(gt=>gt.y+gt.height)),lt={L:me-Ce,R:ut-fe,T:Ne-ce,B:ve-xe},mn=["L","R","T","B"].filter(gt=>lt[gt]<=Se[gt]+.001);if(!mn.length)continue;const At=mn.reduce((gt,is)=>lt[is]<lt[gt]?is:gt,mn[0]);ne[At]=Math.max(ne[At],Math.min(lt[At]+10,Se[At]))}!ne.L&&!ne.R&&!ne.T&&!ne.B||n.resizeShape(j,{x:j.x+ne.L,y:j.y+ne.T,width:j.width-ne.L-ne.R,height:j.height-ne.T-ne.B})}}const s0=_=>{const R=_.waypoints;if(R!=null&&R.length){const L=R[Math.floor((R.length-1)/2)];return{x:L.x,y:L.y,width:0,height:0}}const T=_;return{x:T.x,y:T.y,width:T.width,height:T.height}};let ns=0;const c0=12,u0=14,vL=15,bL=300,xL=_=>{const R=_.split(`
7
- `),T=Math.max(...R.map(B=>oo(B,c0))),L=Math.max(100,Math.min(bL,Math.ceil(T)+u0)),$=R.reduce((B,F)=>B+Math.max(1,Math.ceil((oo(F,c0)+u0)/L)),0);return{width:L,height:Math.max(30,$*vL+10)}};for(const _ of x){const R=_.association,T=((k0=_.placement)==null?void 0:k0.anchor)??(R?R.source===_.annotation.id?R.target:R.source:void 0),L=T?l(T):void 0,$=L?s0(L):void 0,B=xL(_.annotation.text??"");let F;if($&&_.placement){const[pe,Re]=Rs[_.placement.side],re=_.placement.offset??50;F={x:$.x+$.width/2+pe*($.width/2+B.width/2+re),y:$.y+$.height/2+Re*($.height/2+B.height/2+re)}}else $?(F={x:$.x+$.width/2+180+ns%3*260,y:$.y-110-ns%2*95},ns++):(F={x:300+ns*260,y:60},ns++);const j=L?p(L)??u():u(),G=j;$&&typeof G.x=="number"&&typeof G.width=="number"&&G.type==="bpmn:Participant"&&(F=dl(o,$,B,G,_.placement?{placement:_.placement}:{from:F}));const K=n.createShape({type:"bpmn:TextAnnotation",width:B.width,height:B.height,businessObject:i.create("bpmn:TextAnnotation",{id:_.annotation.id,text:_.annotation.text})},F,j);if(R){const pe=Re=>Re===_.annotation.id?K:f(Re);n.connect(pe(R.source),pe(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}_.placement&&O(K,"bwl:Placement",A(_.placement))}for(const _ of Yt(e,"association.add")){const R=_.association;n.connect(f(R.source),f(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const _ of Yt(e,"node.update")){let R=f(_.id);if(_.type&&Ss(_.type)!==R.type&&(R=c.replaceElement(R,{type:Ss(_.type)})),_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.lane||_.band!==void 0){_.band!==void 0&&n.updateProperties(R,{"bwl:band":_.band});const T=R.y+R.height/2,L=p(R),$=_.lane?f(_.lane):((L==null?void 0:L.children)??[]).find(F=>F.type==="bpmn:Lane"&&T>=F.y&&T<=F.y+F.height);_.band!==void 0&&Ee($==null?void 0:$.id,_.band,L);const B=$?$.y+(_.band===void 0?$.height/2:Math.min($.height/2,ae)+M($.id,_.band)*k):_.band!==void 0&&L?L.y+H+M(`pool:${L.id}`,_.band)*k:void 0;if(B!==void 0){const F=B-T;F!==0&&n.moveElements([R],{x:0,y:F})}}}for(const _ of Yt(e,"sequenceFlow.update")){const R=f(_.id);if(_.source!==void 0||_.target!==void 0){const T=R,L=_.source!==void 0?f(_.source):T.source,$=_.target!==void 0?f(_.target):T.target,B=F=>({x:F.x+F.width/2,y:F.y+F.height/2});n.reconnect(T,L,$,[B(L),B($)])}_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.condition!==void 0&&n.updateProperties(R,{name:((O0=_.condition)==null?void 0:O0.label)??void 0})}for(const _ of Yt(e,"messageFlow.update"))_.name!==void 0&&n.updateProperties(f(_.id),{name:_.name??void 0});for(const _ of Yt(e,"dataStore.update"))_.name!==void 0&&n.updateProperties(f(_.id),{name:_.name??void 0});for(const _ of Yt(e,"annotation.update")){const R=f(_.id);if(_.text!==void 0&&n.updateProperties(R,{text:_.text}),_.placement===null)O(R,"bwl:Placement",null);else if(_.placement){const T=f(_.placement.anchor),L=s0(T),$=p(T)??u(),B=typeof $.x=="number"&&typeof $.width=="number"&&$.type==="bpmn:Participant",[F,j]=Rs[_.placement.side],G=_.placement.offset??50,K={x:L.x+L.width/2+F*(L.width/2+R.width/2+G),y:L.y+L.height/2+j*(L.height/2+R.height/2+G)},pe=B?dl(o,L,{width:R.width,height:R.height},$,{placement:_.placement,selfId:_.id}):K;n.moveElements([R],{x:pe.x-(R.x+R.width/2),y:pe.y-(R.y+R.height/2)}),O(R,"bwl:Placement",A(_.placement))}}for(const _ of Yt(e,"group.update")){const R=f(_.id);if(_.name!==void 0&&n.updateLabel(R,_.name??""),_.members){const T=_.members.map(l).filter(L=>!!L);T.length&&n.resizeShape(R,ud(T,_.id)),O(R,"bwl:Members",{refs:_.members.join(" ")})}}}function hl(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 y1(e,t,n){var l,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>vn(p).filter(d=>!t.has(En(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=nt(i),c=o(s),u=[...new Set(c.flatMap(hl))].filter(p=>n.has(p)&&a(p));if(u.length)for(const p of u){const d=i.get(p);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let m=d.parent,h;for(;m;){if(m.type==="bpmn:Participant"){h=m;break}m=m.parent}if(!h){const ye=d.x+d.width/2,We=d.y+d.height/2;h=i.getAll().find(Fe=>{if(Fe.type!=="bpmn:Participant")return!1;const q=Fe;return typeof q.x=="number"&&typeof q.width=="number"&&ye>=q.x&&ye<=q.x+q.width&&We>=q.y&&We<=q.y+q.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const y=(((l=d.businessObject.extensionElements)==null?void 0:l.values)??[]).find(ye=>ye.$type==="bwl:Placement"),v=[...d.incoming??[],...d.outgoing??[]].find(ye=>ye.type==="bpmn:Association"),b=(y!=null&&y.anchor?i.get(y.anchor):void 0)??(v?((f=v.source)==null?void 0:f.id)===p?v.target:v.source:void 0);if(!b)continue;const x=b.waypoints,C=x!=null&&x.length?{x:x[Math.floor((x.length-1)/2)].x,y:x[Math.floor((x.length-1)/2)].y,width:0,height:0}:{x:b.x,y:b.y,width:b.width,height:b.height},P={width:d.width,height:d.height},O={x:d.x+d.width/2,y:d.y+d.height/2},A=y==null?void 0:y.side,I=[];A&&A in Rs&&I.push(dl(i,C,P,h,{placement:{side:A,offset:(y==null?void 0:y.offset)??null},selfId:p}));for(const[ye,We]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Fe=1;Fe<=g1;Fe++)I.push({x:O.x+ye*Lh*Fe,y:O.y+We*Lh*Fe});const k={...s,edges:s.edges.filter(ye=>ye.id!==(v==null?void 0:v.id))},D=o(k),H=D.filter(ye=>hl(ye).includes(p)).length;if(!H)continue;let ae;for(const ye of I){const We=ye.x-O.x,Fe=ye.y-O.y;if(!We&&!Fe||ye.x-P.width/2<h.x||ye.x+P.width/2>h.x+h.width||ye.y-P.height/2<h.y||ye.y+P.height/2>h.y+h.height)continue;const q={...k,shapes:k.shapes.map(Me=>Me.id===p?{...Me,x:Me.x+We,y:Me.y+Fe}:Me)},ue=o(q),oe=ue.filter(Me=>hl(Me).includes(p)).length;if(oe>=H||ue.length>D.length)continue;const le=Math.abs(We)+Math.abs(Fe);if((!ae||oe<ae.mine||oe===ae.mine&&(ue.length<ae.all||ue.length===ae.all&&le<ae.dist))&&(ae={x:ye.x,y:ye.y,mine:oe,all:ue.length,dist:le}),ae.mine===0&&ae.all<D.length)break}ae&&r.moveElements([d],{x:ae.x-O.x,y:ae.y-O.y})}}const v1=60;function b1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>vn(l).filter(f=>!t.has(En(f))),a=l=>l.filter(f=>f.kind==="pool-overlap"),s=new Map(n.shapes.map(l=>[l.id,l])),c=(l,f)=>f.x>=l.x&&f.y>=l.y&&f.x+f.width<=l.x+l.width&&f.y+f.height<=l.y+l.height,u=l=>{if(!s.get(l))return[l];const p=new Set,d=new Set([l]);for(let h=0;h<4;h++){let g=!1;for(const y of n.shapes)y.type!=="bpmn:Group"||p.has(y.id)||[...d].some(v=>{const b=s.get(v);return b&&c(y,b)})&&(p.add(y.id),g=!0);for(const y of n.shapes)y.type!=="bpmn:Participant"||d.has(y.id)||[...p].some(v=>{const b=s.get(v);return b&&c(b,y)})&&(d.add(y.id),g=!0);if(!g)break}const m=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!p.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...p].some(g=>{const y=s.get(g);return y&&c(y,h)})).map(h=>h.id);return[...d,...p,...m]};for(let l=0;l<6;l++){const f=nt(i),p=o(f),d=a(p);if(!d.length)return;const m=new Map(f.shapes.map(x=>[x.id,x]));let h=null;for(const x of d){if(x.kind!=="pool-overlap")continue;const[C,P]=x.pools,O=m.get(C),A=m.get(P);if(!O||!A)continue;const[I,k]=O.x<=A.x?[O,A]:[A,O];if(x.contained)continue;const D=s.get(I.id),H=s.get(k.id),ae=D&&H?Math.max(H.x-(D.x+D.width),0):v1,ye=I.x+I.width+ae-k.x;if(ye<=0)continue;const We=u(k.id).filter(Fe=>i.get(Fe));We.length&&(!h||ye>h.dx)&&(h={movers:We,dx:ye})}if(!h)return;const g=h.movers.map(x=>i.get(x)).filter(x=>!!x&&typeof x.x=="number");if(!g.length)return;const y=p.length,v=d.length;r.moveElements(g,{x:h.dx,y:0});const b=o(nt(i));if(!(a(b).length<v&&b.length<=y)){r.moveElements(g,{x:-h.dx,y:0});return}}}function x1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>vn(u).filter(l=>!t.has(En(l))),a=(u,l)=>l.x>=u.x&&l.y>=u.y&&l.x+l.width<=u.x+u.width&&l.y+l.height<=u.y+u.height,s=u=>({l:Math.min(...u.map(l=>l.x)),t:Math.min(...u.map(l=>l.y)),r:Math.max(...u.map(l=>l.x+l.width)),b:Math.max(...u.map(l=>l.y+l.height))}),c=n.shapes.filter(u=>{var l;return u.type==="bpmn:Group"&&!((l=u.members)!=null&&l.length)});if(c.length)for(const u of c){const l=i.get(u.id);if(!l||typeof l.x!="number")continue;const f=n.shapes.filter(P=>P.id!==u.id&&P.type!=="bpmn:Group"&&a(u,P));if(!f.length)continue;const p=f.map(P=>i.get(P.id)).filter(P=>!!P&&typeof P.x=="number");if(p.length!==f.length)continue;const d=s(f),m=s(p),h=m.l+(u.x-d.l),g=m.t+(u.y-d.t),y=m.r+(u.x+u.width-d.r),v=m.b+(u.y+u.height-d.b),b={x:h,y:g,width:y-h,height:v-g};if(b.width<=0||b.height<=0||Math.abs(b.x-l.x)<1&&Math.abs(b.y-l.y)<1&&Math.abs(b.width-l.width)<1&&Math.abs(b.height-l.height)<1)continue;const x=o(nt(i)).length,C={x:l.x,y:l.y,width:l.width,height:l.height};r.resizeShape(l,b),o(nt(i)).length>x&&r.resizeShape(l,C)}}function Bh(e,t,n=Ih){const i=Dh(e),r=Oh(t,ah(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=nt(i.elementRegistry),s=new Set(vn(a).map(En)),c=new Set(a.edges.map(y=>y.id)),u=new Set(a.shapes.map(y=>y.id)),l=ys(a),f=l.length,p=new Set(l.map(([y,v])=>`${y}|${v}`)),d=e.get("commandStack");try{md(d,()=>{n(t,i),b1(i,s,a),x1(i,s,a),dh(i,c);const y=cl(i,s);lh(i,p,c),Eh(i,s,c),gh(i,c),s1(i,c),bh(i,s,c),p1(i,s,c),Ph(i,s,c),Ch(i,c),Th(i,u),y1(i,s,u),cl(i,s,y)})}catch(y){return{ok:!1,issues:[{kind:"lower-failed",message:y instanceof Error?y.message:String(y)}],findings:[],stats:o}}const m=nt(i.elementRegistry),h=vn(m).filter(y=>!s.has(En(y))),g=Qd(m);return{ok:!0,issues:[],findings:h,stats:{edgeCrossings:{before:f,after:g.pairs.length,pairs:g.pairs,solidPairs:g.solidPairs,dashedPairs:g.dashedPairs,mixedPairs:g.mixedPairs,crossPoolMessages:g.crossPoolMessages}}}}function _1(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function w1(e,t){return typeof e.get=="function"?e.get(t):e[t]}function Nh(e,t){const n=w1(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function $h(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function E1(e){return typeof e=="string"&&Iu.includes(e)}function si(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function Fh(e){const t=e.rootElements??[],n=t.find(q=>q.$type==="bpmn:Collaboration"),i=new Map(t.filter(q=>q.$type==="bpmn:Process").map(q=>[q.id,q])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},f=[],p=[],d=[],m=[],h=[],g=[],y=new Set,v=new Set,b=q=>{q&&y.add(q)},x=q=>{y.add(q),v.add(q)},C=q=>{const ue=$h(q,"bwl:Placement");if(!ue)return;const oe=typeof ue.anchor=="string"?ue.anchor:void 0;if(!oe||!E1(ue.side))return;const le=typeof ue.offset=="number"?ue.offset:void 0;h.push({owner:q.id,anchor:oe,side:ue.side,...le!==void 0?{offset:le}:{}})},P=q=>{const ue=$h(q,"bwl:Members"),oe=typeof(ue==null?void 0:ue.refs)=="string"?ue.refs.split(/\s+/).filter(Boolean):[];oe.length&&g.push({owner:q.id,refs:oe})},O=q=>{var ue;for(const oe of q)switch(b(oe.id),oe.$type){case"bpmn:TextAnnotation":x(oe.id),s.push({id:oe.id,text:typeof oe.text=="string"?oe.text:""}),C(oe);break;case"bpmn:Association":d.push({id:oe.id,type:oe.$type,source:si(oe.sourceRef),target:si(oe.targetRef)});break;case"bpmn:Group":{x(oe.id);const le=(ue=oe.categoryValueRef)==null?void 0:ue.value;c.push({id:oe.id,...typeof le=="string"&&le?{name:le}:{}}),P(oe);break}default:u.push({id:oe.id,type:oe.$type,reason:"type-outside-mvp"})}},A=q=>{for(const ue of q.flowElements??[])b(ue.id),u.push({id:ue.id,type:ue.$type,reason:"inside-container"}),(ue.flowElements??[]).length&&A(ue);for(const ue of q.artifacts??[])b(ue.id),u.push({id:ue.id,type:ue.$type,reason:"inside-container"})},I=(q,ue)=>{const oe=q.flowElements??[],le=(q.laneSets??[]).flatMap(W=>W.lanes??[]),Me=new Map;for(const W of le){b(W.id);for(const Y of W.flowNodeRef??[]){const J=si(Y);J&&Me.set(J,W.id)}}for(const W of oe){if(b(W.id),W.$type==="bpmn:SequenceFlow"){f.push({id:W.id,source:si(W.sourceRef),target:si(W.targetRef),...typeof W.name=="string"&&W.name?{name:W.name}:{}});continue}if(W.$type==="bpmn:DataStoreReference"){x(W.id),a.push({id:W.id,...W.name?{name:W.name}:{}});continue}const Y=_1(W.$type);if(!ld(Y)){u.push({id:W.id,type:W.$type,reason:"type-outside-mvp"});continue}x(W.id);const J=Y==="boundaryEvent"?si(W.attachedToRef):void 0;o.push({id:W.id,type:Y,...W.name?{name:W.name}:{},...ue?{participant:ue}:{},...Me.has(W.id)?{lane:Me.get(W.id)}:{},...J?{attachedTo:J}:{}}),Y==="subProcess"&&A(W);const Te=Nh(W,"bwl:band");Te!==void 0&&(l.bands[W.id]=Te);for(const ft of W.dataOutputAssociations??[])b(ft.id),m.push({id:ft.id,type:ft.$type,source:W.id,target:si(ft.targetRef)});for(const ft of W.dataInputAssociations??[])b(ft.id),m.push({id:ft.id,type:ft.$type,source:si((ft.sourceRef??[])[0]),target:W.id})}O(q.artifacts??[])};if(n){const q=new Set;for(const ue of n.participants??[]){x(ue.id);const oe=si(ue.processRef);oe&&q.add(oe);const le=oe?i.get(oe):void 0,Me=((le==null?void 0:le.laneSets)??[]).flatMap(Te=>Te.lanes??[]),W=Me.map(Te=>({id:Te.id,...Te.name?{name:Te.name}:{}}));for(const Te of W)x(Te.id);const Y=!le||(le.flowElements??[]).length===0&&Me.length===0&&(le.artifacts??[]).length===0;r.push({id:ue.id,...ue.name?{name:ue.name}:{},...Y?{blackBox:!0}:{},...W.length?{lanes:W}:{}});const J=Nh(ue,"bwl:poolOrder");J!==void 0&&(l.poolOrders[ue.id]=J),le&&I(le,ue.id)}for(const ue of n.messageFlows??[])b(ue.id),p.push({id:ue.id,source:si(ue.sourceRef),target:si(ue.targetRef),...typeof ue.name=="string"&&ue.name?{name:ue.name}:{}});O(n.artifacts??[]);for(const[ue,oe]of i)!q.has(ue)&&(oe.flowElements??[]).length>0&&u.push({id:ue,type:oe.$type,reason:"unreachable-process"})}else for(const q of i.values())I(q);const k=[],D=[],H=[],ae=[],ye=(q,ue)=>!!q&&!!ue&&v.has(q)&&v.has(ue);for(const q of f){if(!ye(q.source,q.target)){u.push({id:q.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}k.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),v.add(q.id)}for(const q of p){if(!ye(q.source,q.target)){u.push({id:q.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}D.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),v.add(q.id)}for(const q of m){if(!ye(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}ae.push({...q.id?{id:q.id}:{},source:q.source,target:q.target}),q.id&&v.add(q.id)}for(const q of d){if(!ye(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}H.push({...q.id?{id:q.id}:{},source:q.source,target:q.target})}const We=new Map(c.map(q=>[q.id,q]));for(const{owner:q,refs:ue}of g){const oe=ue.filter(Me=>y.has(Me)),le=We.get(q);le&&oe.length&&(le.members=oe)}for(const q of h)y.has(q.anchor)&&(l.placements[q.owner]={anchor:q.anchor,side:q.side,...q.offset!==void 0?{offset:q.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:k,...D.length?{messageFlows:D}:{},...a.length?{dataStores:a}:{},...ae.length?{dataAssociations:ae}:{},...s.length?{annotations:s}:{},...H.length?{associations:H}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function S1(e){const{definitions:t,warnings:n}=await Qu(e);return{...Fh(t),warnings:n}}function R1(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function jh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Bh(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 C1=Symbol("bpmn-editor");function P1(){const e=Ot.ref(!1),t=Ot.ref(!0),n=Ot.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const f=u.get("keyboard");l?(r&&f.bind(r),r=void 0):r||(r=f.getBinding(),f.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const f=s();n.value=!0;try{const p=await jh(f,u,{currentVersion:l});return p.status==="applied"&&(e.value=!1),p}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:Ju(l)}},async saveXml(){const{xml:u}=await s().saveXML({format:!0});return e.value=!1,u??""},undo:()=>{var u;return(u=c())==null?void 0:u.undo()},redo:()=>{var u;return(u=c())==null?void 0:u.redo()},canUndo:()=>{var u;return((u=c())==null?void 0:u.canUndo())??!1},canRedo:()=>{var u;return((u=c())==null?void 0:u.canRedo())??!1}}}function _e(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function A1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ml={exports:{}},Hh;function T1(){if(Hh)return ml.exports;Hh=1;var e=ml.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o),s=Math.floor(Math.random()*c).toString(n);a=s+a}var u=parseInt(a,n);return u!==1/0&&u>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var r=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(o,c));return o[c]=a,c},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,s){return r.hats[a]=s,r},r.bits=t||128,r.base=n||16,r},ml.exports}var M1=T1(),k1=A1(M1);function hi(e){if(!(this instanceof hi))return new hi(e);e=e||[128,36,1],this._seed=e.length?k1.rack(e[0],e[1],e[2]):e}hi.prototype.next=function(e){return this._seed(e||!0)},hi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},hi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},hi.prototype.assigned=function(e){return this._seed.get(e)||!1},hi.prototype.unclaim=function(e){delete this._seed.hats[e]},hi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const jt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};jt.td=jt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],jt.option=jt.optgroup=[1,'<select multiple="multiple">',"</select>"],jt.thead=jt.tbody=jt.colgroup=jt.caption=jt.tfoot=[1,"<table>","</table>"],jt.polyline=jt.ellipse=jt.polygon=jt.circle=jt.text=jt.line=jt.path=jt.rect=jt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function mt(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:f}=l;return f.remove(),f}let[r,o,a]=Object.hasOwn(jt,i)?jt[i]:jt._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:l}=s;return l.remove(),l}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function O1(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function bn(e,...t){const n=e.style;return N(t,function(i){i&&N(i,function(r,o){n[o]=r})}),e}function ln(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const D1=Object.prototype.toString;function bt(e){return new Zi(e)}function Zi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Zi.prototype.add=function(e){return this.list.add(e),this},Zi.prototype.remove=function(e){return D1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Zi.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},Zi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Zi.prototype.array=function(){return Array.from(this.list)},Zi.prototype.has=Zi.prototype.contains=function(e){return this.list.contains(e)};function Cs(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function kr(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function L1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ps={},zh;function I1(){if(zh)return Ps;zh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Ps.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Ps.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Ps}var Gh=I1(),B1=L1(Gh),$e=O1({__proto__:null,default:B1},[Gh]),Vh=["focus","blur"];function N1(e,t,n,i,r){return Vh.indexOf(n)!==-1&&(r=!0),$e.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=kr(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function $1(e,t,n,i){return Vh.indexOf(t)!==-1&&(i=!0),$e.unbind(e,t,n,i)}var Mn={bind:N1,unbind:$1};function gl(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function ot(e,t){return t=t||document,t.querySelector(e)}function As(e,t){return t=t||document,t.querySelectorAll(e)}function mi(e){e.parentNode&&e.parentNode.removeChild(e)}function F1(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function j1(e,t){return t.appendChild(F1(e,t))}function je(e,t){return j1(t,e),e}var yl=2,Wh={"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":yl,"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":yl,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function H1(e,t){return Wh[t]?e.style[t]:e.getAttributeNS(null,t)}function Uh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=Wh[i];r?(r===yl&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function z1(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Uh(e,r,t[r])}function we(e,t,n){if(typeof t=="string")if(n!==void 0)Uh(e,t,n);else return H1(e,t);else z1(e,t);return e}const G1=Object.prototype.toString;function Xe(e){return new Qi(e)}function Qi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Qi.prototype.add=function(e){return this.list.add(e),this},Qi.prototype.remove=function(e){return G1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Qi.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},Qi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Qi.prototype.array=function(){return Array.from(this.list)},Qi.prototype.has=Qi.prototype.contains=function(e){return this.list.contains(e)};function Ts(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Yh(e){return e.cloneNode(!0)}var vl={svg:"http://www.w3.org/2000/svg"},qh='<svg xmlns="'+vl.svg+'"';function V1(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(vl.svg)===-1&&(e=qh+e.substring(4)):(e=qh+">"+e+"</svg>",t=!0);var n=W1(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function W1(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Pe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=V1(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(vl.svg,e),t&&we(n,t),n}var bl=null;function Kh(){return bl===null&&(bl=Pe("svg")),bl}function Xh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function U1(e,t,n,i,r,o){var a=Kh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Xh(a,e);case 6:return Xh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function ea(e){return Kh().createSVGTransform()}var Zh=/([&<>]{1})/g,Y1=/([&<>\n\r"]{1})/g,q1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function xl(e,t){function n(i,r){return q1[r]||r}return e.replace(t,n)}function Qh(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(xl(e.textContent,Zh));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,'="',xl(o.value,Y1),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)Qh(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",xl(e.nodeValue,Zh),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function K1(e){for(var t=e.firstChild,n=[];t;)Qh(t,n),t=t.nextSibling;return n.join("")}function Jh(e,t){return K1(e)}function Ht(e){var t=e.parentNode;return t&&t.removeChild(e),e}function X1(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function Z1(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(X1(e,i))}function ta(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),Z1(n,t)),n.consolidate()}const Q1=/^class[ {]/;function J1(e){return Q1.test(e.toString())}function _l(e){return Array.isArray(e)}function wl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ms(...e){e.length===1&&_l(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const eS=/constructor\s*[^(]*\(\s*([^)]*)\)/m,tS=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,nS=/\/\*([^*]*)\*\//m;function iS(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(J1(e)?eS:tS);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(nS);return(r&&r[1]||i).trim()})||[]}function em(e,t){const n=t||{get:function(b,x){if(i.push(b),x===!1)return null;throw s(`No provider for "${b}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(b){const x=i.join(" -> ");return i.length=0,new Error(x?`${b} (Resolving: ${x})`:b)};function c(b,x){if(!r[b]&&b.includes(".")){const C=b.split(".");let P=c(C.shift());for(;C.length;)P=P[C.shift()];return P}if(wl(o,b))return o[b];if(wl(r,b)){if(i.indexOf(b)!==-1)throw i.push(b),s("Cannot resolve circular dependency!");return i.push(b),o[b]=r[b][0](r[b][1]),i.pop(),o[b]}return n.get(b,x)}function u(b,x){if(typeof x>"u"&&(x={}),typeof b!="function")if(_l(b))b=Ms(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const P=(b.$inject||iS(b)).map(O=>wl(x,O)?x[O]:c(O));return{fn:b,dependencies:P}}function l(b){const{fn:x,dependencies:C}=u(b),P=Function.prototype.bind.call(x,null,...C);return new P}function f(b,x,C){const{fn:P,dependencies:O}=u(b,C);return P.apply(x,O)}function p(b){return Ms(x=>b.get(x))}function d(b,x){if(x&&x.length){const C=Object.create(null),P=Object.create(null),O=[],A=[],I=[];let k,D,H,ae;for(let ye in r)k=r[ye],x.indexOf(ye)!==-1&&(k[2]==="private"?(D=O.indexOf(k[3]),D===-1?(H=k[3].createChild([],x),ae=p(H),O.push(k[3]),A.push(H),I.push(ae),C[ye]=[ae,ye,"private",H]):C[ye]=[I[D],ye,"private",A[D]]):C[ye]=[k[2],k[1]],P[ye]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&x.forEach(We=>{k[1].$scope.indexOf(We)!==-1&&(C[ye]=[k[2],k[1]],P[We]=!0)});x.forEach(ye=>{if(!P[ye])throw new Error('No provider for "'+ye+'". Cannot use provider from the parent!')}),b.unshift(C)}return new em(b,a)}const m={factory:f,type:l,value:function(b){return b}};function h(b,x){const C=b.__init__||[];return function(){C.forEach(P=>{typeof P=="string"?x.get(P):x.invoke(P)})}}function g(b){const x=b.__exports__;if(x){const C=b.__modules__,P=Object.keys(b).reduce((D,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&(D[H]=b[H]),D),Object.create(null)),O=(C||[]).concat(P),A=d(O),I=Ms(function(D){return A.get(D)});x.forEach(function(D){r[D]=[I,D,"private",A]});const k=(b.__init__||[]).slice();return k.unshift(function(){A.init()}),b=Object.assign({},b,{__init__:k}),h(b,A)}return Object.keys(b).forEach(function(C){if(C==="__init__"||C==="__depends__")return;const P=b[C];if(P[2]==="private"){r[C]=P;return}const O=P[0],A=P[1];r[C]=[m[O],rS(O,A),O]}),h(b,a)}function y(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(y,b),b.indexOf(x)!==-1)?b:b.concat(x)}function v(b){const x=b.reduce(y,[]).map(g);let C=!1;return function(){C||(C=!0,x.forEach(P=>P()))}}this.get=c,this.invoke=f,this.instantiate=l,this.createChild=d,this.init=v(e)}function rS(e,t){return e!=="value"&&_l(t)&&(t=Ms(t.slice())),t}var oS=1e3;function ki(e,t){var n=this;t=t||oS,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)})}ki.prototype.canRender=function(e){},ki.prototype.drawShape=function(e,t){},ki.prototype.drawConnection=function(e,t){},ki.prototype.getShapePath=function(e){},ki.prototype.getConnectionPath=function(e){};function Or(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function aS(e){return["M",e.x,e.y]}function El(e){return["L",e.x,e.y]}function sS(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function cS(e,t){const n=e.length,i=[aS(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(El(a));continue}const c=Math.min(t,Sl(a.x-o.x,a.y-o.y),Sl(s.x-a.x,s.y-a.y));if(!c){i.push(El(a));continue}const u=ks(a,o,c),l=ks(a,o,c*.5),f=ks(a,s,c),p=ks(a,s,c*.5);i.push(El(u)),i.push(sS(l,p,f))}return i}function ks(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Sl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Sl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function na(e,t,n){Be(t)&&(n=t,t=null),t||(t={});const i=Pe("path",t);return Be(n)&&(i.dataset.cornerRadius=String(n)),Rl(i,e)}function Rl(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return we(e,{d:Or(cS(t,n))}),e}function Os(e){var t=new Set(e);return Ue(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Dr(e,t,n){n=n||0,De(e)||(e=[e]),N(e,function(i,r){var o=t(i,r,n);De(o)&&o.length&&Dr(o,t,n+1)})}function Cl(e,t,n){var i=new Set,r=new Set;return Dr(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 ia(e,t){return Cl(e)}function uS(e,t,n){Cr(t)&&(t=!0),Wt(t)&&(n=t,t=!0),n=n||{};var i=ra(n.allShapes),r=ra(n.allConnections),o=ra(n.enclosedElements),a=ra(n.enclosedConnections),s=ra(n.topLevel,t&&eo(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,N(l.incoming,c),N(l.outgoing,c),l.children}return Dr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function Dt(e,t){t=!!t,De(e)||(e=[e]);var n,i,r,o;return N(e,function(a){var s=a;a.waypoints&&!t&&(s=Dt(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+f>r||r===void 0)&&(r=c+f),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function po(e,t){var n={};return N(e,function(i){var r=i;r.waypoints&&(r=Dt(r)),!Be(t.y)&&r.x>t.x&&(n[i.id]=i),!Be(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Be(t.width)&&Be(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Be(t.width)||!Be(t.height))&&(n[i.id]=i)}),n}function tm(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function nm(e){return!!(e&&e.isFrame)}function ra(e,t){return V({},e||{},t||{})}var lS=1;function Ji(e,t){ki.call(this,e,lS),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}_e(Ji,ki),Ji.prototype.canRender=function(){return!0},Ji.prototype.drawShape=function(t,n,i){var r=Pe("rect");return we(r,{x:0,y:0,width:n.width||0,height:n.height||0}),nm(n)?we(r,V({},this.FRAME_STYLE,i||{})):we(r,V({},this.SHAPE_STYLE,i||{})),je(t,r),r},Ji.prototype.drawConnection=function(t,n,i){var r=na(n.waypoints,V({},this.CONNECTION_STYLE,i||{}));return je(t,r),r},Ji.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 Or(a)},Ji.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 Or(o)},Ji.$inject=["eventBus","styles"];function pS(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return V(o,{class:n})},this.style=function(n,i){!De(n)&&!i&&(i=n,n=[]);var r=An(n,function(o,a){return V(o,e[a]||{})},{});return i?V(r,i):r},this.computeStyle=function(n,i,r){return De(i)||(r=i,i=[]),t.style(i||[],V({},r,n||{}))}}const fS={__init__:["defaultRenderer"],defaultRenderer:["type",Ji],styles:["type",pS]};function Ct(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Tt(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 Pl(e,t){return!e||!t?-1:e.indexOf(t)}function oa(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Al(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=oa(e,t);return Math.abs(r/o)<=i}var dS=2;function Oi(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(hS(r,n))return o;return!1}function hS(e,t){const n=t[0];return Pr(t,function(i){return Math.abs(n[e]-i[e])<=dS})}function im(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 Tl(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var mS=/,?([a-z]),?/gi,rm=parseFloat,Lt=Math,er=Lt.PI,gi=Lt.min,yi=Lt.max,om=Lt.pow,tr=Lt.abs,gS=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,yS=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,am=Array.isArray||function(e){return e instanceof Array};function vS(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function bS(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 xS(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 vS(r,i)?(bS(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function _S(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(gS,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(yS,function(c,u){u&&a.push(+u)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=kl,n}function wS(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 ES(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 Ml(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 kl(){return this.join(",").replace(mS,"$1")}function SS(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=kl,t}function sm(e,t,n,i,r,o,a,s,c){var u=1-c,l=om(u,3),f=om(u,2),p=c*c,d=p*c,m=l*e+f*3*c*n+u*3*c*c*r+d*a,h=l*t+f*3*c*i+u*3*c*c*o+d*s;return{x:Ds(m),y:Ds(h)}}function cm(e){var t=MS(...e);return Ml(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function nr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function RS(e,t){return e=Ml(e),t=Ml(t),nr(t,e.x,e.y)||nr(t,e.x2,e.y)||nr(t,e.x,e.y2)||nr(t,e.x2,e.y2)||nr(e,t.x,t.y)||nr(e,t.x2,t.y)||nr(e,t.x,t.y2)||nr(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 um(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 lm(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,m=0;m<l;m++){var h=u*f[m]+u,g=um(h,e,n,r,a),y=um(h,t,i,o,s),v=g*g+y*y;d+=p[m]*Lt.sqrt(v)}return u*d}function CS(e,t,n,i,r,o,a,s){if(!(yi(e,n)<gi(r,a)||gi(e,n)>yi(r,a)||yi(t,i)<gi(o,s)||gi(t,i)>yi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var f=Ds(c/l),p=Ds(u/l),d=+f.toFixed(2),m=+p.toFixed(2);if(!(d<+gi(e,n).toFixed(2)||d>+yi(e,n).toFixed(2)||d<+gi(r,a).toFixed(2)||d>+yi(r,a).toFixed(2)||m<+gi(t,i).toFixed(2)||m>+yi(t,i).toFixed(2)||m<+gi(o,s).toFixed(2)||m>+yi(o,s).toFixed(2)))return{x:f,y:p}}}}function Ds(e){return Math.round(e*1e11)/1e11}function PS(e,t,n){var i=cm(e),r=cm(t);if(!RS(i,r))return[];var o=lm(...e),a=lm(...t),s=fm(e)?1:~~(o/5)||1,c=fm(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),f={},p=[],d,m;for(d=0;d<s+1;d++){var h=sm(...e,d/s);u[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=sm(...t,d/c),l[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(m=0;m<c;m++){var g=u[d],y=u[d+1],v=l[m],b=l[m+1],x=tr(y.x-g.x)<.01?"y":"x",C=tr(b.x-v.x)<.01?"y":"x",P=CS(g.x,g.y,y.x,y.y,v.x,v.y,b.x,b.y),O;if(P){if(O=P.x.toFixed(9)+"#"+P.y.toFixed(9),f[O])continue;f[O]=!0;var A=g.t+tr((P[x]-g[x])/(y[x]-g[x]))*(y.t-g.t),I=v.t+tr((P[C]-v[C])/(b[C]-v[C]))*(b.t-v.t);A>=0&&A<=1&&I>=0&&I<=1&&p.push({x:P.x,y:P.y,t1:A,t2:I})}}return p}function pm(e,t,n){e=mm(e),t=mm(t);for(var i,r,o,a,s,c,u,l,f,p,d=n?0:[],m=0,h=e.length;m<h;m++){var g=e[m];if(g[0]=="M")i=s=g[1],r=c=g[2];else{g[0]=="C"?(f=[i,r,...g.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var y=0,v=t.length;y<v;y++){var b=t[y];if(b[0]=="M")o=u=b[1],a=l=b[2];else{b[0]=="C"?(p=[o,a,...b.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,u,l,u,l],o=u,a=l);var x=PS(f,p);{for(var C=0,P=x.length;C<P;C++)x[C].segment1=m,x[C].segment2=y,x[C].bez1=f,x[C].bez2=p;d=d.concat(x)}}}}}return d}function AS(e){return am(e)&&am(e[0])}function TS(e){if(wS(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,f=e.length;l<f;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var p=1,d=u.length;p<d;p++)c[p]=+u[p]+(p%2?n:i)}else for(var m=0,h=u.length;m<h;m++)c[m]=u[m];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=kl,t}function fm(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Ls(e,t,n,i){return[e,t,n,i,n,i]}function dm(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 hm(e,t,n,i,r,o,a,s,c,u){var l=er*120/180,f=er/180*(+r||0),p=[],d,m=xS(function(M,S,w){var z=M*Lt.cos(w)-S*Lt.sin(w),U=M*Lt.sin(w)+S*Lt.cos(w);return{x:z,y:U}});if(u)O=u[0],A=u[1],C=u[2],P=u[3];else{d=m(e,t,-f),e=d.x,t=d.y,d=m(s,c,-f),s=d.x,c=d.y;var h=(e-s)/2,g=(t-c)/2,y=h*h/(n*n)+g*g/(i*i);y>1&&(y=Lt.sqrt(y),n=y*n,i=y*i);var v=n*n,b=i*i,x=(o==a?-1:1)*Lt.sqrt(tr((v*b-v*g*g-b*h*h)/(v*g*g+b*h*h))),C=x*n*g/i+(e+s)/2,P=x*-i*h/n+(t+c)/2,O=Lt.asin(((t-P)/i).toFixed(9)),A=Lt.asin(((c-P)/i).toFixed(9));O=e<C?er-O:O,A=s<C?er-A:A,O<0&&(O=er*2+O),A<0&&(A=er*2+A),a&&O>A&&(O=O-er*2),!a&&A>O&&(A=A-er*2)}var I=A-O;if(tr(I)>l){var k=A,D=s,H=c;A=O+l*(a&&A>O?1:-1),s=C+n*Lt.cos(A),c=P+i*Lt.sin(A),p=hm(s,c,n,i,r,0,a,D,H,[A,k,C,P])}I=A-O;var ae=Lt.cos(O),ye=Lt.sin(O),We=Lt.cos(A),Fe=Lt.sin(A),q=Lt.tan(I/4),ue=4/3*n*q,oe=4/3*i*q,le=[e,t],Me=[e+ue*ye,t-oe*ae],W=[s+ue*Fe,c-oe*We],Y=[s,c];if(Me[0]=2*le[0]-Me[0],Me[1]=2*le[1]-Me[1],u)return[Me,W,Y].concat(p);p=[Me,W,Y].concat(p).join().split(",");for(var J=[],Te=0,ft=p.length;Te<ft;Te++)J[Te]=Te%2?m(p[Te-1],p[Te],f).y:m(p[Te],p[Te+1],f).x;return J}function MS(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,f,p,d,m,h,g,y,v=0;v<2;++v){if(v==0?(f=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,p=3*i-3*t),tr(l)<1e-12){if(tr(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}g=f*f-4*p*l,y=Lt.sqrt(g),!(g<0)&&(m=(-f+y)/(2*l),0<m&&m<1&&c.push(m),h=(-f-y)/(2*l),0<h&&h<1&&c.push(h))}for(var b=c.length,x=b,C;b--;)d=c[b],C=1-d,u[0][b]=C*C*C*e+3*C*C*d*n+3*C*d*d*r+d*d*d*a,u[1][b]=C*C*C*t+3*C*C*d*i+3*C*d*d*o+d*d*d*s;return u[0][x]=e,u[1][x]=t,u[0][x+1]=a,u[1][x+1]=s,u[0].length=u[1].length=x+2,{x0:gi(...u[0]),y0:gi(...u[1]),x1:yi(...u[0]),y1:yi(...u[1])}}function mm(e){if(AS(e)||(e=_S(e)),ES(e))return e;for(var t=SS(TS(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,m){var h,g;if(!p)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(p[0]in{T:1,Q:1})&&(d.qx=d.qy=null),p[0]){case"M":d.X=p[1],d.Y=p[2];break;case"A":p=["C",...hm(d.x,d.y,...p.slice(1))];break;case"S":m=="C"||m=="S"?(h=d.x*2-d.bx,g=d.y*2-d.by):(h=d.x,g=d.y),p=["C",h,g,...p.slice(1)];break;case"T":m=="Q"||m=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),p=["C",...dm(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",...dm(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Ls(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Ls(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Ls(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Ls(d.x,d.y,d.X,d.Y)];break}return p},r=function(p,d){if(p[d].length>7){p[d].shift();for(var m=p[d];m.length;)o[d]="A",p.splice(d++,0,["C",...m.splice(0,6)]);p.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],f=l.length;n.x=l[f-2],n.y=l[f-1],n.bx=rm(l[f-4])||n.x,n.by=rm(l[f-3])||n.y}return t}function at(e){return Wt(e)&&Pn(e,"waypoints")}function Ge(e){return Wt(e)&&Pn(e,"labelTarget")}function kS(e){return Wt(e)&&Qr(e.parent)}function gm(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Di(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ae(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Is(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function OS(e){return Di({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function DS(e){for(var t=e.waypoints,n=t.reduce(function(u,l,f){var p=t[f-1];if(p){var d=u[u.length-1],m=d&&d.endLength||0,h=BS(p,l);u.push({start:p,end:l,startLength:m,endLength:m+h,length:h})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function Le(e){return at(e)?DS(e):OS(e)}function en(e,t,n){n=n||0,Wt(n)||(n={x:n,y:n});var i=Ae(e),r=Ae(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,u=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function aa(e,t,n){var i=LS(e,t);return i.length===1||i.length===2&&oa(i[0],i[1])<1?Di(i[0]):i.length>1?(i=li(i,function(r){var o=Math.floor(r.t2*100)||1;return o=100-o,o=(o<10?"0":"")+o,r.segment2+"#"+o}),Di(i[n?0:i.length-1])):null}function LS(e,t){return pm(e,t)}function IS(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],oa(n,r)===0||Al(i,r,n)?e.splice(t,1):t++;return e}function BS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Bs(e,t){return Math.round(e*t)/t}function ym(e){return Be(e)?e+"px":e}function NS(e){for(;e.parent;)e=e.parent;return e}function $S(e){e=V({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),bn(n,{position:"relative",overflow:"hidden",width:ym(e.width),height:ym(e.height)}),t.appendChild(n),n}function vm(e,t,n){const i=Pe("g");Xe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const FS="base",bm=0,jS=1,HS={shape:["x","y","width","height"],connection:["waypoints"]};function Ie(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}Ie.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Ie.prototype._init=function(e){const t=this._eventBus,n=this._container=$S(e),i=this._svg=Pe("svg");we(i,{width:"100%",height:"100%"}),ln(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")}),je(n,i);const r=this._viewport=vm(i,"viewport");e.deferUpdate&&(this._viewboxChanged=Fu(this._viewboxChanged,300)),this._restoreFocus=Fu(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Ie.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},Ie.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Ie.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=tm(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Ie.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Ie.prototype.restoreFocus=function(){this._restoreFocus()},Ie.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Ie.prototype.isFocused=function(){return this._focused},Ie.prototype.getDefaultLayer=function(){return this.getLayer(FS,bm)},Ie.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},Ie.prototype._getChildIndex=function(e){return An(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Ie.prototype._createLayer=function(e,t){typeof t>"u"&&(t=jS);const n=this._getChildIndex(t);return{group:vm(this._viewport,"layer-"+e,n),index:t,visible:!0}},Ie.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},Ie.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(Ht(n),t.visible=!1),n},Ie.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Ht(t.group))},Ie.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Ie.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(NS(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Ie.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Ie.prototype._findPlaneForRoot=function(e){return pt(this._planes,function(t){return t.rootElement===e})},Ie.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Ie.prototype._resolveElements=function(e){return De(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Ie.prototype.getContainer=function(){return this._container},Ie.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&(N([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Xe(r).add(t)):(e.markers.delete(t),Xe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ie.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ie.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ie.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Ie.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ie.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Ie.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,bm);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Ie.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},Ie.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},Ie.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},Ie.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},Ie.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},Ie.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=HS[e];if(!Pr(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ie.prototype._setParent=function(e,t,n){Tt(t.children,e,n),e.parent=t},Ie.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},Ie.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ie.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ie.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),Ct(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Ie.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ie.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ie.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ie.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ie.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ie.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);ta(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=ta(t),r=a?a.matrix:U1(),s=Bs(r.a,1e3),c=Bs(-r.e||0,1e3),u=Bs(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},Ie.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=V({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),xm(t,n)}),{x:n.e,y:n.f}},Ie.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(m=>m!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=Dt(o),s=Ae(a),c=this.viewbox(),u=this.zoom();let l,f;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const p=Ae(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,f=a.y-c.y;else{const m=Math.max(0,s.right-p.right),h=Math.min(0,s.left-p.left),g=Math.max(0,s.bottom-p.bottom),y=Math.min(0,s.top-p.top);l=m||h,f=g||y}this.scroll({dx:-l*u,dy:-f*u})},Ie.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Bs(i.a,1e3)};function xm(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ie.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},Ie.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const f=c.a;return t?(a=V(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),xm(this._viewport,l),l},Ie.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ie.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},Ie.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var fo="data-element-id";function Gn(e){this._elements={},this._eventBus=e}Gn.$inject=["eventBus"],Gn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),we(t,fo,i),n&&we(n,fo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Gn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(we(i.gfx,fo,""),i.secondaryGfx&&we(i.secondaryGfx,fo,""),delete t[n])},Gn.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)},Gn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&we(t,fo,i),t},Gn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&we(e,fo);var n=this._elements[t];return n&&n.element},Gn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Gn.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}},Gn.prototype.getAll=function(){return this.filter(function(e){return e})},Gn.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)})},Gn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Gn.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 zS(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 GS(e){return e.__refs_collection===!0}function VS(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function _m(e,t,n){var i=zS(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 WS(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 Yn(e,t){if(!(this instanceof Yn))return new Yn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Yn.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?_m(this,t,e):WS(this,t,e)},Yn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return GS(n)||_m(this,t,e),n},Yn.prototype.ensureBound=function(e,t){VS(e,t)||this.bind(e,t)},Yn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Yn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Ol=new Yn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),wm=new Yn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Em=new Yn({name:"attachers",collection:!0},{name:"host"}),Sm=new Yn({name:"outgoing",collection:!0},{name:"source"}),Rm=new Yn({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)}}),Ol.bind(this,"parent"),wm.bind(this,"labels"),Sm.bind(this,"outgoing"),Rm.bind(this,"incoming")}function sa(){ho.call(this),Ol.bind(this,"children"),Em.bind(this,"host"),Em.bind(this,"attachers")}_e(sa,ho);function Cm(){ho.call(this),Ol.bind(this,"children")}_e(Cm,sa);function Pm(){sa.call(this),wm.bind(this,"labelTarget")}_e(Pm,sa);function Am(){ho.call(this),Sm.bind(this,"source"),Rm.bind(this,"target")}_e(Am,ho);var US={connection:Am,shape:sa,label:Pm,root:Cm};function YS(e,t){var n=US[e];if(!n)throw new Error("unknown type: <"+e+">");return V(new n,t)}function qS(e){return e instanceof ho}function Li(){this._uid=12}Li.prototype.createRoot=function(e){return this.create("root",e)},Li.prototype.createLabel=function(e){return this.create("label",e)},Li.prototype.createShape=function(e){return this.create("shape",e)},Li.prototype.createConnection=function(e){return this.create("connection",e)},Li.prototype.create=function(e,t){return t=V({},t||{}),t.id||(t.id=e+"_"+this._uid++),YS(e,t)};var Ns="__fn",Tm=1e3,KS=Array.prototype.slice;function kn(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}kn.prototype.on=function(e,t,n,i){if(e=De(e)?e:[e],Ut(t)&&(i=n,n=t,t=Tm),!Be(t))throw new Error("priority must be a number");var r=n;i&&(r=wn(n,i),r[Ns]=n[Ns]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},kn.prototype.once=function(e,t,n,i){var r=this;if(Ut(t)&&(i=n,n=t,t=Tm),!Be(t))throw new Error("priority must be a number");function o(){o.__isTomb=!0;var a=n.apply(i,arguments);return r.off(e,o),a}o[Ns]=n,this.on(e,t,o)},kn.prototype.off=function(e,t){e=De(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},kn.prototype.createEvent=function(e){var t=new ca;return t.init(e),t},kn.prototype.fire=function(e,t){var n,i,r,o;if(o=KS.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 ca?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}},kn.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},kn.prototype._destroy=function(){this._listeners={}},kn.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},kn.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=XS(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},kn.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},kn.prototype._getListeners=function(e){return this._listeners[e]},kn.prototype._setListeners=function(e,t){this._listeners[e]=t},kn.prototype._removeListener=function(e,t){var n=this._getListeners(e),i,r,o;if(!t){this._setListeners(e,null);return}for(;n;)i=n.next,o=n.callback,(o===t||o[Ns]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function ca(){}ca.prototype.stopPropagation=function(){this.cancelBubble=!0},ca.prototype.preventDefault=function(){this.defaultPrevented=!0},ca.prototype.init=function(e){V(this,e||{})};function XS(e,t){return e.apply(null,t)}function Lr(e){return e.childNodes[0]}function ZS(e){return e.parentNode.childNodes[1]}function $s(e,t,n,i,r){var o=ea();o.setTranslate(t,n);var a=ea();a.setRotate(i||0,0,0);var s=ea();s.setScale(1,1),ta(e,[o,a,s])}function tn(e,t,n){var i=ea();i.setTranslate(t,n),ta(e,i)}function Mm(e,t){var n=ea();n.setRotate(t,0,0),ta(e,n)}function Vn(e,t){this._eventBus=e,this._elementRegistry=t}Vn.$inject=["eventBus","elementRegistry"],Vn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=ZS(t),n||(n=Pe("g"),Xe(n).add("djs-children"),je(t.parentNode,n))):n=t,n},Vn.prototype._clear=function(e){var t=Lr(e);return Cs(t),t},Vn.prototype._createContainer=function(e,t,n,i){var r=Pe("g");Xe(r).add("djs-group"),typeof n<"u"?QS(r,t,t.childNodes[n]):je(t,r);var o=Pe("g");Xe(o).add("djs-element"),Xe(o).add("djs-"+e),i&&Xe(o).add("djs-frame"),je(r,o);var a=Pe("g");return Xe(a).add("djs-visual"),je(o,a),o},Vn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,nm(t))},Vn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=An(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),N(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;N(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Vn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Vn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Vn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Vn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Vn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),tn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?we(n,"display","none"):we(n,"display","block")}},Vn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Ht(t.parentNode)};function QS(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const JS={__depends__:[fS],__init__:["canvas"],canvas:["type",Ie],elementRegistry:["type",Gn],elementFactory:["type",Li],eventBus:["type",kn],graphicsFactory:["type",Vn]};function eR(e){var t=new em(e);return t.init(),t}function tR(e){e=e||{};var t={config:["value",e]},n=[t,JS].concat(e.modules||[]);return eR(n)}function ir(e,t){this._injector=t||tR(e),this.get("eventBus").fire("diagram.init")}ir.prototype.get=function(e,t){return this._injector.get(e,t)},ir.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},ir.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},ir.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function pn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Sn(e,t){return e.$instanceOf(t)}function nR(e){return pt(e.rootElements,function(t){return Sn(t,"bpmn:Process")||Sn(t,"bpmn:Collaboration")})}function iR(e){var t={},n=[],i={};function r(W,Y){return function(J){W(J,Y)}}function o(W){t[W.id]=W}function a(W){return t[W.id]}function s(W,Y){var J=W.gfx;if(J)throw new Error(`already rendered ${pn(W)}`);return e.element(W,i[W.id],Y)}function c(W,Y){return e.root(W,i[W.id],Y)}function u(W,Y){try{var J=i[W.id]&&s(W,Y);return o(W),J}catch(Te){l(Te.message,{element:W,error:Te}),console.error(`failed to import ${pn(W)}`,Te)}}function l(W,Y){e.error(W,Y)}var f=this.registerDi=function(Y){var J=Y.bpmnElement;J?i[J.id]?l(`multiple DI elements defined for ${pn(J)}`,{element:J}):i[J.id]=Y:l(`no bpmnElement referenced in ${pn(Y)}`,{element:Y})};function p(W){d(W.plane)}function d(W){f(W),N(W.planeElement,m)}function m(W){f(W)}this.handleDefinitions=function(Y,J){var Te=Y.diagrams;if(J&&Te.indexOf(J)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!J&&Te&&Te.length&&(J=Te[0]),!J)throw new Error("no diagram to display");i={},p(J);var ft=J.plane;if(!ft)throw new Error(`no plane for ${pn(J)}`);var M=ft.bpmnElement;if(!M)if(M=nR(Y),M)l(`correcting missing bpmnElement on ${pn(ft)} to ${pn(M)}`),ft.bpmnElement=M,f(ft);else throw new Error("no process or collaboration to display");var S=c(M,ft);if(Sn(M,"bpmn:Process")||Sn(M,"bpmn:SubProcess"))g(M,S);else if(Sn(M,"bpmn:Collaboration"))le(M,S),y(Y.rootElements,S);else throw new Error(`unsupported bpmnElement for ${pn(ft)}: ${pn(M)}`);h(n)};var h=this.handleDeferred=function(){for(var Y;n.length;)Y=n.shift(),Y()};function g(W,Y){q(W,Y),I(W.ioSpecification,Y),A(W.artifacts,Y),o(W)}function y(W,Y){var J=Ue(W,function(Te){return!a(Te)&&Sn(Te,"bpmn:Process")&&Te.laneSets});J.forEach(r(g,Y))}function v(W,Y){u(W,Y)}function b(W,Y){N(W,r(v,Y))}function x(W,Y){u(W,Y)}function C(W,Y){u(W,Y)}function P(W,Y){u(W,Y)}function O(W,Y){u(W,Y)}function A(W,Y){N(W,function(J){Sn(J,"bpmn:Association")?n.push(function(){O(J,Y)}):O(J,Y)})}function I(W,Y){W&&(N(W.dataInputs,r(C,Y)),N(W.dataOutputs,r(P,Y)))}var k=this.handleSubProcess=function(Y,J){q(Y,J),A(Y.artifacts,J)};function D(W,Y){var J=u(W,Y);Sn(W,"bpmn:SubProcess")&&k(W,J||Y),Sn(W,"bpmn:Activity")&&I(W.ioSpecification,Y),n.push(function(){N(W.dataInputAssociations,r(x,Y)),N(W.dataOutputAssociations,r(x,Y))})}function H(W,Y){u(W,Y)}function ae(W,Y){u(W,Y)}function ye(W,Y){n.push(function(){var J=u(W,Y);W.childLaneSet&&We(W.childLaneSet,J||Y),Me(W)})}function We(W,Y){N(W.lanes,r(ye,Y))}function Fe(W,Y){N(W,r(We,Y))}function q(W,Y){ue(W.flowElements,Y),W.laneSets&&Fe(W.laneSets,Y)}function ue(W,Y){N(W,function(J){Sn(J,"bpmn:SequenceFlow")?n.push(function(){H(J,Y)}):Sn(J,"bpmn:BoundaryEvent")?n.unshift(function(){D(J,Y)}):Sn(J,"bpmn:FlowNode")?D(J,Y):Sn(J,"bpmn:DataObject")||(Sn(J,"bpmn:DataStoreReference")||Sn(J,"bpmn:DataObjectReference")?ae(J,Y):l(`unrecognized flowElement ${pn(J)} in context ${pn(Y&&Y.businessObject)}`,{element:J,context:Y}))})}function oe(W,Y){var J=u(W,Y),Te=W.processRef;Te&&g(Te,J||Y)}function le(W,Y){N(W.participants,r(oe,Y)),n.push(function(){b(W.messageFlows,Y)}),A(W.artifacts,Y)}function Me(W){N(W.flowNodeRef,function(Y){var J=Y.get("lanes");J&&J.push(W)})}}function E(e,t){var n=ie(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Ve(e,t){return Yi(t,function(n){return E(e,n)})}function ie(e){return e&&e.businessObject||e}function Ze(e){return e&&e.di}function rR(e,t,n){var i,r,o,a,s=[];function c(u,l){var f={root:function(h,g){return i.add(h,g)},element:function(h,g,y){return i.add(h,g,y)},error:function(h,g){s.push({message:h,context:g})}},p=new iR(f);l=l||u.diagrams&&u.diagrams[0];var d=oR(u,l);if(!d)throw new Error("no diagram to display");N(d,function(h){p.handleDefinitions(u,h)});var m=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(m+"_plane")||o.findRoot(m))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(f){return f.warnings=s,l(f)}})}function oR(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!E(n,"bpmn:Process")&&!E(n,"bpmn:Collaboration")&&(i=aR(n));var r;E(i,"bpmn:Collaboration")?r=i:r=pt(e.rootElements,function(u){if(E(u,"bpmn:Collaboration"))return pt(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=cn(r.participants,function(u){return u.processRef}),o.push(r));var a=km(o),s=[t],c=[n];return N(e.diagrams,function(u){if(u.plane){var l=u.plane.bpmnElement;a.indexOf(l)!==-1&&c.indexOf(l)===-1&&(s.push(u),c.push(l))}}),s}}function km(e){var t=[];return N(e,function(n){n&&(t.push(n),t=t.concat(km(n.flowElements)))}),t}function aR(e){for(var t=e;t;){if(E(t,"bpmn:Process"))return t;t=t.$parent}}var sR='<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>',Om=sR,Dm={verticalAlign:"middle"},Lm={color:"#404040"},cR={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},uR={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},lR={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"},pR='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Om+'</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>',vi;function fR(){vi=mt(pR),bn(vi,cR),bn(ot("svg",vi),Dm),bn(ot(".backdrop",vi),uR),bn(ot(".notice",vi),lR),bn(ot(".link",vi),Lm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function dR(){vi||(fR(),Mn.bind(vi,".backdrop","click",function(e){document.body.removeChild(vi)})),document.body.appendChild(vi)}const Fs=5,Im="djs-outline-hidden";function xt(e){e=V({},mR,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),yR(this._container)}_e(xt,ir),xt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(p){throw this._emit("import.parse.complete",{error:p}),p}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const f=await this.importDefinitions(s,n);return o=o.concat(f.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),js(s,o),s=hR(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},xt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},xt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw js(o,[]),o}if(typeof t=="string"&&(i=gR(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw js(o,[]),o}try{this.clear()}catch(o){throw js(o,[]),o}const{warnings:r}=await rR(this,n,i);return{warnings:r}},xt.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},xt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=ot(":scope > defs",i._svg),a=Jh(r),s=o?"<defs>"+Jh(o)+"</defs>":"",c=i.getContainer();bt(c).add(Im);let u;try{u=r.getBBox()}finally{bt(c).remove(Im)}const l=u.x-Fs,f=u.y-Fs,p=u.width+Fs*2,d=u.height+Fs*2;t=`<?xml version="1.0" encoding="utf-8"?>
4
+ nested error: `+C.message;if(D)return a.addWarning({message:H,error:C}),!0;throw Zi(H)}function l(C,P){return u(C,P,!0)}function f(){var C=a.elementsById,P=a.references,D,T;for(D=0;T=P[D];D++){var I=T.element,k=C[T.id],L=Ti(I).propertiesByName[T.property];if(k||a.addWarning({message:"unresolved reference <"+T.id+">",element:T.element,property:T.property,value:T.id}),L.isMany){var H=I.get(L.name),ae=H.indexOf(T);ae===-1&&(ae=H.length),k?H[ae]=k:H.splice(ae,1)}else I.set(L.name,k)}}function p(){c.pop().handleEnd()}var d=/^<\?xml /i,m=/ encoding="([^"]+)"/i,h=/^utf-8$/i;function g(C){if(d.test(C)){var P=m.exec(C),D=P&&P[1];!D||h.test(D)||a.addWarning({message:"unsupported document encoding <"+D+">, falling back to UTF-8"})}}function y(C,P){var D=c.peek();try{c.push(D.handleNode(C))}catch(T){u(T,P,o)&&c.push(new Ku)}}function v(C,P){try{c.peek().handleText(C)}catch(D){l(D,P)}}function b(C,P){C.trim()&&v(C,P)}var x=r.getPackages().reduce(function(C,P){return C[P.uri]=P.prefix,C},Object.entries(qu).reduce(function(C,[P,D]){return C[D]=P,C},r.config&&r.config.nsMap||{}));return s.ns(x).on("openTag",function(C,P,D,T){var I=C.attrs||{},k=Object.keys(I).reduce(function(H,ae){var ye=P(I[ae]);return H[ae]=ye,H},{}),L={name:C.name,originalName:C.originalName,attributes:k,ns:C.ns};y(L,T)}).on("question",g).on("closeTag",p).on("cdata",v).on("text",function(C,P,D){b(P(C),D)}).on("error",u).on("warn",l),new Promise(function(C,P){var D;try{s.parse(e),f()}catch(H){D=H}var T=i.element;!D&&!T&&(D=Zi("failed to parse document as <"+i.type.$descriptor.name+">"));var I=a.warnings,k=a.references,L=a.elementsById;return D?(D.warnings=I,P(D)):C({rootElement:T,elementsById:L,references:k,warnings:I})})},Qu.prototype.handler=function(e){return new Zu(this.model,e)};function _w(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}var ww=`<?xml version="1.0" encoding="UTF-8"?>
5
+ `,Ew=/<|>|'|"|&|\n\r|\n/g,Bd=/<|>|&/g;function di(e){this.prefixMap={},this.uriMap={},this.used={},this.wellknown=[],this.custom=[],this.parent=e,this.defaultPrefixMap=e&&e.defaultPrefixMap||{}}di.prototype.mapDefaultPrefixes=function(e){this.defaultPrefixMap=e},di.prototype.defaultUriByPrefix=function(e){return this.defaultPrefixMap[e]},di.prototype.byUri=function(e){return this.uriMap[e]||this.parent&&this.parent.byUri(e)},di.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)},di.prototype.uriByPrefix=function(e){return this.prefixMap[e||"xmlns"]||this.parent&&this.parent.uriByPrefix(e)},di.prototype.mapPrefix=function(e,t){this.prefixMap[e||"xmlns"]=t},di.prototype.getNSKey=function(e){return e.prefix!==void 0?e.uri+"|"+e.prefix:e.uri},di.prototype.logUsed=function(e){var t=e.uri,n=this.getNSKey(e);this.used[n]=this.byUri(t),this.parent&&this.parent.logUsed(e)},di.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 Sw(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Rw(e,t){return Od(t)?Sw(e):e}function Nd(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function $d(e){return Pn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function Cw(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 Pw(e,t){return t.isGeneric?V({localName:t.ns.localName},e):V({localName:Rw(t.ns.localName,t.$pkg)},e)}function Aw(e,t){return V({localName:t.ns.localName},e)}function Tw(e){var t=e.$descriptor;return Ue(t.properties,function(n){var i=n.name;if(n.isVirtual||!An(e,i))return!1;var r=e[i];return r===n.default||r===null?!1:n.isMany?r.length:!0})}var Mw={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},kw={"<":"lt",">":"gt","&":"amp"};function Fd(e,t,n){return e=Pn(e)?e:""+e,e.replace(t,function(i){return"&"+n[i]+";"})}function Ow(e){return Fd(e,Ew,Mw)}function Dw(e){return Fd(e,Bd,kw)}function Lw(e){return Ue(e,function(t){return t.isAttr})}function Iw(e){return Ue(e,function(t){return!t.isAttr})}function Ju(e){this.tagName=e}Ju.prototype.build=function(e){return this.element=e,this},Ju.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()};function kr(){}kr.prototype.serializeValue=kr.prototype.serializeTo=function(e){e.append(this.escape?Dw(this.value):this.value)},kr.prototype.build=function(e,t){return this.value=t,e.type==="String"&&t.search(Bd)!==-1&&(this.escape=!0),this};function el(e){this.tagName=e}Nd(el,kr),el.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()};function xt(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}xt.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=Tw(e),this.parseAttributes(Lw(r)),this.parseContainments(Iw(r))),this.parseGenericAttributes(e,i),this},xt.prototype.nsTagName=function(e){var t=this.logNamespaceUsed(e.ns);return Pw(t,e)},xt.prototype.nsPropertyTagName=function(e){var t=this.logNamespaceUsed(e.ns);return Aw(t,e)},xt.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},xt.prototype.nsAttributeName=function(e){var t;if(Pn(e)?t=pn(e):t=e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:V({localName:t.localName},n)},xt.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}))},xt.prototype.parseGenericContainments=function(e){var t=e.$body;t&&this.body.push(new kr().build({type:"String"},t));var n=e.$children;n&&$(n,i=>{this.body.push(new xt(this).build(i))})},xt.prototype.parseNsAttribute=function(e,t,n){var i=e.$model,r=pn(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)}},xt.prototype.parseNsAttributes=function(e){var t=this,n=e.$attrs,i=[];return $(n,function(r,o){var a=t.parseNsAttribute(e,o,r);a&&i.push(a)}),i},xt.prototype.parseGenericAttributes=function(e,t){var n=this;$(t,function(i){try{n.addAttribute(n.nsAttributeName(i.name),i.value)}catch(r){typeof console<"u"&&console.warn(`missing namespace information for <${i.name}=${i.value}> on`,e,r)}})},xt.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;$(e,function(r){var o=i.get(r.name),a=r.isReference,s=r.isMany;if(s||(o=[o]),r.isBody)n.push(new kr().build(r,o[0]));else if(Rd(r.type))$(o,function(u){n.push(new el(t.addTagName(t.nsPropertyTagName(r))).build(r,u))});else if(a)$(o,function(u){n.push(new Ju(t.addTagName(t.nsPropertyTagName(r))).build(u))});else{var c=Ld(r);$(o,function(u){var l;c?c===Dd?l=new xt(t,r):l=new ds(t,r,c):l=new xt(t),n.push(l.build(u))})}})},xt.prototype.getNamespaces=function(e){var t=this.namespaces,n=this.parent,i;return t||(i=n&&n.getNamespaces(),e||!i?this.namespaces=t=new di(i):t=i),t},xt.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},xt.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},xt.prototype.parseAttributes=function(e){var t=this,n=this.element;$(e,function(i){var r=n.get(i.name);if(i.isReference)if(!i.isMany)r=r.id;else{var o=[];$(r,function(a){o.push(a.id)}),r=o.join(" ")}t.addAttribute(t.nsAttributeName(i),r)})},xt.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),$d(e)},xt.prototype.addAttribute=function(e,t){var n=this.attrs;Pn(t)&&(t=Ow(t));var i=_d(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)},xt.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=Cw(n).concat(t)),$(t,function(i){e.append(" ").append($d(i.name)).append('="').append(i.value).append('"')})},xt.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==kr;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),$(this.body,function(i){i.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()};function ds(e,t,n){xt.call(this,e,t),this.serialization=n}Nd(ds,xt),ds.prototype.parseNsAttributes=function(e){var t=xt.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},ds.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri};function Bw(){this.value="",this.write=function(e){this.value+=e}}function Nw(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 $w(e){e=V({format:!1,preamble:!0},e||{});function t(n,i){var r=i||new Bw,o=new Nw(r,e.format);e.preamble&&o.append(ww);var a=new xt,s=n.$model;if(a.getNamespaces().mapDefaultPrefixes(Fw(s)),a.build(n).serializeTo(o),!i)return r.value}return{toXML:t}}function Fw(e){const t=e.config&&e.config.nsMap||{},n={};for(const i in qu)n[i]=qu[i];for(const i in t){const r=t[i];n[r]=i}for(const i of e.getPackages())n[i.prefix]=i.uri;return n}function hs(e,t){Yn.call(this,e,t)}hs.prototype=Object.create(Yn.prototype),hs.prototype.fromXML=function(e,t,n){Pn(t)||(n=t,t="bpmn:Definitions");var i=new Qu(V({model:this,lax:!0},n)),r=i.handler(t);return i.fromXML(e,r)},hs.prototype.toXML=function(e,t){var n=new $w(t);return new Promise(function(i,r){try{var o=n.toXML(e);return i({xml:o})}catch(a){return r(a)}})};var jw="BPMN20",Hw="http://www.omg.org/spec/BPMN/20100524/MODEL",zw="bpmn",Gw=[],Vw=[{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"}]}],Ww=[{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"}]}],Uw={tagAlias:"lowerCase",typePrefix:"t"},Yw={name:jw,uri:Hw,prefix:zw,associations:Gw,types:Vw,enumerations:Ww,xml:Uw},qw="BPMNDI",Kw="http://www.omg.org/spec/BPMN/20100524/DI",Xw="bpmndi",Zw=[{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"]}],Qw=[{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"}]}],Jw=[],eE={name:qw,uri:Kw,prefix:Xw,types:Zw,enumerations:Qw,associations:Jw},tE="DC",nE="http://www.omg.org/spec/DD/20100524/DC",iE="dc",rE=[{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}]}],oE=[],aE={name:tE,uri:nE,prefix:iE,types:rE,associations:oE},sE="DI",cE="http://www.omg.org/spec/DD/20100524/DI",uE="di",lE=[{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"}]}],pE=[],fE={tagAlias:"lowerCase"},dE={name:sE,uri:cE,prefix:uE,types:lE,associations:pE,xml:fE},hE="bpmn.io colors for BPMN",mE="http://bpmn.io/schema/bpmn/biocolor/1.0",gE="bioc",yE=[{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"}]}],vE=[],bE=[],xE={name:hE,uri:mE,prefix:gE,types:yE,enumerations:vE,associations:bE},_E="BPMN in Color",wE="http://www.omg.org/spec/BPMN/non-normative/color/1.0",EE="color",SE=[{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"}]}],RE=[],CE=[],PE={name:_E,uri:wE,prefix:EE,types:SE,enumerations:RE,associations:CE};const AE={bpmn:Yw,bpmndi:eE,dc:aE,di:dE,bioc:xE,color:PE};function jd(e,t){const n=V({},AE,e);return new hs(n,t)}const TE={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"}},ME="http://www.omg.org/spec/BPMN/non-normative/extensions/i18n/1.0",Hd="i18n",ms={[Hd]:TE,[Nu]:gd};function zd(){return jd(ms)}const Gd=zd();async function tl(e){const{rootElement:t,warnings:n}=await Gd.fromXML(e,"bpmn:Definitions");return{definitions:t,warnings:n}}async function kE(e){const{xml:t}=await Gd.toXML(e,{format:!0});return t}function nl(e){return e.map(t=>typeof t=="string"?t:t.message??String(t))}const ao={cjkEm:.865,upperEm:.68,lowerEm:.5,digitEm:.556,spaceEm:.278,otherEm:.35,ascentEm:.9,descentEm:.25},OE=/[ᄀ-ᇿ -〿぀-ヿ㐀-鿿가-힯＀-⦆]/;function DE(e){const t=ao;return OE.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 so(e,t){let n=0;for(const i of e)n+=t*DE(i);return n}function Vd(e=globalThis,{textMeasurement:t="approximate"}={}){if(!(e!=null&&e.SVGElement))throw new Error("installHeadlessBpmnDom: DOM 전역이 없다 — jsdom window 를 전역에 올린 뒤 호출할 것");t==="approximate"&&LE(e),IE(e),BE(e),NE(e)}function LE(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:so(r,o),fontBoundingBoxAscent:o*ao.ascentEm,fontBoundingBoxDescent:o*ao.descentEm,actualBoundingBoxAscent:o*ao.ascentEm,actualBoundingBoxDescent:o*ao.descentEm}}};t.getContext=()=>n}function IE(e){if(e.SVGMatrix)return;class t{constructor(){Jr(this,"a",1);Jr(this,"b",0);Jr(this,"c",0);Jr(this,"d",1);Jr(this,"e",0);Jr(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 BE(e){var o;const t=()=>{const a=new e.SVGMatrix;return{type:0,matrix:a,setTranslate(s,c){a.e=s,a.f=c},setScale(s,c){a.a=s,a.d=c},setRotate(s,c=0,u=0){const l=s*Math.PI/180,f=Math.cos(l),p=Math.sin(l);a.a=f,a.b=p,a.c=-p,a.d=f,a.e=c-f*c+p*u,a.f=u-p*c-f*u},setMatrix(s){Object.assign(a,s)}}},n=a=>{const s=t();return Object.assign(s.matrix,a),s},i=(o=e.SVGSVGElement)==null?void 0:o.prototype;i&&!i.createSVGTransform&&(i.createSVGTransform=t,i.createSVGTransformFromMatrix=n,i.createSVGMatrix=()=>new e.SVGMatrix,i.createSVGPoint=()=>({x:0,y:0,matrixTransform:()=>({x:0,y:0})}));const r=e.SVGElement.prototype;Object.getOwnPropertyDescriptor(r,"transform")||Object.defineProperty(r,"transform",{configurable:!0,get(){if(!this.__headlessTransformList){const a=[];this.__headlessTransformList={baseVal:{get numberOfItems(){return a.length},clear:()=>{a.length=0},appendItem:s=>(a.push(s),s),getItem:s=>a[s],createSVGTransformFromMatrix:n,consolidate:()=>a[a.length-1]??null}}}return this.__headlessTransformList}})}function NE(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:so(n,12),height:14}})}const gs=new Set(["bpmn:Participant","bpmn:Lane","bpmn:Group","bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),$E=new Set(["bpmn:SubProcess","bpmn:AdHocSubProcess","bpmn:Transaction"]),FE=1,il=new Set(["bpmn:TextAnnotation","bpmn:DataStoreReference","bpmn:DataObjectReference","bpmn:DataInput","bpmn:DataOutput"]),jE=2;function bn(e){switch(e.kind){case"label-over-line":return`L|${e.edge}|${e.line}`;case"edge-crosses-shape":return`x|${e.edge}|${e.shape}`;case"shape-overlap":return`o|${e.shapes[0]}|${e.shapes[1]}`;case"shape-outside-container":return`c|${e.shape}|${e.container}`;case"edge-overlap-opposite":return`p|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-mixed":return`m|${e.edges[0]}|${e.edges[1]}`;case"edge-overlap-unrelated":return`u|${e.edges[0]}|${e.edges[1]}`;case"label-on-shared-segment":return`l|${e.edge}|${e.other}`;case"annotation-over-label":return`a|${e.annotation}|${e.label}`;case"pool-overlap":return`P|${e.pools[0]}|${e.pools[1]}`;case"edge-crosses-subprocess":return`S|${e.edge}|${e.subProcess}`;case"group-overlap-unintended":return`g|${e.groups[0]}|${e.groups[1]}${e.container?`|⊃${e.container}`:""}`;case"group-overlap-unreadable":return e.reason==="minority"?`gu*|${e.group}|${e.shapes.join(",")}`:e.reason==="throughpass"?`gu>|${e.group}|${e.shapes.join(",")}`:`gu|${e.groups[0]}|${e.groups[1]}|${e.shapes.join(",")}`;case"group-stack-unreadable":return`gs|${e.groups.join("|")}|${e.shapes.join(",")}`;case"group-on-container-boundary":return`gb|${e.group}|${e.container}|${e.side}`;case"group-on-group-boundary":return`gg|${e.groups[0]}|${e.groups[1]}|${e.axis}`;case"group-cuts-shape":return`gc|${e.group}|${e.shape}|${e.side}`;case"pool-name-over-label":return`pn|${e.pool}|${e.label}`}}const Wd=20,ys=5,Ud=3,HE=8,Yd=12,zE=Yd*1.2;function rl(e,t){const n=t.split(/\r?\n/),i=Math.max(...n.map(o=>so(o,Yd))),r=n.length*zE;return{x:e.x+e.width/2-i/2,y:e.y+e.height/2-r/2,width:i,height:r}}const qd=1;function xn(e){const t=[];for(let n=0;n+1<e.waypoints.length;n++){const i=e.waypoints[n],r=e.waypoints[n+1];Math.abs(i.y-r.y)<.5&&Math.abs(i.x-r.x)>=.5?t.push({axis:"h",at:i.y,lo:Math.min(i.x,r.x),hi:Math.max(i.x,r.x),dir:r.x>i.x?1:-1}):Math.abs(i.x-r.x)<.5&&Math.abs(i.y-r.y)>=.5&&t.push({axis:"v",at:i.x,lo:Math.min(i.y,r.y),hi:Math.max(i.y,r.y),dir:r.y>i.y?1:-1})}return t}function co(e,t){let n=null;const i=e.type!==t.type,o=!!(e.source&&e.target&&t.source&&t.target)&&e.source!==t.source&&e.source!==t.target&&e.target!==t.source&&e.target!==t.target;for(const a of xn(e))for(const s of xn(t)){if(a.axis!==s.axis||Math.abs(a.at-s.at)>qd)continue;const c=a.dir!==s.dir?"opposite":i?"mixed":o?"unrelated":null;if(!c)continue;const u=Math.min(a.hi,s.hi)-Math.max(a.lo,s.lo);u>=Wd&&(!n||u>n.length)&&(n={axis:a.axis,length:u,kind:c})}return n}function ol(e){return e.kind==="edge-overlap-opposite"||e.kind==="edge-overlap-mixed"||e.kind==="edge-overlap-unrelated"}function Kd(e,t){const n=co(e,t);return n&&n.kind==="opposite"?{axis:n.axis,length:n.length}:null}function GE(e,t){let n=0;for(const i of t)i.id!==e.id&&Kd(e,i)&&n++;return n}function Hn(e,t){let n=0;for(const i of t)i.id!==e.id&&co(e,i)&&n++;return n}const Xd=15,Zd=20;function VE(e,t){const n=t.axis==="v"?[e.x,e.x+e.width]:[e.y,e.y+e.height];if(t.at<n[0]-Zd||t.at>n[1]+Zd)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 al=20;function vs(e,t){const n=[];for(const i of t){if(i.axis!==e.axis||Math.abs(i.at-e.at)>qd)continue;const r=Math.max(e.lo,i.lo),o=Math.min(e.hi,i.hi);o-r<Wd||n.push([r-al,o+al])}return n}function bs(e,t){const n=e.label;if(!n)return null;let i=null;for(const r of xn(e)){const o=VE(n,r);if(o){for(const a of t)if(a.id!==e.id&&!(i&&a.id>=i.other)){for(const[s,c]of vs(r,xn(a)))if(Math.min(c,o[1])>Math.max(s,o[0])){i={other:a.id,axis:r.axis};break}}}}return i}const WE=1,UE=(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 YE(e,t,n,i){const r=n.x+i,o=n.y+i,a=n.x+n.width-i,s=n.y+n.height-i;if(a<=r||s<=o)return!1;const c=t.x-e.x,u=t.y-e.y;let l=0,f=1;const p=(d,m)=>{if(m===0)return d<=0;const h=d/m;if(m>0){if(h>f)return!1;h>l&&(l=h)}else{if(h<l)return!1;h<f&&(f=h)}return!0};return p(r-e.x,c)&&p(e.x-a,-c)&&p(o-e.y,u)&&p(e.y-s,-u)&&f>l}function sl(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 qE=(e,t)=>e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height,uo=1;function Mi(e,t){const n=e.x+uo,i=e.x+e.width-uo,r=e.y+uo,o=e.y+e.height-uo;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 ea(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 Qd(e,t){const n=e.label;if(!n)return null;if(xn(e).some(i=>Mi(n,i)))return e.id;for(const i of[...t.edges].filter(r=>r.id!==e.id).sort((r,o)=>r.id.localeCompare(o.id)))if(xn(i).some(r=>Mi(n,r)))return i.id;for(const i of t.shapes.filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(ea(i).some(r=>Mi(n,r)))return i.id;return null}function en(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(YE(e.waypoints[o],e.waypoints[o+1],r,jE)){i.push(r);break}}return i}function KE(e,t,n,i){const r=(u,l,f)=>(l.x-u.x)*(f.y-u.y)-(l.y-u.y)*(f.x-u.x),o=r(n,i,e),a=r(n,i,t),s=r(e,t,n),c=r(e,t,i);return o*a<0&&s*c<0}const Jd=(e,t)=>e.endpoints.some(n=>t.endpoints.includes(n));function ta(e,t){let n=0;for(const i of t){if(i.id===e.id||Jd(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++)KE(e.waypoints[o],e.waypoints[o+1],i.waypoints[a],i.waypoints[a+1])&&(r=!0);r&&n++}return n}function zn(e,t){let n=0;for(const i of t)i.id===e.id||Jd(e,i)||ta(e,[i])>0&&(n+=i.type===e.type?2:1);return n}function eh(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++)ta(n[i],[n[r]])>0&&(t+=n[i].type===n[r].type?2:1);return t}function xs(e){const t=[],n=e.edges;for(let i=0;i<n.length;i++)for(let r=i+1;r<n.length;r++)if(ta(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 th(e){const t=xs(e),n=a=>a==="bpmn:MessageFlow"||a.endsWith("Association")?"dashed":"solid",i=new Map(e.edges.map(a=>[a.id,a]));let r=0,o=0;for(const[a,s]of t){const c=i.get(a),u=i.get(s);if(!c||!u)continue;const l=n(c.type),f=n(u.type);l==="solid"&&f==="solid"?r++:l==="dashed"&&f==="dashed"&&o++}return{pairs:t,solidPairs:r,dashedPairs:o,mixedPairs:t.length-r-o,crossPoolMessages:XE(e)}}function XE(e){const t=e.shapes.filter(r=>r.type==="bpmn:Participant");if(t.length<3)return 0;const n=r=>{const o=e.shapes.find(a=>a.id===r);if(o)return t.find(a=>o.x>=a.x&&o.y>=a.y&&o.x+o.width<=a.x+a.width&&o.y+o.height<=a.y+a.height)};let i=0;for(const r of e.edges){if(r.type!=="bpmn:MessageFlow"||r.endpoints.length<2)continue;const o=n(r.endpoints[0]),a=n(r.endpoints[1]);if(!o||!a||o.id===a.id)continue;const s=Math.min(o.y,a.y),c=Math.max(o.y+o.height,a.y+a.height);t.some(u=>u.id!==o.id&&u.id!==a.id&&u.y>s&&u.y+u.height<c)&&i++}return i}function nh(e,t,n){const i=new Set(t.flatMap(r=>[...r.members]));return e.shapes.filter(r=>!r.container&&!il.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 ih(e){var n;const t=(n=bt(e==null?void 0:e.extensionElements))==null?void 0:n.values;if(Array.isArray(t))for(const i of t){const r=bt(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 rh=e=>e?{members:e}:{},Gn=e=>e.shapes.filter(t=>!t.container);function ZE(e,t,n){if(e.type==="bpmn:TextAnnotation")for(const i of t.edges){if(!/Association$/.test(i.type)||!i.endpoints.includes(e.id))continue;const r=i.endpoints.find(a=>a!==e.id),o=r?n.get(r):void 0;if(o){if(o.container)return o.id;if(o.parent)return o.parent}}}function oh(e,t){const n=e.label;if(!n)return null;for(const i of[...t.edges].sort((r,o)=>r.id.localeCompare(o.id)))if(xn(i).some(r=>Mi(n,r)))return i.id;for(const i of[...t.shapes].filter(r=>r.container).sort((r,o)=>r.id.localeCompare(o.id)))if(ea(i).some(r=>Mi(n,r)))return i.id;return null}function lo(e){const t=[];for(const n of e.shapes)n.label&&t.push({owner:n.id,rect:n.label});for(const n of e.edges)n.label&&t.push({owner:n.id,rect:n.label});return t}function fn(e){const t=[],n=e.shapes.filter(y=>!y.container);for(const y of e.edges)for(const v of en(y,n))t.push({kind:"edge-crosses-shape",edge:y.id,shape:v.id});const i=e.shapes.filter(y=>y.container&&$E.has(y.type));if(i.length){const y=(v,b)=>{const x=e.shapes.find(C=>C.id===b);return!!x&&x.x>=v.x&&x.y>=v.y&&x.x+x.width<=v.x+v.width&&x.y+x.height<=v.y+v.height};for(const v of e.edges)for(const b of en(v,i))v.endpoints.includes(b.id)||v.endpoints.some(x=>y(b,x))||t.push({kind:"edge-crosses-subprocess",edge:v.id,subProcess:b.id})}const r=e.shapes.filter(y=>y.type==="bpmn:Participant");for(let y=0;y<r.length;y++)for(let v=y+1;v<r.length;v++){const b=r[y],x=r[v];if(b.x+b.width<=x.x||x.x+x.width<=b.x||b.y+b.height<=x.y||x.y+x.height<=b.y)continue;const C=(P,D)=>P.x<=D.x&&P.y<=D.y&&P.x+P.width>=D.x+D.width&&P.y+P.height>=D.y+D.height;t.push({kind:"pool-overlap",pools:[b.id,x.id],contained:C(b,x)||C(x,b)})}const o=n.filter(y=>!y.attached);for(let y=0;y<o.length;y++)for(let v=y+1;v<o.length;v++){const b=o[y],x=o[v];if(!sl(b,x,FE))continue;const C=b.id<x.id?[b.id,x.id]:[x.id,b.id];t.push({kind:"shape-overlap",shapes:C,identical:qE(b,x)})}const a=e.shapes.filter(y=>y.type==="bpmn:Group"&&Array.isArray(y.members)&&y.members.length>0);for(let y=0;y<a.length;y++)for(let v=y+1;v<a.length;v++){const b=a[y],x=a[v],C=Math.min(b.x+b.width,x.x+x.width)-Math.max(b.x,x.x),P=Math.min(b.y+b.height,x.y+x.height)-Math.max(b.y,x.y);if(C<=ys||P<=ys)continue;const D=b.id<x.id?[b.id,x.id]:[x.id,b.id],T=new Set(x.members);if(b.members.some(k=>T.has(k))){const k=nh(e,a,{x:Math.max(b.x,x.x),y:Math.max(b.y,x.y),right:Math.min(b.x+b.width,x.x+x.width),bottom:Math.min(b.y+b.height,x.y+x.height)});k.length&&t.push({kind:"group-overlap-unreadable",reason:"orphan",groups:D,shapes:k});continue}const I=b.x<=x.x&&b.y<=x.y&&b.x+b.width>=x.x+x.width&&b.y+b.height>=x.y+x.height?b.id:x.x<=b.x&&x.y<=b.y&&x.x+x.width>=b.x+b.width&&x.y+x.height>=b.y+b.height?x.id:void 0;t.push({kind:"group-overlap-unintended",groups:D,...I?{container:I}:{}})}const s=new Set(a.flatMap(y=>[...y.members])),c=y=>e.shapes.filter(v=>!v.container&&!il.has(v.type)&&v.x>=y.x&&v.y>=y.y&&v.x+v.width<=y.x+y.width&&v.y+v.height<=y.y+y.height);for(const y of a){const v=c(y);if(!v.length)continue;const b=new Set(y.members),x=v.filter(C=>!b.has(C.id));x.some(C=>s.has(C.id))&&(x.length*2<v.length||t.push({kind:"group-overlap-unreadable",reason:"minority",group:y.id,shapes:x.map(C=>C.id).sort()}))}for(const y of a){const v=new Set(c(y).map(T=>T.id)),b=new Set(y.members),x=new Set([...v].filter(T=>!b.has(T)&&s.has(T)));if(!x.size)continue;let C=!1,P=!1,D=!1;for(const T of e.edges){if(T.type!=="bpmn:SequenceFlow"||!T.source||!T.target)continue;const I=x.has(T.source),k=x.has(T.target);!I&&k&&!v.has(T.source)?C=!0:I&&!k&&!v.has(T.target)?P=!0:I&&k&&(D=!0)}C&&P&&D&&t.push({kind:"group-overlap-unreadable",reason:"throughpass",group:y.id,shapes:[...x].sort()})}const u=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<u.length;y++)for(let v=y+1;v<u.length;v++)for(let b=v+1;b<u.length;b++){const x=[u[y],u[v],u[b]],C={x:Math.max(...x.map(T=>T.x)),y:Math.max(...x.map(T=>T.y)),right:Math.min(...x.map(T=>T.x+T.width)),bottom:Math.min(...x.map(T=>T.y+T.height))};if(C.right-C.x<=ys||C.bottom-C.y<=ys)continue;const P=nh(e,[],C);if(!P.length)continue;const D=x.map(T=>T.id).sort();t.push({kind:"group-stack-unreadable",groups:D,shapes:P})}for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of e.shapes){if(v.container||v.attached||il.has(v.type)||v.width<=0||v.height<=0)continue;const b=[["top",y.y,"h",y.x,y.x+y.width],["bottom",y.y+y.height,"h",y.x,y.x+y.width],["left",y.x,"v",y.y,y.y+y.height],["right",y.x+y.width,"v",y.y,y.y+y.height]];for(const[x,C,P,D,T]of b){const I=P==="h"?v.x:v.y,k=P==="h"?v.x+v.width:v.y+v.height;if(!(I<T&&D<k))continue;const L=P==="h"?v.y:v.x,H=P==="h"?v.y+v.height:v.x+v.width;if(!(L<C&&C<H))continue;const ae=Math.min(C-L,H-C);ae<HE||t.push({kind:"group-cuts-shape",group:y.id,shape:v.id,side:x,depth:ae})}}const l=e.shapes.filter(y=>y.container&&y.type!=="bpmn:Group"&&y.type!=="bpmn:Lane");for(const y of e.shapes.filter(v=>v.type==="bpmn:Group"))for(const v of l){const b=y.x<v.x+v.width&&v.x<y.x+y.width,x=y.y<v.y+v.height&&v.y<y.y+y.height,C=[["top",y.y,v.y,b],["bottom",y.y+y.height,v.y+v.height,b],["left",y.x,v.x,x],["right",y.x+y.width,v.x+v.width,x]];for(const[P,D,T,I]of C)I&&Math.abs(D-T)<=Ud&&t.push({kind:"group-on-container-boundary",group:y.id,container:v.id,side:P})}const f=e.shapes.filter(y=>y.type==="bpmn:Group");for(let y=0;y<f.length;y++)for(let v=y+1;v<f.length;v++){const b=f[y],x=f[v],C=b.x<x.x+x.width&&x.x<b.x+b.width,P=b.y<x.y+x.height&&x.y<b.y+b.height,D=[["x",b.x+b.width,x.x,P],["x",x.x+x.width,b.x,P],["y",b.y+b.height,x.y,C],["y",x.y+x.height,b.y,C]];for(const[T,I,k,L]of D)if(L&&Math.abs(I-k)<=Ud){t.push({kind:"group-on-group-boundary",groups:b.id<x.id?[b.id,x.id]:[x.id,b.id],axis:T});break}}for(let y=0;y<e.edges.length;y++)for(let v=y+1;v<e.edges.length;v++){const b=e.edges[y],x=e.edges[v],C=co(b,x);if(!C)continue;const P=b.id<x.id?[b.id,x.id]:[x.id,b.id];t.push({kind:C.kind==="opposite"?"edge-overlap-opposite":C.kind==="mixed"?"edge-overlap-mixed":"edge-overlap-unrelated",edges:P,axis:C.axis,length:Math.round(C.length)})}for(const y of e.edges){if(!y.label)continue;const v=bs(y,e.edges);v&&t.push({kind:"label-on-shared-segment",edge:y.id,other:v.other,axis:v.axis})}for(const y of e.edges){if(!y.label)continue;const v=Qd(y,e);v&&t.push({kind:"label-over-line",edge:y.id,line:v})}const p=new Set(n.map(y=>y.id)),d=e.shapes.filter(y=>y.type==="bpmn:Participant"&&y.label);for(const y of[...n,...d.filter(v=>!p.has(v.id))]){if(!y.label)continue;const v=oh(y,e);v&&t.push({kind:"label-over-line",edge:y.id,line:v})}const m=new Set(e.shapes.filter(y=>y.type==="bpmn:TextAnnotation").map(y=>y.id));for(const y of d)for(const{owner:v,rect:b}of lo(e))v===y.id||m.has(v)||sl(y.label,b,uo)&&t.push({kind:"pool-name-over-label",pool:y.id,label:v});const h=lo(e);for(const y of n)if(y.type==="bpmn:TextAnnotation")for(const{owner:v,rect:b}of h)v!==y.id&&sl(y,b,uo)&&t.push({kind:"annotation-over-label",annotation:y.id,label:v});const g=new Map(e.shapes.map(y=>[y.id,y]));for(const y of n){const v=y.parent??ZE(y,e,g);if(!v)continue;const b=g.get(v);!b||!b.container||UE(b,y,WE)||t.push({kind:"shape-outside-container",shape:y.id,container:b.id})}return t.sort((y,v)=>bn(y).localeCompare(bn(v)))}const bt=e=>typeof e=="object"&&e!==null?e:void 0,Pt=e=>typeof e=="number"?e:0,ki=e=>{const t=bt(e);return typeof(t==null?void 0:t.id)=="string"?t.id:void 0};function QE(e){const t=bt(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 JE(e){const t=bt(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 e1(e,t){const n=bt(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(gs.has(i)&&i!=="bpmn:Lane"&&i!=="bpmn:Group")return ki(n)}function ah(e){var a,s,c,u,l;const t=[],n=[],i=((a=bt(e))==null?void 0:a.diagrams)??[],r=new Map,o=new Set;for(const f of((s=bt(e))==null?void 0:s.rootElements)??[]){const p=bt(f);if((p==null?void 0:p.$type)==="bpmn:Collaboration")for(const d of p.participants??[]){const m=bt(d),h=ki(m),g=ki(m==null?void 0:m.processRef);h&&g?r.set(g,h):h&&o.add(h)}}for(const f of i){const p=bt((c=bt(f))==null?void 0:c.plane),d=(p==null?void 0:p.planeElement)??[];for(const m of d){const h=bt(m);if(!h)continue;const g=bt(h.bpmnElement),y=typeof(g==null?void 0:g.id)=="string"?g.id:void 0;if(!y)continue;const v=typeof(g==null?void 0:g.$type)=="string"?g.$type:"",b=bt(h.bounds);if(b){const C=h.isExpanded===!1&&v!=="bpmn:Participant",P=bt((u=bt(h.label))==null?void 0:u.bounds),D={id:y,type:v,x:Pt(b.x),y:Pt(b.y),width:Pt(b.width),height:Pt(b.height),container:gs.has(v)&&!C,attached:(g==null?void 0:g.attachedToRef)!==void 0,...g?{parent:e1(g,r)}:{},...P?{label:{x:Pt(P.x),y:Pt(P.y),width:Pt(P.width),height:Pt(P.height)}}:{},...v==="bpmn:Group"?rh(ih(g)):{}},T=h.isHorizontal!==!1,I=typeof(g==null?void 0:g.name)=="string"?g.name:"";o.has(y)&&T&&I&&(D.label=rl(D,I)),t.push(D);continue}const x=h.waypoint;if(Array.isArray(x)){const C=bt((l=bt(h.label))==null?void 0:l.bounds);n.push({id:y,type:v,waypoints:x.map(P=>{var D,T;return{x:Pt((D=bt(P))==null?void 0:D.x),y:Pt((T=bt(P))==null?void 0:T.y)}}),endpoints:QE(g),...JE(g),...C?{label:{x:Pt(C.x),y:Pt(C.y),width:Pt(C.width),height:Pt(C.height)}}:{}})}}}return{shapes:t,edges:n}}function sh(e){return fn(ah(e))}async function t1(e){const{definitions:t,warnings:n}=await tl(e);return{findings:sh(t),warnings:n}}function nt(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=bt(o.label),g=ki(o.source),y=ki(o.target);n.push({id:o.id,type:a,waypoints:s.map(v=>({x:Pt(v.x),y:Pt(v.y)})),endpoints:[g,y].filter(v=>!!v),...g&&y?{source:g,target:y}:{},...h&&typeof h.x=="number"?{label:{x:h.x,y:Pt(h.y),width:Pt(h.width),height:Pt(h.height)}}:{}});continue}if(typeof o.x!="number"||typeof o.y!="number")continue;const c=bt(o.businessObject),u=bt(o.label);let l=bt(o.parent);for(;l&&l.type==="bpmn:Lane";)l=bt(l.parent);const f=typeof(l==null?void 0:l.type)=="string"?l.type:"",p=l&&gs.has(f)&&f!=="bpmn:Group"&&typeof l.id=="string"?l.id:void 0,d={id:o.id,type:a,x:o.x,y:o.y,width:Pt(o.width),height:Pt(o.height),container:gs.has(a)&&(a==="bpmn:Participant"||o.collapsed!==!0),attached:(c==null?void 0:c.attachedToRef)!==void 0,...p!==void 0?{parent:p}:{},...u&&typeof u.x=="number"?{label:{x:u.x,y:Pt(u.y),width:Pt(u.width),height:Pt(u.height)}}:{},...a==="bpmn:Group"?rh(ih(c)):{}},m=typeof(c==null?void 0:c.name)=="string"?c.name:"";a==="bpmn:Participant"&&!(c!=null&&c.processRef)&&m&&((i=bt(o.di))==null?void 0:i.isHorizontal)!==!1&&(d.label=rl(d,m)),t.push(d)}return{shapes:t,edges:n}}const n1={"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 i1(e,t){const n=n1[e];return n||(e==="label"||e.startsWith("bpmndi:")?"other":e.startsWith("bpmn:")&&!("waypoints"in t&&t.waypoints)?"flowNode":"other")}function ch(e){let t=e.parent;for(;t;){if(t.type==="bpmn:Participant")return t.id;t=t.parent}}function uh(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 i1(i.type,i)},lanesOf:n=>t().filter(i=>i.type==="bpmn:Lane"&&ch(i)===n).sort((i,r)=>i.y-r.y).map(i=>i.id),participantOf:n=>{const i=e.get(n);return i?ch(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 cl=20,r1=4,gt=(e,t)=>Math.abs(e-t)<.5;function _s(e,t,n,i=cl){if(gt(e.y,t.y)&&!gt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x);if(!(r<n.x-i&&n.x+n.width+i<o))return null;const a=e.x<t.x?n.x-i:n.x+n.width+i,s=e.x<t.x?n.x+n.width+i:n.x-i,c=u=>[{x:a,y:e.y},{x:a,y:u},{x:s,y:u},{x:s,y:e.y}];return[c(n.y-i),c(n.y+n.height+i)]}if(gt(e.x,t.x)&&!gt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y);if(!(r<n.y-i&&n.y+n.height+i<o))return null;const a=e.y<t.y?n.y-i:n.y+n.height+i,s=e.y<t.y?n.y+n.height+i:n.y-i,c=u=>[{x:e.x,y:a},{x:u,y:a},{x:u,y:s},{x:e.x,y:s}];return[c(n.x-i),c(n.x+n.width+i)]}return null}function lh(e,t,n,i=cl){if(n.length<2)return null;if(gt(e.y,t.y)&&!gt(e.x,t.x)){const r=Math.min(e.x,t.x),o=Math.max(e.x,t.x),a=Math.min(...n.map(d=>d.x))-i,s=Math.max(...n.map(d=>d.x+d.width))+i;if(!(r<a&&s<o))return null;const c=e.x<t.x?a:s,u=e.x<t.x?s:a,l=Math.min(...n.map(d=>d.y))-i,f=Math.max(...n.map(d=>d.y+d.height))+i,p=d=>[{x:c,y:e.y},{x:c,y:d},{x:u,y:d},{x:u,y:e.y}];return[p(l),p(f)]}if(gt(e.x,t.x)&&!gt(e.y,t.y)){const r=Math.min(e.y,t.y),o=Math.max(e.y,t.y),a=Math.min(...n.map(d=>d.y))-i,s=Math.max(...n.map(d=>d.y+d.height))+i;if(!(r<a&&s<o))return null;const c=e.y<t.y?a:s,u=e.y<t.y?s:a,l=Math.min(...n.map(d=>d.x))-i,f=Math.max(...n.map(d=>d.x+d.width))+i,p=d=>[{x:e.x,y:c},{x:d,y:c},{x:d,y:u},{x:e.x,y:u}];return[p(l),p(f)]}return null}function ph(e,t,n=cl){if(e.length!==4)return null;const[i,r,o,a]=e;if(gt(i.y,r.y)&&gt(r.x,o.x)&&gt(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(gt(i.x,r.x)&&gt(r.y,o.y)&&gt(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 ws(e,t){if(e.endpoints.length!==2)return[];const n=t.find(f=>f.id===e.endpoints[0]),i=t.find(f=>f.id===e.endpoints[1]);if(!n||!i)return[];if(i.x<=n.x+n.width)return[];const r=n.y+n.height/2,o=i.y+i.height/2;if(r>=i.y&&r<=i.y+i.height)return[];const a=i.x+i.width/2,s=n.x+n.width/2,c=r>o,u=[{x:n.x+n.width,y:r},{x:a,y:r},{x:a,y:c?i.y+i.height:i.y}],l=[{x:s,y:c?n.y:n.y+n.height},{x:s,y:o},{x:i.x,y:o}];return[u,l]}const fh=30,o1=[0,-25,25,-40,40];function a1(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+fh:s-fh,u=a?i.y+i.height:i.y,l=n.x+n.width/2,f=i.x+i.width/2;return o1.map(p=>[{x:l,y:s},{x:l,y:c},{x:f+p,y:c},{x:f+p,y:u}])}const ul=(e,t,n)=>[...e.slice(0,t+1),...n,...e.slice(t+1)],po=(e,t,n)=>en({...e,waypoints:t},n).length;function ll(e,t,n,i){let r=[...e.waypoints],o=po(e,r,t);if(o===0)return null;let a=!1;for(const f of ws(e,t))if(po(e,f,t)===0)return f;const s=(i??[]).filter(f=>f.id!==e.id).flatMap(xn),c=f=>xn({...e,waypoints:f}).some(p=>vs(p,s).length>0),u=a1(e,t).filter(f=>po(e,f,t)===0);if(u.length)return u.find(f=>!c(f))??u[0];const l=f=>!n||f.every(p=>p.x>=n.x&&p.x<=n.x+n.width&&p.y>=n.y&&p.y<=n.y+n.height);if(e.endpoints.length===2&&r.length>2){const f=t.find(d=>d.id===e.endpoints[0]),p=t.find(d=>d.id===e.endpoints[1]);if(f&&p&&gt(f.y+f.height/2,p.y+p.height/2)){const d=[r[0],r[r.length-1]];if(gt(d[0].y,d[1].y)&&!gt(d[0].x,d[1].x)){const m=t.filter(v=>!e.endpoints.includes(v.id)&&en({...e,waypoints:d},[v]).length>0),h=m.length>=2?lh(d[0],d[1],m):null,y=(h?h.map(v=>[d[0],...v,d[1]]):m.length===1?(_s(d[0],d[1],m[0])??[]).map(v=>[d[0],...v,d[1]]):m.length===0?[d]:[]).filter(v=>po(e,v,t)===0&&v.length<=r.length).sort((v,b)=>Number(l(b))-Number(l(v)));if(y.length)return y.find(v=>!c(v))??y[0]}}}for(let f=0;f+1<r.length;f++){const p=r[f],d=r[f+1],m=t.filter(y=>!e.endpoints.includes(y.id)&&en({...e,waypoints:[p,d]},[y]).length>0);if(m.length<2)continue;const h=lh(p,d,m);if(!h)continue;const g=h.map(y=>ul(r,f,y)).filter(y=>po(e,y,t)===0).sort((y,v)=>Number(l(v))-Number(l(y)));if(g.length)return g.find(y=>!c(y))??g[0]}for(let f=0;f<r1&&o>0;f++){let p=!1;for(let d=0;d+1<r.length&&!p;d++){const m=r[d],h=r[d+1];for(const g of t){if(e.endpoints.includes(g.id)||en({...e,waypoints:[m,h]},[g]).length===0)continue;const y=_s(m,h,g),v=y?y.map(x=>ul(r,d,x)):ph(r,g)??[];if(!v.length)continue;const b=[...v].sort((x,C)=>Number(l(C))-Number(l(x)));for(const x of b){const C=po(e,x,t);if(C<o){r=x,o=C,p=!0,a=!0;break}}if(p)break}}if(!p)break}return a&&o===0?r:null}function pl(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=Gn(o),s=new Set,c=fn(o).filter(l=>l.kind==="edge-crosses-shape"&&!t.has(bn(l)));if(!c.length)return s;const u=new Map;for(const l of c){if(l.kind!=="edge-crosses-shape"||u.has(l.edge))continue;const f=o.edges.find(p=>p.id===l.edge);f&&u.set(l.edge,f)}for(const[l,f]of u){if(n&&!n.has(l))continue;const p=i.get(l);if(!p)continue;const d=p.parent,m=d&&typeof d.x=="number"&&typeof d.width=="number"?{x:d.x,y:d.y,width:d.width,height:d.height}:void 0,h=ll(f,a,m,o.edges);if(!h){en(f,a).some(b=>b.type==="bpmn:TextAnnotation")&&s.add(l);continue}const g=o.edges.filter(b=>b.id!==l),y=Hn(f,g);Hn({...f,waypoints:h},g)>y||r.updateWaypoints(p,h)}return s}const s1=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},fl=(e,t)=>ta(e,[t])>0;function dh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=Gn(o);let s=o;const c=new Set(fn(o).map(bn));for(const[u,l]of xs(o))if(!t.has(`${u}|${l}`))for(const[f,p]of[[u,l],[l,u]]){if(n.has(f))continue;const d=s.edges.find(I=>I.id===f),m=s.edges.find(I=>I.id===p);if(!d||!m)continue;const h=i.get(f);if(!h)continue;const g=h.parent,y=g&&typeof g.x=="number"&&typeof g.width=="number"?{x:g.x,y:g.y,width:g.width,height:g.height}:void 0,v=s1(m),b=[...ws(d,a)??[]],x=ll(d,[...a,...v],y,o.edges);x&&b.push(x);for(let I=0;I+1<d.waypoints.length;I++)for(const k of v)for(const L of _s(d.waypoints[I],d.waypoints[I+1],k)??[])b.push(ul(d.waypoints,I,L));const C=s.edges.filter(I=>I.id!==f),P=I=>({...s,edges:s.edges.map(k=>k.id===f?{...k,waypoints:I}:k)}),D=I=>!y||I.every(k=>k.x>=y.x&&k.x<=y.x+y.width&&k.y>=y.y&&k.y<=y.y+y.height),T=b.find(I=>{const k={...d,waypoints:I};return fl(k,m)||!D(I)||C.some(L=>L.id!==p&&!fl(d,L)&&fl(k,L))?!1:fn(P(I)).every(L=>c.has(bn(L)))});if(T){r.updateWaypoints(h,T),s=P(T);break}}}const c1=10;function hh(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 mh(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=hh(i,n),a=hh(r,n);if(!o||!a||o.id===a.id)return null;const s=a.y>o.y,c=s?o:a,u=s?a:o,l=n.filter(H=>H.id!==o.id&&H.id!==a.id&&H.y>=c.y+c.height&&H.y+H.height<=u.y).sort((H,ae)=>H.y-ae.y);if(!l.length)return null;const f=l[0],p=l[l.length-1],d=(c.y+c.height+f.y)/2,m=(p.y+p.height+u.y)/2,h=s?d:m,g=s?m:d,y=e.waypoints[0],v=e.waypoints[e.waypoints.length-1],b=Gn(t),x=t.edges.filter(H=>H.id!==e.id),C=zn(e,x),P=en(e,b).length;if(C===0&&P===0||P===0&&e.waypoints.length===2)return null;const D=Math.min(...l.map(H=>H.x)),T=Math.max(...l.map(H=>H.x+H.width)),I=(y.x+v.x)/2,k=H=>H.filter((ae,ye)=>ye===0||!(gt(ae.x,H[ye-1].x)&&gt(ae.y,H[ye-1].y)));let L;for(let H=D;H<=T;H+=c1){const ae=k([y,{x:y.x,y:h},{x:H,y:h},{x:H,y:g},{x:v.x,y:g},v]),ye={...e,waypoints:ae};if(en(ye,b).length>0)continue;const We=zn(ye,x),Fe=Math.abs(H-I);(!L||We<L.cross||We===L.cross&&Fe<L.detour)&&(L={pts:ae,cross:We,detour:Fe})}return L&&(P>0?L.cross<=C:L.cross<C)?L.pts:null}function gh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n);for(const o of r.edges){if(o.type!=="bpmn:MessageFlow"||t.has(o.id))continue;const a=nt(n),s=a.edges.find(l=>l.id===o.id);if(!s)continue;const c=mh(s,a);if(!c)continue;const u=n.get(o.id);u&&i.updateWaypoints(u,c)}}const hi=[25,-25,40,-40],fo=35;function u1(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)-fo:Math.max(e.y+e.height,t.y+t.height)+fo;for(const u of[0,...hi])if(!(Math.abs(u)>=e.width/2-5))for(const l of[0,...hi]){if(Math.abs(l)>=t.width/2-5)continue;const f=n+u,p=i+l;r.push({pts:[{x:f,y:a},{x:f,y:c},{x:p,y:c},{x:p,y:s}],cost:Math.abs(l)+Math.abs(u)})}}return r}function Es(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 u1(n,i);const o=i.x+i.width/2,a=n.x+n.width/2,s=r<i.y,c=s?i.y:i.y+i.height,u=s?n.y:n.y+n.height,l=s?n.y-fo:n.y+n.height+fo,f=[];for(const v of[0,...hi]){if(Math.abs(v)>=i.width/2-5)continue;const b=o+v;f.push({pts:[{x:n.x,y:r},{x:b,y:r},{x:b,y:c}],cost:Math.abs(v)});for(const x of[0,...hi]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;f.push({pts:[{x:C,y:u},{x:C,y:l},{x:b,y:l},{x:b,y:c}],cost:Math.abs(v)+Math.abs(x)})}}const p=50,d=i.y+i.height/2,m=s?n.y+n.height:n.y;for(const v of[0,...hi]){if(Math.abs(v)>=n.width/2-5)continue;const b=a+v;f.push({pts:[{x:b,y:m},{x:b,y:d},{x:i.x+i.width,y:d}],cost:p+Math.abs(v)})}const h=60,g=s?i.y+i.height:i.y,y=s?i.y+i.height+fo:i.y-fo;for(const v of[0,...hi]){if(Math.abs(v)>=i.width/2-5)continue;const b=o+v;for(const x of[0,...hi]){if(Math.abs(x)>=n.width/2-5)continue;const C=a+x;f.push({pts:[{x:C,y:m},{x:C,y},{x:b,y},{x:b,y:g}],cost:h+Math.abs(v)+Math.abs(x)})}}return f}const Ss=30;function yh(e,t){for(let n=1;n<e.length-2;n++){const i=e[n],r=e[n+1],o=gt(i.y,r.y)&&!gt(i.x,r.x),a=gt(i.x,r.x)&&!gt(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)<Ss||Math.abs(i.y-(s.y+s.height))<Ss)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)<Ss||Math.abs(i.x-(s.x+s.width))<Ss)return!0}}return!1}const Rs=40;function l1(e,t,n){let i=0;for(const r of t){if(r.container||n.includes(r.id))continue;const o=r.x-Rs,a=r.x+r.width+Rs,s=r.y-Rs,c=r.y+r.height+Rs;for(let u=1;u<e.length-2;u++){const l=e[u],f=e[u+1],p={x:Math.min(l.x,f.x),y:Math.min(l.y,f.y)},d={x:Math.max(l.x,f.x),y:Math.max(l.y,f.y)};if(p.x<a&&d.x>o&&p.y<c&&d.y>s){i++;break}}}return i}function vh(e,t){if(e.type!=="bpmn:SequenceFlow")return null;const n=t.shapes.filter(P=>P.container),i=new Map(t.shapes.map(P=>[P.id,P])),r=Gn(t),o=t.edges.filter(P=>P.id!==e.id),a=Hn(e,o),s=zn(e,o),c=P=>l1(P,t.shapes,e.endpoints)+(yh(P,n)?1:0),u=c(e.waypoints),l=P=>{if(!P)return;const D=P.x+P.width/2,T=P.y+P.height/2;return n.find(I=>I.type==="bpmn:Lane"&&D>=I.x&&D<=I.x+I.width&&T>=I.y&&T<=I.y+I.height)},f=l(i.get(e.endpoints[0]??"")),p=l(i.get(e.endpoints[1]??"")),d=!!f&&!!p&&f.id!==p.id,m=P=>{if(!d||!p)return!1;for(let D=1;D<P.length-2;D++){const T=P[D],I=P[D+1];if(gt(T.y,I.y)&&!gt(T.x,I.x)&&T.y>p.y&&T.y<p.y+p.height)return!0}return!1},h=m(e.waypoints),y=(P=>{if(!P)return;const D=P.x+P.width/2,T=P.y+P.height/2;return n.filter(I=>I.type==="bpmn:Participant"&&D>=I.x&&D<=I.x+I.width&&T>=I.y&&T<=I.y+I.height).sort((I,k)=>I.width*I.height-k.width*k.height)[0]})(i.get(e.endpoints[0]??"")),v=P=>{if(!y)return 0;let D=0;for(let T=1;T<P.length-1;T++){const I=P[T];(I.x<y.x||I.x>y.x+y.width||I.y<y.y||I.y>y.y+y.height)&&D++}return D},b=v(e.waypoints);if(!yh(e.waypoints,n)&&!(d&&!h)&&b===0)return null;const x=P=>P.reduce((D,T,I)=>I?D+Math.abs(T.x-P[I-1].x)+Math.abs(T.y-P[I-1].y):0,0);let C;for(const{pts:P,cost:D}of Es(e,i)){const T={...e,waypoints:P};if(en(T,r).length>0)continue;const I=Hn(T,o);if(I>a)continue;const k=v(P);if(k>b)continue;const L=k<b&&I===0;if(!L&&zn(T,o)>s)continue;const H=c(P),ae=m(P);if(!L&&!(ae&&!h)&&H>=u)continue;const We=ae?0:1,Fe=x(P);(!C||k<C.out||k===C.out&&(We<C.lane||We===C.lane&&(I<C.opp||I===C.opp&&(H<C.sc||H===C.sc&&(D<C.cost||D===C.cost&&Fe<C.len)))))&&(C={pts:P,out:k,sc:H,lane:We,opp:I,cost:D,len:Fe})}return(C==null?void 0:C.pts)??null}function p1(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n).edges.filter(o=>!t.has(o.id)&&o.waypoints.length>=4).map(o=>o.id).sort();for(const o of r){const a=nt(n),s=a.edges.find(d=>d.id===o);if(!s||s.waypoints.length<4)continue;const c=Gn(a),u=a.edges.filter(d=>d.id!==o),l=en(s,c).length,f=Hn(s,u),p=zn(s,u);for(const d of ws(s,a.shapes)){if(d.length>=s.waypoints.length)continue;const m={...s,waypoints:d};if(en(m,c).length>l||Hn(m,u)>f||zn(m,u)>p)continue;const h=n.get(o);h&&i.updateWaypoints(h,d);break}}}function bh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n).edges.filter(o=>o.type==="bpmn:SequenceFlow"&&!t.has(o.id)).map(o=>o.id).sort();for(const o of r){const a=nt(n),s=a.edges.find(l=>l.id===o);if(!s)continue;const c=vh(s,a);if(!c)continue;const u=n.get(o);u&&i.updateWaypoints(u,c)}}function dl(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=gt(n[0].x,n[1].x)&&!gt(n[0].y,n[1].y),s=gt(n[n.length-1].x,n[n.length-2].x)&&!gt(n[n.length-1].y,n[n.length-2].y);for(const c of hi){if(a&&r&&Math.abs(c)<r.width/2-5){const u=n.map(l=>({...l}));u[0].x+=c,u[1].x+=c,i.push({pts:u,cost:Math.abs(c)})}if(s&&o&&Math.abs(c)<o.width/2-5){const u=n.map(l=>({...l}));u[u.length-1].x+=c,u[u.length-2].x+=c,i.push({pts:u,cost:Math.abs(c)})}}return i}function f1(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];if(Math.min(n.x+n.width,i.x+i.width)-Math.max(n.x,i.x)>=1)return[];const r=i.y+i.height<=n.y,o=n.y+n.height<=i.y;if(!r&&!o)return[];const a=i.x>=n.x+n.width,s=i.x+i.width<=n.x;if(!a&&!s)return[];const c=n.x+n.width/2,u=n.y+n.height/2,l=i.x+i.width/2,f=i.y+i.height/2,p=a?n.x+n.width:n.x,d=o?n.y+n.height:n.y,m=a?i.x:i.x+i.width,h=o?i.y:i.y+i.height,g=[];for(const y of[0,...hi])Math.abs(y)<i.width/2-5&&g.push({pts:[{x:p,y:u},{x:l+y,y:u},{x:l+y,y:h}],cost:Math.abs(y)}),Math.abs(y)<i.height/2-5&&g.push({pts:[{x:c,y:d},{x:c,y:f+y},{x:m,y:f+y}],cost:Math.abs(y)});return g}function hl(e,t){if(e.type!=="bpmn:SequenceFlow")return[];const n=t.get(e.endpoints[0]??""),i=t.get(e.endpoints[1]??"");if(!n||!i)return[];const r=Math.max(n.x,i.x),o=Math.min(n.x+n.width,i.x+i.width);if(o-r<1)return[];const a=i.y+i.height<=n.y,s=n.y+n.height<=i.y;if(!a&&!s)return[];const c=a?n.y:n.y+n.height,u=a?i.y+i.height:i.y,l=(r+o)/2,f=[];for(const p of[0,...hi]){const d=l+p;d<=r||d>=o||f.push({pts:[{x:d,y:c},{x:d,y:u}],cost:Math.abs(p)})}return f}function xh(e,t){const n=new Map(t.shapes.map(d=>[d.id,d])),i=Gn(t),r=t.edges.filter(d=>d.id!==e.id),o=Hn(e,r);if(o===0)return null;const a=zn(e,r);let s;const c=d=>d.reduce((m,h,g)=>g?m+Math.abs(h.x-d[g-1].x)+Math.abs(h.y-d[g-1].y):0,0),u=3,l=d=>{const m=d[0],h=d[d.length-1],g=Math.hypot(h.x-m.x,h.y-m.y);return g>=1&&c(d)/g>=u?1:0},f=l(e.waypoints),p=[...Es(e,n),...hl(e,n),...dl(e,n)];for(const{pts:d,cost:m}of p){const h={...e,waypoints:d};if(en(h,i).length>0)continue;const g=Hn(h,r),y=zn(h,r),v=o-g+(f-l(d));if(g>=o||y-a>v)continue;const b=c(d);(!s||g<s.opposite||g===s.opposite&&(y<s.cross||y===s.cross&&(m<s.cost||m===s.cost&&b<s.len)))&&(s={pts:d,opposite:g,cross:y,cost:m,len:b})}return(s==null?void 0:s.pts)??null}function _h(e,t){var i;let n=0;for(const r of t)r.id!==e.id&&((i=co(e,r))==null?void 0:i.kind)==="unrelated"&&n++;return n}function d1(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Gn(t),r=t.edges.filter(p=>p.id!==e.id),o=_h(e,r);if(o===0)return null;const a=Hn(e,r),s=zn(e,r),c=p=>p.reduce((d,m,h)=>h?d+Math.abs(m.x-p[h-1].x)+Math.abs(m.y-p[h-1].y):0,0),u=2;let l;const f=[...Es(e,n),...hl(e,n),...f1(e,n),...dl(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(en(m,i).length>0)continue;const h=_h(m,r);if(h>=o)continue;const g=Hn(m,r);if(g-h>a-o)continue;const y=zn(m,r);if(y-s>(o-h)*u)continue;const v=c(p);(!l||h<l.fake||h===l.fake&&(g<l.unreadable||g===l.unreadable&&(y<l.cross||y===l.cross&&(d<l.cost||d===l.cost&&v<l.length))))&&(l={pts:p,fake:h,unreadable:g,cross:y,cost:d,length:v})}return(l==null?void 0:l.pts)??null}function wh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=fn(nt(i)).filter(s=>s.kind==="edge-overlap-unrelated"&&!t.has(bn(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=nt(i),u=c.edges.find(p=>p.id===s);if(!u)continue;const l=d1(u,c);if(!l)continue;const f=i.get(s);f&&r.updateWaypoints(f,l)}}function Eh(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 Sh(e,t,n){var u;if(e.type!=="bpmn:SequenceFlow"||t.type!=="bpmn:SequenceFlow"||((u=co(e,t))==null?void 0:u.kind)!=="opposite")return!1;const[i,r]=e.endpoints,[o,a]=t.endpoints,s=[i,r].filter(l=>l&&(l===o||l===a)).length;return!(!!r&&r===o||!!a&&a===i)||s!==1?!1:Eh(e,n)&&Eh(t,n)}function Rh(e,t,n){let i=0;for(const r of t)r.id!==e.id&&Sh(e,r,n)&&i++;return i}function h1(e,t){const n=new Map(t.shapes.map(p=>[p.id,p])),i=Gn(t),r=t.edges.filter(p=>p.id!==e.id),o=Rh(e,r,n);if(o===0)return null;const a=Hn(e,r),s=zn(e,r),c=p=>p.reduce((d,m,h)=>h?d+Math.abs(m.x-p[h-1].x)+Math.abs(m.y-p[h-1].y):0,0),u=2;let l;const f=[...Es(e,n),...hl(e,n),...dl(e,n)];for(const{pts:p,cost:d}of f){const m={...e,waypoints:p};if(en(m,i).length>0)continue;const h=Rh(m,r,n);if(h>=o)continue;const g=Hn(m,r);if(g-h>a-o)continue;const y=zn(m,r);if(y-s>(o-h)*u)continue;const v=c(p);(!l||h<l.chain||h===l.chain&&(g<l.unreadable||g===l.unreadable&&(y<l.cross||y===l.cross&&(d<l.cost||d===l.cost&&v<l.length))))&&(l={pts:p,chain:h,unreadable:g,cross:y,cost:d,length:v})}return(l==null?void 0:l.pts)??null}function m1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=new Map(o.shapes.map(u=>[u.id,u])),s=fn(o).filter(u=>u.kind==="edge-overlap-opposite"&&!t.has(bn(u)));if(!s.length)return;const c=new Set;for(const u of s){if(u.kind!=="edge-overlap-opposite")continue;const[l,f]=u.edges.map(p=>o.edges.find(d=>d.id===p));if(!(!l||!f||!Sh(l,f,a)))for(const p of u.edges)n.has(p)||c.add(p)}for(const u of[...c].sort()){const l=nt(i),f=l.edges.find(m=>m.id===u);if(!f)continue;const p=h1(f,l);if(!p)continue;const d=i.get(u);d&&r.updateWaypoints(d,p)}}function Ch(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=fn(o).filter(l=>ol(l)&&!t.has(bn(l)));if(!a.length)return;const s=new Set;for(const l of a)if(ol(l))for(const f of l.edges)n.has(f)||s.add(f);const c=l=>{var f;return((f=o.edges.find(p=>p.id===l))==null?void 0:f.type)??""},u=[...s].sort((l,f)=>{const p=c(l)==="bpmn:SequenceFlow"?0:1,d=c(f)==="bpmn:SequenceFlow"?0:1;return p!==d?p-d:l.localeCompare(f)});for(const l of u){const f=nt(i),p=f.edges.find(h=>h.id===l);if(!p)continue;const d=xh(p,f);if(!d)continue;const m=i.get(l);m&&r.updateWaypoints(m,d)}}const g1=10,y1=(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 Ph(e,t){const n=e.label;if(!n)return null;const i=t.edges.filter(a=>a.id!==e.id);if(!bs(e,i))return null;const r=Gn(t),o=i.flatMap(xn);for(const a of xn(e)){let s=[[a.lo,a.hi]];for(const[d,m]of vs(a,o))s=s.flatMap(([h,g])=>{const y=[];return d>h&&y.push([h,Math.min(g,d)]),m<g&&y.push([Math.max(h,m),g]),y.filter(([v,b])=>b>v)});const c=a.axis==="h"?n.width:n.height,u=s.find(([d,m])=>m-d>=c+g1*2);if(!u)continue;const l=(u[0]+u[1])/2,f=a.axis==="h"?{x:l,y:a.at-Xd}:{x:a.at+Mn+n.width/2,y:l},p={x:f.x-n.width/2,y:f.y-n.height/2,width:n.width,height:n.height};if(!bs({...e,label:p},i)&&!r.some(d=>!e.endpoints.includes(d.id)&&y1(p,d)))return p}return null}const Mn=8;function Ah(e,t){const n=e.label;if(!n)return null;const i=xn(e);if(!i.length)return null;const r=n.x+n.width/2,o=n.y+n.height/2,a=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(xn),...t.shapes.filter(p=>p.container).flatMap(ea)],u=p=>!c.some(d=>Mi(p,d));if(u(n))return null;const l=(s.axis==="v"?n.height:n.width)+Mn,f=[0,-l,l,-2*l,2*l];if(s.axis==="v")for(const p of[s.at+Mn,s.at-Mn-n.width])for(const d of f){const m=n.y+d;if(m<s.lo||m+n.height>s.hi)continue;const h={...n,x:p,y:m};if(u(h))return h}else for(const p of[s.at-Mn-n.height,s.at+Mn])for(const d of f){const m=n.x+d;if(m<s.lo||m+n.width>s.hi)continue;const h={...n,x:m,y:p};if(u(h))return h}return null}function Th(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n);for(const o of r.edges){if(!o.label||t.has(o.id))continue;const a=Ah(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 Mh(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=nt(i),a=fn(o).filter(s=>s.kind==="label-on-shared-segment"&&!t.has(bn(s)));for(const s of a){if(s.kind!=="label-on-shared-segment"||n.has(s.edge))continue;const c=o.edges.find(p=>p.id===s.edge);if(!c)continue;const u=Ph(c,o);if(!u)continue;const l=i.get(s.edge),f=l==null?void 0:l.label;f&&r.moveElements([f],{x:u.x-f.x,y:u.y-f.y})}}function kh(e,t){const n=e.label;if(!n)return null;const i=[...t.edges.flatMap(xn),...t.shapes.filter(p=>p.container).flatMap(ea)],r=i.filter(p=>Mi(n,p));if(!r.length)return null;const o=t.shapes.filter(p=>!p.container&&p.id!==e.id),a=lo(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=>Mi(p,d))&&!o.some(d=>s(p,d))&&!a.some(d=>s(p,d)),u=[];for(const p of r)p.axis==="h"?u.push({...n,y:p.at-Mn-n.height},{...n,y:p.at+Mn}):u.push({...n,x:p.at-Mn-n.width},{...n,x:p.at+Mn});const l=e.x+e.width/2,f=e.y+e.height/2;return u.push({...n,x:l-n.width/2,y:e.y+e.height+Mn},{...n,x:l-n.width/2,y:e.y-Mn-n.height},{...n,x:e.x+e.width+Mn,y:f-n.height/2},{...n,x:e.x-Mn-n.width,y:f-n.height/2}),u.find(c)??null}function Oh(e,t){const{elementRegistry:n}=e,i=e.modeling,r=nt(n);for(const o of r.shapes){if(o.container||!o.label||t.has(o.id))continue;const a=kh(o,nt(n));if(!a)continue;const s=n.get(o.id),c=s==null?void 0:s.label;c&&i.moveElements([c],{x:a.x-c.x,y:a.y-c.y})}}const v1=/^[\p{L}_][\p{L}\p{N}_.\-]*$/u,Dh=new Set(["sequenceFlow","messageFlow","dataAssociation","association"]),Lh={"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}]},Cs=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),ml=e=>typeof e=="string"&&e!=="";function b1(e){const t=[];function n(i,r,o,a){if(a===null){ml(o)||t.push({kind:"payload-invalid",opIndex:i,field:r});return}if(!Cs(o)){t.push({kind:"payload-invalid",opIndex:i,field:r});return}for(const s of a)ml(o[s])||t.push({kind:"payload-invalid",opIndex:i,field:`${r}.${s}`})}return e.forEach((i,r)=>{var o,a;if(!Cs(i)||!ml(i.kind)||!(i.kind in Lh)){t.push({kind:"payload-invalid",opIndex:r,field:"kind"});return}for(const s of Lh[i.kind]){const c=s.path.endsWith("[]"),u=c?s.path.slice(0,-2):s.path,l=u.split(".");let f=i;for(const d of l.slice(0,-1)){if(!Cs(f))break;f=f[d]}if(!Cs(f))continue;const p=f[l[l.length-1]];if(!(p===void 0&&s.optional)&&!(p===null&&s.optional)){if(!c){n(r,s.path,p,s.shape);continue}if(!Array.isArray(p)){t.push({kind:"payload-invalid",opIndex:r,field:s.path});continue}p.forEach((d,m)=>n(r,`${u}[${m}]`,d,s.shape))}}if(i.kind==="node.add"||i.kind==="node.update"){const s=i.band;s!==void 0&&(!Number.isInteger(s)||s<0)&&t.push({kind:"payload-invalid",opIndex:r,field:"band"});const c=i.kind==="node.add"?(o=i.node)==null?void 0:o.type:i.type;typeof c=="string"&&!hd(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 Ih(e,t){const n=b1(e);if(n.length>0)return n;const i=[],r=new Map,o=new Map;function a(p,d,m){if(!v1.test(d)){i.push({kind:"id-invalid",opIndex:p,id:d});return}if(t.categoryOf(d)!==void 0||r.has(d)){i.push({kind:"id-duplicate",opIndex:p,id:d});return}r.set(d,{...m,opIndex:p})}e.forEach((p,d)=>{var m;switch(p.kind){case"participant.add":a(d,p.participant.id,{category:"participant",lanes:(p.participant.lanes??[]).map(h=>h.id)});for(const h of p.participant.lanes??[])a(d,h.id,{category:"lane"});break;case"node.add":a(d,p.node.id,{category:"flowNode",participant:p.node.participant});break;case"sequenceFlow.add":a(d,p.flow.id,{category:"sequenceFlow"});break;case"messageFlow.add":a(d,p.flow.id,{category:"messageFlow"});break;case"dataStore.add":a(d,p.dataStore.id,{category:"dataStore"});for(const h of p.associations??[])h.id&&a(d,h.id,{category:"dataAssociation"});break;case"dataAssociation.add":p.association.id&&a(d,p.association.id,{category:"dataAssociation"});break;case"association.add":p.association.id&&a(d,p.association.id,{category:"association"});break;case"annotation.add":a(d,p.annotation.id,{category:"annotation"}),(m=p.association)!=null&&m.id&&a(d,p.association.id,{category:"association"});break;case"group.add":a(d,p.group.id,{category:"group"});break;case"participant.update":if(p.lanes){o.set(p.id,p.lanes.map(h=>h.id));for(const h of p.lanes)t.categoryOf(h.id)===void 0&&a(d,h.id,{category:"lane"})}break}});const s=p=>{var d;return((d=r.get(p))==null?void 0:d.category)??t.categoryOf(p)},c=p=>{const d=r.get(p);return d?d.category==="participant"?p:d.participant:t.categoryOf(p)==="participant"?p:t.participantOf(p)};function u(p,d,m,h){const g=s(d);if(g===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:m});return}if(h&&!h.includes(g)){i.push({kind:"ref-category",opIndex:p,ref:d,role:m,expected:h.join("|"),actual:g});return}return g}const l=t.isCollaboration()||e.some(p=>p.kind==="participant.add");return e.forEach((p,d)=>{var m;switch(p.kind){case"participant.add":break;case"node.add":{const{participant:h,lane:g}=p.node;if(h===void 0){(l||g!==void 0)&&i.push({kind:"participant-required",opIndex:d,id:p.node.id});break}if(u(d,h,"participant",["participant"])===void 0)break;g!==void 0&&((((m=r.get(h))==null?void 0:m.lanes)??o.get(h)??t.lanesOf(h)).includes(g)||i.push({kind:"lane-unknown",opIndex:d,lane:g,participant:h}));break}case"sequenceFlow.add":{const{id:h,source:g,target:y,name:v,condition:b}=p.flow,x=u(d,g,"source",["flowNode"]),C=u(d,y,"target",["flowNode"]);x&&C&&c(g)!==c(y)&&i.push({kind:"flow-cross-pool",opIndex:d,id:h}),v!==void 0&&b!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:h});break}case"messageFlow.add":{const{id:h,source:g,target:y}=p.flow,v=u(d,g,"source",["flowNode","participant"]),b=u(d,y,"target",["flowNode","participant"]);if(v&&b){const x=c(g),C=c(y);x!==void 0&&x===C&&i.push({kind:"message-flow-same-pool",opIndex:d,id:h})}break}case"dataStore.add":{for(const h of p.associations??[]){if([h.source,h.target].filter(v=>v===p.dataStore.id).length!==1){i.push({kind:"data-association-ends",opIndex:d,source:h.source,target:h.target});continue}const y=h.source===p.dataStore.id?h.target:h.source;u(d,y,"dataAssociation",["flowNode"])}break}case"dataAssociation.add":{const{source:h,target:g}=p.association,y=u(d,h,"source"),v=u(d,g,"target");if(y&&v){const b=new Set([y,v]);b.has("dataStore")&&b.has("flowNode")||i.push({kind:"data-association-ends",opIndex:d,source:h,target:g})}break}case"association.add":{const{id:h,source:g,target:y}=p.association,v=u(d,g,"source"),b=u(d,y,"target");v&&b&&v!=="annotation"&&b!=="annotation"&&i.push({kind:"association-detached",opIndex:d,annotation:h??`${g}->${y}`});break}case"annotation.add":{if(p.association){const{source:h,target:g}=p.association;if(h!==p.annotation.id&&g!==p.annotation.id)i.push({kind:"association-detached",opIndex:d,annotation:p.annotation.id});else{const y=h===p.annotation.id?g:h;u(d,y,"association")}}p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.add":{for(const h of p.group.members??[]){const g=u(d,h,"member");g&&Dh.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:g})}break}case"participant.update":{if(f(d,p.id,"participant")===void 0)break;if(p.lanes){const h=t.lanesOf(p.id),g=p.lanes.map(v=>v.id);for(const v of h)g.includes(v)||i.push({kind:"lane-shrink-unsupported",opIndex:d,participant:p.id,lane:v});for(const v of g)t.categoryOf(v)!==void 0&&!h.includes(v)&&i.push({kind:"id-duplicate",opIndex:d,id:v});const y=g.filter(v=>h.includes(v));y.length===h.length&&y.some((v,b)=>v!==h[b])&&i.push({kind:"lane-reorder-unsupported",opIndex:d,participant:p.id})}break}case"node.update":{if(f(d,p.id,"flowNode")===void 0)break;if(p.lane!==void 0){const h=t.participantOf(p.id);(h?o.get(h)??t.lanesOf(h):[]).includes(p.lane)||i.push({kind:"lane-unknown",opIndex:d,lane:p.lane,participant:h??""})}break}case"sequenceFlow.update":{if(f(d,p.id,"sequenceFlow")===void 0)break;if(p.name!==void 0&&p.condition!==void 0&&i.push({kind:"condition-name-conflict",opIndex:d,id:p.id}),p.source!==void 0||p.target!==void 0){const h=p.source===void 0||u(d,p.source,"source",["flowNode"])!==void 0,g=p.target===void 0||u(d,p.target,"target",["flowNode"])!==void 0,y=t.endpointsOf(p.id),v=p.source??(y==null?void 0:y.source),b=p.target??(y==null?void 0:y.target);h&&g&&v!==void 0&&b!==void 0&&new Set([c(v),c(b),c(p.id)]).size>1&&i.push({kind:"flow-cross-pool",opIndex:d,id:p.id})}break}case"messageFlow.update":f(d,p.id,"messageFlow");break;case"dataStore.update":f(d,p.id,"dataStore");break;case"annotation.update":{if(f(d,p.id,"annotation")===void 0)break;p.placement&&u(d,p.placement.anchor,"anchor");break}case"group.update":{if(f(d,p.id,"group")===void 0)break;for(const h of p.members??[]){const g=u(d,h,"member");g&&Dh.has(g)&&i.push({kind:"ref-category",opIndex:d,ref:h,role:"member",expected:"shape",actual:g})}break}case"element.remove":{f(d,p.id)==="lane"&&i.push({kind:"ref-category",opIndex:d,ref:p.id,role:"target",expected:"removable",actual:"lane"});break}}}),i;function f(p,d,m){if(r.has(d)){i.push({kind:"target-added-in-batch",opIndex:p,id:d});return}const h=t.categoryOf(d);if(h===void 0){i.push({kind:"ref-missing",opIndex:p,ref:d,role:"target"});return}if(m&&h!==m){i.push({kind:"ref-category",opIndex:p,ref:d,role:"target",expected:m,actual:h});return}return h}}function Bh(e){return{modeling:e.get("modeling"),bpmnFactory:e.get("bpmnFactory"),elementFactory:e.get("elementFactory"),elementRegistry:e.get("elementRegistry"),canvas:e.get("canvas"),autoPlace:e.get("autoPlace"),bpmnReplace:e.get("bpmnReplace")}}function Ps(e){return`bpmn:${e[0].toUpperCase()}${e.slice(1)}`}const As={"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]},tn=10,Nh=40,x1=10;function gl(e,t,n,i,r){const o=n,a=(k,L)=>{const[H,ae]=As[k];let ye={x:t.x+t.width/2+H*(t.width/2+o.width/2+L),y:t.y+t.height/2+ae*(t.height/2+o.height/2+L)};const We=i.x+tn+o.width/2,Fe=i.x+i.width-tn-o.width/2,q=i.y+tn+o.height/2,ue=i.y+i.height-tn-o.height/2,oe={x:Math.min(Fe,Math.max(We,ye.x)),y:Math.min(ue,Math.max(q,ye.y))};return(oe.x!==ye.x||oe.y!==ye.y)&&(ye=Math.abs(oe.x-(t.x+t.width/2))<(t.width+o.width)/2+tn&&Math.abs(oe.y-(t.y+t.height/2))<(t.height+o.height)/2+tn?{x:t.x+t.width+tn+o.width/2,y:oe.y}:oe),ye},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=nt(e),u=k=>{var H,ae;if(!r.selfId)return!1;const L=e.get(k);return!!L&&(((H=L.source)==null?void 0:H.id)===r.selfId||((ae=L.target)==null?void 0:ae.id)===r.selfId)},l=c.edges.filter(k=>!u(k.id)).flatMap(xn),f=lo(c).filter(k=>k.owner!==r.selfId).map(k=>k.rect),p=k=>({x0:k.x-o.width/2-tn,x1:k.x+o.width/2+tn,y0:k.y-o.height/2-tn,y1:k.y+o.height/2+tn}),d=k=>{const L=p(k);return s.some(H=>L.x0<H.x+H.width&&L.x1>H.x&&L.y0<H.y+H.height&&L.y1>H.y)},m=k=>{const L=p(k);return l.some(H=>H.axis==="h"?H.at>L.y0&&H.at<L.y1&&H.lo<L.x1&&H.hi>L.x0:H.at>L.x0&&H.at<L.x1&&H.lo<L.y1&&H.hi>L.y0)},h=k=>{const L=p(k);return f.some(H=>L.x0<H.x+H.width&&L.x1>H.x&&L.y0<H.y+H.height&&L.y1>H.y)},g=c.shapes.filter(k=>k.type==="bpmn:Group").flatMap(k=>[{axis:"h",at:k.y,lo:k.x,hi:k.x+k.width},{axis:"h",at:k.y+k.height,lo:k.x,hi:k.x+k.width},{axis:"v",at:k.x,lo:k.y,hi:k.y+k.height},{axis:"v",at:k.x+k.width,lo:k.y,hi:k.y+k.height}]),y=k=>{const L=p(k);return g.some(H=>H.axis==="h"?H.at>L.y0&&H.at<L.y1&&H.lo<L.x1&&H.hi>L.x0:H.at>L.x0&&H.at<L.x1&&H.lo<L.y1&&H.hi>L.y0)},v=k=>d(k)||m(k)||h(k)||y(k),b=k=>k.x-o.width/2>=i.x&&k.x+o.width/2<=i.x+i.width&&k.y-o.height/2>=i.y&&k.y+o.height/2<=i.y+i.height;if(r.placement){const k=Fe=>Fe.startsWith("top")?Fe.replace(/^top/,"bottom"):Fe.replace(/^bottom/,"top"),L=Fe=>Fe.endsWith("left")?Fe.replace(/left$/,"right"):Fe.replace(/right$/,"left"),H=r.placement.side,ae=[H,k(H),L(H),k(L(H)),"top","bottom","left","right","top-left","top-right","bottom-left","bottom-right"],ye=r.placement.offset??50;let We=a(H,ye);if(v(We)){const Fe=new Set;for(const q of ae){if(Fe.has(q))continue;Fe.add(q);const ue=a(q,ye);if(b(ue)&&!v(ue)){We=ue;break}}}return We}const x=r.from,C=i.x+tn+o.width/2,P=i.x+i.width-tn-o.width/2,D=i.y+tn+o.height/2,T=i.y+i.height-tn-o.height/2;let I={x:Math.min(P,Math.max(C,x.x)),y:Math.min(T,Math.max(D,x.y))};if(v(I)){const k=(t.width+o.width)/2+tn,H=[{x:I.x+k,y:I.y},{x:I.x-k,y:I.y},{x:I.x,y:I.y-o.height-tn},{x:I.x,y:I.y+o.height+tn}].filter(b).find(ae=>!v(ae));H&&(I=H)}return I}function Kt(e,t){return e.filter(n=>n.kind===t)}function $h(e,t){var h0,m0,g0,y0,v0,b0,x0,_0,w0,E0,S0,R0,C0,P0,A0,T0,M0,k0,O0,D0,L0,I0,B0;const{modeling:n,bpmnFactory:i,elementFactory:r,elementRegistry:o,canvas:a,autoPlace:s,bpmnReplace:c}=t,u=()=>a.getRootElement(),l=_=>o.get(_),f=_=>{const R=l(_);if(!R)throw new Error(`하강 참조 해소 실패: ${_}`);return R},p=_=>{let R=_.parent;for(;R;){if(R.type==="bpmn:Participant")return R;R=R.parent}},d=new Map;for(const _ of o.filter(R=>!("waypoints"in R&&R.waypoints)&&R.type!=="bpmn:Lane"&&R.type!=="label"&&typeof R.x=="number"))d.set(_.id,{x:_.x,y:_.y});const m=Kt(e,"participant.add"),h=Kt(e,"node.add"),g=Kt(e,"sequenceFlow.add"),y=Kt(e,"messageFlow.add"),v=Kt(e,"dataStore.add"),b=Kt(e,"dataAssociation.add"),x=Kt(e,"annotation.add"),C=Kt(e,"group.add"),P=new Map(h.map(_=>[_.node.id,_])),D=(_,R,A)=>{var j;const O=_.businessObject,F=(((j=O.extensionElements)==null?void 0:j.values)??[]).filter(G=>G.$type!==R),N=A?[...F,i.create(R,A)]:F;if(!N.length){O.extensionElements&&n.updateProperties(_,{extensionElements:void 0});return}const B=i.create("bpmn:ExtensionElements",{values:N});N.forEach(G=>{G.$parent=B}),n.updateProperties(_,{extensionElements:B})},T=_=>({anchor:_.anchor,side:_.side,..._.offset!==void 0?{offset:_.offset}:{}});for(const _ of Kt(e,"element.remove")){const R=l(_.id);R&&n.removeElements([R])}const I=_=>o.filter(R=>{var A;return R.type==="bpmn:Lane"&&((A=p(R))==null?void 0:A.id)===_}).sort((R,A)=>R.y-A.y);for(const _ of Kt(e,"participant.update")){const R=f(_.id);if(_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),!_.lanes)continue;const A=I(_.id);if(!A.length){n.splitLane(R,_.lanes.length),I(_.id).forEach((F,N)=>{const B=_.lanes[N];B&&n.updateProperties(F,{id:B.id,name:B.name})});continue}const O=new Set(A.map(F=>F.id));_.lanes.forEach((F,N)=>{if(O.has(F.id)){n.updateProperties(f(F.id),{name:F.name});return}const B=N===0?n.addLane(I(_.id)[0],"top"):n.addLane(f(_.lanes[N-1].id),"bottom");n.updateProperties(B,{id:F.id,name:F.name})})}const k=150,L=130,H=80,ae=90,ye=180,We=30,Fe=30,q=(_,R,A,O,F)=>{const N=A-R.width/2,B=O-R.height/2;return(_.children??[]).find(j=>!("waypoints"in j&&j.waypoints)&&j.type!=="bpmn:Lane"&&j.type!=="label"&&!(F!=null&&F.has(j.id))&&typeof j.x=="number"&&N<j.x+j.width+Fe&&N+R.width+Fe>j.x&&B<j.y+j.height&&B+R.height>j.y)},ue=new Set;for(const _ of m){ue.add(`pool:${_.participant.id}`);for(const R of _.participant.lanes??[])ue.add(R.id)}const oe=new Map;for(const _ of h){const R=_.node.lane??`pool:${_.node.participant??""}`;let A=oe.get(R);A||oe.set(R,A=new Set([0])),_.band!==void 0&&A.add(_.band)}const le=new Map;for(const[_,R]of oe){if(!ue.has(_))continue;const A=[...R].sort((N,B)=>N-B),O=A.map((N,B)=>B===0?0:B%2===1?Math.ceil(B/2):-(B/2)),F=Math.min(...O);le.set(_,new Map(A.map((N,B)=>[N,O[B]-F])))}{const _=new Map;for(const R of m)(R.participant.lanes??[]).forEach((A,O)=>_.set(A.id,O));for(const[R,A]of le){if(!_.has(R)||A.size<2)continue;const O=_.get(R),F=A.get(0)??0,N=new Set;for(const re of h){if(re.node.lane!==R||(re.band??0)!==0||!re.node.type.endsWith("Gateway"))continue;const Oe={in:new Set,out:new Set,cross:new Set};for(const be of g){const Ce=be.flow.source===re.node.id;if(!Ce&&be.flow.target!==re.node.id)continue;const pt=P.get(Ce?be.flow.target:be.flow.source);if(!pt||pt.node.participant!==re.node.participant||!pt.node.lane)continue;let ce,ve=!1;if(pt.node.lane!==R){const de=_.get(pt.node.lane);if(de===void 0)continue;ce=de>O?"down":"up",ve=!0}else{const de=A.get(pt.band??0)??F;ce=de>F?"down":de<F?"up":void 0}ce&&(Oe[Ce?"out":"in"].add(ce),ve&&Oe.cross.add(ce))}for(const be of["up","down"])Oe.in.has(be)&&Oe.out.has(be)&&Oe.cross.has(be)&&N.add(be)}if(N.size!==1)continue;const[B]=N,j=Math.max(...A.values()),G=B==="down"?j:0;if(F===G)continue;const K=[...A.entries()].filter(([re])=>re!==0).sort((re,Oe)=>re[1]-Oe[1]),pe=[...Array(j+1).keys()].filter(re=>re!==G),Ee=new Map([[0,G]]);K.forEach(([re],Oe)=>Ee.set(re,pe[Oe])),le.set(R,Ee)}}const ke=_=>{var R;return(((R=oe.get(_))==null?void 0:R.size)??0)>1},W=_=>_.band??(_.node.lane||!ke(`pool:${_.node.participant??""}`)?void 0:0),Y=new Map,J=_=>Y.get(_.node.id)??W(_),Te=new Set,dt=new Set;{const _=new Map;for(const O of g)_.set(O.flow.target,(_.get(O.flow.target)??0)+1);const R=O=>{const F=[],N=new Set([O]),B=[O];for(;B.length;){const j=B.shift();F.push(j);for(const G of g)G.flow.source!==j||N.has(G.flow.target)||(_.get(G.flow.target)??0)!==1||(N.add(G.flow.target),B.push(G.flow.target))}return F},A=(O,F)=>{var N;return((N=le.get(O))==null?void 0:N.get(F))??F};for(const O of h){if(!O.node.type.endsWith("Gateway"))continue;const F=O.node.lane??`pool:${O.node.participant??""}`,N=le.get(F);if(!N||N.size<2)continue;const B=J(O);if(B===void 0||A(F,B)!==A(F,0))continue;const j=A(F,B),G=g.filter(be=>be.flow.source===O.node.id).map(be=>P.get(be.flow.target)).filter(be=>!!be&&(be.node.lane??`pool:${be.node.participant??""}`)===F),K=G.filter(be=>{const Ce=J(be);return Ce!==void 0&&A(F,Ce)===j&&(_.get(be.node.id)??0)===1}),pe=G.some(be=>{const Ce=J(be);return Ce!==void 0&&A(F,Ce)>j});if(K.length!==1||!pe)continue;const Ee=new Set(G.flatMap(be=>R(be.node.id)));if(!g.some(be=>be.flow.target===O.node.id&&Ee.has(be.flow.source)))continue;const Oe=new Map;for(const[be,Ce]of N)Oe.set(be,Ce+1);Oe.set(-1,0),le.set(F,Oe);for(const be of R(K[0].node.id))P.has(be)&&(Y.set(be,-1),dt.add(be));Te.add(O.node.id)}}const M=(_,R)=>{var A;return((A=le.get(_))==null?void 0:A.get(R))??R},S=(_,R,A,O)=>{const F=_?l(_):R?l(R):void 0;if(!F)return!1;const N=_?F.y+Math.min(F.height/2,ae):F.y+H;return Math.abs(N+M(_??`pool:${R??""}`,A)*k-O)<=k/2},w=new Map;for(const[_,R]of oe){let A=0;for(const O of R)A=Math.max(A,M(_,O));w.set(_,A)}const z=_=>ye+k*_,U=(_,R,A)=>{const O=u().children.filter(F=>!("waypoints"in F&&F.waypoints)&&F.id!==R&&typeof F.y=="number"&&F.y>=_);O.length&&n.moveElements(O,{x:0,y:A})},Q=(_,R,A)=>{const O=_.type==="bpmn:Participant"?_:void 0;if(!O||O.children.some(j=>j.type==="bpmn:Lane"))return;const F=A+R.height/2+We-O.y;if(O.height>=F)return;const N=F-O.height,B=O.y+O.height;n.resizeShape(O,{x:O.x,y:O.y,width:O.width,height:F}),U(B,O.id,N)},we=(_,R,A)=>{if(_){const B=f(_),j=z(R);if(B.height>=j)return;const G=j-B.height,K=p(B),pe=K?K.y+K.height:B.y+B.height;n.resizeLane(B,{x:B.x,y:B.y,width:B.width,height:j},!1),U(pe,K==null?void 0:K.id,G);return}if(!A)return;const O=k*(R+1);if(A.height>=O)return;const F=O-A.height,N=A.y+A.height;n.resizeShape(A,{x:A.x,y:A.y,width:A.width,height:O}),U(N,A.id,F)},ze=new Map;for(const _ of g)ze.set(_.flow.target,(ze.get(_.flow.target)??0)+1);const et=_=>(ze.get(_)??0)<=1,Tt=(_,R,A)=>{if(!_)return!0;const O=l(_);return O?A-R.height/2>=O.y&&A+R.height/2<=O.y+O.height:!0},it=m.map((_,R)=>({op:_,declared:R}));it.sort((_,R)=>{const A=_.op.order??Number.POSITIVE_INFINITY,O=R.op.order??Number.POSITIVE_INFINITY;return A!==O?A-O:_.declared-R.declared});let Ct=80;for(const _ of o.getAll())_.parent===u()&&"height"in _&&typeof _.y=="number"&&(Ct=Math.max(Ct,_.y+_.height+60));for(const{op:_}of it){const R=_.participant,A=h.filter(re=>re.node.participant===R.id).length,O=((h0=R.lanes)==null?void 0:h0.length)??0,F=Math.max(1200,A*160+300),N=(R.lanes??[]).map(re=>z(w.get(re.id)??0)),B=N.reduce((re,Oe)=>re+Oe,0);O&&B<300&&(N[O-1]+=300-B);const j=Math.max(300,k*((w.get(`pool:${R.id}`)??0)+1)),G=R.blackBox||A+O===0?120:O?Math.max(300,B):j,K=r.createShape({type:"bpmn:Participant",businessObject:i.create("bpmn:Participant",{id:R.id,name:R.name,..._.order!==void 0?{"bwl:poolOrder":_.order}:{},...R.blackBox?{}:{processRef:i.create("bpmn:Process")}}),width:F,height:G,isExpanded:!0}),pe=n.createShape(K,{x:100+F/2,y:Ct+G/2},u()),Ee=R.lanes??[];if(Ee.length&&n.splitLane(pe,Ee.length),Ee.length){const re=o.filter(Oe=>{var be;return Oe.type==="bpmn:Lane"&&((be=p(Oe))==null?void 0:be.id)===R.id}).sort((Oe,be)=>Oe.y-be.y);if(re.forEach((Oe,be)=>{const Ce=Ee[be];Ce&&n.updateProperties(Oe,{id:Ce.id,name:Ce.name})}),N.some(Oe=>Oe!==pe.height/O)){let Oe=pe.y;re.forEach((be,Ce)=>{const pt=N[Ce];n.resizeShape(be,{x:be.x,y:Oe,width:be.width,height:pt}),Oe+=pt})}}Ct=pe.y+pe.height+60}const gn=_=>{var O;const R=P.get(_);if(R)return R.node.participant??"";const A=l(_);return A?A.type==="bpmn:Participant"?A.id:((O=p(A))==null?void 0:O.id)??"":""},Zt=new Map,ht=_=>{let R=Zt.get(_);return R||Zt.set(_,R={nodes:[],flows:[]}),R};for(const _ of h)ht(_.node.participant??"").nodes.push(_);for(const _ of g)ht(gn(_.flow.source)).flows.push(_);const kt=_=>{var R;return i.create("bpmn:SequenceFlow",{id:_.id,name:_.name??((R=_.condition)==null?void 0:R.label)})},sn=(_,R)=>r.createShape({type:Ps(_.type),businessObject:i.create(Ps(_.type),{id:_.id,name:_.name,...R!==void 0?{"bwl:band":R}:{}})}),Uo=[...it.map(({op:_})=>_.participant.id).filter(_=>Zt.has(_)),...[...Zt.keys()].filter(_=>!m.some(R=>R.participant.id===_))],Fn=_=>_.endsWith("Gateway");for(const _ of Uo){const R=Zt.get(_),A=_?f(_):void 0,O=A?A.x+150:250;let F=A?A.y+80:120;const N=(ce,ve,de)=>{if(ce){const he=f(ce);return he.y+Math.min(he.height/2,ae)+M(ce,ve??0)*k}return ve!==void 0&&A?A.y+H+M(`pool:${_}`,ve)*k:de},B=(ce,ve,de)=>{if(ce){const he=f(ce);return he.y+Math.min(he.height/2,ae)+ve*k}return A?A.y+H+ve*k:de},j=ce=>ce.participant?f(ce.participant):u(),G=(ce,ve,de,he,Ye,Je,Ot)=>{const Qt=de!==void 0||he!==void 0,Se=M(de??`pool:${_}`,he??0);if((he===void 0||S(de,_,he,Ot??Number.NaN))&&Ot!==void 0&&Tt(de,ve,Ot)&&!q(ce,ve,Ye,Ot))return{x:Ye,y:Ot};if(Qt)for(let X=0;X<4;X++){const Z=B(de,Se+X,Je);if(!q(ce,ve,Ye,Z))return we(de,Se+X,A),{x:Ye,y:Z}}const Me=N(de,he,Je);Qt?we(de,Se,A):Q(ce,ve,Me);let ne=Ye;for(let X=0;X<64;X++){const Z=q(ce,ve,ne,Me);if(!Z)break;ne=Z.x+Z.width+L+ve.width/2}return{x:ne,y:Me}},K=new Set(R.flows.map(ce=>ce.flow.target)),pe=new Map;for(const ce of R.nodes){if(K.has(ce.node.id))continue;const ve=sn(ce.node,ce.band),de=W(ce),he=ce.node.lane?`${ce.node.lane}|${de??""}`:de!==void 0?`band:${de}`:"",Ye=j(ce.node),Je=G(Ye,ve,ce.node.lane,de,pe.get(he)??O,F);n.createShape(ve,Je,Ye),pe.set(he,Je.x+ve.width+L),!ce.node.lane&&de===void 0&&(F+=160)}const Ee=new Set,re=new Map,Oe=new Map,be=new Map;if(_&&ue.has(`pool:${_}`)){const ce=new Map;for(const Se of R.flows)ce.set(Se.flow.target,(ce.get(Se.flow.target)??0)+1);const ve=Se=>N(Se.node.lane,J(Se),Number.NaN),de=new Set,he=Se=>{var X;const Me=(X=P.get(Se))==null?void 0:X.node.participant;if(Me)return l(Me);const ne=l(Se);if(ne)return ne.type==="bpmn:Participant"?ne:p(ne)},Ye=Se=>{const Me=[],ne=new Set([Se]),X=[Se];for(;X.length;){const Z=X.shift(),fe=P.get(Z);fe&&Me.push(fe);for(const me of R.flows)me.flow.source!==Z||ne.has(me.flow.target)||(ce.get(me.flow.target)??0)!==1||(ne.add(me.flow.target),X.push(me.flow.target))}return Me},Je=Se=>{if(!A)return;const Me=new Set(Se.map(Z=>Z.node.id));let ne=!1,X=!1;for(const Z of y){if(!Me.has(Z.flow.source))continue;const fe=he(Z.flow.target);!fe||fe.id===A.id||(fe.y<A.y?ne=!0:X=!0)}return ne&&!X?"up":X&&!ne?"down":void 0};for(const Se of R.nodes){if(!Fn(Se.node.type))continue;const Me=N(Se.node.lane,W(Se),Number.NaN);if(Number.isNaN(Me))continue;const ne=[];for(const me of R.flows){if(me.flow.source!==Se.node.id)continue;const Re=P.get(me.flow.target);if(!Re||Re.node.lane!==Se.node.lane||(ce.get(Re.node.id)??0)!==1)continue;const De=W(Re);if(De===void 0)continue;const rt=N(Re.node.lane,De,Number.NaN);if(Number.isNaN(rt))continue;const vt=Ye(Re.node.id),st=Je(vt);st&&ne.push({subtree:vt,band:De,row:rt,dir:st})}if(!ne.some(me=>me.dir==="up")||!ne.some(me=>me.dir==="down")||!ne.some(me=>me.dir==="up"&&ne.some(Re=>Re.dir==="down"&&Re.row<me.row)))continue;const Z=[...ne].sort((me,Re)=>me.row-Re.row);[...ne.filter(me=>me.dir==="up"),...ne.filter(me=>me.dir==="down")].sort((me,Re)=>me.dir===Re.dir?me.row-Re.row:me.dir==="up"?-1:1).forEach((me,Re)=>{const De=Z[Re].band;if(De!==me.band){de.add(Se.node.id);for(const rt of me.subtree)W(rt)===me.band&&Y.set(rt.node.id,De)}})}const Ot=Se=>{if(!A)return;const Me=new Set(Se.map(Z=>Z.node.id));let ne=!1,X=!1;for(const Z of y){if(!Me.has(Z.flow.target))continue;const fe=he(Z.flow.source);!fe||fe.id===A.id||(fe.y<A.y?ne=!0:X=!0)}return ne&&!X?"up":X&&!ne?"down":void 0};for(const Se of R.nodes){if(!Fn(Se.node.type))continue;const Me=Se.node.lane??`pool:${_}`,ne=le.get(Me);if(!ne||ne.size<2)continue;const X=ne.get(0);if(X===void 0)continue;const Z=Math.max(...ne.values()),fe=X===Z&&X!==0?"down":void 0;if(!fe)continue;const me=[];for(const st of R.flows){if(st.flow.source!==Se.node.id)continue;const mt=P.get(st.flow.target);if(!mt||mt.node.lane!==Se.node.lane||(ce.get(mt.node.id)??0)!==1)continue;const Qr=J(mt);Qr!==void 0&&me.push({t:mt,subtree:Ye(mt.node.id),band:Qr})}const Re=me.find(st=>(ne.get(st.band)??st.band)===X);if(!Re||Ot(Re.subtree)===fe||Je(Re.subtree)===fe)continue;const De=me.find(st=>st!==Re&&Ot(st.subtree)===fe);if(!De)continue;const rt=Re.band,vt=De.band;for(const st of Re.subtree)J(st)===rt&&Y.set(st.node.id,vt);for(const st of De.subtree)J(st)===vt&&Y.set(st.node.id,rt);de.add(Se.node.id)}for(const Se of R.nodes){if(!Fn(Se.node.type))continue;const Me=ve(Se);if(Number.isNaN(Me)||x.some(me=>{var Re,De;return(((Re=me.placement)==null?void 0:Re.anchor)??(me.association?me.association.source===me.annotation.id?me.association.target:me.association.source:void 0))===Se.node.id&&((De=me.placement)==null?void 0:De.side.startsWith("bottom"))}))continue;let X,Z=!1,fe;for(const me of R.flows){if(me.flow.source!==Se.node.id)continue;const Re=P.get(me.flow.target);if(!Re||!Re.node.lane&&W(Re)===void 0)continue;const De=ve(Re);Number.isNaN(De)||(Math.abs(De-Me)<.5&&(Z=!0),De>Me?!X||De>X.row?X={id:Re.node.id,row:De,count:1}:De===X.row&&X.count++:De<Me&&Re.node.lane===Se.node.lane&&(!fe||De>fe.row?fe={op:Re,row:De,count:1}:De===fe.row&&fe.count++))}X&&X.count===1&&(ce.get(X.id)??0)===1&&!de.has(Se.node.id)&&Ee.add(X.id),!Z&&fe&&fe.count===1&&(ce.get(fe.op.node.id)??0)===1&&!Te.has(Se.node.id)&&re.set(fe.op.node.id,{lane:Se.node.lane,band:J(Se)})}const Qt=new Map;for(const Se of y)Qt.set(Se.flow.target,[...Qt.get(Se.flow.target)??[],Se]);for(const Se of R.nodes){const Me=Qt.get(Se.node.id);if(!Me||Me.length!==1||!ce.get(Se.node.id)||!Se.node.lane&&W(Se)===void 0||dt.has(Se.node.id))continue;const ne=(m0=P.get(Me[0].flow.source))==null?void 0:m0.node.participant,X=ne?l(ne):void 0;if(!X||!A||X.id===A.id)continue;const Z=Se.node.lane??`pool:${_}`,fe=le.get(Z);if(!fe)continue;const me=fe.get(0)??0,Re=(fe.get(J(Se)??0)??me)-me;if(Re===0)continue;const De=X.y<A.y;if(De&&Re<0||!De&&Re>0)continue;let rt;for(const[vt,st]of fe){const mt=st-me;(De&&mt<0&&(!rt||mt<rt.row)||!De&&mt>0&&(!rt||mt>rt.row))&&(rt={band:vt,row:mt})}rt&&Oe.set(Se.node.id,{lane:Se.node.lane,band:rt.band})}}const Ce=new Set;let pt=0;for(;pt++<R.nodes.length+2;){for(let de=0;de<R.nodes.length+R.flows.length+2;de++){let he=!1;for(const Ye of R.flows){const Je=Ye.flow;if(Ce.has(Je.id))continue;const Ot=l(Je.source);if(!Ot)continue;const Qt=l(Je.target),Se=P.get(Je.target);if(!Qt&&Se){const Me=sn(Se.node,Se.band),ne=J(Se);if(Se.node.lane||ne!==void 0){const X=j(Se.node),Z=Ot,fe=Z.x+(be.get(Je.source)??0)+Z.width+L,me=re.get(Je.target)??Oe.get(Je.target),Re=G(X,Me,me?me.lane:Se.node.lane,me?me.band:ne,Ee.has(Je.target)?Z.x+Z.width/2:fe,Number.NaN,me||!et(Je.target)?void 0:Z.y+Z.height/2),De=n.createShape(Me,Re,X);Ee.has(Je.target)&&be.set(Je.target,fe-(De.x+De.width/2)),n.connect(Ot,De,{type:"bpmn:SequenceFlow",businessObject:kt(Je)})}else s.append(Ot,Me,{connection:{type:"bpmn:SequenceFlow",businessObject:kt(Je)}})}else if(Qt)n.connect(Ot,Qt,{type:"bpmn:SequenceFlow",businessObject:kt(Je)});else continue;Ce.add(Je.id),he=!0}if(!he)break}const ce=R.nodes.filter(de=>!l(de.node.id));if(!ce.length)break;const ve=ce[0];{const de=sn(ve.node,ve.band),he=j(ve.node),Ye=W(ve);n.createShape(de,G(he,de,ve.node.lane,Ye,O,F),he),!ve.node.lane&&Ye===void 0&&(F+=160)}}}const ai=40,cn=(_,R=()=>!0)=>{const A=l(_);if(!A)return[];const O=[A],F=new Set([_]);for(let N=0;N<O.length;N++){const B=O[N].id;for(const j of g){const G=j.flow.target;if(j.flow.source!==B||F.has(G)||!P.has(G))continue;F.add(G);const K=l(G);K&&R(K)&&O.push(K)}}return O},Ut=(_,R=()=>!0)=>{const A=l(_);if(!A)return[];const O=[A],F=new Set([_]);for(let N=0;N<O.length;N++){const B=O[N].id;for(const j of g){const G=j.flow.source;if(j.flow.target!==B||F.has(G)||!P.has(G))continue;F.add(G);const K=l(G);K&&R(K)&&O.push(K)}}return O},En=30,Ai=_=>!("waypoints"in _&&_.waypoints)&&_.type!=="bpmn:Lane"&&_.type!=="label"&&typeof _.x=="number",yn=(_,R)=>{const A=new Set(_.flatMap(B=>B.subtree.map(j=>j.id)));for(const B of _){const j=(B.pool.children??[]).filter(Ai).filter(K=>!A.has(K.id));if(B.subtree.some(K=>j.some(pe=>K.x+R<pe.x+pe.width+En&&K.x+R+K.width+En>pe.x&&K.y<pe.y+pe.height&&K.y+K.height>pe.y)))return null}const O=_.map(B=>B.pool.width),F=o.filter(B=>B.type==="label").map(B=>({label:B,x:B.x,y:B.y}));n.moveElements(_.flatMap(B=>B.subtree),{x:R,y:0});const N=_.map(B=>{const G=Math.max(...B.subtree.map(K=>K.x+K.width))+150-(B.pool.x+B.pool.width);return G>0&&n.resizeShape(B.pool,{x:B.pool.x,y:B.pool.y,width:B.pool.width+G,height:B.pool.height}),G});return()=>{n.moveElements(_.flatMap(B=>B.subtree),{x:-R,y:0}),_.forEach((B,j)=>{N[j]>0&&n.resizeShape(B.pool,{x:B.pool.x,y:B.pool.y,width:O[j],height:B.pool.height})});for(let B=0;B<3;B++){let j=0;for(const G of F){const K=G.x-G.label.x,pe=G.y-G.label.y;Math.abs(K)<=.5&&Math.abs(pe)<=.5||(n.moveElements([G.label],{x:K,y:pe}),j++)}if(!j)break}}},tt=_=>{var F,N;const R=new Map,A=new Map;for(const B of o.getAll()){if(B.type!=="bpmn:Participant")continue;const j=B;(j.children??[]).length||(R.set(j.id,j),A.set(j.id,[]))}for(const B of o.getAll()){if(B.type!=="bpmn:MessageFlow")continue;const j=B,G=(F=j.source)==null?void 0:F.id,K=(N=j.target)==null?void 0:N.id;G&&K&&A.has(G)&&A.get(G).push(K),G&&K&&A.has(K)&&A.get(K).push(G)}const O=[];for(const[B,j]of A)j.length&&j.every(G=>_.has(G))&&O.push(R.get(B));return O},ot=(_,R)=>{if(!_.length)return null;const A=new Set(_.map(B=>B.id)),O=o.getAll().filter(B=>B.type==="bpmn:Participant"&&!A.has(B.id));if(_.some(B=>O.some(j=>B.x+R<j.x+j.width+En&&B.x+R+B.width+En>j.x&&B.y<j.y+j.height&&B.y+B.height>j.y)))return null;const N=o.filter(B=>B.type==="label").map(B=>({label:B,x:B.x,y:B.y}));return n.moveElements(_,{x:R,y:0}),()=>{n.moveElements(_,{x:-R,y:0});for(let B=0;B<3;B++){let j=0;for(const G of N){const K=G.x-G.label.x,pe=G.y-G.label.y;Math.abs(K)<=.5&&Math.abs(pe)<=.5||(n.moveElements([G.label],{x:K,y:pe}),j++)}if(!j)break}}},q_=()=>{let _=0;for(const R of o.getAll()){if(R.type!=="bpmn:DataInputAssociation"&&R.type!=="bpmn:DataOutputAssociation")continue;const A=R.waypoints??[];for(let O=1;O<A.length;O++)_+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return _},K_=()=>{let _=0;for(const R of o.getAll()){if(R.type!=="bpmn:Association")continue;const A=R.waypoints??[];for(let O=1;O<A.length;O++)_+=Math.hypot(A[O].x-A[O-1].x,A[O].y-A[O-1].y)}return _},pL=_=>{const R=[];for(const A of o.getAll()){if(A.type!=="bpmn:TextAnnotation")continue;const O=A;if(_.has(O.id))continue;const N=[...O.incoming??[],...O.outgoing??[]].filter(B=>B.type==="bpmn:Association").map(B=>B.source===O?B.target:B.source);N.length&&(N.some(B=>B===void 0||"waypoints"in B&&B.waypoints)||N.every(B=>_.has(B.id))&&R.push(O))}return R},X_=()=>fn(nt(o)).filter(_=>_.kind==="edge-crosses-shape").length,Z_=_=>{const R=(_.children??[]).filter(Ai);let A=0;for(let O=0;O<R.length;O++)for(let F=O+1;F<R.length;F++){const N=R[O],B=R[F];N.x<B.x+B.width&&N.x+N.width>B.x&&N.y<B.y+B.height&&N.y+N.height>B.y&&A++}return A},Yo=()=>{const _=nt(o),R=A=>A.length>=2&&(A.every(O=>Math.abs(O.x-A[0].x)<.01)||A.every(O=>Math.abs(O.y-A[0].y)<.01));return{messages:_.edges.filter(A=>A.type==="bpmn:MessageFlow"&&A.waypoints.length===2).length,lines:_.edges.filter(A=>R(A.waypoints)).length}},fL=_=>{const R=F=>{const N=[F],B=new Set([F.id]);for(let j=0;j<N.length;j++)for(const G of N[j].outgoing??[]){if(G.type!=="bpmn:SequenceFlow")continue;const K=G.target;!K||B.has(K.id)||_.has(K.id)||!Ai(K)||K.x<F.x||(B.add(K.id),N.push(K))}return N},A=new Set(_),O=[];for(const F of o.getAll()){if(F.type!=="bpmn:MessageFlow")continue;const N=F;if(!N.waypoints||N.waypoints.length!==2)continue;const B=N.source,j=N.target;if(!B||!j)continue;const G=_.has(B.id);if(G===_.has(j.id))continue;const K=G?j:B,pe=p(K);if(!pe||A.has(K.id))continue;const Ee=R(K).filter(re=>!A.has(re.id));if(Ee.length){for(const re of Ee)A.add(re.id);O.push({subtree:Ee,pool:pe})}}return O};for(const _ of Kt(e,"sequenceFlow.update")){if(_.target===void 0)continue;const R=P.get(_.target);if(!R)continue;const A=l(_.target),O=l(_.id);if(!A||!O)continue;const F=_.source!==void 0?l(_.source):O.source,N=O.target;if(!F||!N||N.id===A.id)continue;const B=cn(_.target),j=new Set(B.map(he=>he.id)),G=Math.min(...B.map(he=>he.x)),K=Math.max(...B.map(he=>he.x+he.width)),pe=F.x+F.width,Ee=K-G+ai*2-(N.x-pe);let re=[];if(Ee>0){const he=p(A),Ye=(he==null?void 0:he.children)??[],Je=Me=>Me.type==="bpmn:Lane";re=(()=>{const Me=new Set;for(const X of Ye)Ai(X)&&!j.has(X.id)&&X.id!==F.id&&X.x>=N.x&&Me.add(X.id);const ne=[];for(const X of Ye){if(X.type!=="bpmn:DataStoreReference"&&X.type!=="bpmn:DataObjectReference")continue;const Z=X,me=[...Z.incoming??[],...Z.outgoing??[]].filter(Re=>Re.type==="bpmn:DataInputAssociation"||Re.type==="bpmn:DataOutputAssociation").map(Re=>Re.source===Z?Re.target:Re.source);me.length&&me.every(Re=>Re!==void 0&&Me.has(Re.id))&&ne.push(Z)}return ne})();const Qt=Ye.filter(Me=>!("waypoints"in Me&&Me.waypoints)&&!Je(Me)&&!j.has(Me.id)&&Me.id!==F.id&&Me.x>=N.x),Se=he?[he,...Ye.filter(Me=>Je(Me))]:[];if(Qt.length){const Me=new Set(Qt.map(De=>De.id)),ne=fL(Me),X=pL(Me),Z=tt(Me),fe=new Set(Me);for(const De of ne)for(const rt of De.subtree)fe.add(rt.id);const me=ne.length?tt(fe):Z;n.createSpace(Qt,Se,{x:Ee,y:0},"e",N.x-1);let Re=!1;if(ne.length){const De=Yo(),rt=yn(ne,Ee);if(rt){const vt=me.length?ot(me,Ee):null,st=Yo();st.messages>De.messages&&st.lines>=De.lines?Re=!0:(vt==null||vt(),rt())}}if(!Re){for(const De of ne){const rt=Yo(),vt=yn([De],Ee);if(!vt)continue;const st=Yo();(st.messages<=rt.messages||st.lines<rt.lines)&&vt()}if(Z.length){const De=Yo(),rt=ot(Z,Ee);if(rt){const vt=Yo();(vt.messages<=De.messages||vt.lines<De.lines)&&rt()}}}if(X.length){const De=()=>new Set(fn(nt(o)).map(vt=>bn(vt))),rt=vt=>{const st=K_(),mt=De(),Qr=vt.map(Dt=>({a:Dt,x:Dt.x,y:Dt.y})),CL=o.filter(Dt=>Dt.type==="label").map(Dt=>({label:Dt,x:Dt.x,y:Dt.y}));n.moveElements(vt,{x:Ee,y:0});const PL=[...De()].filter(Dt=>!mt.has(Dt));if(K_()<st&&PL.length===0)return!0;for(const{a:Dt,x:os,y:as}of Qr)(Dt.x!==os||Dt.y!==as)&&n.moveElements([Dt],{x:os-Dt.x,y:as-Dt.y});for(const Dt of CL){const os=Dt.x-Dt.label.x,as=Dt.y-Dt.label.y;(os!==0||as!==0)&&n.moveElements([Dt.label],{x:os,y:as})}return!1};if(!rt(X)&&X.length>1)for(const vt of X)rt([vt])}}}const Oe=F.y+F.height/2,be=Oe-(A.y+A.height/2),Ce=R.band!==void 0,pt=Ce?[A]:B,ce=(R.band===void 0||S(R.node.lane,R.node.participant,R.band,Oe))&&et(_.target)&&pt.every(he=>{var Ye;return Tt((Ye=P.get(he.id))==null?void 0:Ye.node.lane,he,he.y+he.height/2+be)});ce&&Ce?(n.moveElements(B,{x:pe+ai-G,y:0}),n.moveElements([A],{x:0,y:be})):n.moveElements(B,{x:pe+ai-G,y:ce?be:0});const ve=p(A);if(!ce&&R.node.lane===void 0&&R.band!==void 0&&ve){const he=ve.y+H+M(`pool:${R.node.participant??""}`,R.band)*k,Ye=he-(A.y+A.height/2);Ye!==0&&!q(ve,A,A.x+A.width/2,he,j)&&n.moveElements([A],{x:0,y:Ye})}const de=re.length?p(re[0]):void 0;if(de){const he={assoc:q_(),overlaps:Z_(de),crosses:X_()},Ye=re.map(Z=>({st:Z,x:Z.x})),Je=o.filter(Z=>Z.type==="label").map(Z=>({label:Z,x:Z.x,y:Z.y})),Ot=Math.min(...re.flatMap(Z=>[...Z.incoming??[],...Z.outgoing??[]].filter(fe=>fe.type==="bpmn:DataInputAssociation"||fe.type==="bpmn:DataOutputAssociation").map(fe=>(fe.source===Z?fe.target:fe.source).x))),Qt=new Set(re.map(Z=>Z.id)),Se=(de.children??[]).filter(Ai).filter(Z=>!Qt.has(Z.id));let Me=Ot;for(const Z of[...re].sort((fe,me)=>fe.x-me.x)){let fe=Me;for(let me=0;me<100;me++){const Re=Se.find(De=>fe<De.x+De.width+En&&fe+Z.width+En>De.x&&Z.y<De.y+De.height&&Z.y+Z.height>De.y);if(!Re)break;fe=Re.x+Re.width+En}fe!==Z.x&&n.moveElements([Z],{x:fe-Z.x,y:0}),Me=fe+Z.width+En}const ne=Me+150-(de.x+de.width);ne>0&&n.resizeShape(de,{x:de.x,y:de.y,width:de.width+ne,height:de.height});const X={assoc:q_(),overlaps:Z_(de),crosses:X_()};if(X.assoc>=he.assoc||X.overlaps>he.overlaps||X.crosses>he.crosses){for(const{st:Z,x:fe}of Ye)Z.x!==fe&&n.moveElements([Z],{x:fe-Z.x,y:0});ne>0&&n.resizeShape(de,{x:de.x,y:de.y,width:de.width-ne,height:de.height});for(const Z of Je){const fe=Z.x-Z.label.x,me=Z.y-Z.label.y;(fe!==0||me!==0)&&n.moveElements([Z.label],{x:fe,y:me})}}}}const Q_=(_,R)=>{const A=R.target===_,O=f(R.source),F=f(R.target),N=A?"bpmn:DataOutputAssociation":"bpmn:DataInputAssociation";n.connect(O,F,R.id?{type:N,businessObject:i.create(N,{id:R.id})}:{type:N})},dL=100,J_=_=>{for(const R of m){if(!R.participant.blackBox)continue;const A=l(R.participant.id);if(!A)continue;const O=[];for(const N of y){const B=N.flow.source===R.participant.id?N.flow.target:N.flow.target===R.participant.id?N.flow.source:void 0,j=B?l(B):void 0;j&&typeof j.x=="number"&&j.type!=="bpmn:Participant"&&O.push(j)}if(!O.length)continue;const F=Math.max(...O.map(N=>N.x+N.width/2))+dL;if(F>A.x+A.width&&n.resizeShape(A,{x:A.x,y:A.y,width:F-A.x,height:A.height}),!!_)for(const N of y){const B=l(N.flow.id),j=N.flow.source===R.participant.id?N.flow.target:N.flow.target===R.participant.id?N.flow.source:void 0,G=j?l(j):void 0;if(!B||!G||G.type==="bpmn:Participant")continue;const K=G.x+G.width/2;if(K<A.x+10||K>A.x+A.width-10)continue;const pe=A.y>G.y,Ee=pe?G.y+G.height:G.y,re=pe?A.y:A.y+A.height,Oe=N.flow.source===R.participant.id?[{x:K,y:re},{x:K,y:Ee}]:[{x:K,y:Ee},{x:K,y:re}],be=nt(o),Ce={...be.edges.find(pt=>pt.id===N.flow.id),waypoints:Oe};en(Ce,Gn(be)).length||n.updateWaypoints(B,Oe)}}};J_(!1);for(const _ of y){const R=_.flow;n.connect(f(R.source),f(R.target),{type:"bpmn:MessageFlow",businessObject:i.create("bpmn:MessageFlow",{id:R.id,name:R.name})})}{const A=new Set([...g.map(G=>G.flow.id),...y.map(G=>G.flow.id)].filter(G=>!!G)),O=o.filter(G=>!!G.waypoints),F=(G,K)=>Math.abs(K.x-G.x)<2?"L":Math.abs(K.x-(G.x+G.width))<2?"R":Math.abs(K.y-G.y)<2?"T":Math.abs(K.y-(G.y+G.height))<2?"B":void 0,N=new Map,B=(G,K,pe)=>{if(!G||!K||typeof G.x!="number")return;const Ee=F(G,K);if(!Ee)return;let re=N.get(G.id);re||N.set(G.id,re=new Map),re.set(Ee,[...re.get(Ee)??[],pe])};for(const G of O){const K=G.waypoints;!K||K.length<2||(B(G.source,K[0],{id:G.id,dir:"out"}),B(G.target,K[K.length-1],{id:G.id,dir:"in"}))}const j=new Set;for(const[G,K]of N){const pe=l(G);if(!pe||typeof pe.x!="number"||![...K.values()].some(ve=>{const de=ve.filter(he=>he.dir==="in");return ve.length>=3&&de.length>=1&&ve.some(he=>he.dir==="out")&&de.some(he=>A.has(he.id))}))continue;const re=p(pe);if(!re||j.has(re.id)||(re.children??[]).some(ve=>ve.type==="bpmn:Lane"))continue;const Oe=(g0=K.get("T"))!=null&&g0.length?(y0=K.get("B"))!=null&&y0.length?void 0:"B":"T";if(!Oe||(Oe==="T"?pe.y-re.y:re.y+re.height-(pe.y+pe.height))>=k)continue;const Ce=(re.children??[]).filter(ve=>!("waypoints"in ve&&ve.waypoints)&&ve.type!=="label"&&typeof ve.x=="number"),pt=re.y+re.height;n.resizeShape(re,{x:re.x,y:re.y,width:re.width,height:re.height+k});const ce=u().children.filter(ve=>!("waypoints"in ve&&ve.waypoints)&&ve.id!==re.id&&typeof ve.y=="number"&&ve.y>=pt);ce.length&&n.moveElements(ce,{x:0,y:k}),Oe==="T"&&Ce.length&&n.moveElements(Ce,{x:0,y:k}),j.add(re.id)}}const cd=20,e0=4,hL=2,mL=[10,30,80],qo=()=>{const _=nt(o);return{bad:fn(_).filter(R=>R.kind==="edge-crosses-shape"||R.kind==="edge-overlap-opposite"||R.kind==="edge-overlap-mixed").length,crossings:eh(_),straight:_.edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.waypoints.length===2).length}},Ko=_=>{const R=nt(o),A=R.edges.find(O=>O.id===_);return A?en(A,Gn(R)).length:0},Du=_=>Ko(_)>0,Lu=_=>nt(o).edges.filter(R=>R.type==="bpmn:MessageFlow"&&R.id!==_&&R.waypoints.length===2).length,gL=(_,R,A)=>yn([{subtree:_,pool:R}],A),t0=(_,R)=>R.bad>_.bad||R.crossings>_.crossings&&R.straight<=_.straight&&R.bad>=_.bad,Iu=(_,R)=>t0(_,R)||R.straight<_.straight,Bu=(_,R,A=()=>!0,O=t0)=>{const F=qo(),N=yn(_,R);if(!N)return!1;const B=qo();return O(F,B)||!A()?(N(),!1):!0},n0=(_,R,A,O=()=>!0)=>Bu([{subtree:_,pool:R}],A,O),Kr=_=>{var R;return!!((R=P.get(_))!=null&&R.node.participant)},is=new Map;for(const _ of y){if(!Kr(_.flow.target))continue;const R=is.get(_.flow.target)??[];R.push(_),is.set(_.flow.target,R)}const ud=[...is.keys()],i0=new Set(g.map(_=>_.flow.target)),r0=_=>it.findIndex(({op:R})=>R.participant.id===_);ud.sort((_,R)=>{var F,N;const A=i0.has(_)?1:0,O=i0.has(R)?1:0;return A!==O?A-O:r0((F=P.get(_))==null?void 0:F.node.participant)-r0((N=P.get(R))==null?void 0:N.node.participant)});const Xr=_=>_.x+_.width/2,yL=_=>{const R=new Map;for(const F of o.getAll()){const N=F;if(!N.waypoints||!N.source||!N.target)continue;(R.get(N.source.id)??R.set(N.source.id,[]).get(N.source.id)).push(N.target.id)}const A=new Set([_]),O=[_];for(let F=0;F<O.length;F++)for(const N of R.get(O[F])??[])A.has(N)||(A.add(N),O.push(N));return A},vL=(_,R)=>{const A=yL(R);let O;for(const F of o.getAll()){const N=F;if(N.type!=="bpmn:MessageFlow"||!N.source||!N.target||N.target.id!==_||A.has(N.source.id))continue;const B=N.source;if(typeof B.x!="number"||B.type==="bpmn:Participant")continue;const j=Xr(B);(O===void 0||j>O)&&(O=j)}return O},ld=(_,R)=>{const A=l(_.flow.source);if(A)return A.type==="bpmn:Participant"?vL(A.id,R):Xr(A)},o0=_=>{let R;for(const A of is.get(_)??[]){const O=ld(A,_);O!==void 0&&(!R||O>R.cx)&&(R={op:A,cx:O})}return R==null?void 0:R.op},bL=_=>{const R=o0(_),A=l(_),O=R?ld(R,_):void 0;return A&&O!==void 0?O-Xr(A):void 0},xL=_=>{const R=bL(_);return R!==void 0&&Math.abs(R)<cd},a0=(_,R,A,O,F)=>{var N;for(let B=!0;B;){B=!1;for(const j of y){if(j.flow.id===A)continue;const G=R.has(j.flow.source),K=R.has(j.flow.target);if(G===K||O(G?j.flow.source:j.flow.target))continue;const pe=G?j.flow.target:j.flow.source;if(F(pe)||!Kr(pe))continue;const Ee=l(j.flow.id);if(!(Ee!=null&&Ee.waypoints)||Ee.waypoints.length!==2)continue;const re=l(pe),Oe=(N=P.get(pe))==null?void 0:N.node.participant;if(!re||!Oe)continue;const be=cn(pe,Ce=>Ce.x>=re.x).filter(Ce=>!R.has(Ce.id));if(!(!be.length||be.some(Ce=>F(Ce.id)))){for(const Ce of be)R.add(Ce.id);_.set(Oe,[..._.get(Oe)??[],...be]),B=!0}}}return[..._].map(([B,j])=>({subtree:j,pool:f(B)}))},s0=(_,R,A,O,F)=>a0(new Map([[R,[..._]]]),new Set(_.map(N=>N.id)),O,N=>N===A,N=>N===F),pd=_=>{const R=o0(_);if(!R)return null;const A=l(_),O=l(R.flow.source),F=ld(R,_);if(!A||!O||F===void 0)return null;const N=F-Xr(A);if(N>=cd){const B=P.get(_).node.participant,j=cn(_,G=>G.x>=A.x);return{groups:s0(j,B,_,R.flow.id,R.flow.source),dx:N}}if(-N>=cd&&Kr(R.flow.source)){const B=P.get(R.flow.source).node.participant,j=cn(R.flow.source,G=>G.x>=O.x&&!xL(G.id));return{groups:s0(j,B,R.flow.source,R.flow.id,_),dx:-N}}return null},c0=()=>ud.map(_=>({id:_,plan:pd(_)})).filter(_=>!!_.plan).sort((_,R)=>Math.min(..._.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))-Math.min(...R.plan.groups.flatMap(A=>A.subtree.map(O=>O.x)))).map(_=>_.id);for(let _=0;_<3;_++){const R=qo(),A=[];for(const F of c0()){const N=pd(F);if(!N)continue;const B=yn(N.groups,N.dx);B&&A.push(B)}if(!A.length)break;if(!Iu(R,qo()))continue;for(const F of A.reverse())F();let O=!1;for(const F of c0()){const N=pd(F);N&&Bu(N.groups,N.dx,()=>!0,Iu)&&(O=!0)}if(!O)break}for(const _ of ud.flatMap(R=>is.get(R)??[])){if(!Du(_.flow.id))continue;const R=l(_.flow.target);if(!R)continue;const A=f(P.get(_.flow.target).node.participant),O=cn(_.flow.target,j=>j.x>=R.x),F=R.width+L,N=Ko(_.flow.id),B=Lu(_.flow.id);for(let j=1;j<=e0;j++){const G=()=>Ko(_.flow.id)<N&&Lu(_.flow.id)>=B;if(n0(O,A,F*j,G))break}}for(const _ of y){if(!Du(_.flow.id))continue;const R=l(_.flow.source),A=l(_.flow.target);if(!R||!A||R.type==="bpmn:Participant"||A.type==="bpmn:Participant")continue;const O=R.x+R.width/2;if(Math.abs(O-(A.x+A.width/2))>15)continue;const[F,N]=R.y<A.y?[R.y+R.height,A.y]:[A.y+A.height,R.y],B=[...P.values()].map(j=>l(j.node.id)).filter(j=>!!j&&j.id!==R.id&&j.id!==A.id).filter(j=>j.x<=O&&O<=j.x+j.width&&j.y+j.height>F&&j.y<N).sort((j,G)=>j.x-G.x);for(const j of B){const G=(v0=P.get(j.id))==null?void 0:v0.node.participant,K=G?l(G):void 0;if(!K)continue;const pe=[...P.values()].filter(de=>de.node.participant===G).map(de=>de.node.id),Ee=de=>de.map(he=>l(he)).filter(he=>!!he),Oe=[Ut(j.id,de=>{var he;return((he=P.get(de.id))==null?void 0:he.node.participant)===G}),Ee(pe)].filter(de=>de.length),be=j.width+L,Ce=Ko(_.flow.id),pt=Lu(_.flow.id),ce=()=>Ko(_.flow.id)<Ce&&Lu(_.flow.id)>=pt;let ve=!1;for(const de of Oe){for(let he=1;he<=e0;he++)if(n0(de,K,be*he,ce)){ve=!0;break}if(ve)break}if(!Du(_.flow.id))break}}for(const _ of y){if(!Du(_.flow.id))continue;const R=l(_.flow.id);if(((b0=R==null?void 0:R.waypoints)==null?void 0:b0.length)!==2)continue;const A=l(_.flow.source),O=l(_.flow.target);if(!A||!O||A.type==="bpmn:Participant"||O.type==="bpmn:Participant"||!Kr(_.flow.source)||!Kr(_.flow.target)||Math.abs(Xr(A)-Xr(O))>hL)continue;const F=Xr(A),N=R.waypoints.map(Ce=>Ce.y),[B,j]=[Math.min(...N),Math.max(...N)],G=Gn(nt(o)).filter(Ce=>Ce.id!==A.id&&Ce.id!==O.id&&Ce.x<F&&F<Ce.x+Ce.width&&B<Ce.y+Ce.height&&Ce.y<j);if(!G.length)continue;const K=(x0=P.get(_.flow.source))==null?void 0:x0.node.participant,pe=(_0=P.get(_.flow.target))==null?void 0:_0.node.participant;if(!K||!pe)continue;const Ee=new Map;for(const[Ce,pt,ce]of[[_.flow.source,A,K],[_.flow.target,O,pe]]){const ve=Ee.get(ce)??[],de=cn(Ce,he=>he.x>=pt.x).filter(he=>!ve.some(Ye=>Ye.id===he.id));Ee.set(ce,[...ve,...de])}const re=new Set([...Ee.values()].flat().map(Ce=>Ce.id)),Oe=a0(Ee,re,_.flow.id,Ce=>Ce===_.flow.source||Ce===_.flow.target,()=>!1),be=Math.max(...G.map(Ce=>Ce.x+Ce.width));for(const Ce of mL){const pt=be+Ce-F;if(pt<=0)continue;if(Bu(Oe,pt,()=>{var ve,de;return Ko(_.flow.id)===0&&((de=(ve=l(_.flow.id))==null?void 0:ve.waypoints)==null?void 0:de.length)===2},Iu))break}}{const _=A=>A.y+A.height/2,R=[];for(const A of P.keys()){if(!Kr(A))continue;const O=g.filter(B=>B.flow.target===A);if(O.length!==1)continue;const F=l(O[0].flow.source),N=l(A);!F||!N||!P.has(F.id)||Math.abs(_(F)-_(N))>1||N.x-(F.x+F.width)<=L+1||R.push({id:A,pred:F,node:N})}R.sort((A,O)=>A.node.x-O.node.x);for(const{id:A}of R){const O=P.get(A),F=l(A),N=l(g.find(re=>re.flow.target===A).flow.source);if(!F||!N)continue;const B=F.x-(N.x+N.width);if(B<=L+1)continue;const j=f(O.node.participant),G=cn(A,re=>re.x>=F.x),K=qo(),pe=gL(G,j,-(B-L));if(!pe)continue;const Ee=qo();(Ee.bad>K.bad||Ee.crossings>=K.crossings||Ee.straight<K.straight)&&pe()}}J_(!0);for(const _ of v){const R=_.associations??[],A=R.map(N=>N.source===_.dataStore.id?N.target:N.source).map(l).find(Boolean),O=A?p(A)??u():u(),F=A?{x:A.x+A.width/2,y:A.y+A.height+110}:{x:200,y:Ct+60};n.createShape({type:"bpmn:DataStoreReference",businessObject:i.create("bpmn:DataStoreReference",{id:_.dataStore.id,name:_.dataStore.name})},F,O);for(const N of R)Q_(_.dataStore.id,N)}for(const _ of b){const A=f(_.association.target).type==="bpmn:DataStoreReference"?_.association.target:_.association.source;Q_(A,_.association)}let u0=0;const Zr=10,l0=40,_L=(_,R)=>{const A=R.map(G=>p(G)).filter(G=>!!G);for(const G of A){const K=Zr,pe=G.y,Ee=G.y+G.height,re=G.x,Oe=G.x+G.width;if(Math.abs(_.y-pe)<K){const be=pe+K-_.y;_.y+=be,_.height-=be}if(Math.abs(_.y+_.height-Ee)<K&&(_.height=Ee-K-_.y),Math.abs(_.x-re)<K){const be=re+K-_.x;_.x+=be,_.width-=be}Math.abs(_.x+_.width-Oe)<K&&(_.width=Oe-K-_.x)}if(!A.length)return;const O=Math.min(...A.map(G=>G.y)),F=Math.max(...A.map(G=>G.y+G.height)),N=O-_.y,B=_.y+_.height-F,j=l0-Zr;if(N>0!=B>0)if(N>0&&N<j){const G=N+Zr;_.y+=G,_.height-=G}else B>0&&B<j&&(_.height-=B+Zr)},wL=(_,R)=>{const A=Zr,O=30,F=o.filter(N=>N.type==="bpmn:Group"&&N.id!==R);for(const N of F){const B=N.x,j=N.x+N.width,G=N.y,K=N.y+N.height,pe=_.y<K&&G<_.y+_.height,Ee=_.x<j&&B<_.x+_.width;if(pe){if(Math.abs(_.x-j)<A){const re=Math.min(j+A-_.x,O);re>0&&_.width-re>0&&(_.x+=re,_.width-=re)}if(Math.abs(_.x+_.width-B)<A){const re=Math.min(_.x+_.width-(B-A),O);re>0&&_.width-re>0&&(_.width-=re)}}if(Ee){if(Math.abs(_.y-K)<A){const re=Math.min(K+A-_.y,O);re>0&&_.height-re>0&&(_.y+=re,_.height-=re)}if(Math.abs(_.y+_.height-G)<A){const re=Math.min(_.y+_.height-(G-A),O);re>0&&_.height-re>0&&(_.height-=re)}}}},fd=(_,R)=>{const A=l0,O=Math.min(..._.map(G=>G.x))-A,F=Math.min(..._.map(G=>G.y))-A,N=Math.max(..._.map(G=>G.x+G.width))+A,B=Math.max(..._.map(G=>G.y+G.height))+A,j={x:O,y:F,width:N-O,height:B-F};return _L(j,_),wL(j,R),j};for(const _ of C){const R=(_.group.members??[]).map(l).filter(F=>!!F);let A;R.length?A=fd(R,_.group.id):(A={x:300+u0*350,y:40,width:300,height:200},u0++);const O=n.createShape({type:"bpmn:Group",businessObject:i.create("bpmn:Group",{id:_.group.id}),width:A.width,height:A.height},{x:A.x+A.width/2,y:A.y+A.height/2},u());_.group.name&&n.updateLabel(O,_.group.name),(w0=_.group.members)!=null&&w0.length&&D(O,"bwl:Members",{refs:_.group.members.join(" ")})}{const _=o.filter(F=>!!F.waypoints),R=new Map,A=(F,N)=>{!F||!N||(R.has(F)||R.set(F,new Set),R.get(F).add(N))};for(const F of _){const N=(E0=F.source)==null?void 0:E0.id,B=(S0=F.target)==null?void 0:S0.id;A(N,B),((R0=F.type)!=null&&R0.includes("DataOutputAssociation")||(C0=F.type)!=null&&C0.includes("DataInputAssociation")||F.type==="bpmn:Association")&&A(B,N)}const O=o.filter(F=>F.type==="bpmn:Group");for(const F of O){const B=(((P0=F.businessObject.extensionElements)==null?void 0:P0.values)??[]).find(ce=>ce.$type==="bwl:Members"),j=((B==null?void 0:B.refs)??"").split(" ").filter(Boolean);if(!j.length)continue;const G=new Set(j),K=[...j];for(;K.length;){const ce=K.shift();for(const ve of R.get(ce)??[])G.has(ve)||(G.add(ve),K.push(ve))}const pe=F.x,Ee=F.x+F.width,re=F.y,Oe=F.y+F.height,be=ce=>g.filter(ve=>ve.flow.target===ce).length,Ce=ce=>{var de;const ve=((de=l(ce))==null?void 0:de.type)??"";if(ve==="bpmn:StartEvent"&&be(ce)===0)return!1;if(ve.endsWith("Gateway")){const he=g.filter(Ye=>Ye.flow.target===ce).map(Ye=>Ye.flow.source);if(he.length&&he.every(Ye=>{var Je;return((Je=l(Ye))==null?void 0:Je.type)==="bpmn:StartEvent"&&be(Ye)===0}))return!1}return!0},pt=o.filter(ce=>Ai(ce)).filter(ce=>ce.type!=="bpmn:Group"&&ce.type!=="bpmn:Participant"&&ce.type!=="bpmn:TextAnnotation"&&!G.has(ce.id)&&Kr(ce.id)&&Ce(ce.id)&&ce.x<Ee&&ce.x+ce.width>pe&&ce.y<Oe&&ce.y+ce.height>re);if(pt.length)for(const ce of[-1,1]){const ve=pt.filter(ne=>(ne.x+ne.width-pe<=Ee-ne.x?-1:1)===ce);if(!ve.length)continue;const de=[];for(const ne of ve){const X=de.find(Z=>Z.some(fe=>ne.y<fe.y+fe.height&&ne.y+ne.height>fe.y));X?X.push(ne):de.push([ne])}const he=new Map;for(const ne of de){let X=ce<0?pe-Zr:Ee+Zr;for(const Z of[...ne].sort((fe,me)=>ce<0?me.x-fe.x:fe.x-me.x)){const fe=ce<0?Math.min(Z.x,X-Z.width):Math.max(Z.x,X);X=ce<0?fe-En:fe+Z.width+En,fe!==Z.x&&Math.sign(fe-Z.x)===ce&&he.set(Z.id,fe-Z.x)}}const Ye=new Map,Je=ne=>Ye.get(ne)===ne||!Ye.get(ne)?ne:Je(Ye.get(ne));for(const ne of ve)Ye.set(ne.id,ne.id);for(const ne of y){const X=he.has(ne.flow.source)?ne.flow.source:void 0,Z=he.has(ne.flow.target)?ne.flow.target:void 0;if(!X||!Z)continue;const fe=l(ne.flow.id);((A0=fe==null?void 0:fe.waypoints)==null?void 0:A0.length)===2&&Ye.set(Je(X),Je(Z))}const Ot=new Map;for(const ne of ve){if(!he.has(ne.id))continue;const X=Je(ne.id);Ot.set(X,[...Ot.get(X)??[],ne])}const Qt=[...Ot.values()].sort((ne,X)=>ce<0?Math.min(...ne.map(Z=>Z.x))-Math.min(...X.map(Z=>Z.x)):Math.max(...X.map(Z=>Z.x))-Math.max(...ne.map(Z=>Z.x))),Se=[];let Me=!0;for(const ne of Qt){const X=ne.map(me=>he.get(me.id)??0).reduce((me,Re)=>Math.abs(Re)>Math.abs(me)?Re:me,0),Z=new Map;let fe=!0;for(const me of ne){const Re=p(me);if(!Re){fe=!1;break}Z.has(Re.id)||Z.set(Re.id,{subtree:[],pool:Re}),Z.get(Re.id).subtree.push(me)}fe&&Bu([...Z.values()],X,()=>!0,Iu)?Se.push({shapes:ne,dx:X}):Me=!1}if(!Me)for(const ne of Se.reverse())n.moveElements(ne.shapes,{x:-ne.dx,y:0})}}}{const _=new Set([...C.map(R=>R.group.id),...Kt(e,"group.update").map(R=>R.id)]);for(const R of o.filter(A=>A.type==="bpmn:Group")){if(_.has(R.id))continue;const O=(((T0=R.businessObject.extensionElements)==null?void 0:T0.values)??[]).find(j=>j.$type==="bwl:Members"),F=((O==null?void 0:O.refs)??"").split(" ").filter(Boolean).map(l).filter(j=>!!j);!F.length||!F.some(j=>{const G=d.get(j.id);return!G||G.x!==j.x||G.y!==j.y})||!F.some(j=>j.x<R.x||j.y<R.y||j.x+j.width>R.x+R.width||j.y+j.height>R.y+R.height)||n.resizeShape(R,fd(F,R.id))}}{const R=new Map(lo(nt(o)).map(j=>[j.owner,j.rect])),A=o.filter(j=>!!j.waypoints),O=new Map,F=(j,G)=>{!j||!G||(O.has(j)||O.set(j,new Set),O.get(j).add(G))};for(const j of A){const G=(M0=j.source)==null?void 0:M0.id,K=(k0=j.target)==null?void 0:k0.id;F(G,K),((O0=j.type)!=null&&O0.includes("DataOutputAssociation")||(D0=j.type)!=null&&D0.includes("DataInputAssociation")||j.type==="bpmn:Association")&&F(K,G)}const N=j=>g.filter(G=>G.flow.target===j).length,B=j=>{var K;const G=((K=l(j))==null?void 0:K.type)??"";if(G==="bpmn:StartEvent"&&N(j)===0)return!1;if(G.endsWith("Gateway")){const pe=g.filter(Ee=>Ee.flow.target===j).map(Ee=>Ee.flow.source);if(pe.length&&pe.every(Ee=>{var re;return((re=l(Ee))==null?void 0:re.type)==="bpmn:StartEvent"&&N(Ee)===0}))return!1}return!0};for(const j of o.filter(G=>G.type==="bpmn:Group")){const K=(((L0=j.businessObject.extensionElements)==null?void 0:L0.values)??[]).find(X=>X.$type==="bwl:Members"),pe=((K==null?void 0:K.refs)??"").split(" ").filter(Boolean);if(!pe.length)continue;const Ee=pe.map(l).filter(X=>!!X);if(!Ee.length||!(C.some(X=>X.group.id===j.id)||Kt(e,"group.update").some(X=>X.id===j.id)||Ee.some(X=>{const Z=d.get(X.id);return!Z||Z.x!==X.x||Z.y!==X.y})))continue;const Oe=new Set(pe),be=[...pe];for(;be.length;){const X=be.shift();for(const Z of O.get(X)??[])Oe.has(Z)||(Oe.add(Z),be.push(Z))}const Ce=j.x,pt=j.x+j.width,ce=j.y,ve=j.y+j.height,de=X=>{const Z=R.get(X.id),fe={x:X.x,y:X.y,width:X.width,height:X.height};return Z?[fe,{x:Z.x,y:Z.y,width:Z.width,height:Z.height}]:[fe]},he=Ee.flatMap(de),Ye=Math.min(...he.map(X=>X.x)),Je=Math.max(...he.map(X=>X.x+X.width)),Ot=Math.min(...he.map(X=>X.y)),Qt=Math.max(...he.map(X=>X.y+X.height)),Se={L:Ye-Ce,R:pt-Je,T:Ot-ce,B:ve-Qt},Me=o.filter(X=>Ai(X)).filter(X=>X.type!=="bpmn:Group"&&X.type!=="bpmn:Participant"&&X.type!=="bpmn:TextAnnotation"&&!Oe.has(X.id)&&B(X.id)&&X.x<pt&&X.x+X.width>Ce&&X.y<ve&&X.y+X.height>ce);if(!Me.length)continue;const ne={L:0,R:0,T:0,B:0};for(const X of Me){const Z=de(X),fe=Math.min(...Z.map(mt=>mt.x)),me=Math.max(...Z.map(mt=>mt.x+mt.width)),Re=Math.min(...Z.map(mt=>mt.y)),De=Math.max(...Z.map(mt=>mt.y+mt.height)),rt={L:me-Ce,R:pt-fe,T:De-ce,B:ve-Re},vt=["L","R","T","B"].filter(mt=>rt[mt]<=Se[mt]+.001);if(!vt.length)continue;const st=vt.reduce((mt,Qr)=>rt[Qr]<rt[mt]?Qr:mt,vt[0]);ne[st]=Math.max(ne[st],Math.min(rt[st]+10,Se[st]))}!ne.L&&!ne.R&&!ne.T&&!ne.B||n.resizeShape(j,{x:j.x+ne.L,y:j.y+ne.T,width:j.width-ne.L-ne.R,height:j.height-ne.T-ne.B})}}const p0=_=>{const R=_.waypoints;if(R!=null&&R.length){const O=R[Math.floor((R.length-1)/2)];return{x:O.x,y:O.y,width:0,height:0}}const A=_;return{x:A.x,y:A.y,width:A.width,height:A.height}};let rs=0;const f0=12,d0=14,EL=15,SL=300,RL=_=>{const R=_.split(`
7
+ `),A=Math.max(...R.map(N=>so(N,f0))),O=Math.max(100,Math.min(SL,Math.ceil(A)+d0)),F=R.reduce((N,B)=>N+Math.max(1,Math.ceil((so(B,f0)+d0)/O)),0);return{width:O,height:Math.max(30,F*EL+10)}};for(const _ of x){const R=_.association,A=((I0=_.placement)==null?void 0:I0.anchor)??(R?R.source===_.annotation.id?R.target:R.source:void 0),O=A?l(A):void 0,F=O?p0(O):void 0,N=RL(_.annotation.text??"");let B;if(F&&_.placement){const[pe,Ee]=As[_.placement.side],re=_.placement.offset??50;B={x:F.x+F.width/2+pe*(F.width/2+N.width/2+re),y:F.y+F.height/2+Ee*(F.height/2+N.height/2+re)}}else F?(B={x:F.x+F.width/2+180+rs%3*260,y:F.y-110-rs%2*95},rs++):(B={x:300+rs*260,y:60},rs++);const j=O?p(O)??u():u(),G=j;F&&typeof G.x=="number"&&typeof G.width=="number"&&G.type==="bpmn:Participant"&&(B=gl(o,F,N,G,_.placement?{placement:_.placement}:{from:B}));const K=n.createShape({type:"bpmn:TextAnnotation",width:N.width,height:N.height,businessObject:i.create("bpmn:TextAnnotation",{id:_.annotation.id,text:_.annotation.text})},B,j);if(R){const pe=Ee=>Ee===_.annotation.id?K:f(Ee);n.connect(pe(R.source),pe(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}_.placement&&D(K,"bwl:Placement",T(_.placement))}for(const _ of Kt(e,"association.add")){const R=_.association;n.connect(f(R.source),f(R.target),R.id?{type:"bpmn:Association",businessObject:i.create("bpmn:Association",{id:R.id})}:{type:"bpmn:Association"})}for(const _ of Kt(e,"node.update")){let R=f(_.id);if(_.type&&Ps(_.type)!==R.type&&(R=c.replaceElement(R,{type:Ps(_.type)})),_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.lane||_.band!==void 0){_.band!==void 0&&n.updateProperties(R,{"bwl:band":_.band});const A=R.y+R.height/2,O=p(R),F=_.lane?f(_.lane):((O==null?void 0:O.children)??[]).find(B=>B.type==="bpmn:Lane"&&A>=B.y&&A<=B.y+B.height);_.band!==void 0&&we(F==null?void 0:F.id,_.band,O);const N=F?F.y+(_.band===void 0?F.height/2:Math.min(F.height/2,ae)+M(F.id,_.band)*k):_.band!==void 0&&O?O.y+H+M(`pool:${O.id}`,_.band)*k:void 0;if(N!==void 0){const B=N-A;B!==0&&n.moveElements([R],{x:0,y:B})}}}for(const _ of Kt(e,"sequenceFlow.update")){const R=f(_.id);if(_.source!==void 0||_.target!==void 0){const A=R,O=_.source!==void 0?f(_.source):A.source,F=_.target!==void 0?f(_.target):A.target,N=B=>({x:B.x+B.width/2,y:B.y+B.height/2});n.reconnect(A,O,F,[N(O),N(F)])}_.name!==void 0&&n.updateProperties(R,{name:_.name??void 0}),_.condition!==void 0&&n.updateProperties(R,{name:((B0=_.condition)==null?void 0:B0.label)??void 0})}for(const _ of Kt(e,"messageFlow.update"))_.name!==void 0&&n.updateProperties(f(_.id),{name:_.name??void 0});for(const _ of Kt(e,"dataStore.update"))_.name!==void 0&&n.updateProperties(f(_.id),{name:_.name??void 0});for(const _ of Kt(e,"annotation.update")){const R=f(_.id);if(_.text!==void 0&&n.updateProperties(R,{text:_.text}),_.placement===null)D(R,"bwl:Placement",null);else if(_.placement){const A=f(_.placement.anchor),O=p0(A),F=p(A)??u(),N=typeof F.x=="number"&&typeof F.width=="number"&&F.type==="bpmn:Participant",[B,j]=As[_.placement.side],G=_.placement.offset??50,K={x:O.x+O.width/2+B*(O.width/2+R.width/2+G),y:O.y+O.height/2+j*(O.height/2+R.height/2+G)},pe=N?gl(o,O,{width:R.width,height:R.height},F,{placement:_.placement,selfId:_.id}):K;n.moveElements([R],{x:pe.x-(R.x+R.width/2),y:pe.y-(R.y+R.height/2)}),D(R,"bwl:Placement",T(_.placement))}}for(const _ of Kt(e,"group.update")){const R=f(_.id);if(_.name!==void 0&&n.updateLabel(R,_.name??""),_.members){const A=_.members.map(l).filter(O=>!!O);A.length&&n.resizeShape(R,fd(A,_.id)),D(R,"bwl:Members",{refs:_.members.join(" ")})}}}function yl(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 _1(e,t,n){var l,f;const{elementRegistry:i}=e,r=e.modeling,o=p=>fn(p).filter(d=>!t.has(bn(d))),a=p=>{var d;return((d=i.get(p))==null?void 0:d.type)==="bpmn:TextAnnotation"},s=nt(i),c=o(s),u=[...new Set(c.flatMap(yl))].filter(p=>n.has(p)&&a(p));if(u.length)for(const p of u){const d=i.get(p);if(!d||typeof d.x!="number"||typeof d.width!="number")continue;let m=d.parent,h;for(;m;){if(m.type==="bpmn:Participant"){h=m;break}m=m.parent}if(!h){const ye=d.x+d.width/2,We=d.y+d.height/2;h=i.getAll().find(Fe=>{if(Fe.type!=="bpmn:Participant")return!1;const q=Fe;return typeof q.x=="number"&&typeof q.width=="number"&&ye>=q.x&&ye<=q.x+q.width&&We>=q.y&&We<=q.y+q.height})}if(!h||typeof h.x!="number"||typeof h.width!="number")continue;const y=(((l=d.businessObject.extensionElements)==null?void 0:l.values)??[]).find(ye=>ye.$type==="bwl:Placement"),v=[...d.incoming??[],...d.outgoing??[]].find(ye=>ye.type==="bpmn:Association"),b=(y!=null&&y.anchor?i.get(y.anchor):void 0)??(v?((f=v.source)==null?void 0:f.id)===p?v.target:v.source:void 0);if(!b)continue;const x=b.waypoints,C=x!=null&&x.length?{x:x[Math.floor((x.length-1)/2)].x,y:x[Math.floor((x.length-1)/2)].y,width:0,height:0}:{x:b.x,y:b.y,width:b.width,height:b.height},P={width:d.width,height:d.height},D={x:d.x+d.width/2,y:d.y+d.height/2},T=y==null?void 0:y.side,I=[];T&&T in As&&I.push(gl(i,C,P,h,{placement:{side:T,offset:(y==null?void 0:y.offset)??null},selfId:p}));for(const[ye,We]of[[-1,0],[1,0],[0,-1],[0,1]])for(let Fe=1;Fe<=x1;Fe++)I.push({x:D.x+ye*Nh*Fe,y:D.y+We*Nh*Fe});const k={...s,edges:s.edges.filter(ye=>ye.id!==(v==null?void 0:v.id))},L=o(k),H=L.filter(ye=>yl(ye).includes(p)).length;if(!H)continue;let ae;for(const ye of I){const We=ye.x-D.x,Fe=ye.y-D.y;if(!We&&!Fe||ye.x-P.width/2<h.x||ye.x+P.width/2>h.x+h.width||ye.y-P.height/2<h.y||ye.y+P.height/2>h.y+h.height)continue;const q={...k,shapes:k.shapes.map(ke=>ke.id===p?{...ke,x:ke.x+We,y:ke.y+Fe}:ke)},ue=o(q),oe=ue.filter(ke=>yl(ke).includes(p)).length;if(oe>=H||ue.length>L.length)continue;const le=Math.abs(We)+Math.abs(Fe);if((!ae||oe<ae.mine||oe===ae.mine&&(ue.length<ae.all||ue.length===ae.all&&le<ae.dist))&&(ae={x:ye.x,y:ye.y,mine:oe,all:ue.length,dist:le}),ae.mine===0&&ae.all<L.length)break}ae&&r.moveElements([d],{x:ae.x-D.x,y:ae.y-D.y})}}const w1=60;function E1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=l=>fn(l).filter(f=>!t.has(bn(f))),a=l=>l.filter(f=>f.kind==="pool-overlap"),s=new Map(n.shapes.map(l=>[l.id,l])),c=(l,f)=>f.x>=l.x&&f.y>=l.y&&f.x+f.width<=l.x+l.width&&f.y+f.height<=l.y+l.height,u=l=>{if(!s.get(l))return[l];const p=new Set,d=new Set([l]);for(let h=0;h<4;h++){let g=!1;for(const y of n.shapes)y.type!=="bpmn:Group"||p.has(y.id)||[...d].some(v=>{const b=s.get(v);return b&&c(y,b)})&&(p.add(y.id),g=!0);for(const y of n.shapes)y.type!=="bpmn:Participant"||d.has(y.id)||[...p].some(v=>{const b=s.get(v);return b&&c(b,y)})&&(d.add(y.id),g=!0);if(!g)break}const m=n.shapes.filter(h=>!h.parent&&!d.has(h.id)&&!p.has(h.id)&&h.type!=="bpmn:Group"&&h.type!=="bpmn:Participant").filter(h=>[...p].some(g=>{const y=s.get(g);return y&&c(y,h)})).map(h=>h.id);return[...d,...p,...m]};for(let l=0;l<6;l++){const f=nt(i),p=o(f),d=a(p);if(!d.length)return;const m=new Map(f.shapes.map(x=>[x.id,x]));let h=null;for(const x of d){if(x.kind!=="pool-overlap")continue;const[C,P]=x.pools,D=m.get(C),T=m.get(P);if(!D||!T)continue;const[I,k]=D.x<=T.x?[D,T]:[T,D];if(x.contained)continue;const L=s.get(I.id),H=s.get(k.id),ae=L&&H?Math.max(H.x-(L.x+L.width),0):w1,ye=I.x+I.width+ae-k.x;if(ye<=0)continue;const We=u(k.id).filter(Fe=>i.get(Fe));We.length&&(!h||ye>h.dx)&&(h={movers:We,dx:ye})}if(!h)return;const g=h.movers.map(x=>i.get(x)).filter(x=>!!x&&typeof x.x=="number");if(!g.length)return;const y=p.length,v=d.length;r.moveElements(g,{x:h.dx,y:0});const b=o(nt(i));if(!(a(b).length<v&&b.length<=y)){r.moveElements(g,{x:-h.dx,y:0});return}}}function S1(e,t,n){const{elementRegistry:i}=e,r=e.modeling,o=u=>fn(u).filter(l=>!t.has(bn(l))),a=(u,l)=>l.x>=u.x&&l.y>=u.y&&l.x+l.width<=u.x+u.width&&l.y+l.height<=u.y+u.height,s=u=>({l:Math.min(...u.map(l=>l.x)),t:Math.min(...u.map(l=>l.y)),r:Math.max(...u.map(l=>l.x+l.width)),b:Math.max(...u.map(l=>l.y+l.height))}),c=n.shapes.filter(u=>{var l;return u.type==="bpmn:Group"&&!((l=u.members)!=null&&l.length)});if(c.length)for(const u of c){const l=i.get(u.id);if(!l||typeof l.x!="number")continue;const f=n.shapes.filter(P=>P.id!==u.id&&P.type!=="bpmn:Group"&&a(u,P));if(!f.length)continue;const p=f.map(P=>i.get(P.id)).filter(P=>!!P&&typeof P.x=="number");if(p.length!==f.length)continue;const d=s(f),m=s(p),h=m.l+(u.x-d.l),g=m.t+(u.y-d.t),y=m.r+(u.x+u.width-d.r),v=m.b+(u.y+u.height-d.b),b={x:h,y:g,width:y-h,height:v-g};if(b.width<=0||b.height<=0||Math.abs(b.x-l.x)<1&&Math.abs(b.y-l.y)<1&&Math.abs(b.width-l.width)<1&&Math.abs(b.height-l.height)<1)continue;const x=o(nt(i)).length,C={x:l.x,y:l.y,width:l.width,height:l.height};r.resizeShape(l,b),o(nt(i)).length>x&&r.resizeShape(l,C)}}function Fh(e,t,n=$h){const i=Bh(e),r=Ih(t,uh(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=nt(i.elementRegistry),s=new Set(fn(a).map(bn)),c=new Set(a.edges.map(y=>y.id)),u=new Set(a.shapes.map(y=>y.id)),l=xs(a),f=l.length,p=new Set(l.map(([y,v])=>`${y}|${v}`)),d=e.get("commandStack");try{vd(d,()=>{n(t,i),E1(i,s,a),S1(i,s,a),gh(i,c);const y=pl(i,s);dh(i,p,c),Ch(i,s,c),bh(i,c),p1(i,c),wh(i,s,c),m1(i,s,c),Mh(i,s,c),Th(i,c),Oh(i,u),_1(i,s,u),pl(i,s,y)})}catch(y){return{ok:!1,issues:[{kind:"lower-failed",message:y instanceof Error?y.message:String(y)}],findings:[],stats:o}}const m=nt(i.elementRegistry),h=fn(m).filter(y=>!s.has(bn(y))),g=th(m);return{ok:!0,issues:[],findings:h,stats:{edgeCrossings:{before:f,after:g.pairs.length,pairs:g.pairs,solidPairs:g.solidPairs,dashedPairs:g.dashedPairs,mixedPairs:g.mixedPairs,crossPoolMessages:g.crossPoolMessages}}}}function R1(e){const t=e.slice(e.indexOf(":")+1);return t.charAt(0).toLowerCase()+t.slice(1)}function C1(e,t){return typeof e.get=="function"?e.get(t):e[t]}function jh(e,t){const n=C1(e,t);return typeof n=="number"&&Number.isFinite(n)?n:void 0}function Hh(e,t){var i;return(((i=e.extensionElements)==null?void 0:i.values)??[]).find(r=>(r==null?void 0:r.$type)===t)}function P1(e){return typeof e=="string"&&$u.includes(e)}function ci(e){if(typeof e=="string")return e;const t=e==null?void 0:e.id;return typeof t=="string"?t:void 0}function zh(e){const t=e.rootElements??[],n=t.find(q=>q.$type==="bpmn:Collaboration"),i=new Map(t.filter(q=>q.$type==="bpmn:Process").map(q=>[q.id,q])),r=[],o=[],a=[],s=[],c=[],u=[],l={poolOrders:{},bands:{},placements:{}},f=[],p=[],d=[],m=[],h=[],g=[],y=new Set,v=new Set,b=q=>{q&&y.add(q)},x=q=>{y.add(q),v.add(q)},C=q=>{const ue=Hh(q,"bwl:Placement");if(!ue)return;const oe=typeof ue.anchor=="string"?ue.anchor:void 0;if(!oe||!P1(ue.side))return;const le=typeof ue.offset=="number"?ue.offset:void 0;h.push({owner:q.id,anchor:oe,side:ue.side,...le!==void 0?{offset:le}:{}})},P=q=>{const ue=Hh(q,"bwl:Members"),oe=typeof(ue==null?void 0:ue.refs)=="string"?ue.refs.split(/\s+/).filter(Boolean):[];oe.length&&g.push({owner:q.id,refs:oe})},D=q=>{var ue;for(const oe of q)switch(b(oe.id),oe.$type){case"bpmn:TextAnnotation":x(oe.id),s.push({id:oe.id,text:typeof oe.text=="string"?oe.text:""}),C(oe);break;case"bpmn:Association":d.push({id:oe.id,type:oe.$type,source:ci(oe.sourceRef),target:ci(oe.targetRef)});break;case"bpmn:Group":{x(oe.id);const le=(ue=oe.categoryValueRef)==null?void 0:ue.value;c.push({id:oe.id,...typeof le=="string"&&le?{name:le}:{}}),P(oe);break}default:u.push({id:oe.id,type:oe.$type,reason:"type-outside-mvp"})}},T=q=>{for(const ue of q.flowElements??[])b(ue.id),u.push({id:ue.id,type:ue.$type,reason:"inside-container"}),(ue.flowElements??[]).length&&T(ue);for(const ue of q.artifacts??[])b(ue.id),u.push({id:ue.id,type:ue.$type,reason:"inside-container"})},I=(q,ue)=>{const oe=q.flowElements??[],le=(q.laneSets??[]).flatMap(W=>W.lanes??[]),ke=new Map;for(const W of le){b(W.id);for(const Y of W.flowNodeRef??[]){const J=ci(Y);J&&ke.set(J,W.id)}}for(const W of oe){if(b(W.id),W.$type==="bpmn:SequenceFlow"){f.push({id:W.id,source:ci(W.sourceRef),target:ci(W.targetRef),...typeof W.name=="string"&&W.name?{name:W.name}:{}});continue}if(W.$type==="bpmn:DataStoreReference"){x(W.id),a.push({id:W.id,...W.name?{name:W.name}:{}});continue}const Y=R1(W.$type);if(!dd(Y)){u.push({id:W.id,type:W.$type,reason:"type-outside-mvp"});continue}x(W.id);const J=Y==="boundaryEvent"?ci(W.attachedToRef):void 0;o.push({id:W.id,type:Y,...W.name?{name:W.name}:{},...ue?{participant:ue}:{},...ke.has(W.id)?{lane:ke.get(W.id)}:{},...J?{attachedTo:J}:{}}),Y==="subProcess"&&T(W);const Te=jh(W,"bwl:band");Te!==void 0&&(l.bands[W.id]=Te);for(const dt of W.dataOutputAssociations??[])b(dt.id),m.push({id:dt.id,type:dt.$type,source:W.id,target:ci(dt.targetRef)});for(const dt of W.dataInputAssociations??[])b(dt.id),m.push({id:dt.id,type:dt.$type,source:ci((dt.sourceRef??[])[0]),target:W.id})}D(q.artifacts??[])};if(n){const q=new Set;for(const ue of n.participants??[]){x(ue.id);const oe=ci(ue.processRef);oe&&q.add(oe);const le=oe?i.get(oe):void 0,ke=((le==null?void 0:le.laneSets)??[]).flatMap(Te=>Te.lanes??[]),W=ke.map(Te=>({id:Te.id,...Te.name?{name:Te.name}:{}}));for(const Te of W)x(Te.id);const Y=!le||(le.flowElements??[]).length===0&&ke.length===0&&(le.artifacts??[]).length===0;r.push({id:ue.id,...ue.name?{name:ue.name}:{},...Y?{blackBox:!0}:{},...W.length?{lanes:W}:{}});const J=jh(ue,"bwl:poolOrder");J!==void 0&&(l.poolOrders[ue.id]=J),le&&I(le,ue.id)}for(const ue of n.messageFlows??[])b(ue.id),p.push({id:ue.id,source:ci(ue.sourceRef),target:ci(ue.targetRef),...typeof ue.name=="string"&&ue.name?{name:ue.name}:{}});D(n.artifacts??[]);for(const[ue,oe]of i)!q.has(ue)&&(oe.flowElements??[]).length>0&&u.push({id:ue,type:oe.$type,reason:"unreachable-process"})}else for(const q of i.values())I(q);const k=[],L=[],H=[],ae=[],ye=(q,ue)=>!!q&&!!ue&&v.has(q)&&v.has(ue);for(const q of f){if(!ye(q.source,q.target)){u.push({id:q.id,type:"bpmn:SequenceFlow",reason:"endpoint-outside-mvp"});continue}k.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),v.add(q.id)}for(const q of p){if(!ye(q.source,q.target)){u.push({id:q.id,type:"bpmn:MessageFlow",reason:"endpoint-outside-mvp"});continue}L.push({id:q.id,source:q.source,target:q.target,...q.name?{name:q.name}:{}}),v.add(q.id)}for(const q of m){if(!ye(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}ae.push({...q.id?{id:q.id}:{},source:q.source,target:q.target}),q.id&&v.add(q.id)}for(const q of d){if(!ye(q.source,q.target)){u.push({id:q.id??"",type:q.type,reason:"endpoint-outside-mvp"});continue}H.push({...q.id?{id:q.id}:{},source:q.source,target:q.target})}const We=new Map(c.map(q=>[q.id,q]));for(const{owner:q,refs:ue}of g){const oe=ue.filter(ke=>y.has(ke)),le=We.get(q);le&&oe.length&&(le.members=oe)}for(const q of h)y.has(q.anchor)&&(l.placements[q.owner]={anchor:q.anchor,side:q.side,...q.offset!==void 0?{offset:q.offset}:{}});return{definition:{...r.length?{participants:r}:{},nodes:o,sequenceFlows:k,...L.length?{messageFlows:L}:{},...a.length?{dataStores:a}:{},...ae.length?{dataAssociations:ae}:{},...s.length?{annotations:s}:{},...H.length?{associations:H}:{},...c.length?{groups:c}:{}},hints:l,omitted:u}}async function A1(e){const{definitions:t,warnings:n}=await tl(e);return{...zh(t),warnings:n}}function T1(e,t,n,i={}){return{documentId:e,baseVersion:t,ops:[...n],origin:i.origin??"agent",clientOpId:(i.mkClientOpId??(()=>crypto.randomUUID()))()}}async function Gh(e,t,{currentVersion:n}){if(t.baseVersion!==n)return{status:"conflict",baseVersion:t.baseVersion,currentVersion:n};const i=Fh(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 M1=Symbol("bpmn-editor");function k1(){const e=Lt.ref(!1),t=Lt.ref(!0),n=Lt.ref(!1);let i,r;const o=()=>{e.value=!0};function a(u,l){u.get("canvas").getContainer().style.pointerEvents=l?"":"none";const f=u.get("keyboard");l?(r&&f.bind(r),r=void 0):r||(r=f.getBinding(),f.unbind())}function s(){if(!i)throw new Error("modeler not attached — 뷰 @ready 후 attach() 필요");return i}function c(){return i==null?void 0:i.get("commandStack")}return{dirty:e,editable:t,agentBusy:n,attach(u){i&&this.detach(),i=u,i.get("eventBus").on("commandStack.changed",o),t.value||a(i,!1)},detach(){i==null||i.get("eventBus").off("commandStack.changed",o),i&&!t.value&&a(i,!0),r=void 0,i=void 0},setEditable(u){t.value=u,i&&a(i,u)},async applyAgentBatch(u,l){const f=s();n.value=!0;try{const p=await Gh(f,u,{currentVersion:l});return p.status==="applied"&&(e.value=!1),p}finally{n.value=!1}},async importXml(u){const{warnings:l}=await s().importXML(u);return e.value=!1,{warnings:nl(l)}},async saveXml(){const{xml:u}=await s().saveXML({format:!0});return e.value=!1,u??""},undo:()=>{var u;return(u=c())==null?void 0:u.undo()},redo:()=>{var u;return(u=c())==null?void 0:u.redo()},canUndo:()=>{var u;return((u=c())==null?void 0:u.canUndo())??!1},canRedo:()=>{var u;return((u=c())==null?void 0:u.canRedo())??!1}}}function xe(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}function O1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var vl={exports:{}},Vh;function D1(){if(Vh)return vl.exports;Vh=1;var e=vl.exports=function(t,n){if(n||(n=16),t===void 0&&(t=128),t<=0)return"0";for(var i=Math.log(Math.pow(2,t))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,t/r))/Math.log(n)*r;for(var o=i-Math.floor(i),a="",r=0;r<Math.floor(i);r++){var s=Math.floor(Math.random()*n).toString(n);a=s+a}if(o){var c=Math.pow(n,o),s=Math.floor(Math.random()*c).toString(n);a=s+a}var u=parseInt(a,n);return u!==1/0&&u>=Math.pow(2,t)?e(t,n):a};return e.rack=function(t,n,i){var r=function(a){var s=0;do{if(s++>10)if(i)t+=i;else throw new Error("too many ID collisions, use more bits");var c=e(t,n)}while(Object.hasOwnProperty.call(o,c));return o[c]=a,c},o=r.hats={};return r.get=function(a){return r.hats[a]},r.set=function(a,s){return r.hats[a]=s,r},r.bits=t||128,r.base=n||16,r},vl.exports}var L1=D1(),I1=O1(L1);function mi(e){if(!(this instanceof mi))return new mi(e);e=e||[128,36,1],this._seed=e.length?I1.rack(e[0],e[1],e[2]):e}mi.prototype.next=function(e){return this._seed(e||!0)},mi.prototype.nextPrefixed=function(e,t){var n;do n=e+this.next(!0);while(this.assigned(n));return this.claim(n,t),n},mi.prototype.claim=function(e,t){this._seed.set(e,t||!0)},mi.prototype.assigned=function(e){return this._seed.get(e)||!1},mi.prototype.unclaim=function(e){delete this._seed.hats[e]},mi.prototype.clear=function(){var e=this._seed.hats,t;for(t in e)this.unclaim(t)};const zt={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:[0,"",""]};zt.td=zt.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],zt.option=zt.optgroup=[1,'<select multiple="multiple">',"</select>"],zt.thead=zt.tbody=zt.colgroup=zt.caption=zt.tfoot=[1,"<table>","</table>"],zt.polyline=zt.ellipse=zt.polygon=zt.circle=zt.text=zt.line=zt.path=zt.rect=zt.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function yt(e,t=globalThis.document){var u;if(typeof e!="string")throw new TypeError("String expected");const n=/^<!--(.*?)-->$/s.exec(e);if(n)return t.createComment(n[1]);const i=(u=/<([\w:]+)/.exec(e))==null?void 0:u[1];if(!i)return t.createTextNode(e);if(e=e.trim(),i==="body"){const l=t.createElement("html");l.innerHTML=e;const{lastChild:f}=l;return f.remove(),f}let[r,o,a]=Object.hasOwn(zt,i)?zt[i]:zt._default,s=t.createElement("div");for(s.innerHTML=o+e+a;r--;)s=s.lastChild;if(s.firstChild===s.lastChild){const{firstChild:l}=s;return l.remove(),l}const c=t.createDocumentFragment();return c.append(...s.childNodes),c}function B1(e,t){return t.forEach(function(n){n&&typeof n!="string"&&!Array.isArray(n)&&Object.keys(n).forEach(function(i){if(i!=="default"&&!(i in e)){var r=Object.getOwnPropertyDescriptor(n,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return n[i]}})}})}),Object.freeze(e)}function _n(e,...t){const n=e.style;return $(t,function(i){i&&$(i,function(r,o){n[o]=r})}),e}function dn(e,t,n){return arguments.length==2?e.getAttribute(t):n===null?e.removeAttribute(t):(e.setAttribute(t,n),e)}const N1=Object.prototype.toString;function _t(e){return new Qi(e)}function Qi(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Qi.prototype.add=function(e){return this.list.add(e),this},Qi.prototype.remove=function(e){return N1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Qi.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},Qi.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Qi.prototype.array=function(){return Array.from(this.list)},Qi.prototype.has=Qi.prototype.contains=function(e){return this.list.contains(e)};function Ts(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Or(e,t,n){var i=n?e:e.parentNode;return i&&typeof i.closest=="function"&&i.closest(t)||null}function $1(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ms={},Wh;function F1(){if(Wh)return Ms;Wh=1;var e,t,n;function i(){e=window.addEventListener?"addEventListener":"attachEvent",t=window.removeEventListener?"removeEventListener":"detachEvent",n=e!=="addEventListener"?"on":""}return Ms.bind=function(r,o,a,s){return e||i(),r[e](n+o,a,s||!1),a},Ms.unbind=function(r,o,a,s){return t||i(),r[t](n+o,a,s||!1),a},Ms}var Uh=F1(),j1=$1(Uh),$e=B1({__proto__:null,default:j1},[Uh]),Yh=["focus","blur"];function H1(e,t,n,i,r){return Yh.indexOf(n)!==-1&&(r=!0),$e.bind(e,n,function(o){var a=o.target||o.srcElement;o.delegateTarget=Or(a,t,!0),o.delegateTarget&&i.call(e,o)},r)}function z1(e,t,n,i){return Yh.indexOf(t)!==-1&&(i=!0),$e.unbind(e,t,n,i)}var kn={bind:H1,unbind:z1};function bl(e,t){return e&&typeof e.matches=="function"&&e.matches(t)||!1}function at(e,t){return t=t||document,t.querySelector(e)}function ks(e,t){return t=t||document,t.querySelectorAll(e)}function gi(e){e.parentNode&&e.parentNode.removeChild(e)}function G1(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch{}return e}function V1(e,t){return t.appendChild(G1(e,t))}function je(e,t){return V1(t,e),e}var xl=2,qh={"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":xl,"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":xl,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function W1(e,t){return qh[t]?e.style[t]:e.getAttributeNS(null,t)}function Kh(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=qh[i];r?(r===xl&&typeof n=="number"&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function U1(e,t){var n=Object.keys(t),i,r;for(i=0,r;r=n[i];i++)Kh(e,r,t[r])}function _e(e,t,n){if(typeof t=="string")if(n!==void 0)Kh(e,t,n);else return W1(e,t);else U1(e,t);return e}const Y1=Object.prototype.toString;function Xe(e){return new Ji(e)}function Ji(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Ji.prototype.add=function(e){return this.list.add(e),this},Ji.prototype.remove=function(e){return Y1.call(e)=="[object RegExp]"?this.removeMatching(e):(this.list.remove(e),this)},Ji.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},Ji.prototype.toggle=function(e,t){return typeof t<"u"?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this},Ji.prototype.array=function(){return Array.from(this.list)},Ji.prototype.has=Ji.prototype.contains=function(e){return this.list.contains(e)};function Os(e){for(var t;t=e.firstChild;)e.removeChild(t);return e}function Xh(e){return e.cloneNode(!0)}var _l={svg:"http://www.w3.org/2000/svg"},Zh='<svg xmlns="'+_l.svg+'"';function q1(e){var t=!1;e.substring(0,4)==="<svg"?e.indexOf(_l.svg)===-1&&(e=Zh+e.substring(4)):(e=Zh+">"+e+"</svg>",t=!0);var n=K1(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function K1(e){var t;return t=new DOMParser,t.async=!1,t.parseFromString(e,"text/xml")}function Pe(e,t){var n;return e=e.trim(),e.charAt(0)==="<"?(n=q1(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(_l.svg,e),t&&_e(n,t),n}var wl=null;function Qh(){return wl===null&&(wl=Pe("svg")),wl}function Jh(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function X1(e,t,n,i,r,o){var a=Qh().createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Jh(a,e);case 6:return Jh(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}function na(e){return Qh().createSVGTransform()}var em=/([&<>]{1})/g,Z1=/([&<>\n\r"]{1})/g,Q1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function El(e,t){function n(i,r){return Q1[r]||r}return e.replace(t,n)}function tm(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(El(e.textContent,em));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,'="',El(o.value,Z1),'"');if(e.hasChildNodes()){for(t.push(">"),a=e.childNodes,n=0,i=a.length;n<i;++n)tm(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("<!--",El(e.nodeValue,em),"-->");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function J1(e){for(var t=e.firstChild,n=[];t;)tm(t,n),t=t.nextSibling;return n.join("")}function nm(e,t){return J1(e)}function Gt(e){var t=e.parentNode;return t&&t.removeChild(e),e}function eS(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function tS(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(eS(e,i))}function ia(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),tS(n,t)),n.consolidate()}const nS=/^class[ {]/;function iS(e){return nS.test(e.toString())}function Sl(e){return Array.isArray(e)}function Rl(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ds(...e){e.length===1&&Sl(e[0])&&(e=e[0]),e=[...e];const t=e.pop();return t.$inject=e,t}const rS=/constructor\s*[^(]*\(\s*([^)]*)\)/m,oS=/^(?:async\s+)?(?:function\s*[^(]*)?(?:\(\s*([^)]*)\)|(\w+))/m,aS=/\/\*([^*]*)\*\//m;function sS(e){if(typeof e!="function")throw new Error(`Cannot annotate "${e}". Expected a function!`);const t=e.toString().match(iS(e)?rS:oS);if(!t)return[];const n=t[1]||t[2];return n&&n.split(",").map(i=>{const r=i.match(aS);return(r&&r[1]||i).trim()})||[]}function im(e,t){const n=t||{get:function(b,x){if(i.push(b),x===!1)return null;throw s(`No provider for "${b}"!`)}},i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(b){const x=i.join(" -> ");return i.length=0,new Error(x?`${b} (Resolving: ${x})`:b)};function c(b,x){if(!r[b]&&b.includes(".")){const C=b.split(".");let P=c(C.shift());for(;C.length;)P=P[C.shift()];return P}if(Rl(o,b))return o[b];if(Rl(r,b)){if(i.indexOf(b)!==-1)throw i.push(b),s("Cannot resolve circular dependency!");return i.push(b),o[b]=r[b][0](r[b][1]),i.pop(),o[b]}return n.get(b,x)}function u(b,x){if(typeof x>"u"&&(x={}),typeof b!="function")if(Sl(b))b=Ds(b.slice());else throw s(`Cannot invoke "${b}". Expected a function!`);const P=(b.$inject||sS(b)).map(D=>Rl(x,D)?x[D]:c(D));return{fn:b,dependencies:P}}function l(b){const{fn:x,dependencies:C}=u(b),P=Function.prototype.bind.call(x,null,...C);return new P}function f(b,x,C){const{fn:P,dependencies:D}=u(b,C);return P.apply(x,D)}function p(b){return Ds(x=>b.get(x))}function d(b,x){if(x&&x.length){const C=Object.create(null),P=Object.create(null),D=[],T=[],I=[];let k,L,H,ae;for(let ye in r)k=r[ye],x.indexOf(ye)!==-1&&(k[2]==="private"?(L=D.indexOf(k[3]),L===-1?(H=k[3].createChild([],x),ae=p(H),D.push(k[3]),T.push(H),I.push(ae),C[ye]=[ae,ye,"private",H]):C[ye]=[I[L],ye,"private",T[L]]):C[ye]=[k[2],k[1]],P[ye]=!0),(k[2]==="factory"||k[2]==="type")&&k[1].$scope&&x.forEach(We=>{k[1].$scope.indexOf(We)!==-1&&(C[ye]=[k[2],k[1]],P[We]=!0)});x.forEach(ye=>{if(!P[ye])throw new Error('No provider for "'+ye+'". Cannot use provider from the parent!')}),b.unshift(C)}return new im(b,a)}const m={factory:f,type:l,value:function(b){return b}};function h(b,x){const C=b.__init__||[];return function(){C.forEach(P=>{typeof P=="string"?x.get(P):x.invoke(P)})}}function g(b){const x=b.__exports__;if(x){const C=b.__modules__,P=Object.keys(b).reduce((L,H)=>(H!=="__exports__"&&H!=="__modules__"&&H!=="__init__"&&H!=="__depends__"&&(L[H]=b[H]),L),Object.create(null)),D=(C||[]).concat(P),T=d(D),I=Ds(function(L){return T.get(L)});x.forEach(function(L){r[L]=[I,L,"private",T]});const k=(b.__init__||[]).slice();return k.unshift(function(){T.init()}),b=Object.assign({},b,{__init__:k}),h(b,T)}return Object.keys(b).forEach(function(C){if(C==="__init__"||C==="__depends__")return;const P=b[C];if(P[2]==="private"){r[C]=P;return}const D=P[0],T=P[1];r[C]=[m[D],cS(D,T),D]}),h(b,a)}function y(b,x){return b.indexOf(x)!==-1||(b=(x.__depends__||[]).reduce(y,b),b.indexOf(x)!==-1)?b:b.concat(x)}function v(b){const x=b.reduce(y,[]).map(g);let C=!1;return function(){C||(C=!0,x.forEach(P=>P()))}}this.get=c,this.invoke=f,this.instantiate=l,this.createChild=d,this.init=v(e)}function cS(e,t){return e!=="value"&&Sl(t)&&(t=Ds(t.slice())),t}var uS=1e3;function Oi(e,t){var n=this;t=t||uS,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)})}Oi.prototype.canRender=function(e){},Oi.prototype.drawShape=function(e,t){},Oi.prototype.drawConnection=function(e,t){},Oi.prototype.getShapePath=function(e){},Oi.prototype.getConnectionPath=function(e){};function Dr(e){return e.flat().join(",").replace(/,?([A-Za-z]),?/g,"$1")}function lS(e){return["M",e.x,e.y]}function Cl(e){return["L",e.x,e.y]}function pS(e,t,n){return["C",e.x,e.y,t.x,t.y,n.x,n.y]}function fS(e,t){const n=e.length,i=[lS(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(Cl(a));continue}const c=Math.min(t,Pl(a.x-o.x,a.y-o.y),Pl(s.x-a.x,s.y-a.y));if(!c){i.push(Cl(a));continue}const u=Ls(a,o,c),l=Ls(a,o,c*.5),f=Ls(a,s,c),p=Ls(a,s,c*.5);i.push(Cl(u)),i.push(pS(l,p,f))}return i}function Ls(e,t,n){const i=t.x-e.x,r=t.y-e.y,o=Pl(i,r),a=n/o;return{x:e.x+i*a,y:e.y+r*a}}function Pl(e,t){return Math.sqrt(Math.pow(e,2)+Math.pow(t,2))}function ra(e,t,n){Ne(t)&&(n=t,t=null),t||(t={});const i=Pe("path",t);return Ne(n)&&(i.dataset.cornerRadius=String(n)),Al(i,e)}function Al(e,t){const n=parseInt(e.dataset.cornerRadius,10)||0;return _e(e,{d:Dr(fS(t,n))}),e}function Is(e){var t=new Set(e);return Ue(e,function(n){for(var i=n.parent;i;){if(t.has(i))return!1;i=i.parent}return!0})}function Lr(e,t,n){n=n||0,Le(e)||(e=[e]),$(e,function(i,r){var o=t(i,r,n);Le(o)&&o.length&&Lr(o,t,n+1)})}function Tl(e,t,n){var i=new Set,r=new Set;return Lr(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 Tl(e)}function dS(e,t,n){Pr(t)&&(t=!0),Yt(t)&&(n=t,t=!0),n=n||{};var i=aa(n.allShapes),r=aa(n.allConnections),o=aa(n.enclosedElements),a=aa(n.enclosedConnections),s=aa(n.topLevel,t&&no(e,function(l){return l.id}));function c(l){s[l.source.id]&&s[l.target.id]&&(s[l.id]=[l]),i[l.source.id]&&i[l.target.id]&&(a[l.id]=o[l.id]=l),r[l.id]=l}function u(l){if(o[l.id]=l,l.waypoints)a[l.id]=r[l.id]=l;else return i[l.id]=l,$(l.incoming,c),$(l.outgoing,c),l.children}return Lr(e,u),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}function It(e,t){t=!!t,Le(e)||(e=[e]);var n,i,r,o;return $(e,function(a){var s=a;a.waypoints&&!t&&(s=It(a.waypoints,!0));var c=s.x,u=s.y,l=s.height||0,f=s.width||0;(c<n||n===void 0)&&(n=c),(u<i||i===void 0)&&(i=u),(c+f>r||r===void 0)&&(r=c+f),(u+l>o||o===void 0)&&(o=u+l)}),{x:n,y:i,height:o-i,width:r-n}}function ho(e,t){var n={};return $(e,function(i){var r=i;r.waypoints&&(r=It(r)),!Ne(t.y)&&r.x>t.x&&(n[i.id]=i),!Ne(t.x)&&r.y>t.y&&(n[i.id]=i),r.x>t.x&&r.y>t.y&&(Ne(t.width)&&Ne(t.height)&&r.width+r.x<t.width+t.x&&r.height+r.y<t.height+t.y||!Ne(t.width)||!Ne(t.height))&&(n[i.id]=i)}),n}function rm(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function om(e){return!!(e&&e.isFrame)}function aa(e,t){return V({},e||{},t||{})}var hS=1;function er(e,t){Oi.call(this,e,hS),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})}xe(er,Oi),er.prototype.canRender=function(){return!0},er.prototype.drawShape=function(t,n,i){var r=Pe("rect");return _e(r,{x:0,y:0,width:n.width||0,height:n.height||0}),om(n)?_e(r,V({},this.FRAME_STYLE,i||{})):_e(r,V({},this.SHAPE_STYLE,i||{})),je(t,r),r},er.prototype.drawConnection=function(t,n,i){var r=ra(n.waypoints,V({},this.CONNECTION_STYLE,i||{}));return je(t,r),r},er.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 Dr(a)},er.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 Dr(o)},er.$inject=["eventBus","styles"];function mS(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(n,i,r){var o=this.style(i,r);return V(o,{class:n})},this.style=function(n,i){!Le(n)&&!i&&(i=n,n=[]);var r=Tn(n,function(o,a){return V(o,e[a]||{})},{});return i?V(r,i):r},this.computeStyle=function(n,i,r){return Le(i)||(r=i,i=[]),t.style(i||[],V({},r,n||{}))}}const gS={__init__:["defaultRenderer"],defaultRenderer:["type",er],styles:["type",mS]};function At(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return n!==-1&&e.splice(n,1),n}function Mt(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 Ml(e,t){return!e||!t?-1:e.indexOf(t)}function sa(e,t){return!e||!t?-1:Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function kl(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=sa(e,t);return Math.abs(r/o)<=i}var yS=2;function Di(e,t){var n=Array.from(arguments).flat();const i={x:"v",y:"h"};for(const[r,o]of Object.entries(i))if(vS(r,n))return o;return!1}function vS(e,t){const n=t[0];return Ar(t,function(i){return Math.abs(n[e]-i[e])<=yS})}function am(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 Ol(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}var bS=/,?([a-z]),?/gi,sm=parseFloat,Bt=Math,tr=Bt.PI,yi=Bt.min,vi=Bt.max,cm=Bt.pow,nr=Bt.abs,xS=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/ig,_S=/(-?\d*\.?\d*(?:e[-+]?\d+)?)[\s]*,?[\s]*/ig,um=Array.isArray||function(e){return e instanceof Array};function wS(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ES(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 SS(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 wS(r,i)?(ES(o,i),r[i]):(o.length>=1e3&&delete r[o.shift()],o.push(i),r[i]=e(...arguments),r[i])}return t}function RS(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(xS,function(i,r,o){var a=[],s=r.toLowerCase();for(o.replace(_S,function(c,u){u&&a.push(+u)}),s=="m"&&a.length>2&&(n.push([r,...a.splice(0,2)]),s="l",r=r=="m"?"l":"L");a.length>=t[s]&&(n.push([r,...a.splice(0,t[s])]),!!t[s]););}),n.toString=Ll,n}function CS(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 PS(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 Dl(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 Ll(){return this.join(",").replace(bS,"$1")}function AS(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=Ll,t}function lm(e,t,n,i,r,o,a,s,c){var u=1-c,l=cm(u,3),f=cm(u,2),p=c*c,d=p*c,m=l*e+f*3*c*n+u*3*c*c*r+d*a,h=l*t+f*3*c*i+u*3*c*c*o+d*s;return{x:Bs(m),y:Bs(h)}}function pm(e){var t=LS(...e);return Dl(t.x0,t.y0,t.x1-t.x0,t.y1-t.y0)}function ir(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function TS(e,t){return e=Dl(e),t=Dl(t),ir(t,e.x,e.y)||ir(t,e.x2,e.y)||ir(t,e.x,e.y2)||ir(t,e.x2,e.y2)||ir(e,t.x,t.y)||ir(e,t.x2,t.y)||ir(e,t.x,t.y2)||ir(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 fm(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 dm(e,t,n,i,r,o,a,s,c){c==null&&(c=1),c=c>1?1:c<0?0:c;for(var u=c/2,l=12,f=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],p=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],d=0,m=0;m<l;m++){var h=u*f[m]+u,g=fm(h,e,n,r,a),y=fm(h,t,i,o,s),v=g*g+y*y;d+=p[m]*Bt.sqrt(v)}return u*d}function MS(e,t,n,i,r,o,a,s){if(!(vi(e,n)<yi(r,a)||yi(e,n)>vi(r,a)||vi(t,i)<yi(o,s)||yi(t,i)>vi(o,s))){var c=(e*i-t*n)*(r-a)-(e-n)*(r*s-o*a),u=(e*i-t*n)*(o-s)-(t-i)*(r*s-o*a),l=(e-n)*(o-s)-(t-i)*(r-a);if(l){var f=Bs(c/l),p=Bs(u/l),d=+f.toFixed(2),m=+p.toFixed(2);if(!(d<+yi(e,n).toFixed(2)||d>+vi(e,n).toFixed(2)||d<+yi(r,a).toFixed(2)||d>+vi(r,a).toFixed(2)||m<+yi(t,i).toFixed(2)||m>+vi(t,i).toFixed(2)||m<+yi(o,s).toFixed(2)||m>+vi(o,s).toFixed(2)))return{x:f,y:p}}}}function Bs(e){return Math.round(e*1e11)/1e11}function kS(e,t,n){var i=pm(e),r=pm(t);if(!TS(i,r))return[];var o=dm(...e),a=dm(...t),s=mm(e)?1:~~(o/5)||1,c=mm(t)?1:~~(a/5)||1,u=new Array(s+1),l=new Array(c+1),f={},p=[],d,m;for(d=0;d<s+1;d++){var h=lm(...e,d/s);u[d]={x:h.x,y:h.y,t:d/s}}for(d=0;d<c+1;d++)h=lm(...t,d/c),l[d]={x:h.x,y:h.y,t:d/c};for(d=0;d<s;d++)for(m=0;m<c;m++){var g=u[d],y=u[d+1],v=l[m],b=l[m+1],x=nr(y.x-g.x)<.01?"y":"x",C=nr(b.x-v.x)<.01?"y":"x",P=MS(g.x,g.y,y.x,y.y,v.x,v.y,b.x,b.y),D;if(P){if(D=P.x.toFixed(9)+"#"+P.y.toFixed(9),f[D])continue;f[D]=!0;var T=g.t+nr((P[x]-g[x])/(y[x]-g[x]))*(y.t-g.t),I=v.t+nr((P[C]-v[C])/(b[C]-v[C]))*(b.t-v.t);T>=0&&T<=1&&I>=0&&I<=1&&p.push({x:P.x,y:P.y,t1:T,t2:I})}}return p}function hm(e,t,n){e=vm(e),t=vm(t);for(var i,r,o,a,s,c,u,l,f,p,d=n?0:[],m=0,h=e.length;m<h;m++){var g=e[m];if(g[0]=="M")i=s=g[1],r=c=g[2];else{g[0]=="C"?(f=[i,r,...g.slice(1)],i=f[6],r=f[7]):(f=[i,r,i,r,s,c,s,c],i=s,r=c);for(var y=0,v=t.length;y<v;y++){var b=t[y];if(b[0]=="M")o=u=b[1],a=l=b[2];else{b[0]=="C"?(p=[o,a,...b.slice(1)],o=p[6],a=p[7]):(p=[o,a,o,a,u,l,u,l],o=u,a=l);var x=kS(f,p);{for(var C=0,P=x.length;C<P;C++)x[C].segment1=m,x[C].segment2=y,x[C].bez1=f,x[C].bez2=p;d=d.concat(x)}}}}}return d}function OS(e){return um(e)&&um(e[0])}function DS(e){if(CS(e))return e;var t=new Array(e.length),n=0,i=0,r=0,o=0,a=0,s;e[0][0]=="M"&&(n=+e[0][1],i=+e[0][2],r=n,o=i,a++,t[0]=["M",n,i]);for(var c,u,l=a,f=e.length;l<f;l++){if(u=e[l],s=u[0],t[l]=c=new Array(u.length),s!=s.toUpperCase())switch(c[0]=s.toUpperCase(),c[0]){case"A":c[1]=u[1],c[2]=u[2],c[3]=u[3],c[4]=u[4],c[5]=u[5],c[6]=+u[6]+n,c[7]=+u[7]+i;break;case"V":c[1]=+u[1]+i;break;case"H":c[1]=+u[1]+n;break;case"M":r=+u[1]+n,o=+u[2]+i;default:for(var p=1,d=u.length;p<d;p++)c[p]=+u[p]+(p%2?n:i)}else for(var m=0,h=u.length;m<h;m++)c[m]=u[m];switch(s=s.toUpperCase(),c[0]){case"Z":n=+r,i=+o;break;case"H":n=c[1];break;case"V":i=c[1];break;case"M":r=c[c.length-2],o=c[c.length-1];default:n=c[c.length-2],i=c[c.length-1]}}return t.toString=Ll,t}function mm(e){return e[0]===e[2]&&e[1]===e[3]&&e[4]===e[6]&&e[5]===e[7]}function Ns(e,t,n,i){return[e,t,n,i,n,i]}function gm(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 ym(e,t,n,i,r,o,a,s,c,u){var l=tr*120/180,f=tr/180*(+r||0),p=[],d,m=SS(function(M,S,w){var z=M*Bt.cos(w)-S*Bt.sin(w),U=M*Bt.sin(w)+S*Bt.cos(w);return{x:z,y:U}});if(u)D=u[0],T=u[1],C=u[2],P=u[3];else{d=m(e,t,-f),e=d.x,t=d.y,d=m(s,c,-f),s=d.x,c=d.y;var h=(e-s)/2,g=(t-c)/2,y=h*h/(n*n)+g*g/(i*i);y>1&&(y=Bt.sqrt(y),n=y*n,i=y*i);var v=n*n,b=i*i,x=(o==a?-1:1)*Bt.sqrt(nr((v*b-v*g*g-b*h*h)/(v*g*g+b*h*h))),C=x*n*g/i+(e+s)/2,P=x*-i*h/n+(t+c)/2,D=Bt.asin(((t-P)/i).toFixed(9)),T=Bt.asin(((c-P)/i).toFixed(9));D=e<C?tr-D:D,T=s<C?tr-T:T,D<0&&(D=tr*2+D),T<0&&(T=tr*2+T),a&&D>T&&(D=D-tr*2),!a&&T>D&&(T=T-tr*2)}var I=T-D;if(nr(I)>l){var k=T,L=s,H=c;T=D+l*(a&&T>D?1:-1),s=C+n*Bt.cos(T),c=P+i*Bt.sin(T),p=ym(s,c,n,i,r,0,a,L,H,[T,k,C,P])}I=T-D;var ae=Bt.cos(D),ye=Bt.sin(D),We=Bt.cos(T),Fe=Bt.sin(T),q=Bt.tan(I/4),ue=4/3*n*q,oe=4/3*i*q,le=[e,t],ke=[e+ue*ye,t-oe*ae],W=[s+ue*Fe,c-oe*We],Y=[s,c];if(ke[0]=2*le[0]-ke[0],ke[1]=2*le[1]-ke[1],u)return[ke,W,Y].concat(p);p=[ke,W,Y].concat(p).join().split(",");for(var J=[],Te=0,dt=p.length;Te<dt;Te++)J[Te]=Te%2?m(p[Te-1],p[Te],f).y:m(p[Te],p[Te+1],f).x;return J}function LS(e,t,n,i,r,o,a,s){for(var c=[],u=[[],[]],l,f,p,d,m,h,g,y,v=0;v<2;++v){if(v==0?(f=6*e-12*n+6*r,l=-3*e+9*n-9*r+3*a,p=3*n-3*e):(f=6*t-12*i+6*o,l=-3*t+9*i-9*o+3*s,p=3*i-3*t),nr(l)<1e-12){if(nr(f)<1e-12)continue;d=-p/f,0<d&&d<1&&c.push(d);continue}g=f*f-4*p*l,y=Bt.sqrt(g),!(g<0)&&(m=(-f+y)/(2*l),0<m&&m<1&&c.push(m),h=(-f-y)/(2*l),0<h&&h<1&&c.push(h))}for(var b=c.length,x=b,C;b--;)d=c[b],C=1-d,u[0][b]=C*C*C*e+3*C*C*d*n+3*C*d*d*r+d*d*d*a,u[1][b]=C*C*C*t+3*C*C*d*i+3*C*d*d*o+d*d*d*s;return u[0][x]=e,u[1][x]=t,u[0][x+1]=a,u[1][x+1]=s,u[0].length=u[1].length=x+2,{x0:yi(...u[0]),y0:yi(...u[1]),x1:vi(...u[0]),y1:vi(...u[1])}}function vm(e){if(OS(e)||(e=RS(e)),PS(e))return e;for(var t=AS(DS(e)),n={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},i=function(p,d,m){var h,g;if(!p)return["C",d.x,d.y,d.x,d.y,d.x,d.y];switch(!(p[0]in{T:1,Q:1})&&(d.qx=d.qy=null),p[0]){case"M":d.X=p[1],d.Y=p[2];break;case"A":p=["C",...ym(d.x,d.y,...p.slice(1))];break;case"S":m=="C"||m=="S"?(h=d.x*2-d.bx,g=d.y*2-d.by):(h=d.x,g=d.y),p=["C",h,g,...p.slice(1)];break;case"T":m=="Q"||m=="T"?(d.qx=d.x*2-d.qx,d.qy=d.y*2-d.qy):(d.qx=d.x,d.qy=d.y),p=["C",...gm(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",...gm(d.x,d.y,p[1],p[2],p[3],p[4])];break;case"L":p=["C",...Ns(d.x,d.y,p[1],p[2])];break;case"H":p=["C",...Ns(d.x,d.y,p[1],d.y)];break;case"V":p=["C",...Ns(d.x,d.y,d.x,p[1])];break;case"Z":p=["C",...Ns(d.x,d.y,d.X,d.Y)];break}return p},r=function(p,d){if(p[d].length>7){p[d].shift();for(var m=p[d];m.length;)o[d]="A",p.splice(d++,0,["C",...m.splice(0,6)]);p.splice(d,1),u=t.length}},o=[],a="",s="",c=0,u=t.length;c<u;c++){t[c]&&(a=t[c][0]),a!="C"&&(o[c]=a,c&&(s=o[c-1])),t[c]=i(t[c],n,s),o[c]!="A"&&a=="C"&&(o[c]="C"),r(t,c);var l=t[c],f=l.length;n.x=l[f-2],n.y=l[f-1],n.bx=sm(l[f-4])||n.x,n.by=sm(l[f-3])||n.y}return t}function ct(e){return Yt(e)&&An(e,"waypoints")}function Ge(e){return Yt(e)&&An(e,"labelTarget")}function IS(e){return Yt(e)&&eo(e.parent)}function bm(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Li(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ae(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function $s(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function BS(e){return Li({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function NS(e){for(var t=e.waypoints,n=t.reduce(function(u,l,f){var p=t[f-1];if(p){var d=u[u.length-1],m=d&&d.endLength||0,h=jS(p,l);u.push({start:p,end:l,startLength:m,endLength:m+h,length:h})}return u},[]),i=n.reduce(function(u,l){return u+l.length},0),r=i/2,o=0,a=n[o];a.endLength<r;)a=n[++o];var s=(r-a.startLength)/a.length,c={x:a.start.x+(a.end.x-a.start.x)*s,y:a.start.y+(a.end.y-a.start.y)*s};return c}function Ie(e){return ct(e)?NS(e):BS(e)}function nn(e,t,n){n=n||0,Yt(n)||(n={x:n,y:n});var i=Ae(e),r=Ae(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=i.right+n.x<=r.left,u=o?"top":s?"bottom":null,l=c?"left":a?"right":null;return l&&u?u+"-"+l:l||u||"intersect"}function ca(e,t,n){var i=$S(e,t);return i.length===1||i.length===2&&sa(i[0],i[1])<1?Li(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}),Li(i[n?0:i.length-1])):null}function $S(e,t){return hm(e,t)}function FS(e){e=e.slice();for(var t=0,n,i,r;e[t];)n=e[t],i=e[t-1],r=e[t+1],sa(n,r)===0||kl(i,r,n)?e.splice(t,1):t++;return e}function jS(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Fs(e,t){return Math.round(e*t)/t}function xm(e){return Ne(e)?e+"px":e}function HS(e){for(;e.parent;)e=e.parent;return e}function zS(e){e=V({},{width:"100%",height:"100%"},e);const t=e.container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container djs-parent"),_n(n,{position:"relative",overflow:"hidden",width:xm(e.width),height:xm(e.height)}),t.appendChild(n),n}function _m(e,t,n){const i=Pe("g");Xe(i).add(t);const r=n!==void 0?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}const GS="base",wm=0,VS=1,WS={shape:["x","y","width","height"],connection:["waypoints"]};function Be(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._rootsIdx=0,this._layers={},this._planes=[],this._rootElement=null,this._focused=!1,this._init(e||{})}Be.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Be.prototype._init=function(e){const t=this._eventBus,n=this._container=zS(e),i=this._svg=Pe("svg");_e(i,{width:"100%",height:"100%"}),dn(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")}),je(n,i);const r=this._viewport=_m(i,"viewport");e.deferUpdate&&(this._viewboxChanged=zu(this._viewboxChanged,300)),this._restoreFocus=zu(this._restoreFocus,0),t.on("diagram.init",()=>{t.fire("canvas.init",{svg:i,viewport:r})}),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed","root.set"],()=>{delete this._cachedViewbox}),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Be.prototype._destroy=function(){this._restoreFocus.cancel(),this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});const e=this._container.parentNode;e&&e.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._planes,delete this._rootElement,delete this._viewport},Be.prototype._setFocused=function(e){e!=this._focused&&(this._focused=e,this._eventBus.fire("canvas.focus.changed",{focused:e}))},Be.prototype._clear=function(){this._elementRegistry.getAll().forEach(t=>{const n=rm(t);n==="root"?this.removeRootElement(t):this._removeElement(t,n)}),this._planes=[],this._rootElement=null,delete this._cachedViewbox},Be.prototype.focus=function(){this._svg.focus({preventScroll:!0}),this._setFocused(!0)},Be.prototype.restoreFocus=function(){this._restoreFocus()},Be.prototype._restoreFocus=function(){document.activeElement===document.body&&this.focus()},Be.prototype.isFocused=function(){return this._focused},Be.prototype.getDefaultLayer=function(){return this.getLayer(GS,wm)},Be.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");let n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),typeof t<"u"&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},Be.prototype._getChildIndex=function(e){return Tn(this._layers,function(t,n){return n.visible&&e>=n.index&&t++,t},0)},Be.prototype._createLayer=function(e,t){typeof t>"u"&&(t=VS);const n=this._getChildIndex(t);return{group:_m(this._viewport,"layer-"+e,n),index:t,visible:!0}},Be.prototype.showLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=this._viewport,i=t.group,r=t.index;if(t.visible)return i;const o=this._getChildIndex(r);return n.insertBefore(i,n.childNodes[o]||null),t.visible=!0,i},Be.prototype.hideLayer=function(e){if(!e)throw new Error("must specify a name");const t=this._layers[e];if(!t)throw new Error("layer <"+e+"> does not exist");const n=t.group;return t.visible&&(Gt(n),t.visible=!1),n},Be.prototype._removeLayer=function(e){const t=this._layers[e];t&&(delete this._layers[e],Gt(t.group))},Be.prototype.getActiveLayer=function(){const e=this._findPlaneForRoot(this.getRootElement());return e?e.layer:null},Be.prototype.findRoot=function(e){const t=this._resolveElements(e);let n;for(const i of t){const r=this._findPlaneForRoot(HS(i));if(!r||n&&r.rootElement!==n)return;n=r.rootElement}return n},Be.prototype.getRootElements=function(){return this._planes.map(function(e){return e.rootElement})},Be.prototype._findPlaneForRoot=function(e){return ft(this._planes,function(t){return t.rootElement===e})},Be.prototype._resolveElement=function(e){return typeof e=="string"?this._elementRegistry.get(e):e},Be.prototype._resolveElements=function(e){return Le(e)||(e=[e]),e.map(t=>this._resolveElement(t)).filter(Boolean)},Be.prototype.getContainer=function(){return this._container},Be.prototype._updateMarker=function(e,t,n){let i;e=this._resolveElement(e),e.markers=e.markers||new Set,i=this._elementRegistry._elements[e.id],i&&($([i.gfx,i.secondaryGfx],function(r){r&&(n?(e.markers.add(t),Xe(r).add(t)):(e.markers.delete(t),Xe(r).remove(t)))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Be.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Be.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Be.prototype.hasMarker=function(e,t){return e=this._resolveElement(e),e.markers?e.markers.has(t):!1},Be.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Be.prototype.getRootElement=function(){const e=this._rootElement;return e||this._planes.length?e:this.setRootElement(this.addRootElement(null))},Be.prototype.addRootElement=function(e){const t=this._rootsIdx++;e||(e={id:"__implicitroot_"+t,children:[],isImplicit:!0});const n=e.layer="root-"+t;this._ensureValid("root",e);const i=this.getLayer(n,wm);return this.hideLayer(n),this._addRoot(e,i),this._planes.push({rootElement:e,layer:i}),e},Be.prototype.removeRootElement=function(e){if(e=this._resolveElement(e),!!this._findPlaneForRoot(e))return this._removeRoot(e),this._removeLayer(e.layer),this._planes=this._planes.filter(function(n){return n.rootElement!==e}),this._rootElement===e&&(this._rootElement=null),e},Be.prototype.setRootElement=function(e){if(e===this._rootElement)return e;let t;if(!e)throw new Error("rootElement required");return t=this._findPlaneForRoot(e),t||(e=this.addRootElement(e)),this._setRoot(e),e},Be.prototype._removeRoot=function(e){const t=this._elementRegistry,n=this._eventBus;n.fire("root.remove",{element:e}),n.fire("root.removed",{element:e}),t.remove(e)},Be.prototype._addRoot=function(e,t){const n=this._elementRegistry,i=this._eventBus;i.fire("root.add",{element:e}),n.add(e,t),i.fire("root.added",{element:e,gfx:t})},Be.prototype._setRoot=function(e,t){const n=this._rootElement;n&&(this._elementRegistry.updateGraphics(n,null,!0),this.hideLayer(n.layer)),e&&(t||(t=this._findPlaneForRoot(e).layer),this._elementRegistry.updateGraphics(e,this._svg,!0),this.showLayer(e.layer)),this._rootElement=e,this._eventBus.fire("root.set",{element:e})},Be.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element <"+t.id+"> already exists");const n=WS[e];if(!Ar(n,function(r){return typeof t[r]<"u"}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Be.prototype._setParent=function(e,t,n){Mt(t.children,e,n),e.parent=t},Be.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();const r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);const a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},Be.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Be.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Be.prototype._removeElement=function(e,t){const n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e),!!e)return r.fire(t+".remove",{element:e}),i.remove(e),At(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Be.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Be.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Be.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Be.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Be.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Be.prototype.viewbox=function(e){if(e===void 0&&this._cachedViewbox)return structuredClone(this._cachedViewbox);const t=this._viewport,n=this.getSize();let i,r,o,a,s,c,u;if(e)this._changeViewbox(function(){s=Math.min(n.width/e.width,n.height/e.height);const l=this._svg.createSVGMatrix().scale(s).translate(-e.x,-e.y);ia(t,l)});else return o=this._rootElement?this.getActiveLayer():null,i=o&&o.getBBox()||{},a=ia(t),r=a?a.matrix:X1(),s=Fs(r.a,1e3),c=Fs(-r.e||0,1e3),u=Fs(-r.f||0,1e3),e=this._cachedViewbox={x:c?c/s:0,y:u?u/s:0,width:n.width/s,height:n.height/s,scale:s,inner:{width:i.width||0,height:i.height||0,x:i.x||0,y:i.y||0},outer:n},e;return e},Be.prototype.scroll=function(e){const t=this._viewport;let n=t.getCTM();return e&&this._changeViewbox(function(){e=V({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Em(t,n)}),{x:n.e,y:n.f}},Be.prototype.scrollToElement=function(e,t){let n=100;const i=this._resolveElements(e);if(!i.length)return;const r=this.findRoot(i);if(!r)return;r!==this.getRootElement()&&this.setRootElement(r);const o=i.filter(m=>m!=r);if(!o.length)return;t||(t={}),typeof t=="number"&&(n=t),t={top:t.top||n,right:t.right||n,bottom:t.bottom||n,left:t.left||n};const a=It(o),s=Ae(a),c=this.viewbox(),u=this.zoom();let l,f;c.y+=t.top/u,c.x+=t.left/u,c.width-=(t.right+t.left)/u,c.height-=(t.bottom+t.top)/u;const p=Ae(c);if(!(a.width<c.width&&a.height<c.height))l=a.x-c.x,f=a.y-c.y;else{const m=Math.max(0,s.right-p.right),h=Math.min(0,s.left-p.left),g=Math.max(0,s.bottom-p.bottom),y=Math.min(0,s.top-p.top);l=m||h,f=g||y}this.scroll({dx:-l*u,dy:-f*u})},Be.prototype.zoom=function(e,t){if(!e)return this.viewbox(e).scale;if(e==="fit-viewport")return this._fitViewport(t);let n,i;return this._changeViewbox(function(){typeof t!="object"&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),Fs(i.a,1e3)};function Em(e,t){const n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Be.prototype._fitViewport=function(e){const t=this.viewbox(),n=t.outer,i=t.inner;let r,o;return i.x>=0&&i.y>=0&&i.x+i.width<=n.width&&i.y+i.height<=n.height&&!e?o={x:0,y:0,width:Math.max(i.width+i.x,n.width),height:Math.max(i.height+i.y,n.height)}:(r=Math.min(1,n.width/i.width,n.height/i.height),o={x:i.x+(e?i.width/2-n.width/r/2:0),y:i.y+(e?i.height/2-n.height/r/2:0),width:n.width/r,height:n.height/r}),this.viewbox(o),this.viewbox(!1).scale},Be.prototype._setZoom=function(e,t){const n=this._svg,i=this._viewport,r=n.createSVGMatrix(),o=n.createSVGPoint();let a,s,c,u,l;c=i.getCTM();const f=c.a;return t?(a=V(o,t),s=a.matrixTransform(c.inverse()),u=r.translate(s.x,s.y).scale(1/f*e).translate(-s.x,-s.y),l=c.multiply(u)):l=r.scale(e),Em(this._viewport,l),l},Be.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Be.prototype.getAbsoluteBBox=function(e){const t=this.viewbox();let n;e.waypoints?n=this.getGraphics(e).getBBox():n=e;const i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale,o=n.width*t.scale,a=n.height*t.scale;return{x:i,y:r,width:o,height:a}},Be.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var mo="data-element-id";function Vn(e){this._elements={},this._eventBus=e}Vn.$inject=["eventBus"],Vn.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),_e(t,mo,i),n&&_e(n,mo,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Vn.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(_e(i.gfx,mo,""),i.secondaryGfx&&_e(i.secondaryGfx,mo,""),delete t[n])},Vn.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)},Vn.prototype.updateGraphics=function(e,t,n){var i=e.id||e,r=this._elements[i];return n?r.secondaryGfx=t:r.gfx=t,t&&_e(t,mo,i),t},Vn.prototype.get=function(e){var t;typeof e=="string"?t=e:t=e&&_e(e,mo);var n=this._elements[t];return n&&n.element},Vn.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Vn.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}},Vn.prototype.getAll=function(){return this.filter(function(e){return e})},Vn.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)})},Vn.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Vn.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 US(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 YS(e){return e.__refs_collection===!0}function qS(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)}function Sm(e,t,n){var i=US(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 KS(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 qn(e,t){if(!(this instanceof qn))return new qn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}qn.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?Sm(this,t,e):KS(this,t,e)},qn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return YS(n)||Sm(this,t,e),n},qn.prototype.ensureBound=function(e,t){qS(e,t)||this.bind(e,t)},qn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},qn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Il=new qn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Rm=new qn({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Cm=new qn({name:"attachers",collection:!0},{name:"host"}),Pm=new qn({name:"outgoing",collection:!0},{name:"source"}),Am=new qn({name:"incoming",collection:!0},{name:"target"});function go(){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)}}),Il.bind(this,"parent"),Rm.bind(this,"labels"),Pm.bind(this,"outgoing"),Am.bind(this,"incoming")}function ua(){go.call(this),Il.bind(this,"children"),Cm.bind(this,"host"),Cm.bind(this,"attachers")}xe(ua,go);function Tm(){go.call(this),Il.bind(this,"children")}xe(Tm,ua);function Mm(){ua.call(this),Rm.bind(this,"labelTarget")}xe(Mm,ua);function km(){go.call(this),Pm.bind(this,"source"),Am.bind(this,"target")}xe(km,go);var XS={connection:km,shape:ua,label:Mm,root:Tm};function ZS(e,t){var n=XS[e];if(!n)throw new Error("unknown type: <"+e+">");return V(new n,t)}function QS(e){return e instanceof go}function Ii(){this._uid=12}Ii.prototype.createRoot=function(e){return this.create("root",e)},Ii.prototype.createLabel=function(e){return this.create("label",e)},Ii.prototype.createShape=function(e){return this.create("shape",e)},Ii.prototype.createConnection=function(e){return this.create("connection",e)},Ii.prototype.create=function(e,t){return t=V({},t||{}),t.id||(t.id=e+"_"+this._uid++),ZS(e,t)};var js="__fn",Om=1e3,JS=Array.prototype.slice;function On(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}On.prototype.on=function(e,t,n,i){if(e=Le(e)?e:[e],qt(t)&&(i=n,n=t,t=Om),!Ne(t))throw new Error("priority must be a number");var r=n;i&&(r=Sn(n,i),r[js]=n[js]||n);var o=this;e.forEach(function(a){o._addListener(a,{priority:t,callback:r,next:null})})},On.prototype.once=function(e,t,n,i){var r=this;if(qt(t)&&(i=n,n=t,t=Om),!Ne(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[js]=n,this.on(e,t,o)},On.prototype.off=function(e,t){e=Le(e)?e:[e];var n=this;e.forEach(function(i){n._removeListener(i,t)})},On.prototype.createEvent=function(e){var t=new la;return t.init(e),t},On.prototype.fire=function(e,t){var n,i,r,o;if(o=JS.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 la?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}},On.prototype.handleError=function(e){return this.fire("error",{error:e})===!1},On.prototype._destroy=function(){this._listeners={}},On.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},On.prototype._invokeListener=function(e,t,n){var i;if(n.callback.__isTomb)return i;try{i=eR(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},On.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},On.prototype._getListeners=function(e){return this._listeners[e]},On.prototype._setListeners=function(e,t){this._listeners[e]=t},On.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[js]===t)&&(r?r.next=i:this._setListeners(e,i)),r=n,n=i};function la(){}la.prototype.stopPropagation=function(){this.cancelBubble=!0},la.prototype.preventDefault=function(){this.defaultPrevented=!0},la.prototype.init=function(e){V(this,e||{})};function eR(e,t){return e.apply(null,t)}function Ir(e){return e.childNodes[0]}function tR(e){return e.parentNode.childNodes[1]}function Hs(e,t,n,i,r){var o=na();o.setTranslate(t,n);var a=na();a.setRotate(i||0,0,0);var s=na();s.setScale(1,1),ia(e,[o,a,s])}function rn(e,t,n){var i=na();i.setTranslate(t,n),ia(e,i)}function Dm(e,t){var n=na();n.setRotate(t,0,0),ia(e,n)}function Wn(e,t){this._eventBus=e,this._elementRegistry=t}Wn.$inject=["eventBus","elementRegistry"],Wn.prototype._getChildrenContainer=function(e){var t=this._elementRegistry.getGraphics(e),n;return e.parent?(n=tR(t),n||(n=Pe("g"),Xe(n).add("djs-children"),je(t.parentNode,n))):n=t,n},Wn.prototype._clear=function(e){var t=Ir(e);return Ts(t),t},Wn.prototype._createContainer=function(e,t,n,i){var r=Pe("g");Xe(r).add("djs-group"),typeof n<"u"?nR(r,t,t.childNodes[n]):je(t,r);var o=Pe("g");Xe(o).add("djs-element"),Xe(o).add("djs-"+e),i&&Xe(o).add("djs-frame"),je(r,o);var a=Pe("g");return Xe(a).add("djs-visual"),je(o,a),o},Wn.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,om(t))},Wn.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry,i;i=Tn(e,function(r,o){return o.parent&&(r[o.parent.id]=o.parent),r},{}),$(i,function(r){var o=r.children;if(o){var a=t._getChildrenContainer(r),s=a.firstChild;$(o,function(c){var u=n.getGraphics(c).parentNode;u===s?s=s.nextSibling:a.insertBefore(u,s)})}})},Wn.prototype.drawShape=function(e,t,n={}){var i=this._eventBus;return i.fire("render.shape",{gfx:e,element:t,attrs:n})},Wn.prototype.getShapePath=function(e){var t=this._eventBus;return t.fire("render.getShapePath",e)},Wn.prototype.drawConnection=function(e,t,n={}){var i=this._eventBus;return i.fire("render.connection",{gfx:e,element:t,attrs:n})},Wn.prototype.getConnectionPath=function(e){var t=this._eventBus;return t.fire("render.getConnectionPath",e)},Wn.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if(e==="shape")this.drawShape(i,t),rn(n,t.x,t.y);else if(e==="connection")this.drawConnection(i,t);else throw new Error("unknown type: "+e);t.hidden?_e(n,"display","none"):_e(n,"display","block")}},Wn.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Gt(t.parentNode)};function nR(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}const iR={__depends__:[gS],__init__:["canvas"],canvas:["type",Be],elementRegistry:["type",Vn],elementFactory:["type",Ii],eventBus:["type",On],graphicsFactory:["type",Wn]};function rR(e){var t=new im(e);return t.init(),t}function oR(e){e=e||{};var t={config:["value",e]},n=[t,iR].concat(e.modules||[]);return rR(n)}function rr(e,t){this._injector=t||oR(e),this.get("eventBus").fire("diagram.init")}rr.prototype.get=function(e,t){return this._injector.get(e,t)},rr.prototype.invoke=function(e,t,n){return this._injector.invoke(e,t,n)},rr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},rr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};function hn(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}function Rn(e,t){return e.$instanceOf(t)}function aR(e){return ft(e.rootElements,function(t){return Rn(t,"bpmn:Process")||Rn(t,"bpmn:Collaboration")})}function sR(e){var t={},n=[],i={};function r(W,Y){return function(J){W(J,Y)}}function o(W){t[W.id]=W}function a(W){return t[W.id]}function s(W,Y){var J=W.gfx;if(J)throw new Error(`already rendered ${hn(W)}`);return e.element(W,i[W.id],Y)}function c(W,Y){return e.root(W,i[W.id],Y)}function u(W,Y){try{var J=i[W.id]&&s(W,Y);return o(W),J}catch(Te){l(Te.message,{element:W,error:Te}),console.error(`failed to import ${hn(W)}`,Te)}}function l(W,Y){e.error(W,Y)}var f=this.registerDi=function(Y){var J=Y.bpmnElement;J?i[J.id]?l(`multiple DI elements defined for ${hn(J)}`,{element:J}):i[J.id]=Y:l(`no bpmnElement referenced in ${hn(Y)}`,{element:Y})};function p(W){d(W.plane)}function d(W){f(W),$(W.planeElement,m)}function m(W){f(W)}this.handleDefinitions=function(Y,J){var Te=Y.diagrams;if(J&&Te.indexOf(J)===-1)throw new Error("diagram not part of <bpmn:Definitions />");if(!J&&Te&&Te.length&&(J=Te[0]),!J)throw new Error("no diagram to display");i={},p(J);var dt=J.plane;if(!dt)throw new Error(`no plane for ${hn(J)}`);var M=dt.bpmnElement;if(!M)if(M=aR(Y),M)l(`correcting missing bpmnElement on ${hn(dt)} to ${hn(M)}`),dt.bpmnElement=M,f(dt);else throw new Error("no process or collaboration to display");var S=c(M,dt);if(Rn(M,"bpmn:Process")||Rn(M,"bpmn:SubProcess"))g(M,S);else if(Rn(M,"bpmn:Collaboration"))le(M,S),y(Y.rootElements,S);else throw new Error(`unsupported bpmnElement for ${hn(dt)}: ${hn(M)}`);h(n)};var h=this.handleDeferred=function(){for(var Y;n.length;)Y=n.shift(),Y()};function g(W,Y){q(W,Y),I(W.ioSpecification,Y),T(W.artifacts,Y),o(W)}function y(W,Y){var J=Ue(W,function(Te){return!a(Te)&&Rn(Te,"bpmn:Process")&&Te.laneSets});J.forEach(r(g,Y))}function v(W,Y){u(W,Y)}function b(W,Y){$(W,r(v,Y))}function x(W,Y){u(W,Y)}function C(W,Y){u(W,Y)}function P(W,Y){u(W,Y)}function D(W,Y){u(W,Y)}function T(W,Y){$(W,function(J){Rn(J,"bpmn:Association")?n.push(function(){D(J,Y)}):D(J,Y)})}function I(W,Y){W&&($(W.dataInputs,r(C,Y)),$(W.dataOutputs,r(P,Y)))}var k=this.handleSubProcess=function(Y,J){q(Y,J),T(Y.artifacts,J)};function L(W,Y){var J=u(W,Y);Rn(W,"bpmn:SubProcess")&&k(W,J||Y),Rn(W,"bpmn:Activity")&&I(W.ioSpecification,Y),n.push(function(){$(W.dataInputAssociations,r(x,Y)),$(W.dataOutputAssociations,r(x,Y))})}function H(W,Y){u(W,Y)}function ae(W,Y){u(W,Y)}function ye(W,Y){n.push(function(){var J=u(W,Y);W.childLaneSet&&We(W.childLaneSet,J||Y),ke(W)})}function We(W,Y){$(W.lanes,r(ye,Y))}function Fe(W,Y){$(W,r(We,Y))}function q(W,Y){ue(W.flowElements,Y),W.laneSets&&Fe(W.laneSets,Y)}function ue(W,Y){$(W,function(J){Rn(J,"bpmn:SequenceFlow")?n.push(function(){H(J,Y)}):Rn(J,"bpmn:BoundaryEvent")?n.unshift(function(){L(J,Y)}):Rn(J,"bpmn:FlowNode")?L(J,Y):Rn(J,"bpmn:DataObject")||(Rn(J,"bpmn:DataStoreReference")||Rn(J,"bpmn:DataObjectReference")?ae(J,Y):l(`unrecognized flowElement ${hn(J)} in context ${hn(Y&&Y.businessObject)}`,{element:J,context:Y}))})}function oe(W,Y){var J=u(W,Y),Te=W.processRef;Te&&g(Te,J||Y)}function le(W,Y){$(W.participants,r(oe,Y)),n.push(function(){b(W.messageFlows,Y)}),T(W.artifacts,Y)}function ke(W){$(W.flowNodeRef,function(Y){var J=Y.get("lanes");J&&J.push(W)})}}function E(e,t){var n=ie(e);return n&&typeof n.$instanceOf=="function"&&n.$instanceOf(t)}function Ve(e,t){return qi(t,function(n){return E(e,n)})}function ie(e){return e&&e.businessObject||e}function Ze(e){return e&&e.di}function cR(e,t,n){var i,r,o,a,s=[];function c(u,l){var f={root:function(h,g){return i.add(h,g)},element:function(h,g,y){return i.add(h,g,y)},error:function(h,g){s.push({message:h,context:g})}},p=new sR(f);l=l||u.diagrams&&u.diagrams[0];var d=uR(u,l);if(!d)throw new Error("no diagram to display");$(d,function(h){p.handleDefinitions(u,h)});var m=l.plane.bpmnElement.id;o.setRootElement(o.findRoot(m+"_plane")||o.findRoot(m))}return new Promise(function(u,l){try{return i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("canvas"),r.fire("import.render.start",{definitions:t}),c(t,n),r.fire("import.render.complete",{error:a,warnings:s}),u({warnings:s})}catch(f){return f.warnings=s,l(f)}})}function uR(e,t){if(!(!t||!t.plane)){var n=t.plane.bpmnElement,i=n;!E(n,"bpmn:Process")&&!E(n,"bpmn:Collaboration")&&(i=lR(n));var r;E(i,"bpmn:Collaboration")?r=i:r=ft(e.rootElements,function(u){if(E(u,"bpmn:Collaboration"))return ft(u.participants,function(l){return l.processRef===i})});var o=[i];r&&(o=ln(r.participants,function(u){return u.processRef}),o.push(r));var a=Lm(o),s=[t],c=[n];return $(e.diagrams,function(u){if(u.plane){var l=u.plane.bpmnElement;a.indexOf(l)!==-1&&c.indexOf(l)===-1&&(s.push(u),c.push(l))}}),s}}function Lm(e){var t=[];return $(e,function(n){n&&(t.push(n),t=t.concat(Lm(n.flowElements)))}),t}function lR(e){for(var t=e;t;){if(E(t,"bpmn:Process"))return t;t=t.$parent}}var pR='<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>',Im=pR,Bm={verticalAlign:"middle"},Nm={color:"#404040"},fR={zIndex:"1001",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"},dR={width:"100%",height:"100%",background:"rgba(40,40,40,0.2)"},hR={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"},mR='<div class="bjs-powered-by-lightbox"><div class="backdrop"></div><div class="notice"><a href="https://bpmn.io" target="_blank" rel="noopener" class="link">'+Im+'</a><span>Web-based tooling for BPMN, DMN and forms powered by <a href="https://bpmn.io" target="_blank" rel="noopener">bpmn.io</a>.</span></div></div>',bi;function gR(){bi=yt(mR),_n(bi,fR),_n(at("svg",bi),Bm),_n(at(".backdrop",bi),dR),_n(at(".notice",bi),hR),_n(at(".link",bi),Nm,{margin:"15px 20px 15px 10px",alignSelf:"center"})}function yR(){bi||(gR(),kn.bind(bi,".backdrop","click",function(e){document.body.removeChild(bi)})),document.body.appendChild(bi)}const zs=5,$m="djs-outline-hidden";function wt(e){e=V({},bR,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),this._init(this._container,this._moddle,e),_R(this._container)}xe(wt,rr),wt.prototype.importXML=async function(t,n){const i=this;function r(a){return i.get("eventBus").createEvent(a)}let o=[];try{t=this._emit("import.parse.start",{xml:t})||t;let a;try{a=await this._moddle.fromXML(t,"bpmn:Definitions")}catch(p){throw this._emit("import.parse.complete",{error:p}),p}let s=a.rootElement;const c=a.references,u=a.warnings,l=a.elementsById;o=o.concat(u),s=this._emit("import.parse.complete",r({error:null,definitions:s,elementsById:l,references:c,warnings:o}))||s;const f=await this.importDefinitions(s,n);return o=o.concat(f.warnings),this._emit("import.done",{error:null,warnings:o}),{warnings:o}}catch(a){let s=a;throw o=o.concat(s.warnings||[]),Gs(s,o),s=vR(s),this._emit("import.done",{error:s,warnings:s.warnings}),s}},wt.prototype.importDefinitions=async function(t,n){return this._setDefinitions(t),{warnings:(await this.open(n)).warnings}},wt.prototype.open=async function(t){const n=this._definitions;let i=t;if(!n){const o=new Error("no XML imported");throw Gs(o,[]),o}if(typeof t=="string"&&(i=xR(n,t),!i)){const o=new Error("BPMNDiagram <"+t+"> not found");throw Gs(o,[]),o}try{this.clear()}catch(o){throw Gs(o,[]),o}const{warnings:r}=await cR(this,n,i);return{warnings:r}},wt.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},wt.prototype.saveSVG=async function(){this._emit("saveSVG.start");let t,n;try{const i=this.get("canvas"),r=i.getActiveLayer(),o=at(":scope > defs",i._svg),a=nm(r),s=o?"<defs>"+nm(o)+"</defs>":"",c=i.getContainer();_t(c).add($m);let u;try{u=r.getBBox()}finally{_t(c).remove($m)}const l=u.x-zs,f=u.y-zs,p=u.width+zs*2,d=u.height+zs*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="'+l+" "+f+" "+p+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},xt.prototype._setDefinitions=function(e){this._definitions=e},xt.prototype.getModules=function(){return this._modules},xt.prototype.clear=function(){this.getDefinitions()&&ir.prototype.clear.call(this)},xt.prototype.destroy=function(){ir.prototype.destroy.call(this),mi(this._container)},xt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},xt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},xt.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=ot(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},xt.prototype.getDefinitions=function(){return this._definitions},xt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},xt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=V(pi(n,["additionalModules"]),{canvas:V({},n.canvas,{container:e}),modules:a});ir.call(this,s),n&&n.container&&this.attachTo(n.container)},xt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},xt.prototype._createContainer=function(e){const t=mt('<div class="bjs-container"></div>');return bn(t,{width:Bm(e.width),height:Bm(e.height),position:e.position}),t},xt.prototype._createModdle=function(e){const t=V({},this._moddleExtensions,e.moddleExtensions);return new Nd(t)},xt.prototype._modules=[];function js(e,t){return e.warnings=t,e}function hR(e){const n=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return n&&(e.message="unparsable content <"+n[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+n[2]),e}const mR={width:"100%",height:"100%",position:"relative"};function Bm(e){return e+(Be(e)?"px":"")}function gR(e,t){return t&&pt(e.diagrams,function(n){return n.id===t})||null}function yR(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Om+"</a>",i=mt(n);bn(ot("svg",i),Dm),bn(i,Lm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),$e.bind(i,"click",function(r){dR(),r.preventDefault()})}function mo(e){xt.call(this,e),this.on("import.parse.complete",function(t){t.error||this._collectIds(t.definitions,t.elementsById)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}_e(mo,xt),mo.prototype._createModdle=function(e){var t=xt.prototype._createModdle.call(this,e);return t.ids=new hi([32,36,1]),t},mo.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 Ke(e,t){return E(e,"bpmn:CallActivity")?!1:E(e,"bpmn:SubProcess")?(t=t||Ze(e),t&&E(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):E(e,"bpmn:Participant")?!!ie(e).processRef:!0}function qt(e){if(!(!E(e,"bpmn:Participant")&&!E(e,"bpmn:Lane"))){var t=Ze(e).isHorizontal;return t===void 0?!0:t}}function vR(e){return e&&ie(e).isInterrupting!==!1}function fn(e){return e&&!!ie(e).triggeredByEvent}function go(e,t){var n=ie(e).eventDefinitions;return Yi(n,function(i){return E(i,t)})}function bR(e){return go(e,"bpmn:ErrorEventDefinition")}function xR(e){return go(e,"bpmn:EscalationEventDefinition")}function _R(e){return go(e,"bpmn:CompensateEventDefinition")}var Ir={width:90,height:20},Nm=15;function rr(e){return E(e,"bpmn:Event")||E(e,"bpmn:Gateway")||E(e,"bpmn:DataStoreReference")||E(e,"bpmn:DataObjectReference")||E(e,"bpmn:DataInput")||E(e,"bpmn:DataOutput")||E(e,"bpmn:SequenceFlow")||E(e,"bpmn:MessageFlow")||E(e,"bpmn:Group")}function Hs(e){return Ge(e.label)}function wR(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=ER(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-=Nm:a+=Nm,{x:a,y:s}}function ER(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 Dl(e){return e.waypoints?wR(e.waypoints):E(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Ir.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Ir.height/2}}function SR(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Ir.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Dl(t),i=Ir),V({x:n.x-i.width/2,y:n.y-i.height/2},i)}function $m(e){if(E(e,"bpmn:FlowElement")||E(e,"bpmn:Participant")||E(e,"bpmn:Lane")||E(e,"bpmn:SequenceFlow")||E(e,"bpmn:MessageFlow")||E(e,"bpmn:DataInput")||E(e,"bpmn:DataOutput"))return"name";if(E(e,"bpmn:TextAnnotation"))return"text";if(E(e,"bpmn:Group"))return"categoryValueRef"}function RR(e){var t=e.categoryValueRef;return t&&t.value||""}function Wn(e){var t=e.businessObject,n=$m(t);if(n)return n==="categoryValueRef"?RR(t):t[n]||""}function CR(e,t){var n=e.businessObject,i=$m(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function PR(e){return Ge(e)&&rr(e.labelTarget)}var yo=7;function Fm(e){let t=[];return N(e.incoming,n=>{E(n,"bpmn:Association")&&E(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),N(e.outgoing,n=>{E(n,"bpmn:Association")&&E(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function ua(e){const t=new Map;return N(Cl(e),n=>{N(Fm(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 Ll="hsl(225, 10%, 15%)",AR="white";function bi(e,t){return Yi(e.eventDefinitions,function(n){return n.$type===t})}function TR(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function MR(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function qe(e,t,n){var i=Ze(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||AR}function ge(e,t,n){var i=Ze(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Ll}function la(e,t,n,i){var r=Ze(e),o=r.get("label");return i||o&&o.get("color:color")||t||ge(e,n)}function jm(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 Or(r)}function Il(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 Or(a)}function kR(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 Or(s)}function OR(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 Or(o)}function pa(e,t={}){return{width:qn(e,t),height:On(e,t)}}function qn(e,t={}){return Pn(t,"width")?t.width:e.width}function On(e,t={}){return Pn(t,"height")?t.height:e.height}var DR=new hi,LR=10,zs=3,IR=1.5,Gs=10,BR=4,vo=.95,NR=1,$R=.25;function Br(e,t,n,i,r,o,a){ki.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(M){return n.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Ll,strokeWidth:2,fill:"white"})}function f(M){return n.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Ll,strokeWidth:2})}function p(M,S){var{ref:w={x:0,y:0},scale:z=1,element:U,parentGfx:Q=r._svg}=S,Ee=Pe("marker",{id:M,viewBox:"0 0 20 20",refX:w.x,refY:w.y,markerWidth:20*z,markerHeight:20*z,orient:"auto"});je(Ee,U);var ze=ot(":scope > defs",Q);ze||(ze=Pe("defs"),je(Q,ze)),je(ze,Ee)}function d(M,S,w,z){var U=DR.nextPrefixed("marker-");return m(M,U,S,w,z),"url(#"+U+")"}function m(M,S,w,z,U){if(w==="sequenceflow-end"){var Q=Pe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:U,stroke:U,strokeWidth:1})});p(S,{element:Q,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(w==="messageflow-start"){var Ee=Pe("circle",{cx:6,cy:6,r:3.5,...l({fill:z,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(S,{element:Ee,ref:{x:6,y:6},parentGfx:M})}if(w==="messageflow-end"){var ze=Pe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:z,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(S,{element:ze,ref:{x:8.5,y:5},parentGfx:M})}if(w==="association-start"){var et=Pe("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(S,{element:et,ref:{x:1,y:10},scale:.5,parentGfx:M})}if(w==="association-end"){var Pt=Pe("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(S,{element:Pt,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(w==="conditional-flow-marker"){var it=Pe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:z,stroke:U})});p(S,{element:it,ref:{x:-1,y:10},scale:.5,parentGfx:M})}if(w==="conditional-default-flow-marker"){var St=Pe("path",{d:"M 6 4 L 10 16",...l({stroke:U,fill:"none"})});p(S,{element:St,ref:{x:0,y:10},scale:.5,parentGfx:M})}}function h(M,S,w,z,U={}){Wt(z)&&(U=z,z=0),z=z||0,U=l(U);var Q=S/2,Ee=w/2,ze=Pe("circle",{cx:Q,cy:Ee,r:Math.round((S+w)/4-z),...U});return je(M,ze),ze}function g(M,S,w,z,U,Q){Wt(U)&&(Q=U,U=0),U=U||0,Q=l(Q);var Ee=Pe("rect",{x:U,y:U,width:S-U*2,height:w-U*2,rx:z,ry:z,...Q});return je(M,Ee),Ee}function y(M,S,w,z){var U=S/2,Q=w/2,Ee=[{x:U,y:0},{x:S,y:Q},{x:U,y:w},{x:0,y:Q}],ze=Ee.map(function(Pt){return Pt.x+","+Pt.y}).join(" ");z=l(z);var et=Pe("polygon",{...z,points:ze});return je(M,et),et}function v(M,S,w,z){w=f(w);var U=na(S,w,z);return je(M,U),U}function b(M,S,w){return v(M,S,w,5)}function x(M,S,w){w=f(w);var z=Pe("path",{...w,d:S});return je(M,z),z}function C(M,S,w,z){return x(S,w,V({"data-marker":M},z))}function P(M){return ft[M]}function O(M){return function(S,w,z){return P(M)(S,w,z)}}var A={"bpmn:MessageEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.235,my:.315}}),Q=z?ge(S,c,w.stroke):qe(S,s,w.fill),Ee=z?qe(S,s,w.fill):ge(S,c,w.stroke),ze=x(M,U,{fill:Q,stroke:Ee,strokeWidth:1});return ze},"bpmn:TimerEventDefinition":function(M,S,w={}){var z=w.width||S.width,U=w.height||S.height,Q=w.width?1:2,Ee=h(M,z,U,.2*U,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:Q}),ze=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:z,containerHeight:U,position:{mx:.5,my:.5}});x(M,ze,{stroke:ge(S,c,w.stroke),strokeWidth:Q});for(var et=0;et<12;et++){var Pt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:z,containerHeight:U,position:{mx:.5,my:.5}}),it=z/2,St=U/2;x(M,Pt,{strokeWidth:1,stroke:ge(S,c,w.stroke),transform:"rotate("+et*30+","+St+","+it+")"})}return Ee},"bpmn:EscalationEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.5,my:.2}}),Q=z?ge(S,c,w.stroke):qe(S,s,w.fill);return x(M,U,{fill:Q,stroke:ge(S,c,w.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(M,S,w={}){var z=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.5,my:.222}});return x(M,z,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.57,my:.263}}),Q=z?ge(S,c,w.stroke):qe(S,s,w.fill);return x(M,U,{fill:Q,stroke:ge(S,c,w.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.2,my:.722}}),Q=z?ge(S,c,w.stroke):qe(S,s,w.fill);return x(M,U,{fill:Q,stroke:ge(S,c,w.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.638,my:-.055}}),Q=z?ge(S,c,w.stroke):"none",Ee=x(M,U,{fill:Q,stroke:ge(S,c,w.stroke),strokeWidth:1});return Mm(Ee,45),Ee},"bpmn:CompensateEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.22,my:.5}}),Q=z?ge(S,c,w.stroke):qe(S,s,w.fill);return x(M,U,{fill:Q,stroke:ge(S,c,w.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.5,my:.2}}),Q=z?ge(S,c,w.stroke):qe(S,s,w.fill);return x(M,U,{strokeWidth:1,fill:Q,stroke:ge(S,c,w.stroke)})},"bpmn:MultipleEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.211,my:.36}}),Q=z?ge(S,c,w.stroke):qe(S,s,w.fill);return x(M,U,{fill:Q,stroke:ge(S,c,w.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(M,S,w={}){var z=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.458,my:.194}});return x(M,z,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(M,S,w={}){var z=h(M,S.width,S.height,8,{fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke),strokeWidth:4});return z}};function I(M,S,w={},z){var U=ie(M),Q=TR(U),Ee=z||M;return U.get("eventDefinitions")&&U.get("eventDefinitions").length>1?U.get("parallelMultiple")?A["bpmn:ParallelMultipleEventDefinition"](S,Ee,w,Q):A["bpmn:MultipleEventDefinition"](S,Ee,w,Q):bi(U,"bpmn:MessageEventDefinition")?A["bpmn:MessageEventDefinition"](S,Ee,w,Q):bi(U,"bpmn:TimerEventDefinition")?A["bpmn:TimerEventDefinition"](S,Ee,w,Q):bi(U,"bpmn:ConditionalEventDefinition")?A["bpmn:ConditionalEventDefinition"](S,Ee,w,Q):bi(U,"bpmn:SignalEventDefinition")?A["bpmn:SignalEventDefinition"](S,Ee,w,Q):bi(U,"bpmn:EscalationEventDefinition")?A["bpmn:EscalationEventDefinition"](S,Ee,w,Q):bi(U,"bpmn:LinkEventDefinition")?A["bpmn:LinkEventDefinition"](S,Ee,w,Q):bi(U,"bpmn:ErrorEventDefinition")?A["bpmn:ErrorEventDefinition"](S,Ee,w,Q):bi(U,"bpmn:CancelEventDefinition")?A["bpmn:CancelEventDefinition"](S,Ee,w,Q):bi(U,"bpmn:CompensateEventDefinition")?A["bpmn:CompensateEventDefinition"](S,Ee,w,Q):bi(U,"bpmn:TerminateEventDefinition")?A["bpmn:TerminateEventDefinition"](S,Ee,w,Q):null}var k={ParticipantMultiplicityMarker:function(M,S,w={}){var z=qn(S,w),U=On(S,w),Q=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:z,containerHeight:U,position:{mx:(z/2-6)/z,my:(U-15)/U}});C("participant-multiplicity",M,Q,{strokeWidth:2,fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke)})},SubProcessMarker:function(M,S,w={}){var z=g(M,14,14,0,{strokeWidth:1,fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke)});tn(z,S.width/2-7.5,S.height-20);var U=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:S.width,containerHeight:S.height,position:{mx:(S.width/2-7.5)/S.width,my:(S.height-20)/S.height}});C("sub-process",M,U,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke)})},ParallelMarker:function(M,S,w){var z=qn(S,w),U=On(S,w),Q=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:z,containerHeight:U,position:{mx:(z/2+w.parallel)/z,my:(U-20)/U}});C("parallel",M,Q,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke)})},SequentialMarker:function(M,S,w){var z=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:(S.width/2+w.seq)/S.width,my:(S.height-19)/S.height}});C("sequential",M,z,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke)})},CompensationMarker:function(M,S,w){var z=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:(S.width/2+w.compensation)/S.width,my:(S.height-13)/S.height}});C("compensation",M,z,{strokeWidth:1,fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke)})},LoopMarker:function(M,S,w){var z=qn(S,w),U=On(S,w),Q=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:z,containerHeight:U,position:{mx:(z/2+w.loop)/z,my:(U-7)/U}});C("loop",M,Q,{strokeWidth:1.5,fill:"none",stroke:ge(S,c,w.stroke),strokeMiterlimit:.5})},AdhocMarker:function(M,S,w){var z=qn(S,w),U=On(S,w),Q=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:z,containerHeight:U,position:{mx:(z/2+w.adhoc)/z,my:(U-15)/U}});C("adhoc",M,Q,{strokeWidth:1,fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke)})}};function D(M,S,w,z){k[M](S,w,z)}function H(M,S,w=[],z={}){z={fill:z.fill,stroke:z.stroke,width:qn(S,z),height:On(S,z)};var U=ie(S),Q=w.includes("SubProcessMarker");Q?z={...z,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:z={...z,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},U.get("isForCompensation")&&w.push("CompensationMarker"),E(U,"bpmn:AdHocSubProcess")&&(w.push("AdhocMarker"),Q||V(z,{compensation:z.compensation-18}));var Ee=U.get("loopCharacteristics"),ze=Ee&&Ee.get("isSequential");Ee&&(V(z,{compensation:z.compensation-18}),w.includes("AdhocMarker")&&V(z,{seq:-23,loop:-18,parallel:-24}),ze===void 0&&w.push("LoopMarker"),ze===!1&&w.push("ParallelMarker"),ze===!0&&w.push("SequentialMarker")),w.includes("CompensationMarker")&&w.length===1&&V(z,{compensation:-8}),N(w,function(et){D(et,M,S,z)})}function ae(M,S,w={}){w=V({size:{width:100}},w);var z=o.createText(S||"",w);return Xe(z).add("djs-label"),je(M,z),z}function ye(M,S,w,z={}){var U=ie(S),Q=pa({x:S.x,y:S.y,width:S.width,height:S.height},z);return ae(M,U.name,{align:w,box:Q,padding:7,style:{fill:la(S,u,c,z.stroke)}})}function We(M,S,w={}){var z={width:S.width,height:S.height,x:S.width/2+S.x,y:S.height/2+S.y};return ae(M,Wn(S),{box:z,style:V({},o.getExternalStyle(),{fill:la(S,u,c,w.stroke)})})}function Fe(M,S,w,z={}){var U=qt(w),Q=ae(M,S,{box:{height:30,width:U?On(w,z):qn(w,z)},align:"center-middle",style:{fill:la(w,u,c,z.stroke)}});if(U){var Ee=-1*On(w,z);$s(Q,0,-Ee,270)}}function q(M,S,w={}){var{width:z,height:U}=pa(S,w);return g(M,z,U,Gs,{...w,fill:qe(S,s,w.fill),fillOpacity:vo,stroke:ge(S,c,w.stroke)})}function ue(M,S,w={}){var z=ie(S),U=qe(S,s,w.fill),Q=ge(S,c,w.stroke);return(z.get("associationDirection")==="One"||z.get("associationDirection")==="Both")&&(w.markerEnd=d(M,"association-end",U,Q)),z.get("associationDirection")==="Both"&&(w.markerStart=d(M,"association-start",U,Q)),w=Qe(w,["markerStart","markerEnd"]),b(M,S.waypoints,{...w,stroke:Q,strokeDasharray:"0, 5"})}function oe(M,S,w={}){var z=qe(S,s,w.fill),U=ge(S,c,w.stroke),Q=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.474,my:.296}}),Ee=x(M,Q,{fill:z,fillOpacity:vo,stroke:U}),ze=ie(S);if(MR(ze)){var et=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.33,my:(S.height-18)/S.height}});x(M,et,{strokeWidth:2,fill:z,stroke:U})}return Ee}function le(M,S,w={}){return h(M,S.width,S.height,{fillOpacity:vo,...w,fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke)})}function Me(M,S,w={}){return y(M,S.width,S.height,{fill:qe(S,s,w.fill),fillOpacity:vo,stroke:ge(S,c,w.stroke)})}function W(M,S,w={}){var z=g(M,qn(S,w),On(S,w),0,{fill:qe(S,s,w.fill),fillOpacity:w.fillOpacity||vo,stroke:ge(S,c,w.stroke),strokeWidth:1.5}),U=ie(S);if(E(U,"bpmn:Lane")){var Q=U.get("name");Fe(M,Q,S,w)}return z}function Y(M,S,w={}){var z=q(M,S,w),U=Ke(S);if(fn(S)&&(we(z,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!U)){var Q=ie(S).flowElements||[],Ee=Q.filter(ze=>E(ze,"bpmn:StartEvent"));Ee.length===1&&J(Ee[0],M,w,S)}return ye(M,S,U?"center-top":"center-middle",w),U?H(M,S,void 0,w):H(M,S,["SubProcessMarker"],w),z}function J(M,S,w,z){var U=22,Q={fill:qe(z,s,w.fill),stroke:ge(z,c,w.stroke),width:U,height:U},Ee=ie(M).isInterrupting,ze=Ee?0:3,et=Ee?1:1.2,Pt=20,it=(U-Pt)/2,St="translate("+it+","+it+")";h(S,Pt,Pt,{fill:Q.fill,stroke:Q.stroke,strokeWidth:et,strokeDasharray:ze,transform:St}),I(M,S,Q,z)}function Te(M,S,w={}){var z=q(M,S,w);return ye(M,S,"center-middle",w),H(M,S,void 0,w),z}var ft=this.handlers={"bpmn:AdHocSubProcess":function(M,S,w={}){return Ke(S)?w=Qe(w,["fill","stroke","width","height"]):w=Qe(w,["fill","stroke"]),Y(M,S,w)},"bpmn:Association":function(M,S,w={}){return w=Qe(w,["fill","stroke"]),ue(M,S,w)},"bpmn:BoundaryEvent":function(M,S,w={}){var{renderIcon:z=!0}=w;w=Qe(w,["fill","stroke"]);var U=ie(S),Q=U.get("cancelActivity");w={strokeWidth:1.5,fill:qe(S,s,w.fill),fillOpacity:NR,stroke:ge(S,c,w.stroke)},Q||(w.strokeDasharray="6");var Ee=le(M,S,w);return h(M,S.width,S.height,zs,{...w,fill:"none"}),z&&I(S,M,w),Ee},"bpmn:BusinessRuleTask":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Te(M,S,w),U=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),Q=x(M,U);we(Q,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1});var Ee=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),ze=x(M,Ee);return we(ze,{fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke),strokeWidth:1}),z},"bpmn:CallActivity":function(M,S,w={}){return w=Qe(w,["fill","stroke"]),Y(M,S,{strokeWidth:5,...w})},"bpmn:ComplexGateway":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Me(M,S,w),U=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:S.width,containerHeight:S.height,position:{mx:.46,my:.26}});return x(M,U,{fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke),strokeWidth:1}),z},"bpmn:DataInput":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=i.getRawPath("DATA_ARROW"),U=oe(M,S,w);return x(M,z,{fill:"none",stroke:ge(S,c,w.stroke),strokeWidth:1}),U},"bpmn:DataInputAssociation":function(M,S,w={}){return w=Qe(w,["fill","stroke"]),ue(M,S,{...w,markerEnd:d(M,"association-end",qe(S,s,w.fill),ge(S,c,w.stroke))})},"bpmn:DataObject":function(M,S,w={}){return w=Qe(w,["fill","stroke"]),oe(M,S,w)},"bpmn:DataObjectReference":O("bpmn:DataObject"),"bpmn:DataOutput":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=i.getRawPath("DATA_ARROW"),U=oe(M,S,w);return x(M,z,{strokeWidth:1,fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke)}),U},"bpmn:DataOutputAssociation":function(M,S,w={}){return w=Qe(w,["fill","stroke"]),ue(M,S,{...w,markerEnd:d(M,"association-end",qe(S,s,w.fill),ge(S,c,w.stroke))})},"bpmn:DataStoreReference":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:0,my:.133}});return x(M,z,{fill:qe(S,s,w.fill),fillOpacity:vo,stroke:ge(S,c,w.stroke),strokeWidth:2})},"bpmn:EndEvent":function(M,S,w={}){var{renderIcon:z=!0}=w;w=Qe(w,["fill","stroke"]);var U=le(M,S,{...w,strokeWidth:4});return z&&I(S,M,w),U},"bpmn:EventBasedGateway":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=ie(S),U=Me(M,S,w);h(M,S.width,S.height,S.height*.2,{fill:qe(S,"none",w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1});var Q=z.get("eventGatewayType"),Ee=!!z.get("instantiate");function ze(){var Pt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:S.width,containerHeight:S.height,position:{mx:.36,my:.44}});x(M,Pt,{fill:"none",stroke:ge(S,c,w.stroke),strokeWidth:2})}if(Q==="Parallel"){var et=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:S.width,containerHeight:S.height,position:{mx:.474,my:.296}});x(M,et,{fill:"none",stroke:ge(S,c,w.stroke),strokeWidth:1})}else Q==="Exclusive"&&(Ee||h(M,S.width,S.height,S.height*.26,{fill:"none",stroke:ge(S,c,w.stroke),strokeWidth:1}),ze());return U},"bpmn:ExclusiveGateway":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Me(M,S,w),U=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:S.width,containerHeight:S.height,position:{mx:.32,my:.3}}),Q=Ze(S);return Q.get("isMarkerVisible")&&x(M,U,{fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke),strokeWidth:1}),z},"bpmn:Gateway":function(M,S,w={}){return w=Qe(w,["fill","stroke"]),Me(M,S,w)},"bpmn:Group":function(M,S,w={}){return w=Qe(w,["fill","stroke","width","height"]),g(M,S.width,S.height,Gs,{stroke:ge(S,c,w.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:qn(S,w),height:On(S,w)})},"bpmn:InclusiveGateway":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Me(M,S,w);return h(M,S.width,S.height,S.height*.24,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:2.5}),z},"bpmn:IntermediateEvent":function(M,S,w={}){var{renderIcon:z=!0}=w;w=Qe(w,["fill","stroke"]);var U=le(M,S,{...w,strokeWidth:1.5});return h(M,S.width,S.height,zs,{fill:"none",stroke:ge(S,c,w.stroke),strokeWidth:1.5}),z&&I(S,M,w),U},"bpmn:IntermediateCatchEvent":O("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":O("bpmn:IntermediateEvent"),"bpmn:Lane":function(M,S,w={}){return w=Qe(w,["fill","stroke","width","height"]),W(M,S,{...w,fillOpacity:$R})},"bpmn:ManualTask":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Te(M,S,w),U=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(M,U,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:.5}),z},"bpmn:MessageFlow":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=ie(S),U=Ze(S),Q=qe(S,s,w.fill),Ee=ge(S,c,w.stroke),ze=b(M,S.waypoints,{markerEnd:d(M,"messageflow-end",Q,Ee),markerStart:d(M,"messageflow-start",Q,Ee),stroke:Ee,strokeDasharray:"10, 11",strokeWidth:1.5});if(z.get("messageRef")){var et=ze.getPointAtLength(ze.getTotalLength()/2),Pt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:et.x,y:et.y}}),it={strokeWidth:1};U.get("messageVisibleKind")==="initiating"?(it.fill=Q,it.stroke=Ee):(it.fill=Ee,it.stroke=Q);var St=x(M,Pt,it),dn=z.get("messageRef"),Kt=dn.get("name"),dt=ae(M,Kt,{align:"center-top",fitBox:!0,style:{fill:Ee}}),Mt=St.getBBox(),on=dt.getBBox(),Vo=et.x-on.width/2,$n=et.y+Mt.height/2+LR;$s(dt,Vo,$n,0)}return ze},"bpmn:ParallelGateway":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Me(M,S,w),U=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:S.width,containerHeight:S.height,position:{mx:.46,my:.2}});return x(M,U,{fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke),strokeWidth:1}),z},"bpmn:Participant":function(M,S,w={}){w=Qe(w,["fill","stroke","width","height"]);var z=W(M,S,w),U=Ke(S),Q=qt(S),Ee=ie(S),ze=Ee.get("name");if(U){var et=Q?[{x:30,y:0},{x:30,y:On(S,w)}]:[{x:0,y:30},{x:qn(S,w),y:30}];v(M,et,{stroke:ge(S,c,w.stroke),strokeWidth:IR}),Fe(M,ze,S,w)}else{var Pt=pa(S,w);Q||(Pt.height=qn(S,w),Pt.width=On(S,w));var it=ae(M,ze,{box:Pt,align:"center-middle",style:{fill:la(S,u,c,w.stroke)}});if(!Q){var St=-1*On(S,w);$s(it,0,-St,270)}}return Ee.get("participantMultiplicity")&&D("ParticipantMultiplicityMarker",M,S,w),z},"bpmn:ReceiveTask":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=ie(S),U=Te(M,S,w),Q;return z.get("instantiate")?(h(M,28,28,20*.22,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1}),Q=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):Q=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(M,Q,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1}),U},"bpmn:ScriptTask":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Te(M,S,w),U=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(M,U,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1}),z},"bpmn:SendTask":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Te(M,S,w),U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(M,U,{fill:ge(S,c,w.stroke),stroke:qe(S,s,w.fill),strokeWidth:1}),z},"bpmn:SequenceFlow":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=qe(S,s,w.fill),U=ge(S,c,w.stroke),Q=b(M,S.waypoints,{markerEnd:d(M,"sequenceflow-end",z,U),stroke:U}),Ee=ie(S),{source:ze}=S;if(ze){var et=ie(ze);Ee.get("conditionExpression")&&E(et,"bpmn:Activity")&&we(Q,{markerStart:d(M,"conditional-flow-marker",z,U)}),et.get("default")&&(E(et,"bpmn:Gateway")||E(et,"bpmn:Activity"))&&et.get("default")===Ee&&we(Q,{markerStart:d(M,"conditional-default-flow-marker",z,U)})}return Q},"bpmn:ServiceTask":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Te(M,S,w);h(M,10,10,{fill:qe(S,s,w.fill),stroke:"none",transform:"translate(6, 6)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(M,U,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1}),h(M,10,10,{fill:qe(S,s,w.fill),stroke:"none",transform:"translate(11, 10)"});var Q=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(M,Q,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1}),z},"bpmn:StartEvent":function(M,S,w={}){var{renderIcon:z=!0}=w;w=Qe(w,["fill","stroke"]);var U=ie(S);U.get("isInterrupting")||(w={...w,strokeDasharray:"6"});var Q=le(M,S,w);return z&&I(S,M,w),Q},"bpmn:SubProcess":function(M,S,w={}){return Ke(S)?w=Qe(w,["fill","stroke","width","height"]):w=Qe(w,["fill","stroke"]),Y(M,S,w)},"bpmn:Task":function(M,S,w={}){return w=Qe(w,["fill","stroke"]),Te(M,S,w)},"bpmn:TextAnnotation":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var{width:z,height:U}=pa(S,w),Q=g(M,z,U,0,0,{fill:"none",stroke:"none"}),Ee=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:z,containerHeight:U,position:{mx:0,my:0}});x(M,Ee,{stroke:ge(S,c,w.stroke)});var ze=ie(S),et=ze.get("text")||"";return ae(M,et,{align:"left-top",box:pa(S,w),padding:yo,style:{fill:la(S,u,c,w.stroke)}}),Q},"bpmn:Transaction":function(M,S,w={}){Ke(S)?w=Qe(w,["fill","stroke","width","height"]):w=Qe(w,["fill","stroke"]);var z=Y(M,S,{strokeWidth:1.5,...w}),U=n.style(["no-fill","no-events"],{stroke:ge(S,c,w.stroke),strokeWidth:1.5}),Q=Ke(S);return Q||(w={}),g(M,qn(S,w),On(S,w),Gs-zs,zs,U),z},"bpmn:UserTask":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Te(M,S,w),U=15,Q=12,Ee=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:Q}});x(M,Ee,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:.5});var ze=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:Q}});x(M,ze,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:.5});var et=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:Q}});return x(M,et,{fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke),strokeWidth:.5}),z},label:function(M,S,w={}){return We(M,S,w)}};this._drawPath=x,this._renderer=P}_e(Br,ki),Br.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Br.prototype.canRender=function(e){return E(e,"bpmn:BaseElement")},Br.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Br.prototype.getShapePath=function(e){return Ge(e)?Il(e,BR):E(e,"bpmn:Event")?jm(e):E(e,"bpmn:Activity")?Il(e,Gs):E(e,"bpmn:Gateway")?kR(e):OR(e)};function Qe(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var FR=0,jR={width:150,height:50};function HR(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function zR(e){return Wt(e)?V({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Bl=null;function GR(){return Bl||(Bl=document.createElement("canvas").getContext("2d")),Bl}function VR(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(Hm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Hm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function WR(e,t){var n=GR();if(!n)return{width:0,height:0};n.font=VR(t),"letterSpacing"in n&&(n.letterSpacing=Hm(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 UR(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=WR(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return YR(e,r,i,o);r=KR(r,o.width,t)}}function YR(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}var zm="­";function qR(e,t){var n=e.split(/(\s|-|\u00AD)/g),i,r=[],o=0;if(n.length>1)for(;i=n.shift();)if(i.length+o<t)r.push(i),o+=i.length;else{(i==="-"||i===zm)&&r.pop();break}var a=r[r.length-1];return a&&a===zm&&(r[r.length-1]="-"),r.join("")}function KR(e,t,n){var i=Math.max(e.length*(n/t),1),r=qR(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Vs(e){this._config=V({},{size:jR,padding:FR,style:{},align:"center-top"},e||{})}Vs.prototype.createText=function(e,t){return this.layoutText(e,t).element},Vs.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Vs.prototype.layoutText=function(e,t){for(var n=V({},this._config.size,t.box),i=V({},this._config.style,t.style),r=HR(t.align||this._config.align),o=zR(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=XR(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(UR(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=An(u,function(g,y,v){return g+(s||y.height)},0)+o.top+o.bottom,p=An(u,function(g,y,v){return y.width>g?y.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||u[0].height)/4;var m=Pe("text");we(m,i),N(u,function(g){var y;switch(d+=s||g.height,r.horizontal){case"left":y=o.left;break;case"right":y=(a?p:l)-o.right-g.width;break;default:y=Math.max(((a?p:l)-g.width)/2+o.left,0)}var v=Pe("tspan");we(v,{x:y,y:d}),v.textContent=g.text,je(m,v)});var h={width:p,height:f};return{dimensions:h,element:m}};function XR(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var ZR=12,QR=1.2,JR=40;function Gm(e){var t=V({fontFamily:"Arial, sans-serif",fontSize:ZR,fontWeight:"normal",lineHeight:QR},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=V({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Vs({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Ir.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:yo});return{x:a.x,y:a.y,width:a.width,height:Math.max(JR,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,V({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Gm.$inject=["config.textRenderer"];function eC(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var f=rC(i.d,{mx:r,my:o,e:a});return f}}var tC=/\{([^{}]+)\}/g,nC=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function iC(e,t,n){var i=n;return t.replace(nC,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 rC(e,t){return String(e).replace(tC,function(n,i){return iC(n,i,t)})}const oC={__init__:["bpmnRenderer"],bpmnRenderer:["type",Br],textRenderer:["type",Gm],pathMap:["type",eC]};function aC(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const fa={translate:["value",aC]};function Ws(e,t,n){return V({id:e.id,type:e.$type,businessObject:e,di:t},n)}function sC(e,t,n){var i=e.waypoint;return!i||i.length<2?[Le(t),Le(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Vm(e,t,n){return new Error(`element ${pn(t)} referenced by ${pn(e)}#${n} not yet drawn`)}function Ii(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Ii.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Ii.prototype.add=function(e,t,n){var i,r,o;if(E(t,"bpmndi:BPMNPlane")){var a=E(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(Ws(e,t,a)),this._canvas.addRootElement(i)}else if(E(t,"bpmndi:BPMNShape")){var s=!Ke(e,t),c=uC(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(Ws(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),E(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),E(e,"bpmn:Lane")&&(o=0),E(e,"bpmn:DataStoreReference")&&(cC(n,Le(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(E(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(Ws(e,t,{hidden:r,source:l,target:f,waypoints:sC(t,l,f)})),E(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)&&Wn(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Ii.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 Vm(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Ii.prototype.addLabel=function(e,t,n){var i,r,o;return i=SR(t,n),r=Wn(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(Ws(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Wn(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)},Ii.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?Vm(e,i,t+"Ref"):new Error(`${pn(e)}#${t} Ref not specified`)},Ii.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Ii.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Ii.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function cC(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 uC(e){return E(e,"bpmn:Group")}const Wm={__depends__:[oC,{__depends__:[fa],bpmnImporter:["type",Ii]}]};function da(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 Nl(e){return Math.log(e)/Math.log(10)}var lC=1e3;function te(e){this._eventBus=e}te.$inject=["eventBus"];function pC(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}te.prototype.on=function(e,t,n,i,r,o){if((Ut(t)||Be(t))&&(o=r,r=i,i=n,n=t,t=null),Ut(n)&&(o=r,r=i,i=n,n=lC),Wt(r)&&(o=r,r=!1),!Ut(i))throw new Error("handlerFn must be a function");De(e)||(e=[e]);var a=this._eventBus;N(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?pC(i,o):i,o)})},te.prototype.canExecute=Bi("canExecute"),te.prototype.preExecute=Bi("preExecute"),te.prototype.preExecuted=Bi("preExecuted"),te.prototype.execute=Bi("execute"),te.prototype.executed=Bi("executed"),te.prototype.postExecute=Bi("postExecute"),te.prototype.postExecuted=Bi("postExecuted"),te.prototype.revert=Bi("revert"),te.prototype.reverted=Bi("reverted");function Bi(e){return function(n,i,r,o,a){(Ut(n)||Be(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var $l=["top","bottom","left","right"],Us=10;function Fl(e,t){te.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Hs(r)&&!at(r)){var o=hC(r);o&&i(r,o)}}function i(r,o){var a=Le(r),s=r.label,c=Le(s);if(s.parent){var u=Ae(r),l;switch(o){case"top":l={x:a.x,y:u.top-Us-s.height/2};break;case"left":l={x:u.left-Us-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Us+s.height/2};break;case"right":l={x:u.right+Us+s.width/2,y:a.y};break}var f=ci(l,c);t.moveShape(s,f)}}}_e(Fl,te),Fl.$inject=["eventBus","modeling"];function fC(e){var t=e.host,n=Le(e),i=en(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=$l.filter(function(a){return r.indexOf(a)===-1});return o}function dC(e){var t=Le(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return Um(t,i)});return n}function hC(e){var t=Le(e.label),n=Le(e),i=Um(n,t);if(mC(i)){var r=dC(e);if(e.host){var o=fC(e);r=r.concat(o)}var a=$l.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?en(e.label,e)!=="intersect"?void 0:i:a[0]}}function Um(e,t){return en(t,e,5)}function mC(e){return $l.indexOf(e)!==-1}function jl(e){te.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(E(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}_e(jl,te),jl.$inject=["eventBus"];var gC=1500;function Hl(e,t,n){e.invoke(te,this),this.preExecute("elements.delete",gC,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=Ue(r,u=>E(u,"bpmn:Participant")||E(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>E(u,"bpmn:Artifact"))),c=new Set;return N(o,u=>{const l=new Set(Jr(po(Array.from(s),Dt(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}_e(Hl,te),Hl.$inject=["injector","eventBus","canvas"];function zl(e,t){e.invoke(te,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ue(r.incoming.concat(r.outgoing),function(a){return E(a,"bpmn:Association")});N(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}_e(zl,te),zl.$inject=["injector","modeling"];function bo(e,t){for(Cn(t)&&(t=[t]);e=e.parent;)if(Ve(e,t))return e;return null}function Ym(e,t){var n=bo(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=bo(e,i),n)return qt(n);if(Ve(e,i))return qt(e);var r;for(r=ie(e);r&&!E(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ie(a);return s&&s.get("processRef")===r});return o?qt(o):!0}var qm=500;function Ys(e,t){t.invoke(te,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",qm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Km(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",qm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Km(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Ys.$inject=["bpmnReplace","injector"],_e(Ys,te),Ys.prototype._replaceShape=function(e,t){var n=yC(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function yC(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function Km(e,t){return!Ge(e)&&Ve(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Gl(e,t){te.call(this,e);function n(i){return Ue(i.attachers,function(r){return E(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);E(r,"bpmn:EventBasedGateway")&&E(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;E(r,"bpmn:Gateway")&&E(o,"bpmn:EventBasedGateway")&&N(o.outgoing,function(a){var s=a.target,c=n(s);E(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Gl.$inject=["eventBus","modeling"],_e(Gl,te);function Xm(e){return e.create("bpmn:Category")}function vC(e){return e.create("bpmn:CategoryValue")}function Zm(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=vC(e)),n.$parent||(n.$parent=Xm(e)),n}function bC(e,t,n){return Tt(t.get("categoryValue"),e),e.$parent=t,Tt(n.get("rootElements"),t),t.$parent=n,e}function xC(e){var t=e.$parent;return t&&(Ct(t.get("categoryValue"),e),e.$parent=null),e}function _C(e){var t=e.$parent;return t&&(Ct(t.get("rootElements"),e),e.$parent=null),e}var wC=500;function Vl(e,t,n){n.invoke(te,this);function i(c){return t.filter(function(u){return E(u,"bpmn:Group")&&!u.labelTarget}).map(ie).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var f=l.get("categoryValueRef");return f&&f.$parent===c})}function a(c,u){c&&u&&bC(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&_C(u),c&&!r(c,l)&&xC(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!E(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!E(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ie(u))},!0),this.executed(["shape.move","shape.resize"],wC,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var u=c.shape;c.categoryValue&&s(c.categoryValue,c.category,ie(u))},!0),this.executed("group.updateRefs",function(c){Qm(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){Qm(c).forEach(function(u){s(u.categoryValue,u.category,ie(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!E(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ie(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!E(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Vl.$inject=["bpmnjs","elementRegistry","injector"],_e(Vl,te);function Qm(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function Wl(e,t,n){te.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(g){const y=g.source,v=g.target;xo(y)&&ha(v)&&l(v)}function r(g){const y=g.connection,v=g.source,b=g.target;xo(v)&&qs(b)&&(u(b),p(v,[y]))}function o(g){const y=g.newTarget,v=g.oldSource,b=g.oldTarget;if(b!==y){const x=v;ha(b)&&l(b),xo(x)&&qs(y)&&u(y)}}function a(g){const{element:y}=g;ha(y)?(f(y),d(y)):qs(y)&&m(y)}function s(g){const{newData:y,oldShape:v}=g;if(xo(g.oldShape)&&y.eventDefinitionType!=="bpmn:CompensateEventDefinition"||y.type!=="bpmn:BoundaryEvent"){const b=v.outgoing.find(({target:x})=>ha(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!xo(g.oldShape)&&y.eventDefinitionType==="bpmn:CompensateEventDefinition"&&y.type==="bpmn:BoundaryEvent"){const b=v.outgoing.find(({target:x})=>qs(x));b&&b.target&&(g._connectionTarget=b.target),h(v)}}function c(g){const{_connectionTarget:y,newShape:v}=g;y&&t.connect(v,y)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function f(g){for(const y of g.incoming)n.canConnect(y.source,g)||t.removeConnection(y);for(const y of g.outgoing)n.canConnect(g,y.target)||t.removeConnection(y)}function p(g,y){g.outgoing.filter(x=>E(x,"bpmn:Association")).filter(x=>ha(x.target)&&!y.includes(x)).forEach(x=>t.removeConnection(x))}function d(g){const y=g.attachers.slice();y.length&&t.removeElements(y)}function m(g){const y=g.incoming.filter(v=>xo(v.source));t.removeElements(y)}function h(g){const y=g.outgoing.filter(v=>E(v,"bpmn:SequenceFlow"));t.removeElements(y)}}_e(Wl,te),Wl.$inject=["eventBus","modeling","bpmnRules"];function ha(e){const t=ie(e);return t&&t.get("isForCompensation")}function xo(e){return e&&E(e,"bpmn:BoundaryEvent")&&go(e,"bpmn:CompensateEventDefinition")}function qs(e){return e&&E(e,"bpmn:Activity")&&!fn(e)}function Ul(e){e.invoke(te,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;E(i,"bpmn:Lane")&&!E(r,"bpmn:Lane")&&(n.parent=bo(i,"bpmn:Participant"))})}Ul.$inject=["injector"],_e(Ul,te);function Yl(e,t){te.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(E(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}Yl.$inject=["eventBus","bpmnFactory"],_e(Yl,te);var ql=20,Kl=20,Jm=30,Ks=2e3;function Xl(e,t,n){te.call(this,t),t.on(["create.start","shape.move.start"],Ks,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!E(a,"bpmn:Participant")||!E(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(f){return!E(f,"bpmn:Group")&&!Ge(f)&&!at(f)});if(c.length){var u=Dt(c),l=EC(a,u);V(a,l),o.createConstraints=SC(a,u)}}}),t.on("create.start",Ks,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}E(a,"bpmn:Participant")&&E(s,"bpmn:Process")&&(t.on("element.hover",Ks,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return E(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Ks,function(r){var o=r.elements,a=r.parent,s=RC(o),c;s&&E(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ie(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;E(a,"bpmn:Participant")&&E(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=ie(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)&&ie(s).set("processRef",ie(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.processRef||o.processRef,c=r.shape,u=o.participant;a&&(!u||c===u)&&ie(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var u=a.children.slice();c?s===c&&n.moveElements(u,{x:0,y:0},c):n.moveElements(u,{x:0,y:0},s)}},!0)}Xl.$inject=["canvas","eventBus","modeling"],_e(Xl,te);function EC(e,t){t={width:t.width+ql*2+Jm,height:t.height+Kl*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 SC(e,t){return t=Ae(t),{bottom:t.top+e.height/2-Kl,left:t.right-e.width/2+ql,top:t.bottom-e.height/2+Kl,right:t.left+e.width/2-ql-Jm}}function RC(e){return pt(e,function(t){return E(t,"bpmn:Participant")})}var eg="__targetRef_placeholder";function Zl(e,t){te.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],tg(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],tg(o));function n(a,s,c){var u=a.get("dataInputAssociations");return pt(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=pt(c,function(l){return l.name===eg});return!u&&s&&(u=t.create("bpmn:Property",{name:eg}),Tt(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||Ct(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,f=l&&l.businessObject,p=s.newTarget,d=p&&p.businessObject,m=s.oldTarget||s.target,h=m&&m.businessObject,g=c.businessObject,y;h&&h!==f&&r(h,u),d&&d!==f&&r(d,u),f?(y=i(f,!0),g.targetRef=y):g.targetRef=null}}Zl.$inject=["eventBus","bpmnFactory"],_e(Zl,te);function tg(e){return function(t){var n=t.context,i=n.connection;if(E(i,"bpmn:DataInputAssociation"))return e(t)}}function Xs(e){this._bpmnUpdater=e}Xs.$inject=["bpmnUpdater"],Xs.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),[]},Xs.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 Ql(e,t,n,i){te.call(this,i),t.registerHandler("dataStore.updateContainment",Xs);function r(){return n.filter(function(s){return E(s,"bpmn:Participant")&&ie(s).processRef})[0]}function o(s){return s.children.filter(function(c){return E(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Ze(s),newSemanticParent:l.processRef||l,newDiParent:Ze(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;E(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(f){return E(f,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(f){return!E(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;E(u,"bpmn:DataStoreReference")&&u.type!=="label"&&E(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,f=u.parent;if(!E(l,"bpmn:Collaboration")&&E(u,"bpmn:DataStoreReference")&&u.type!=="label"&&E(f,"bpmn:Collaboration")){var p=E(l,"bpmn:Participant")?l:PC(l,"bpmn:Participant");a(u,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Ve(u,["bpmn:Participant","bpmn:SubProcess"])&&E(l,"bpmn:Collaboration")&&o(l).filter(function(f){return CC(f,u)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,f=o(u);f.forEach(function(p){E(l,"bpmn:Process")&&a(p,l)})})}Ql.$inject=["canvas","commandStack","elementRegistry","eventBus"],_e(Ql,te);function CC(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 PC(e,t){for(;e.parent;){if(E(e.parent,t))return e.parent;e=e.parent}}var Zs=Math.max,Qs=Math.min,AC=20;function ng(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function TC(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 MC(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 Js(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Be(r)&&(i=(/top|left/.test(e)?Qs:Zs)(i,r)),Be(o)&&(i=(/top|left/.test(e)?Zs:Qs)(i,o)),i}function kC(e,t){if(!t)return e;var n=Ae(e);return Is({top:Js("top",n,t),right:Js("right",n,t),bottom:Js("bottom",n,t),left:Js("left",n,t)})}function OC(e,t,n,i){var r=Ae(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?Ae(i):o,s={top:Qs(o.top,a.top),left:Qs(o.left,a.left),bottom:Zs(o.bottom,a.bottom),right:Zs(o.right,a.right)};return Is(s)}function ma(e,t){return typeof e<"u"?e:AC}function DC(e,t){var n,i,r,o;return typeof t=="object"?(n=ma(t.left),i=ma(t.right),r=ma(t.top),o=ma(t.bottom)):n=i=r=o=ma(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function LC(e){return!(e.waypoints||e.type==="label")}function ig(e,t){var n;if(e.length===void 0?n=Ue(e.children,LC):n=e,n.length)return DC(Dt(n),t)}var or=Math.abs;function IC(e,t){return ng(Ae(t),Ae(e))}var BC=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Kn=30;function ec(e,t){return t=t||[],e.children.filter(function(n){E(n,"bpmn:Lane")&&(ec(n,t),t.push(n))}),t}function ar(e){return e.children.filter(function(t){return E(t,"bpmn:Lane")})}function Xn(e){return bo(e,BC)||e}function NC(e,t){var n=Xn(e),i=E(n,"bpmn:Process")?[]:[n],r=ec(n,i),o=Ae(e),a=Ae(t),s=IC(e,t),c=[],u=qt(e);return r.forEach(function(l){if(l!==e){var f=u?0:s.top,p=u?s.right:0,d=u?0:s.bottom,m=u?s.left:0,h=Ae(l);s.top&&(or(h.bottom-o.top)<10&&(d=a.top-h.bottom),or(h.top-o.top)<5&&(f=a.top-h.top)),s.left&&(or(h.right-o.left)<10&&(p=a.left-h.right),or(h.left-o.left)<5&&(m=a.left-h.left)),s.bottom&&(or(h.top-o.bottom)<10&&(f=a.bottom-h.top),or(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(or(h.left-o.right)<10&&(m=a.right-h.left),or(h.right-o.right)<5&&(p=a.right-h.right)),(f||p||d||m)&&c.push({shape:l,newBounds:MC(l,{top:f,right:p,bottom:d,left:m})})}}),c}var $C=500;function Jl(e,t){te.call(this,e);function n(i,r){var o=qt(i),a=ar(r),s=[],c=[],u=[],l=[];if(Dr(a,function(g){return o?g.y>i.y?c.push(g):s.push(g):g.x>i.x?l.push(g):u.push(g),g.children}),!!a.length){var f;o?c.length&&s.length?f=i.height/2:f=i.height:l.length&&u.length?f=i.width/2:f=i.width;var p,d,m,h;s.length&&(p=t.calculateAdjustments(s,"y",f,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:f},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-f,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-f},"n")),u.length&&(m=t.calculateAdjustments(u,"x",f,i.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:f,y:0},"e")),l.length&&(h=t.calculateAdjustments(l,"x",-f,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",$C,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;E(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}Jl.$inject=["eventBus","spaceTool"],_e(Jl,te);var rg=500;function tc(e,t){t.invoke(te,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",rg,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return og(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",rg,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;og(a,jC(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}tc.$inject=["bpmnReplace","injector"],_e(tc,te),tc.prototype._replaceShape=function(e){var t=FC(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function FC(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function og(e,t){return!Ge(e)&&E(e,"bpmn:BoundaryEvent")&&!t}function jC(e,t){return e.indexOf(t)!==-1}var nc=Math.round,HC=Math.max;function zC(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 GC(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var ag=10;function VC(e,t){var n,i;for(n=0;i=e[n];n++)if(oa(i,t)<=ag)return{point:e[n],bendpoint:!0,index:n};return null}function WC(e,t){var n=pm(zC(t,ag),GC(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=HC(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:nc(i.x+r.x)/2,y:nc(i.y+r.y)/2},index:i.segment2}:{point:{x:nc(i.x),y:nc(i.y)},index:i.segment2}:null}function ep(e,t){return VC(e,t)||WC(e,t)}function tp(e,t,n){te.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,f,p,d,m,h=r.outgoing.slice(),g=r.incoming.slice(),y;Be(a.width)?y=Le(a):y=a;var v=ep(s,y);if(v){if(c=s.slice(0,v.index),u=s.slice(v.index+(v.bendpoint?1:0)),!c.length||!u.length)return;l=v.bendpoint?s[v.index]:y,(c.length===1||!sg(r,c[c.length-1]))&&c.push(cg(l)),(u.length===1||!sg(r,u[0]))&&u.unshift(cg(l))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||y),d=o),t.canConnect(r,p,o)&&(d?m=n.connect(r,p,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||y),m=o));var b=[].concat(d&&Ue(g,function(x){return x.source===d.source})||[],m&&Ue(h,function(x){return x.target===m.target})||[]);b.length&&n.removeElements(b)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=Le(c),l={x:u.x+s.x,y:u.y+s.y},f=pt(o.children,function(p){var d=t.canInsert(a,p);return d&&ep(p.waypoints,l)});f&&(r.targetFlow=f,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}_e(tp,te),tp.$inject=["eventBus","bpmnRules","modeling"];function sg(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 cg(e){return V({},e)}function np(e,t){te.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)&&_o(r)){var c=[];E(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&_o(u)):c=a.incoming.filter(u=>u!==r&&_o(u)&&E(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(E(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(_o).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(_o).forEach(function(s){const c=a.incoming.filter(_o).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}np.$inject=["eventBus","modeling"],_e(np,te);function _o(e){return E(e,"bpmn:SequenceFlow")}var ic=1500,ug=2e3;function lg(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"],ic,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;E(a,"bpmn:Lane")&&!Ve(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Xn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Ve(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"],ic,function(i){var r=i.hover;E(r,"bpmn:Lane")&&(i.hover=Xn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],ic,function(i){var r=i.context,o=i.hover,a=r.type;E(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Xn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],ic,function(i){var r=i.context,o=r.start;E(o,"bpmn:Lane")&&(r.start=Xn(o)||o)}),t.on("shape.move.start",ug,function(i){var r=i.shape;E(r,"bpmn:Lane")&&(i.shape=Xn(r)||r)}),t.on("spaceTool.move",ug,function(i){var r=i.hover;r&&E(r,"bpmn:Lane")&&(i.hover=Xn(r))})}lg.$inject=["elementRegistry","eventBus","canvas"];var pg=770;function ip(e,t,n,i){n.invoke(te,this);function r(s,c){var u=ie(s),l=c.categoryValue||u.categoryValueRef;l||(l=Zm(e,u));var f=c.category||l.$parent||Xm(e);u.categoryValueRef=l,l.$parent=f,c.categoryValue=l,c.category=f}function o(s,c){var u=ie(s),l=c.categoryValue||u.categoryValueRef,f=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=f,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;E(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;E(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=ie(u);if(!(!E(u,"bpmn:Group")||u.labelTarget)){var f=c.categoryValue=l.categoryValueRef;f&&(c.category=f.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!E(u,"bpmn:Group")||u.labelTarget)){var l=c.category,f=c.categoryValue,p=ie(u);f&&(p.categoryValueRef=f,f.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!E(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ie(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!E(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ie(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!E(u,"bpmn:Group")||u.labelTarget||ie(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!E(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",pg,function(s){var c=s.descriptor,u=s.element;if(!(!E(u,"bpmn:Group")||u.labelTarget)){var l=ie(u);if(l.categoryValueRef){var f=l.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",pg,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,f=c.category;l&&(l=u.categoryValueRef=a(l)),f&&(l.$parent=a(f)),delete c.category,delete c.categoryValue})}ip.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],_e(ip,te);function rp(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 fg(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=rp(i,r,o,a),u=rp(i,r,o,s),l;c&&u?dg(c,o)>dg(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],Le(i.source)),t(r[r.length-1],r[r.length-2],Le(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}fg.$inject=["eventBus"];function dg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function op(e){te.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=ie(i),o=Ze(i);if(Ve(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}op.$inject=["eventBus"],_e(op,te);function hg(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function mg(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function UC(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 YC(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 ap(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=YC([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 gg(e,t){var n=ap(e,t),i={x:n.x-e.x,y:n.y-e.y};return hg(i)}function ga(e,t){return hg({x:e.x-t.x,y:e.y-t.y})}var yg=Math.sqrt,vg=Math.min,qC=Math.max,bg=Math.abs;function xg(e){return Math.pow(e,2)}function ya(e,t){return yg(xg(e.x-t.x)+xg(e.y-t.y))}function KC(e,t){var n=0,i,r,o,a,s,c,u,l,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],wg(i,r)?u=[i]:(o=ya(e,i),a=ya(e,r),c=vg(o,a),u=XC(i,r,e,c)),u.length<1)throw new Error("expected between [1, 2] circle -> line intersections");u.length===1&&(l={type:"bendpoint",position:u[0],segmentIndex:n,bendpointIndex:wg(i,u[0])?n:n+1}),u.length===2&&(s=QC(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:ya(i,s)/ya(i,r)}),f=ya(l.position,e),(!d||p>f)&&(d=l,p=f)}return d}function XC(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,f=u/c,p=l/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var m=yg(d),h=-f+m,g=-f-m,y={x:e.x-r*h,y:e.y-o*h};if(d===0)return[y];var v={x:e.x-r*g,y:e.y-o*g};return[y,v].filter(function(b){return ZC(b,e,t)})}function ZC(e,t,n){return _g(e.x,t.x,n.x)&&_g(e.y,t.y,n.y)}function _g(e,t,n){return e>=vg(t,n)-rc&&e<=qC(t,n)+rc}function QC(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var rc=.1;function wg(e,t){return bg(e.x-t.x)<=rc&&bg(e.y-t.y)<=rc}function JC(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var f=Sg(t,u);f<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Eg(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=KC(e,n),c=s.segmentIndex,u=JC(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Rg(n,c),f=Rg(t,u),p=s.position,d=tP(l,p),m=eP(l,f);if(s.type==="bendpoint"){var h=t.length-n.length,g=s.bendpointIndex,y=n[g];if(t.indexOf(y)!==-1)return a;if(h===0){var v=t[g];return r=v.x-s.position.x,o=v.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&g!==0&&g<n.length-1&&(d=Sg(n,g))}var b={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},x=UC({x:e.x-p.x,y:e.y-p.y},m);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:Di(b),delta:Di({x:r,y:o})}}function Sg(e,t){var n=ga(e[t-1],e[t]),i=ga(e[t],e[t+1]),r=n/(n+i);return r}function eP(e,t){var n=mg(e),i=mg(t);return i-n}function Rg(e,t){return[e[t],e[t+1]]}function tP(e,t){var n=ga(e[0],e[1]),i=ga(e[0],t);return n===0?0:i/n}function nP(e,t,n,i){var r=Le(e);return Eg(r,t,n,i).delta}function va(e,t,n){var i=da(t),r=da(n),o=ci(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Di({x:r.x+a.x,y:r.y+a.y})}function Cg(e,t,n){var i=da(e),r=da(t),o=da(n),a=ci(e,i),s=ci(i,r),c=iP(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return Di({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function iP(e,t,n){var i=Ae(t),r=Ae(n);if(rP(i,r))return null;var o=en(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=en(n,s),c!==o?null:a}function rP(e,t){return oP(e,t)||aP(e,t)}function oP(e,t){return e.right!==t.right&&e.left!==t.left}function aP(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Pg="name",Ag="text";function sp(e,t,n,i){te.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ie(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(Pg in u&&t.updateLabel(c,u[Pg]),Ag in u&&E(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[Ag]||"");t.updateLabel(c,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;Ge(u)||!rr(u)||Wn(u)&&t.updateLabel(u,Wn(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=V({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),nP(u,f,p,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,f;!l||!l.parent||(f=o(a),t.moveShape(l,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=ie(c);l&&rr(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!Ge(c)||u.autoResize)){var l=s.newBounds,f=i.getDimensions(Wn(c)||"",{box:l,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=l.y!==c.y,m=c.y+c.height;s.newBounds={width:l.width,height:p,x:l.x,y:d?m-p:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Hs(c)){var f=c.label,p=Le(f),d=uP(l),m=cP(p,d),h=sP(m,l,u);t.moveShape(f,h)}})}_e(sp,te),sp.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function sP(e,t,n){var i=va(e,t,n);return Di(ci(i,e))}function cP(e,t){if(t.length){var n=lP(e,t);return ap(e,n)}}function uP(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 lP(e,t){var n=t.map(function(r){return{line:r,distance:gg(e,r)}}),i=li(n,"distance");return i[0].line}function pP(e,t,n,i){return Eg(e,t,n,i).point}function cp(e,t){te.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=V({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),pP(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),f=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,f)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),f=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,f)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],f={x:l.x+c.x,y:l.y+c.y},p=[].concat(u.waypoints.slice(0,-1),[f]);t.updateWaypoints(u,p)}),a.forEach(function(u){var l=u.waypoints[0],f={x:l.x+c.x,y:l.y+c.y},p=[].concat([f],u.waypoints.slice(1));t.updateWaypoints(u,p)})})}_e(cp,te),cp.$inject=["eventBus","modeling"];function oc(e,t,n){var i=sc(e),r=Mg(i,t),o=i[0];return r.length?r[r.length-1]:va(o.original||o,n,t)}function ac(e,t,n){var i=sc(e),r=Mg(i,t),o=i[i.length-1];return r.length?r[0]:va(o.original||o,n,t)}function up(e,t,n){var i=sc(e),r=Tg(t,n),o=i[0];return va(o.original||o,r,t)}function lp(e,t,n){var i=sc(e),r=Tg(t,n),o=i[i.length-1];return va(o.original||o,r,t)}function Tg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function sc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Mg(e,t){var n=cn(e,dP);return Ue(n,function(i){return fP(i,t)})}function fP(e,t){return en(t,e,1)==="intersect"}function dP(e){return e.original||e}function pp(e,t){te.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(hP(i,r)){var o=mP(i);o.incoming.forEach(function(a){var s=ac(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=oc(a,r,i);t.reconnectStart(a,r,s)})}},!0)}pp.$inject=["eventBus","modeling"],_e(pp,te);function hP(e,t){return E(e,"bpmn:Participant")&&Ke(e)&&E(t,"bpmn:Participant")&&!Ke(t)}function mP(e){var t=ia([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){E(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){E(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const gP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function kg(e){const t=ie(e);if(!E(t,"bpmn:BoundaryEvent")&&!(E(t,"bpmn:StartEvent")&&fn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:gP.some(i=>E(n[0],i))}function Og(e){return E(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function fp(e,t){e.invoke(te,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!kg(r))return;const a=Og(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ie(i).get(a),u=ie(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}fp.$inject=["injector","modeling"],_e(fp,te);function dp(e,t){te.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ze(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}_e(dp,te),dp.$inject=["eventBus","modeling"];function hp(e,t,n){te.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!E(o,"bpmn:SequenceFlow")||!E(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=yP(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}_e(hp,te),hp.$inject=["eventBus","bpmnRules","modeling"];function wo(e){return e.original||e}function yP(e,t){var n=rp(wo(e[e.length-2]),wo(e[e.length-1]),wo(t[1]),wo(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[wo(e[0]),wo(t[t.length-1])]}function mp(e,t){te.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;E(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}mp.$inject=["eventBus","modeling"],_e(mp,te);function gp(e,t,n,i){te.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,f=c.parent;if(f){var p,d;E(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(p="bpmn:MessageFlow")),E(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(u,l,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,f=u.newSource||l.source,p=u.newTarget||l.target,d,m;d=n.canConnect(f,p),!(!d||d.type===l.type)&&(m=t.connect(f,p,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=m,r&&s(l,m))}function s(c,u){var l=r.context(),f=l&&l.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;N(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,f=u.element,p=f.businessObject,d;l.default&&(d=pt(f.outgoing,to({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}_e(gp,te),gp.$inject=["eventBus","modeling","bpmnRules","injector"];function cc(e,t,n,i,r,o){i.invoke(te,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=An(u,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];N(s.closure.topLevel,function(p){fn(p)?l=l.concat(p.children):l=l.concat(p)}),l.length===1&&u&&(c=u);var f=t.canReplace(l,c);f&&this._replaceElements(l,f.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,f;l&&l.length&&(f=t.canReplace(l,u),this._replaceElements(l,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}_e(cc,te),cc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;N(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)},cc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var vP=1500,bP={width:140,height:120},yp={width:300,height:60},vp={width:60,height:300},uc={width:300,height:150},lc={width:150,height:300},Dg={width:140,height:120},Lg={width:100,height:40};function Ig(e){e.on("resize.start",vP,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(E(i,"bpmn:Lane")||E(i,"bpmn:Participant"))&&(n.resizeConstraints=SP(i,r,o)),E(i,"bpmn:SubProcess")&&Ke(i)&&(n.minDimensions=Dg),E(i,"bpmn:TextAnnotation")&&(n.minDimensions=Lg)})}Ig.$inject=["eventBus"];var sr=Math.abs,xP=Math.min,_P=Math.max;function Bg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Eo(e,t,n){return Bg(e,t,n,xP)}function So(e,t,n){return Bg(e,t,n,_P)}var wP={top:20,left:50,right:20,bottom:20},EP={top:50,left:20,right:20,bottom:20};function SP(e,t,n){var i=Xn(e),r=!0,o=!0,a=ec(i,[i]),s=Ae(e),c={},u={},l=qt(e),f=l?yp:vp;/n/.test(t)?u.top=s.bottom-f.height:/e/.test(t)?u.right=s.left+f.width:/s/.test(t)?u.bottom=s.top+f.height:/w/.test(t)&&(u.left=s.right-f.width),a.forEach(function(m){var h=Ae(m);l?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&sr(s.top-h.bottom)<10&&So(c,"top",h.top+f.height),sr(s.top-h.top)<5&&Eo(u,"top",h.bottom-f.height)),/e/.test(t)&&(n&&sr(s.right-h.left)<10&&Eo(c,"right",h.right-f.width),sr(s.right-h.right)<5&&So(u,"right",h.left+f.width)),/s/.test(t)&&(n&&sr(s.bottom-h.top)<10&&Eo(c,"bottom",h.bottom-f.height),sr(s.bottom-h.bottom)<5&&So(u,"bottom",h.top+f.height)),/w/.test(t)&&(n&&sr(s.left-h.right)<10&&So(c,"left",h.left+f.width),sr(s.left-h.left)<5&&Eo(u,"left",h.right-f.width))});var p=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(E(m,"bpmn:FlowElement")||E(m,"bpmn:Artifact"))}),d=l?wP:EP;return p.forEach(function(m){var h=Ae(m);/n/.test(t)&&(!l||r)&&Eo(u,"top",h.top-d.top),/e/.test(t)&&(l||o)&&So(u,"right",h.right+d.right),/s/.test(t)&&(!l||o)&&So(u,"bottom",h.bottom+d.bottom),/w/.test(t)&&(l||r)&&Eo(u,"left",h.left-d.left)}),{min:u,max:c}}function Ng(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Ro(e){return e.originalEvent||e.srcEvent}function bp(e){Ng(e),Ng(Ro(e))}function Nr(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 $g(){return/mac/i.test(navigator.platform)}function Fg(e,t){return(Ro(e)||e).button===t}function cr(e){return Fg(e,0)}function RP(e){return Fg(e,1)}function ba(e){var t=Ro(e)||e;return cr(e)?$g()?t.metaKey:t.ctrlKey:!1}function pc(e){var t=Ro(e)||e;return cr(e)&&t.shiftKey}var jg=1001;function Hg(e,t){e.on("resize.start",jg+500,function(n){var i=n.context,r=i.shape;(E(r,"bpmn:Lane")||E(r,"bpmn:Participant"))&&(i.balanced=!ba(n))}),e.on("resize.end",jg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(E(r,"bpmn:Lane")||E(r,"bpmn:Participant"))return o&&(a=gm(a),t.resizeLane(r,a,i.balanced)),!1})}Hg.$inject=["eventBus","modeling"];var CP=500;function xp(e,t,n,i,r){n.invoke(te,this);function o(l){return Ve(l,["bpmn:ReceiveTask","bpmn:SendTask"])||PP(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var f=e.getDefinitions(),p=f.get("rootElements");return!!pt(p,to({id:l.id}))}function s(l){if(E(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(E(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(E(l,"bpmn:MessageEventDefinition"))return"messageRef";if(E(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(Ve(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var f=l.get("eventDefinitions"),p=f[0];return p.get(s(p))}function u(l,f){if(Ve(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",f);var p=l.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.shape||l.element;if(o(f)){var p=ie(f),d=c(p),m;d&&!a(d)&&(m=e.getDefinitions().get("rootElements"),Tt(m,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");Ct(p,f)}},!0),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,p=l.element;if(!(p.labelTarget||!o(p))){var d=ie(p),m=c(d);m&&(f.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",CP,function(l){var f=l.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(p,d),delete f.referencedRootElement)})}xp.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],_e(xp,te);function PP(e,t){return De(t)||(t=[t]),Yi(t,function(n){return go(e,n)})}var zg=Math.max;function Gg(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return N(n,function(a){var s=a.id;E(a,"bpmn:Participant")&&(o[s]=TP(a,i,r)),E(a,"bpmn:Lane")&&(o[s]=qt(a)?yp:vp),E(a,"bpmn:SubProcess")&&Ke(a)&&(o[s]=Dg),E(a,"bpmn:TextAnnotation")&&(o[s]=Lg),E(a,"bpmn:Group")&&(o[s]=bP)}),o})}Gg.$inject=["eventBus"];function AP(e){return e==="x"}function TP(e,t,n){var i=qt(e);if(!OP(e))return i?uc:lc;var r=AP(t),o={};return r?i?o=uc:o={width:kP(e,n,r),height:lc.height}:i?o={width:uc.width,height:MP(e,n,r)}:o=lc,o}function MP(e,t,n){var i;return i=DP(e,t,n),zg(uc.height,i)}function kP(e,t,n){var i;return i=LP(e,t,n),zg(lc.width,i)}function OP(e){return!!ar(e).length}function DP(e,t,n){var i=ar(e),r;return r=_p(i,t,n),e.height-r.height+yp.height}function LP(e,t,n){var i=ar(e),r;return r=_p(i,t,n),e.width-r.width+vp.width}function _p(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return o=ar(r),o.length?_p(o,t,n):r}var Vg="_plane";function Wg(e){var t=e.id;return IP(t)}function xi(e){var t=e.id;return E(e,"bpmn:SubProcess")?Ug(t):t}function $r(e){return Ug(e)}function fc(e){var t=Ze(e);return E(t,"bpmndi:BPMNPlane")}function Ug(e){return e+Vg}function IP(e){return e.replace(new RegExp(Vg+"$"),"")}var Yg=400,BP=600,qg={x:180,y:160};function Ni(e,t,n,i,r,o,a){te.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(f){return E(f,"bpmn:SubProcess")&&!Ke(f)}function u(f){var p=f.shape,d=f.newRootElement,m=ie(p);d=s._addDiagram(d||m),f.newRootElement=e.addRootElement(d)}function l(f){var p=f.shape,d=ie(p);s._removeDiagram(d);var m=f.newRootElement=a.get(xi(d));e.removeRootElement(m)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;N(p,function(d){if(c(d)){var m=a.get(xi(d));if(!(!m||!d.children||!d.children.length)){var h=Kg(d);s._showRecursively(h),s._moveChildrenToShape(h,m)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!E(p,"bpmn:SubProcess")||!Ke(p)||N(ua([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(xi(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(xi(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,m=e.findRoot(xi(p));if(!(!d||!m)){var h=d.children;n.moveElements(h,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(E(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,g=d.id;if(h!==g){if(fc(p)){a.updateId(p,$r(g)),a.updateId(h,g);return}var y=a.get($r(h));y&&a.updateId($r(h),$r(g))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(E(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,g=d.id;if(h!==g){if(fc(p)){a.updateId(p,$r(h)),a.updateId(g,h);return}var y=a.get($r(g));y&&a.updateId(y,$r(h))}}},!0),t.on("element.changed",function(f){var p=f.element;if(fc(p)){var d=p,m=a.get(Wg(d));!m||m===d||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",Yg,function(f){var p=f.shape;E(p,"bpmn:SubProcess")&&(Ke(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",Yg,function(f){var p=f.shape;E(p,"bpmn:SubProcess")&&(Ke(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",BP,function(f){var p=f.shape;if(E(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(Ke(p))s._moveChildrenToShape(d.children.slice(),p),N(ua(p.children),h=>{n.moveShape(h.annotation,{x:0,y:0},p.parent),N(h.associations,g=>{n.moveConnection(g,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var m=Kg(p);s._moveChildrenToShape(m,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var m=xi(p),h=a.get(m);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,m=f.elements,h=d.parent,g=E(Ze(h),"bpmndi:BPMNPlane");if(g){var y=Wg(h),v=pt(m,function(b){return b.id===y});v&&(p.parent=v.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}_e(Ni,te),Ni.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=Dt(i),o;if(!t.x)o={x:qg.x-r.x,y:qg.y-r.y};else{var a=Le(t),s=Le(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},Ni.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(Fm(e).map(i=>i.annotation));n.size&&N(ua(e.children),i=>{n.has(i.annotation)&&N(i.associations,r=>{t.removeConnection(r)})})},Ni.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},Ni.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},Ni.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:xi(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},Ni.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=pt(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},Ni.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function NP(e){var t=[];return N(ua(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Kg(e){return e.children.slice().concat(NP(e.children)).concat($P(e))}function $P(e){return Cl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function wp(e,t){e.invoke(te,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!E(r,"bpmn:SubProcess")||E(r,"bpmn:AdHocSubProcess")||!(E(i,"bpmn:Task")||E(i,"bpmn:CallActivity"))||!Ke(r))){var o=FP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}wp.$inject=["injector","modeling"],_e(wp,te);function FP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Ep(e,t){te.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;E(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&E(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!E(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,Wn(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}_e(Ep,te),Ep.$inject=["eventBus","textRenderer"];function Sp(e,t){te.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Ke(i))return;var r=ia(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();N(s,function(u){o(u,!0)}),N(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||E(a,"bpmn:Association")&&(E(a.source,"bpmn:TextAnnotation")||E(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Le(i)):t.reconnectStart(a,i,Le(i)))}},!0)}_e(Sp,te),Sp.$inject=["eventBus","modeling"];var Rp=500;function Cp(e,t,n){te.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,f;return l=jP(c).concat([a]),f=ig(l),f?(u.width=Math.max(f.width,u.width),u.height=Math.max(f.height,u.height),u.x=f.x+(f.width-u.width)/2,u.y=f.y+(f.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],Rp,function(a){var s=a.context,c=s.shape;E(c,"bpmn:SubProcess")&&(c.collapsed?Ze(c).isExpanded=!1:(i(c.children),Ze(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Rp,function(a){var s=a.context,c=s.shape;c.collapsed?Ze(c).isExpanded=!1:Ze(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Rp,function(a){var s=a.context.shape,c=t.getDefaultSize(s),u;s.collapsed?u=o(s,c):u=r(s,c),n.resizeShape(s,u,null,{autoResize:s.collapsed?!1:"nwse"})})}_e(Cp,te),Cp.$inject=["eventBus","elementFactory","modeling"];function jP(e){return e.filter(function(t){return!t.hidden})}function Pp(e,t,n,i){t.invoke(te,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Ge(a)||(E(a,"bpmn:Participant")&&Ke(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;E(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}_e(Pp,te),Pp.$inject=["canvas","injector","moddle","modeling"];function Ap(e,t){te.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;HP(r,o)&&t.updateProperties(o,{default:null})})}_e(Ap,te),Ap.$inject=["eventBus","modeling"];function HP(e,t){if(!E(e,"bpmn:SequenceFlow"))return!1;var n=ie(t),i=ie(e);return n.get("default")===i}var zP=500,GP=5e3,Xg=["shape.create","shape.delete","shape.move","shape.resize"],Zg=[...Xg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Tp(e,t){te.call(this,e);var n;function i(){return n=n||new VP,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(Zg,GP,function(){i()}),this.postExecuted(Zg,zP,function(){o()}),this.preExecute(Xg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(E(c,"bpmn:Lane")&&u.addLane(c),E(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}Tp.$inject=["eventBus","modeling"],_e(Tp,te);function VP(){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 WP=500,UP=5e3,Qg=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],Jg=[...Qg,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Mp(e,t){te.call(this,e);var n;function i(){return n=n||new YP,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(Jg,UP,function(){i()}),this.postExecuted(Jg,WP,function(){o()}),this.preExecute(Qg,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(E(s,"bpmn:FlowElement")&&c.addFlowElement(s),E(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;E(s,"bpmn:Group")&&r().addGroup(s)})}Mp.$inject=["eventBus","modeling"],_e(Mp,te);function YP(){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 kp(e,t){te.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)qP(o)&&!XP(o)&&t.updateProperties(o,{isForCompensation:void 0})})}_e(kp,te),kp.$inject=["eventBus","modeling"];function qP(e){const t=ie(e);return t&&t.isForCompensation}function KP(e){return e&&E(e,"bpmn:BoundaryEvent")&&go(e,"bpmn:CompensateEventDefinition")}function XP(e){return e.incoming.filter(n=>KP(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",Fl],appendBehavior:["type",jl],associationBehavior:["type",zl],attachEventBehavior:["type",Ys],artifactBehavior:["type",Hl],boundaryEventBehavior:["type",Gl],categoryRootElementReferenceBehavior:["type",Vl],compensateBoundaryEventBehaviour:["type",Wl],createBehavior:["type",Ul],createDataObjectBehavior:["type",Yl],createParticipantBehavior:["type",Xl],dataInputAssociationBehavior:["type",Zl],dataStoreBehavior:["type",Ql],deleteLaneBehavior:["type",Jl],detachEventBehavior:["type",tc],dropOnFlowBehavior:["type",tp],eventBasedGatewayBehavior:["type",np],fixHoverBehavior:["type",lg],groupBehavior:["type",ip],importDockingFix:["type",fg],isHorizontalFix:["type",op],labelBehavior:["type",sp],layoutConnectionBehavior:["type",cp],messageFlowBehavior:["type",pp],nonInterruptingBehavior:["type",fp],removeElementBehavior:["type",hp],removeEmbeddedLabelBoundsBehavior:["type",dp],removeParticipantBehavior:["type",mp],replaceConnectionBehavior:["type",gp],replaceElementBehaviour:["type",cc],resizeBehavior:["type",Ig],resizeLaneBehavior:["type",Hg],rootElementReferenceBehavior:["type",xp],spaceToolBehavior:["type",Gg],subProcessPlaneBehavior:["type",Ni],subProcessStartEventBehavior:["type",wp],textAnnotationBehavior:["type",Ep],toggleCollapseConnectionBehaviour:["type",Sp],toggleElementCollapseBehaviour:["type",Cp],unclaimIdBehavior:["type",Pp],unsetDefaultFlowBehavior:["type",Ap],updateFlowNodeRefsBehavior:["type",Tp],updateCategoryValueRefsBehavior:["type",Mp],setCompensationActivityAfterPasteBehavior:["type",kp]};function Op(e){this._commandStack=e.get("commandStack",!1)}Op.$inject=["injector"],Op.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const _i={__init__:["rules"],rules:["type",Op]};function Zn(e){te.call(this,e),this.init()}Zn.$inject=["eventBus"],_e(Zn,te),Zn.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)})},Zn.prototype.init=function(){};function ey(e,t){var n=en(e,t,-15);return n!=="intersect"?n:null}function nn(e){Zn.call(this,e)}_e(nn,Zn),nn.$inject=["eventBus"],nn.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return QP(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 hc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return hc(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 dy(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return at(i)&&!mc(t,i)?!1:Pr(t,function(r){return at(r)?hc(r.source,r.target,r):r.host?xa(r,r.host,null,n):Bp(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 sy(a)&&!n.includes(a.host)})?!1:xa(n,t,null,i)||py(n,t,i)||fy(n,t)||mc(n,t)}),this.addRule("shape.create",function(e){return Bp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return xa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return vy(n,t)})},nn.prototype.canConnectMessageFlow=gy,nn.prototype.canConnectSequenceFlow=yy,nn.prototype.canConnectDataAssociation=Np,nn.prototype.canConnectAssociation=hy,nn.prototype.canConnectCompensationAssociation=my,nn.prototype.canMove=fy,nn.prototype.canAttach=xa,nn.prototype.canReplace=py,nn.prototype.canDrop=Co,nn.prototype.canInsert=mc,nn.prototype.canCreate=Bp,nn.prototype.canConnect=hc,nn.prototype.canResize=dy,nn.prototype.canCopy=vy;function QP(e){return Dp(e)?null:Ve(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Dp(e){return!e||Ge(e)}function ty(e){do{if(E(e,"bpmn:Process"))return ie(e);if(E(e,"bpmn:Participant"))return ie(e).processRef||ie(e)}while(e=e.parent)}function Lp(e){return E(e,"bpmn:TextAnnotation")}function Ip(e){return E(e,"bpmn:Group")&&!e.labelTarget}function ny(e){return E(e,"bpmn:BoundaryEvent")&&wi(e,"bpmn:CompensateEventDefinition")}function dc(e){return ie(e).isForCompensation}function JP(e,t){var n=ty(e),i=ty(t);return n===i}function eA(e){return E(e,"bpmn:InteractionNode")&&!E(e,"bpmn:BoundaryEvent")&&(!E(e,"bpmn:Event")||E(e,"bpmn:ThrowEvent")&&oy(e,"bpmn:MessageEventDefinition"))}function tA(e){return E(e,"bpmn:InteractionNode")&&!dc(e)&&(!E(e,"bpmn:Event")||E(e,"bpmn:CatchEvent")&&oy(e,"bpmn:MessageEventDefinition"))&&!(E(e,"bpmn:BoundaryEvent")&&!wi(e,"bpmn:MessageEventDefinition"))}function iy(e){for(var t=e;t=t.parent;){if(E(t,"bpmn:FlowElementsContainer"))return ie(t);if(E(t,"bpmn:Participant"))return ie(t).processRef}return null}function ry(e,t){var n=iy(e),i=iy(t);return n===i}function wi(e,t){var n=ie(e);return!!pt(n.eventDefinitions||[],function(i){return E(i,t)})}function oy(e,t){var n=ie(e);return(n.eventDefinitions||[]).every(function(i){return E(i,t)})}function nA(e){return E(e,"bpmn:FlowNode")&&!E(e,"bpmn:EndEvent")&&!fn(e)&&!(E(e,"bpmn:IntermediateThrowEvent")&&wi(e,"bpmn:LinkEventDefinition"))&&!ny(e)&&!dc(e)}function iA(e){return E(e,"bpmn:FlowNode")&&!E(e,"bpmn:StartEvent")&&!E(e,"bpmn:BoundaryEvent")&&!fn(e)&&!(E(e,"bpmn:IntermediateCatchEvent")&&wi(e,"bpmn:LinkEventDefinition"))&&!dc(e)}function rA(e){return E(e,"bpmn:ReceiveTask")||E(e,"bpmn:IntermediateCatchEvent")&&(wi(e,"bpmn:MessageEventDefinition")||wi(e,"bpmn:TimerEventDefinition")||wi(e,"bpmn:ConditionalEventDefinition")||wi(e,"bpmn:SignalEventDefinition"))}function oA(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function ay(e,t){var n=oA(t);return n.indexOf(e)!==-1}function hc(e,t,n){if(Dp(e)||Dp(t))return null;if(!E(n,"bpmn:DataAssociation")){if(gy(e,t))return{type:"bpmn:MessageFlow"};if(yy(e,t))return{type:"bpmn:SequenceFlow"}}var i=Np(e,t);return i||(my(e,t)?{type:"bpmn:Association",associationDirection:"One"}:hy(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Co(e,t){return Ge(e)||Ip(e)?!0:E(t,"bpmn:Participant")&&!Ke(t)?!1:E(e,"bpmn:Participant")?E(t,"bpmn:Process")||E(t,"bpmn:Collaboration"):Ve(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:E(e,"bpmn:Lane")?E(t,"bpmn:Participant")||E(t,"bpmn:Lane"):E(e,"bpmn:BoundaryEvent")&&!aA(e)?!1:E(e,"bpmn:FlowElement")&&!E(e,"bpmn:DataStoreReference")?E(t,"bpmn:FlowElementsContainer")?Ke(t):Ve(t,["bpmn:Participant","bpmn:Lane"]):E(e,"bpmn:DataStoreReference")&&E(t,"bpmn:Collaboration")?Yi(ie(t).get("participants"),function(n){return!!n.get("processRef")}):Ve(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ve(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):E(e,"bpmn:MessageFlow")?E(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function aA(e){return ie(e).cancelActivity&&(cy(e)||uy(e))}function sy(e){return!Ge(e)&&E(e,"bpmn:BoundaryEvent")}function sA(e){return E(e,"bpmn:Lane")}function cA(e){return sy(e)||E(e,"bpmn:IntermediateThrowEvent")&&cy(e)?!0:E(e,"bpmn:IntermediateCatchEvent")&&uy(e)}function cy(e){var t=ie(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function uy(e){return ly(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function ly(e,t){return t.some(function(n){return wi(e,n)})}function uA(e){return E(e,"bpmn:ReceiveTask")&&pt(e.incoming,function(t){return E(t.source,"bpmn:EventBasedGateway")})}function xa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Ge(r)||!cA(r)||fn(t)||!E(t,"bpmn:Activity")||dc(t)||i&&!ey(i,t)||uA(t)?!1:"attach"}function py(e,t,n){if(!t)return!1;var i={replacements:[]};return N(e,function(r){fn(t)||E(r,"bpmn:StartEvent")&&r.type!=="label"&&Co(r,t)&&(vR(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(bR(r)||xR(r)||_R(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),ly(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&E(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),E(t,"bpmn:Transaction")||wi(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(E(r,"bpmn:EndEvent")&&Co(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),E(r,"bpmn:BoundaryEvent")&&xa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function fy(e,t){return Yi(e,sA)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Co(n,t)})}function Bp(e,t,n,i){return t?Ge(e)||Ip(e)?!0:Co(e,t)||mc(e,t):!1}function dy(e,t,n){return E(e,"bpmn:SubProcess")?Ke(e)&&(!t||t.width>=100&&t.height>=80):E(e,"bpmn:Lane")||E(e,"bpmn:Participant")?!0:Lp(e)?n?n==="e"||n==="w":!0:Ip(e)?!0:Ge(e)?n?n==="e"||n==="w":!0:!1}function lA(e,t){var n=Lp(e),i=Lp(t);return(n||i)&&n!==i}function hy(e,t){return ay(t,e)||ay(e,t)?!1:lA(e,t)?!0:!!Np(e,t)}function my(e,t){return ry(e,t)&&ny(e)&&E(t,"bpmn:Activity")&&!fA(t,e)&&!fn(t)}function gy(e,t){return xy(e)&&!xy(t)?!1:eA(e)&&tA(t)&&!JP(e,t)}function yy(e,t){return nA(e)&&iA(t)&&ry(e,t)&&!(E(e,"bpmn:EventBasedGateway")&&!rA(t))}function Np(e,t){return Ve(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ve(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Ve(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ve(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function mc(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:Ve(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ge(t)&&E(e,"bpmn:FlowNode")&&!E(e,"bpmn:BoundaryEvent")&&Co(e,t.parent)}function $p(e,t){return e&&t&&e.indexOf(t)!==-1}function vy(e,t){return Ge(t)?!0:!(E(t,"bpmn:Lane")&&!$p(e,t.parent)||E(t,"bpmn:MessageFlow")&&!pA(e,t))}function pA(e,t){var n=by(t.source),i=by(t.target);return $p(e,n)&&$p(e,i)}function by(e){for(;e;e=e.parent)if(E(e,"bpmn:Participant"))return e;return null}function xy(e){return bo(e,"bpmn:Process")||bo(e,"bpmn:Collaboration")}function fA(e,t){return e.attachers.includes(t)}const dA={__depends__:[_i],__init__:["bpmnRules"],bpmnRules:["type",nn]};var hA=2e3;function _y(e,t){e.on("saveXML.start",hA,n);function n(){var i=t.getRootElements();N(i,function(r){var o=Ze(r),a,s;a=ia([r]),a=Ue(a,function(c){return c!==r&&!c.labelTarget}),s=cn(a,Ze),o.set("planeElement",s)})}}_y.$inject=["eventBus","canvas"];const mA={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",_y]};function gc(e){te.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)})}gc.prototype.getOrdering=function(e,t){return null},_e(gc,te);function Fp(e,t){gc.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=pt(n,function(c){return Ve(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!Ve(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||E(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=vd(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}Fp.$inject=["eventBus","canvas"],_e(Fp,gc);const gA={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Fp]};function _a(){}_a.prototype.get=function(){return this._data},_a.prototype.set=function(e){this._data=e},_a.prototype.clear=function(){var e=this._data;return delete this._data,e},_a.prototype.isEmpty=function(){return!this._data};const yA={clipboard:["type",_a]};var wy=1500;function Ey(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),u=c&&e.get(c);c&&u&&(a.stopPropagation(),r.hover({element:u,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",wy,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",wy,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=Nr(a),c=document.elementFromPoint(s.x,s.y),vA(c)}}Ey.$inject=["elementRegistry","eventBus","injector"];function vA(e){return kr(e,"svg, .djs-element",!0)}const bA={__init__:["hoverFix"],hoverFix:["type",Ey]};function xA(e){return!0}function yc(e){return cr(e)||RP(e)}var Sy=500;function Ry(e,t,n){var i=this;function r(A,I,k){if(!s(A,I)){var D,H,ae;k?H=t.getGraphics(k):(D=I.delegateTarget||I.target,D&&(H=D,k=t.get(H))),!(!H||!k)&&(ae=e.fire(A,{element:k,gfx:H,originalEvent:I}),ae===!1&&(I.stopPropagation(),I.preventDefault()))}}var o={};function a(A){return o[A]}function s(A,I){var k=u[A]||cr;return!k(I)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},u={"element.contextmenu":xA,"element.mousedown":yc,"element.mouseup":yc,"element.click":yc,"element.dblclick":yc};function l(A,I,k){var D=c[A];if(!D)throw new Error("unmapped DOM event name <"+A+">");return r(D,I,k)}var f="svg, .djs-element";function p(A,I,k,D){var H=o[k]=function(ae){r(k,ae)};D&&(u[k]=D),H.$delegate=Mn.bind(A,f,I,H)}function d(A,I,k){var D=a(k);D&&Mn.unbind(A,I,D.$delegate)}function m(A){N(c,function(I,k){p(A,k,I)})}function h(A){N(c,function(I,k){d(A,k,I)})}e.on("canvas.destroy",function(A){h(A.svg)}),e.on("canvas.init",function(A){m(A.svg)}),e.on(["shape.added","connection.added"],function(A){var I=A.element,k=A.gfx;e.fire("interactionEvents.createHit",{element:I,gfx:k})}),e.on(["shape.changed","connection.changed"],Sy,function(A){var I=A.element,k=A.gfx;e.fire("interactionEvents.updateHit",{element:I,gfx:k})}),e.on("interactionEvents.createHit",Sy,function(A){var I=A.element,k=A.gfx;i.createDefaultHit(I,k)}),e.on("interactionEvents.updateHit",function(A){var I=A.element,k=A.gfx;i.updateDefaultHit(I,k)});var g=C("djs-hit djs-hit-stroke"),y=C("djs-hit djs-hit-click-stroke"),v=C("djs-hit djs-hit-all"),b=C("djs-hit djs-hit-no-move"),x={all:v,"click-stroke":y,stroke:g,"no-move":b};function C(A,I){return I=V({stroke:"white",strokeWidth:15},I||{}),n.cls(A,["no-fill","no-border"],I)}function P(A,I){var k=x[I];if(!k)throw new Error("invalid hit type <"+I+">");return we(A,k),A}function O(A,I){je(A,I)}this.removeHits=function(A){var I=As(".djs-hit",A);N(I,Ht)},this.createDefaultHit=function(A,I){var k=A.waypoints,D=A.isFrame,H;return k?this.createWaypointsHit(I,k):(H=D?"stroke":"all",this.createBoxHit(I,H,{width:A.width,height:A.height}))},this.createWaypointsHit=function(A,I){var k=na(I);return P(k,"stroke"),O(A,k),k},this.createBoxHit=function(A,I,k){k=V({x:0,y:0},k);var D=Pe("rect");return P(D,I),we(D,k),O(A,D),D},this.updateDefaultHit=function(A,I){var k=ot(".djs-hit",I);if(k)return A.waypoints?Rl(k,A.waypoints):we(k,{width:A.width,height:A.height}),k},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}Ry.$inject=["eventBus","elementRegistry","styles"];const vc={__init__:["interactionEvents"],interactionEvents:["type",Ry]};function Po(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)})}Po.$inject=["eventBus","canvas"],Po.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()})}},Po.prototype.get=function(){return Array.from(this._selectedElements)},Po.prototype.isSelected=function(e){return this._selectedElements.has(e)},Po.prototype.select=function(e,t){var n=this.get();De(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?N(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Cy="hover",Py="selected";function Ay(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,Cy)}),t.on("element.out",function(r){i(r.element,Cy)}),t.on("selection.changed",function(r){function o(u){i(u,Py)}function a(u){n(u,Py)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let u of s)c.has(u)||o(u);for(let u of c)s.has(u)||a(u)})}Ay.$inject=["canvas","eventBus"];function Ty(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;De(u)?t.select(u):t.select(s.filter(_A))}}),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=pt(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(cr(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=pc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Ty.$inject=["eventBus","selection","canvas","elementRegistry"];function _A(e){return!e.hidden}const Qn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[vc],selection:["type",Po],selectionVisuals:["type",Ay],selectionBehavior:["type",Ty]};var wA=/^djs-cursor-.*$/;function bc(e){var t=bt(document.body);t.removeMatching(wA),e&&t.add("djs-cursor-"+e)}function My(){bc(null)}var EA=5e3;function ky(e,t){t=t||"element.click";function n(){return!1}return e.once(t,EA,n),function(){e.off(t,n)}}var SA=["c","C"],RA=["v","V"],CA=["d","D"],PA=["x","X"],AA=["y","Y"],Oy=["z","Z"];function TA(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Dn(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function zt(e,t){return e=De(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function jp(e){return e.shiftKey}function MA(e){return Dn(e)&&zt(SA,e)}function kA(e){return Dn(e)&&zt(RA,e)}function OA(e){return Dn(e)&&zt(CA,e)}function DA(e){return Dn(e)&&zt(PA,e)}function LA(e){return Dn(e)&&!jp(e)&&zt(Oy,e)}function IA(e){return Dn(e)&&(zt(AA,e)||zt(Oy,e)&&jp(e))}var Ao=Math.round,Dy="djs-drag-active";function Fr(e){e.preventDefault()}function BA(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function NA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ly(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),C=t._container.getBoundingClientRect();return{x:x.x+(b.x-C.left)/x.scale,y:x.y+(b.y-C.top)/x.scale}}function s(b,x){x=x||o;var C=e.createEvent(V({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,C)===!1?!1:e.fire(x.prefix+"."+b,C)}function c(b){var x=b.filter(function(C){return i.get(C.id)});x.length&&n.select(x)}function u(b,x){var C=o.payload,P=o.displacement,O=o.globalStart,A=Nr(b),I=ci(A,O),k=o.localStart,D=a(A),H=ci(D,k);if(!o.active&&(x||NA(I)>o.threshold)){if(V(C,{x:Ao(k.x+P.x),y:Ao(k.y+P.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return g();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&bc(o.cursor),t.addMarker(t.getRootElement(),Dy)}bp(b),o.active&&(V(C,{x:Ao(D.x+P.x),y:Ao(D.y+P.y),dx:Ao(H.x),dy:Ao(H.y)},{originalEvent:b}),s("move"))}function l(b){var x,C=!0;o.active&&(b&&(o.payload.originalEvent=b,bp(b)),C=s("end")),C===!1&&s("rejected"),x=y(C!==!0),s("ended",x)}function f(b){zt("Escape",b)&&(Fr(b),g())}function p(b){var x;o.active&&(x=ky(e),setTimeout(x,400),Fr(b)),l(b)}function d(b){u(b)}function m(b){var x=o.payload;x.hoverGfx=b.gfx,x.hover=b.element,s("hover")}function h(b){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function g(b){var x;if(o){var C=o.active;C&&s("cancel"),x=y(b),C&&s("canceled",x)}}function y(b){var x,C;s("cleanup"),My(),o.trapClick?C=p:C=l,$e.unbind(document,"mousemove",u),$e.unbind(document,"dragstart",Fr),$e.unbind(document,"selectstart",Fr),$e.unbind(document,"mousedown",C,!0),$e.unbind(document,"mouseup",C,!0),$e.unbind(document,"keyup",f),$e.unbind(document,"touchstart",d,!0),$e.unbind(document,"touchcancel",g,!0),$e.unbind(document,"touchmove",u,!0),$e.unbind(document,"touchend",l,!0),e.off("element.hover",m),e.off("element.out",h),t.removeMarker(t.getRootElement(),Dy);var P=o.payload.previousSelection;return b!==!1&&P&&!n.get().length&&c(P),x=o,o=null,x}function v(b,x,C,P){o&&g(!1),typeof x=="string"&&(P=C,C=x,x=null),P=V({},r,P||{});var O=P.data||{},A,I,k,D,H;if(P.trapClick?D=p:D=l,b?(A=Ro(b)||b,I=Nr(b),bp(b),A.type==="dragstart"&&Fr(A)):(A=null,I={x:0,y:0}),k=a(I),x||(x=k),H=BA(A),o=V({prefix:C,data:O,payload:{},globalStart:I,displacement:ci(x,k),localStart:k,isTouch:H},P),P.manual||(H?($e.bind(document,"touchstart",d,!0),$e.bind(document,"touchcancel",g,!0),$e.bind(document,"touchmove",u,!0),$e.bind(document,"touchend",l,!0)):($e.bind(document,"mousemove",u),$e.bind(document,"dragstart",Fr),$e.bind(document,"selectstart",Fr),$e.bind(document,"mousedown",D,!0),$e.bind(document,"mouseup",D,!0)),$e.bind(document,"keyup",f),e.on("element.hover",m),e.on("element.out",h)),s("init")===!1)return g(),!1;P.autoActivate&&u(b,!0)}e.on("diagram.destroy",g),this.init=v,this.move=u,this.hover=m,this.out=h,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(b){V(r,b)}}Ly.$inject=["eventBus","canvas","selection","elementRegistry"];const $i={__depends__:[bA,Qn],dragging:["type",Ly]};function To(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}To.prototype.next=function(){return this._prefix+ ++this._counter};const $A=new To("ps");var FA=["marker-start","marker-mid","marker-end"],jA=["circle","ellipse","line","path","polygon","polyline","path","rect"];function ur(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}ur.$inject=["elementRegistry","eventBus","canvas","styles"],ur.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")},ur.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},ur.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Yh(n);return this._cloneMarkers(Lr(r),i),we(r,this._styles.cls(i,[])),je(t,r),we(r,"data-preview-support-element-id",e.id),r},ur.prototype.addFrame=function(e,t){var n=Pe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return je(t,n),we(n,"data-preview-support-element-id",e.id),n},ur.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),VA(e)&&FA.forEach(function(r){if(we(e,r)){var o=HA(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},ur.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,$A.next()].join("-"),a=ot("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Yh(n);s.id=o,Xe(s).add(r);var c=ot(":scope > defs",e);c||(c=Pe("defs"),je(e,c)),je(c,s);var u=GA(s.id);we(t,i,u)};function HA(e,t,n){var i=zA(we(e,t));return ot("marker#"+i,n||document)}function zA(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function GA(e){return"url(#"+e+")"}function VA(e){return jA.indexOf(e.nodeName)!==-1}const Mo={__init__:["previewSupport"],previewSupport:["type",ur]};var WA="drop-ok",Iy="drop-not-ok",By="attach-ok",Ny="new-parent",$y="create",UA=2e3;function Fy(e,t,n,i,r){function o(c,u,l,f,p){if(!u)return!1;c=Ue(c,function(v){var b=v.labelTarget;return!v.parent&&!(Ge(v)&&c.indexOf(b)!==-1)});var d=pt(c,function(v){return!at(v)}),m=!1,h=!1,g=!1;Hy(c)&&(m=r.allowed("shape.attach",{position:l,shape:d,target:u})),m||(Hy(c)?g=r.allowed("shape.create",{position:l,shape:d,source:f,target:u}):g=r.allowed("elements.create",{elements:c,position:l,target:u}));var y=p.connectionTarget;return g||m?(d&&f&&(h=r.allowed("connection.create",{source:y===f?d:f,target:y===f?f:d,hints:{targetParent:u,targetAttach:m}})),{attach:m,connect:h}):g===null||m===null?null:!1}function a(c,u){[By,WA,Iy,Ny].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,f=c.hover,p=u.source,d=u.hints||{};if(!f){u.canExecute=!1,u.target=null;return}jy(c);var m={x:c.x,y:c.y},h=u.canExecute=f&&o(l,f,m,p,d);f&&h!==null&&(u.target=f,h&&h.attach?a(f,By):a(f,h?Ny:Iy))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,f=u.shape,p=u.elements,d=u.target,m=u.canExecute,h=m&&m.attach,g=m&&m.connect,y=u.hints||{};if(m===!1||!d)return!1;jy(c);var v={x:c.x,y:c.y};g?f=i.appendShape(l,f,v,d,{attach:h,connection:g===!0?{}:g,connectionTarget:y.connectionTarget}):(p=i.createElements(p,v,d,V({},y,{attach:h})),f=pt(p,function(b){return!at(b)})),V(u,{elements:p,shape:f}),V(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===$y&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],UA,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){De(u)||(u=[u]);var f=pt(u,function(m){return!at(m)});if(f){l=V({elements:u,hints:{},shape:f},l||{}),N(u,function(m){Be(m.x)||(m.x=0),Be(m.y)||(m.y=0)});var p=Ue(u,function(m){return!m.hidden}),d=Dt(p);N(u,function(m){at(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}})),V(m,{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2})}),t.init(c,$y,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:u,context:l}})}}}Fy.$inject=["canvas","dragging","eventBus","modeling","rules"];function jy(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 Hy(e){return e&&e.length===1&&!at(e[0])}var YA=750;function zy(e,t,n,i,r){function o(a){var s=Pe("g");we(s,r.cls("djs-drag-group",["no-events"]));var c=Pe("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Lr(l),u)):(l=n._createContainer("shape",c),n.drawShape(Lr(l),u),tn(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",YA,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var f;s?(l.parentNode||(f=e.getActiveLayer(),je(f,l)),tn(l,a.x,a.y)):Ht(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Ht(c)})}zy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const xc={__depends__:[$i,Mo,_i,Qn],__init__:["create","createPreview"],create:["type",Fy],createPreview:["type",zy]};function Hp(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)})}Hp.$inject=["eventBus"],Hp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||qA(0,0)};function qA(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 wa={__init__:["mouse"],mouse:["type",Hp]};var Gy=2e3;function Ln(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,f=c.elementsSet;u.priority=1,u.id=l.id,f.has(l.parent)&&(u.parent=l.parent.id),KA(l)&&(u.priority=2,u.host=l.host.id),at(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=XA(l)),Ge(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),N(["x","y","width","height"],function(p){Be(l[p])&&(u[p]=l[p])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",Gy,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Gy,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;V(u,{createElementsBehavior:!1})})}Ln.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Ln.prototype.copy=function(e,t={}){var n,i;return De(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(De(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},Ln.prototype.paste=function(e={}){var t=this._eventBus.createEvent({type:"copyPaste.pasteElements",hints:{},...e}),n=this._eventBus.fire(t);if(n!==!1){var i=t.tree;if(i){var r=t.hints,o=this._createElements(i);if(t.element&&t.point)return this._paste(o,t.element,t.point,r);this._create.start(this._mouse.getLastMoveEvent(),o,{hints:r})}}},Ln.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},Ln.prototype.cut=function(e){var t=this.copy(e),n=this._getElementIdsFromTree(t),i=e.filter(function(r){return n[r.id]});return i.length>0&&this._modeling.removeElements(i),t},Ln.prototype._getElementIdsFromTree=function(e){var t={};return N(e,function(n){N(n,function(i){i.id&&(t[i.id]=!0)})}),t},Ln.prototype._paste=function(e,t,n,i){N(e,function(o){Be(o.x)||(o.x=0),Be(o.y)||(o.y=0)});var r=Dt(e);return N(e,function(o){at(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}})),V(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,V({},i))},Ln.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return N(e,function(o,a){o=li(o,"priority"),N(o,function(s){var c=V({},pi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(at(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(Ge(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},Ln.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(pi(e,["id"]));return t},Ln.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(pi(e,["id"]));return t},Ln.prototype.createShape=function(e){var t=this._elementFactory.createShape(pi(e,["id"]));return t},Ln.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(at(e)&&(!n.has(e.source)||!n.has(e.target))||Ge(e)&&!n.has(e.labelTarget))},Ln.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Os(e);function s(f,p){return t.allowed("element.copy",{element:f,elements:p})}function c(f,p){var d=o.get(f);if(!d){var m={element:f,depth:p};r.push(m),o.set(f,m);return}if(d.depth<p){r=u(d,r);var h={element:d.element,depth:p};r.push(h),o.set(f,h)}}function u(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}Dr(a,function(f,p,d){if(Ge(f))return;N(f.labels,function(g){c(g,d)});function m(g){g&&g.length&&N(g,function(y){N(y.labels,function(v){c(v,d)}),c(y,d)})}N([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 l=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:l}),f}),r=li(r,function(f){return f.descriptor.priority}),e=cn(r,function(f){return f.element}),N(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,l)){Wy(f.element,e),l.delete(f.element);return}if(!s(f.element,e)){Wy(f.element,e),l.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function KA(e){return!!e.host}function XA(e){return cn(e.waypoints,function(t){return t=Vy(t),t.original&&(t.original=Vy(t.original)),t})}function Vy(e){return V({},e)}function Wy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const ZA={__depends__:[yA,xc,wa,_i],__init__:["copyPaste"],copyPaste:["type",Ln]};function zp(e,t,n){De(n)||(n=[n]),N(n,function(i){Cr(e[i])||(t[i]=e[i])})}var Gp=750;function Uy(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Gp,function(c){var u=c.descriptor,l=c.element,f=ie(l);if(Ge(l))return u;var p=u.businessObject=i(f,!0),d=u.di=i(Ze(l),!0);d.bpmnElement=p,zp(p,u,"name"),zp(d,u,"isExpanded"),f.default&&(u.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var f=ie(c);return c.default&&(l[c.default]={element:f,property:"default"}),c.host&&(ie(c).attachedToRef=ie(u[c.host])),pi(l,An(l,function(p,d,m){var h=d.element,g=d.property;return m===c.id&&(h.set(g,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,f=l.businessObject,p=l.di;if(Ge(l)){l.businessObject=ie(u[l.labelTarget]),l.di=Ze(u[l.labelTarget]);return}f=l.businessObject=i(f),p=l.di=i(p),p.bpmnElement=f,zp(l,f,["isExpanded","name"]),l.type=f.$type}),t.on("copyPaste.copyElement",Gp,function(c){var u=c.descriptor,l=c.element;if(E(l,"bpmn:Participant")){var f=ie(l);f.processRef&&(u.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;E(u,"bpmn:SubProcess")&&N(ua(l),f=>{l.push(f.annotation)})}),t.on("copyPaste.pasteElement",Gp,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Uy.$inject=["bpmnFactory","eventBus","moddleCopy"];const QA=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],JA=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Ea(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 li(r,o=>o==="extensionElements")}),e.on("moddleCopy.canCopyProperty",i=>{const{parent:r,property:o,propertyName:a}=i,s=Wt(r)&&r.$descriptor;if(a&&JA.includes(a))return o;if(a&&QA.includes(a)||a&&s&&!pt(s.properties,to({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(E(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}Ea.$inject=["eventBus","bpmnFactory","moddle"],Ea.prototype.copyElement=function(e,t,n,i=!1){n&&!De(n)&&(n=[n]),n=n||Vp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(De(r)&&(n=r),N(n,o=>{let a;Pn(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Ft(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Ea.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 Wt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):De(e)?An(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Wt(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},Ea.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 Vp(e,t){return An(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Yy={__depends__:[ZA],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Uy],moddleCopy:["type",Ea]};var qy=Math.round;function Wp(e,t){this._modeling=e,this._eventBus=t}Wp.$inject=["modeling","eventBus"],Wp.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,u=qy(s+o/2),l=qy(c+a/2),f=i.replaceShape(e,V({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function Ky(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Ky.$inject=["selection","eventBus"];const eT={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Ky],replace:["type",Wp]};function tT(e,t,n){De(n)||(n=[n]),N(n,function(i){Cr(e[i])||(t[i]=e[i])})}var nT=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function iT(e,t){var n=e&&Pn(e,"collapsed")?e.collapsed:!Ke(e),i;return t&&(Pn(t,"collapsed")||Pn(t,"isExpanded"))?i=Pn(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Xy(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,f=s.businessObject;if(_c(f)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&iT(s,c))return i.toggleCollapse(s),s;var p=e.create(l),d={type:l,businessObject:p};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),tT(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var m=Vp(f.$descriptor),h=Vp(p.$descriptor,!0),g=rT(m,h);V(p,ai(c,nT));var y=Ue(g,function(x){return x==="eventDefinitions"?Zy(s,c.eventDefinitionType):x==="loopCharacteristics"?!fn(p):Pn(p,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!fn(p):!0});if(p=n.copyElement(f,p,y),c.eventDefinitionType&&(Zy(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),E(f,"bpmn:Activity")){if(_c(f))d.isExpanded=Ke(s);else if(c&&Pn(c,"isExpanded")){d.isExpanded=c.isExpanded;var v=t.getDefaultSize(p,{isExpanded:d.isExpanded});d.width=v.width,d.height=v.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Ke(s)&&!E(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(_c(f)&&!_c(p)&&(u.moveChildren=!1),E(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=qt(s);Ze(s).isHorizontal||(Ze(d).isHorizontal=b),d.width=b?s.width:t.getDefaultSize(d).width,d.height=b?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,Ve(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Ve(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!E(f,"bpmn:BoundaryEvent")&&E(p,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}Xy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function _c(e){return E(e,"bpmn:SubProcess")}function Zy(e,t){var n=ie(e);return t&&n.get("eventDefinitions").some(function(i){return E(i,t)})}function rT(e,t){return e.filter(function(n){return t.includes(n)})}const Qy={__depends__:[Yy,eT,Qn],bpmnReplace:["type",Xy]};var oT=250;function jr(e){this._eventBus=e,this._tools=[],this._active=null}jr.$inject=["eventBus"],jr.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)},jr.prototype.isActive=function(e){return e&&this._active===e},jr.prototype.length=function(e){return this._tools.length},jr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},jr.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),N(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,oT,function(r){this._active&&(aT(r)||this.setActive(null))},this)};function aT(e){var t=e.originalEvent&&e.originalEvent.target;return t&&kr(t,'.group[data-group="tools"]')}const wc={__depends__:[$i],__init__:["toolManager"],toolManager:["type",jr]};function sT(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 cT(e,t){var n=[],i=new Set(e);N(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;N(a.concat(s),function(c){var u=c.source,l=c.target;(i.has(u)||i.has(l))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function uT(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 Up=Math.abs,lT=Math.round,Fi={x:"width",y:"height"},Jy="crosshair",lr={n:"top",w:"left",s:"bottom",e:"right"},pT=1500,Ec={n:"s",w:"e",s:"n",e:"w"},Sc=20;function Jn(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",pT,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&tv(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,f=u.direction,p=u.movingShapes,d=u.resizingShapes,m=u.start;if(u.initialized){tv(c);var h={x:0,y:0};h[l]=lT(c["d"+l]),s.makeSpace(p,d,h,f,m),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}Jn.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Jn.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Jy,data:{context:{reactivate:n}},trapClick:!1})},Jn.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Jy,data:{context:{}}})},Jn.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Jn.prototype.init=function(e,t){var n=Up(e.dx)>Up(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Up(i)<5)return!1;i<0&&(i*=-1),ba(e)&&(i*=-1);var o=sT(n,i),a=this._canvas.getRootElement();!pc(e)&&e.hover&&(a=e.hover);var s=[...ia(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=fT(c,n,o,r,u);return V(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),bc("resize-"+(n==="x"?"ew":"ns")),!0},Jn.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function f(d){s.has(d)||(s.add(d),o.push(d));var m=d.label;m&&!s.has(m)&&(s.add(m),o.push(m))}function p(d){c.has(d)||(c.add(d),a.push(d))}return N(e,function(d){if(!(!d.parent||Ge(d))){if(at(d)){l.push(d);return}var m=d[t],h=m+d[Fi[t]];if(dT(d)&&(n>0&&Le(d)[t]>i||n<0&&Le(d)[t]<i)){u.push(d);return}if(n>0&&m>i||n<0&&h<i){f(d);return}if(m<i&&h>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),N(o,function(d){var m=d.attachers;m&&N(m,function(h){f(h)})}),N(u,function(d){var m=d.host;(s.has(m)||c.has(m))&&f(d)}),N(l,function(d){var m=d.source,h=d.target,g=d.label;(s.has(m)||c.has(m))&&(s.has(h)||c.has(h))&&g&&f(g)}),{movingShapes:o,resizingShapes:a}},Jn.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Jn.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function ev(e){return{top:e.top-Sc,right:e.right+Sc,bottom:e.bottom+Sc,left:e.left-Sc}}function tv(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Be(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Be(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Be(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Be(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function fT(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),f=new Set(a);return N(a,function(p){var d=p.attachers,m=p.children,h=Ae(p),g=Ue(m,function(H){return!at(H)&&!Ge(H)&&!l.has(H)&&!f.has(H)}),y=Ue(m,function(H){return!at(H)&&!Ge(H)&&l.has(H)}),v,b,x,C=[],P=[],O,A,I,k;g.length&&(b=ev(Ae(Dt(g))),v=i-h[lr[n]]+b[lr[n]],n==="n"?s.bottom=u=Be(u)?Math.min(u,v):v:n==="w"?s.right=u=Be(u)?Math.min(u,v):v:n==="s"?s.top=c=Be(c)?Math.max(c,v):v:n==="e"&&(s.left=c=Be(c)?Math.max(c,v):v)),y.length&&(x=ev(Ae(Dt(y))),v=i-x[lr[Ec[n]]]+h[lr[Ec[n]]],n==="n"?s.bottom=u=Be(u)?Math.min(u,v):v:n==="w"?s.right=u=Be(u)?Math.min(u,v):v:n==="s"?s.top=c=Be(c)?Math.max(c,v):v:n==="e"&&(s.left=c=Be(c)?Math.max(c,v):v)),d&&d.length&&(d.forEach(function(H){l.has(H)?C.push(H):P.push(H)}),C.length&&(O=Ae(Dt(C.map(Le))),A=h[lr[Ec[n]]]-(O[lr[Ec[n]]]-i)),P.length&&(I=Ae(Dt(P.map(Le))),k=I[lr[n]]-(h[lr[n]]-i)),n==="n"?(v=Math.min(A||1/0,k||1/0),s.bottom=u=Be(u)?Math.min(u,v):v):n==="w"?(v=Math.min(A||1/0,k||1/0),s.right=u=Be(u)?Math.min(u,v):v):n==="s"?(v=Math.max(A||-1/0,k||-1/0),s.top=c=Be(c)?Math.max(c,v):v):n==="e"&&(v=Math.max(A||-1/0,k||-1/0),s.left=c=Be(c)?Math.max(c,v):v));var D=r&&r[p.id];D&&(n==="n"?(v=i+p[Fi[t]]-D[Fi[t]],s.bottom=u=Be(u)?Math.min(u,v):v):n==="w"?(v=i+p[Fi[t]]-D[Fi[t]],s.right=u=Be(u)?Math.min(u,v):v):n==="s"?(v=i-p[Fi[t]]+D[Fi[t]],s.top=c=Be(c)?Math.max(c,v):v):n==="e"&&(v=i-p[Fi[t]]+D[Fi[t]],s.left=c=Be(c)?Math.max(c,v):v))}),s}}function dT(e){return!!e.host}var Yp="djs-dragging",nv="djs-resizing",hT=250,Rc=Math.max;function iv(e,t,n,i,r){function o(a,s){N(a,function(c){r.addDragger(c,s),n.addMarker(c,Yp)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=Pe("g");we(l,i.cls("djs-crosshair-group",["no-events"])),je(s,l);var f=Pe("path");we(f,"d",u.x),Xe(f).add("djs-crosshair"),je(l,f);var p=Pe("path");we(p,"d",u.y),Xe(p).add("djs-crosshair"),je(l,p),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;tn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Ht(c)}),e.on("spaceTool.move",hT,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=Pe("path"),we(c,"d","M0,0 L0,0"),Xe(c).add("djs-crosshair"),je(p,c),s.line=c;var d=Pe("g");we(d,i.cls("djs-drag-group",["no-events"])),je(n.getActiveLayer(),d),o(l,d);var m=new Set(l);N(f,function(P){m.add(P)});var h=new Set,g=s.movingConnections=[];m.forEach(function(P){N(P.outgoing,function(O){h.has(O)||!at(O)||!m.has(O.target)||(h.add(O),g.push(O))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var y=Pe("g");we(y,i.cls("djs-frame-group",["no-events"])),je(n.getActiveLayer(),y);var v=[];N(f,function(P){var O=r.addFrame(P,y),A=O.getBBox();v.push({element:O,initialBounds:A}),n.addMarker(P,nv)}),s.frameGroup=y,s.frames=v}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};we(c,{d:b[u]});var x={x:"y",y:"x"},C={x:a.dx,y:a.dy};C[x[s.axis]]=0,tn(s.dragGroup,C.x,C.y),N(s.frames,function(P){var O=P.element,A=P.initialBounds,I,k;s.direction==="e"?we(O,{width:Rc(A.width+C.x,5)}):(I=Rc(A.width-C.x,5),we(O,{width:I,x:A.x+A.width-I})),s.direction==="s"?we(O,{height:Rc(A.height+C.y,5)}):(k=Rc(A.height-C.y,5),we(O,{height:k,y:A.y+A.height-k}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;N(c,function(m){n.removeMarker(m,Yp)}),N(u,function(m){n.removeMarker(m,Yp)}),p&&(Ht(f),Ht(p)),N(l,function(m){n.removeMarker(m,nv)}),d&&Ht(d)})}iv.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const mT={__init__:["spaceToolPreview"],__depends__:[$i,_i,wc,Mo,wa],spaceTool:["type",Jn],spaceToolPreview:["type",iv]};function Cc(e,t){e.invoke(Jn,this),this._canvas=t}Cc.$inject=["injector","canvas"],_e(Cc,Jn),Cc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=Jr(po(r.children.filter(u=>E(u,"bpmn:Artifact")),Dt(o))));const s=[...e,...a];var c=Jn.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(E(u,"bpmn:TextAnnotation")||gT(u)&&(t==="y"&&qt(u)||t==="x"&&!qt(u)))}),c};function gT(e){return E(e,"bpmn:Participant")&&!ie(e).processRef}const rv={__depends__:[mT],spaceTool:["type",Cc]};function _t(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}_t.$inject=["eventBus","injector"],_t.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},_t.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(r===void 0){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},_t.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},_t.prototype.undo=function(){let e=this._getUndoAction(),t;if(e){for(this._currentExecution.trigger="undo",this._pushAction(e);e&&(this._internalUndo(e),t=this._getUndoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},_t.prototype.redo=function(){let e=this._getRedoAction(),t;if(e){for(this._currentExecution.trigger="redo",this._pushAction(e);e&&(this._internalExecute(e,!0),t=this._getRedoAction(),!(!t||t.id!==e.id));)e=t;this._popAction()}},_t.prototype.register=function(e,t){this._setHandler(e,t)},_t.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},_t.prototype.canUndo=function(){return!!this._getUndoAction()},_t.prototype.canRedo=function(){return!!this._getRedoAction()},_t.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},_t.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},_t.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo(()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)})},_t.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const o of i)if(r=this._eventBus.fire("commandStack."+o,n),n.cancelBubble)break;return r},_t.prototype._createId=function(){return this._uid++},_t.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},_t.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo(()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)}),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},_t.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},_t.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:bd("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},_t.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=De(e)?e:[e],t.dirty=t.dirty.concat(e))},_t.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},_t.prototype._revertedAction=function(e){this._stackIdx--},_t.prototype._getHandler=function(e){return this._handlerMap[e]},_t.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};const yT={commandStack:["type",_t]};function pr(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 vT=250,ov=1400;function qp(e,t,n){te.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",ov,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=av(a),o.validatedShapes=av(s)}),i&&t.on("shape.move.start",vT,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const u of c.labels)!u.hidden&&!a.has(u)&&s.add(u),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",ov,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];N(s,function(u){N(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;pr(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=Pl(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&&(Tt(s.labels,a,c),a.labelTarget=s)})}_e(qp,te),qp.$inject=["injector","eventBus","modeling"];function av(e){var t=new Set(e);return Ue(e,function(n){return!t.has(n.labelTarget)})}const bT={__init__:["labelSupport"],labelSupport:["type",qp]};var xT=251,sv=1401,cv="attach-ok";function Kp(e,t,n,i,r){te.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",sv,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=_T(c),s.validatedShapes=wT(u)}),o&&t.on("shape.move.start",xT,function(a){var s=a.context,c=s.shapes,u=Xp(c);N(u,function(l){o.makeDraggable(s,l,!0),N(l.labels,function(f){o.makeDraggable(s,f,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,cv),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,cv)}))}}),this.preExecuted("elements.move",sv,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Xp(u);N(l,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Ue(c,function(f){var p=f.host;return ET(f)&&!ST(c,p)}),N(l,function(f){r.updateAttachment(f,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;N(s,function(c){N(c.attachers,function(u){N(u.outgoing.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)}),N(u.incoming.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;pr(c.attachers,function(l){var f=i.allowed("elements.move",{target:u,shapes:[l]});f==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&N(u.attachers,function(l){var f=Cg(l,c,u);r.moveShape(l,f,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&N(f,function(d){var m=Cg(d,u,l);r.moveShape(d,m,d.parent),N(d.labels,function(h){r.moveShape(h,m,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;pr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}_e(Kp,te),Kp.$inject=["injector","eventBus","canvas","rules","modeling"];function Xp(e){return Nu(cn(e,function(t){return t.attachers||[]}))}function _T(e){var t=Xp(e);return J0("id",e,t)}function wT(e){var t=eo(e,"id");return Ue(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function ET(e){return!!e.host}function ST(e,t){return e.indexOf(t)!==-1}const RT={__depends__:[_i],__init__:["attachSupport"],attachSupport:["type",Kp]};function uv(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(tm(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)})}uv.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const Zp={__init__:["changeSupport"],changeSupport:["type",uv]};function ei(e){this._model=e}ei.$inject=["moddle"],ei.prototype._needsId=function(e){return Ve(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"])},ei.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;E(e,"bpmn:Activity")?t="Activity":E(e,"bpmn:Event")?t="Event":E(e,"bpmn:Gateway")?t="Gateway":Ve(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))},ei.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},ei.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},ei.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",V({bpmnElement:e,bounds:this.createDiBounds()},t))},ei.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},ei.prototype.createDiWaypoints=function(e){var t=this;return cn(e,function(n){return t.createDiWaypoint(n)})},ei.prototype.createDiWaypoint=function(e){return this.create("dc:Point",ai(e,["x","y"]))},ei.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",V({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},ei.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",V({bpmnElement:e},t))};function In(e,t,n){te.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var m=d.context,h=m.hints||{},g;!m.cropped&&h.createElementsBehavior!==!1&&(g=m.connection,g.waypoints=n.getCroppedWaypoints(g),m.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var m=d.context;i.updateParent(m.shape||m.connection,m.oldParent)}function a(d){var m=d.context,h=m.shape||m.connection,g=m.parent||m.newParent;i.updateParent(h,g)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Bn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Bn(a));function s(d){var m=d.context,h=m.oldRoot,g=h.children;N(g,function(y){E(y,"bpmn:BaseElement")&&i.updateParent(y)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var m=d.context.shape;E(m,"bpmn:BaseElement")&&i.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],Bn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Bn(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Bn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Bn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Bn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Bn(l)),this.executed("connection.reconnect",Bn(function(d){var m=d.context,h=m.connection,g=m.oldSource,y=m.newSource,v=ie(h),b=ie(g),x=ie(y);v.conditionExpression&&!Ve(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=v.conditionExpression,delete v.conditionExpression),g!==y&&b.default===v&&(m.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",Bn(function(d){var m=d.context,h=m.connection,g=m.oldSource,y=m.newSource,v=ie(h),b=ie(g),x=ie(y);m.oldConditionExpression&&(v.conditionExpression=m.oldConditionExpression),m.oldDefault&&(b.default=m.oldDefault,delete x.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Bn(f)),this.reverted(["element.updateAttachment"],Bn(f)),this.executed("element.updateLabel",Bn(p)),this.reverted("element.updateLabel",Bn(p));function p(d){const{element:m}=d.context,h=Wn(m),g=Ze(m),y=g&&g.get("label");rr(m)||fc(m)||(h&&!y?g.set("label",t.create("bpmndi:BPMNLabel")):!h&&y&&g.set("label",void 0))}}_e(In,te),In.$inject=["eventBus","bpmnFactory","connectionDocking"],In.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},In.prototype.updateParent=function(e,t){if(!Ge(e)&&!(E(e,"bpmn:DataStoreReference")&&e.parent&&E(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ze(e),o=n&&n.businessObject,a=Ze(n);E(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),E(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),E(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),E(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},In.prototype.updateBounds=function(e){var t=Ze(e),n=PT(e);if(n){var i=ci(n,t.get("bounds"));V(n,{x:e.x+i.x,y:e.y+i.y})}var r=Ge(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),V(o,{x:e.x,y:e.y,width:e.width,height:e.height})},In.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;E(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),Ct(i,e)),E(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Tt(r,e))}},In.prototype.updateDiConnection=function(e,t,n){var i=Ze(e),r=Ze(t),o=Ze(n);i.sourceElement&&i.sourceElement.bpmnElement!==ie(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ie(n)&&(i.targetElement=n&&o)},In.prototype.updateDiParent=function(e,t){if(t&&!E(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Ct(n,e),e.$parent=null)}};function CT(e){for(;e&&!E(e,"bpmn:Definitions");)e=e.$parent;return e}In.prototype.getLaneSet=function(e){var t,n;return E(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(E(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},In.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((E(e,"bpmn:DataInput")||E(e,"bpmn:DataOutput"))&&(E(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(E(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(E(e,"bpmn:FlowElement")){if(t){if(E(t,"bpmn:Participant"))t=t.processRef;else if(E(t,"bpmn:Lane"))do t=t.$parent.$parent;while(E(t,"bpmn:Lane"))}i="flowElements"}else if(E(e,"bpmn:Artifact")){for(;t&&!E(t,"bpmn:Process")&&!E(t,"bpmn:SubProcess")&&!E(t,"bpmn:Collaboration");)if(E(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(E(e,"bpmn:MessageFlow"))i="messageFlows";else if(E(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=CT(e.$parent||t),e.$parent&&(Ct(o.get("rootElements"),r),r.$parent=null),t&&(Tt(o.get("rootElements"),r),r.$parent=o))}else E(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":E(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),Ct(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);Ct(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},In.prototype.updateConnectionWaypoints=function(e){var t=Ze(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},In.prototype.updateConnection=function(e){var t=e.connection,n=ie(t),i=t.source,r=ie(i),o=t.target,a=ie(t.target),s;if(E(n,"bpmn:DataAssociation"))E(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):E(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=E(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(Ct(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(Ct(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)},In.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Bn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;E(i,"bpmn:BaseElement")&&e(t)}}function PT(e){if(E(e,"bpmn:Activity")){var t=Ze(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function fr(e,t){Li.call(this),this._bpmnFactory=e,this._moddle=t}_e(fr,Li),fr.$inject=["bpmnFactory","moddle"],fr.prototype._baseCreate=Li.prototype.create,fr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,V({type:"label",di:n},Ir,t))}return this.createElement(e,t)},fr.prototype.createElement=function(e,t){t=V({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!TT(r)){var o=V({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}E(i,"bpmn:Group")&&(t=V({isFrame:!0},t)),t=AT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=Qp(r,t,"isExpanded")),Ve(i,["bpmn:Lane","bpmn:Participant"])&&(t=Qp(r,t,"isHorizontal")),E(i,"bpmn:SubProcess")&&(t.collapsed=!Ke(i,r)),E(i,"bpmn:ExclusiveGateway")&&(Pn(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Ft(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Ft(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=V({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},fr.prototype.getDefaultSize=function(e,t){var n=ie(e);if(t=t||Ze(e),E(n,"bpmn:SubProcess"))return Ke(n,t)?{width:350,height:200}:{width:100,height:80};if(E(n,"bpmn:Task"))return{width:100,height:80};if(E(n,"bpmn:Gateway"))return{width:50,height:50};if(E(n,"bpmn:Event"))return{width:36,height:36};if(E(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Ke(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return E(n,"bpmn:Lane")?{width:400,height:100}:E(n,"bpmn:DataObjectReference")?{width:36,height:50}:E(n,"bpmn:DataStoreReference")?{width:50,height:50}:E(n,"bpmn:TextAnnotation")?{width:100,height:40}:E(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},fr.prototype.createParticipantShape=function(e){return Wt(e)||(e={isExpanded:e}),e=V({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function AT(e,t,n){return N(n,function(i){t=Qp(e,t,i)}),t}function Qp(e,t,n){return t[n]===void 0?t:(e[n]=t[n],pi(t,[n]))}function TT(e){return Ve(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Pc(e,t){this._modeling=e,this._canvas=t}Pc.$inject=["modeling","canvas"],Pc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;N(n,function(r){var o={x:0,y:0};Ft(i.left)?o.x=i.left-r.x:Ft(i.right)?o.x=i.right-r.width-r.x:Ft(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Ft(i.top)?o.y=i.top-r.y:Ft(i.bottom)?o.y=i.bottom-r.height-r.y:Ft(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Pc.prototype.postExecute=function(e){};function Ac(e){this._modeling=e}Ac.$inject=["modeling"],Ac.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},Ac.prototype.postExecute=function(e){var t=e.hints||{};MT(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 MT(e,t){return Yi(e.outgoing,function(n){return n.target===t})}function Tc(e,t){this._canvas=e,this._layouter=t}Tc.$inject=["canvas","layouter"],Tc.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},Tc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Mc=Math.round;function Jp(e){this._modeling=e}Jp.$inject=["modeling"],Jp.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;N(t,function(f){Be(f.x)||(f.x=0),Be(f.y)||(f.y=0)});var s=Ue(t,function(f){return!f.hidden}),c=Dt(s);N(t,function(f){at(f)&&(f.waypoints=cn(f.waypoints,function(p){return{x:Mc(p.x-c.x-c.width/2+r.x),y:Mc(p.y-c.y-c.height/2+r.y)}})),V(f,{x:Mc(f.x-c.x-c.width/2+r.x),y:Mc(f.y-c.y-c.height/2+r.y)})});var u=new Set(Os(t)),l={};N(t,function(f){if(at(f)){l[f.id]=Be(i)?a.createConnection(l[f.source.id],l[f.target.id],i,f,f.parent||n,o):a.createConnection(l[f.source.id],l[f.target.id],f,f.parent||n,o);return}var p=V({},o);u.has(f)||(p.autoResize=!1),Ge(f)&&(p=pi(p,["attach"])),l[f.id]=Be(i)?a.createShape(f,ai(f,["x","y","width","height"]),f.parent||n,i,p):a.createShape(f,ai(f,["x","y","width","height"]),f.parent||n,p)}),e.elements=Jr(l)};var lv=Math.round;function dr(e){this._canvas=e}dr.$inject=["canvas"],dr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?V(t,n):V(t,{x:n.x-lv(t.width/2),y:n.y-lv(t.height/2)}),this._canvas.addShape(t,i,r),t},dr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Sa(e){dr.call(this,e)}_e(Sa,dr),Sa.$inject=["canvas"];var kT=dr.prototype.execute;Sa.prototype.execute=function(e){var t=e.shape;return DT(t),t.labelTarget=e.labelTarget,kT.call(this,e)};var OT=dr.prototype.revert;Sa.prototype.revert=function(e){return e.shape.labelTarget=null,OT.call(this,e)};function DT(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Ra(e,t){this._canvas=e,this._modeling=t}Ra.$inject=["canvas","modeling"],Ra.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Ra.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Pl(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Ra.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Tt(n.children,t,i),this._canvas.addConnection(t,n),t};function ef(e,t){this._modeling=e,this._elementRegistry=t}ef.$inject=["modeling","elementRegistry"],ef.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;N(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function Ca(e,t){this._canvas=e,this._modeling=t}Ca.$inject=["canvas","modeling"],Ca.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;pr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),pr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),pr(n.children,function(i){at(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Ca.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Pl(i.children,n),t.removeShape(n),n},Ca.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Tt(i.children,n,r),t.addShape(n,i),n};function kc(e){this._modeling=e}kc.$inject=["modeling"];var pv={x:"y",y:"x"};kc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,y){g.range.min=Math.min(y[i],g.range.min),g.range.max=Math.max(y[i]+y[r],g.range.max)}function a(g){return g[i]+g[r]/2}function s(g){return g.length-1}function c(g){return g.max-g.min}function u(g,y){var v={y:0};v[i]=g-a(y),v[i]&&(v[pv[i]]=0,t.moveElements([y],v,y.parent))}var l=n[0],f=s(n),p=n[f],d,m,h=0;N(n,function(g,y){var v,b,x;if(g.elements.length<2){y&&y!==n.length-1&&(o(g,g.elements[0]),h+=c(g.range));return}v=li(g.elements,i),b=v[0],y===f&&(b=v[s(v)]),x=a(b),g.range=null,N(v,function(C){if(u(x,C),g.range===null){g.range={min:C[i],max:C[i]+C[r]};return}o(g,C)}),y&&y!==n.length-1&&(h+=c(g.range))}),m=Math.abs(p.range.min-l.range.max),d=Math.round((m-h)/(n.length-1)),!(d<n.length-1)&&N(n,function(g,y){var v={},b;g===l||g===p||(b=n[y-1],g.range.max=0,N(g.elements,function(x,C){v[pv[i]]=0,v[i]=b.range.max-x[i]+d,g.range.min!==x[i]&&(v[i]+=x[i]-g.range.min),v[i]&&t.moveElements([x],v,x.parent),g.range.max=Math.max(x[i]+x[r],C?g.range.max:0)}))})},kc.prototype.postExecute=function(e){};function Oc(e,t){this._layouter=e,this._canvas=t}Oc.$inject=["layouter","canvas"],Oc.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return V(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Oc.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function tf(){}tf.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=Ct(o.children,t),Tt(i.children,t,r),t.parent=i,N(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},tf.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return Ct(n.children,t),Tt(i.children,t,r),t.parent=i,N(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 nf(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}nf.prototype.add=function(e,t){return this.addAll([e],t)},nf.prototype.addAll=function(e,t){var n=uS(e,!!t,this);return V(this,n),this};function Pa(e){this._modeling=e}Pa.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Pa.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),N(a,function(f){o.moveShape(f,t,u[f.id]&&!l&&n,{recurse:!1,layout:!1})}),N(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,u[f.id]&&!l&&n):o.layoutConnection(f,{connectionStart:p&&up(f,f.source,t),connectionEnd:d&&lp(f,f.target,t)})})},Pa.prototype.getClosure=function(e){return new nf().addAll(e,!0)};function Dc(e){this._helper=new Pa(e)}Dc.$inject=["modeling"],Dc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Dc.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 Hr(e){this._modeling=e,this._helper=new Pa(e)}Hr.$inject=["modeling"],Hr.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=ai(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Ct(o.children,t),Tt(i.children,t,r),V(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Hr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&(N(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:lp(o,t,n)})}),N(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:up(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},Hr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Tt(n.children,t,i),V(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Hr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Hr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Aa(e){this._modeling=e}Aa.$inject=["modeling"],Aa.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return De(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Aa.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||fv(De(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||fv(De(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Aa.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 fv(e){return e.original||e}function ji(e,t){this._modeling=e,this._rules=t}ji.$inject=["modeling","rules"],ji.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(m,h,g){return i.allowed("connection.reconnect",{connection:g,source:m,target:h})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var f;a.moveChildren!==!1&&(f=r.children.slice(),n.moveElements(f,{x:0,y:0},s,a));var p=r.incoming.slice(),d=r.outgoing.slice();N(p,function(m){var h=m.source,g=c(h,s,m);g&&t.reconnectEnd(m,s,ac(m,s,l),a)}),N(d,function(m){var h=m.target,g=c(s,h,m);g&&t.reconnectStart(m,s,oc(m,s,l),a)})},ji.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},ji.prototype.execute=function(e){},ji.prototype.revert=function(e){},ji.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},ji.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},ji.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function Ta(e){this._modeling=e}Ta.$inject=["modeling"],Ta.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ta.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&(N(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:ac(o,n,i)})}),N(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:oc(o,n,i)})}))},Ta.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function hr(e){this._modeling=e}hr.$inject=["modeling"],hr.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),N(r,function(s){a[s.id]=IT(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(cT(i,r),t,n,o,i,r,a)},hr.prototype.execute=function(){},hr.prototype.revert=function(){},hr.prototype.moveShapes=function(e,t){var n=this;N(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},hr.prototype.resizeShapes=function(e,t,n){var i=this;N(e,function(r){var o=uT(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},hr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);N(e,function(l){var f=l.source,p=l.target,d=LT(l),m=hv(n),h={},g=c.has(f)||u.has(f),y=c.has(p)||u.has(p);g&&y?(d=cn(d,function(v){return mv(v,i,n)&&(v[m]=v[m]+t[m]),v.original&&mv(v.original,i,n)&&(v.original[m]=v.original[m]+t[m]),v}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||y)&&(c.has(f)?h.connectionStart=up(l,f,t):c.has(p)?h.connectionEnd=lp(l,p,t):u.has(f)?h.connectionStart=oc(l,f,a[f.id]):u.has(p)&&(h.connectionEnd=ac(l,p,a[p.id])),s._modeling.layoutConnection(l,h))})};function dv(e){return V({},e)}function LT(e){return cn(e.waypoints,function(t){return t=dv(t),t.original&&(t.original=dv(t.original)),t})}function hv(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function mv(e,t,n){var i=hv(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function IT(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Lc(e){this._modeling=e}Lc.$inject=["modeling"],Lc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=gv(n),t.collapsed=!t.collapsed;var i=yv(n,t.collapsed);return[t].concat(i)},Lc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=vv(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function gv(e){var t={};return N(e,function(n){t[n.id]=n.hidden,n.children&&(t=V({},t,gv(n.children)))}),t}function yv(e,t){var n=[];return N(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(yv(i.children,i.collapsed||t)))}),n}function vv(e,t){var n=[];return N(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(vv(i.children,t)))}),n}function Ic(e){this._modeling=e}Ic.$inject=["modeling"],Ic.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=bv(i,t),xv(n,t),t.host=n,t},Ic.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,bv(n,t),xv(i,t,r),t};function bv(e,t){return Ct(e&&e.attachers,t)}function xv(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Tt(i,t,n)}}function rf(){}rf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},rf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function st(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}st.$inject=["eventBus","elementFactory","commandStack"],st.prototype.getHandlers=function(){return{"shape.append":Ac,"shape.create":dr,"shape.delete":Ca,"shape.move":Hr,"shape.resize":Ta,"shape.replace":ji,"shape.toggleCollapse":Lc,spaceTool:hr,"label.create":Sa,"connection.create":Tc,"connection.delete":Ra,"connection.move":tf,"connection.layout":Oc,"connection.updateWaypoints":rf,"connection.reconnect":Aa,"elements.create":Jp,"elements.move":Dc,"elements.delete":ef,"elements.distribute":kc,"elements.align":Pc,"element.updateAttachment":Ic}},st.prototype.registerHandlers=function(e){N(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},st.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)},st.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},st.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)},st.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)},st.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},st.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},st.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},st.prototype.createElements=function(e,t,n,i,r){De(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},st.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},st.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},st.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},st.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},st.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},st.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},st.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},st.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},st.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},st.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)},st.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},st.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)},st.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,V(i,{docking:"source"}))},st.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,V(i,{docking:"target"}))},st.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},st.prototype._create=function(e,t){return qS(t)?t:this._elementFactory.create(e,t)},st.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ma(e){this._elementRegistry=e}Ma.$inject=["elementRegistry"],Ma.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||BT(n,os(i));return _v(n,i),e.oldProperties=o,e.changed=r,r},Ma.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return _v(n,t),i},Ma.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return E(e,"bpmn:DataObject")?NT(e,t):[]};function BT(e,t){return An(t,function(n,i){return n[i]=e.get(i),n},{})}function _v(e,t){N(t,function(n,i){e.set(i,n)})}function NT(e,t){return t.filter(function(n){return E(n,"bpmn:DataObjectReference")&&ie(n).dataObjectRef===e})}var ka="default",Hi="id",wv="di",$T={width:0,height:0};function Oa(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}Oa.$inject=["elementRegistry","moddle","modeling","textRenderer"],Oa.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=GT(e.properties),s=e.oldProperties||FT(t,a);return Ev(a,o)&&(r.unclaim(o[Hi]),i.updateId(t,a[Hi]),r.claim(a[Hi],o)),ka in a&&(a[ka]&&n.push(i.get(a[ka].id)),o[ka]&&n.push(i.get(o[ka].id))),Sv(t,a),e.oldProperties=s,e.changed=n,n},Oa.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ie(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,$T)}},Oa.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 Sv(t,i),Ev(n,r)&&(a.unclaim(n[Hi]),o.updateId(t,i[Hi]),a.claim(i[Hi],r)),e.changed};function Ev(e,t){return Hi in e&&e[Hi]!==t[Hi]}function FT(e,t){var n=os(t),i=e.businessObject,r=Ze(e);return An(n,function(o,a){return a!==wv?o[a]=i.get(a):o[a]=jT(r,os(t.di)),o},{})}function jT(e,t){return An(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Sv(e,t){var n=e.businessObject,i=Ze(e);N(t,function(r,o){o!==wv?n.set(o,r):i&&HT(i,r)})}function HT(e,t){N(t,function(n,i){e.set(i,n)})}var zT=["default"];function GT(e){var t=V({},e);return zT.forEach(function(n){n in e&&(t[n]=ie(t[n]))}),t}function Bc(e,t){this._canvas=e,this._modeling=t}Bc.$inject=["canvas","modeling"],Bc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ze(r);return t.setRootElement(n),t.removeRootElement(r),Tt(a.rootElements,i),i.$parent=a,Ct(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Bc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ze(n);return t.setRootElement(r),t.removeRootElement(n),Ct(a.rootElements,i),i.$parent=null,Tt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function of(e,t){this._modeling=e,this._spaceTool=t}of.$inject=["modeling","spaceTool"],of.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Xn(i),a=o===i,s=a?i:i.parent,c=ar(s),u=qt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+Kn,y:i.y,width:i.width-Kn,height:i.height}:{x:i.x,y:i.y+Kn,width:i.width,height:i.height-Kn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var f=[];Dr(o,function(x){return f.push(x),x.label&&f.push(x.label),x===i?[]:Ue(x.children,function(C){return C!==i})});var p,d,m,h,g;r==="top"?(p=-120,d=i.y,m=d+10,h="n",g="y"):r==="left"?(p=-120,d=i.x,m=d+10,h="w",g="x"):r==="bottom"?(p=120,d=i.y+i.height,m=d-10,h="s",g="y"):r==="right"&&(p=120,d=i.x+i.width,m=d-10,h="e",g="x");var y=t.calculateAdjustments(f,g,p,m),v=u?{x:0,y:p}:{x:p,y:0};t.makeSpace(y.movingShapes,y.resizingShapes,v,h,m);var b=u?{x:i.x+(a?Kn:0),y:d-(r==="top"?120:0),width:i.width-(a?Kn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Kn:0),width:120,height:i.height-(a?Kn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function af(e){this._modeling=e}af.$inject=["modeling"],af.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=ar(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=qt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,f,p;for(p=0;p<i;p++)p===i-1?u=s-c*p:u=c,l=a?{x:n.x+Kn,y:n.y+p*c,width:n.width-Kn,height:u}:{x:n.x+p*c,y:n.y+Kn,width:u,height:n.height-Kn},p<o?t.resizeShape(r[p],l):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,l,n))};function Da(e,t){this._modeling=e,this._spaceTool=t}Da.$inject=["modeling","spaceTool"],Da.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Da.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=NC(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Da.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ae(e),r=Ae(t),o=ng(r,i),a=Xn(e),s=[],c=[];Dr(a,function(m){return s.push(m),(E(m,"bpmn:Lane")||E(m,"bpmn:Participant"))&&c.push(m),m.children});var u,l,f,p,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},f)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},f))};var La="flowNodeRef",sf="lanes";function Nc(){}Nc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,f){var p=Ae(f),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var f=Xn(l);return r[f.id]||(r[f.id]=ec(f)),r[f.id]}function u(l){if(!l.parent)return[];var f=c(l);return f.filter(function(p){return a(l,p)}).map(function(p){return p.businessObject})}return t.forEach(function(l){var f=Xn(l);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return E(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(l){var f=l.businessObject,p=f.get(sf),d=p.slice(),m=u(l);i.push({flowNode:f,remove:d,add:m})}),t.forEach(function(l){var f=l.businessObject;l.parent||f.get(La).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},Nc.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(n){var i=n.flowNode,r=i.get(sf);n.remove.forEach(function(o){Ct(r,o),Ct(o.get(La),i)}),n.add.forEach(function(o){Tt(r,o),Tt(o.get(La),i)})}),[]},Nc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(sf);n.add.forEach(function(o){Ct(r,o),Ct(o.get(La),i)}),n.remove.forEach(function(o){Tt(r,o),Tt(o.get(La),i)})}),[]};var cf="categoryValueRef";function Ia(e,t){this._bpmnFactory=e,this._elementRegistry=t}Ia.$inject=["bpmnFactory","elementRegistry"],Ia.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(v,b,x){if(b){var C=a.get(v);C||(C={},a.set(v,C)),!(x&&C.present)&&(!x&&C.past||(x?C.present={categoryValue:b,root:uf(v)}:C.past={categoryValue:b}))}}function c(v){r.set(v,ie(v))}function u(){n.filter(function(v){return E(v,"bpmn:FlowElement")&&!Ge(v)&&v.parent}).forEach(c)}function l(v){var b=ie(v),x=b.get("categoryValueRef");return x||(x=Zm(i,b),o.push(VT(v,x))),x}function f(v){return v.reduce(function(b,x){var C=uf(x),P=b.get(C);return P||(P=[],b.set(C,P)),P.push(x),b},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&u(),e.forEach(c),n.filter(function(v){return E(v,"bpmn:Group")&&!Ge(v)&&v.parent}).forEach(function(v){var b=ie(v).get("categoryValueRef");if(!b){var x=uf(v),C=p.get(x)||[],P=po(C,v),O=Object.keys(P).length>0;O&&(b=l(v))}s(v,b,!0)}),t.forEach(function(v){s(v.groupShape,v.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),m=Array.from(a.values()).reduce(function(v,b){return b.present&&v.add(b.present.categoryValue),b.past&&v.add(b.past.categoryValue),v},new Set),h=new Map,g=f(d);a.forEach(function(v,b){var x=v.present;if(x){var C=g.get(x.root)||[],P=po(C,b);C.forEach(function(O){if(P[O.id]){var A=h.get(O);A||(A=new Set,h.set(O,A)),A.add(x.categoryValue)}})}});var y=d.reduce(function(v,b){var x=r.get(b),C=x.get(cf),P=new Set(C),O=h.get(b)||new Set,A=Array.from(O).filter(function(k){return!P.has(k)}),I=C.filter(function(k){return m.has(k)&&!O.has(k)});return(A.length||I.length)&&v.push({businessObject:x,categoryValuesToAdd:A,categoryValuesToRemove:I}),v},[]);return{flowElements:y,groups:o}},Ia.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),WT(t.groups),YT(t.flowElements),[]},Ia.prototype.revert=function(e){var t=e.updates;return qT(t.flowElements),UT(t.groups),[]};function VT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function WT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function UT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=null})}function YT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(cf);t.categoryValuesToRemove.forEach(function(r){Ct(i,r)}),t.categoryValuesToAdd.forEach(function(r){Tt(i,r,!0)})})}function qT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(cf);t.categoryValuesToAdd.forEach(function(r){Ct(i,r)}),t.categoryValuesToRemove.forEach(function(r){Tt(i,r,!0)})})}function uf(e){for(;e.parent;)e=e.parent;return e}function $c(e){this._moddle=e}$c.$inject=["moddle"],$c.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),[]},$c.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 KT={fill:void 0,stroke:void 0};function lf(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Cn(t)){var n=XT(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}lf.$inject=["commandStack"],lf.prototype.postExecute=function(e){var t=e.elements,n=e.colors||KT,i=this,r={};"fill"in n&&V(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&V(r,{"border-color":this._normalizeColor(n.stroke)}),N(t,function(o){var a=at(o)?ai(r,["border-color"]):r,s=Ze(o);if(ZT(a),Ge(o)){if(!s||!E(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!Ve(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function XT(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 ZT(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var QT={width:0,height:0};function Rv(e,t,n){function i(c,u){var l=c.label||c,f=c.labelTarget||c;return CR(l,u),[l,f]}function r(c){var u=c.element,l=u.businessObject,f=c.newLabel;if(!Ge(u)&&rr(u)&&!Hs(u)&&!Cv(f)){var p=7,d=Dl(u);d={x:d.x,y:d.y+p},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=Wn(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!Ge(l)&&!E(l,"bpmn:TextAnnotation"))){if(Ge(l)&&Cv(f)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var m=Wn(u);typeof p>"u"&&(p=t.getExternalLabelBounds(l,m)),p&&e.resizeShape(l,p,QT)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Rv.$inject=["modeling","textRenderer","bpmnFactory"];function Cv(e){return!e||!e.trim()}function rn(e,t,n,i){st.call(this,e,t,n),this._bpmnRules=i}_e(rn,st),rn.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],rn.prototype.getHandlers=function(){var e=st.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Ma,e["element.updateProperties"]=Oa,e["canvas.updateRoot"]=Bc,e["lane.add"]=of,e["lane.resize"]=Da,e["lane.split"]=af,e["lane.updateRefs"]=Nc,e["group.updateRefs"]=Ia,e["id.updateClaim"]=$c,e["element.setColor"]=lf,e["element.updateLabel"]=Rv,e},rn.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},rn.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)},rn.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},rn.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},rn.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},rn.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},rn.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},rn.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},rn.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},rn.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},rn.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},rn.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},rn.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},rn.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Pv(){}Pv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Le(t.source||e.source),t.connectionEnd||Le(t.target||e.target)]};var Fc=20,JT=5,jc=Math.round,Av=20,eM={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function tM(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function nM(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Tv(e,t,n){var i=en(t,e,JT),r=n.split(":")[0],o=jc((t.x-e.x)/2+e.x),a=jc((t.y-e.y)/2+e.y),s,c,u=nM(r,i),l=/h|r|l/.test(r),f=!1,p=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(f=tM(i,r),c=l?"h:v":"v:h",f?l?(p=a===e.y,s={x:e.x+Fc*(/l/.test(r)?-1:1),y:p?a+Fc:a}):(p=o===e.x,s={x:p?o+Fc:o,y:e.y+Fc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:pf(e,s,c).concat(s),directions:c,turnNextDirections:p}}function iM(e,t,n){return Tv(e,t,n)}function rM(e,t,n){var i=Tv(t,e,Mv(n));return{waypoints:i.waypoints.slice().reverse(),directions:Mv(i.directions),turnNextDirections:i.turnNextDirections}}function oM(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=pf(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Mv(e){return e.split(":").reverse().join(":")}function aM(e,t,n){var i=jc((t.x-e.x)/2+e.x),r=jc((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 pf(e,t,n){if(n=n||"h:h",!mM(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Ov(n)){var i=iM(e,t,n),r=rM(e,t,n),o=oM(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return aM(e,t,n)}function sM(e,t,n){var i=pf(e,t,n);return i.unshift(e),i.push(t),Lv(i)}function cM(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Z0(o,"straight")[0]||"h:h",s=eM[a]||0,c=en(e,t,s),u=hM(c,a);n=n||Le(e),i=i||Le(t);var l=u.split(":"),f=Dv(n,e,l[0],gM(c)),p=Dv(i,t,l[1],c);return sM(f,p,u)}function uM(e,t,n,i,r,o){De(n)&&(r=n,o=i,n=Le(e),i=Le(t)),o=V({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&pM(e,t,n,i,o),c||(c=o.connectionEnd&&dM(t,e,i,r),c)||(c=o.connectionStart&&fM(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:cM(e,t,n,i,o)}function lM(e,t,n){return e>=t&&e<=n}function kv(e,t,n){var i={x:"width",y:"height"};return lM(t[e],n[e],n[e]+n[i[e]])}function pM(e,t,n,i,r){var o={},a,s;return s=en(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?kv(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:kv(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 fM(e,t,n,i){return ff(e,t,n,i)}function dM(e,t,n,i){var r=i.slice().reverse();return r=ff(e,t,n,r),r?r.reverse():null}function ff(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!pt(l,function(f,p){var d=l[p-1];return d&&oa(f,d)<3})}function o(l,f,p){var d=Oi(f,l);switch(d){case"v":return{x:p.x,y:l.y};case"h":return{x:l.x,y:p.y}}return{x:l.x,y:l.y}}function a(l,f,p){var d;for(d=l.length-2;d!==0;d--)if(im(l[d],f,Av)||im(l[d],p,Av))return l.slice(d);return l}if(r(i))return null;var s=i[0],c=i.slice(),u;return c[0]=n,c[1]=o(c[1],s,n),u=a(c,e,t),u!==c&&(c=ff(e,t,n,u)),c&&Oi(c)?null:c}function hM(e,t){if(Ov(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 mM(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Ov(e){return e&&/t|r|b|l/.test(e)}function gM(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 Dv(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 Lv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return Al(r,o,n,0)||t.push(n),t},[])}var yM=-10,vM=40,bM={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},xM={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},df={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Ba={top:"t",right:"r",bottom:"b",left:"l"};function Hc(e){this._elementRegistry=e}_e(Hc,Pv),Hc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=Iv(r&&r[0],n)),a||(a=Iv(r&&r[r.length-1],i)),(E(e,"bpmn:Association")||E(e,"bpmn:DataAssociation"))&&r&&!Bv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Ym(n,s)?bM:xM;return E(e,"bpmn:MessageFlow")?c=wM(n,i,l):(E(e,"bpmn:SequenceFlow")||Bv(n,i))&&(n===i?c={preferredLayouts:AM(n,e,l)}:E(n,"bpmn:BoundaryEvent")?c={preferredLayouts:TM(n,i,a,l)}:Na(n)||Na(i)?c={preferredLayouts:l.subProcess,preserveDocking:SM(n)}:E(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:E(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=V(c,t),u=Lv(uM(n,i,o,a,r,c))),u||[o,a]};function _M(e){var t=e.host;return en(Le(e),t,yM)}function wM(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:EM(e,t)}}function EM(e,t){return E(t,"bpmn:Participant")?"source":E(e,"bpmn:Participant")?"target":Na(t)?"source":Na(e)||E(t,"bpmn:Event")?"target":E(e,"bpmn:Event")?"source":null}function SM(e){return Na(e)?"target":"source"}function Iv(e,t){return e?e.original||e:Le(t)}function Bv(e,t){return E(t,"bpmn:Activity")&&E(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Na(e){return E(e,"bpmn:SubProcess")&&Ke(e)}function zr(e,t){return e===t}function RM(e,t){return t.indexOf(e)!==-1}function ko(e){var t=/right|left/.exec(e);return t&&t[0]}function Oo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Nv(e,t){return df[e]===t}function CM(e,t){var n=ko(e),i=df[n];return t.indexOf(i)!==-1}function PM(e,t){var n=Oo(e),i=df[n];return t.indexOf(i)!==-1}function $v(e){return e==="right"||e==="left"}function AM(e,t,n){var i=t.waypoints,r=i&&i.length&&en(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function TM(e,t,n,i){var r=Le(e),o=Le(t),a=_M(e),s,c,u=zr(e.host,t),l=RM(a,["top","right","bottom","left"]),f=en(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?MM(a,l,e,t,n,i):(s=kM(a,f,l,i.isHorizontal),c=OM(a,f,l,i.isHorizontal),[s+":"+c])}function MM(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Oo(e):ko(e),s=Ba[a],c;return t?$v(e)?c=Fv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=Fv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function Fv(e,t,n,i){var r=vM;return!(hf(e,i,n,r)||hf(e,i,{x:n.x+n.width,y:n.y+n.height},r)||hf(e,i,Le(t),r))}function hf(e,t,n,i){return Math.abs(t[e]-n[e])<i}function kM(e,t,n,i){if(n)return Ba[e];var r=Oo(e),o=ko(e),a=Oo(t),s=ko(t);if(i){if(zr(r,a)||Nv(o,s))return Ba[r]}else if(zr(o,s)||Nv(r,a))return Ba[o];return Ba[i?o:r]}function OM(e,t,n,i){if(n)return $v(e)?CM(e,t)||zr(e,t)?"h":"v":PM(e,t)||zr(e,t)?"v":"h";var r=Oo(e),o=ko(e),a=Oo(t),s=ko(t);return a&&!s?"v":s&&!a?"h":i?zr(r,a)?"h":"v":zr(o,s)?"v":"h"}Hc.$inject=["elementRegistry"];function jv(e){return V({original:e.point.original||e.point},e.actual)}function mr(e,t){this._elementRegistry=e,this._graphicsFactory=t}mr.$inject=["elementRegistry","graphicsFactory"],mr.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(jv(i)),o.push(jv(r)),o},mr.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}},mr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return aa(i,r,n)},mr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},mr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},mr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const mf={__init__:["modeling","bpmnUpdater"],__depends__:[ZP,dA,mA,gA,Qy,yT,bT,RT,Qn,Zp,rv],bpmnFactory:["type",ei],bpmnUpdater:["type",In],elementFactory:["type",fr],modeling:["type",rn],layouter:["type",Hc],connectionDocking:["type",mr]};var DM=10,Hv=50,LM=250;function gf(e,t,n,i){for(var r;r=IM(e,n,t);)n=i(t,n,r);return n}function yf(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,u=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-u+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+u+c)}}),r}}function IM(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=NM(e);return pt(r,function(o){if(o===n)return!1;var a=en(o,i,DM);return a==="intersect"})}function BM(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||Hv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||LM,c=t.reference||"start";o||(o=jM);function u(m,h){return r==="n"?c==="start"?Ae(m).top-Ae(h).bottom:c==="center"?Ae(m).top-Le(h).y:Ae(m).top-Ae(h).top:r==="w"?c==="start"?Ae(m).left-Ae(h).right:c==="center"?Ae(m).left-Le(h).x:Ae(m).left-Ae(h).left:r==="s"?c==="start"?Ae(h).top-Ae(m).bottom:c==="center"?Le(h).y-Ae(m).bottom:Ae(h).bottom-Ae(m).bottom:c==="start"?Ae(h).left-Ae(m).right:c==="center"?Le(h).x-Ae(m).right:Ae(h).right-Ae(m).right}var l=e.incoming.filter(o).map(function(m){var h=a(m),g=h<0?u(m.source,e):u(e,m.source);return{id:m.source.id,distance:g,weight:h}}),f=e.outgoing.filter(o).map(function(m){var h=a(m),g=h>0?u(e,m.target):u(m.target,e);return{id:m.target.id,distance:g,weight:h}}),p=l.concat(f).reduce(function(m,h){return m[h.id+"__weight_"+h.weight]=h,m},{}),d=An(p,function(m,h){var g=h.distance,y=h.weight;return g<0||g>s||(m[String(g)]||(m[String(g)]=0),m[String(g)]+=1*y,(!m.distance||m[m.distance]<m[String(g)])&&(m.distance=g)),m},{});return d.distance||i}function NM(e){var t=vf(e);return e.host&&(t=t.concat(vf(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(vf(i))},[]))),t}function vf(e){return FM(e).concat($M(e))}function $M(e){return e.incoming.map(function(t){return t.source})}function FM(e){return e.outgoing.map(function(t){return t.target})}function jM(){return!0}var HM=100;function zv(e,t,n){e.on("autoPlace",HM,function(i){var r=i.shape,o=i.source;return zM(o,r)}),e.on("autoPlace.end",function(i){n.scrollToElement(i.shape)}),this.append=function(i,r,o){e.fire("autoPlace.start",{source:i,shape:r});var a=e.fire("autoPlace",{source:i,shape:r}),s=t.appendShape(i,r,a,i.parent,o);return e.fire("autoPlace.end",{source:i,shape:s}),s}}zv.$inject=["eventBus","modeling","canvas"];function zM(e,t,n){n||(n={});var i=n.defaultDistance||Hv,r=Le(e),o=Ae(e);return{x:o.right+i+t.width/2,y:r.y}}function Gv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Gv.$inject=["eventBus","selection"];const GM={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",zv],autoPlaceSelectionBehavior:["type",Gv]};function Vv(e,t,n){var i=Ym(e,n);if(E(t,"bpmn:TextAnnotation"))return WM(e,t,i);if(Ve(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return UM(e,t,i);if(E(t,"bpmn:FlowNode"))return VM(e,t,i)}function VM(e,t,n){var i=Ae(e),r=Le(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=BM(e,{filter:function(d){return E(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;E(e,"bpmn:BoundaryEvent")&&(u=en(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+Wv(u,c,o)}:{x:r.x+Wv(u,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return gf(e,t,l,yf(p))}function Wv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function WM(e,t,n){var i=Ae(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};at(e)&&(r=Le(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return gf(e,t,r,yf(a))}function UM(e,t,n){var i=Ae(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 gf(e,t,r,yf(a))}function Uv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Vv(r,i,t)})}Uv.$inject=["eventBus","elementRegistry"];const zc={__depends__:[GM],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Uv]},Yv=[Wm,fa,mf,zc];function YM(e={}){Hd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new mo({container:t,moddleExtensions:e.moddleExtensions??fs,additionalModules:[...Yv,...e.additionalModules??[]]})}var qM=new To("ov"),KM=500;function Zt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=qM,this._overlayDefaults=V({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=XM(n.getContainer()),this._init()}Zt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Zt.prototype.get=function(e){if(Cn(e)&&(e={id:e}),Cn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ue(t.overlays,to({type:e.type})):t.overlays.slice():[]}else return e.type?Ue(this._overlays,to({type:e.type})):e.id?this._overlays[e.id]:null},Zt.prototype.add=function(e,t,n){if(Wt(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=V({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Zt.prototype.remove=function(e){var t=this.get(e)||[];De(t)||(t=[t]);var n=this;N(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(mi(i.html),mi(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)}})},Zt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Zt.prototype.show=function(){Gc(this._overlayRoot)},Zt.prototype.hide=function(){Gc(this._overlayRoot,!1)},Zt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Cs(this._overlayRoot)},Zt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=Dt(t);i=o.x,r=o.y}qv(n,i,r),ln(e.html,"data-container-id",t.id)},Zt.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=Dt(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=Dt(i).height:s=i.height,o=t.bottom*-1+s}qv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Zt.prototype._createOverlayContainer=function(e){var t=mt('<div class="djs-overlays" />');bn(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Zt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Kv(this._overlayRoot,n)},Zt.prototype._getOverlayContainer=function(e,t){var n=pt(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Zt.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)),Cn(i)&&(i=mt(i)),o=this._getOverlayContainer(n),r=mt('<div class="djs-overlay" data-overlay-id="'+t+'">'),bn(r,{position:"absolute"}),r.appendChild(i),e.type&&bt(r).add("djs-overlay-"+e.type);var a=this._canvas.findRoot(n),s=this._canvas.getRootElement();Gc(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())},Zt.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&&(Ft(r)&&r>t.scale||Ft(o)&&o<t.scale))&&(c=!1),Gc(a,c),this._updateOverlayScale(e,t)},Zt.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),Ft(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Ft(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Ft(a)&&(s="scale("+a+","+a+")"),Kv(o,s)},Zt.prototype._updateOverlaysVisibilty=function(e){var t=this;N(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Zt.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});N(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){mi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",KM,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&(N(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&bt(r.html)[i.add?"add":"remove"](i.marker)}),e.on("root.set",function(){t._updateOverlaysVisibilty(t._canvas.viewbox())}),e.on("diagram.clear",this.clear,this)};function XM(e){var t=mt('<div class="djs-overlay-container" />');return bn(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function qv(e,t,n){bn(e,{left:t+"px",top:n+"px"})}function Gc(e,t){e.style.display=t===!1?"none":""}function Kv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Vc={__init__:["overlays"],overlays:["type",Zt]};function bf(e,t){t.invoke(te,this),this.executed(function(n){var i=n.context;i.rootElement?e.setRootElement(i.rootElement):i.rootElement=e.getRootElement()}),this.revert(function(n){var i=n.context;i.rootElement&&e.setRootElement(i.rootElement)})}_e(bf,te),bf.$inject=["canvas","injector"];const ZM={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",bf]};function $a(e){return CSS.escape(e)}var QM={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Xv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return QM[t]})}var JM="bjs-breadcrumbs-shown";function Zv(e,t,n){var i=mt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=bt(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=ie(u),f=pt(a,function(p){return p===l});f&&s()});function s(c){c&&(a=e2(c));var u=a.flatMap(function(f){var p=n.findRoot(xi(f))||n.findRoot(f.id);if(!p&&E(f,"bpmn:Process")){var d=t.find(function(g){var y=ie(g);return y&&y.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var m=Xv(f.name||f.id),h=mt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(p)}),h});i.innerHTML="";var l=u.length>1;o.toggle(JM,l),u.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}Zv.$inject=["eventBus","elementRegistry","canvas"];function e2(e){for(var t=ie(e),n=[],i=t;i;i=i.$parent)(E(i,"bpmn:SubProcess")||E(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function Qv(e,t){var n=null,i=new t2;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!E(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}Qv.$inject=["eventBus","canvas"];function t2(){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 Jv={x:180,y:160};function Gr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Gr.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)})}},Gr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;E(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),i2(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},Gr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=n2(e),i={x:n.x-Jv.x,y:n.y-Jv.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)})},Gr.prototype._moveToDiPlane=function(e,t){var n=eb(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Gr.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},Gr.$inject=["eventBus","moddle"];function eb(e){return E(e,"bpmndi:BPMNDiagram")?e:eb(e.$parent)}function n2(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=Ae(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),Is(t)}function i2(e,t){var n=e.$parent;return!(!E(n,"bpmn:SubProcess")||n===t.bpmnElement||Ve(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var Wc=250,r2='<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>',o2="bjs-drilldown-empty";function gr(e,t,n,i,r){te.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",Wc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",Wc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],Wc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],Wc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}_e(gr,te),gr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},gr.prototype._canDrillDown=function(e){var t=this._canvas;return E(e,"bpmn:SubProcess")&&t.findRoot(xi(e))},gr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ie(e),i=t.get({element:n.id,type:"drilldown"})[0];if(i){var r=n&&n.get("flowElements")&&n.get("flowElements").length;bt(i.html).toggle(o2,!r)}},gr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ie(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=mt('<button type="button" class="bjs-drilldown">'+r2+"</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(xi(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},gr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},gr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const a2={__depends__:[Vc,Zp,ZM],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",Zv],drilldownCentering:["type",Qv],drilldownOverlayBehavior:["type",gr],subprocessCompatibility:["type",Gr]};function yr(e){xt.call(this,e)}_e(yr,xt),yr.prototype._modules=[Wm,a2,Vc,Qn,fa],yr.prototype._moddleExtensions={};var Uc="keyboard.keydown",s2="keyboard.keyup",c2=1e3,tb="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 xn(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(tb));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}xn.$inject=["config.keyboard","eventBus"],xn.prototype._keydownHandler=function(e){this._keyHandler(e,Uc)},xn.prototype._keyupHandler=function(e){this._keyHandler(e,s2)},xn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Uc,i),n&&e.preventDefault()}},xn.prototype._isEventIgnored=function(e){return!1},xn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(tb)),this.unbind(),e=this._node=this._target,$e.bind(e,"keydown",this._keydownHandler),$e.bind(e,"keyup",this._keyupHandler),this._fire("bind")},xn.prototype.getBinding=function(){return this._node},xn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),$e.unbind(e,"keydown",this._keydownHandler),$e.unbind(e,"keyup",this._keyupHandler)),this._node=null},xn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},xn.prototype.addListener=function(e,t,n){Ut(e)&&(n=t,t=e,e=c2),this._eventBus.on(n||Uc,e,t)},xn.prototype.removeListener=function(e,t){this._eventBus.off(t||Uc,e)},xn.prototype.hasModifier=TA,xn.prototype.isCmd=Dn,xn.prototype.isShift=jp,xn.prototype.isKey=zt;var u2=500;function Do(e,t){var n=this;e.on("editorActions.init",u2,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Do.$inject=["eventBus","keyboard"],Do.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if(LA(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(IA(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(MA(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(kA(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(OA(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(DA(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(zt(["+","Add","="],r)&&Dn(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(zt(["-","Subtract"],r)&&Dn(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(zt("0",r)&&Dn(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(zt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const xf={__init__:["keyboard","keyboardBindings"],keyboard:["type",xn],keyboardBindings:["type",Do]};var l2={moveSpeed:50,moveSpeedAccelerated:200};function nb(e,t,n){var i=this;this._config=V({},l2,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,u;switch(a.key){case"ArrowLeft":case"Left":u="left";break;case"ArrowUp":case"Up":u="up";break;case"ArrowRight":case"Right":u="right";break;case"ArrowDown":case"Down":u="down";break}return i.moveCanvas({speed:c,direction:u}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,u=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=u;break;case"up":s=u;break;case"right":a=-u;break;case"down":s=-u;break}n.scroll({dx:a,dy:s})}}nb.$inject=["config.keyboardMove","keyboard","canvas"];const ib={__depends__:[xf],__init__:["keyboardMove"],keyboardMove:["type",nb]};var p2=15;function rb(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=Nr(s),f=ci(l,c);if(!n.dragging&&f2(f)>p2&&(n.dragging=!0,u===0&&ky(e),bc("grab")),n.dragging){var p=n.last||n.start;f=ci(l,p),t.scroll({dx:f.x,dy:f.y}),n.last=l}s.preventDefault()}function o(s){$e.unbind(document,"mousemove",r),$e.unbind(document,"mouseup",o),n=null,My()}function a(s){if(!kr(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:Nr(s)},$e.bind(document,"mousemove",r),$e.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}rb.$inject=["eventBus","canvas"];function f2(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const ob={__init__:["moveCanvas"],moveCanvas:["type",rb]};function ab(e,t){var n=Nl(e.min),i=Nl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function d2(e,t){return Math.max(e.min,Math.min(e.max,t))}var h2=Math.sign||function(e){return e>=0?1:-1},_f={min:.2,max:4},sb=10,m2=.1,g2=.75;function Ei(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=wn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||g2;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Ei.$inject=["config.zoomScroll","eventBus","canvas"],Ei.prototype.scroll=function(t){this._canvas.scroll(t)},Ei.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Ei.prototype.zoom=function(t,n){var i=ab(_f,sb*2);this._totalDelta+=t,Math.abs(this._totalDelta)>m2&&(this._zoom(t,n,i),this._totalDelta=0)},Ei.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||$g()&&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))*h2(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)}},Ei.prototype.stepZoom=function(t,n){var i=ab(_f,sb);this._zoom(t,n,i)},Ei.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Nl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(d2(_f,s),t)},Ei.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&$e[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Ei.prototype._init=function(e){this.toggle(e)};const cb={__init__:["zoomScroll"],zoomScroll:["type",Ei]};function Fa(e){yr.call(this,e)}_e(Fa,yr),Fa.prototype._navigationModules=[ib,ob,cb],Fa.prototype._modules=[].concat(yr.prototype._modules,Fa.prototype._navigationModules);function wf(e){return e&&e[e.length-1]}function ub(e){return e.y}function lb(e){return e.x}var y2={left:lb,center:lb,right:function(e){return e.x+e.width},top:ub,middle:ub,bottom:function(e){return e.y+e.height}};function Lo(e,t){this._modeling=e,this._rules=t}Lo.$inject=["modeling","rules"],Lo.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}},Lo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Lo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function f(p,d){return Math.round((p[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=wf(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if(N(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=li(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=wf(c).center,o;u=t[0],t=li(t,function(p){return p[i]+p[r]}),l=wf(t),o[e]=f(u,l)}return o},Lo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ue(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),De(i)&&(r=i),!(r.length<2||!i)){var o=y2[t],a=li(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const v2={__init__:["alignElements"],alignElements:["type",Lo]},b2=new To;function Io(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}Io.$inject=["eventBus"],Io.prototype.schedule=function(e,t=b2.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},Io.prototype._schedule=function(e,t){const n=x2();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}},Io.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},Io.prototype._cancel=function(e){clearTimeout(e.executionId)};function x2(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const _2={scheduler:["type",Io]};var w2="djs-element-hidden",Yc=".entry",E2=1e3,pb=8,S2=300;function It(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}It.$inject=["canvas","elementRegistry","eventBus","scheduler"],It.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=De(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=De(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},It.prototype._createContainer=function(){var e=mt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},It.prototype.registerProvider=function(e,t){t||(t=e,e=E2),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},It.prototype.getEntries=function(e){var t=this._getProviders(),n=De(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return N(t,function(r){if(Ut(r[n])){var o=r[n](e);Ut(o)?i=o(i):N(o,function(a,s){i[s]=a})}}),i},It.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=ln(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},S2);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},It.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(Ut(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},It.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))}},It.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},It.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;N(t,function(r,o){var a=r.group||"default",s=mt(r.html||'<div class="entry" draggable="true"></div>'),c;ln(s,"data-action",o),c=ot("[data-group="+$a(a)+"]",n),c||(c=mt('<div class="group"></div>'),ln(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&R2(s,r.className),r.title&&ln(s,"title",r.title),r.imageUrl&&(i=mt("<img>"),ln(i,"src",r.imageUrl),i.style.width="100%",i.style.height="100%",s.appendChild(i))}),bt(n).add("open"),this._current={entries:t,html:n,target:e},this._updatePosition(),this._updateVisibility(),this._eventBus.fire("contextPad.open",{current:this._current})},It.prototype._createHtml=function(e){var t=this,n=mt('<div class="djs-context-pad"></div>');return Mn.bind(n,Yc,"click",function(i){t.trigger("click",i)}),Mn.bind(n,Yc,"dragstart",function(i){t.trigger("dragstart",i)}),Mn.bind(n,Yc,"mouseover",function(i){t.trigger("mouseover",i)}),Mn.bind(n,Yc,"mouseout",function(i){t.trigger("mouseout",i)}),$e.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},It.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()&&P2(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},It.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},It.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return De(e)!==De(n)?!1:De(e)?e.length===n.length&&Pr(e,function(i){return n.includes(i)}):n===e},It.prototype.isShown=function(){return this.isOpen()&&bt(this._current.html).has("open")},It.prototype.show=function(){this.isOpen()&&(bt(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},It.prototype.hide=function(){this.isOpen()&&(bt(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},It.prototype._getPosition=function(e){if(!De(e)&&at(e)){var t=this._canvas.viewbox(),n=C2(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+pb*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+pb*this._canvas.zoom(),top:s.top-a.top}},It.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")},It.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=De(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,w2)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},It.prototype._getTargetBounds=function(e){var t=this,n=De(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function R2(e,t){var n=bt(e);t=De(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function C2(e){return e.waypoints[e.waypoints.length-1]}function P2(e,t){return e=De(e)?e:[e],t=De(t)?t:[t],e.length===t.length&&Pr(e,function(n){return t.includes(n)})}const fb={__depends__:[vc,_2,Vc],contextPad:["type",It]};var qc,wt,db,vr,hb,mb,gb,Ef,Kc,ja,yb,Sf,Rf,Cf,Xc={},Zc=[],A2=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Qc=Array.isArray;function zi(e,t){for(var n in t)e[n]=t[n];return e}function Pf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function vb(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?qc.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 Jc(e,a,i,r,null)}function Jc(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??++db,__i:-1,__u:0};return r==null&&wt.vnode!=null&&wt.vnode(o),o}function eu(e){return e.children}function tu(e,t){this.props=e,this.context=t}function Vr(e,t){if(t==null)return e.__?Vr(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"?Vr(e):null}function T2(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=zi({},t);o.__v=t.__v+1,wt.vnode&&wt.vnode(o),Af(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Vr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Cb(i,o,r),t.__e=t.__=null,o.__e!=n&&bb(o)}}function bb(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}),bb(e)}function xb(e){(!e.__d&&(e.__d=!0)&&vr.push(e)&&!nu.__r++||hb!=wt.debounceRendering)&&((hb=wt.debounceRendering)||mb)(nu)}function nu(){try{for(var e,t=1;vr.length;)vr.length>t&&vr.sort(gb),e=vr.shift(),t=vr.length,T2(e)}finally{vr.length=nu.__r=0}}function _b(e,t,n,i,r,o,a,s,c,u,l){var f,p,d,m,h,g,y=i&&i.__k||Zc,v=t.length;for(c=M2(n,t,y,c,v),f=0;f<v;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&y[d.__i]||Xc,d.__i=f,g=Af(e,d,p,r,o,a,s,c,u,l),m=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&Tf(p.ref,null,d),l.push(d.ref,d.__c||m,d)),h==null&&m!=null&&(h=m),4&d.__u?(c=wb(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&g!==void 0?c=g:m&&(c=m.nextSibling),d.__u&=-7);return n.__e=h,c}function M2(e,t,n,i,r){var o,a,s,c,u,l=n.length,f=l,p=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=Jc(null,a,null,null,null):Qc(a)?a=e.__k[o]=Jc(eu,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=Jc(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=k2(a,n,c,f))!=-1&&(f--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?p--:r<l&&p++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?p--:u==c+1?p++:(u>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Vr(s)),Ab(s,s));return i}function wb(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=wb(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Vr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function k2(e,t,n,i){var r,o,a,s=e.key,c=e.type,u=t[n],l=u!=null&&(2&u.__u)==0;if(u===null&&s==null||l&&s==u.key&&c==u.type)return n;if(i>(l?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((u=t[a=r>=0?r--:o++])!=null&&(2&u.__u)==0&&s==u.key&&c==u.type)return a}return-1}function Eb(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||A2.test(t)?n:n+"px"}function iu(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||Eb(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Eb(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(yb,"$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[ja]=i[ja]:(n[ja]=Sf,e.addEventListener(t,o?Cf:Rf,o)):e.removeEventListener(t,o?Cf:Rf,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 Sb(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Kc]==null)t[Kc]=Sf++;else if(t[Kc]<n[ja])return;return n(wt.event?wt.event(t):t)}}}function Af(e,t,n,i,r,o,a,s,c,u){var l,f,p,d,m,h,g,y,v,b,x,C,P,O,A,I,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=wt.__b)&&l(t);e:if(typeof k=="function"){f=a.length;try{if(v=t.props,b=k.prototype&&k.prototype.render,x=(l=k.contextType)&&i[l.__c],C=l?x?x.props.value:l.__:i,n.__c?y=(p=t.__c=n.__c).__=p.__E:(b?t.__c=p=new k(v,C):(t.__c=p=new tu(v,C),p.constructor=k,p.render=D2),x&&x.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),b&&p.__s==null&&(p.__s=p.state),b&&k.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=zi({},p.__s)),zi(p.__s,k.getDerivedStateFromProps(v,p.__s))),m=p.props,h=p.state,p.__v=t,d)b&&k.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),b&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(b&&k.getDerivedStateFromProps==null&&v!==m&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(v,C),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(v,p.__s,C)===!1){t.__v!=n.__v&&(p.props=v,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(D){D&&(D.__=t)}),Zc.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=Vr(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(v,p.__s,C),b&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(m,h,g)})}if(p.context=C,p.props=v,p.__P=e,p.__e=!1,P=wt.__r,O=0,b)p.state=p.__s,p.__d=!1,P&&P(t),l=p.render(p.props,p.state,p.context),Zc.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,P&&P(t),l=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++O<25);p.state=p.__s,p.getChildContext!=null&&(i=zi(zi({},i),p.getChildContext())),b&&!d&&p.getSnapshotBeforeUpdate!=null&&(g=p.getSnapshotBeforeUpdate(m,h)),A=l!=null&&l.type===eu&&l.key==null?Pb(l.props.children):l,s=_b(e,Qc(A)?A:[A],t,n,i,r,o,a,s,c,u),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),y&&(p.__E=p.__=null)}catch(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(I=o.length;I--;)Pf(o[I])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),D.then||Rb(t),wt.__e(D,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=O2(n.__e,t,n,i,r,o,a,c,u);return(l=wt.diffed)&&l(t),128&t.__u?void 0:s}function Rb(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Rb))}function Cb(e,t,n){for(var i=0;i<n.length;i++)Tf(n[i],n[++i],n[++i]);wt.__c&&wt.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){wt.__e(o,r.__v)}})}function Pb(e){return typeof e!="object"||e==null||e.__b>0?e:Qc(e)?e.map(Pb):e.constructor!==void 0?null:zi({},e)}function O2(e,t,n,i,r,o,a,s,c){var u,l,f,p,d,m,h,g=n.props||Xc,y=t.props,v=t.type;if(v=="svg"?r="http://www.w3.org/2000/svg":v=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!v&&(v?d.localName==v:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(v==null)return document.createTextNode(y);e=document.createElementNS(r,v,y.is&&y),s&&(wt.__m&&wt.__m(t,o),s=!1),o=null}if(v==null)g===y||s&&e.data==y||(e.data=y);else{if(o=v=="textarea"&&y.defaultValue!=null?null:o&&qc.call(e.childNodes),!s&&o!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?f=d:u=="children"||u in y||u=="value"&&"defaultValue"in y||u=="checked"&&"defaultChecked"in y||iu(e,u,null,d,r);for(u in y)d=y[u],u=="children"?p=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?m=d:u=="checked"?h=d:s&&typeof d!="function"||g[u]===d||iu(e,u,d,g[u],r);if(l)s||f&&(l.__html==f.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(f&&(e.innerHTML=""),_b(t.type=="template"?e.content:e,Qc(p)?p:[p],t,n,i,v=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Vr(n,0),s,c),o!=null)for(u=o.length;u--;)Pf(o[u]);s&&v!="textarea"||(u="value",v=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[u]||v=="progress"&&!m||v=="option"&&m!=g[u])&&iu(e,u,m,g[u],r),u="checked",h!=null&&h!=e[u]&&iu(e,u,h,g[u],r))}return e}function Tf(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){wt.__e(r,n)}}function Ab(e,t,n){var i,r;if(wt.unmount&&wt.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Tf(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){wt.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Ab(i[r],t,n||typeof e.type!="function");n||Pf(e.__e),e.__c=e.__=e.__e=void 0}function D2(e,t,n){return this.constructor(e,n)}function Tb(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),wt.__&&wt.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],Af(t,e=t.__k=vb(eu,null,[e]),r||Xc,Xc,t.namespaceURI,r?null:t.firstChild?qc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Cb(o,e,a),e.props.children=null}qc=Zc.slice,wt={__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}},db=0,tu.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=zi({},this.state),typeof e=="function"&&(e=e(zi({},n),this.props)),e&&zi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),xb(this))},tu.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),xb(this))},tu.prototype.render=eu,vr=[],mb=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,gb=function(e,t){return e.__v.__b-t.__v.__b},nu.__r=0,Ef=Math.random().toString(8),Kc="__d"+Ef,ja="__a"+Ef,yb=/(PointerCapture)$|Capture$/i,Sf=0,Rf=Sb(!1),Cf=Sb(!0);var Mb=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,Mb(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},kb=new Map;function L2(e){var t=kb.get(this);return t||(t=new Map,kb.set(this,t)),(t=Mb(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var f=0;f<n[l].length;f++)i=n[l][f],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][f+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
- `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var ct=L2.bind(vb),Bo,Bt,Mf,Ob,Ha=0,Db=[],Gt=wt,Lb=Gt.__b,Ib=Gt.__r,Bb=Gt.diffed,Nb=Gt.__c,$b=Gt.unmount,Fb=Gt.__;function ru(e,t){Gt.__h&&Gt.__h(Bt,e,Ha||t),Ha=0;var n=Bt.__H||(Bt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function kf(e){return Ha=1,I2(Hb,e)}function I2(e,t,n){var i=ru(Bo++,2);if(i.t=e,!i.__c&&(i.__=[Hb(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],u=i.t(c,s);c!==u&&(i.__N=[u,i.__[1]],i.__c.setState({}))}],i.__c=Bt,!Bt.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,f=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var m=d.__[0];d.__=d.__N,d.__N=void 0,m!==d.__[0]&&(f=!0)}}),o){var p=o.call(this,s,c,u);return l?p||f:p}return!l||f};Bt.__f=!0;var o=Bt.shouldComponentUpdate,a=Bt.componentWillUpdate;Bt.componentWillUpdate=function(s,c,u){if(this.__e){var l=o;o=void 0,r(s,c,u),o=l}a&&a.call(this,s,c,u)},Bt.shouldComponentUpdate=r}return i.__N||i.__}function ou(e,t){var n=ru(Bo++,3);!Gt.__s&&Lf(n.__H,t)&&(n.__=e,n.u=t,Bt.__H.__h.push(n))}function Of(e,t){var n=ru(Bo++,4);!Gt.__s&&Lf(n.__H,t)&&(n.__=e,n.u=t,Bt.__h.push(n))}function au(e){return Ha=5,Gi(function(){return{current:e}},[])}function Gi(e,t){var n=ru(Bo++,7);return Lf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function za(e,t){return Ha=8,Gi(function(){return e},t)}function B2(){for(var e;e=Db.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(su),t.__h.some(Df),t.__h=[]}catch(n){t.__h=[],Gt.__e(n,e.__v)}}}Gt.__b=function(e){Bt=null,Lb&&Lb(e)},Gt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Fb&&Fb(e,t)},Gt.__r=function(e){Ib&&Ib(e),Bo=0;var t=(Bt=e.__c).__H;t&&(Mf===Bt?(t.__h=[],Bt.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(su),t.__h.some(Df),t.__h=[],Bo=0)),Mf=Bt},Gt.diffed=function(e){Bb&&Bb(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Db.push(t)!==1&&Ob===Gt.requestAnimationFrame||((Ob=Gt.requestAnimationFrame)||N2)(B2)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Mf=Bt=null},Gt.__c=function(e,t){t.some(function(n){try{n.__h.some(su),n.__h=n.__h.filter(function(i){return!i.__||Df(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Gt.__e(i,n.__v)}}),Nb&&Nb(e,t)},Gt.unmount=function(e){$b&&$b(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{su(i)}catch(r){t=r}}),n.__H=void 0,t&&Gt.__e(t,n.__v))};var jb=typeof requestAnimationFrame=="function";function N2(e){var t,n=function(){clearTimeout(i),jb&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);jb&&(t=requestAnimationFrame(n))}function su(e){var t=Bt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Bt=t}function Df(e){var t=Bt;e.__c=e.__(),Bt=t}function Lf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Hb(e,t){return typeof t=="function"?t(e):t}function $2(e){const{navigationStack:t,setNavigationStack:n}=e,i=Gi(()=>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 ct`
10
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="`+p+'" height="'+d+'" viewBox="'+l+" "+f+" "+p+" "+d+'" version="1.1">'+s+a+"</svg>"}catch(i){n=i}if(this._emit("saveSVG.done",{error:n,svg:t}),n)throw n;return{svg:t}},wt.prototype._setDefinitions=function(e){this._definitions=e},wt.prototype.getModules=function(){return this._modules},wt.prototype.clear=function(){this.getDefinitions()&&rr.prototype.clear.call(this)},wt.prototype.destroy=function(){rr.prototype.destroy.call(this),gi(this._container)},wt.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},wt.prototype.off=function(e,t){this.get("eventBus").off(e,t)},wt.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=at(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},wt.prototype.getDefinitions=function(){return this._definitions},wt.prototype.detach=function(){const e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},wt.prototype._init=function(e,t,n){const i=n.modules||this.getModules(n),r=n.additionalModules||[],o=[{bpmnjs:["value",this],moddle:["value",t]}],a=[].concat(o,i,r),s=V(fi(n,["additionalModules"]),{canvas:V({},n.canvas,{container:e}),modules:a});rr.call(this,s),n&&n.container&&this.attachTo(n.container)},wt.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},wt.prototype._createContainer=function(e){const t=yt('<div class="bjs-container"></div>');return _n(t,{width:Fm(e.width),height:Fm(e.height),position:e.position}),t},wt.prototype._createModdle=function(e){const t=V({},this._moddleExtensions,e.moddleExtensions);return new jd(t)},wt.prototype._modules=[];function Gs(e,t){return e.warnings=t,e}function vR(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 bR={width:"100%",height:"100%",position:"relative"};function Fm(e){return e+(Ne(e)?"px":"")}function xR(e,t){return t&&ft(e.diagrams,function(n){return n.id===t})||null}function _R(e){const n='<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" >'+Im+"</a>",i=yt(n);_n(at("svg",i),Bm),_n(i,Nm,{position:"absolute",bottom:"15px",right:"15px",zIndex:"100"}),e.appendChild(i),$e.bind(i,"click",function(r){yR(),r.preventDefault()})}function yo(e){wt.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)}xe(yo,wt),yo.prototype._createModdle=function(e){var t=wt.prototype._createModdle.call(this,e);return t.ids=new mi([32,36,1]),t},yo.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 Ke(e,t){return E(e,"bpmn:CallActivity")?!1:E(e,"bpmn:SubProcess")?(t=t||Ze(e),t&&E(t,"bpmndi:BPMNPlane")?!0:t&&!!t.isExpanded):E(e,"bpmn:Participant")?!!ie(e).processRef:!0}function Xt(e){if(!(!E(e,"bpmn:Participant")&&!E(e,"bpmn:Lane"))){var t=Ze(e).isHorizontal;return t===void 0?!0:t}}function wR(e){return e&&ie(e).isInterrupting!==!1}function mn(e){return e&&!!ie(e).triggeredByEvent}function vo(e,t){var n=ie(e).eventDefinitions;return qi(n,function(i){return E(i,t)})}function ER(e){return vo(e,"bpmn:ErrorEventDefinition")}function SR(e){return vo(e,"bpmn:EscalationEventDefinition")}function RR(e){return vo(e,"bpmn:CompensateEventDefinition")}var Br={width:90,height:20},jm=15;function or(e){return E(e,"bpmn:Event")||E(e,"bpmn:Gateway")||E(e,"bpmn:DataStoreReference")||E(e,"bpmn:DataObjectReference")||E(e,"bpmn:DataInput")||E(e,"bpmn:DataOutput")||E(e,"bpmn:SequenceFlow")||E(e,"bpmn:MessageFlow")||E(e,"bpmn:Group")}function Vs(e){return Ge(e.label)}function CR(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=PR(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-=jm:a+=jm,{x:a,y:s}}function PR(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 Bl(e){return e.waypoints?CR(e.waypoints):E(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+Br.height/2}:{x:e.x+e.width/2,y:e.y+e.height+Br.height/2}}function AR(e,t){var n,i,r,o=e.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Br.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=Bl(t),i=Br),V({x:n.x-i.width/2,y:n.y-i.height/2},i)}function Hm(e){if(E(e,"bpmn:FlowElement")||E(e,"bpmn:Participant")||E(e,"bpmn:Lane")||E(e,"bpmn:SequenceFlow")||E(e,"bpmn:MessageFlow")||E(e,"bpmn:DataInput")||E(e,"bpmn:DataOutput"))return"name";if(E(e,"bpmn:TextAnnotation"))return"text";if(E(e,"bpmn:Group"))return"categoryValueRef"}function TR(e){var t=e.categoryValueRef;return t&&t.value||""}function Un(e){var t=e.businessObject,n=Hm(t);if(n)return n==="categoryValueRef"?TR(t):t[n]||""}function MR(e,t){var n=e.businessObject,i=Hm(n);if(i)if(i==="categoryValueRef"){if(!n[i])return e;n[i].value=t}else n[i]=t;return e}function kR(e){return Ge(e)&&or(e.labelTarget)}var bo=7;function zm(e){let t=[];return $(e.incoming,n=>{E(n,"bpmn:Association")&&E(n.source,"bpmn:TextAnnotation")&&t.push({annotation:n.source,association:n})}),$(e.outgoing,n=>{E(n,"bpmn:Association")&&E(n.target,"bpmn:TextAnnotation")&&t.push({annotation:n.target,association:n})}),t}function pa(e){const t=new Map;return $(Tl(e),n=>{$(zm(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 Nl="hsl(225, 10%, 15%)",OR="white";function xi(e,t){return qi(e.eventDefinitions,function(n){return n.$type===t})}function DR(e){return e.$type==="bpmn:IntermediateThrowEvent"||e.$type==="bpmn:EndEvent"}function LR(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}function qe(e,t,n){var i=Ze(e);return n||i.get("color:background-color")||i.get("bioc:fill")||t||OR}function ge(e,t,n){var i=Ze(e);return n||i.get("color:border-color")||i.get("bioc:stroke")||t||Nl}function fa(e,t,n,i){var r=Ze(e),o=r.get("label");return i||o&&o.get("color:color")||t||ge(e,n)}function Gm(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 Dr(r)}function $l(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 Dr(a)}function IR(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 Dr(s)}function BR(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 Dr(o)}function da(e,t={}){return{width:Kn(e,t),height:Dn(e,t)}}function Kn(e,t={}){return An(t,"width")?t.width:e.width}function Dn(e,t={}){return An(t,"height")?t.height:e.height}var NR=new mi,$R=10,Ws=3,FR=1.5,Us=10,jR=4,xo=.95,HR=1,zR=.25;function Nr(e,t,n,i,r,o,a){Oi.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,u=e&&e.defaultLabelColor;function l(M){return n.computeStyle(M,{strokeLinecap:"round",strokeLinejoin:"round",stroke:Nl,strokeWidth:2,fill:"white"})}function f(M){return n.computeStyle(M,["no-fill"],{strokeLinecap:"round",strokeLinejoin:"round",stroke:Nl,strokeWidth:2})}function p(M,S){var{ref:w={x:0,y:0},scale:z=1,element:U,parentGfx:Q=r._svg}=S,we=Pe("marker",{id:M,viewBox:"0 0 20 20",refX:w.x,refY:w.y,markerWidth:20*z,markerHeight:20*z,orient:"auto"});je(we,U);var ze=at(":scope > defs",Q);ze||(ze=Pe("defs"),je(Q,ze)),je(ze,we)}function d(M,S,w,z){var U=NR.nextPrefixed("marker-");return m(M,U,S,w,z),"url(#"+U+")"}function m(M,S,w,z,U){if(w==="sequenceflow-end"){var Q=Pe("path",{d:"M 1 5 L 11 10 L 1 15 Z",...l({fill:U,stroke:U,strokeWidth:1})});p(S,{element:Q,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(w==="messageflow-start"){var we=Pe("circle",{cx:6,cy:6,r:3.5,...l({fill:z,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(S,{element:we,ref:{x:6,y:6},parentGfx:M})}if(w==="messageflow-end"){var ze=Pe("path",{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z",...l({fill:z,stroke:U,strokeWidth:1,strokeDasharray:[1e4,1]})});p(S,{element:ze,ref:{x:8.5,y:5},parentGfx:M})}if(w==="association-start"){var et=Pe("path",{d:"M 11 5 L 1 10 L 11 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(S,{element:et,ref:{x:1,y:10},scale:.5,parentGfx:M})}if(w==="association-end"){var Tt=Pe("path",{d:"M 1 5 L 11 10 L 1 15",...f({fill:"none",stroke:U,strokeWidth:1.5,strokeDasharray:[1e4,1]})});p(S,{element:Tt,ref:{x:11,y:10},scale:.5,parentGfx:M})}if(w==="conditional-flow-marker"){var it=Pe("path",{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z",...l({fill:z,stroke:U})});p(S,{element:it,ref:{x:-1,y:10},scale:.5,parentGfx:M})}if(w==="conditional-default-flow-marker"){var Ct=Pe("path",{d:"M 6 4 L 10 16",...l({stroke:U,fill:"none"})});p(S,{element:Ct,ref:{x:0,y:10},scale:.5,parentGfx:M})}}function h(M,S,w,z,U={}){Yt(z)&&(U=z,z=0),z=z||0,U=l(U);var Q=S/2,we=w/2,ze=Pe("circle",{cx:Q,cy:we,r:Math.round((S+w)/4-z),...U});return je(M,ze),ze}function g(M,S,w,z,U,Q){Yt(U)&&(Q=U,U=0),U=U||0,Q=l(Q);var we=Pe("rect",{x:U,y:U,width:S-U*2,height:w-U*2,rx:z,ry:z,...Q});return je(M,we),we}function y(M,S,w,z){var U=S/2,Q=w/2,we=[{x:U,y:0},{x:S,y:Q},{x:U,y:w},{x:0,y:Q}],ze=we.map(function(Tt){return Tt.x+","+Tt.y}).join(" ");z=l(z);var et=Pe("polygon",{...z,points:ze});return je(M,et),et}function v(M,S,w,z){w=f(w);var U=ra(S,w,z);return je(M,U),U}function b(M,S,w){return v(M,S,w,5)}function x(M,S,w){w=f(w);var z=Pe("path",{...w,d:S});return je(M,z),z}function C(M,S,w,z){return x(S,w,V({"data-marker":M},z))}function P(M){return dt[M]}function D(M){return function(S,w,z){return P(M)(S,w,z)}}var T={"bpmn:MessageEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.235,my:.315}}),Q=z?ge(S,c,w.stroke):qe(S,s,w.fill),we=z?qe(S,s,w.fill):ge(S,c,w.stroke),ze=x(M,U,{fill:Q,stroke:we,strokeWidth:1});return ze},"bpmn:TimerEventDefinition":function(M,S,w={}){var z=w.width||S.width,U=w.height||S.height,Q=w.width?1:2,we=h(M,z,U,.2*U,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:Q}),ze=i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:z,containerHeight:U,position:{mx:.5,my:.5}});x(M,ze,{stroke:ge(S,c,w.stroke),strokeWidth:Q});for(var et=0;et<12;et++){var Tt=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:z,containerHeight:U,position:{mx:.5,my:.5}}),it=z/2,Ct=U/2;x(M,Tt,{strokeWidth:1,stroke:ge(S,c,w.stroke),transform:"rotate("+et*30+","+Ct+","+it+")"})}return we},"bpmn:EscalationEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.5,my:.2}}),Q=z?ge(S,c,w.stroke):qe(S,s,w.fill);return x(M,U,{fill:Q,stroke:ge(S,c,w.stroke),strokeWidth:1})},"bpmn:ConditionalEventDefinition":function(M,S,w={}){var z=i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.5,my:.222}});return x(M,z,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1})},"bpmn:LinkEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.57,my:.263}}),Q=z?ge(S,c,w.stroke):qe(S,s,w.fill);return x(M,U,{fill:Q,stroke:ge(S,c,w.stroke),strokeWidth:1})},"bpmn:ErrorEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.2,my:.722}}),Q=z?ge(S,c,w.stroke):qe(S,s,w.fill);return x(M,U,{fill:Q,stroke:ge(S,c,w.stroke),strokeWidth:1})},"bpmn:CancelEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.638,my:-.055}}),Q=z?ge(S,c,w.stroke):"none",we=x(M,U,{fill:Q,stroke:ge(S,c,w.stroke),strokeWidth:1});return Dm(we,45),we},"bpmn:CompensateEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.22,my:.5}}),Q=z?ge(S,c,w.stroke):qe(S,s,w.fill);return x(M,U,{fill:Q,stroke:ge(S,c,w.stroke),strokeWidth:1})},"bpmn:SignalEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.5,my:.2}}),Q=z?ge(S,c,w.stroke):qe(S,s,w.fill);return x(M,U,{strokeWidth:1,fill:Q,stroke:ge(S,c,w.stroke)})},"bpmn:MultipleEventDefinition":function(M,S,w={},z){var U=i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.211,my:.36}}),Q=z?ge(S,c,w.stroke):qe(S,s,w.fill);return x(M,U,{fill:Q,stroke:ge(S,c,w.stroke),strokeWidth:1})},"bpmn:ParallelMultipleEventDefinition":function(M,S,w={}){var z=i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:w.width||S.width,containerHeight:w.height||S.height,position:{mx:.458,my:.194}});return x(M,z,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1})},"bpmn:TerminateEventDefinition":function(M,S,w={}){var z=h(M,S.width,S.height,8,{fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke),strokeWidth:4});return z}};function I(M,S,w={},z){var U=ie(M),Q=DR(U),we=z||M;return U.get("eventDefinitions")&&U.get("eventDefinitions").length>1?U.get("parallelMultiple")?T["bpmn:ParallelMultipleEventDefinition"](S,we,w,Q):T["bpmn:MultipleEventDefinition"](S,we,w,Q):xi(U,"bpmn:MessageEventDefinition")?T["bpmn:MessageEventDefinition"](S,we,w,Q):xi(U,"bpmn:TimerEventDefinition")?T["bpmn:TimerEventDefinition"](S,we,w,Q):xi(U,"bpmn:ConditionalEventDefinition")?T["bpmn:ConditionalEventDefinition"](S,we,w,Q):xi(U,"bpmn:SignalEventDefinition")?T["bpmn:SignalEventDefinition"](S,we,w,Q):xi(U,"bpmn:EscalationEventDefinition")?T["bpmn:EscalationEventDefinition"](S,we,w,Q):xi(U,"bpmn:LinkEventDefinition")?T["bpmn:LinkEventDefinition"](S,we,w,Q):xi(U,"bpmn:ErrorEventDefinition")?T["bpmn:ErrorEventDefinition"](S,we,w,Q):xi(U,"bpmn:CancelEventDefinition")?T["bpmn:CancelEventDefinition"](S,we,w,Q):xi(U,"bpmn:CompensateEventDefinition")?T["bpmn:CompensateEventDefinition"](S,we,w,Q):xi(U,"bpmn:TerminateEventDefinition")?T["bpmn:TerminateEventDefinition"](S,we,w,Q):null}var k={ParticipantMultiplicityMarker:function(M,S,w={}){var z=Kn(S,w),U=Dn(S,w),Q=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:z,containerHeight:U,position:{mx:(z/2-6)/z,my:(U-15)/U}});C("participant-multiplicity",M,Q,{strokeWidth:2,fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke)})},SubProcessMarker:function(M,S,w={}){var z=g(M,14,14,0,{strokeWidth:1,fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke)});rn(z,S.width/2-7.5,S.height-20);var U=i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:S.width,containerHeight:S.height,position:{mx:(S.width/2-7.5)/S.width,my:(S.height-20)/S.height}});C("sub-process",M,U,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke)})},ParallelMarker:function(M,S,w){var z=Kn(S,w),U=Dn(S,w),Q=i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:z,containerHeight:U,position:{mx:(z/2+w.parallel)/z,my:(U-20)/U}});C("parallel",M,Q,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke)})},SequentialMarker:function(M,S,w){var z=i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:(S.width/2+w.seq)/S.width,my:(S.height-19)/S.height}});C("sequential",M,z,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke)})},CompensationMarker:function(M,S,w){var z=i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:(S.width/2+w.compensation)/S.width,my:(S.height-13)/S.height}});C("compensation",M,z,{strokeWidth:1,fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke)})},LoopMarker:function(M,S,w){var z=Kn(S,w),U=Dn(S,w),Q=i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:z,containerHeight:U,position:{mx:(z/2+w.loop)/z,my:(U-7)/U}});C("loop",M,Q,{strokeWidth:1.5,fill:"none",stroke:ge(S,c,w.stroke),strokeMiterlimit:.5})},AdhocMarker:function(M,S,w){var z=Kn(S,w),U=Dn(S,w),Q=i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:z,containerHeight:U,position:{mx:(z/2+w.adhoc)/z,my:(U-15)/U}});C("adhoc",M,Q,{strokeWidth:1,fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke)})}};function L(M,S,w,z){k[M](S,w,z)}function H(M,S,w=[],z={}){z={fill:z.fill,stroke:z.stroke,width:Kn(S,z),height:Dn(S,z)};var U=ie(S),Q=w.includes("SubProcessMarker");Q?z={...z,seq:-21,parallel:-22,compensation:-25,loop:-18,adhoc:10}:z={...z,seq:-5,parallel:-6,compensation:-7,loop:0,adhoc:-8},U.get("isForCompensation")&&w.push("CompensationMarker"),E(U,"bpmn:AdHocSubProcess")&&(w.push("AdhocMarker"),Q||V(z,{compensation:z.compensation-18}));var we=U.get("loopCharacteristics"),ze=we&&we.get("isSequential");we&&(V(z,{compensation:z.compensation-18}),w.includes("AdhocMarker")&&V(z,{seq:-23,loop:-18,parallel:-24}),ze===void 0&&w.push("LoopMarker"),ze===!1&&w.push("ParallelMarker"),ze===!0&&w.push("SequentialMarker")),w.includes("CompensationMarker")&&w.length===1&&V(z,{compensation:-8}),$(w,function(et){L(et,M,S,z)})}function ae(M,S,w={}){w=V({size:{width:100}},w);var z=o.createText(S||"",w);return Xe(z).add("djs-label"),je(M,z),z}function ye(M,S,w,z={}){var U=ie(S),Q=da({x:S.x,y:S.y,width:S.width,height:S.height},z);return ae(M,U.name,{align:w,box:Q,padding:7,style:{fill:fa(S,u,c,z.stroke)}})}function We(M,S,w={}){var z={width:S.width,height:S.height,x:S.width/2+S.x,y:S.height/2+S.y};return ae(M,Un(S),{box:z,style:V({},o.getExternalStyle(),{fill:fa(S,u,c,w.stroke)})})}function Fe(M,S,w,z={}){var U=Xt(w),Q=ae(M,S,{box:{height:30,width:U?Dn(w,z):Kn(w,z)},align:"center-middle",style:{fill:fa(w,u,c,z.stroke)}});if(U){var we=-1*Dn(w,z);Hs(Q,0,-we,270)}}function q(M,S,w={}){var{width:z,height:U}=da(S,w);return g(M,z,U,Us,{...w,fill:qe(S,s,w.fill),fillOpacity:xo,stroke:ge(S,c,w.stroke)})}function ue(M,S,w={}){var z=ie(S),U=qe(S,s,w.fill),Q=ge(S,c,w.stroke);return(z.get("associationDirection")==="One"||z.get("associationDirection")==="Both")&&(w.markerEnd=d(M,"association-end",U,Q)),z.get("associationDirection")==="Both"&&(w.markerStart=d(M,"association-start",U,Q)),w=Qe(w,["markerStart","markerEnd"]),b(M,S.waypoints,{...w,stroke:Q,strokeDasharray:"0, 5"})}function oe(M,S,w={}){var z=qe(S,s,w.fill),U=ge(S,c,w.stroke),Q=i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.474,my:.296}}),we=x(M,Q,{fill:z,fillOpacity:xo,stroke:U}),ze=ie(S);if(LR(ze)){var et=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:.33,my:(S.height-18)/S.height}});x(M,et,{strokeWidth:2,fill:z,stroke:U})}return we}function le(M,S,w={}){return h(M,S.width,S.height,{fillOpacity:xo,...w,fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke)})}function ke(M,S,w={}){return y(M,S.width,S.height,{fill:qe(S,s,w.fill),fillOpacity:xo,stroke:ge(S,c,w.stroke)})}function W(M,S,w={}){var z=g(M,Kn(S,w),Dn(S,w),0,{fill:qe(S,s,w.fill),fillOpacity:w.fillOpacity||xo,stroke:ge(S,c,w.stroke),strokeWidth:1.5}),U=ie(S);if(E(U,"bpmn:Lane")){var Q=U.get("name");Fe(M,Q,S,w)}return z}function Y(M,S,w={}){var z=q(M,S,w),U=Ke(S);if(mn(S)&&(_e(z,{strokeDasharray:"0, 5.5",strokeWidth:2.5}),!U)){var Q=ie(S).flowElements||[],we=Q.filter(ze=>E(ze,"bpmn:StartEvent"));we.length===1&&J(we[0],M,w,S)}return ye(M,S,U?"center-top":"center-middle",w),U?H(M,S,void 0,w):H(M,S,["SubProcessMarker"],w),z}function J(M,S,w,z){var U=22,Q={fill:qe(z,s,w.fill),stroke:ge(z,c,w.stroke),width:U,height:U},we=ie(M).isInterrupting,ze=we?0:3,et=we?1:1.2,Tt=20,it=(U-Tt)/2,Ct="translate("+it+","+it+")";h(S,Tt,Tt,{fill:Q.fill,stroke:Q.stroke,strokeWidth:et,strokeDasharray:ze,transform:Ct}),I(M,S,Q,z)}function Te(M,S,w={}){var z=q(M,S,w);return ye(M,S,"center-middle",w),H(M,S,void 0,w),z}var dt=this.handlers={"bpmn:AdHocSubProcess":function(M,S,w={}){return Ke(S)?w=Qe(w,["fill","stroke","width","height"]):w=Qe(w,["fill","stroke"]),Y(M,S,w)},"bpmn:Association":function(M,S,w={}){return w=Qe(w,["fill","stroke"]),ue(M,S,w)},"bpmn:BoundaryEvent":function(M,S,w={}){var{renderIcon:z=!0}=w;w=Qe(w,["fill","stroke"]);var U=ie(S),Q=U.get("cancelActivity");w={strokeWidth:1.5,fill:qe(S,s,w.fill),fillOpacity:HR,stroke:ge(S,c,w.stroke)},Q||(w.strokeDasharray="6");var we=le(M,S,w);return h(M,S.width,S.height,Ws,{...w,fill:"none"}),z&&I(S,M,w),we},"bpmn:BusinessRuleTask":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Te(M,S,w),U=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}),Q=x(M,U);_e(Q,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1});var we=i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}),ze=x(M,we);return _e(ze,{fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke),strokeWidth:1}),z},"bpmn:CallActivity":function(M,S,w={}){return w=Qe(w,["fill","stroke"]),Y(M,S,{strokeWidth:5,...w})},"bpmn:ComplexGateway":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=ke(M,S,w),U=i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:S.width,containerHeight:S.height,position:{mx:.46,my:.26}});return x(M,U,{fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke),strokeWidth:1}),z},"bpmn:DataInput":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=i.getRawPath("DATA_ARROW"),U=oe(M,S,w);return x(M,z,{fill:"none",stroke:ge(S,c,w.stroke),strokeWidth:1}),U},"bpmn:DataInputAssociation":function(M,S,w={}){return w=Qe(w,["fill","stroke"]),ue(M,S,{...w,markerEnd:d(M,"association-end",qe(S,s,w.fill),ge(S,c,w.stroke))})},"bpmn:DataObject":function(M,S,w={}){return w=Qe(w,["fill","stroke"]),oe(M,S,w)},"bpmn:DataObjectReference":D("bpmn:DataObject"),"bpmn:DataOutput":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=i.getRawPath("DATA_ARROW"),U=oe(M,S,w);return x(M,z,{strokeWidth:1,fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke)}),U},"bpmn:DataOutputAssociation":function(M,S,w={}){return w=Qe(w,["fill","stroke"]),ue(M,S,{...w,markerEnd:d(M,"association-end",qe(S,s,w.fill),ge(S,c,w.stroke))})},"bpmn:DataStoreReference":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:S.width,containerHeight:S.height,position:{mx:0,my:.133}});return x(M,z,{fill:qe(S,s,w.fill),fillOpacity:xo,stroke:ge(S,c,w.stroke),strokeWidth:2})},"bpmn:EndEvent":function(M,S,w={}){var{renderIcon:z=!0}=w;w=Qe(w,["fill","stroke"]);var U=le(M,S,{...w,strokeWidth:4});return z&&I(S,M,w),U},"bpmn:EventBasedGateway":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=ie(S),U=ke(M,S,w);h(M,S.width,S.height,S.height*.2,{fill:qe(S,"none",w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1});var Q=z.get("eventGatewayType"),we=!!z.get("instantiate");function ze(){var Tt=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:S.width,containerHeight:S.height,position:{mx:.36,my:.44}});x(M,Tt,{fill:"none",stroke:ge(S,c,w.stroke),strokeWidth:2})}if(Q==="Parallel"){var et=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:S.width,containerHeight:S.height,position:{mx:.474,my:.296}});x(M,et,{fill:"none",stroke:ge(S,c,w.stroke),strokeWidth:1})}else Q==="Exclusive"&&(we||h(M,S.width,S.height,S.height*.26,{fill:"none",stroke:ge(S,c,w.stroke),strokeWidth:1}),ze());return U},"bpmn:ExclusiveGateway":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=ke(M,S,w),U=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:S.width,containerHeight:S.height,position:{mx:.32,my:.3}}),Q=Ze(S);return Q.get("isMarkerVisible")&&x(M,U,{fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke),strokeWidth:1}),z},"bpmn:Gateway":function(M,S,w={}){return w=Qe(w,["fill","stroke"]),ke(M,S,w)},"bpmn:Group":function(M,S,w={}){return w=Qe(w,["fill","stroke","width","height"]),g(M,S.width,S.height,Us,{stroke:ge(S,c,w.stroke),strokeWidth:1.5,strokeDasharray:"10, 6, 0, 6",fill:"none",pointerEvents:"none",width:Kn(S,w),height:Dn(S,w)})},"bpmn:InclusiveGateway":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=ke(M,S,w);return h(M,S.width,S.height,S.height*.24,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:2.5}),z},"bpmn:IntermediateEvent":function(M,S,w={}){var{renderIcon:z=!0}=w;w=Qe(w,["fill","stroke"]);var U=le(M,S,{...w,strokeWidth:1.5});return h(M,S.width,S.height,Ws,{fill:"none",stroke:ge(S,c,w.stroke),strokeWidth:1.5}),z&&I(S,M,w),U},"bpmn:IntermediateCatchEvent":D("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":D("bpmn:IntermediateEvent"),"bpmn:Lane":function(M,S,w={}){return w=Qe(w,["fill","stroke","width","height"]),W(M,S,{...w,fillOpacity:zR})},"bpmn:ManualTask":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Te(M,S,w),U=i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}});return x(M,U,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:.5}),z},"bpmn:MessageFlow":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=ie(S),U=Ze(S),Q=qe(S,s,w.fill),we=ge(S,c,w.stroke),ze=b(M,S.waypoints,{markerEnd:d(M,"messageflow-end",Q,we),markerStart:d(M,"messageflow-start",Q,we),stroke:we,strokeDasharray:"10, 11",strokeWidth:1.5});if(z.get("messageRef")){var et=ze.getPointAtLength(ze.getTotalLength()/2),Tt=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:et.x,y:et.y}}),it={strokeWidth:1};U.get("messageVisibleKind")==="initiating"?(it.fill=Q,it.stroke=we):(it.fill=we,it.stroke=Q);var Ct=x(M,Tt,it),gn=z.get("messageRef"),Zt=gn.get("name"),ht=ae(M,Zt,{align:"center-top",fitBox:!0,style:{fill:we}}),kt=Ct.getBBox(),sn=ht.getBBox(),Uo=et.x-sn.width/2,Fn=et.y+kt.height/2+$R;Hs(ht,Uo,Fn,0)}return ze},"bpmn:ParallelGateway":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=ke(M,S,w),U=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:S.width,containerHeight:S.height,position:{mx:.46,my:.2}});return x(M,U,{fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke),strokeWidth:1}),z},"bpmn:Participant":function(M,S,w={}){w=Qe(w,["fill","stroke","width","height"]);var z=W(M,S,w),U=Ke(S),Q=Xt(S),we=ie(S),ze=we.get("name");if(U){var et=Q?[{x:30,y:0},{x:30,y:Dn(S,w)}]:[{x:0,y:30},{x:Kn(S,w),y:30}];v(M,et,{stroke:ge(S,c,w.stroke),strokeWidth:FR}),Fe(M,ze,S,w)}else{var Tt=da(S,w);Q||(Tt.height=Kn(S,w),Tt.width=Dn(S,w));var it=ae(M,ze,{box:Tt,align:"center-middle",style:{fill:fa(S,u,c,w.stroke)}});if(!Q){var Ct=-1*Dn(S,w);Hs(it,0,-Ct,270)}}return we.get("participantMultiplicity")&&L("ParticipantMultiplicityMarker",M,S,w),z},"bpmn:ReceiveTask":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=ie(S),U=Te(M,S,w),Q;return z.get("instantiate")?(h(M,28,28,20*.22,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1}),Q=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):Q=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(M,Q,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1}),U},"bpmn:ScriptTask":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Te(M,S,w),U=i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}});return x(M,U,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1}),z},"bpmn:SendTask":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Te(M,S,w),U=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}});return x(M,U,{fill:ge(S,c,w.stroke),stroke:qe(S,s,w.fill),strokeWidth:1}),z},"bpmn:SequenceFlow":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=qe(S,s,w.fill),U=ge(S,c,w.stroke),Q=b(M,S.waypoints,{markerEnd:d(M,"sequenceflow-end",z,U),stroke:U}),we=ie(S),{source:ze}=S;if(ze){var et=ie(ze);we.get("conditionExpression")&&E(et,"bpmn:Activity")&&_e(Q,{markerStart:d(M,"conditional-flow-marker",z,U)}),et.get("default")&&(E(et,"bpmn:Gateway")||E(et,"bpmn:Activity"))&&et.get("default")===we&&_e(Q,{markerStart:d(M,"conditional-default-flow-marker",z,U)})}return Q},"bpmn:ServiceTask":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Te(M,S,w);h(M,10,10,{fill:qe(S,s,w.fill),stroke:"none",transform:"translate(6, 6)"});var U=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}});x(M,U,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1}),h(M,10,10,{fill:qe(S,s,w.fill),stroke:"none",transform:"translate(11, 10)"});var Q=i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}});return x(M,Q,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:1}),z},"bpmn:StartEvent":function(M,S,w={}){var{renderIcon:z=!0}=w;w=Qe(w,["fill","stroke"]);var U=ie(S);U.get("isInterrupting")||(w={...w,strokeDasharray:"6"});var Q=le(M,S,w);return z&&I(S,M,w),Q},"bpmn:SubProcess":function(M,S,w={}){return Ke(S)?w=Qe(w,["fill","stroke","width","height"]):w=Qe(w,["fill","stroke"]),Y(M,S,w)},"bpmn:Task":function(M,S,w={}){return w=Qe(w,["fill","stroke"]),Te(M,S,w)},"bpmn:TextAnnotation":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var{width:z,height:U}=da(S,w),Q=g(M,z,U,0,0,{fill:"none",stroke:"none"}),we=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:z,containerHeight:U,position:{mx:0,my:0}});x(M,we,{stroke:ge(S,c,w.stroke)});var ze=ie(S),et=ze.get("text")||"";return ae(M,et,{align:"left-top",box:da(S,w),padding:bo,style:{fill:fa(S,u,c,w.stroke)}}),Q},"bpmn:Transaction":function(M,S,w={}){Ke(S)?w=Qe(w,["fill","stroke","width","height"]):w=Qe(w,["fill","stroke"]);var z=Y(M,S,{strokeWidth:1.5,...w}),U=n.style(["no-fill","no-events"],{stroke:ge(S,c,w.stroke),strokeWidth:1.5}),Q=Ke(S);return Q||(w={}),g(M,Kn(S,w),Dn(S,w),Us-Ws,Ws,U),z},"bpmn:UserTask":function(M,S,w={}){w=Qe(w,["fill","stroke"]);var z=Te(M,S,w),U=15,Q=12,we=i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:U,y:Q}});x(M,we,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:.5});var ze=i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:U,y:Q}});x(M,ze,{fill:qe(S,s,w.fill),stroke:ge(S,c,w.stroke),strokeWidth:.5});var et=i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:U,y:Q}});return x(M,et,{fill:ge(S,c,w.stroke),stroke:ge(S,c,w.stroke),strokeWidth:.5}),z},label:function(M,S,w={}){return We(M,S,w)}};this._drawPath=x,this._renderer=P}xe(Nr,Oi),Nr.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Nr.prototype.canRender=function(e){return E(e,"bpmn:BaseElement")},Nr.prototype.drawShape=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Nr.prototype.drawConnection=function(e,t,n={}){var{type:i}=t,r=this._renderer(i);return r(e,t,n)},Nr.prototype.getShapePath=function(e){return Ge(e)?$l(e,jR):E(e,"bpmn:Event")?Gm(e):E(e,"bpmn:Activity")?$l(e,Us):E(e,"bpmn:Gateway")?IR(e):BR(e)};function Qe(e,t=[]){return t.reduce((n,i)=>(e[i]&&(n[i]=e[i]),n),{})}var GR=0,VR={width:150,height:50};function WR(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}function UR(e){return Yt(e)?V({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}var Fl=null;function YR(){return Fl||(Fl=document.createElement("canvas").getContext("2d")),Fl}function qR(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(Vm(e.fontSize)||"12px"),t.push(e.fontFamily||"sans-serif"),t.join(" ")}function Vm(e){if(e!=null)return typeof e=="number"||/^-?\d+(\.\d+)?$/.test(e)?e+"px":e}function KR(e,t){var n=YR();if(!n)return{width:0,height:0};n.font=qR(t),"letterSpacing"in n&&(n.letterSpacing=Vm(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 XR(e,t,n){for(var i=e.shift(),r=i,o;;){if(o=KR(r,n),o.width=r?o.width:0,r===" "||r===""||o.width<Math.round(t)||r.length<2)return ZR(e,r,i,o);r=JR(r,o.width,t)}}function ZR(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 Wm="­";function QR(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===Wm)&&r.pop();break}var a=r[r.length-1];return a&&a===Wm&&(r[r.length-1]="-"),r.join("")}function JR(e,t,n){var i=Math.max(e.length*(n/t),1),r=QR(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Ys(e){this._config=V({},{size:VR,padding:GR,style:{},align:"center-top"},e||{})}Ys.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ys.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ys.prototype.layoutText=function(e,t){for(var n=V({},this._config.size,t.box),i=V({},this._config.style,t.style),r=WR(t.align||this._config.align),o=UR(t.padding!==void 0?t.padding:this._config.padding),a=t.fitBox||!1,s=eC(i),c=e.split(/\u00AD?\r?\n/),u=[],l=n.width-o.left-o.right;c.length;)u.push(XR(c,l,i));r.vertical==="middle"&&(o.top=o.bottom=0);var f=Tn(u,function(g,y,v){return g+(s||y.height)},0)+o.top+o.bottom,p=Tn(u,function(g,y,v){return y.width>g?y.width:g},0),d=o.top;r.vertical==="middle"&&(d+=(n.height-f)/2),d-=(s||u[0].height)/4;var m=Pe("text");_e(m,i),$(u,function(g){var y;switch(d+=s||g.height,r.horizontal){case"left":y=o.left;break;case"right":y=(a?p:l)-o.right-g.width;break;default:y=Math.max(((a?p:l)-g.width)/2+o.left,0)}var v=Pe("tspan");_e(v,{x:y,y:d}),v.textContent=g.text,je(m,v)});var h={width:p,height:f};return{dimensions:h,element:m}};function eC(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}var tC=12,nC=1.2,iC=40;function Um(e){var t=V({fontFamily:"Arial, sans-serif",fontSize:tC,fontWeight:"normal",lineHeight:nC},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=V({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Ys({style:t});this.getExternalLabelBounds=function(a,s){var c={width:Math.max(a.width,Br.width),height:30},u=o(s,c,{style:i});return{x:Math.round(a.x+a.width/2-u.width/2),y:a.y,width:Math.ceil(u.width),height:Math.ceil(u.height)}},this.getTextAnnotationBounds=function(a,s){var c=o(s,a,{style:t,align:"left-top",padding:bo});return{x:a.x,y:a.y,width:a.width,height:Math.max(iC,Math.round(c.height))}},this.getDimensions=function(a,s){return r.getDimensions(a,s||{})};function o(a,s,c){return r.getDimensions(a,V({box:s},c))}this.createText=function(a,s){return r.createText(a,s||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}Um.$inject=["config.textRenderer"];function rC(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(t){return this.pathMap[t].d},this.getScaledPath=function(t,n){var i=this.pathMap[t],r,o;n.abspos?(r=n.abspos.x,o=n.abspos.y):(r=n.containerWidth*n.position.mx,o=n.containerHeight*n.position.my);var a={};if(n.position){for(var s=n.containerHeight/i.height*n.yScaleFactor,c=n.containerWidth/i.width*n.xScaleFactor,u=0;u<i.heightElements.length;u++)a["y"+u]=i.heightElements[u]*s;for(var l=0;l<i.widthElements.length;l++)a["x"+l]=i.widthElements[l]*c}var f=cC(i.d,{mx:r,my:o,e:a});return f}}var oC=/\{([^{}]+)\}/g,aC=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;function sC(e,t,n){var i=n;return t.replace(aC,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 cC(e,t){return String(e).replace(oC,function(n,i){return sC(n,i,t)})}const uC={__init__:["bpmnRenderer"],bpmnRenderer:["type",Nr],textRenderer:["type",Um],pathMap:["type",rC]};function lC(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(n,i){return t[i]||"{"+i+"}"})}const ha={translate:["value",lC]};function qs(e,t,n){return V({id:e.id,type:e.$type,businessObject:e,di:t},n)}function pC(e,t,n){var i=e.waypoint;return!i||i.length<2?[Ie(t),Ie(n)]:i.map(function(r){return{x:r.x,y:r.y}})}function Ym(e,t,n){return new Error(`element ${hn(t)} referenced by ${hn(e)}#${n} not yet drawn`)}function Bi(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._textRenderer=r}Bi.$inject=["eventBus","canvas","elementFactory","elementRegistry","textRenderer"],Bi.prototype.add=function(e,t,n){var i,r,o;if(E(t,"bpmndi:BPMNPlane")){var a=E(e,"bpmn:SubProcess")?{id:e.id+"_plane"}:{};i=this._elementFactory.createRoot(qs(e,t,a)),this._canvas.addRootElement(i)}else if(E(t,"bpmndi:BPMNShape")){var s=!Ke(e,t),c=dC(e);r=n&&(n.hidden||n.collapsed);var u=t.bounds;i=this._elementFactory.createShape(qs(e,t,{collapsed:s,hidden:r,x:Math.round(u.x),y:Math.round(u.y),width:Math.round(u.width),height:Math.round(u.height),isFrame:c})),E(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,i),E(e,"bpmn:Lane")&&(o=0),E(e,"bpmn:DataStoreReference")&&(fC(n,Ie(u))||(n=this._canvas.findRoot(n))),this._canvas.addShape(i,n,o)}else if(E(t,"bpmndi:BPMNEdge")){var l=this._getSource(e),f=this._getTarget(e);r=n&&(n.hidden||n.collapsed),i=this._elementFactory.createConnection(qs(e,t,{hidden:r,source:l,target:f,waypoints:pC(t,l,f)})),E(e,"bpmn:DataAssociation")&&(n=this._canvas.findRoot(n)),this._canvas.addConnection(i,n,o)}else throw new Error(`unknown di ${hn(t)} for element ${hn(e)}`);return or(e)&&Un(i)&&this.addLabel(e,t,i),this._eventBus.fire("bpmnElement.added",{element:i}),i},Bi.prototype._attachBoundary=function(e,t){var n=e.attachedToRef;if(!n)throw new Error(`missing ${hn(e)}#attachedToRef`);var i=this._elementRegistry.get(n.id),r=i&&i.attachers;if(!i)throw Ym(e,n,"attachedToRef");t.host=i,r||(i.attachers=r=[]),r.indexOf(t)===-1&&r.push(t)},Bi.prototype.addLabel=function(e,t,n){var i,r,o;return i=AR(t,n),r=Un(n),r&&(i=this._textRenderer.getExternalLabelBounds(i,r)),o=this._elementFactory.createLabel(qs(e,t,{id:e.id+"_label",labelTarget:n,type:"label",hidden:n.hidden||!Un(n),x:Math.round(i.x),y:Math.round(i.y),width:Math.round(i.width),height:Math.round(i.height)})),this._canvas.addShape(o,n.parent)},Bi.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?Ym(e,i,t+"Ref"):new Error(`${hn(e)}#${t} Ref not specified`)},Bi.prototype._getSource=function(e){return this._getConnectedElement(e,"source")},Bi.prototype._getTarget=function(e){return this._getConnectedElement(e,"target")},Bi.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};function fC(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 dC(e){return E(e,"bpmn:Group")}const qm={__depends__:[uC,{__depends__:[ha],bpmnImporter:["type",Bi]}]};function ma(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ui(e,t){return{x:e.x-t.x,y:e.y-t.y}}function jl(e){return Math.log(e)/Math.log(10)}var hC=1e3;function te(e){this._eventBus=e}te.$inject=["eventBus"];function mC(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}te.prototype.on=function(e,t,n,i,r,o){if((qt(t)||Ne(t))&&(o=r,r=i,i=n,n=t,t=null),qt(n)&&(o=r,r=i,i=n,n=hC),Yt(r)&&(o=r,r=!1),!qt(i))throw new Error("handlerFn must be a function");Le(e)||(e=[e]);var a=this._eventBus;$(e,function(s){var c=["commandStack",s,t].filter(function(u){return u}).join(".");a.on(c,n,r?mC(i,o):i,o)})},te.prototype.canExecute=Ni("canExecute"),te.prototype.preExecute=Ni("preExecute"),te.prototype.preExecuted=Ni("preExecuted"),te.prototype.execute=Ni("execute"),te.prototype.executed=Ni("executed"),te.prototype.postExecute=Ni("postExecute"),te.prototype.postExecuted=Ni("postExecuted"),te.prototype.revert=Ni("revert"),te.prototype.reverted=Ni("reverted");function Ni(e){return function(n,i,r,o,a){(qt(n)||Ne(n))&&(a=o,o=r,r=i,i=n,n=null),this.on(n,e,i,r,o,a)}}var Hl=["top","bottom","left","right"],Ks=10;function zl(e,t){te.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(r){var o=r.context,a=o.connection,s=a.source,c=a.target,u=o.hints||{};u.createElementsBehavior!==!1&&(n(s),n(c))}),this.postExecuted(["label.create"],function(r){var o=r.context,a=o.shape,s=o.hints||{};s.createElementsBehavior!==!1&&n(a.labelTarget)}),this.postExecuted(["elements.create"],function(r){var o=r.context,a=o.elements,s=o.hints||{};s.createElementsBehavior!==!1&&a.forEach(function(c){n(c)})});function n(r){if(Vs(r)&&!ct(r)){var o=vC(r);o&&i(r,o)}}function i(r,o){var a=Ie(r),s=r.label,c=Ie(s);if(s.parent){var u=Ae(r),l;switch(o){case"top":l={x:a.x,y:u.top-Ks-s.height/2};break;case"left":l={x:u.left-Ks-s.width/2,y:a.y};break;case"bottom":l={x:a.x,y:u.bottom+Ks+s.height/2};break;case"right":l={x:u.right+Ks+s.width/2,y:a.y};break}var f=ui(l,c);t.moveShape(s,f)}}}xe(zl,te),zl.$inject=["eventBus","modeling"];function gC(e){var t=e.host,n=Ie(e),i=nn(n,t),r;i.indexOf("-")>=0?r=i.split("-"):r=[i];var o=Hl.filter(function(a){return r.indexOf(a)===-1});return o}function yC(e){var t=Ie(e),n=[].concat(e.incoming.map(function(i){return i.waypoints[i.waypoints.length-2]}),e.outgoing.map(function(i){return i.waypoints[1]})).map(function(i){return Km(t,i)});return n}function vC(e){var t=Ie(e.label),n=Ie(e),i=Km(n,t);if(bC(i)){var r=yC(e);if(e.host){var o=gC(e);r=r.concat(o)}var a=Hl.filter(function(s){return r.indexOf(s)===-1});return a.indexOf(i)!==-1?nn(e.label,e)!=="intersect"?void 0:i:a[0]}}function Km(e,t){return nn(t,e,5)}function bC(e){return Hl.indexOf(e)!==-1}function Gl(e){te.call(this,e),this.preExecute("shape.append",function(t){var n=t.source,i=t.shape;t.position||(E(i,"bpmn:TextAnnotation")?t.position={x:n.x+n.width/2+75,y:n.y-50-i.height/2}:t.position={x:n.x+n.width+80+i.width/2,y:n.y+n.height/2})},!0)}xe(Gl,te),Gl.$inject=["eventBus"];var xC=1500;function Vl(e,t,n){e.invoke(te,this),this.preExecute("elements.delete",xC,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=Ue(r,u=>E(u,"bpmn:Participant")||E(u,"bpmn:SubProcess"));if(!o.length)return[];var a=n.getRootElement(),s=new Set(a.children.filter(u=>E(u,"bpmn:Artifact"))),c=new Set;return $(o,u=>{const l=new Set(to(ho(Array.from(s),It(u))));c=c.union(l),s=s.difference(l)}),Array.from(c)}}xe(Vl,te),Vl.$inject=["injector","eventBus","canvas"];function Wl(e,t){e.invoke(te,this),this.postExecute("shape.move",function(n){var i=n.newParent,r=n.shape,o=Ue(r.incoming.concat(r.outgoing),function(a){return E(a,"bpmn:Association")});$(o,function(a){t.moveConnection(a,{x:0,y:0},i)})},!0)}xe(Wl,te),Wl.$inject=["injector","modeling"];function _o(e,t){for(Pn(t)&&(t=[t]);e=e.parent;)if(Ve(e,t))return e;return null}function Xm(e,t){var n=_o(e,"bpmn:Process");if(n)return!0;var i=["bpmn:Participant","bpmn:Lane"];if(n=_o(e,i),n)return Xt(n);if(Ve(e,i))return Xt(e);var r;for(r=ie(e);r&&!E(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find(function(a){var s=ie(a);return s&&s.get("processRef")===r});return o?Xt(o):!0}var Zm=500;function Xs(e,t){t.invoke(te,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",Zm,function(i){var r=i.elements;r=r.filter(function(o){var a=o.host;return Qm(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",Zm,function(i){var r=i.shapes,o=i.newHost;if(r.length===1){var a=r[0];Qm(a,o)&&(i.shapes=[n._replaceShape(a,o)])}},!0)}Xs.$inject=["bpmnReplace","injector"],xe(Xs,te),Xs.prototype._replaceShape=function(e,t){var n=_C(e),i={type:"bpmn:BoundaryEvent",host:t};return n&&(i.eventDefinitionType=n.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})};function _C(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function Qm(e,t){return!Ge(e)&&Ve(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Ul(e,t){te.call(this,e);function n(i){return Ue(i.attachers,function(r){return E(r,"bpmn:BoundaryEvent")})}this.postExecute("connection.create",function(i){var r=i.context.source,o=i.context.target,a=n(o);E(r,"bpmn:EventBasedGateway")&&E(o,"bpmn:ReceiveTask")&&a.length>0&&t.removeElements(a)}),this.postExecute("connection.reconnect",function(i){var r=i.context.oldSource,o=i.context.newSource;E(r,"bpmn:Gateway")&&E(o,"bpmn:EventBasedGateway")&&$(o.outgoing,function(a){var s=a.target,c=n(s);E(s,"bpmn:ReceiveTask")&&c.length>0&&t.removeElements(c)})})}Ul.$inject=["eventBus","modeling"],xe(Ul,te);function Jm(e){return e.create("bpmn:Category")}function wC(e){return e.create("bpmn:CategoryValue")}function eg(e,t){var n=t.get("categoryValueRef");return n||(n=t.categoryValueRef=wC(e)),n.$parent||(n.$parent=Jm(e)),n}function EC(e,t,n){return Mt(t.get("categoryValue"),e),e.$parent=t,Mt(n.get("rootElements"),t),t.$parent=n,e}function SC(e){var t=e.$parent;return t&&(At(t.get("categoryValue"),e),e.$parent=null),e}function RC(e){var t=e.$parent;return t&&(At(t.get("rootElements"),e),e.$parent=null),e}var CC=500;function Yl(e,t,n){n.invoke(te,this);function i(c){return t.filter(function(u){return E(u,"bpmn:Group")&&!u.labelTarget}).map(ie).filter(function(u){return u!==c})}function r(c,u){return i(u).some(function(l){return l.get("categoryValueRef")===c})}function o(c,u){return i(u).some(function(l){var f=l.get("categoryValueRef");return f&&f.$parent===c})}function a(c,u){c&&u&&EC(c,u,e.getDefinitions())}function s(c,u,l){u&&!o(u,l)&&RC(u),c&&!r(c,l)&&SC(c)}this.executed(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!E(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0),this.reverted(["shape.create","label.create"],function(c){var u=c.labelTarget||c.shape;!E(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ie(u))},!0),this.executed(["shape.move","shape.resize"],CC,function(c){a(c.categoryValue,c.category)},!0),this.reverted(["shape.move","shape.resize"],function(c){var u=c.shape;c.categoryValue&&s(c.categoryValue,c.category,ie(u))},!0),this.executed("group.updateRefs",function(c){tg(c).forEach(function(u){a(u.categoryValue,u.category)})},!0),this.reverted("group.updateRefs",function(c){tg(c).forEach(function(u){s(u.categoryValue,u.category,ie(u.groupShape))})},!0),this.executed("shape.delete",function(c){var u=c.shape;!E(u,"bpmn:Group")||u.labelTarget||s(c.categoryValue,c.category,ie(u))},!0),this.reverted("shape.delete",function(c){var u=c.shape;!E(u,"bpmn:Group")||u.labelTarget||a(c.categoryValue,c.category)},!0)}Yl.$inject=["bpmnjs","elementRegistry","injector"],xe(Yl,te);function tg(e){var t;return((t=e.updates)==null?void 0:t.groups)||[]}function ql(e,t,n){te.call(this,e),this.preExecute("shape.replace",s,!0),this.postExecuted("shape.replace",c,!0),this.preExecute("connection.create",r,!0),this.postExecuted("connection.delete",i,!0),this.postExecuted("connection.reconnect",o,!0),this.postExecuted("element.updateProperties",a,!0);function i(g){const y=g.source,v=g.target;wo(y)&&ga(v)&&l(v)}function r(g){const y=g.connection,v=g.source,b=g.target;wo(v)&&Zs(b)&&(u(b),p(v,[y]))}function o(g){const y=g.newTarget,v=g.oldSource,b=g.oldTarget;if(b!==y){const x=v;ga(b)&&l(b),wo(x)&&Zs(y)&&u(y)}}function a(g){const{element:y}=g;ga(y)?(f(y),d(y)):Zs(y)&&m(y)}function s(g){const{newData:y,oldShape:v}=g;if(wo(g.oldShape)&&y.eventDefinitionType!=="bpmn:CompensateEventDefinition"||y.type!=="bpmn:BoundaryEvent"){const b=v.outgoing.find(({target:x})=>ga(x));b&&b.target&&(g._connectionTarget=b.target)}else if(!wo(g.oldShape)&&y.eventDefinitionType==="bpmn:CompensateEventDefinition"&&y.type==="bpmn:BoundaryEvent"){const b=v.outgoing.find(({target:x})=>Zs(x));b&&b.target&&(g._connectionTarget=b.target),h(v)}}function c(g){const{_connectionTarget:y,newShape:v}=g;y&&t.connect(v,y)}function u(g){t.updateProperties(g,{isForCompensation:!0})}function l(g){t.updateProperties(g,{isForCompensation:void 0})}function f(g){for(const y of g.incoming)n.canConnect(y.source,g)||t.removeConnection(y);for(const y of g.outgoing)n.canConnect(g,y.target)||t.removeConnection(y)}function p(g,y){g.outgoing.filter(x=>E(x,"bpmn:Association")).filter(x=>ga(x.target)&&!y.includes(x)).forEach(x=>t.removeConnection(x))}function d(g){const y=g.attachers.slice();y.length&&t.removeElements(y)}function m(g){const y=g.incoming.filter(v=>wo(v.source));t.removeElements(y)}function h(g){const y=g.outgoing.filter(v=>E(v,"bpmn:SequenceFlow"));t.removeElements(y)}}xe(ql,te),ql.$inject=["eventBus","modeling","bpmnRules"];function ga(e){const t=ie(e);return t&&t.get("isForCompensation")}function wo(e){return e&&E(e,"bpmn:BoundaryEvent")&&vo(e,"bpmn:CompensateEventDefinition")}function Zs(e){return e&&E(e,"bpmn:Activity")&&!mn(e)}function Kl(e){e.invoke(te,this),this.preExecute("shape.create",1500,function(t){var n=t.context,i=n.parent,r=n.shape;E(i,"bpmn:Lane")&&!E(r,"bpmn:Lane")&&(n.parent=_o(i,"bpmn:Participant"))})}Kl.$inject=["injector"],xe(Kl,te);function Xl(e,t){te.call(this,e),this.preExecute("shape.create",function(n){var a;var i=n.context,r=i.shape;if(E(r,"bpmn:DataObjectReference")&&r.type!=="label"){var o=t.create("bpmn:DataObject");o.isCollection=((a=r.businessObject.dataObjectRef)==null?void 0:a.isCollection)||!1,r.businessObject.dataObjectRef=o}})}Xl.$inject=["eventBus","bpmnFactory"],xe(Xl,te);var Zl=20,Ql=20,ng=30,Qs=2e3;function Jl(e,t,n){te.call(this,t),t.on(["create.start","shape.move.start"],Qs,function(r){var o=r.context,a=o.shape,s=e.getRootElement();if(!(!E(a,"bpmn:Participant")||!E(s,"bpmn:Process")||!s.children.length)){var c=s.children.filter(function(f){return!E(f,"bpmn:Group")&&!Ge(f)&&!ct(f)});if(c.length){var u=It(c),l=PC(a,u);V(a,l),o.createConstraints=AC(a,u)}}}),t.on("create.start",Qs,function(r){var o=r.context,a=o.shape,s=e.getRootElement(),c=e.getGraphics(s);function u(l){l.element=s,l.gfx=c}E(a,"bpmn:Participant")&&E(s,"bpmn:Process")&&(t.on("element.hover",Qs,u),t.once("create.cleanup",function(){t.off("element.hover",u)}))});function i(){var r=e.getRootElement();return E(r,"bpmn:Collaboration")?r:n.makeCollaboration()}this.preExecute("elements.create",Qs,function(r){var o=r.elements,a=r.parent,s=TC(o),c;s&&E(a,"bpmn:Process")&&(r.parent=i(),c=r.hints=r.hints||{},c.participant=s,c.process=a,c.processRef=ie(s).get("processRef"))},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;E(a,"bpmn:Participant")&&E(o,"bpmn:Process")&&(r.parent=i(),r.process=o,r.processRef=ie(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)&&ie(s).set("processRef",ie(a))},!0),this.revert("shape.create",function(r){var o=r.hints||{},a=r.process||o.process,s=r.processRef||o.processRef,c=r.shape,u=o.participant;a&&(!u||c===u)&&ie(c).set("processRef",s)},!0),this.postExecute("shape.create",function(r){var o=r.hints||{},a=r.process||r.hints.process,s=r.shape,c=o.participant;if(a){var u=a.children.slice();c?s===c&&n.moveElements(u,{x:0,y:0},c):n.moveElements(u,{x:0,y:0},s)}},!0)}Jl.$inject=["canvas","eventBus","modeling"],xe(Jl,te);function PC(e,t){t={width:t.width+Zl*2+ng,height:t.height+Ql*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 AC(e,t){return t=Ae(t),{bottom:t.top+e.height/2-Ql,left:t.right-e.width/2+Zl,top:t.bottom-e.height/2+Ql,right:t.left+e.width/2-Zl-ng}}function TC(e){return ft(e,function(t){return E(t,"bpmn:Participant")})}var ig="__targetRef_placeholder";function ep(e,t){te.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],rg(o)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],rg(o));function n(a,s,c){var u=a.get("dataInputAssociations");return ft(u,function(l){return l!==c&&l.targetRef===s})}function i(a,s){var c=a.get("properties"),u=ft(c,function(l){return l.name===ig});return!u&&s&&(u=t.create("bpmn:Property",{name:ig}),Mt(c,u)),u}function r(a,s){var c=i(a);c&&(n(a,c,s)||At(a.get("properties"),c))}function o(a){var s=a.context,c=s.connection,u=c.businessObject,l=c.target,f=l&&l.businessObject,p=s.newTarget,d=p&&p.businessObject,m=s.oldTarget||s.target,h=m&&m.businessObject,g=c.businessObject,y;h&&h!==f&&r(h,u),d&&d!==f&&r(d,u),f?(y=i(f,!0),g.targetRef=y):g.targetRef=null}}ep.$inject=["eventBus","bpmnFactory"],xe(ep,te);function rg(e){return function(t){var n=t.context,i=n.connection;if(E(i,"bpmn:DataInputAssociation"))return e(t)}}function Js(e){this._bpmnUpdater=e}Js.$inject=["bpmnUpdater"],Js.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),[]},Js.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 tp(e,t,n,i){te.call(this,i),t.registerHandler("dataStore.updateContainment",Js);function r(){return n.filter(function(s){return E(s,"bpmn:Participant")&&ie(s).processRef})[0]}function o(s){return s.children.filter(function(c){return E(c,"bpmn:DataStoreReference")&&!c.labelTarget})}function a(s,c){var u=s.businessObject||s;if(c=c||r(),c){var l=c.businessObject||c;t.execute("dataStore.updateContainment",{dataStoreBo:u,dataStoreDi:Ze(s),newSemanticParent:l.processRef||l,newDiParent:Ze(c)})}}this.preExecute("shape.create",function(s){var c=s.context,u=c.shape;E(u,"bpmn:DataStoreReference")&&u.type!=="label"&&(c.hints||(c.hints={}),c.hints.autoResize=!1)}),this.preExecute("elements.move",function(s){var c=s.context,u=c.shapes,l=u.filter(function(f){return E(f,"bpmn:DataStoreReference")});l.length&&(c.hints||(c.hints={}),c.hints.autoResize=u.filter(function(f){return!E(f,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(s){var c=s.context,u=c.shape,l=u.parent;E(u,"bpmn:DataStoreReference")&&u.type!=="label"&&E(l,"bpmn:Collaboration")&&a(u)}),this.postExecute("shape.move",function(s){var c=s.context,u=c.shape,l=c.oldParent,f=u.parent;if(!E(l,"bpmn:Collaboration")&&E(u,"bpmn:DataStoreReference")&&u.type!=="label"&&E(f,"bpmn:Collaboration")){var p=E(l,"bpmn:Participant")?l:kC(l,"bpmn:Participant");a(u,p)}}),this.postExecute("shape.delete",function(s){var c=s.context,u=c.shape,l=e.getRootElement();Ve(u,["bpmn:Participant","bpmn:SubProcess"])&&E(l,"bpmn:Collaboration")&&o(l).filter(function(f){return MC(f,u)}).forEach(function(f){a(f)})}),this.postExecute("canvas.updateRoot",function(s){var c=s.context,u=c.oldRoot,l=c.newRoot,f=o(u);f.forEach(function(p){E(l,"bpmn:Process")&&a(p,l)})})}tp.$inject=["canvas","commandStack","elementRegistry","eventBus"],xe(tp,te);function MC(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 kC(e,t){for(;e.parent;){if(E(e.parent,t))return e.parent;e=e.parent}}var ec=Math.max,tc=Math.min,OC=20;function og(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function DC(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 LC(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 nc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Ne(r)&&(i=(/top|left/.test(e)?tc:ec)(i,r)),Ne(o)&&(i=(/top|left/.test(e)?ec:tc)(i,o)),i}function IC(e,t){if(!t)return e;var n=Ae(e);return $s({top:nc("top",n,t),right:nc("right",n,t),bottom:nc("bottom",n,t),left:nc("left",n,t)})}function BC(e,t,n,i){var r=Ae(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?Ae(i):o,s={top:tc(o.top,a.top),left:tc(o.left,a.left),bottom:ec(o.bottom,a.bottom),right:ec(o.right,a.right)};return $s(s)}function ya(e,t){return typeof e<"u"?e:OC}function NC(e,t){var n,i,r,o;return typeof t=="object"?(n=ya(t.left),i=ya(t.right),r=ya(t.top),o=ya(t.bottom)):n=i=r=o=ya(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function $C(e){return!(e.waypoints||e.type==="label")}function ag(e,t){var n;if(e.length===void 0?n=Ue(e.children,$C):n=e,n.length)return NC(It(n),t)}var ar=Math.abs;function FC(e,t){return og(Ae(t),Ae(e))}var jC=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Xn=30;function ic(e,t){return t=t||[],e.children.filter(function(n){E(n,"bpmn:Lane")&&(ic(n,t),t.push(n))}),t}function sr(e){return e.children.filter(function(t){return E(t,"bpmn:Lane")})}function Zn(e){return _o(e,jC)||e}function HC(e,t){var n=Zn(e),i=E(n,"bpmn:Process")?[]:[n],r=ic(n,i),o=Ae(e),a=Ae(t),s=FC(e,t),c=[],u=Xt(e);return r.forEach(function(l){if(l!==e){var f=u?0:s.top,p=u?s.right:0,d=u?0:s.bottom,m=u?s.left:0,h=Ae(l);s.top&&(ar(h.bottom-o.top)<10&&(d=a.top-h.bottom),ar(h.top-o.top)<5&&(f=a.top-h.top)),s.left&&(ar(h.right-o.left)<10&&(p=a.left-h.right),ar(h.left-o.left)<5&&(m=a.left-h.left)),s.bottom&&(ar(h.top-o.bottom)<10&&(f=a.bottom-h.top),ar(h.bottom-o.bottom)<5&&(d=a.bottom-h.bottom)),s.right&&(ar(h.left-o.right)<10&&(m=a.right-h.left),ar(h.right-o.right)<5&&(p=a.right-h.right)),(f||p||d||m)&&c.push({shape:l,newBounds:LC(l,{top:f,right:p,bottom:d,left:m})})}}),c}var zC=500;function np(e,t){te.call(this,e);function n(i,r){var o=Xt(i),a=sr(r),s=[],c=[],u=[],l=[];if(Lr(a,function(g){return o?g.y>i.y?c.push(g):s.push(g):g.x>i.x?l.push(g):u.push(g),g.children}),!!a.length){var f;o?c.length&&s.length?f=i.height/2:f=i.height:l.length&&u.length?f=i.width/2:f=i.width;var p,d,m,h;s.length&&(p=t.calculateAdjustments(s,"y",f,i.y-10),t.makeSpace(p.movingShapes,p.resizingShapes,{x:0,y:f},"s")),c.length&&(d=t.calculateAdjustments(c,"y",-f,i.y+i.height+10),t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:-f},"n")),u.length&&(m=t.calculateAdjustments(u,"x",f,i.x-10),t.makeSpace(m.movingShapes,m.resizingShapes,{x:f,y:0},"e")),l.length&&(h=t.calculateAdjustments(l,"x",-f,i.x+i.width+10),t.makeSpace(h.movingShapes,h.resizingShapes,{x:-f,y:0},"w"))}}this.postExecuted("shape.delete",zC,function(i){var r=i.context,o=r.hints,a=r.shape,s=r.oldParent;E(a,"bpmn:Lane")&&(o&&o.nested||n(a,s))})}np.$inject=["eventBus","spaceTool"],xe(np,te);var sg=500;function rc(e,t){t.invoke(te,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",sg,function(i){var r=i.elements;r.filter(function(o){var a=o.host;return cg(o,a)}).map(function(o){return r.indexOf(o)}).forEach(function(o){i.elements[o]=n._replaceShape(r[o])})},!0),this.preExecute("elements.move",sg,function(i){var r=i.shapes,o=i.newHost;r.forEach(function(a,s){var c=a.host;cg(a,VC(r,c)?c:o)&&(r[s]=n._replaceShape(a))})},!0)}rc.$inject=["bpmnReplace","injector"],xe(rc,te),rc.prototype._replaceShape=function(e){var t=GC(e),n;return t?n={type:"bpmn:IntermediateCatchEvent",eventDefinitionType:t.$type}:n={type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,n,{layoutConnection:!1})};function GC(e){var t=ie(e),n=t.eventDefinitions;return n&&n[0]}function cg(e,t){return!Ge(e)&&E(e,"bpmn:BoundaryEvent")&&!t}function VC(e,t){return e.indexOf(t)!==-1}var oc=Math.round,WC=Math.max;function UC(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 YC(e){var t=[];return e.forEach(function(n,i){t.push([i===0?"M":"L",n.x,n.y])}),t}var ug=10;function qC(e,t){var n,i;for(n=0;i=e[n];n++)if(sa(i,t)<=ug)return{point:e[n],bendpoint:!0,index:n};return null}function KC(e,t){var n=hm(UC(t,ug),YC(e)),i=n[0],r=n[n.length-1],o;return i?i!==r?i.segment2!==r.segment2?(o=WC(i.segment2,r.segment2)-1,{point:e[o],bendpoint:!0,index:o}):{point:{x:oc(i.x+r.x)/2,y:oc(i.y+r.y)/2},index:i.segment2}:{point:{x:oc(i.x),y:oc(i.y)},index:i.segment2}:null}function ip(e,t){return qC(e,t)||KC(e,t)}function rp(e,t,n){te.call(this,e);function i(r,o,a){var s=o.waypoints,c,u,l,f,p,d,m,h=r.outgoing.slice(),g=r.incoming.slice(),y;Ne(a.width)?y=Ie(a):y=a;var v=ip(s,y);if(v){if(c=s.slice(0,v.index),u=s.slice(v.index+(v.bendpoint?1:0)),!c.length||!u.length)return;l=v.bendpoint?s[v.index]:y,(c.length===1||!lg(r,c[c.length-1]))&&c.push(pg(l)),(u.length===1||!lg(r,u[0]))&&u.unshift(pg(l))}f=o.source,p=o.target,t.canConnect(f,r,o)&&(n.reconnectEnd(o,r,c||y),d=o),t.canConnect(r,p,o)&&(d?m=n.connect(r,p,{type:o.type,waypoints:u}):(n.reconnectStart(o,r,u||y),m=o));var b=[].concat(d&&Ue(g,function(x){return x.source===d.source})||[],m&&Ue(h,function(x){return x.target===m.target})||[]);b.length&&n.removeElements(b)}this.preExecute("elements.move",function(r){var o=r.newParent,a=r.shapes,s=r.delta,c=a[0];if(!(!c||!o)){o&&o.waypoints&&(r.newParent=o=o.parent);var u=Ie(c),l={x:u.x+s.x,y:u.y+s.y},f=ft(o.children,function(p){var d=t.canInsert(a,p);return d&&ip(p.waypoints,l)});f&&(r.targetFlow=f,r.position=l)}},!0),this.postExecuted("elements.move",function(r){var o=r.shapes,a=r.targetFlow,s=r.position;a&&i(o[0],a,s)},!0),this.preExecute("shape.create",function(r){var o=r.parent,a=r.shape;t.canInsert(a,o)&&(r.targetFlow=o,r.parent=o.parent)},!0),this.postExecuted("shape.create",function(r){var o=r.shape,a=r.targetFlow,s=r.position;a&&i(o,a,s)},!0)}xe(rp,te),rp.$inject=["eventBus","bpmnRules","modeling"];function lg(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 pg(e){return V({},e)}function op(e,t){te.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)&&Eo(r)){var c=[];E(o,"bpmn:EventBasedGateway")?c=a.incoming.filter(u=>u!==r&&Eo(u)):c=a.incoming.filter(u=>u!==r&&Eo(u)&&E(u.source,"bpmn:EventBasedGateway")),c.forEach(function(u){t.removeConnection(u)})}}),this.preExecuted("shape.replace",function(n){var i=n.context,r=i.newShape;if(E(r,"bpmn:EventBasedGateway")){var o=r.outgoing.filter(Eo).reduce(function(a,s){return a.includes(s.target)?a:a.concat(s.target)},[]);o.forEach(function(a){a.incoming.filter(Eo).forEach(function(s){const c=a.incoming.filter(Eo).filter(function(u){return u.source===r});(s.source!==r||c.length>1)&&t.removeConnection(s)})})}})}op.$inject=["eventBus","modeling"],xe(op,te);function Eo(e){return E(e,"bpmn:SequenceFlow")}var ac=1500,fg=2e3;function dg(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"],ac,function(i){var r=i.context,o=r.shape||i.shape,a=i.hover;E(a,"bpmn:Lane")&&!Ve(o,["bpmn:Lane","bpmn:Participant"])&&(i.hover=Zn(a),i.hoverGfx=e.getGraphics(i.hover));var s=n.getRootElement();a&&a!==s&&(o.labelTarget||Ve(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"],ac,function(i){var r=i.hover;E(r,"bpmn:Lane")&&(i.hover=Zn(r)||r,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["bendpoint.move.hover"],ac,function(i){var r=i.context,o=i.hover,a=r.type;E(o,"bpmn:Lane")&&/reconnect/.test(a)&&(i.hover=Zn(o)||o,i.hoverGfx=e.getGraphics(i.hover))}),t.on(["connect.start"],ac,function(i){var r=i.context,o=r.start;E(o,"bpmn:Lane")&&(r.start=Zn(o)||o)}),t.on("shape.move.start",fg,function(i){var r=i.shape;E(r,"bpmn:Lane")&&(i.shape=Zn(r)||r)}),t.on("spaceTool.move",fg,function(i){var r=i.hover;r&&E(r,"bpmn:Lane")&&(i.hover=Zn(r))})}dg.$inject=["elementRegistry","eventBus","canvas"];var hg=770;function ap(e,t,n,i){n.invoke(te,this);function r(s,c){var u=ie(s),l=c.categoryValue||u.categoryValueRef;l||(l=eg(e,u));var f=c.category||l.$parent||Jm(e);u.categoryValueRef=l,l.$parent=f,c.categoryValue=l,c.category=f}function o(s,c){var u=ie(s),l=c.categoryValue||u.categoryValueRef,f=c.category||l&&l.$parent;l&&(c.categoryValue=l,c.category=f,u.categoryValueRef=null)}this.execute("label.create",function(s){var c=s.context,u=c.labelTarget;E(u,"bpmn:Group")&&r(u,c)}),this.revert("label.create",function(s){var c=s.context,u=c.labelTarget;E(u,"bpmn:Group")&&o(u,c)}),this.execute("shape.delete",function(s){var c=s.context,u=c.shape,l=ie(u);if(!(!E(u,"bpmn:Group")||u.labelTarget)){var f=c.categoryValue=l.categoryValueRef;f&&(c.category=f.$parent,l.categoryValueRef=null)}}),this.reverted("shape.delete",function(s){var c=s.context,u=c.shape;if(!(!E(u,"bpmn:Group")||u.labelTarget)){var l=c.category,f=c.categoryValue,p=ie(u);f&&(p.categoryValueRef=f,f.$parent=l)}}),this.execute("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!E(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ie(u).categoryValueRef&&!c.categoryValue||r(u,c)}),this.reverted("shape.create",function(s){var c=s.context,u=c.shape,l=c.hints||{};!E(u,"bpmn:Group")||u.labelTarget||l.createElementsBehavior===!1&&!ie(u).categoryValueRef&&!c.categoryValue||o(u,c)}),this.executed(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!E(u,"bpmn:Group")||u.labelTarget||ie(u).categoryValueRef||r(u,c)}),this.reverted(["shape.move","shape.resize"],function(s){var c=s.context,u=c.shape;!E(u,"bpmn:Group")||u.labelTarget||!c.categoryValue||o(u,c)});function a(s,c){var u=e.create(s.$type);return i.copyElement(s,u,null,c)}t.on("copyPaste.copyElement",hg,function(s){var c=s.descriptor,u=s.element;if(!(!E(u,"bpmn:Group")||u.labelTarget)){var l=ie(u);if(l.categoryValueRef){var f=l.categoryValueRef;c.categoryValue=a(f,!0),f.$parent&&(c.category=a(f.$parent,!0))}}}),t.on("copyPaste.pasteElement",hg,function(s){var c=s.descriptor,u=c.businessObject,l=c.categoryValue,f=c.category;l&&(l=u.categoryValueRef=a(l)),f&&(l.$parent=a(f)),delete c.category,delete c.categoryValue})}ap.$inject=["bpmnFactory","eventBus","injector","moddleCopy"],xe(ap,te);function sp(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 mg(e){function t(i,r,o){var a={x:o.x,y:o.y-50},s={x:o.x-50,y:o.y},c=sp(i,r,o,a),u=sp(i,r,o,s),l;c&&u?gg(c,o)>gg(u,o)?l=u:l=c:l=c||u,i.original=l}function n(i){var r=i.waypoints;t(r[0],r[1],Ie(i.source)),t(r[r.length-1],r[r.length-2],Ie(i.target))}e.on("bpmnElement.added",function(i){var r=i.element;r.waypoints&&n(r)})}mg.$inject=["eventBus"];function gg(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function cp(e){te.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=ie(i),o=Ze(i);if(Ve(r,t)){var a=o.get("isHorizontal");a===void 0&&(a=!0),o.set("isHorizontal",a)}})}cp.$inject=["eventBus"],xe(cp,te);function yg(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function vg(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function XC(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 ZC(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 up(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=ZC([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 bg(e,t){var n=up(e,t),i={x:n.x-e.x,y:n.y-e.y};return yg(i)}function va(e,t){return yg({x:e.x-t.x,y:e.y-t.y})}var xg=Math.sqrt,_g=Math.min,QC=Math.max,wg=Math.abs;function Eg(e){return Math.pow(e,2)}function ba(e,t){return xg(Eg(e.x-t.x)+Eg(e.y-t.y))}function JC(e,t){var n=0,i,r,o,a,s,c,u,l,f,p,d;for(n=0;n<t.length-1;n++){if(i=t[n],r=t[n+1],Rg(i,r)?u=[i]:(o=ba(e,i),a=ba(e,r),c=_g(o,a),u=eP(i,r,e,c)),u.length<1)throw new Error("expected between [1, 2] circle -> line intersections");u.length===1&&(l={type:"bendpoint",position:u[0],segmentIndex:n,bendpointIndex:Rg(i,u[0])?n:n+1}),u.length===2&&(s=nP(u[0],u[1]),l={type:"segment",position:s,segmentIndex:n,relativeLocation:ba(i,s)/ba(i,r)}),f=ba(l.position,e),(!d||p>f)&&(d=l,p=f)}return d}function eP(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,u=r*a+o*s,l=a*a+s*s-i*i,f=u/c,p=l/c,d=f*f-p;if(d<0&&d>-1e-6&&(d=0),d<0)return[];var m=xg(d),h=-f+m,g=-f-m,y={x:e.x-r*h,y:e.y-o*h};if(d===0)return[y];var v={x:e.x-r*g,y:e.y-o*g};return[y,v].filter(function(b){return tP(b,e,t)})}function tP(e,t,n){return Sg(e.x,t.x,n.x)&&Sg(e.y,t.y,n.y)}function Sg(e,t,n){return e>=_g(t,n)-sc&&e<=QC(t,n)+sc}function nP(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}var sc=.1;function Rg(e,t){return wg(e.x-t.x)<=sc&&wg(e.y-t.y)<=sc}function iP(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c=i.bendpointMove.insert,u=i.bendpointMove.bendpointIndex,l;if(o===0)return r;if(r>=u&&(l=c?r+1:r-1),r<u&&(l=r,c&&n.type!=="bendpoint"&&u-1===r)){var f=Pg(t,u);f<n.relativeLocation&&l++}return l}return o===0?r:i.connectionStart&&r===0?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}function Cg(e,t,n,i){var r=0,o=0,a={point:e,delta:{x:0,y:0}},s=JC(e,n),c=s.segmentIndex,u=iP(n,t,s,i);if(u<0||u>t.length-2||u===null)return a;var l=Ag(n,c),f=Ag(t,u),p=s.position,d=oP(l,p),m=rP(l,f);if(s.type==="bendpoint"){var h=t.length-n.length,g=s.bendpointIndex,y=n[g];if(t.indexOf(y)!==-1)return a;if(h===0){var v=t[g];return r=v.x-s.position.x,o=v.y-s.position.y,{delta:{x:r,y:o},point:{x:e.x+r,y:e.y+o}}}h<0&&g!==0&&g<n.length-1&&(d=Pg(n,g))}var b={x:(f[1].x-f[0].x)*d+f[0].x,y:(f[1].y-f[0].y)*d+f[0].y},x=XC({x:e.x-p.x,y:e.y-p.y},m);return r=b.x+x.x-e.x,o=b.y+x.y-e.y,{point:Li(b),delta:Li({x:r,y:o})}}function Pg(e,t){var n=va(e[t-1],e[t]),i=va(e[t],e[t+1]),r=n/(n+i);return r}function rP(e,t){var n=vg(e),i=vg(t);return i-n}function Ag(e,t){return[e[t],e[t+1]]}function oP(e,t){var n=va(e[0],e[1]),i=va(e[0],t);return n===0?0:i/n}function aP(e,t,n,i){var r=Ie(e);return Cg(r,t,n,i).delta}function xa(e,t,n){var i=ma(t),r=ma(n),o=ui(e,i),a={x:o.x*(n.width/t.width),y:o.y*(n.height/t.height)};return Li({x:r.x+a.x,y:r.y+a.y})}function Tg(e,t,n){var i=ma(e),r=ma(t),o=ma(n),a=ui(e,i),s=ui(i,r),c=sP(i,t,n);if(c)return c;var u={x:s.x*(n.width/t.width),y:s.y*(n.height/t.height)},l={x:o.x+u.x,y:o.y+u.y};return Li({x:l.x+a.x-e.x,y:l.y+a.y-e.y})}function sP(e,t,n){var i=Ae(t),r=Ae(n);if(cP(i,r))return null;var o=nn(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=nn(n,s),c!==o?null:a}function cP(e,t){return uP(e,t)||lP(e,t)}function uP(e,t){return e.right!==t.right&&e.left!==t.left}function lP(e,t){return e.top!==t.top&&e.bottom!==t.bottom}var Mg="name",kg="text";function lp(e,t,n,i){te.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",a=>{ie(a.context.element)===a.context.moddleElement&&r(a)});function r(a){var s=a.context,c=s.element,u=s.properties;if(Mg in u&&t.updateLabel(c,u[Mg]),kg in u&&E(c,"bpmn:TextAnnotation")){var l=i.getTextAnnotationBounds({x:c.x,y:c.y,width:c.width,height:c.height},u[kg]||"");t.updateLabel(c,u.text,l)}}this.postExecute(["shape.create","connection.create"],function(a){var s=a.context,c=s.hints||{};if(c.createElementsBehavior!==!1){var u=s.shape||s.connection;Ge(u)||!or(u)||Un(u)&&t.updateLabel(u,Un(u))}}),this.postExecute("shape.delete",function(a){var s=a.context,c=s.labelTarget,u=s.hints||{};c&&u.unsetLabel!==!1&&t.updateLabel(c,null,null,{removeShape:!1})});function o(a){var s=a.context,c=s.connection,u=c.label,l=V({},s.hints),f=s.newWaypoints||c.waypoints,p=s.oldWaypoints;return typeof l.startChanged>"u"&&(l.startChanged=!!l.connectionStart),typeof l.endChanged>"u"&&(l.endChanged=!!l.connectionEnd),aP(u,f,p,l)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(a){var s=a.context,c=s.hints||{};if(c.labelBehavior!==!1){var u=s.connection,l=u.label,f;!l||!l.parent||(f=o(a),t.moveShape(l,f))}}),this.postExecute(["shape.replace"],function(a){var s=a.context,c=s.newShape,u=s.oldShape,l=ie(c);l&&or(l)&&u.label&&c.label&&(c.label.x=u.label.x,c.label.y=u.label.y)}),this.preExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.hints||{};if(!(!Ge(c)||u.autoResize)){var l=s.newBounds,f=i.getDimensions(Un(c)||"",{box:l,style:i.getExternalStyle()}),p=Math.ceil(f.height),d=l.y!==c.y,m=c.y+c.height;s.newBounds={width:l.width,height:p,x:l.x,y:d?m-p:l.y}}}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.newBounds,l=s.oldBounds;if(Vs(c)){var f=c.label,p=Ie(f),d=dP(l),m=fP(p,d),h=pP(m,l,u);t.moveShape(f,h)}})}xe(lp,te),lp.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];function pP(e,t,n){var i=xa(e,t,n);return Li(ui(i,e))}function fP(e,t){if(t.length){var n=hP(e,t);return up(e,n)}}function dP(e){return[[{x:e.x,y:e.y},{x:e.x+(e.width||0),y:e.y}],[{x:e.x+(e.width||0),y:e.y},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y+(e.height||0)},{x:e.x+(e.width||0),y:e.y+(e.height||0)}],[{x:e.x,y:e.y},{x:e.x,y:e.y+(e.height||0)}]]}function hP(e,t){var n=t.map(function(r){return{line:r,distance:bg(e,r)}}),i=pi(n,"distance");return i[0].line}function mP(e,t,n,i){return Cg(e,t,n,i).point}function pp(e,t){te.call(this,e);function n(i,r){var o=i.context,a=o.connection,s=V({},o.hints),c=o.newWaypoints||a.waypoints,u=o.oldWaypoints;return typeof s.startChanged>"u"&&(s.startChanged=!!s.connectionStart),typeof s.endChanged>"u"&&(s.endChanged=!!s.connectionEnd),mP(r,c,u,s)}this.postExecute(["connection.layout","connection.updateWaypoints"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming;s.forEach(function(c){var u=c.waypoints[c.waypoints.length-1],l=n(i,u),f=[].concat(c.waypoints.slice(0,-1),[l]);t.updateWaypoints(c,f)}),a.forEach(function(c){var u=c.waypoints[0],l=n(i,u),f=[].concat([l],c.waypoints.slice(1));t.updateWaypoints(c,f)})}),this.postExecute(["connection.move"],function(i){var r=i.context,o=r.connection,a=o.outgoing,s=o.incoming,c=r.delta;s.forEach(function(u){var l=u.waypoints[u.waypoints.length-1],f={x:l.x+c.x,y:l.y+c.y},p=[].concat(u.waypoints.slice(0,-1),[f]);t.updateWaypoints(u,p)}),a.forEach(function(u){var l=u.waypoints[0],f={x:l.x+c.x,y:l.y+c.y},p=[].concat([f],u.waypoints.slice(1));t.updateWaypoints(u,p)})})}xe(pp,te),pp.$inject=["eventBus","modeling"];function cc(e,t,n){var i=lc(e),r=Dg(i,t),o=i[0];return r.length?r[r.length-1]:xa(o.original||o,n,t)}function uc(e,t,n){var i=lc(e),r=Dg(i,t),o=i[i.length-1];return r.length?r[0]:xa(o.original||o,n,t)}function fp(e,t,n){var i=lc(e),r=Og(t,n),o=i[0];return xa(o.original||o,r,t)}function dp(e,t,n){var i=lc(e),r=Og(t,n),o=i[i.length-1];return xa(o.original||o,r,t)}function Og(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function lc(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function Dg(e,t){var n=ln(e,yP);return Ue(n,function(i){return gP(i,t)})}function gP(e,t){return nn(t,e,1)==="intersect"}function yP(e){return e.original||e}function hp(e,t){te.call(this,e),this.postExecute("shape.replace",function(n){var i=n.oldShape,r=n.newShape;if(vP(i,r)){var o=bP(i);o.incoming.forEach(function(a){var s=uc(a,r,i);t.reconnectEnd(a,r,s)}),o.outgoing.forEach(function(a){var s=cc(a,r,i);t.reconnectStart(a,r,s)})}},!0)}hp.$inject=["eventBus","modeling"],xe(hp,te);function vP(e,t){return E(e,"bpmn:Participant")&&Ke(e)&&E(t,"bpmn:Participant")&&!Ke(t)}function bP(e){var t=oa([e]),n=[],i=[];return t.forEach(function(r){r!==e&&(r.incoming.forEach(function(o){E(o,"bpmn:MessageFlow")&&n.push(o)}),r.outgoing.forEach(function(o){E(o,"bpmn:MessageFlow")&&i.push(o)}))},[]),{incoming:n,outgoing:i}}const xP=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Lg(e){const t=ie(e);if(!E(t,"bpmn:BoundaryEvent")&&!(E(t,"bpmn:StartEvent")&&mn(t.$parent)))return!1;const n=t.get("eventDefinitions");return!n||!n.length?!1:xP.some(i=>E(n[0],i))}function Ig(e){return E(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function mp(e,t){e.invoke(te,this),this.postExecuted("shape.replace",function(n){const i=n.context.oldShape,r=n.context.newShape,o=n.context.hints;if(!Lg(r))return;const a=Ig(r);if(o.targetElement&&o.targetElement[a]!==void 0)return;const c=ie(i).get(a),u=ie(r).get(a);c!==u&&t.updateProperties(r,{[a]:c})})}mp.$inject=["injector","modeling"],xe(mp,te);function gp(e,t){te.call(this,e),this.preExecute("shape.resize",function(n){var i=n.shape,r=Ze(i),o=r&&r.get("label"),a=o&&o.get("bounds");a&&t.updateModdleProperties(i,o,{bounds:void 0})},!0)}xe(gp,te),gp.$inject=["eventBus","modeling"];function yp(e,t,n){te.call(this,e),this.preExecute("shape.delete",function(i){var r=i.context.shape;if(!(r.incoming.length!==1||r.outgoing.length!==1)){var o=r.incoming[0],a=r.outgoing[0];if(!(!E(o,"bpmn:SequenceFlow")||!E(a,"bpmn:SequenceFlow"))&&t.canConnect(o.source,a.target,o)){var s=_P(o.waypoints,a.waypoints);n.reconnectEnd(o,a.target,s)}}})}xe(yp,te),yp.$inject=["eventBus","bpmnRules","modeling"];function So(e){return e.original||e}function _P(e,t){var n=sp(So(e[e.length-2]),So(e[e.length-1]),So(t[1]),So(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[So(e[0]),So(t[t.length-1])]}function vp(e,t){te.call(this,e),this.preExecute("shape.delete",function(n){var i=n.shape,r=i.parent;E(i,"bpmn:Participant")&&(n.collaborationRoot=r)},!0),this.postExecute("shape.delete",function(n){var i=n.collaborationRoot;if(i&&!i.businessObject.participants.length){var r=t.makeProcess(),o=i.children.slice();t.moveElements(o,{x:0,y:0},r)}},!0)}vp.$inject=["eventBus","modeling"],xe(vp,te);function bp(e,t,n,i){te.call(this,e);var r=i.get("dragging",!1);function o(c){var u=c.source,l=c.target,f=c.parent;if(f){var p,d;E(c,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(u,l)||(d=!0),n.canConnectMessageFlow(u,l)&&(p="bpmn:MessageFlow")),E(c,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(u,l)||(d=!0),n.canConnectSequenceFlow(u,l)&&(p="bpmn:SequenceFlow")),d&&t.removeConnection(c),p&&t.connect(u,l,{type:p,waypoints:c.waypoints.slice()})}}function a(c){var u=c.context,l=u.connection,f=u.newSource||l.source,p=u.newTarget||l.target,d,m;d=n.canConnect(f,p),!(!d||d.type===l.type)&&(m=t.connect(f,p,{type:d.type,associationDirection:d.associationDirection,waypoints:l.waypoints.slice()}),l.parent&&t.removeConnection(l),u.connection=m,r&&s(l,m))}function s(c,u){var l=r.context(),f=l&&l.payload.previousSelection,p;!f||!f.length||(p=f.indexOf(c),p!==-1&&f.splice(p,1,u))}this.postExecuted("elements.move",function(c){var u=c.closure,l=u.allConnections;$(l,o)},!0),this.preExecute("connection.reconnect",a),this.postExecuted("element.updateProperties",function(c){var u=c.context,l=u.properties,f=u.element,p=f.businessObject,d;l.default&&(d=ft(f.outgoing,io({id:f.businessObject.default.id})),d&&t.updateProperties(d,{conditionExpression:void 0})),l.conditionExpression&&p.sourceRef.default===p&&t.updateProperties(f.source,{default:void 0})})}xe(bp,te),bp.$inject=["eventBus","modeling","bpmnRules","injector"];function pc(e,t,n,i,r,o){i.invoke(te,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,function(a){var s=a.context,c=s.parent,u=s.elements,l=Tn(u,function(f,p){var d=t.canReplace([p],p.host||p.parent||c);return d?f.concat(d.replacements):f},[]);l.length&&this._replaceElements(u,l)},this),this.postExecuted(["elements.move"],500,function(a){var s=a.context,c=s.newParent,u=s.newHost,l=[];$(s.closure.topLevel,function(p){mn(p)?l=l.concat(p.children):l=l.concat(p)}),l.length===1&&u&&(c=u);var f=t.canReplace(l,c);f&&this._replaceElements(l,f.replacements,u)},this),this.postExecute(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape,l=c.attachers,f;l&&l.length&&(f=t.canReplace(l,u),this._replaceElements(l,f.replacements))},this),this.postExecuted(["shape.replace"],1500,function(a){var s=a.context,c=s.oldShape,u=s.newShape;r.unclaimId(c.businessObject.id,c.businessObject),r.updateProperties(u,{id:c.id})})}xe(pc,te),pc.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;$(t,function(o){var a={type:o.newElementType},s=n.get(o.oldElementId),c=e.indexOf(s);e[c]=i.replaceElement(s,a,{select:!1})}),t&&r.select(e)},pc.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var wP=1500,EP={width:140,height:120},xp={width:300,height:60},_p={width:60,height:300},fc={width:300,height:150},dc={width:150,height:300},Bg={width:140,height:120},Ng={width:100,height:40};function $g(e){e.on("resize.start",wP,function(t){var n=t.context,i=n.shape,r=n.direction,o=n.balanced;(E(i,"bpmn:Lane")||E(i,"bpmn:Participant"))&&(n.resizeConstraints=AP(i,r,o)),E(i,"bpmn:SubProcess")&&Ke(i)&&(n.minDimensions=Bg),E(i,"bpmn:TextAnnotation")&&(n.minDimensions=Ng)})}$g.$inject=["eventBus"];var cr=Math.abs,SP=Math.min,RP=Math.max;function Fg(e,t,n,i){var r=e[t];e[t]=r===void 0?n:i(n,r)}function Ro(e,t,n){return Fg(e,t,n,SP)}function Co(e,t,n){return Fg(e,t,n,RP)}var CP={top:20,left:50,right:20,bottom:20},PP={top:50,left:20,right:20,bottom:20};function AP(e,t,n){var i=Zn(e),r=!0,o=!0,a=ic(i,[i]),s=Ae(e),c={},u={},l=Xt(e),f=l?xp:_p;/n/.test(t)?u.top=s.bottom-f.height:/e/.test(t)?u.right=s.left+f.width:/s/.test(t)?u.bottom=s.top+f.height:/w/.test(t)&&(u.left=s.right-f.width),a.forEach(function(m){var h=Ae(m);l?(h.top<s.top-10&&(r=!1),h.bottom>s.bottom+10&&(o=!1)):(h.left<s.left-10&&(r=!1),h.right>s.right+10&&(o=!1)),/n/.test(t)&&(n&&cr(s.top-h.bottom)<10&&Co(c,"top",h.top+f.height),cr(s.top-h.top)<5&&Ro(u,"top",h.bottom-f.height)),/e/.test(t)&&(n&&cr(s.right-h.left)<10&&Ro(c,"right",h.right-f.width),cr(s.right-h.right)<5&&Co(u,"right",h.left+f.width)),/s/.test(t)&&(n&&cr(s.bottom-h.top)<10&&Ro(c,"bottom",h.bottom-f.height),cr(s.bottom-h.bottom)<5&&Co(u,"bottom",h.top+f.height)),/w/.test(t)&&(n&&cr(s.left-h.right)<10&&Co(c,"left",h.left+f.width),cr(s.left-h.left)<5&&Ro(u,"left",h.right-f.width))});var p=i.children.filter(function(m){return!m.hidden&&!m.waypoints&&(E(m,"bpmn:FlowElement")||E(m,"bpmn:Artifact"))}),d=l?CP:PP;return p.forEach(function(m){var h=Ae(m);/n/.test(t)&&(!l||r)&&Ro(u,"top",h.top-d.top),/e/.test(t)&&(l||o)&&Co(u,"right",h.right+d.right),/s/.test(t)&&(!l||o)&&Co(u,"bottom",h.bottom+d.bottom),/w/.test(t)&&(l||r)&&Ro(u,"left",h.left-d.left)}),{min:u,max:c}}function jg(e){!e||typeof e.stopPropagation!="function"||e.stopPropagation()}function Po(e){return e.originalEvent||e.srcEvent}function wp(e){jg(e),jg(Po(e))}function $r(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 Hg(){return/mac/i.test(navigator.platform)}function zg(e,t){return(Po(e)||e).button===t}function ur(e){return zg(e,0)}function TP(e){return zg(e,1)}function _a(e){var t=Po(e)||e;return ur(e)?Hg()?t.metaKey:t.ctrlKey:!1}function hc(e){var t=Po(e)||e;return ur(e)&&t.shiftKey}var Gg=1001;function Vg(e,t){e.on("resize.start",Gg+500,function(n){var i=n.context,r=i.shape;(E(r,"bpmn:Lane")||E(r,"bpmn:Participant"))&&(i.balanced=!_a(n))}),e.on("resize.end",Gg,function(n){var i=n.context,r=i.shape,o=i.canExecute,a=i.newBounds;if(E(r,"bpmn:Lane")||E(r,"bpmn:Participant"))return o&&(a=bm(a),t.resizeLane(r,a,i.balanced)),!1})}Vg.$inject=["eventBus","modeling"];var MP=500;function Ep(e,t,n,i,r){n.invoke(te,this);function o(l){return Ve(l,["bpmn:ReceiveTask","bpmn:SendTask"])||kP(l,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function a(l){var f=e.getDefinitions(),p=f.get("rootElements");return!!ft(p,io({id:l.id}))}function s(l){if(E(l,"bpmn:ErrorEventDefinition"))return"errorRef";if(E(l,"bpmn:EscalationEventDefinition"))return"escalationRef";if(E(l,"bpmn:MessageEventDefinition"))return"messageRef";if(E(l,"bpmn:SignalEventDefinition"))return"signalRef"}function c(l){if(Ve(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.get("messageRef");var f=l.get("eventDefinitions"),p=f[0];return p.get(s(p))}function u(l,f){if(Ve(l,["bpmn:ReceiveTask","bpmn:SendTask"]))return l.set("messageRef",f);var p=l.get("eventDefinitions"),d=p[0];return d.set(s(d),f)}this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.shape||l.element;if(o(f)){var p=ie(f),d=c(p),m;d&&!a(d)&&(m=e.getDefinitions().get("rootElements"),Mt(m,d),l.addedRootElement=d)}},!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],function(l){var f=l.addedRootElement;if(f){var p=e.getDefinitions().get("rootElements");At(p,f)}},!0),t.on("copyPaste.copyElement",function(l){var f=l.descriptor,p=l.element;if(!(p.labelTarget||!o(p))){var d=ie(p),m=c(d);m&&(f.referencedRootElement=m)}}),t.on("copyPaste.pasteElement",MP,function(l){var f=l.descriptor,p=f.businessObject,d=f.referencedRootElement;d&&(a(d)||(d=i.copyElement(d,r.create(d.$type))),u(p,d),delete f.referencedRootElement)})}Ep.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],xe(Ep,te);function kP(e,t){return Le(t)||(t=[t]),qi(t,function(n){return vo(e,n)})}var Wg=Math.max;function Ug(e){e.on("spaceTool.getMinDimensions",function(t){var n=t.shapes,i=t.axis,r=t.start,o={};return $(n,function(a){var s=a.id;E(a,"bpmn:Participant")&&(o[s]=DP(a,i,r)),E(a,"bpmn:Lane")&&(o[s]=Xt(a)?xp:_p),E(a,"bpmn:SubProcess")&&Ke(a)&&(o[s]=Bg),E(a,"bpmn:TextAnnotation")&&(o[s]=Ng),E(a,"bpmn:Group")&&(o[s]=EP)}),o})}Ug.$inject=["eventBus"];function OP(e){return e==="x"}function DP(e,t,n){var i=Xt(e);if(!BP(e))return i?fc:dc;var r=OP(t),o={};return r?i?o=fc:o={width:IP(e,n,r),height:dc.height}:i?o={width:fc.width,height:LP(e,n,r)}:o=dc,o}function LP(e,t,n){var i;return i=NP(e,t,n),Wg(fc.height,i)}function IP(e,t,n){var i;return i=$P(e,t,n),Wg(dc.width,i)}function BP(e){return!!sr(e).length}function NP(e,t,n){var i=sr(e),r;return r=Sp(i,t,n),e.height-r.height+xp.height}function $P(e,t,n){var i=sr(e),r;return r=Sp(i,t,n),e.width-r.width+_p.width}function Sp(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=sr(r),o.length?Sp(o,t,n):r}var Yg="_plane";function qg(e){var t=e.id;return FP(t)}function _i(e){var t=e.id;return E(e,"bpmn:SubProcess")?Kg(t):t}function Fr(e){return Kg(e)}function mc(e){var t=Ze(e);return E(t,"bpmndi:BPMNPlane")}function Kg(e){return e+Yg}function FP(e){return e.replace(new RegExp(Yg+"$"),"")}var Xg=400,jP=600,Zg={x:180,y:160};function $i(e,t,n,i,r,o,a){te.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=a;var s=this;function c(f){return E(f,"bpmn:SubProcess")&&!Ke(f)}function u(f){var p=f.shape,d=f.newRootElement,m=ie(p);d=s._addDiagram(d||m),f.newRootElement=e.addRootElement(d)}function l(f){var p=f.shape,d=ie(p);s._removeDiagram(d);var m=f.newRootElement=a.get(_i(d));e.removeRootElement(m)}this.executed("shape.create",function(f){var p=f.shape;c(p)&&u(f)},!0),this.postExecuted("elements.create",function(f){var p=f.elements;$(p,function(d){if(c(d)){var m=a.get(_i(d));if(!(!m||!d.children||!d.children.length)){var h=Qg(d);s._showRecursively(h),s._moveChildrenToShape(h,m)}}})},!0),this.reverted("shape.create",function(f){var p=f.shape;c(p)&&l(f)},!0),this.preExecute("shape.delete",function(f){var p=f.shape;!E(p,"bpmn:SubProcess")||!Ke(p)||$(pa([p]),d=>{n.removeShape(d.annotation)})},!0),this.preExecuted("shape.delete",function(f){var p=f.shape;if(c(p)){var d=a.get(_i(p));d&&n.removeElements(d.children.slice())}},!0),this.executed("shape.delete",function(f){var p=f.shape;c(p)&&l(f)},!0),this.reverted("shape.delete",function(f){var p=f.shape;c(p)&&u(f)},!0),this.preExecuted("shape.replace",function(f){var p=f.oldShape,d=f.newShape;!c(p)||!c(d)||(f.oldRoot=e.removeRootElement(_i(p)))},!0),this.postExecuted("shape.replace",function(f){var p=f.newShape,d=f.oldRoot,m=e.findRoot(_i(p));if(!(!d||!m)){var h=d.children;n.moveElements(h,{x:0,y:0},m)}},!0),this.executed("element.updateProperties",function(f){var p=f.element;if(E(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,g=d.id;if(h!==g){if(mc(p)){a.updateId(p,Fr(g)),a.updateId(h,g);return}var y=a.get(Fr(h));y&&a.updateId(Fr(h),Fr(g))}}},!0),this.reverted("element.updateProperties",function(f){var p=f.element;if(E(p,"bpmn:SubProcess")){var d=f.properties,m=f.oldProperties,h=m.id,g=d.id;if(h!==g){if(mc(p)){a.updateId(p,Fr(h)),a.updateId(g,h);return}var y=a.get(Fr(g));y&&a.updateId(y,Fr(h))}}},!0),t.on("element.changed",function(f){var p=f.element;if(mc(p)){var d=p,m=a.get(qg(d));!m||m===d||t.fire("element.changed",{element:m})}}),this.executed("shape.toggleCollapse",Xg,function(f){var p=f.shape;E(p,"bpmn:SubProcess")&&(Ke(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.reverted("shape.toggleCollapse",Xg,function(f){var p=f.shape;E(p,"bpmn:SubProcess")&&(Ke(p)?l(f):(u(f),s._showRecursively(p.children)))},!0),this.postExecuted("shape.toggleCollapse",jP,function(f){var p=f.shape;if(E(p,"bpmn:SubProcess")){var d=f.newRootElement;if(d)if(Ke(p))s._moveChildrenToShape(d.children.slice(),p),$(pa(p.children),h=>{n.moveShape(h.annotation,{x:0,y:0},p.parent),$(h.associations,g=>{n.moveConnection(g,{x:0,y:0},p.parent)})});else{s._disconnectSharedAnnotations(p);var m=Qg(p);s._moveChildrenToShape(m,d)}}},!0),t.on("copyPaste.createTree",function(f){var p=f.element,d=f.children;if(c(p)){var m=_i(p),h=a.get(m);h&&d.push.apply(d,h.children)}}),t.on("copyPaste.copyElement",function(f){var p=f.descriptor,d=f.element,m=f.elements,h=d.parent,g=E(Ze(h),"bpmndi:BPMNPlane");if(g){var y=qg(h),v=ft(m,function(b){return b.id===y});v&&(p.parent=v.id)}}),t.on("copyPaste.pasteElement",function(f){var p=f.descriptor;p.parent&&(c(p.parent)||p.parent.hidden)&&(p.hidden=!0)})}xe($i,te),$i.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=It(i),o;if(!t.x)o={x:Zg.x-r.x,y:Zg.y-r.y};else{var a=Ie(t),s=Ie(r);o={x:a.x-s.x,y:a.y-s.y}}n.moveElements(e,o,t,{autoResize:!1})}},$i.prototype._disconnectSharedAnnotations=function(e){var t=this._modeling,n=new Set(zm(e).map(i=>i.annotation));n.size&&$(pa(e.children),i=>{n.has(i.annotation)&&$(i.associations,r=>{t.removeConnection(r)})})},$i.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},$i.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},$i.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});i.$parent=r;var o=n.createRoot({id:_i(e),type:e.$type,di:i,businessObject:e,collapsed:!0});return o},$i.prototype._removeDiagram=function(e){var t=this._bpmnjs,n=t.getDefinitions().diagrams,i=ft(n,function(r){return r.plane.bpmnElement.id===e.id});return n.splice(n.indexOf(i),1),i},$i.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"];function HP(e){var t=[];return $(pa(e),n=>{t.push(n.annotation),t.push.apply(t,n.associations)}),t}function Qg(e){return e.children.slice().concat(HP(e.children)).concat(zP(e))}function zP(e){return Tl(e.children||[]).reduce(function(t,n){return n.label&&n.label.parent!==e&&t.push(n.label),t},[])}function Rp(e,t){e.invoke(te,this),this.postExecuted("shape.replace",function(n){var i=n.context.oldShape,r=n.context.newShape;if(!(!E(r,"bpmn:SubProcess")||E(r,"bpmn:AdHocSubProcess")||!(E(i,"bpmn:Task")||E(i,"bpmn:CallActivity"))||!Ke(r))){var o=GP(r);t.createShape({type:"bpmn:StartEvent"},o,r)}})}Rp.$inject=["injector","modeling"],xe(Rp,te);function GP(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}function Cp(e,t){te.call(this,e),this.preExecute("connection.create",function(n){const{target:i}=n;E(i,"bpmn:TextAnnotation")&&(n.parent=i.parent)},!0),this.preExecute(["shape.create","shape.resize","elements.move"],function(n){const i=n.shapes||[n.shape];i.length===1&&E(i[0],"bpmn:TextAnnotation")&&(n.hints=n.hints||{},n.hints.autoResize=!1)},!0),this.preExecute("shape.resize",function(n){var i=n.context,r=i.shape,o=i.hints||{};if(!(!E(r,"bpmn:TextAnnotation")||o.autoResize)){var a=i.newBounds,s=t.getTextAnnotationBounds(a,Un(r)||""),c=a.y!==r.y&&Math.abs(a.y+a.height-(r.y+r.height))<=1,u=r.y+r.height;i.newBounds={width:a.width,height:s.height,x:a.x,y:c?u-s.height:a.y}}})}xe(Cp,te),Cp.$inject=["eventBus","textRenderer"];function Pp(e,t){te.call(this,e),this.postExecuted("shape.toggleCollapse",1500,function(n){var i=n.shape;if(Ke(i))return;var r=oa(i);r.forEach(function(a){var s=a.incoming.slice(),c=a.outgoing.slice();$(s,function(u){o(u,!0)}),$(c,function(u){o(u,!1)})});function o(a,s){r.indexOf(a.source)!==-1&&r.indexOf(a.target)!==-1||E(a,"bpmn:Association")&&(E(a.source,"bpmn:TextAnnotation")||E(a.target,"bpmn:TextAnnotation"))||(s?t.reconnectEnd(a,i,Ie(i)):t.reconnectStart(a,i,Ie(i)))}},!0)}xe(Pp,te),Pp.$inject=["eventBus","modeling"];var Ap=500;function Tp(e,t,n){te.call(this,e);function i(a){a.length&&a.forEach(function(s){s.type==="label"&&!s.businessObject.name&&(s.hidden=!0)})}function r(a,s){var c=a.children,u=s,l,f;return l=VP(c).concat([a]),f=ag(l),f?(u.width=Math.max(f.width,u.width),u.height=Math.max(f.height,u.height),u.x=f.x+(f.width-u.width)/2,u.y=f.y+(f.height-u.height)/2):(u.x=a.x+(a.width-u.width)/2,u.y=a.y+(a.height-u.height)/2),u}function o(a,s){return{x:a.x+(a.width-s.width)/2,y:a.y+(a.height-s.height)/2,width:s.width,height:s.height}}this.executed(["shape.toggleCollapse"],Ap,function(a){var s=a.context,c=s.shape;E(c,"bpmn:SubProcess")&&(c.collapsed?Ze(c).isExpanded=!1:(i(c.children),Ze(c).isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Ap,function(a){var s=a.context,c=s.shape;c.collapsed?Ze(c).isExpanded=!1:Ze(c).isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Ap,function(a){var s=a.context.shape,c=t.getDefaultSize(s),u;s.collapsed?u=o(s,c):u=r(s,c),n.resizeShape(s,u,null,{autoResize:s.collapsed?!1:"nwse"})})}xe(Tp,te),Tp.$inject=["eventBus","elementFactory","modeling"];function VP(e){return e.filter(function(t){return!t.hidden})}function Mp(e,t,n,i){t.invoke(te,this),this.preExecute("shape.delete",function(r){var o=r.context,a=o.shape,s=a.businessObject;Ge(a)||(E(a,"bpmn:Participant")&&Ke(a)&&n.ids.unclaim(s.processRef.id),i.unclaimId(s.id,s))}),this.preExecute("connection.delete",function(r){var o=r.context,a=o.connection,s=a.businessObject;i.unclaimId(s.id,s)}),this.preExecute("canvas.updateRoot",function(){var r=e.getRootElement(),o=r.businessObject;E(r,"bpmn:Collaboration")&&n.ids.unclaim(o.id)})}xe(Mp,te),Mp.$inject=["canvas","injector","moddle","modeling"];function kp(e,t){te.call(this,e),this.preExecute("connection.delete",function(n){var i=n.context,r=i.connection,o=r.source;WP(r,o)&&t.updateProperties(o,{default:null})})}xe(kp,te),kp.$inject=["eventBus","modeling"];function WP(e,t){if(!E(e,"bpmn:SequenceFlow"))return!1;var n=ie(t),i=ie(e);return n.get("default")===i}var UP=500,YP=5e3,Jg=["shape.create","shape.delete","shape.move","shape.resize"],ey=[...Jg,"spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move"];function Op(e,t){te.call(this,e);var n;function i(){return n=n||new qP,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(ey,YP,function(){i()}),this.postExecuted(ey,UP,function(){o()}),this.preExecute(Jg,function(a){var s=a.context,c=s.shape,u=r();!c||c.labelTarget||(E(c,"bpmn:Lane")&&u.addLane(c),E(c,"bpmn:FlowNode")&&u.addFlowNode(c))})}Op.$inject=["eventBus","modeling"],xe(Op,te);function qP(){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 KP=500,XP=5e3,ty=["connection.create","connection.delete","connection.layout","connection.move","connection.reconnect","connection.updateWaypoints","shape.create","shape.delete","shape.move","shape.resize"],ny=[...ty,"elements.create","elements.delete","elements.move","label.create","spaceTool"];function Dp(e,t){te.call(this,e);var n;function i(){return n=n||new ZP,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(ny,XP,function(){i()}),this.postExecuted(ny,KP,function(){o()}),this.preExecute(ty,function(a){var s=a.context.connection||a.context.shape,c=r();!s||s.labelTarget||(E(s,"bpmn:FlowElement")&&c.addFlowElement(s),E(s,"bpmn:Group")&&c.addGroup(s))}),this.preExecute("label.create",function(a){var s=a.context.labelTarget;E(s,"bpmn:Group")&&r().addGroup(s)})}Dp.$inject=["eventBus","modeling"],xe(Dp,te);function ZP(){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 Lp(e,t){te.call(this,e),this.postExecuted("elements.create",function(n){const i=n.context,r=i.elements;for(const o of r)QP(o)&&!eA(o)&&t.updateProperties(o,{isForCompensation:void 0})})}xe(Lp,te),Lp.$inject=["eventBus","modeling"];function QP(e){const t=ie(e);return t&&t.isForCompensation}function JP(e){return e&&E(e,"bpmn:BoundaryEvent")&&vo(e,"bpmn:CompensateEventDefinition")}function eA(e){return e.incoming.filter(n=>JP(n.source)).length>0}const tA={__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",zl],appendBehavior:["type",Gl],associationBehavior:["type",Wl],attachEventBehavior:["type",Xs],artifactBehavior:["type",Vl],boundaryEventBehavior:["type",Ul],categoryRootElementReferenceBehavior:["type",Yl],compensateBoundaryEventBehaviour:["type",ql],createBehavior:["type",Kl],createDataObjectBehavior:["type",Xl],createParticipantBehavior:["type",Jl],dataInputAssociationBehavior:["type",ep],dataStoreBehavior:["type",tp],deleteLaneBehavior:["type",np],detachEventBehavior:["type",rc],dropOnFlowBehavior:["type",rp],eventBasedGatewayBehavior:["type",op],fixHoverBehavior:["type",dg],groupBehavior:["type",ap],importDockingFix:["type",mg],isHorizontalFix:["type",cp],labelBehavior:["type",lp],layoutConnectionBehavior:["type",pp],messageFlowBehavior:["type",hp],nonInterruptingBehavior:["type",mp],removeElementBehavior:["type",yp],removeEmbeddedLabelBoundsBehavior:["type",gp],removeParticipantBehavior:["type",vp],replaceConnectionBehavior:["type",bp],replaceElementBehaviour:["type",pc],resizeBehavior:["type",$g],resizeLaneBehavior:["type",Vg],rootElementReferenceBehavior:["type",Ep],spaceToolBehavior:["type",Ug],subProcessPlaneBehavior:["type",$i],subProcessStartEventBehavior:["type",Rp],textAnnotationBehavior:["type",Cp],toggleCollapseConnectionBehaviour:["type",Pp],toggleElementCollapseBehaviour:["type",Tp],unclaimIdBehavior:["type",Mp],unsetDefaultFlowBehavior:["type",kp],updateFlowNodeRefsBehavior:["type",Op],updateCategoryValueRefsBehavior:["type",Dp],setCompensationActivityAfterPasteBehavior:["type",Lp]};function Ip(e){this._commandStack=e.get("commandStack",!1)}Ip.$inject=["injector"],Ip.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),n===void 0?!0:n};const wi={__init__:["rules"],rules:["type",Ip]};function Qn(e){te.call(this,e),this.init()}Qn.$inject=["eventBus"],xe(Qn,te),Qn.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)})},Qn.prototype.init=function(){};function iy(e,t){var n=nn(e,t,-15);return n!=="intersect"?n:null}function on(e){Qn.call(this,e)}xe(on,Qn),on.$inject=["eventBus"],on.prototype.init=function(){this.addRule("connection.start",function(e){var t=e.source;return nA(t)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent,o=i.targetAttach;if(o)return!1;r&&(n.parent=r);try{return yc(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnect",function(e){var t=e.connection,n=e.source,i=e.target;return yc(n,i,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){var t=e.shape,n=e.newBounds,i=e.direction;return gy(t,n,i)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return ct(i)&&!vc(t,i)?!1:Ar(t,function(r){return ct(r)?yc(r.source,r.target,r):r.host?wa(r,r.host,null,n):Fp(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 ly(a)&&!n.includes(a.host)})?!1:wa(n,t,null,i)||hy(n,t,i)||my(n,t)||vc(n,t)}),this.addRule("shape.create",function(e){return Fp(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return wa(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element,n=e.elements;return _y(n,t)})},on.prototype.canConnectMessageFlow=by,on.prototype.canConnectSequenceFlow=xy,on.prototype.canConnectDataAssociation=jp,on.prototype.canConnectAssociation=yy,on.prototype.canConnectCompensationAssociation=vy,on.prototype.canMove=my,on.prototype.canAttach=wa,on.prototype.canReplace=hy,on.prototype.canDrop=Ao,on.prototype.canInsert=vc,on.prototype.canCreate=Fp,on.prototype.canConnect=yc,on.prototype.canResize=gy,on.prototype.canCopy=_y;function nA(e){return Bp(e)?null:Ve(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}function Bp(e){return!e||Ge(e)}function ry(e){do{if(E(e,"bpmn:Process"))return ie(e);if(E(e,"bpmn:Participant"))return ie(e).processRef||ie(e)}while(e=e.parent)}function Np(e){return E(e,"bpmn:TextAnnotation")}function $p(e){return E(e,"bpmn:Group")&&!e.labelTarget}function oy(e){return E(e,"bpmn:BoundaryEvent")&&Ei(e,"bpmn:CompensateEventDefinition")}function gc(e){return ie(e).isForCompensation}function iA(e,t){var n=ry(e),i=ry(t);return n===i}function rA(e){return E(e,"bpmn:InteractionNode")&&!E(e,"bpmn:BoundaryEvent")&&(!E(e,"bpmn:Event")||E(e,"bpmn:ThrowEvent")&&cy(e,"bpmn:MessageEventDefinition"))}function oA(e){return E(e,"bpmn:InteractionNode")&&!gc(e)&&(!E(e,"bpmn:Event")||E(e,"bpmn:CatchEvent")&&cy(e,"bpmn:MessageEventDefinition"))&&!(E(e,"bpmn:BoundaryEvent")&&!Ei(e,"bpmn:MessageEventDefinition"))}function ay(e){for(var t=e;t=t.parent;){if(E(t,"bpmn:FlowElementsContainer"))return ie(t);if(E(t,"bpmn:Participant"))return ie(t).processRef}return null}function sy(e,t){var n=ay(e),i=ay(t);return n===i}function Ei(e,t){var n=ie(e);return!!ft(n.eventDefinitions||[],function(i){return E(i,t)})}function cy(e,t){var n=ie(e);return(n.eventDefinitions||[]).every(function(i){return E(i,t)})}function aA(e){return E(e,"bpmn:FlowNode")&&!E(e,"bpmn:EndEvent")&&!mn(e)&&!(E(e,"bpmn:IntermediateThrowEvent")&&Ei(e,"bpmn:LinkEventDefinition"))&&!oy(e)&&!gc(e)}function sA(e){return E(e,"bpmn:FlowNode")&&!E(e,"bpmn:StartEvent")&&!E(e,"bpmn:BoundaryEvent")&&!mn(e)&&!(E(e,"bpmn:IntermediateCatchEvent")&&Ei(e,"bpmn:LinkEventDefinition"))&&!gc(e)}function cA(e){return E(e,"bpmn:ReceiveTask")||E(e,"bpmn:IntermediateCatchEvent")&&(Ei(e,"bpmn:MessageEventDefinition")||Ei(e,"bpmn:TimerEventDefinition")||Ei(e,"bpmn:ConditionalEventDefinition")||Ei(e,"bpmn:SignalEventDefinition"))}function uA(e){for(var t=[];e;)e=e.parent,e&&t.push(e);return t}function uy(e,t){var n=uA(t);return n.indexOf(e)!==-1}function yc(e,t,n){if(Bp(e)||Bp(t))return null;if(!E(n,"bpmn:DataAssociation")){if(by(e,t))return{type:"bpmn:MessageFlow"};if(xy(e,t))return{type:"bpmn:SequenceFlow"}}var i=jp(e,t);return i||(vy(e,t)?{type:"bpmn:Association",associationDirection:"One"}:yy(e,t)?{type:"bpmn:Association",associationDirection:"None"}:!1)}function Ao(e,t){return Ge(e)||$p(e)?!0:E(t,"bpmn:Participant")&&!Ke(t)?!1:E(e,"bpmn:Participant")?E(t,"bpmn:Process")||E(t,"bpmn:Collaboration"):Ve(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:E(e,"bpmn:Lane")?E(t,"bpmn:Participant")||E(t,"bpmn:Lane"):E(e,"bpmn:BoundaryEvent")&&!lA(e)?!1:E(e,"bpmn:FlowElement")&&!E(e,"bpmn:DataStoreReference")?E(t,"bpmn:FlowElementsContainer")?Ke(t):Ve(t,["bpmn:Participant","bpmn:Lane"]):E(e,"bpmn:DataStoreReference")&&E(t,"bpmn:Collaboration")?qi(ie(t).get("participants"),function(n){return!!n.get("processRef")}):Ve(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Ve(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):E(e,"bpmn:MessageFlow")?E(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t:!1}function lA(e){return ie(e).cancelActivity&&(py(e)||fy(e))}function ly(e){return!Ge(e)&&E(e,"bpmn:BoundaryEvent")}function pA(e){return E(e,"bpmn:Lane")}function fA(e){return ly(e)||E(e,"bpmn:IntermediateThrowEvent")&&py(e)?!0:E(e,"bpmn:IntermediateCatchEvent")&&fy(e)}function py(e){var t=ie(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function fy(e){return dy(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function dy(e,t){return t.some(function(n){return Ei(e,n)})}function dA(e){return E(e,"bpmn:ReceiveTask")&&ft(e.incoming,function(t){return E(t.source,"bpmn:EventBasedGateway")})}function wa(e,t,n,i){if(Array.isArray(e)||(e=[e]),e.length!==1)return!1;var r=e[0];return Ge(r)||!fA(r)||mn(t)||!E(t,"bpmn:Activity")||gc(t)||i&&!iy(i,t)||dA(t)?!1:"attach"}function hy(e,t,n){if(!t)return!1;var i={replacements:[]};return $(e,function(r){mn(t)||E(r,"bpmn:StartEvent")&&r.type!=="label"&&Ao(r,t)&&(wR(r)||i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),(ER(r)||SR(r)||RR(r))&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"}),dy(r,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&E(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:StartEvent"})),E(t,"bpmn:Transaction")||Ei(r,"bpmn:CancelEventDefinition")&&r.type!=="label"&&(E(r,"bpmn:EndEvent")&&Ao(r,t)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:EndEvent"}),E(r,"bpmn:BoundaryEvent")&&wa(r,t,null,n)&&i.replacements.push({oldElementId:r.id,newElementType:"bpmn:BoundaryEvent"}))}),i.replacements.length?i:!1}function my(e,t){return qi(e,pA)?!1:t===void 0?!0:t===null?!1:e.every(function(n){return Ao(n,t)})}function Fp(e,t,n,i){return t?Ge(e)||$p(e)?!0:Ao(e,t)||vc(e,t):!1}function gy(e,t,n){return E(e,"bpmn:SubProcess")?Ke(e)&&(!t||t.width>=100&&t.height>=80):E(e,"bpmn:Lane")||E(e,"bpmn:Participant")?!0:Np(e)?n?n==="e"||n==="w":!0:$p(e)?!0:Ge(e)?n?n==="e"||n==="w":!0:!1}function hA(e,t){var n=Np(e),i=Np(t);return(n||i)&&n!==i}function yy(e,t){return uy(t,e)||uy(e,t)?!1:hA(e,t)?!0:!!jp(e,t)}function vy(e,t){return sy(e,t)&&oy(e)&&E(t,"bpmn:Activity")&&!gA(t,e)&&!mn(t)}function by(e,t){return Ey(e)&&!Ey(t)?!1:rA(e)&&oA(t)&&!iA(e,t)}function xy(e,t){return aA(e)&&sA(t)&&sy(e,t)&&!(E(e,"bpmn:EventBasedGateway")&&!cA(t))}function jp(e,t){return Ve(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ve(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:Ve(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Ve(e,["bpmn:Activity","bpmn:CatchEvent"])?{type:"bpmn:DataOutputAssociation"}:!1}function vc(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:Ve(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!Ge(t)&&E(e,"bpmn:FlowNode")&&!E(e,"bpmn:BoundaryEvent")&&Ao(e,t.parent)}function Hp(e,t){return e&&t&&e.indexOf(t)!==-1}function _y(e,t){return Ge(t)?!0:!(E(t,"bpmn:Lane")&&!Hp(e,t.parent)||E(t,"bpmn:MessageFlow")&&!mA(e,t))}function mA(e,t){var n=wy(t.source),i=wy(t.target);return Hp(e,n)&&Hp(e,i)}function wy(e){for(;e;e=e.parent)if(E(e,"bpmn:Participant"))return e;return null}function Ey(e){return _o(e,"bpmn:Process")||_o(e,"bpmn:Collaboration")}function gA(e,t){return e.attachers.includes(t)}const yA={__depends__:[wi],__init__:["bpmnRules"],bpmnRules:["type",on]};var vA=2e3;function Sy(e,t){e.on("saveXML.start",vA,n);function n(){var i=t.getRootElements();$(i,function(r){var o=Ze(r),a,s;a=oa([r]),a=Ue(a,function(c){return c!==r&&!c.labelTarget}),s=ln(a,Ze),o.set("planeElement",s)})}}Sy.$inject=["eventBus","canvas"];const bA={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Sy]};function bc(e){te.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)})}bc.prototype.getOrdering=function(e,t){return null},xe(bc,te);function zp(e,t){bc.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=ft(n,function(c){return Ve(a,[c.type])});return s&&s.order||{level:1}}function r(a){var s=a.order;if(s||(a.order=s=i(a)),!s)throw new Error(`no order for <${a.id}>`);return s}function o(a,s,c){for(var u=s;u&&!Ve(u,c);)u=u.parent;if(!u)throw new Error(`no parent for <${a.id}> in <${s&&s.id}>`);return u}this.getOrdering=function(a,s){if(a.labelTarget||E(a,"bpmn:TextAnnotation"))return{parent:t.findRoot(s)||t.getRootElement(),index:-1};var c=r(a);c.containers&&(s=o(a,s,c.containers));var u=s.children.indexOf(a),l=_d(s.children,function(f){return!a.labelTarget&&f.labelTarget?!1:c.level<r(f).level});return l!==-1&&u!==-1&&u<l&&(l-=1),{index:l,parent:s}}}zp.$inject=["eventBus","canvas"],xe(zp,bc);const xA={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",zp]};function Ea(){}Ea.prototype.get=function(){return this._data},Ea.prototype.set=function(e){this._data=e},Ea.prototype.clear=function(){var e=this._data;return delete this._data,e},Ea.prototype.isEmpty=function(){return!this._data};const _A={clipboard:["type",Ea]};var Ry=1500;function Cy(e,t,n){var i=this,r=n.get("dragging",!1);function o(a){if(!a.hover){var s=a.originalEvent,c=i._findTargetGfx(s),u=c&&e.get(c);c&&u&&(a.stopPropagation(),r.hover({element:u,gfx:c}),r.move(s))}}r&&t.on("drag.start",function(a){t.once("drag.move",Ry,function(s){o(s)})}),(function(){var a,s;t.on("element.hover",function(c){a=c.gfx,s=c.element}),t.on("element.hover",Ry,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=$r(a),c=document.elementFromPoint(s.x,s.y),wA(c)}}Cy.$inject=["elementRegistry","eventBus","injector"];function wA(e){return Or(e,"svg, .djs-element",!0)}const EA={__init__:["hoverFix"],hoverFix:["type",Cy]};function SA(e){return!0}function xc(e){return ur(e)||TP(e)}var Py=500;function Ay(e,t,n){var i=this;function r(T,I,k){if(!s(T,I)){var L,H,ae;k?H=t.getGraphics(k):(L=I.delegateTarget||I.target,L&&(H=L,k=t.get(H))),!(!H||!k)&&(ae=e.fire(T,{element:k,gfx:H,originalEvent:I}),ae===!1&&(I.stopPropagation(),I.preventDefault()))}}var o={};function a(T){return o[T]}function s(T,I){var k=u[T]||ur;return!k(I)}var c={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},u={"element.contextmenu":SA,"element.mousedown":xc,"element.mouseup":xc,"element.click":xc,"element.dblclick":xc};function l(T,I,k){var L=c[T];if(!L)throw new Error("unmapped DOM event name <"+T+">");return r(L,I,k)}var f="svg, .djs-element";function p(T,I,k,L){var H=o[k]=function(ae){r(k,ae)};L&&(u[k]=L),H.$delegate=kn.bind(T,f,I,H)}function d(T,I,k){var L=a(k);L&&kn.unbind(T,I,L.$delegate)}function m(T){$(c,function(I,k){p(T,k,I)})}function h(T){$(c,function(I,k){d(T,k,I)})}e.on("canvas.destroy",function(T){h(T.svg)}),e.on("canvas.init",function(T){m(T.svg)}),e.on(["shape.added","connection.added"],function(T){var I=T.element,k=T.gfx;e.fire("interactionEvents.createHit",{element:I,gfx:k})}),e.on(["shape.changed","connection.changed"],Py,function(T){var I=T.element,k=T.gfx;e.fire("interactionEvents.updateHit",{element:I,gfx:k})}),e.on("interactionEvents.createHit",Py,function(T){var I=T.element,k=T.gfx;i.createDefaultHit(I,k)}),e.on("interactionEvents.updateHit",function(T){var I=T.element,k=T.gfx;i.updateDefaultHit(I,k)});var g=C("djs-hit djs-hit-stroke"),y=C("djs-hit djs-hit-click-stroke"),v=C("djs-hit djs-hit-all"),b=C("djs-hit djs-hit-no-move"),x={all:v,"click-stroke":y,stroke:g,"no-move":b};function C(T,I){return I=V({stroke:"white",strokeWidth:15},I||{}),n.cls(T,["no-fill","no-border"],I)}function P(T,I){var k=x[I];if(!k)throw new Error("invalid hit type <"+I+">");return _e(T,k),T}function D(T,I){je(T,I)}this.removeHits=function(T){var I=ks(".djs-hit",T);$(I,Gt)},this.createDefaultHit=function(T,I){var k=T.waypoints,L=T.isFrame,H;return k?this.createWaypointsHit(I,k):(H=L?"stroke":"all",this.createBoxHit(I,H,{width:T.width,height:T.height}))},this.createWaypointsHit=function(T,I){var k=ra(I);return P(k,"stroke"),D(T,k),k},this.createBoxHit=function(T,I,k){k=V({x:0,y:0},k);var L=Pe("rect");return P(L,I),_e(L,k),D(T,L),L},this.updateDefaultHit=function(T,I){var k=at(".djs-hit",I);if(k)return T.waypoints?Al(k,T.waypoints):_e(k,{width:T.width,height:T.height}),k},this.fire=r,this.triggerMouseEvent=l,this.mouseHandler=a,this.registerEvent=p,this.unregisterEvent=d}Ay.$inject=["eventBus","elementRegistry","styles"];const _c={__init__:["interactionEvents"],interactionEvents:["type",Ay]};function To(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)})}To.$inject=["eventBus","canvas"],To.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()})}},To.prototype.get=function(){return Array.from(this._selectedElements)},To.prototype.isSelected=function(e){return this._selectedElements.has(e)},To.prototype.select=function(e,t){var n=this.get();Le(e)||(e=e?[e]:[]);var i=this._canvas,r=i.getRootElement();e=e.filter(function(o){var a=i.findRoot(o);return r===a}),t?$(e,o=>{this._selectedElements.add(o)}):this._selectedElements=new Set(e),this._eventBus.fire("selection.changed",{oldSelection:n,newSelection:this.get()})};var Ty="hover",My="selected";function ky(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,Ty)}),t.on("element.out",function(r){i(r.element,Ty)}),t.on("selection.changed",function(r){function o(u){i(u,My)}function a(u){n(u,My)}var s=new Set(r.oldSelection),c=new Set(r.newSelection);for(let u of s)c.has(u)||o(u);for(let u of c)s.has(u)||a(u)})}ky.$inject=["canvas","eventBus"];function Oy(e,t,n,i){e.on("create.end",500,function(r){var o=r.context,a=o.canExecute,s=o.elements,c=o.hints||{},u=c.autoSelect;if(a){if(u===!1)return;Le(u)?t.select(u):t.select(s.filter(RA))}}),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=ft(o,function(c){return a.id===c.id});s||t.select(a)}),e.on("element.click",function(r){if(ur(r)){var o=r.element;o===n.getRootElement()&&(o=null);var a=t.isSelected(o),s=t.get().length>1,c=hc(r);if(a&&s)return c?t.deselect(o):t.select(o);a?t.deselect(o):t.select(o,c)}})}Oy.$inject=["eventBus","selection","canvas","elementRegistry"];function RA(e){return!e.hidden}const Jn={__init__:["selectionVisuals","selectionBehavior"],__depends__:[_c],selection:["type",To],selectionVisuals:["type",ky],selectionBehavior:["type",Oy]};var CA=/^djs-cursor-.*$/;function wc(e){var t=_t(document.body);t.removeMatching(CA),e&&t.add("djs-cursor-"+e)}function Dy(){wc(null)}var PA=5e3;function Ly(e,t){t=t||"element.click";function n(){return!1}return e.once(t,PA,n),function(){e.off(t,n)}}var AA=["c","C"],TA=["v","V"],MA=["d","D"],kA=["x","X"],OA=["y","Y"],Iy=["z","Z"];function DA(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey}function Ln(e){return e.altKey?!1:e.ctrlKey||e.metaKey}function Vt(e,t){return e=Le(e)?e:[e],e.indexOf(t.key)!==-1||e.indexOf(t.code)!==-1}function Gp(e){return e.shiftKey}function LA(e){return Ln(e)&&Vt(AA,e)}function IA(e){return Ln(e)&&Vt(TA,e)}function BA(e){return Ln(e)&&Vt(MA,e)}function NA(e){return Ln(e)&&Vt(kA,e)}function $A(e){return Ln(e)&&!Gp(e)&&Vt(Iy,e)}function FA(e){return Ln(e)&&(Vt(OA,e)||Vt(Iy,e)&&Gp(e))}var Mo=Math.round,By="djs-drag-active";function jr(e){e.preventDefault()}function jA(e){return typeof TouchEvent<"u"&&e instanceof TouchEvent}function HA(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Ny(e,t,n,i){var r={threshold:5,trapClick:!0},o;function a(b){var x=t.viewbox(),C=t._container.getBoundingClientRect();return{x:x.x+(b.x-C.left)/x.scale,y:x.y+(b.y-C.top)/x.scale}}function s(b,x){x=x||o;var C=e.createEvent(V({},x.payload,x.data,{isTouch:x.isTouch}));return e.fire("drag."+b,C)===!1?!1:e.fire(x.prefix+"."+b,C)}function c(b){var x=b.filter(function(C){return i.get(C.id)});x.length&&n.select(x)}function u(b,x){var C=o.payload,P=o.displacement,D=o.globalStart,T=$r(b),I=ui(T,D),k=o.localStart,L=a(T),H=ui(L,k);if(!o.active&&(x||HA(I)>o.threshold)){if(V(C,{x:Mo(k.x+P.x),y:Mo(k.y+P.y),dx:0,dy:0},{originalEvent:b}),s("start")===!1)return g();o.active=!0,o.keepSelection||(C.previousSelection=n.get(),n.select(null)),o.cursor&&wc(o.cursor),t.addMarker(t.getRootElement(),By)}wp(b),o.active&&(V(C,{x:Mo(L.x+P.x),y:Mo(L.y+P.y),dx:Mo(H.x),dy:Mo(H.y)},{originalEvent:b}),s("move"))}function l(b){var x,C=!0;o.active&&(b&&(o.payload.originalEvent=b,wp(b)),C=s("end")),C===!1&&s("rejected"),x=y(C!==!0),s("ended",x)}function f(b){Vt("Escape",b)&&(jr(b),g())}function p(b){var x;o.active&&(x=Ly(e),setTimeout(x,400),jr(b)),l(b)}function d(b){u(b)}function m(b){var x=o.payload;x.hoverGfx=b.gfx,x.hover=b.element,s("hover")}function h(b){s("out");var x=o.payload;x.hoverGfx=null,x.hover=null}function g(b){var x;if(o){var C=o.active;C&&s("cancel"),x=y(b),C&&s("canceled",x)}}function y(b){var x,C;s("cleanup"),Dy(),o.trapClick?C=p:C=l,$e.unbind(document,"mousemove",u),$e.unbind(document,"dragstart",jr),$e.unbind(document,"selectstart",jr),$e.unbind(document,"mousedown",C,!0),$e.unbind(document,"mouseup",C,!0),$e.unbind(document,"keyup",f),$e.unbind(document,"touchstart",d,!0),$e.unbind(document,"touchcancel",g,!0),$e.unbind(document,"touchmove",u,!0),$e.unbind(document,"touchend",l,!0),e.off("element.hover",m),e.off("element.out",h),t.removeMarker(t.getRootElement(),By);var P=o.payload.previousSelection;return b!==!1&&P&&!n.get().length&&c(P),x=o,o=null,x}function v(b,x,C,P){o&&g(!1),typeof x=="string"&&(P=C,C=x,x=null),P=V({},r,P||{});var D=P.data||{},T,I,k,L,H;if(P.trapClick?L=p:L=l,b?(T=Po(b)||b,I=$r(b),wp(b),T.type==="dragstart"&&jr(T)):(T=null,I={x:0,y:0}),k=a(I),x||(x=k),H=jA(T),o=V({prefix:C,data:D,payload:{},globalStart:I,displacement:ui(x,k),localStart:k,isTouch:H},P),P.manual||(H?($e.bind(document,"touchstart",d,!0),$e.bind(document,"touchcancel",g,!0),$e.bind(document,"touchmove",u,!0),$e.bind(document,"touchend",l,!0)):($e.bind(document,"mousemove",u),$e.bind(document,"dragstart",jr),$e.bind(document,"selectstart",jr),$e.bind(document,"mousedown",L,!0),$e.bind(document,"mouseup",L,!0)),$e.bind(document,"keyup",f),e.on("element.hover",m),e.on("element.out",h)),s("init")===!1)return g(),!1;P.autoActivate&&u(b,!0)}e.on("diagram.destroy",g),this.init=v,this.move=u,this.hover=m,this.out=h,this.end=l,this.cancel=g,this.context=function(){return o},this.setOptions=function(b){V(r,b)}}Ny.$inject=["eventBus","canvas","selection","elementRegistry"];const Fi={__depends__:[EA,Jn],dragging:["type",Ny]};function ko(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(Math.random()*1e9)+"-"}ko.prototype.next=function(){return this._prefix+ ++this._counter};const zA=new ko("ps");var GA=["marker-start","marker-mid","marker-end"],VA=["circle","ellipse","line","path","polygon","polyline","path","rect"];function lr(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}lr.$inject=["elementRegistry","eventBus","canvas","styles"],lr.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")},lr.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},lr.prototype.addDragger=function(e,t,n,i="djs-dragger"){n=n||this.getGfx(e);var r=Xh(n);return this._cloneMarkers(Ir(r),i),_e(r,this._styles.cls(i,[])),je(t,r),_e(r,"data-preview-support-element-id",e.id),r},lr.prototype.addFrame=function(e,t){var n=Pe("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return je(t,n),_e(n,"data-preview-support-element-id",e.id),n},lr.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach(r=>{i._cloneMarkers(r,t,n)}),qA(e)&&GA.forEach(function(r){if(_e(e,r)){var o=WA(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}})},lr.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,zA.next()].join("-"),a=at("marker#"+n.id,e);e=e||this._canvas._svg;var s=a||Xh(n);s.id=o,Xe(s).add(r);var c=at(":scope > defs",e);c||(c=Pe("defs"),je(e,c)),je(c,s);var u=YA(s.id);_e(t,i,u)};function WA(e,t,n){var i=UA(_e(e,t));return at("marker#"+i,n||document)}function UA(e){return e.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]}function YA(e){return"url(#"+e+")"}function qA(e){return VA.indexOf(e.nodeName)!==-1}const Oo={__init__:["previewSupport"],previewSupport:["type",lr]};var KA="drop-ok",$y="drop-not-ok",Fy="attach-ok",jy="new-parent",Hy="create",XA=2e3;function zy(e,t,n,i,r){function o(c,u,l,f,p){if(!u)return!1;c=Ue(c,function(v){var b=v.labelTarget;return!v.parent&&!(Ge(v)&&c.indexOf(b)!==-1)});var d=ft(c,function(v){return!ct(v)}),m=!1,h=!1,g=!1;Vy(c)&&(m=r.allowed("shape.attach",{position:l,shape:d,target:u})),m||(Vy(c)?g=r.allowed("shape.create",{position:l,shape:d,source:f,target:u}):g=r.allowed("elements.create",{elements:c,position:l,target:u}));var y=p.connectionTarget;return g||m?(d&&f&&(h=r.allowed("connection.create",{source:y===f?d:f,target:y===f?f:d,hints:{targetParent:u,targetAttach:m}})),{attach:m,connect:h}):g===null||m===null?null:!1}function a(c,u){[Fy,KA,$y,jy].forEach(function(l){l===u?e.addMarker(c,l):e.removeMarker(c,l)})}n.on(["create.move","create.hover"],function(c){var u=c.context,l=u.elements,f=c.hover,p=u.source,d=u.hints||{};if(!f){u.canExecute=!1,u.target=null;return}Gy(c);var m={x:c.x,y:c.y},h=u.canExecute=f&&o(l,f,m,p,d);f&&h!==null&&(u.target=f,h&&h.attach?a(f,Fy):a(f,h?jy:$y))}),n.on(["create.end","create.out","create.cleanup"],function(c){var u=c.hover;u&&a(u,null)}),n.on("create.end",function(c){var u=c.context,l=u.source,f=u.shape,p=u.elements,d=u.target,m=u.canExecute,h=m&&m.attach,g=m&&m.connect,y=u.hints||{};if(m===!1||!d)return!1;Gy(c);var v={x:c.x,y:c.y};g?f=i.appendShape(l,f,v,d,{attach:h,connection:g===!0?{}:g,connectionTarget:y.connectionTarget}):(p=i.createElements(p,v,d,V({},y,{attach:h})),f=ft(p,function(b){return!ct(b)})),V(u,{elements:p,shape:f}),V(c,{elements:p,shape:f})});function s(){var c=t.context();c&&c.prefix===Hy&&t.cancel()}n.on("create.init",function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],XA,function(){n.off("elements.changed",s)})}),this.start=function(c,u,l){Le(u)||(u=[u]);var f=ft(u,function(m){return!ct(m)});if(f){l=V({elements:u,hints:{},shape:f},l||{}),$(u,function(m){Ne(m.x)||(m.x=0),Ne(m.y)||(m.y=0)});var p=Ue(u,function(m){return!m.hidden}),d=It(p);$(u,function(m){ct(m)&&(m.waypoints=ln(m.waypoints,function(h){return{x:h.x-d.x-d.width/2,y:h.y-d.y-d.height/2}})),V(m,{x:m.x-d.x-d.width/2,y:m.y-d.y-d.height/2})}),t.init(c,Hy,{cursor:"grabbing",autoActivate:!0,data:{shape:f,elements:u,context:l}})}}}zy.$inject=["canvas","dragging","eventBus","modeling","rules"];function Gy(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 Vy(e){return e&&e.length===1&&!ct(e[0])}var ZA=750;function Wy(e,t,n,i,r){function o(a){var s=Pe("g");_e(s,r.cls("djs-drag-group",["no-events"]));var c=Pe("g");return a.forEach(function(u){var l;u.hidden||(u.waypoints?(l=n._createContainer("connection",c),n.drawConnection(Ir(l),u)):(l=n._createContainer("shape",c),n.drawShape(Ir(l),u),rn(l,u.x,u.y)),i.addDragger(u,s,l))}),s}t.on("create.move",ZA,function(a){var s=a.hover,c=a.context,u=c.elements,l=c.dragGroup;l||(l=c.dragGroup=o(u));var f;s?(l.parentNode||(f=e.getActiveLayer(),je(f,l)),rn(l,a.x,a.y)):Gt(l)}),t.on("create.cleanup",function(a){var s=a.context,c=s.dragGroup;c&&Gt(c)})}Wy.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];const Ec={__depends__:[Fi,Oo,wi,Jn],__init__:["create","createPreview"],create:["type",zy],createPreview:["type",Wy]};function Vp(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)})}Vp.$inject=["eventBus"],Vp.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||QA(0,0)};function QA(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 Sa={__init__:["mouse"],mouse:["type",Vp]};var Uy=2e3;function In(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(c){var u=c.descriptor,l=c.element,f=c.elementsSet;u.priority=1,u.id=l.id,f.has(l.parent)&&(u.parent=l.parent.id),JA(l)&&(u.priority=2,u.host=l.host.id),ct(l)&&(u.priority=3,u.source=l.source.id,u.target=l.target.id,u.waypoints=eT(l)),Ge(l)&&(u.priority=4,u.labelTarget=l.labelTarget.id),$(["x","y","width","height"],function(p){Ne(l[p])&&(u[p]=l[p])}),u.hidden=l.hidden,u.collapsed=l.collapsed}),r.on("copyPaste.elementsCopied",Uy,function(c){var u;((u=c.hints)==null?void 0:u.clip)!==!1&&n.set(c.tree)}),r.on("copyPaste.pasteElements",Uy,function(c){c.tree||(c.tree=n.get())}),r.on("copyPaste.pasteElements",function(c){var u=c.hints;V(u,{createElementsBehavior:!1})})}In.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],In.prototype.copy=function(e,t={}){var n,i;return Le(e)||(e=e?[e]:[]),n=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}),n===!1?i={}:i=this.createTree(Le(n)?n:e),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:i,hints:t}),i},In.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})}}},In.prototype.duplicate=function(e,t={}){var n=this.copy(e,{clip:!1});return this.paste({...t,tree:n})},In.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},In.prototype._getElementIdsFromTree=function(e){var t={};return $(e,function(n){$(n,function(i){i.id&&(t[i.id]=!0)})}),t},In.prototype._paste=function(e,t,n,i){$(e,function(o){Ne(o.x)||(o.x=0),Ne(o.y)||(o.y=0)});var r=It(e);return $(e,function(o){ct(o)&&(o.waypoints=ln(o.waypoints,function(a){return{x:a.x-r.x-r.width/2,y:a.y-r.y-r.height/2}})),V(o,{x:o.x-r.x-r.width/2,y:o.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,V({},i))},In.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return $(e,function(o,a){o=pi(o,"priority"),$(o,function(s){var c=V({},fi(s,["priority"]));i[s.parent]?c.parent=i[s.parent]:delete c.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:c});var u;if(ct(c)){c.source=i[s.source],c.target=i[s.target],u=i[s.id]=t.createConnection(c),r.push(u);return}if(Ge(c)){c.labelTarget=i[c.labelTarget],u=i[s.id]=t.createLabel(c),r.push(u);return}c.host&&(c.host=i[c.host]),u=i[s.id]=t.createShape(c),r.push(u)})}),r},In.prototype.createConnection=function(e){var t=this._elementFactory.createConnection(fi(e,["id"]));return t},In.prototype.createLabel=function(e){var t=this._elementFactory.createLabel(fi(e,["id"]));return t},In.prototype.createShape=function(e){var t=this._elementFactory.createShape(fi(e,["id"]));return t},In.prototype.hasRelations=function(e,t,n){return n||(n=new Set(t)),!(ct(e)&&(!n.has(e.source)||!n.has(e.target))||Ge(e)&&!n.has(e.labelTarget))},In.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[],o=new Map,a=Is(e);function s(f,p){return t.allowed("element.copy",{element:f,elements:p})}function c(f,p){var d=o.get(f);if(!d){var m={element:f,depth:p};r.push(m),o.set(f,m);return}if(d.depth<p){r=u(d,r);var h={element:d.element,depth:p};r.push(h),o.set(f,h)}}function u(f,p){var d=p.indexOf(f);return d!==-1&&p.splice(d,1),p}Lr(a,function(f,p,d){if(Ge(f))return;$(f.labels,function(g){c(g,d)});function m(g){g&&g.length&&$(g,function(y){$(y.labels,function(v){c(v,d)}),c(y,d)})}$([f.attachers,f.incoming,f.outgoing],m),c(f,d);var h=[];return f.children&&(h=f.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:f,children:h}),h}),e=ln(r,function(f){return f.element});var l=new Set(e);return r=ln(r,function(f){return f.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:f.descriptor,element:f.element,elements:e,elementsSet:l}),f}),r=pi(r,function(f){return f.descriptor.priority}),e=ln(r,function(f){return f.element}),$(r,function(f){var p=f.depth;if(!n.hasRelations(f.element,e,l)){qy(f.element,e),l.delete(f.element);return}if(!s(f.element,e)){qy(f.element,e),l.delete(f.element);return}i[p]||(i[p]=[]),i[p].push(f.descriptor)}),i};function JA(e){return!!e.host}function eT(e){return ln(e.waypoints,function(t){return t=Yy(t),t.original&&(t.original=Yy(t.original)),t})}function Yy(e){return V({},e)}function qy(e,t){var n=t.indexOf(e);return n===-1?t:t.splice(n,1)}const tT={__depends__:[_A,Ec,Sa,wi],__init__:["copyPaste"],copyPaste:["type",In]};function Wp(e,t,n){Le(n)||(n=[n]),$(n,function(i){Pr(e[i])||(t[i]=e[i])})}var Up=750;function Ky(e,t,n){function i(c,u){var l=e.create(c.$type);return n.copyElement(c,l,null,u)}t.on("copyPaste.copyElement",Up,function(c){var u=c.descriptor,l=c.element,f=ie(l);if(Ge(l))return u;var p=u.businessObject=i(f,!0),d=u.di=i(Ze(l),!0);d.bpmnElement=p,Wp(p,u,"name"),Wp(d,u,"isExpanded"),f.default&&(u.default=f.default.id)});var r="-bpmn-js-refs";function o(c){return c[r]=c[r]||{}}function a(c,u){c[r]=u}function s(c,u,l){var f=ie(c);return c.default&&(l[c.default]={element:f,property:"default"}),c.host&&(ie(c).attachedToRef=ie(u[c.host])),fi(l,Tn(l,function(p,d,m){var h=d.element,g=d.property;return m===c.id&&(h.set(g,f),p.push(c.id)),p},[]))}t.on("copyPaste.pasteElement",function(c){var u=c.cache,l=c.descriptor,f=l.businessObject,p=l.di;if(Ge(l)){l.businessObject=ie(u[l.labelTarget]),l.di=Ze(u[l.labelTarget]);return}f=l.businessObject=i(f),p=l.di=i(p),p.bpmnElement=f,Wp(l,f,["isExpanded","name"]),l.type=f.$type}),t.on("copyPaste.copyElement",Up,function(c){var u=c.descriptor,l=c.element;if(E(l,"bpmn:Participant")){var f=ie(l);f.processRef&&(u.processRef=i(f.processRef,!0))}}),t.on("copyPaste.pasteElement",function(c){var u=c.descriptor,l=u.processRef;l&&(u.processRef=i(l))}),t.on("copyPaste.createTree",function(c){var u=c.element,l=c.children;E(u,"bpmn:SubProcess")&&$(pa(l),f=>{l.push(f.annotation)})}),t.on("copyPaste.pasteElement",Up,function(c){var u=c.cache,l=c.descriptor;a(u,s(l,u,o(u)))})}Ky.$inject=["bpmnFactory","eventBus","moddleCopy"];const nT=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"],iT=["errorRef","escalationRef","messageRef","signalRef","dataObjectRef"];function Ra(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=Yt(r)&&r.$descriptor;if(a&&iT.includes(a))return o;if(a&&nT.includes(a)||a&&s&&!ft(s.properties,io({name:a})))return!1}),e.on("moddleCopy.canSetCopiedProperty",i=>{const{property:r}=i;if(E(r,"bpmn:ExtensionElements")&&(!r.values||!r.values.length))return!1})}Ra.$inject=["eventBus","bpmnFactory","moddle"],Ra.prototype.copyElement=function(e,t,n,i=!1){n&&!Le(n)&&(n=[n]),n=n||Yp(e.$descriptor);const r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return r===!1||(Le(r)&&(n=r),$(n,o=>{let a;An(e,o)&&(a=e.get(o));const s=this.copyProperty(a,t,o,i);!Ht(s)||this._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:o})===!1||t.set(o,s)})),t},Ra.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 Yt(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;const o=this._moddle.getPropertyDescriptor(t,n);if(!o.isReference)return o.isId?e&&this._copyId(e,t,i):Le(e)?Tn(e,(a,s)=>{const c=this.copyProperty(s,t,n,i);return c?a.concat(c):a},[]):Yt(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},Ra.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 Yp(e,t){return Tn(e.properties,(n,i)=>t&&i.default?n:n.concat(i.name),[])}const Xy={__depends__:[tT],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Ky],moddleCopy:["type",Ra]};var Zy=Math.round;function qp(e,t){this._modeling=e,this._eventBus=t}qp.$inject=["modeling","eventBus"],qp.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,a=t.height||e.height,s=t.x||e.x,c=t.y||e.y,u=Zy(s+o/2),l=Zy(c+a/2),f=i.replaceShape(e,V({},t,{x:u,y:l,width:o,height:a}),n);return r.fire("replace.end",{element:e,newElement:f,hints:n}),f};function Qy(e,t){t.on("replace.end",500,function(n){const{newElement:i,hints:r={}}=n;r.select!==!1&&e.select(i)})}Qy.$inject=["selection","eventBus"];const rT={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Qy],replace:["type",qp]};function oT(e,t,n){Le(n)||(n=[n]),$(n,function(i){Pr(e[i])||(t[i]=e[i])})}var aT=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function sT(e,t){var n=e&&An(e,"collapsed")?e.collapsed:!Ke(e),i;return t&&(An(t,"collapsed")||An(t,"isExpanded"))?i=An(t,"collapsed")?t.collapsed:!t.isExpanded:i=n,n!==i}function Jy(e,t,n,i,r,o){function a(s,c,u){u=u||{};var l=c.type,f=s.businessObject;if(Sc(f)&&(l==="bpmn:SubProcess"||l==="bpmn:AdHocSubProcess")&&sT(s,c))return i.toggleCollapse(s),s;var p=e.create(l),d={type:l,businessObject:p};d.di={},l==="bpmn:ExclusiveGateway"&&(d.di.isMarkerVisible=!0),oT(s.di,d.di,["fill","stroke","background-color","border-color","color"]);var m=Yp(f.$descriptor),h=Yp(p.$descriptor,!0),g=cT(m,h);V(p,si(c,aT));var y=Ue(g,function(x){return x==="eventDefinitions"?ev(s,c.eventDefinitionType):x==="loopCharacteristics"?!mn(p):An(p,x)||x==="processRef"&&c.isExpanded===!1||x==="triggeredByEvent"?!1:x==="isForCompensation"?!mn(p):!0});if(p=n.copyElement(f,p,y),c.eventDefinitionType&&(ev(p,c.eventDefinitionType)||(d.eventDefinitionType=c.eventDefinitionType,d.eventDefinitionAttrs=c.eventDefinitionAttrs)),E(f,"bpmn:Activity")){if(Sc(f))d.isExpanded=Ke(s);else if(c&&An(c,"isExpanded")){d.isExpanded=c.isExpanded;var v=t.getDefaultSize(p,{isExpanded:d.isExpanded});d.width=v.width,d.height=v.height,d.x=s.x-(d.width-s.width)/2,d.y=s.y-(d.height-s.height)/2}Ke(s)&&!E(f,"bpmn:Task")&&d.isExpanded&&(d.width=s.width,d.height=s.height)}if(Sc(f)&&!Sc(p)&&(u.moveChildren=!1),E(f,"bpmn:Participant")){c.isExpanded===!0?p.processRef=e.create("bpmn:Process"):u.moveChildren=!1;var b=Xt(s);Ze(s).isHorizontal||(Ze(d).isHorizontal=b),d.width=b?s.width:t.getDefaultSize(d).width,d.height=b?t.getDefaultSize(d).height:s.height}return o.allowed("shape.resize",{shape:p})||(d.height=t.getDefaultSize(d).height,d.width=t.getDefaultSize(d).width),p.name=f.name,Ve(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Ve(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=f.default),c.host&&!E(f,"bpmn:BoundaryEvent")&&E(p,"bpmn:BoundaryEvent")&&(d.host=c.host),(d.type==="bpmn:DataStoreReference"||d.type==="bpmn:DataObjectReference")&&(d.x=s.x+(s.width-d.width)/2),r.replaceElement(s,d,{...u,targetElement:c})}this.replaceElement=a}Jy.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];function Sc(e){return E(e,"bpmn:SubProcess")}function ev(e,t){var n=ie(e);return t&&n.get("eventDefinitions").some(function(i){return E(i,t)})}function cT(e,t){return e.filter(function(n){return t.includes(n)})}const tv={__depends__:[Xy,rT,Jn],bpmnReplace:["type",Jy]};var uT=250;function Hr(e){this._eventBus=e,this._tools=[],this._active=null}Hr.$inject=["eventBus"],Hr.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)},Hr.prototype.isActive=function(e){return e&&this._active===e},Hr.prototype.length=function(e){return this._tools.length},Hr.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Hr.prototype.bindEvents=function(e,t){var n=this._eventBus,i=[];n.on(t.tool+".init",function(r){var o=r.context;if(!o.reactivate&&this.isActive(e)){this.setActive(null);return}this.setActive(e)},this),$(t,function(r){i.push(r+".ended"),i.push(r+".canceled")}),n.on(i,uT,function(r){this._active&&(lT(r)||this.setActive(null))},this)};function lT(e){var t=e.originalEvent&&e.originalEvent.target;return t&&Or(t,'.group[data-group="tools"]')}const Rc={__depends__:[Fi],__init__:["toolManager"],toolManager:["type",Hr]};function pT(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 fT(e,t){var n=[],i=new Set(e);$(t,function(o){i.add(o)});var r=new Set;return i.forEach(function(o){var a=o.incoming,s=o.outgoing;$(a.concat(s),function(c){var u=c.source,l=c.target;(i.has(u)||i.has(l))&&(r.has(c)||(r.add(c),n.push(c)))})}),n}function dT(e,t,n){var i=e.x,r=e.y,o=e.width,a=e.height,s=n.x,c=n.y;switch(t){case"n":return{x:i,y:r+c,width:o,height:a-c};case"s":return{x:i,y:r,width:o,height:a+c};case"w":return{x:i+s,y:r,width:o-s,height:a};case"e":return{x:i,y:r,width:o+s,height:a};default:throw new Error("unknown direction: "+t)}}var Kp=Math.abs,hT=Math.round,ji={x:"width",y:"height"},nv="crosshair",pr={n:"top",w:"left",s:"bottom",e:"right"},mT=1500,Cc={n:"s",w:"e",s:"n",e:"w"},Pc=20;function ei(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",mT,function(c){var u=c.context,l=u.initialized;l||(l=u.initialized=s.init(c,u)),l&&rv(c)}),n.on("spaceTool.end",function(c){var u=c.context,l=u.axis,f=u.direction,p=u.movingShapes,d=u.resizingShapes,m=u.start;if(u.initialized){rv(c);var h={x:0,y:0};h[l]=hT(c["d"+l]),s.makeSpace(p,d,h,f,m),n.once("spaceTool.ended",function(g){s.activateSelection(g.originalEvent,!0,!0)})}})}ei.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],ei.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:nv,data:{context:{reactivate:n}},trapClick:!1})},ei.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:nv,data:{context:{}}})},ei.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},ei.prototype.init=function(e,t){var n=Kp(e.dx)>Kp(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Kp(i)<5)return!1;i<0&&(i*=-1),_a(e)&&(i*=-1);var o=pT(n,i),a=this._canvas.getRootElement();!hc(e)&&e.hover&&(a=e.hover);var s=[...oa(a),...a.attachers||[]],c=this.calculateAdjustments(s,n,i,r),u=this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:c.resizingShapes,start:r}),l=gT(c,n,o,r,u);return V(t,c,{axis:n,direction:o,spaceToolConstraints:l,start:r}),wc("resize-"+(n==="x"?"ew":"ns")),!0},ei.prototype.calculateAdjustments=function(e,t,n,i){var r=this._rules,o=[],a=[],s=new Set,c=new Set,u=[],l=[];function f(d){s.has(d)||(s.add(d),o.push(d));var m=d.label;m&&!s.has(m)&&(s.add(m),o.push(m))}function p(d){c.has(d)||(c.add(d),a.push(d))}return $(e,function(d){if(!(!d.parent||Ge(d))){if(ct(d)){l.push(d);return}var m=d[t],h=m+d[ji[t]];if(yT(d)&&(n>0&&Ie(d)[t]>i||n<0&&Ie(d)[t]<i)){u.push(d);return}if(n>0&&m>i||n<0&&h<i){f(d);return}if(m<i&&h>i&&r.allowed("shape.resize",{shape:d})){p(d);return}}}),$(o,function(d){var m=d.attachers;m&&$(m,function(h){f(h)})}),$(u,function(d){var m=d.host;(s.has(m)||c.has(m))&&f(d)}),$(l,function(d){var m=d.source,h=d.target,g=d.label;(s.has(m)||c.has(m))&&(s.has(h)||c.has(h))&&g&&f(g)}),{movingShapes:o,resizingShapes:a}},ei.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},ei.prototype.isActive=function(){var e=this._dragging.context();return e?/^spaceTool/.test(e.prefix):!1};function iv(e){return{top:e.top-Pc,right:e.right+Pc,bottom:e.bottom+Pc,left:e.left-Pc}}function rv(e){var t=e.context,n=t.spaceToolConstraints;if(n){var i,r;Ne(n.left)&&(i=Math.max(e.x,n.left),e.dx=e.dx+i-e.x,e.x=i),Ne(n.right)&&(i=Math.min(e.x,n.right),e.dx=e.dx+i-e.x,e.x=i),Ne(n.top)&&(r=Math.max(e.y,n.top),e.dy=e.dy+r-e.y,e.y=r),Ne(n.bottom)&&(r=Math.min(e.y,n.bottom),e.dy=e.dy+r-e.y,e.y=r)}}function gT(e,t,n,i,r){var o=e.movingShapes,a=e.resizingShapes;if(a.length){var s={},c,u,l=new Set(o),f=new Set(a);return $(a,function(p){var d=p.attachers,m=p.children,h=Ae(p),g=Ue(m,function(H){return!ct(H)&&!Ge(H)&&!l.has(H)&&!f.has(H)}),y=Ue(m,function(H){return!ct(H)&&!Ge(H)&&l.has(H)}),v,b,x,C=[],P=[],D,T,I,k;g.length&&(b=iv(Ae(It(g))),v=i-h[pr[n]]+b[pr[n]],n==="n"?s.bottom=u=Ne(u)?Math.min(u,v):v:n==="w"?s.right=u=Ne(u)?Math.min(u,v):v:n==="s"?s.top=c=Ne(c)?Math.max(c,v):v:n==="e"&&(s.left=c=Ne(c)?Math.max(c,v):v)),y.length&&(x=iv(Ae(It(y))),v=i-x[pr[Cc[n]]]+h[pr[Cc[n]]],n==="n"?s.bottom=u=Ne(u)?Math.min(u,v):v:n==="w"?s.right=u=Ne(u)?Math.min(u,v):v:n==="s"?s.top=c=Ne(c)?Math.max(c,v):v:n==="e"&&(s.left=c=Ne(c)?Math.max(c,v):v)),d&&d.length&&(d.forEach(function(H){l.has(H)?C.push(H):P.push(H)}),C.length&&(D=Ae(It(C.map(Ie))),T=h[pr[Cc[n]]]-(D[pr[Cc[n]]]-i)),P.length&&(I=Ae(It(P.map(Ie))),k=I[pr[n]]-(h[pr[n]]-i)),n==="n"?(v=Math.min(T||1/0,k||1/0),s.bottom=u=Ne(u)?Math.min(u,v):v):n==="w"?(v=Math.min(T||1/0,k||1/0),s.right=u=Ne(u)?Math.min(u,v):v):n==="s"?(v=Math.max(T||-1/0,k||-1/0),s.top=c=Ne(c)?Math.max(c,v):v):n==="e"&&(v=Math.max(T||-1/0,k||-1/0),s.left=c=Ne(c)?Math.max(c,v):v));var L=r&&r[p.id];L&&(n==="n"?(v=i+p[ji[t]]-L[ji[t]],s.bottom=u=Ne(u)?Math.min(u,v):v):n==="w"?(v=i+p[ji[t]]-L[ji[t]],s.right=u=Ne(u)?Math.min(u,v):v):n==="s"?(v=i-p[ji[t]]+L[ji[t]],s.top=c=Ne(c)?Math.max(c,v):v):n==="e"&&(v=i-p[ji[t]]+L[ji[t]],s.left=c=Ne(c)?Math.max(c,v):v))}),s}}function yT(e){return!!e.host}var Xp="djs-dragging",ov="djs-resizing",vT=250,Ac=Math.max;function av(e,t,n,i,r){function o(a,s){$(a,function(c){r.addDragger(c,s),n.addMarker(c,Xp)})}e.on("spaceTool.selection.start",function(a){var s=n.getLayer("space"),c=a.context,u={x:"M 0,-10000 L 0,10000",y:"M -10000,0 L 10000,0"},l=Pe("g");_e(l,i.cls("djs-crosshair-group",["no-events"])),je(s,l);var f=Pe("path");_e(f,"d",u.x),Xe(f).add("djs-crosshair"),je(l,f);var p=Pe("path");_e(p,"d",u.y),Xe(p).add("djs-crosshair"),je(l,p),c.crosshairGroup=l}),e.on("spaceTool.selection.move",function(a){var s=a.context.crosshairGroup;rn(s,a.x,a.y)}),e.on("spaceTool.selection.cleanup",function(a){var s=a.context,c=s.crosshairGroup;c&&Gt(c)}),e.on("spaceTool.move",vT,function(a){var s=a.context,c=s.line,u=s.axis,l=s.movingShapes,f=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var p=n.getLayer("space");c=Pe("path"),_e(c,"d","M0,0 L0,0"),Xe(c).add("djs-crosshair"),je(p,c),s.line=c;var d=Pe("g");_e(d,i.cls("djs-drag-group",["no-events"])),je(n.getActiveLayer(),d),o(l,d);var m=new Set(l);$(f,function(P){m.add(P)});var h=new Set,g=s.movingConnections=[];m.forEach(function(P){$(P.outgoing,function(D){h.has(D)||!ct(D)||!m.has(D.target)||(h.add(D),g.push(D))})}),o(g,d),s.dragGroup=d}if(!s.frameGroup){var y=Pe("g");_e(y,i.cls("djs-frame-group",["no-events"])),je(n.getActiveLayer(),y);var v=[];$(f,function(P){var D=r.addFrame(P,y),T=D.getBBox();v.push({element:D,initialBounds:T}),n.addMarker(P,ov)}),s.frameGroup=y,s.frames=v}var b={x:"M"+a.x+", -10000 L"+a.x+", 10000",y:"M -10000, "+a.y+" L 10000, "+a.y};_e(c,{d:b[u]});var x={x:"y",y:"x"},C={x:a.dx,y:a.dy};C[x[s.axis]]=0,rn(s.dragGroup,C.x,C.y),$(s.frames,function(P){var D=P.element,T=P.initialBounds,I,k;s.direction==="e"?_e(D,{width:Ac(T.width+C.x,5)}):(I=Ac(T.width-C.x,5),_e(D,{width:I,x:T.x+T.width-I})),s.direction==="s"?_e(D,{height:Ac(T.height+C.y,5)}):(k=Ac(T.height-C.y,5),_e(D,{height:k,y:T.y+T.height-k}))})}}),e.on("spaceTool.cleanup",function(a){var s=a.context,c=s.movingShapes,u=s.movingConnections,l=s.resizingShapes,f=s.line,p=s.dragGroup,d=s.frameGroup;$(c,function(m){n.removeMarker(m,Xp)}),$(u,function(m){n.removeMarker(m,Xp)}),p&&(Gt(f),Gt(p)),$(l,function(m){n.removeMarker(m,ov)}),d&&Gt(d)})}av.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];const bT={__init__:["spaceToolPreview"],__depends__:[Fi,wi,Rc,Oo,Sa],spaceTool:["type",ei],spaceToolPreview:["type",av]};function Tc(e,t){e.invoke(ei,this),this._canvas=t}Tc.$inject=["injector","canvas"],xe(Tc,ei),Tc.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],a=[];o&&(a=to(ho(r.children.filter(u=>E(u,"bpmn:Artifact")),It(o))));const s=[...e,...a];var c=ei.prototype.calculateAdjustments.call(this,s,t,n,i);return c.resizingShapes=c.resizingShapes.filter(function(u){return!(E(u,"bpmn:TextAnnotation")||xT(u)&&(t==="y"&&Xt(u)||t==="x"&&!Xt(u)))}),c};function xT(e){return E(e,"bpmn:Participant")&&!ie(e).processRef}const sv={__depends__:[bT],spaceTool:["type",Tc]};function Et(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)}Et.$inject=["eventBus","injector"],Et.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()},Et.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},Et.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,e!==!1&&this._fire("changed",{trigger:"clear"})},Et.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()}},Et.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()}},Et.prototype.register=function(e,t){this._setHandler(e,t)},Et.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)},Et.prototype.canUndo=function(){return!!this._getUndoAction()},Et.prototype.canRedo=function(){return!!this._getRedoAction()},Et.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Et.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Et.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)})},Et.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},Et.prototype._createId=function(){return this._uid++},Et.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Et.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()},Et.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)},Et.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:wd("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},Et.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=Le(e)?e:[e],t.dirty=t.dirty.concat(e))},Et.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Et.prototype._revertedAction=function(e){this._stackIdx--},Et.prototype._getHandler=function(e){return this._handlerMap[e]},Et.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 _T={commandStack:["type",Et]};function fr(e,t){if(typeof t!="function")throw new Error("removeFn iterator must be a function");if(!e)return[];for(var n;n=e[0];)t(n);return e}var wT=250,cv=1400;function Zp(e,t,n){te.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",cv,function(r){var o=r.context,a=o.shapes,s=o.validatedShapes;o.shapes=uv(a),o.validatedShapes=uv(s)}),i&&t.on("shape.move.start",wT,function(r){var o=r.context,a=new Set(o.shapes),s=new Set;for(const c of a)for(const u of c.labels)!u.hidden&&!a.has(u)&&s.add(u),c.labelTarget&&s.add(c);for(const c of s)i.makeDraggable(o,c,!0)}),this.preExecuted("elements.move",cv,function(r){var o=r.context,a=o.closure,s=a.enclosedElements,c=[];$(s,function(u){$(u.labels,function(l){s[l.id]||c.push(l)})}),a.addAll(c)}),this.preExecute(["connection.delete","shape.delete"],function(r){var o=r.context,a=o.connection||o.shape;fr(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=Ml(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&&(Mt(s.labels,a,c),a.labelTarget=s)})}xe(Zp,te),Zp.$inject=["injector","eventBus","modeling"];function uv(e){var t=new Set(e);return Ue(e,function(n){return!t.has(n.labelTarget)})}const ET={__init__:["labelSupport"],labelSupport:["type",Zp]};var ST=251,lv=1401,pv="attach-ok";function Qp(e,t,n,i,r){te.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",lv,function(a){var s=a.context,c=s.shapes,u=s.validatedShapes;s.shapes=RT(c),s.validatedShapes=CT(u)}),o&&t.on("shape.move.start",ST,function(a){var s=a.context,c=s.shapes,u=Jp(c);$(u,function(l){o.makeDraggable(s,l,!0),$(l.labels,function(f){o.makeDraggable(s,f,!0)})})}),o&&t.on("shape.move.start",function(a){var s=a.context,c=s.shapes;if(c.length===1){var u=c[0],l=u.host;l&&(n.addMarker(l,pv),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(l,pv)}))}}),this.preExecuted("elements.move",lv,function(a){var s=a.context,c=s.closure,u=s.shapes,l=Jp(u);$(l,function(f){c.add(f,c.topLevel[f.host.id])})}),this.postExecuted("elements.move",function(a){var s=a.context,c=s.shapes,u=s.newHost,l;u&&c.length!==1||(u?l=c:l=Ue(c,function(f){var p=f.host;return PT(f)&&!AT(c,p)}),$(l,function(f){r.updateAttachment(f,u)}))}),this.postExecuted("elements.move",function(a){var s=a.context.shapes;$(s,function(c){$(c.attachers,function(u){$(u.outgoing.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)}),$(u.incoming.slice(),function(l){var f=i.allowed("connection.reconnect",{connection:l,source:l.source,target:l.target});f||r.removeConnection(l)})})})}),this.postExecute("shape.create",function(a){var s=a.context,c=s.shape,u=s.host;u&&r.updateAttachment(c,u)}),this.postExecute("shape.replace",function(a){var s=a.context,c=s.oldShape,u=s.newShape;fr(c.attachers,function(l){var f=i.allowed("elements.move",{target:u,shapes:[l]});f==="attach"?r.updateAttachment(l,u):r.removeShape(l)}),u.attachers.length&&$(u.attachers,function(l){var f=Tg(l,c,u);r.moveShape(l,f,l.parent)})}),this.postExecute("shape.resize",function(a){var s=a.context,c=s.shape,u=s.oldBounds,l=s.newBounds,f=c.attachers,p=s.hints||{};p.attachSupport!==!1&&$(f,function(d){var m=Tg(d,u,l);r.moveShape(d,m,d.parent),$(d.labels,function(h){r.moveShape(h,m,h.parent)})})}),this.preExecute("shape.delete",function(a){var s=a.context.shape;fr(s.attachers,function(c){r.removeShape(c)}),s.host&&r.updateAttachment(s,null)})}xe(Qp,te),Qp.$inject=["injector","eventBus","canvas","rules","modeling"];function Jp(e){return ju(ln(e,function(t){return t.attachers||[]}))}function RT(e){var t=Jp(e);return iw("id",e,t)}function CT(e){var t=no(e,"id");return Ue(e,function(n){for(;n;){if(n.host&&t[n.host.id])return!1;n=n.parent}return!0})}function PT(e){return!!e.host}function AT(e,t){return e.indexOf(t)!==-1}const TT={__depends__:[wi],__init__:["attachSupport"],attachSupport:["type",Qp]};function fv(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(rm(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)})}fv.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];const ef={__init__:["changeSupport"],changeSupport:["type",fv]};function ti(e){this._model=e}ti.$inject=["moddle"],ti.prototype._needsId=function(e){return Ve(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"])},ti.prototype._ensureId=function(e){if(e.id){this._model.ids.claim(e.id,e);return}var t;E(e,"bpmn:Activity")?t="Activity":E(e,"bpmn:Event")?t="Event":E(e,"bpmn:Gateway")?t="Gateway":Ve(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))},ti.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},ti.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},ti.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",V({bpmnElement:e,bounds:this.createDiBounds()},t))},ti.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},ti.prototype.createDiWaypoints=function(e){var t=this;return ln(e,function(n){return t.createDiWaypoint(n)})},ti.prototype.createDiWaypoint=function(e){return this.create("dc:Point",si(e,["x","y"]))},ti.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",V({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},ti.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",V({bpmnElement:e},t))};function Bn(e,t,n){te.call(this,e),this._bpmnFactory=t;var i=this;function r(d){var m=d.context,h=m.hints||{},g;!m.cropped&&h.createElementsBehavior!==!1&&(g=m.connection,g.waypoints=n.getCroppedWaypoints(g),m.cropped=!0)}this.executed(["connection.layout","connection.create"],r),this.reverted(["connection.layout"],function(d){delete d.context.cropped});function o(d){var m=d.context;i.updateParent(m.shape||m.connection,m.oldParent)}function a(d){var m=d.context,h=m.shape||m.connection,g=m.parent||m.newParent;i.updateParent(h,g)}this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Nn(o)),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],Nn(a));function s(d){var m=d.context,h=m.oldRoot,g=h.children;$(g,function(y){E(y,"bpmn:BaseElement")&&i.updateParent(y)})}this.executed(["canvas.updateRoot"],s),this.reverted(["canvas.updateRoot"],s);function c(d){var m=d.context.shape;E(m,"bpmn:BaseElement")&&i.updateBounds(m)}this.executed(["shape.move","shape.create","shape.resize"],Nn(function(d){d.context.shape.type!=="label"&&c(d)})),this.reverted(["shape.move","shape.create","shape.resize"],Nn(function(d){d.context.shape.type!=="label"&&c(d)})),e.on("shape.changed",function(d){d.element.type==="label"&&c({context:{shape:d.element}})});function u(d){i.updateConnection(d.context)}this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],Nn(u)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],Nn(u));function l(d){i.updateConnectionWaypoints(d.context.connection)}this.executed(["connection.layout","connection.move","connection.updateWaypoints"],Nn(l)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],Nn(l)),this.executed("connection.reconnect",Nn(function(d){var m=d.context,h=m.connection,g=m.oldSource,y=m.newSource,v=ie(h),b=ie(g),x=ie(y);v.conditionExpression&&!Ve(x,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(m.oldConditionExpression=v.conditionExpression,delete v.conditionExpression),g!==y&&b.default===v&&(m.oldDefault=b.default,delete b.default)})),this.reverted("connection.reconnect",Nn(function(d){var m=d.context,h=m.connection,g=m.oldSource,y=m.newSource,v=ie(h),b=ie(g),x=ie(y);m.oldConditionExpression&&(v.conditionExpression=m.oldConditionExpression),m.oldDefault&&(b.default=m.oldDefault,delete x.default)}));function f(d){i.updateAttachment(d.context)}this.executed(["element.updateAttachment"],Nn(f)),this.reverted(["element.updateAttachment"],Nn(f)),this.executed("element.updateLabel",Nn(p)),this.reverted("element.updateLabel",Nn(p));function p(d){const{element:m}=d.context,h=Un(m),g=Ze(m),y=g&&g.get("label");or(m)||mc(m)||(h&&!y?g.set("label",t.create("bpmndi:BPMNLabel")):!h&&y&&g.set("label",void 0))}}xe(Bn,te),Bn.$inject=["eventBus","bpmnFactory","connectionDocking"],Bn.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},Bn.prototype.updateParent=function(e,t){if(!Ge(e)&&!(E(e,"bpmn:DataStoreReference")&&e.parent&&E(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Ze(e),o=n&&n.businessObject,a=Ze(n);E(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),E(e,"bpmn:DataOutputAssociation")&&(e.source?o=e.source.businessObject:o=null),E(e,"bpmn:DataInputAssociation")&&(e.target?o=e.target.businessObject:o=null),this.updateSemanticParent(i,o),E(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,a)}},Bn.prototype.updateBounds=function(e){var t=Ze(e),n=kT(e);if(n){var i=ui(n,t.get("bounds"));V(n,{x:e.x+i.x,y:e.y+i.y})}var r=Ge(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),V(o,{x:e.x,y:e.y,width:e.width,height:e.height})},Bn.prototype.updateFlowNodeRefs=function(e,t,n){if(n!==t){var i,r;E(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),At(i,e)),E(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),Mt(r,e))}},Bn.prototype.updateDiConnection=function(e,t,n){var i=Ze(e),r=Ze(t),o=Ze(n);i.sourceElement&&i.sourceElement.bpmnElement!==ie(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==ie(n)&&(i.targetElement=n&&o)},Bn.prototype.updateDiParent=function(e,t){if(t&&!E(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(At(n,e),e.$parent=null)}};function MT(e){for(;e&&!E(e,"bpmn:Definitions");)e=e.$parent;return e}Bn.prototype.getLaneSet=function(e){var t,n;return E(e,"bpmn:Lane")?(t=e.childLaneSet,t||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(E(e,"bpmn:Participant")&&(e=e.processRef),n=e.get("laneSets"),t=n[0],t||(t=this._bpmnFactory.create("bpmn:LaneSet"),t.$parent=e,n.push(t)),t)},Bn.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&!((E(e,"bpmn:DataInput")||E(e,"bpmn:DataOutput"))&&(E(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(E(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(E(e,"bpmn:FlowElement")){if(t){if(E(t,"bpmn:Participant"))t=t.processRef;else if(E(t,"bpmn:Lane"))do t=t.$parent.$parent;while(E(t,"bpmn:Lane"))}i="flowElements"}else if(E(e,"bpmn:Artifact")){for(;t&&!E(t,"bpmn:Process")&&!E(t,"bpmn:SubProcess")&&!E(t,"bpmn:Collaboration");)if(E(t,"bpmn:Participant")){t=t.processRef;break}else t=t.$parent;i="artifacts"}else if(E(e,"bpmn:MessageFlow"))i="messageFlows";else if(E(e,"bpmn:Participant")){i="participants";var r=e.processRef,o;r&&(o=MT(e.$parent||t),e.$parent&&(At(o.get("rootElements"),r),r.$parent=null),t&&(Mt(o.get("rootElements"),r),r.$parent=o))}else E(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":E(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var a;if(e.$parent&&(a=e.$parent.get(i),At(a,e)),t?(a=t.get(i),a.push(e),e.$parent=t):e.$parent=null,n){var s=n.get(i);At(a,e),t&&(s||(s=[],t.set(i,s)),s.push(e))}}},Bn.prototype.updateConnectionWaypoints=function(e){var t=Ze(e);t.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},Bn.prototype.updateConnection=function(e){var t=e.connection,n=ie(t),i=t.source,r=ie(i),o=t.target,a=ie(t.target),s;if(E(n,"bpmn:DataAssociation"))E(n,"bpmn:DataInputAssociation")?(n.get("sourceRef")[0]=r,s=e.parent||e.newParent||a,this.updateSemanticParent(n,a,s)):E(n,"bpmn:DataOutputAssociation")&&(s=e.parent||e.newParent||r,this.updateSemanticParent(n,r,s),n.targetRef=a);else{var c=E(n,"bpmn:SequenceFlow");n.sourceRef!==r&&(c&&(At(n.sourceRef&&n.sourceRef.get("outgoing"),n),r&&r.get("outgoing")&&r.get("outgoing").push(n)),n.sourceRef=r),n.targetRef!==a&&(c&&(At(n.targetRef&&n.targetRef.get("incoming"),n),a&&a.get("incoming")&&a.get("incoming").push(n)),n.targetRef=a)}this.updateConnectionWaypoints(t),this.updateDiConnection(t,i,o)},Bn.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};function Nn(e){return function(t){var n=t.context,i=n.shape||n.connection||n.element;E(i,"bpmn:BaseElement")&&e(t)}}function kT(e){if(E(e,"bpmn:Activity")){var t=Ze(e);if(t){var n=t.get("label");if(n)return n.get("bounds")}}}function dr(e,t){Ii.call(this),this._bpmnFactory=e,this._moddle=t}xe(dr,Ii),dr.$inject=["bpmnFactory","moddle"],dr.prototype._baseCreate=Ii.prototype.create,dr.prototype.create=function(e,t){if(e==="label"){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,V({type:"label",di:n},Br,t))}return this.createElement(e,t)},dr.prototype.createElement=function(e,t){t=V({},t||{});var n,i=t.businessObject,r=t.di;if(!i){if(!t.type)throw new Error("no shape type specified");i=this._bpmnFactory.create(t.type)}if(!DT(r)){var o=V({},r||{},{id:i.id+"_di"});e==="root"?r=this._bpmnFactory.createDiPlane(i,o):e==="connection"?r=this._bpmnFactory.createDiEdge(i,o):r=this._bpmnFactory.createDiShape(i,o)}E(i,"bpmn:Group")&&(t=V({isFrame:!0},t)),t=OT(i,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=tf(r,t,"isExpanded")),Ve(i,["bpmn:Lane","bpmn:Participant"])&&(t=tf(r,t,"isHorizontal")),E(i,"bpmn:SubProcess")&&(t.collapsed=!Ke(i,r)),E(i,"bpmn:ExclusiveGateway")&&(An(r,"isMarkerVisible")?r.isMarkerVisible===void 0&&(r.isMarkerVisible=!1):r.isMarkerVisible=!0),Ht(t.triggeredByEvent)&&(i.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),Ht(t.cancelActivity)&&(i.cancelActivity=t.cancelActivity,delete t.cancelActivity);var a,s;return t.eventDefinitionType&&(a=i.get("eventDefinitions")||[],s=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),t.eventDefinitionType==="bpmn:ConditionalEventDefinition"&&(s.condition=this._bpmnFactory.create("bpmn:FormalExpression")),a.push(s),s.$parent=i,i.eventDefinitions=a,delete t.eventDefinitionType),n=this.getDefaultSize(i,r),t=V({id:i.id},n,t,{businessObject:i,di:r}),this._baseCreate(e,t)},dr.prototype.getDefaultSize=function(e,t){var n=ie(e);if(t=t||Ze(e),E(n,"bpmn:SubProcess"))return Ke(n,t)?{width:350,height:200}:{width:100,height:80};if(E(n,"bpmn:Task"))return{width:100,height:80};if(E(n,"bpmn:Gateway"))return{width:50,height:50};if(E(n,"bpmn:Event"))return{width:36,height:36};if(E(n,"bpmn:Participant")){var i=t.isHorizontal===void 0||t.isHorizontal===!0;return Ke(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return E(n,"bpmn:Lane")?{width:400,height:100}:E(n,"bpmn:DataObjectReference")?{width:36,height:50}:E(n,"bpmn:DataStoreReference")?{width:50,height:50}:E(n,"bpmn:TextAnnotation")?{width:100,height:40}:E(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},dr.prototype.createParticipantShape=function(e){return Yt(e)||(e={isExpanded:e}),e=V({type:"bpmn:Participant"},e||{}),e.isExpanded!==!1&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)};function OT(e,t,n){return $(n,function(i){t=tf(e,t,i)}),t}function tf(e,t,n){return t[n]===void 0?t:(e[n]=t[n],fi(t,[n]))}function DT(e){return Ve(e,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])}function Mc(e,t){this._modeling=e,this._canvas=t}Mc.$inject=["modeling","canvas"],Mc.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;$(n,function(r){var o={x:0,y:0};Ht(i.left)?o.x=i.left-r.x:Ht(i.right)?o.x=i.right-r.width-r.x:Ht(i.center)?o.x=i.center-Math.round(r.width/2)-r.x:Ht(i.top)?o.y=i.top-r.y:Ht(i.bottom)?o.y=i.bottom-r.height-r.y:Ht(i.middle)&&(o.y=i.middle-Math.round(r.height/2)-r.y),t.moveElements([r],o,r.parent)})},Mc.prototype.postExecute=function(e){};function kc(e){this._modeling=e}kc.$inject=["modeling"],kc.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},kc.prototype.postExecute=function(e){var t=e.hints||{};LT(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 LT(e,t){return qi(e.outgoing,function(n){return n.target===t})}function Oc(e,t){this._canvas=e,this._layouter=t}Oc.$inject=["canvas","layouter"],Oc.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},Oc.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Dc=Math.round;function nf(e){this._modeling=e}nf.$inject=["modeling"],nf.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;$(t,function(f){Ne(f.x)||(f.x=0),Ne(f.y)||(f.y=0)});var s=Ue(t,function(f){return!f.hidden}),c=It(s);$(t,function(f){ct(f)&&(f.waypoints=ln(f.waypoints,function(p){return{x:Dc(p.x-c.x-c.width/2+r.x),y:Dc(p.y-c.y-c.height/2+r.y)}})),V(f,{x:Dc(f.x-c.x-c.width/2+r.x),y:Dc(f.y-c.y-c.height/2+r.y)})});var u=new Set(Is(t)),l={};$(t,function(f){if(ct(f)){l[f.id]=Ne(i)?a.createConnection(l[f.source.id],l[f.target.id],i,f,f.parent||n,o):a.createConnection(l[f.source.id],l[f.target.id],f,f.parent||n,o);return}var p=V({},o);u.has(f)||(p.autoResize=!1),Ge(f)&&(p=fi(p,["attach"])),l[f.id]=Ne(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=to(l)};var dv=Math.round;function hr(e){this._canvas=e}hr.$inject=["canvas"],hr.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return n.width!==void 0?V(t,n):V(t,{x:n.x-dv(t.width/2),y:n.y-dv(t.height/2)}),this._canvas.addShape(t,i,r),t},hr.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t};function Ca(e){hr.call(this,e)}xe(Ca,hr),Ca.$inject=["canvas"];var IT=hr.prototype.execute;Ca.prototype.execute=function(e){var t=e.shape;return NT(t),t.labelTarget=e.labelTarget,IT.call(this,e)};var BT=hr.prototype.revert;Ca.prototype.revert=function(e){return e.shape.labelTarget=null,BT.call(this,e)};function NT(e){["width","height"].forEach(function(t){typeof e[t]>"u"&&(e[t]=0)})}function Pa(e,t){this._canvas=e,this._modeling=t}Pa.$inject=["canvas","modeling"],Pa.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;fr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),fr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})})},Pa.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=Ml(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Pa.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Mt(n.children,t,i),this._canvas.addConnection(t,n),t};function rf(e,t){this._modeling=e,this._elementRegistry=t}rf.$inject=["modeling","elementRegistry"],rf.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;$(i,function(r){n.get(r.id)&&(r.waypoints?t.removeConnection(r):t.removeShape(r))})};function Aa(e,t){this._canvas=e,this._modeling=t}Aa.$inject=["canvas","modeling"],Aa.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;fr(n.incoming,function(i){t.removeConnection(i,{nested:!0})}),fr(n.outgoing,function(i){t.removeConnection(i,{nested:!0})}),fr(n.children,function(i){ct(i)?t.removeConnection(i,{nested:!0}):t.removeShape(i,{nested:!0})})},Aa.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=Ml(i.children,n),t.removeShape(n),n},Aa.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Mt(i.children,n,r),t.addShape(n,i),n};function Lc(e){this._modeling=e}Lc.$inject=["modeling"];var hv={x:"y",y:"x"};Lc.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(g,y){g.range.min=Math.min(y[i],g.range.min),g.range.max=Math.max(y[i]+y[r],g.range.max)}function a(g){return g[i]+g[r]/2}function s(g){return g.length-1}function c(g){return g.max-g.min}function u(g,y){var v={y:0};v[i]=g-a(y),v[i]&&(v[hv[i]]=0,t.moveElements([y],v,y.parent))}var l=n[0],f=s(n),p=n[f],d,m,h=0;$(n,function(g,y){var v,b,x;if(g.elements.length<2){y&&y!==n.length-1&&(o(g,g.elements[0]),h+=c(g.range));return}v=pi(g.elements,i),b=v[0],y===f&&(b=v[s(v)]),x=a(b),g.range=null,$(v,function(C){if(u(x,C),g.range===null){g.range={min:C[i],max:C[i]+C[r]};return}o(g,C)}),y&&y!==n.length-1&&(h+=c(g.range))}),m=Math.abs(p.range.min-l.range.max),d=Math.round((m-h)/(n.length-1)),!(d<n.length-1)&&$(n,function(g,y){var v={},b;g===l||g===p||(b=n[y-1],g.range.max=0,$(g.elements,function(x,C){v[hv[i]]=0,v[i]=b.range.max-x[i]+d,g.range.min!==x[i]&&(v[i]+=x[i]-g.range.min),v[i]&&t.moveElements([x],v,x.parent),g.range.max=Math.max(x[i]+x[r],C?g.range.max:0)}))})},Lc.prototype.postExecute=function(e){};function Ic(e,t){this._layouter=e,this._canvas=t}Ic.$inject=["layouter","canvas"],Ic.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return V(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Ic.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};function of(){}of.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=At(o.children,t),Mt(i.children,t,r),t.parent=i,$(t.waypoints,function(a){a.x+=n.x,a.y+=n.y,a.original&&(a.original.x+=n.x,a.original.y+=n.y)}),t},of.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return At(n.children,t),Mt(i.children,t,r),t.parent=i,$(t.waypoints,function(a){a.x-=o.x,a.y-=o.y,a.original&&(a.original.x-=o.x,a.original.y-=o.y)}),t};function af(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}af.prototype.add=function(e,t){return this.addAll([e],t)},af.prototype.addAll=function(e,t){var n=dS(e,!!t,this);return V(this,n),this};function Ta(e){this._modeling=e}Ta.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ta.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,u=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),$(a,function(f){o.moveShape(f,t,u[f.id]&&!l&&n,{recurse:!1,layout:!1})}),$(s,function(f){var p=!!a[f.source.id],d=!!a[f.target.id];c[f.id]&&p&&d?o.moveConnection(f,t,u[f.id]&&!l&&n):o.layoutConnection(f,{connectionStart:p&&fp(f,f.source,t),connectionEnd:d&&dp(f,f.target,t)})})},Ta.prototype.getClosure=function(e){return new af().addAll(e,!0)};function Bc(e){this._helper=new Ta(e)}Bc.$inject=["modeling"],Bc.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Bc.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 zr(e){this._modeling=e,this._helper=new Ta(e)}zr.$inject=["modeling"],zr.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=At(o.children,t),Mt(i.children,t,r),V(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},zr.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;i.layout!==!1&&($(t.incoming,function(o){r.layoutConnection(o,{connectionEnd:dp(o,t,n)})}),$(t.outgoing,function(o){r.layoutConnection(o,{connectionStart:fp(o,t,n)})})),i.recurse!==!1&&this.moveChildren(e)},zr.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Mt(n.children,t,i),V(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},zr.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},zr.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};function Ma(e){this._modeling=e}Ma.$inject=["modeling"],Ma.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return Le(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Ma.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||mv(Le(r)?r[0]:r)),i&&(!n||o.docking==="target")&&(a.connectionEnd=a.connectionEnd||mv(Le(r)?r[r.length-1]:r)),o.newWaypoints&&(a.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,a))},Ma.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 mv(e){return e.original||e}function Hi(e,t){this._modeling=e,this._rules=t}Hi.$inject=["modeling","rules"],Hi.prototype.preExecute=function(e){var t=this,n=this._modeling,i=this._rules,r=e.oldShape,o=e.newData,a=e.hints||{},s;function c(m,h,g){return i.allowed("connection.reconnect",{connection:g,source:m,target:h})}var u={x:o.x,y:o.y},l={x:r.x,y:r.y,width:r.width,height:r.height};s=e.newShape=e.newShape||t.createShape(o,u,r.parent,a),r.host&&n.updateAttachment(s,r.host);var f;a.moveChildren!==!1&&(f=r.children.slice(),n.moveElements(f,{x:0,y:0},s,a));var p=r.incoming.slice(),d=r.outgoing.slice();$(p,function(m){var h=m.source,g=c(h,s,m);g&&t.reconnectEnd(m,s,uc(m,s,l),a)}),$(d,function(m){var h=m.target,g=c(s,h,m);g&&t.reconnectStart(m,s,cc(m,s,l),a)})},Hi.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Hi.prototype.execute=function(e){},Hi.prototype.revert=function(e){},Hi.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Hi.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Hi.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)};function ka(e){this._modeling=e}ka.$inject=["modeling"],ka.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ka.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds,r=e.hints||{};r.layout!==!1&&($(n.incoming,function(o){t.layoutConnection(o,{connectionEnd:uc(o,n,i)})}),$(n.outgoing,function(o){t.layoutConnection(o,{connectionStart:cc(o,n,i)})}))},ka.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return V(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};function mr(e){this._modeling=e}mr.$inject=["modeling"],mr.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,a={};this.moveShapes(i,t),$(r,function(s){a[s.id]=FT(s)}),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(fT(i,r),t,n,o,i,r,a)},mr.prototype.execute=function(){},mr.prototype.revert=function(){},mr.prototype.moveShapes=function(e,t){var n=this;$(e,function(i){n._modeling.moveShape(i,t,null,{autoResize:!1,layout:!1,recurse:!1})})},mr.prototype.resizeShapes=function(e,t,n){var i=this;$(e,function(r){var o=dT(r,n,t);i._modeling.resizeShape(r,o,null,{attachSupport:!1,autoResize:!1,layout:!1})})},mr.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,a){var s=this,c=new Set(r),u=new Set(o);$(e,function(l){var f=l.source,p=l.target,d=$T(l),m=yv(n),h={},g=c.has(f)||u.has(f),y=c.has(p)||u.has(p);g&&y?(d=ln(d,function(v){return vv(v,i,n)&&(v[m]=v[m]+t[m]),v.original&&vv(v.original,i,n)&&(v.original[m]=v.original[m]+t[m]),v}),s._modeling.updateWaypoints(l,d,{labelBehavior:!1})):(g||y)&&(c.has(f)?h.connectionStart=fp(l,f,t):c.has(p)?h.connectionEnd=dp(l,p,t):u.has(f)?h.connectionStart=cc(l,f,a[f.id]):u.has(p)&&(h.connectionEnd=uc(l,p,a[p.id])),s._modeling.layoutConnection(l,h))})};function gv(e){return V({},e)}function $T(e){return ln(e.waypoints,function(t){return t=gv(t),t.original&&(t.original=gv(t.original)),t})}function yv(e){switch(e){case"n":return"y";case"w":return"x";case"s":return"y";case"e":return"x"}}function vv(e,t,n){var i=yv(n);if(/e|s/.test(n))return e[i]>t;if(/n|w/.test(n))return e[i]<t}function FT(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}function Nc(e){this._modeling=e}Nc.$inject=["modeling"],Nc.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=bv(n),t.collapsed=!t.collapsed;var i=xv(n,t.collapsed);return[t].concat(i)},Nc.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=t.children,r=_v(i,n);return t.collapsed=!t.collapsed,[t].concat(r)};function bv(e){var t={};return $(e,function(n){t[n.id]=n.hidden,n.children&&(t=V({},t,bv(n.children)))}),t}function xv(e,t){var n=[];return $(e,function(i){i.hidden=t,n=n.concat(i),i.children&&(n=n.concat(xv(i.children,i.collapsed||t)))}),n}function _v(e,t){var n=[];return $(e,function(i){i.hidden=t[i.id],n=n.concat(i),i.children&&(n=n.concat(_v(i.children,t)))}),n}function $c(e){this._modeling=e}$c.$inject=["modeling"],$c.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=wv(i,t),Ev(n,t),t.host=n,t},$c.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,wv(n,t),Ev(i,t,r),t};function wv(e,t){return At(e&&e.attachers,t)}function Ev(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Mt(i,t,n)}}function sf(){}sf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},sf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};function ut(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}ut.$inject=["eventBus","elementFactory","commandStack"],ut.prototype.getHandlers=function(){return{"shape.append":kc,"shape.create":hr,"shape.delete":Aa,"shape.move":zr,"shape.resize":ka,"shape.replace":Hi,"shape.toggleCollapse":Nc,spaceTool:mr,"label.create":Ca,"connection.create":Oc,"connection.delete":Pa,"connection.move":of,"connection.layout":Ic,"connection.updateWaypoints":sf,"connection.reconnect":Ma,"elements.create":nf,"elements.move":Bc,"elements.delete":rf,"elements.distribute":Lc,"elements.align":Mc,"element.updateAttachment":$c}},ut.prototype.registerHandlers=function(e){$(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},ut.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)},ut.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},ut.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)},ut.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)},ut.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},ut.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},ut.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},ut.prototype.createElements=function(e,t,n,i,r){Le(e)||(e=[e]),typeof i!="number"&&(r=i,i=void 0),r=r||{};var o={position:t,elements:e,parent:n,parentIndex:i,hints:r};return this._commandStack.execute("elements.create",o),o.elements},ut.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},ut.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},ut.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},ut.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},ut.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},ut.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},ut.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},ut.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},ut.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},ut.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)},ut.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},ut.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)},ut.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,V(i,{docking:"source"}))},ut.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,V(i,{docking:"target"}))},ut.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},ut.prototype._create=function(e,t){return QS(t)?t:this._elementFactory.create(e,t)},ut.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Oa(e){this._elementRegistry=e}Oa.$inject=["elementRegistry"],Oa.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||jT(n,cs(i));return Sv(n,i),e.oldProperties=o,e.changed=r,r},Oa.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return Sv(n,t),i},Oa.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return E(e,"bpmn:DataObject")?HT(e,t):[]};function jT(e,t){return Tn(t,function(n,i){return n[i]=e.get(i),n},{})}function Sv(e,t){$(t,function(n,i){e.set(i,n)})}function HT(e,t){return t.filter(function(n){return E(n,"bpmn:DataObjectReference")&&ie(n).dataObjectRef===e})}var Da="default",zi="id",Rv="di",zT={width:0,height:0};function La(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}La.$inject=["elementRegistry","moddle","modeling","textRenderer"],La.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=YT(e.properties),s=e.oldProperties||GT(t,a);return Cv(a,o)&&(r.unclaim(o[zi]),i.updateId(t,a[zi]),r.claim(a[zi],o)),Da in a&&(a[Da]&&n.push(i.get(a[Da].id)),o[Da]&&n.push(i.get(o[Da].id))),Pv(t,a),e.oldProperties=s,e.changed=n,n},La.prototype.postExecute=function(e){var t=e.element,n=t.label,i=n&&ie(n).name;if(i){var r=this._textRenderer.getExternalLabelBounds(n,i);this._modeling.resizeShape(n,r,zT)}},La.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return Pv(t,i),Cv(n,r)&&(a.unclaim(n[zi]),o.updateId(t,i[zi]),a.claim(i[zi],r)),e.changed};function Cv(e,t){return zi in e&&e[zi]!==t[zi]}function GT(e,t){var n=cs(t),i=e.businessObject,r=Ze(e);return Tn(n,function(o,a){return a!==Rv?o[a]=i.get(a):o[a]=VT(r,cs(t.di)),o},{})}function VT(e,t){return Tn(t,function(n,i){return n[i]=e&&e.get(i),n},{})}function Pv(e,t){var n=e.businessObject,i=Ze(e);$(t,function(r,o){o!==Rv?n.set(o,r):i&&WT(i,r)})}function WT(e,t){$(t,function(n,i){e.set(i,n)})}var UT=["default"];function YT(e){var t=V({},e);return UT.forEach(function(n){n in e&&(t[n]=ie(t[n]))}),t}function Fc(e,t){this._canvas=e,this._modeling=t}Fc.$inject=["canvas","modeling"],Fc.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=Ze(r);return t.setRootElement(n),t.removeRootElement(r),Mt(a.rootElements,i),i.$parent=a,At(a.rootElements,o),o.$parent=null,r.di=null,s.bpmnElement=i,n.di=s,e.oldRoot=r,[]},Fc.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,a=i.$parent,s=Ze(n);return t.setRootElement(r),t.removeRootElement(n),At(a.rootElements,i),i.$parent=null,Mt(a.rootElements,o),o.$parent=a,n.di=null,s.bpmnElement=o,r.di=s,[]};function cf(e,t){this._modeling=e,this._spaceTool=t}cf.$inject=["modeling","spaceTool"],cf.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Zn(i),a=o===i,s=a?i:i.parent,c=sr(s),u=Xt(i);if(u?r==="left"?r="top":r==="right"&&(r="bottom"):r==="top"?r="left":r==="bottom"&&(r="right"),!c.length){var l=u?{x:i.x+Xn,y:i.y,width:i.width-Xn,height:i.height}:{x:i.x,y:i.y+Xn,width:i.width,height:i.height-Xn};n.createShape({type:"bpmn:Lane",isHorizontal:u},l,s)}var f=[];Lr(o,function(x){return f.push(x),x.label&&f.push(x.label),x===i?[]:Ue(x.children,function(C){return C!==i})});var p,d,m,h,g;r==="top"?(p=-120,d=i.y,m=d+10,h="n",g="y"):r==="left"?(p=-120,d=i.x,m=d+10,h="w",g="x"):r==="bottom"?(p=120,d=i.y+i.height,m=d-10,h="s",g="y"):r==="right"&&(p=120,d=i.x+i.width,m=d-10,h="e",g="x");var y=t.calculateAdjustments(f,g,p,m),v=u?{x:0,y:p}:{x:p,y:0};t.makeSpace(y.movingShapes,y.resizingShapes,v,h,m);var b=u?{x:i.x+(a?Xn:0),y:d-(r==="top"?120:0),width:i.width-(a?Xn:0),height:120}:{x:d-(r==="left"?120:0),y:i.y+(a?Xn:0),width:120,height:i.height-(a?Xn:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:u},b,s)};function uf(e){this._modeling=e}uf.$inject=["modeling"],uf.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=sr(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var a=Xt(n),s=a?n.height:n.width,c=Math.round(s/i),u,l,f,p;for(p=0;p<i;p++)p===i-1?u=s-c*p:u=c,l=a?{x:n.x+Xn,y:n.y+p*c,width:n.width-Xn,height:u}:{x:n.x+p*c,y:n.y+Xn,width:u,height:n.height-Xn},p<o?t.resizeShape(r[p],l):(f={type:"bpmn:Lane",isHorizontal:a},t.createShape(f,l,n))};function Ia(e,t){this._modeling=e,this._spaceTool=t}Ia.$inject=["modeling","spaceTool"],Ia.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds,i=e.balanced;i!==!1?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Ia.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=HC(e,t);n.resizeShape(e,t),i.forEach(function(r){n.resizeShape(r.shape,r.newBounds)})},Ia.prototype.resizeSpace=function(e,t){var n=this._spaceTool,i=Ae(e),r=Ae(t),o=og(r,i),a=Zn(e),s=[],c=[];Lr(a,function(m){return s.push(m),(E(m,"bpmn:Lane")||E(m,"bpmn:Participant"))&&c.push(m),m.children});var u,l,f,p,d;(o.bottom||o.top)&&(u=o.bottom||o.top,l=e.y+(o.bottom?e.height:0)+(o.bottom?-10:10),f=o.bottom?"s":"n",p=o.top>0||o.bottom<0?-u:u,d=n.calculateAdjustments(s,"y",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:u},f)),(o.left||o.right)&&(u=o.right||o.left,l=e.x+(o.right?e.width:0)+(o.right?-10:100),f=o.right?"e":"w",p=o.left>0||o.right<0?-u:u,d=n.calculateAdjustments(c,"x",p,l),n.makeSpace(d.movingShapes,d.resizingShapes,{x:u,y:0},f))};var Ba="flowNodeRef",lf="lanes";function jc(){}jc.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},o=[];function a(l,f){var p=Ae(f),d={x:l.x+l.width/2,y:l.y+l.height/2};return d.x>p.left&&d.x<p.right&&d.y>p.top&&d.y<p.bottom}function s(l){n.indexOf(l)===-1&&(o.push(l),n.push(l))}function c(l){var f=Zn(l);return r[f.id]||(r[f.id]=ic(f)),r[f.id]}function u(l){if(!l.parent)return[];var f=c(l);return f.filter(function(p){return a(l,p)}).map(function(p){return p.businessObject})}return t.forEach(function(l){var f=Zn(l);if(!(!f||n.indexOf(f)!==-1)){var p=f.children.filter(function(d){return E(d,"bpmn:FlowNode")});p.forEach(s),n.push(f)}}),e.forEach(s),o.forEach(function(l){var f=l.businessObject,p=f.get(lf),d=p.slice(),m=u(l);i.push({flowNode:f,remove:d,add:m})}),t.forEach(function(l){var f=l.businessObject;l.parent||f.get(Ba).forEach(function(p){i.push({flowNode:p,remove:[f],add:[]})})}),i},jc.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(lf);n.remove.forEach(function(o){At(r,o),At(o.get(Ba),i)}),n.add.forEach(function(o){Mt(r,o),Mt(o.get(Ba),i)})}),[]},jc.prototype.revert=function(e){var t=e.updates;return t.forEach(function(n){var i=n.flowNode,r=i.get(lf);n.add.forEach(function(o){At(r,o),At(o.get(Ba),i)}),n.remove.forEach(function(o){Mt(r,o),Mt(o.get(Ba),i)})}),[]};var pf="categoryValueRef";function Na(e,t){this._bpmnFactory=e,this._elementRegistry=t}Na.$inject=["bpmnFactory","elementRegistry"],Na.prototype._computeUpdates=function(e,t){var n=this._elementRegistry,i=this._bpmnFactory,r=new Map,o=[],a=new Map;function s(v,b,x){if(b){var C=a.get(v);C||(C={},a.set(v,C)),!(x&&C.present)&&(!x&&C.past||(x?C.present={categoryValue:b,root:ff(v)}:C.past={categoryValue:b}))}}function c(v){r.set(v,ie(v))}function u(){n.filter(function(v){return E(v,"bpmn:FlowElement")&&!Ge(v)&&v.parent}).forEach(c)}function l(v){var b=ie(v),x=b.get("categoryValueRef");return x||(x=eg(i,b),o.push(qT(v,x))),x}function f(v){return v.reduce(function(b,x){var C=ff(x),P=b.get(C);return P||(P=[],b.set(C,P)),P.push(x),b},new Map)}e=Array.from(e||[]);var p=f(e);t.length&&u(),e.forEach(c),n.filter(function(v){return E(v,"bpmn:Group")&&!Ge(v)&&v.parent}).forEach(function(v){var b=ie(v).get("categoryValueRef");if(!b){var x=ff(v),C=p.get(x)||[],P=ho(C,v),D=Object.keys(P).length>0;D&&(b=l(v))}s(v,b,!0)}),t.forEach(function(v){s(v.groupShape,v.categoryValue,!1)}),o.length&&u();var d=Array.from(r.keys()),m=Array.from(a.values()).reduce(function(v,b){return b.present&&v.add(b.present.categoryValue),b.past&&v.add(b.past.categoryValue),v},new Set),h=new Map,g=f(d);a.forEach(function(v,b){var x=v.present;if(x){var C=g.get(x.root)||[],P=ho(C,b);C.forEach(function(D){if(P[D.id]){var T=h.get(D);T||(T=new Set,h.set(D,T)),T.add(x.categoryValue)}})}});var y=d.reduce(function(v,b){var x=r.get(b),C=x.get(pf),P=new Set(C),D=h.get(b)||new Set,T=Array.from(D).filter(function(k){return!P.has(k)}),I=C.filter(function(k){return m.has(k)&&!D.has(k)});return(T.length||I.length)&&v.push({businessObject:x,categoryValuesToAdd:T,categoryValuesToRemove:I}),v},[]);return{flowElements:y,groups:o}},Na.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.affectedFlowElements,e.affectedGroupEntries)),KT(t.groups),ZT(t.flowElements),[]},Na.prototype.revert=function(e){var t=e.updates;return QT(t.flowElements),XT(t.groups),[]};function qT(e,t){return{groupShape:e,categoryValue:t,category:t.$parent}}function KT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=t.categoryValue,t.categoryValue.$parent=t.category})}function XT(e){e.forEach(function(t){ie(t.groupShape).categoryValueRef=null})}function ZT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(pf);t.categoryValuesToRemove.forEach(function(r){At(i,r)}),t.categoryValuesToAdd.forEach(function(r){Mt(i,r,!0)})})}function QT(e){e.forEach(function(t){var n=t.businessObject,i=n.get(pf);t.categoryValuesToAdd.forEach(function(r){At(i,r)}),t.categoryValuesToRemove.forEach(function(r){Mt(i,r,!0)})})}function ff(e){for(;e.parent;)e=e.parent;return e}function Hc(e){this._moddle=e}Hc.$inject=["moddle"],Hc.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),[]},Hc.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 JT={fill:void 0,stroke:void 0};function df(e){this._commandStack=e,this._normalizeColor=function(t){if(t){if(Pn(t)){var n=eM(t);if(n)return n}throw new Error(`invalid color value: ${t}`)}}}df.$inject=["commandStack"],df.prototype.postExecute=function(e){var t=e.elements,n=e.colors||JT,i=this,r={};"fill"in n&&V(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&V(r,{"border-color":this._normalizeColor(n.stroke)}),$(t,function(o){var a=ct(o)?si(r,["border-color"]):r,s=Ze(o);if(tM(a),Ge(o)){if(!s||!E(s.label,"bpmndi:BPMNLabel"))return;i._commandStack.execute("element.updateModdleProperties",{element:o,moddleElement:s.label,properties:{color:r["border-color"]}})}else{if(!Ve(s,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:o,properties:{di:a}})}})};function eM(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 tM(e){"border-color"in e&&(e.stroke=e["border-color"]),"background-color"in e&&(e.fill=e["background-color"])}var nM={width:0,height:0};function Av(e,t,n){function i(c,u){var l=c.label||c,f=c.labelTarget||c;return MR(l,u),[l,f]}function r(c){var u=c.element,l=u.businessObject,f=c.newLabel;if(!Ge(u)&&or(u)&&!Vs(u)&&!Tv(f)){var p=7,d=Bl(u);d={x:d.x,y:d.y+p},e.createLabel(u,d,{id:l.id+"_label",businessObject:l,di:u.di})}}function o(c){return c.oldLabel=Un(c.element),i(c.element,c.newLabel)}function a(c){return i(c.element,c.oldLabel)}function s(c){var u=c.element,l=u.label||u,f=c.newLabel,p=c.newBounds,d=c.hints||{};if(!(!Ge(l)&&!E(l,"bpmn:TextAnnotation"))){if(Ge(l)&&Tv(f)){d.removeShape!==!1&&e.removeShape(l,{unsetLabel:!1});return}var m=Un(u);typeof p>"u"&&(p=t.getExternalLabelBounds(l,m)),p&&e.resizeShape(l,p,nM)}}this.preExecute=r,this.execute=o,this.revert=a,this.postExecute=s}Av.$inject=["modeling","textRenderer","bpmnFactory"];function Tv(e){return!e||!e.trim()}function an(e,t,n,i){ut.call(this,e,t,n),this._bpmnRules=i}xe(an,ut),an.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],an.prototype.getHandlers=function(){var e=ut.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=Oa,e["element.updateProperties"]=La,e["canvas.updateRoot"]=Fc,e["lane.add"]=cf,e["lane.resize"]=Ia,e["lane.split"]=uf,e["lane.updateRefs"]=jc,e["group.updateRefs"]=Na,e["id.updateClaim"]=Hc,e["element.setColor"]=df,e["element.updateLabel"]=Av,e},an.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},an.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)},an.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},an.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},an.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},an.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},an.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},an.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},an.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},an.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},an.prototype.updateCategoryValueRefs=function(e,t){this._commandStack.execute("group.updateRefs",{affectedFlowElements:e,affectedGroupEntries:t})},an.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},an.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},an.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};function Mv(){}Mv.prototype.layoutConnection=function(e,t){return t=t||{},[t.connectionStart||Ie(t.source||e.source),t.connectionEnd||Ie(t.target||e.target)]};var zc=20,iM=5,Gc=Math.round,kv=20,rM={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function oM(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}function aM(e,t){return{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[e].test(t)}function Ov(e,t,n){var i=nn(t,e,iM),r=n.split(":")[0],o=Gc((t.x-e.x)/2+e.x),a=Gc((t.y-e.y)/2+e.y),s,c,u=aM(r,i),l=/h|r|l/.test(r),f=!1,p=!1;return u?(s=l?{x:o,y:e.y}:{x:e.x,y:a},c=l?"h:h":"v:v"):(f=oM(i,r),c=l?"h:v":"v:h",f?l?(p=a===e.y,s={x:e.x+zc*(/l/.test(r)?-1:1),y:p?a+zc:a}):(p=o===e.x,s={x:p?o+zc:o,y:e.y+zc*(/t/.test(r)?-1:1)}):s={x:o,y:a}),{waypoints:hf(e,s,c).concat(s),directions:c,turnNextDirections:p}}function sM(e,t,n){return Ov(e,t,n)}function cM(e,t,n){var i=Ov(t,e,Dv(n));return{waypoints:i.waypoints.slice().reverse(),directions:Dv(i.directions),turnNextDirections:i.turnNextDirections}}function uM(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=hf(e.waypoints[e.waypoints.length-1],t.waypoints[0],r);return{waypoints:o,directions:r}}function Dv(e){return e.split(":").reverse().join(":")}function lM(e,t,n){var i=Gc((t.x-e.x)/2+e.x),r=Gc((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 hf(e,t,n){if(n=n||"h:h",!bM(n))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Iv(n)){var i=sM(e,t,n),r=cM(e,t,n),o=uM(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return lM(e,t,n)}function pM(e,t,n){var i=hf(e,t,n);return i.unshift(e),i.push(t),Nv(i)}function fM(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=tw(o,"straight")[0]||"h:h",s=rM[a]||0,c=nn(e,t,s),u=vM(c,a);n=n||Ie(e),i=i||Ie(t);var l=u.split(":"),f=Bv(n,e,l[0],xM(c)),p=Bv(i,t,l[1],c);return pM(f,p,u)}function dM(e,t,n,i,r,o){Le(n)&&(r=n,o=i,n=Ie(e),i=Ie(t)),o=V({preferredLayouts:[]},o),r=r||[];var a=o.preferredLayouts,s=a.indexOf("straight")!==-1,c;return c=s&&mM(e,t,n,i,o),c||(c=o.connectionEnd&&yM(t,e,i,r),c)||(c=o.connectionStart&&gM(e,t,n,r),c)?c:!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:fM(e,t,n,i,o)}function hM(e,t,n){return e>=t&&e<=n}function Lv(e,t,n){var i={x:"width",y:"height"};return hM(t[e],n[e],n[e]+n[i[e]])}function mM(e,t,n,i,r){var o={},a,s;return s=nn(e,t),/^(top|bottom|left|right)$/.test(s)?(/top|bottom/.test(s)&&(a="x"),/left|right/.test(s)&&(a="y"),r.preserveDocking==="target"?Lv(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:Lv(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 gM(e,t,n,i){return mf(e,t,n,i)}function yM(e,t,n,i){var r=i.slice().reverse();return r=mf(e,t,n,r),r?r.reverse():null}function mf(e,t,n,i){function r(l){return l.length<3?!0:l.length>4?!1:!!ft(l,function(f,p){var d=l[p-1];return d&&sa(f,d)<3})}function o(l,f,p){var d=Di(f,l);switch(d){case"v":return{x:p.x,y:l.y};case"h":return{x:l.x,y:p.y}}return{x:l.x,y:l.y}}function a(l,f,p){var d;for(d=l.length-2;d!==0;d--)if(am(l[d],f,kv)||am(l[d],p,kv))return l.slice(d);return l}if(r(i))return null;var s=i[0],c=i.slice(),u;return c[0]=n,c[1]=o(c[1],s,n),u=a(c,e,t),u!==c&&(c=mf(e,t,n,u)),c&&Di(c)?null:c}function vM(e,t){if(Iv(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 bM(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}function Iv(e){return e&&/t|r|b|l/.test(e)}function xM(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}function Bv(e,t,n,i){if(n==="h"&&(n=/left/.test(i)?"l":"r"),n==="v"&&(n=/top/.test(i)?"t":"b"),n==="t")return{original:e,x:e.x,y:t.y};if(n==="r")return{original:e,x:t.x+t.width,y:e.y};if(n==="b")return{original:e,x:e.x,y:t.y+t.height};if(n==="l")return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Nv(e){return e.reduce(function(t,n,i){var r=t[t.length-1],o=e[i+1];return kl(r,o,n,0)||t.push(n),t},[])}var _M=-10,wM=40,EM={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},SM={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},gf={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},$a={top:"t",right:"r",bottom:"b",left:"l"};function Vc(e){this._elementRegistry=e}xe(Vc,Mv),Vc.prototype.layoutConnection=function(e,t){t||(t={});var n=t.source||e.source,i=t.target||e.target,r=t.waypoints||e.waypoints,o=t.connectionStart,a=t.connectionEnd,s=this._elementRegistry,c,u;if(o||(o=$v(r&&r[0],n)),a||(a=$v(r&&r[r.length-1],i)),(E(e,"bpmn:Association")||E(e,"bpmn:DataAssociation"))&&r&&!Fv(n,i))return[].concat([o],r.slice(1,-1),[a]);var l=Xm(n,s)?EM:SM;return E(e,"bpmn:MessageFlow")?c=CM(n,i,l):(E(e,"bpmn:SequenceFlow")||Fv(n,i))&&(n===i?c={preferredLayouts:OM(n,e,l)}:E(n,"bpmn:BoundaryEvent")?c={preferredLayouts:DM(n,i,a,l)}:Fa(n)||Fa(i)?c={preferredLayouts:l.subProcess,preserveDocking:AM(n)}:E(n,"bpmn:Gateway")?c={preferredLayouts:l.fromGateway}:E(i,"bpmn:Gateway")?c={preferredLayouts:l.toGateway}:c={preferredLayouts:l.default}),c&&(c=V(c,t),u=Nv(dM(n,i,o,a,r,c))),u||[o,a]};function RM(e){var t=e.host;return nn(Ie(e),t,_M)}function CM(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:PM(e,t)}}function PM(e,t){return E(t,"bpmn:Participant")?"source":E(e,"bpmn:Participant")?"target":Fa(t)?"source":Fa(e)||E(t,"bpmn:Event")?"target":E(e,"bpmn:Event")?"source":null}function AM(e){return Fa(e)?"target":"source"}function $v(e,t){return e?e.original||e:Ie(t)}function Fv(e,t){return E(t,"bpmn:Activity")&&E(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Fa(e){return E(e,"bpmn:SubProcess")&&Ke(e)}function Gr(e,t){return e===t}function TM(e,t){return t.indexOf(e)!==-1}function Do(e){var t=/right|left/.exec(e);return t&&t[0]}function Lo(e){var t=/top|bottom/.exec(e);return t&&t[0]}function jv(e,t){return gf[e]===t}function MM(e,t){var n=Do(e),i=gf[n];return t.indexOf(i)!==-1}function kM(e,t){var n=Lo(e),i=gf[n];return t.indexOf(i)!==-1}function Hv(e){return e==="right"||e==="left"}function OM(e,t,n){var i=t.waypoints,r=i&&i.length&&nn(i[0],e);return r==="top"?n.loop.fromTop:r==="right"?n.loop.fromRight:r==="left"?n.loop.fromLeft:n.loop.fromBottom}function DM(e,t,n,i){var r=Ie(e),o=Ie(t),a=RM(e),s,c,u=Gr(e.host,t),l=TM(a,["top","right","bottom","left"]),f=nn(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?LM(a,l,e,t,n,i):(s=IM(a,f,l,i.isHorizontal),c=BM(a,f,l,i.isHorizontal),[s+":"+c])}function LM(e,t,n,i,r,o){var a=t?e:o.isHorizontal?Lo(e):Do(e),s=$a[a],c;return t?Hv(e)?c=zv("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:c=zv("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:c=o.boundaryLoop.default,[s+":"+c]}function zv(e,t,n,i){var r=wM;return!(yf(e,i,n,r)||yf(e,i,{x:n.x+n.width,y:n.y+n.height},r)||yf(e,i,Ie(t),r))}function yf(e,t,n,i){return Math.abs(t[e]-n[e])<i}function IM(e,t,n,i){if(n)return $a[e];var r=Lo(e),o=Do(e),a=Lo(t),s=Do(t);if(i){if(Gr(r,a)||jv(o,s))return $a[r]}else if(Gr(o,s)||jv(r,a))return $a[o];return $a[i?o:r]}function BM(e,t,n,i){if(n)return Hv(e)?MM(e,t)||Gr(e,t)?"h":"v":kM(e,t)||Gr(e,t)?"v":"h";var r=Lo(e),o=Do(e),a=Lo(t),s=Do(t);return a&&!s?"v":s&&!a?"h":i?Gr(r,a)?"h":"v":Gr(o,s)?"v":"h"}Vc.$inject=["elementRegistry"];function Gv(e){return V({original:e.point.original||e.point},e.actual)}function gr(e,t){this._elementRegistry=e,this._graphicsFactory=t}gr.$inject=["elementRegistry","graphicsFactory"],gr.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(Gv(i)),o.push(Gv(r)),o},gr.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}},gr.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return ca(i,r,n)},gr.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},gr.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},gr.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};const vf={__init__:["modeling","bpmnUpdater"],__depends__:[tA,yA,bA,xA,tv,_T,ET,TT,Jn,ef,sv],bpmnFactory:["type",ti],bpmnUpdater:["type",Bn],elementFactory:["type",dr],modeling:["type",an],layouter:["type",Vc],connectionDocking:["type",gr]};var NM=10,Vv=50,$M=250;function bf(e,t,n,i){for(var r;r=FM(e,n,t);)n=i(t,n,r);return n}function xf(e){return function(t,n,i){var r={x:n.x,y:n.y};return["x","y"].forEach(function(o){var a=e[o];if(a){var s=o==="x"?"width":"height",c=a.margin,u=a.minDistance;c<0?r[o]=Math.min(i[o]+c-t[s]/2,n[o]-u+c):r[o]=Math.max(i[o]+i[s]+c+t[s]/2,n[o]+u+c)}}),r}}function FM(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=HM(e);return ft(r,function(o){if(o===n)return!1;var a=nn(o,i,NM);return a==="intersect"})}function jM(e,t){t||(t={});function n(m){return m.source===e?1:-1}var i=t.defaultDistance||Vv,r=t.direction||"e",o=t.filter,a=t.getWeight||n,s=t.maxDistance||$M,c=t.reference||"start";o||(o=VM);function u(m,h){return r==="n"?c==="start"?Ae(m).top-Ae(h).bottom:c==="center"?Ae(m).top-Ie(h).y:Ae(m).top-Ae(h).top:r==="w"?c==="start"?Ae(m).left-Ae(h).right:c==="center"?Ae(m).left-Ie(h).x:Ae(m).left-Ae(h).left:r==="s"?c==="start"?Ae(h).top-Ae(m).bottom:c==="center"?Ie(h).y-Ae(m).bottom:Ae(h).bottom-Ae(m).bottom:c==="start"?Ae(h).left-Ae(m).right:c==="center"?Ie(h).x-Ae(m).right:Ae(h).right-Ae(m).right}var l=e.incoming.filter(o).map(function(m){var h=a(m),g=h<0?u(m.source,e):u(e,m.source);return{id:m.source.id,distance:g,weight:h}}),f=e.outgoing.filter(o).map(function(m){var h=a(m),g=h>0?u(e,m.target):u(m.target,e);return{id:m.target.id,distance:g,weight:h}}),p=l.concat(f).reduce(function(m,h){return m[h.id+"__weight_"+h.weight]=h,m},{}),d=Tn(p,function(m,h){var g=h.distance,y=h.weight;return g<0||g>s||(m[String(g)]||(m[String(g)]=0),m[String(g)]+=1*y,(!m.distance||m[m.distance]<m[String(g)])&&(m.distance=g)),m},{});return d.distance||i}function HM(e){var t=_f(e);return e.host&&(t=t.concat(_f(e.host))),e.attachers&&(t=t.concat(e.attachers.reduce(function(n,i){return n.concat(_f(i))},[]))),t}function _f(e){return GM(e).concat(zM(e))}function zM(e){return e.incoming.map(function(t){return t.source})}function GM(e){return e.outgoing.map(function(t){return t.target})}function VM(){return!0}var WM=100;function Wv(e,t,n){e.on("autoPlace",WM,function(i){var r=i.shape,o=i.source;return UM(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}}Wv.$inject=["eventBus","modeling","canvas"];function UM(e,t,n){n||(n={});var i=n.defaultDistance||Vv,r=Ie(e),o=Ae(e);return{x:o.right+i+t.width/2,y:r.y}}function Uv(e,t){e.on("autoPlace.end",500,function(n){t.select(n.shape)})}Uv.$inject=["eventBus","selection"];const YM={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Wv],autoPlaceSelectionBehavior:["type",Uv]};function Yv(e,t,n){var i=Xm(e,n);if(E(t,"bpmn:TextAnnotation"))return KM(e,t,i);if(Ve(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return XM(e,t,i);if(E(t,"bpmn:FlowNode"))return qM(e,t,i)}function qM(e,t,n){var i=Ae(e),r=Ie(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},a=jM(e,{filter:function(d){return E(d,"bpmn:SequenceFlow")},direction:o.directionHint}),s=30,c=o.minDistance,u=o.baseOrientation;E(e,"bpmn:BoundaryEvent")&&(u=nn(e,e.host,-25),u.indexOf(o.boundaryOrientation)!==-1&&(s*=-1));var l=n?{x:i.right+a+t.width/2,y:r.y+qv(u,c,o)}:{x:r.x+qv(u,c,o),y:i.bottom+a+t.height/2},f={margin:s,minDistance:c},p=n?{y:f}:{x:f};return bf(e,t,l,xf(p))}function qv(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function KM(e,t,n){var i=Ae(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};ct(e)&&(r=Ie(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},a=n?{y:o}:{x:o};return bf(e,t,r,xf(a))}function XM(e,t,n){var i=Ae(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 bf(e,t,r,xf(a))}function Kv(e,t){e.on("autoPlace",function(n){var i=n.shape,r=n.source;return Yv(r,i,t)})}Kv.$inject=["eventBus","elementRegistry"];const Wc={__depends__:[YM],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",Kv]},Xv=[qm,ha,vf,Wc];function ZM(e={}){Vd(globalThis,e.dom);const t=document.createElement("div");return document.body.appendChild(t),new yo({container:t,moddleExtensions:e.moddleExtensions??ms,additionalModules:[...Xv,...e.additionalModules??[]]})}var QM=new ko("ov"),JM=500;function Jt(e,t,n,i){this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=QM,this._overlayDefaults=V({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=e2(n.getContainer()),this._init()}Jt.$inject=["config.overlays","eventBus","canvas","elementRegistry"],Jt.prototype.get=function(e){if(Pn(e)&&(e={id:e}),Pn(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Ue(t.overlays,io({type:e.type})):t.overlays.slice():[]}else return e.type?Ue(this._overlays,io({type:e.type})):e.id?this._overlays[e.id]:null},Jt.prototype.add=function(e,t,n){if(Yt(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=V({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},Jt.prototype.remove=function(e){var t=this.get(e)||[];Le(t)||(t=[t]);var n=this;$(t,function(i){var r=n._getOverlayContainer(i.element,!0);if(i&&(gi(i.html),gi(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)}})},Jt.prototype.isShown=function(){return this._overlayRoot.style.display!=="none"},Jt.prototype.show=function(){Uc(this._overlayRoot)},Jt.prototype.hide=function(){Uc(this._overlayRoot,!1)},Jt.prototype.clear=function(){this._overlays={},this._overlayContainers=[],Ts(this._overlayRoot)},Jt.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=It(t);i=o.x,r=o.y}Zv(n,i,r),dn(e.html,"data-container-id",t.id)},Jt.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=It(i).width:a=i.width,r=t.right*-1+a}if(t.bottom!==void 0){var s;i.waypoints?s=It(i).height:s=i.height,o=t.bottom*-1+s}Zv(n,r||0,o||0),this._updateOverlayVisibilty(e,this._canvas.viewbox())},Jt.prototype._createOverlayContainer=function(e){var t=yt('<div class="djs-overlays" />');_n(t,{position:"absolute"}),this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},Jt.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Qv(this._overlayRoot,n)},Jt.prototype._getOverlayContainer=function(e,t){var n=ft(this._overlayContainers,function(i){return i.element===e});return!n&&!t?this._createOverlayContainer(e):n},Jt.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)),Pn(i)&&(i=yt(i)),o=this._getOverlayContainer(n),r=yt('<div class="djs-overlay" data-overlay-id="'+t+'">'),_n(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();Uc(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())},Jt.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=this._canvas.findRoot(e.element),r=n&&n.minZoom,o=n&&n.maxZoom,a=e.htmlContainer,s=this._canvas.getRootElement(),c=!0;(i!==s||n&&(Ht(r)&&r>t.scale||Ht(o)&&o<t.scale))&&(c=!1),Uc(a,c),this._updateOverlayScale(e,t)},Jt.prototype._updateOverlayScale=function(e,t){var n=e.scale,i,r,o=e.htmlContainer,a,s="";n!==!0&&(n===!1?(i=1,r=1):(i=n.min,r=n.max),Ht(i)&&t.scale<i&&(a=(1/t.scale||1)*i),Ht(r)&&t.scale>r&&(a=(1/t.scale||1)*r)),Ht(a)&&(s="scale("+a+","+a+")"),Qv(o,s)},Jt.prototype._updateOverlaysVisibilty=function(e){var t=this;$(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},Jt.prototype._init=function(){var e=this._eventBus,t=this;function n(i){t._updateRoot(i),t._updateOverlaysVisibilty(i),t.show()}e.on("canvas.viewbox.changing",function(i){t.hide()}),e.on("canvas.viewbox.changed",function(i){n(i.viewbox)}),e.on(["shape.remove","connection.remove"],function(i){var r=i.element,o=t.get({element:r});$(o,function(c){t.remove(c.id)});var a=t._getOverlayContainer(r);if(a){gi(a.html);var s=t._overlayContainers.indexOf(a);s!==-1&&t._overlayContainers.splice(s,1)}}),e.on("element.changed",JM,function(i){var r=i.element,o=t._getOverlayContainer(r,!0);o&&($(o.overlays,function(a){t._updateOverlay(a)}),t._updateOverlayContainer(o))}),e.on("element.marker.update",function(i){var r=t._getOverlayContainer(i.element,!0);r&&_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 e2(e){var t=yt('<div class="djs-overlay-container" />');return _n(t,{position:"absolute",width:0,height:0}),e.insertBefore(t,e.firstChild),t}function Zv(e,t,n){_n(e,{left:t+"px",top:n+"px"})}function Uc(e,t){e.style.display=t===!1?"none":""}function Qv(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}const Yc={__init__:["overlays"],overlays:["type",Jt]};function wf(e,t){t.invoke(te,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)})}xe(wf,te),wf.$inject=["canvas","injector"];const t2={__init__:["rootElementsBehavior"],rootElementsBehavior:["type",wf]};function ja(e){return CSS.escape(e)}var n2={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function Jv(e){return e=""+e,e&&e.replace(/[&<>"']/g,function(t){return n2[t]})}var i2="bjs-breadcrumbs-shown";function eb(e,t,n){var i=yt('<ul class="bjs-breadcrumbs"></ul>'),r=n.getContainer(),o=_t(r);r.appendChild(i);var a=[];e.on("element.changed",function(c){var u=c.element,l=ie(u),f=ft(a,function(p){return p===l});f&&s()});function s(c){c&&(a=r2(c));var u=a.flatMap(function(f){var p=n.findRoot(_i(f))||n.findRoot(f.id);if(!p&&E(f,"bpmn:Process")){var d=t.find(function(g){var y=ie(g);return y&&y.get("processRef")===f});p=d&&n.findRoot(d.id)}if(!p)return[];var m=Jv(f.name||f.id),h=yt('<li><span class="bjs-crumb"><a title="'+m+'">'+m+"</a></span></li>");return h.addEventListener("click",function(){n.setRootElement(p)}),h});i.innerHTML="";var l=u.length>1;o.toggle(i2,l),u.forEach(function(f){i.appendChild(f)})}e.on("root.set",function(c){s(c.element)})}eb.$inject=["eventBus","elementRegistry","canvas"];function r2(e){for(var t=ie(e),n=[],i=t;i;i=i.$parent)(E(i,"bpmn:SubProcess")||E(i,"bpmn:Process"))&&n.push(i);return n.reverse()}function tb(e,t){var n=null,i=new o2;e.on("root.set",function(r){var o=r.element,a=t.viewbox(),s=i.get(o);if(i.set(n,{x:a.x,y:a.y,zoom:a.scale}),n=o,!(!E(o,"bpmn:SubProcess")&&!s)){s=s||{x:0,y:0,zoom:1};var c=(a.x-s.x)*a.scale,u=(a.y-s.y)*a.scale;(c!==0||u!==0)&&t.scroll({dx:c,dy:u}),s.zoom!==a.scale&&t.zoom(s.zoom,{x:0,y:0})}}),e.on("diagram.clear",function(){i.clear(),n=null})}tb.$inject=["eventBus","canvas"];function o2(){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 nb={x:180,y:160};function Vr(e,t){this._eventBus=e,this._moddle=t;var n=this;e.on("import.render.start",1500,function(i,r){n._handleImport(r.definitions)})}Vr.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)})}},Vr.prototype._createNewDiagrams=function(e){var t=this,n=[],i=[];e.get("planeElement").forEach(function(o){var a=o.bpmnElement;if(a){var s=a.$parent;E(a,"bpmn:SubProcess")&&!o.isExpanded&&n.push(a),s2(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},Vr.prototype._movePlaneElementsToOrigin=function(e){var t=e.get("planeElement"),n=a2(e),i={x:n.x-nb.x,y:n.y-nb.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)})},Vr.prototype._moveToDiPlane=function(e,t){var n=ib(e),i=n.plane.get("planeElement");i.splice(i.indexOf(e),1),t.get("planeElement").push(e)},Vr.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},Vr.$inject=["eventBus","moddle"];function ib(e){return E(e,"bpmndi:BPMNDiagram")?e:ib(e.$parent)}function a2(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=Ae(n.bounds);t.top=Math.min(i.top,t.top),t.left=Math.min(i.left,t.left)}}),$s(t)}function s2(e,t){var n=e.$parent;return!(!E(n,"bpmn:SubProcess")||n===t.bpmnElement||Ve(e,["bpmn:DataInputAssociation","bpmn:DataOutputAssociation"]))}var qc=250,c2='<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>',u2="bjs-drilldown-empty";function yr(e,t,n,i,r){te.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",qc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.reverted("shape.toggleCollapse",qc,function(a){var s=a.shape;o._canDrillDown(s)?o._addOverlay(s):o._removeOverlay(s)},!0),this.executed(["shape.create","shape.move","shape.delete"],qc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),this.reverted(["shape.create","shape.move","shape.delete"],qc,function(a){var s=a.oldParent,c=a.newParent||a.parent,u=a.shape;o._canDrillDown(u)&&o._addOverlay(u),o._updateDrilldownOverlay(s),o._updateDrilldownOverlay(c),o._updateDrilldownOverlay(u)},!0),t.on("import.render.complete",function(){n.filter(function(a){return o._canDrillDown(a)}).map(function(a){o._addOverlay(a)})})}xe(yr,te),yr.prototype._updateDrilldownOverlay=function(e){var t=this._canvas;if(e){var n=t.findRoot(e);n&&this._updateOverlayVisibility(n)}},yr.prototype._canDrillDown=function(e){var t=this._canvas;return E(e,"bpmn:SubProcess")&&t.findRoot(_i(e))},yr.prototype._updateOverlayVisibility=function(e){var t=this._overlays,n=ie(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(u2,!r)}},yr.prototype._addOverlay=function(e){var t=this._canvas,n=this._overlays,i=ie(e),r=n.get({element:e,type:"drilldown"});r.length&&this._removeOverlay(e);var o=yt('<button type="button" class="bjs-drilldown">'+c2+"</button>"),a=i.get("name")||i.get("id"),s=this._translate("Open {element}",{element:a});o.setAttribute("title",s),o.addEventListener("click",function(){t.setRootElement(t.findRoot(_i(e)))}),n.add(e,"drilldown",{position:{bottom:-7,right:-8},html:o}),this._updateOverlayVisibility(e)},yr.prototype._removeOverlay=function(e){var t=this._overlays;t.remove({element:e,type:"drilldown"})},yr.$inject=["canvas","eventBus","elementRegistry","overlays","translate"];const l2={__depends__:[Yc,ef,t2],__init__:["drilldownBreadcrumbs","drilldownOverlayBehavior","drilldownCentering","subprocessCompatibility"],drilldownBreadcrumbs:["type",eb],drilldownCentering:["type",tb],drilldownOverlayBehavior:["type",yr],subprocessCompatibility:["type",Vr]};function vr(e){wt.call(this,e)}xe(vr,wt),vr.prototype._modules=[qm,l2,Yc,Jn,ha],vr.prototype._moddleExtensions={};var Kc="keyboard.keydown",p2="keyboard.keyup",f2=1e3,rb="Keyboard binding is now implicit; explicit binding to an element got removed. For more information, see https://github.com/bpmn-io/diagram-js/issues/661";function wn(e,t){var n=this;this._config=e=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),e.bindTo&&console.error("unsupported configuration <keyboard.bindTo>",new Error(rb));var i=e&&e.bind!==!1;t.on("canvas.init",function(r){n._target=r.svg,i&&n.bind(),n._fire("init")})}wn.$inject=["config.keyboard","eventBus"],wn.prototype._keydownHandler=function(e){this._keyHandler(e,Kc)},wn.prototype._keyupHandler=function(e){this._keyHandler(e,p2)},wn.prototype._keyHandler=function(e,t){var n;if(!this._isEventIgnored(e)){var i={keyEvent:e};n=this._eventBus.fire(t||Kc,i),n&&e.preventDefault()}},wn.prototype._isEventIgnored=function(e){return!1},wn.prototype.bind=function(e){e&&console.error("unsupported argument <node>",new Error(rb)),this.unbind(),e=this._node=this._target,$e.bind(e,"keydown",this._keydownHandler),$e.bind(e,"keyup",this._keyupHandler),this._fire("bind")},wn.prototype.getBinding=function(){return this._node},wn.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),$e.unbind(e,"keydown",this._keydownHandler),$e.unbind(e,"keyup",this._keyupHandler)),this._node=null},wn.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},wn.prototype.addListener=function(e,t,n){qt(e)&&(n=t,t=e,e=f2),this._eventBus.on(n||Kc,e,t)},wn.prototype.removeListener=function(e,t){this._eventBus.off(t||Kc,e)},wn.prototype.hasModifier=DA,wn.prototype.isCmd=Ln,wn.prototype.isShift=Gp,wn.prototype.isKey=Vt;var d2=500;function Io(e,t){var n=this;e.on("editorActions.init",d2,function(i){var r=i.editorActions;n.registerBindings(t,r)})}Io.$inject=["eventBus","keyboard"],Io.prototype.registerBindings=function(e,t){function n(i,r){t.isRegistered(i)&&e.addListener(r)}n("undo",function(i){var r=i.keyEvent;if($A(r))return t.trigger("undo"),!0}),n("redo",function(i){var r=i.keyEvent;if(FA(r))return t.trigger("redo"),!0}),n("copy",function(i){var r=i.keyEvent;if(LA(r))return t.trigger("copy"),!0}),n("paste",function(i){var r=i.keyEvent;if(IA(r))return t.trigger("paste"),!0}),n("duplicate",function(i){var r=i.keyEvent;if(BA(r))return t.trigger("duplicate"),!0}),n("cut",function(i){var r=i.keyEvent;if(NA(r))return t.trigger("cut"),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Vt(["+","Add","="],r)&&Ln(r))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(i){var r=i.keyEvent;if(Vt(["-","Subtract"],r)&&Ln(r))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(i){var r=i.keyEvent;if(Vt("0",r)&&Ln(r))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(i){var r=i.keyEvent;if(Vt(["Backspace","Delete","Del"],r))return t.trigger("removeSelection"),!0})};const Ef={__init__:["keyboard","keyboardBindings"],keyboard:["type",wn],keyboardBindings:["type",Io]};var h2={moveSpeed:50,moveSpeedAccelerated:200};function ob(e,t,n){var i=this;this._config=V({},h2,e||{}),t.addListener(r);function r(o){var a=o.keyEvent,s=i._config;if(t.isCmd(a)&&t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],a)){var c=t.isShift(a)?s.moveSpeedAccelerated:s.moveSpeed,u;switch(a.key){case"ArrowLeft":case"Left":u="left";break;case"ArrowUp":case"Up":u="up";break;case"ArrowRight":case"Right":u="right";break;case"ArrowDown":case"Down":u="down";break}return i.moveCanvas({speed:c,direction:u}),!0}}this.moveCanvas=function(o){var a=0,s=0,c=o.speed,u=c/Math.min(Math.sqrt(n.viewbox().scale),1);switch(o.direction){case"left":a=u;break;case"up":s=u;break;case"right":a=-u;break;case"down":s=-u;break}n.scroll({dx:a,dy:s})}}ob.$inject=["config.keyboardMove","keyboard","canvas"];const ab={__depends__:[Ef],__init__:["keyboardMove"],keyboardMove:["type",ob]};var m2=15;function sb(e,t){var n;function i(s){return a(s.originalEvent)}e.on("canvas.focus.changed",function(s){s.focused?e.on("element.mousedown",500,i):e.off("element.mousedown",i)});function r(s){var c=n.start,u=n.button,l=$r(s),f=ui(l,c);if(!n.dragging&&g2(f)>m2&&(n.dragging=!0,u===0&&Ly(e),wc("grab")),n.dragging){var p=n.last||n.start;f=ui(l,p),t.scroll({dx:f.x,dy:f.y}),n.last=l}s.preventDefault()}function o(s){$e.unbind(document,"mousemove",r),$e.unbind(document,"mouseup",o),n=null,Dy()}function a(s){if(!Or(s.target,".djs-draggable")){var c=s.button;if(!(c>=2||s.ctrlKey||s.shiftKey||s.altKey))return n={button:c,start:$r(s)},$e.bind(document,"mousemove",r),$e.bind(document,"mouseup",o),!0}}this.isActive=function(){return!!n}}sb.$inject=["eventBus","canvas"];function g2(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}const cb={__init__:["moveCanvas"],moveCanvas:["type",sb]};function ub(e,t){var n=jl(e.min),i=jl(e.max),r=Math.abs(n)+Math.abs(i);return r/t}function y2(e,t){return Math.max(e.min,Math.min(e.max,t))}var v2=Math.sign||function(e){return e>=0?1:-1},Sf={min:.2,max:4},lb=10,b2=.1,x2=.75;function Si(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Sn(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||x2;var i=this;t.on("canvas.mouseover",function(){i._init(e.enabled!==!1)}),t.on("canvas.mouseout",function(){i._init(!1)})}Si.$inject=["config.zoomScroll","eventBus","canvas"],Si.prototype.scroll=function(t){this._canvas.scroll(t)},Si.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Si.prototype.zoom=function(t,n){var i=ub(Sf,lb*2);this._totalDelta+=t,Math.abs(this._totalDelta)>b2&&(this._zoom(t,n,i),this._totalDelta=0)},Si.prototype._handleWheel=function(t){if(this._enabled){var n=this._container;t.preventDefault();var i=t.ctrlKey||Hg()&&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))*v2(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)}},Si.prototype.stepZoom=function(t,n){var i=ub(Sf,lb);this._zoom(t,n,i)},Si.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=jl(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(y2(Sf,s),t)},Si.prototype.toggle=function(t){var n=this._container,i=this._handleWheel,r=this._enabled;return typeof t>"u"&&(t=!r),r!==t&&$e[t?"bind":"unbind"](n,"wheel",i,!1),this._enabled=t,t},Si.prototype._init=function(e){this.toggle(e)};const pb={__init__:["zoomScroll"],zoomScroll:["type",Si]};function Ha(e){vr.call(this,e)}xe(Ha,vr),Ha.prototype._navigationModules=[ab,cb,pb],Ha.prototype._modules=[].concat(vr.prototype._modules,Ha.prototype._navigationModules);function Rf(e){return e&&e[e.length-1]}function fb(e){return e.y}function db(e){return e.x}var _2={left:db,center:db,right:function(e){return e.x+e.width},top:fb,middle:fb,bottom:function(e){return e.y+e.height}};function Bo(e,t){this._modeling=e,this._rules=t}Bo.$inject=["modeling","rules"],Bo.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}},Bo.prototype._isType=function(e,t){return t.indexOf(e)!==-1},Bo.prototype._alignmentPosition=function(e,t){var n=this._getOrientationDetails(e),i=n.axis,r=n.dimension,o={},a={},s=!1,c,u,l;function f(p,d){return Math.round((p[i]+d[i]+d[r])/2)}if(this._isType(e,["left","top"]))o[e]=t[0][i];else if(this._isType(e,["right","bottom"]))l=Rf(t),o[e]=l[i]+l[r];else if(this._isType(e,["center","middle"])){if($(t,function(p){var d=p[i]+Math.round(p[r]/2);a[d]?a[d].elements.push(p):a[d]={elements:[p],center:d}}),c=pi(a,function(p){return p.elements.length>1&&(s=!0),p.elements.length}),s)return o[e]=Rf(c).center,o;u=t[0],t=pi(t,function(p){return p[i]+p[r]}),l=Rf(t),o[e]=f(u,l)}return o},Bo.prototype.trigger=function(e,t){var n=this._modeling,i,r=Ue(e,function(c){return!(c.waypoints||c.host||c.labelTarget)});if(i=this._rules.allowed("elements.align",{elements:r}),Le(i)&&(r=i),!(r.length<2||!i)){var o=_2[t],a=pi(r,o),s=this._alignmentPosition(t,a);n.alignElements(a,s)}};const w2={__init__:["alignElements"],alignElements:["type",Bo]},E2=new ko;function No(e){this._scheduled={},e.on("diagram.destroy",()=>{Object.keys(this._scheduled).forEach(t=>{this.cancel(t)})})}No.$inject=["eventBus"],No.prototype.schedule=function(e,t=E2.next()){this.cancel(t);const n=this._schedule(e,t);return this._scheduled[t]=n,n.promise},No.prototype._schedule=function(e,t){const n=S2();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}},No.prototype.cancel=function(e){const t=this._scheduled[e];t&&(this._cancel(t),this._scheduled[e]=null)},No.prototype._cancel=function(e){clearTimeout(e.executionId)};function S2(){const e={};return e.promise=new Promise((t,n)=>{e.resolve=t,e.reject=n}),e}const R2={scheduler:["type",No]};var C2="djs-element-hidden",Xc=".entry",P2=1e3,hb=8,A2=300;function Nt(e,t,n,i){this._canvas=e,this._elementRegistry=t,this._eventBus=n,this._scheduler=i,this._current=null,this._init()}Nt.$inject=["canvas","elementRegistry","eventBus","scheduler"],Nt.prototype._init=function(){var e=this;this._eventBus.on("selection.changed",function(t){var n=t.newSelection,i=n.length?n.length===1?n[0]:n:null;i?e.open(i,!0):e.close()}),this._eventBus.on("elements.changed",function(t){var n=t.elements,i=e._current;if(i){var r=i.target,o=Le(r)?r:[r],a=o.filter(function(c){return n.includes(c)});if(a.length){e.close();var s=o.filter(function(c){return e._elementRegistry.get(c.id)});s.length&&e._updateAndOpen(s.length>1?s:s[0])}}}),this._eventBus.on("canvas.viewbox.changed",function(){e._updatePosition()}),this._eventBus.on("element.marker.update",function(t){if(e.isOpen()){var n=t.element,i=e._current,r=Le(i.target)?i.target:[i.target];r.includes(n)&&e._updateVisibility()}}),this._container=this._createContainer()},Nt.prototype._createContainer=function(){var e=yt('<div class="djs-context-pad-parent"></div>');return this._canvas.getContainer().appendChild(e),e},Nt.prototype.registerProvider=function(e,t){t||(t=e,e=P2),this._eventBus.on("contextPad.getProviders",e,function(n){n.providers.push(t)})},Nt.prototype.getEntries=function(e){var t=this._getProviders(),n=Le(e)?"getMultiElementContextPadEntries":"getContextPadEntries",i={};return $(t,function(r){if(qt(r[n])){var o=r[n](e);qt(o)?i=o(i):$(o,function(a,s){i[s]=a})}}),i},Nt.prototype.trigger=function(e,t,n){var i=this,r,o,a=t.delegateTarget||t.target;if(!a)return t.preventDefault();if(r=dn(a,"data-action"),o=t.originalEvent||t,e==="mouseover"){this._timeout=setTimeout(function(){i._mouseout=i.triggerEntry(r,"hover",o,n)},A2);return}else if(e==="mouseout"){clearTimeout(this._timeout),this._mouseout&&(this._mouseout(),this._mouseout=null);return}return this.triggerEntry(r,e,o,n)},Nt.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(qt(s)){if(t==="click")return s(n,r,i)}else if(s[t])return s[t](n,r,i);n.preventDefault()}}}},Nt.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))}},Nt.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"contextPad.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Nt.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this._createHtml(e),i;$(t,function(r,o){var a=r.group||"default",s=yt(r.html||'<div class="entry" draggable="true"></div>'),c;dn(s,"data-action",o),c=at("[data-group="+ja(a)+"]",n),c||(c=yt('<div class="group"></div>'),dn(c,"data-group",a),n.appendChild(c)),c.appendChild(s),r.className&&T2(s,r.className),r.title&&dn(s,"title",r.title),r.imageUrl&&(i=yt("<img>"),dn(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})},Nt.prototype._createHtml=function(e){var t=this,n=yt('<div class="djs-context-pad"></div>');return kn.bind(n,Xc,"click",function(i){t.trigger("click",i)}),kn.bind(n,Xc,"dragstart",function(i){t.trigger("dragstart",i)}),kn.bind(n,Xc,"mouseover",function(i){t.trigger("mouseover",i)}),kn.bind(n,Xc,"mouseout",function(i){t.trigger("mouseout",i)}),$e.bind(n,"mousedown",function(i){i.stopPropagation()}),this._container.appendChild(n),this._eventBus.fire("contextPad.create",{target:e,pad:n}),n},Nt.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()&&k2(this._current.target,e)?t=this._current.html:t=this._createHtml(e),{html:t}},Nt.prototype.close=function(){this.isOpen()&&(clearTimeout(this._timeout),this._container.innerHTML="",this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Nt.prototype.isOpen=function(e){var t=this._current;if(!t)return!1;if(!e)return!0;var n=t.target;return Le(e)!==Le(n)?!1:Le(e)?e.length===n.length&&Ar(e,function(i){return n.includes(i)}):n===e},Nt.prototype.isShown=function(){return this.isOpen()&&_t(this._current.html).has("open")},Nt.prototype.show=function(){this.isOpen()&&(_t(this._current.html).add("open"),this._updatePosition(),this._eventBus.fire("contextPad.show",{current:this._current}))},Nt.prototype.hide=function(){this.isOpen()&&(_t(this._current.html).remove("open"),this._eventBus.fire("contextPad.hide",{current:this._current}))},Nt.prototype._getPosition=function(e){if(!Le(e)&&ct(e)){var t=this._canvas.viewbox(),n=M2(e),i=n.x*t.scale-t.x*t.scale,r=n.y*t.scale-t.y*t.scale;return{left:i+hb*this._canvas.zoom(),top:r}}var o=this._canvas.getContainer(),a=o.getBoundingClientRect(),s=this._getTargetBounds(e);return{left:s.right-a.left+hb*this._canvas.zoom(),top:s.top-a.top}},Nt.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")},Nt.prototype._updateVisibility=function(){const e=()=>{if(this.isOpen()){var t=this,n=this._current.target,i=Le(n)?n:[n],r=i.some(function(o){return t._canvas.hasMarker(o,C2)});r?t.hide():t.show()}};this._scheduler.schedule(e,"ContextPad#_updateVisibility")},Nt.prototype._getTargetBounds=function(e){var t=this,n=Le(e)?e:[e],i=n.map(function(r){return t._canvas.getGraphics(r)});return i.reduce(function(r,o){const a=o.getBoundingClientRect();return r.top=Math.min(r.top,a.top),r.right=Math.max(r.right,a.right),r.bottom=Math.max(r.bottom,a.bottom),r.left=Math.min(r.left,a.left),r.x=r.left,r.y=r.top,r.width=r.right-r.left,r.height=r.bottom-r.top,r},{top:1/0,right:-1/0,bottom:-1/0,left:1/0})};function T2(e,t){var n=_t(e);t=Le(t)?t:t.split(/\s+/g),t.forEach(function(i){n.add(i)})}function M2(e){return e.waypoints[e.waypoints.length-1]}function k2(e,t){return e=Le(e)?e:[e],t=Le(t)?t:[t],e.length===t.length&&Ar(e,function(n){return t.includes(n)})}const mb={__depends__:[_c,R2,Yc],contextPad:["type",Nt]};var Zc,St,gb,br,yb,vb,bb,Cf,Qc,za,xb,Pf,Af,Tf,Jc={},eu=[],O2=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,tu=Array.isArray;function Gi(e,t){for(var n in t)e[n]=t[n];return e}function Mf(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function _b(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?Zc.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 nu(e,a,i,r,null)}function nu(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??++gb,__i:-1,__u:0};return r==null&&St.vnode!=null&&St.vnode(o),o}function iu(e){return e.children}function ru(e,t){this.props=e,this.context=t}function Wr(e,t){if(t==null)return e.__?Wr(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"?Wr(e):null}function D2(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,i=[],r=[],o=Gi({},t);o.__v=t.__v+1,St.vnode&&St.vnode(o),kf(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,i,n??Wr(t),!!(32&t.__u),r),o.__v=t.__v,o.__.__k[o.__i]=o,Tb(i,o,r),t.__e=t.__=null,o.__e!=n&&wb(o)}}function wb(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}),wb(e)}function Eb(e){(!e.__d&&(e.__d=!0)&&br.push(e)&&!ou.__r++||yb!=St.debounceRendering)&&((yb=St.debounceRendering)||vb)(ou)}function ou(){try{for(var e,t=1;br.length;)br.length>t&&br.sort(bb),e=br.shift(),t=br.length,D2(e)}finally{br.length=ou.__r=0}}function Sb(e,t,n,i,r,o,a,s,c,u,l){var f,p,d,m,h,g,y=i&&i.__k||eu,v=t.length;for(c=L2(n,t,y,c,v),f=0;f<v;f++)(d=n.__k[f])!=null&&(p=d.__i!=-1&&y[d.__i]||Jc,d.__i=f,g=kf(e,d,p,r,o,a,s,c,u,l),m=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&Of(p.ref,null,d),l.push(d.ref,d.__c||m,d)),h==null&&m!=null&&(h=m),4&d.__u?(c=Rb(d,c,e),p.__e&&(p.__e=null)):typeof d.type=="function"&&g!==void 0?c=g:m&&(c=m.nextSibling),d.__u&=-7);return n.__e=h,c}function L2(e,t,n,i,r){var o,a,s,c,u,l=n.length,f=l,p=0;for(e.__k=new Array(r),o=0;o<r;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[o]=nu(null,a,null,null,null):tu(a)?a=e.__k[o]=nu(iu,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[o]=nu(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[o]=a,c=o+p,a.__=e,a.__b=e.__b+1,s=null,(u=a.__i=I2(a,n,c,f))!=-1&&(f--,(s=n[u])&&(s.__u|=2)),s==null||s.__v==null?(u==-1&&(r>l?p--:r<l&&p++),typeof a.type!="function"&&(a.__u|=4)):u!=c&&(u==c-1?p--:u==c+1?p++:(u>c?p--:p++,a.__u|=4))):e.__k[o]=null;if(f)for(o=0;o<l;o++)(s=n[o])!=null&&(2&s.__u)==0&&(s.__e==i&&(i=Wr(s)),kb(s,s));return i}function Rb(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=Rb(i[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=Wr(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function I2(e,t,n,i){var r,o,a,s=e.key,c=e.type,u=t[n],l=u!=null&&(2&u.__u)==0;if(u===null&&s==null||l&&s==u.key&&c==u.type)return n;if(i>(l?1:0)){for(r=n-1,o=n+1;r>=0||o<t.length;)if((u=t[a=r>=0?r--:o++])!=null&&(2&u.__u)==0&&s==u.key&&c==u.type)return a}return-1}function Cb(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||O2.test(t)?n:n+"px"}function au(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||Cb(e.style,t,"");if(n)for(t in n)i&&n[t]==i[t]||Cb(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(xb,"$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[za]=i[za]:(n[za]=Pf,e.addEventListener(t,o?Tf:Af,o)):e.removeEventListener(t,o?Tf:Af,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 Pb(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Qc]==null)t[Qc]=Pf++;else if(t[Qc]<n[za])return;return n(St.event?St.event(t):t)}}}function kf(e,t,n,i,r,o,a,s,c,u){var l,f,p,d,m,h,g,y,v,b,x,C,P,D,T,I,k=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[s=t.__e=n.__e]),(l=St.__b)&&l(t);e:if(typeof k=="function"){f=a.length;try{if(v=t.props,b=k.prototype&&k.prototype.render,x=(l=k.contextType)&&i[l.__c],C=l?x?x.props.value:l.__:i,n.__c?y=(p=t.__c=n.__c).__=p.__E:(b?t.__c=p=new k(v,C):(t.__c=p=new ru(v,C),p.constructor=k,p.render=N2),x&&x.sub(p),p.state||(p.state={}),p.__n=i,d=p.__d=!0,p.__h=[],p._sb=[]),b&&p.__s==null&&(p.__s=p.state),b&&k.getDerivedStateFromProps!=null&&(p.__s==p.state&&(p.__s=Gi({},p.__s)),Gi(p.__s,k.getDerivedStateFromProps(v,p.__s))),m=p.props,h=p.state,p.__v=t,d)b&&k.getDerivedStateFromProps==null&&p.componentWillMount!=null&&p.componentWillMount(),b&&p.componentDidMount!=null&&p.__h.push(p.componentDidMount);else{if(b&&k.getDerivedStateFromProps==null&&v!==m&&p.componentWillReceiveProps!=null&&p.componentWillReceiveProps(v,C),t.__v==n.__v||!p.__e&&p.shouldComponentUpdate!=null&&p.shouldComponentUpdate(v,p.__s,C)===!1){t.__v!=n.__v&&(p.props=v,p.state=p.__s,p.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(L){L&&(L.__=t)}),eu.push.apply(p.__h,p._sb),p._sb=[],p.__h.length&&a.push(p),s=Wr(n);break e}p.componentWillUpdate!=null&&p.componentWillUpdate(v,p.__s,C),b&&p.componentDidUpdate!=null&&p.__h.push(function(){p.componentDidUpdate(m,h,g)})}if(p.context=C,p.props=v,p.__P=e,p.__e=!1,P=St.__r,D=0,b)p.state=p.__s,p.__d=!1,P&&P(t),l=p.render(p.props,p.state,p.context),eu.push.apply(p.__h,p._sb),p._sb=[];else do p.__d=!1,P&&P(t),l=p.render(p.props,p.state,p.context),p.state=p.__s;while(p.__d&&++D<25);p.state=p.__s,p.getChildContext!=null&&(i=Gi(Gi({},i),p.getChildContext())),b&&!d&&p.getSnapshotBeforeUpdate!=null&&(g=p.getSnapshotBeforeUpdate(m,h)),T=l!=null&&l.type===iu&&l.key==null?Mb(l.props.children):l,s=Sb(e,tu(T)?T:[T],t,n,i,r,o,a,s,c,u),p.base=t.__e,t.__u&=-161,p.__h.length&&a.push(p),y&&(p.__E=p.__=null)}catch(L){if(a.length=f,t.__v=null,c||o!=null){if(L.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o!=null&&(o[o.indexOf(s)]=null),t.__e=s}else if(o!=null)for(I=o.length;I--;)Mf(o[I])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),L.then||Ab(t),St.__e(L,t,n)}}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=B2(n.__e,t,n,i,r,o,a,c,u);return(l=St.diffed)&&l(t),128&t.__u?void 0:s}function Ab(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Ab))}function Tb(e,t,n){for(var i=0;i<n.length;i++)Of(n[i],n[++i],n[++i]);St.__c&&St.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(o){o.call(r)})}catch(o){St.__e(o,r.__v)}})}function Mb(e){return typeof e!="object"||e==null||e.__b>0?e:tu(e)?e.map(Mb):e.constructor!==void 0?null:Gi({},e)}function B2(e,t,n,i,r,o,a,s,c){var u,l,f,p,d,m,h,g=n.props||Jc,y=t.props,v=t.type;if(v=="svg"?r="http://www.w3.org/2000/svg":v=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),o!=null){for(u=0;u<o.length;u++)if((d=o[u])&&"setAttribute"in d==!!v&&(v?d.localName==v:d.nodeType==3)){e=d,o[u]=null;break}}if(e==null){if(v==null)return document.createTextNode(y);e=document.createElementNS(r,v,y.is&&y),s&&(St.__m&&St.__m(t,o),s=!1),o=null}if(v==null)g===y||s&&e.data==y||(e.data=y);else{if(o=v=="textarea"&&y.defaultValue!=null?null:o&&Zc.call(e.childNodes),!s&&o!=null)for(g={},u=0;u<e.attributes.length;u++)g[(d=e.attributes[u]).name]=d.value;for(u in g)d=g[u],u=="dangerouslySetInnerHTML"?f=d:u=="children"||u in y||u=="value"&&"defaultValue"in y||u=="checked"&&"defaultChecked"in y||au(e,u,null,d,r);for(u in y)d=y[u],u=="children"?p=d:u=="dangerouslySetInnerHTML"?l=d:u=="value"?m=d:u=="checked"?h=d:s&&typeof d!="function"||g[u]===d||au(e,u,d,g[u],r);if(l)s||f&&(l.__html==f.__html||l.__html==e.innerHTML)||(e.innerHTML=l.__html),t.__k=[];else if(f&&(e.innerHTML=""),Sb(t.type=="template"?e.content:e,tu(p)?p:[p],t,n,i,v=="foreignObject"?"http://www.w3.org/1999/xhtml":r,o,a,o?o[0]:n.__k&&Wr(n,0),s,c),o!=null)for(u=o.length;u--;)Mf(o[u]);s&&v!="textarea"||(u="value",v=="progress"&&m==null?e.removeAttribute("value"):m!=null&&(m!==e[u]||v=="progress"&&!m||v=="option"&&m!=g[u])&&au(e,u,m,g[u],r),u="checked",h!=null&&h!=e[u]&&au(e,u,h,g[u],r))}return e}function Of(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){St.__e(r,n)}}function kb(e,t,n){var i,r;if(St.unmount&&St.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||Of(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(o){St.__e(o,t)}i.base=i.__P=i.__n=null}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&kb(i[r],t,n||typeof e.type!="function");n||Mf(e.__e),e.__c=e.__=e.__e=void 0}function N2(e,t,n){return this.constructor(e,n)}function Ob(e,t,n){var i,r,o,a;t==document&&(t=document.documentElement),St.__&&St.__(e,t),r=(i=!1)?null:t.__k,o=[],a=[],kf(t,e=t.__k=_b(iu,null,[e]),r||Jc,Jc,t.namespaceURI,r?null:t.firstChild?Zc.call(t.childNodes):null,o,r?r.__e:t.firstChild,i,a),Tb(o,e,a),e.props.children=null}Zc=eu.slice,St={__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}},gb=0,ru.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Gi({},this.state),typeof e=="function"&&(e=e(Gi({},n),this.props)),e&&Gi(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Eb(this))},ru.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Eb(this))},ru.prototype.render=iu,br=[],vb=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,bb=function(e,t){return e.__v.__b-t.__v.__b},ou.__r=0,Cf=Math.random().toString(8),Qc="__d"+Cf,za="__a"+Cf,xb=/(PointerCapture)$|Capture$/i,Pf=0,Af=Pb(!1),Tf=Pb(!0);var Db=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,Db(e,s,n,["",null])),i.push(r),s[0]?t[0]|=2:(t[o-2]=0,t[o]=r)):i.push(s)}return i},Lb=new Map;function $2(e){var t=Lb.get(this);return t||(t=new Map,Lb.set(this,t)),(t=Db(this,t.get(e)||(t.set(e,t=(function(n){for(var i,r,o=1,a="",s="",c=[0],u=function(p){o===1&&(p||(a=a.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,p,a):o===3&&(p||a)?(c.push(3,p,a),o=2):o===2&&a==="..."&&p?c.push(4,p,0):o===2&&a&&!p?c.push(5,0,!0,a):o>=5&&((a||!p&&o===5)&&(c.push(o,0,a,r),o=6),p&&(c.push(o,p,0,r),o=6)),a=""},l=0;l<n.length;l++){l&&(o===1&&u(),u(l));for(var f=0;f<n[l].length;f++)i=n[l][f],o===1?i==="<"?(u(),c=[c],o=3):a+=i:o===4?a==="--"&&i===">"?(o=1,a=""):a=i+a[0]:s?i===s?s="":a+=i:i==='"'||i==="'"?s=i:i===">"?(u(),o=1):o&&(i==="="?(o=5,r=a,a=""):i==="/"&&(o<5||n[l][f+1]===">")?(u(),o===3&&(c=c[0]),o=c,(c=c[0]).push(2,0,o),o=0):i===" "||i===" "||i===`
11
+ `||i==="\r"?(u(),o=2):a+=i),o===3&&a==="!--"&&(o=4,c=c[0])}return u(),c})(e)),t),arguments,[])).length>1?t:t[0]}var lt=$2.bind(_b),$o,$t,Df,Ib,Ga=0,Bb=[],Wt=St,Nb=Wt.__b,$b=Wt.__r,Fb=Wt.diffed,jb=Wt.__c,Hb=Wt.unmount,zb=Wt.__;function su(e,t){Wt.__h&&Wt.__h($t,e,Ga||t),Ga=0;var n=$t.__H||($t.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function Lf(e){return Ga=1,F2(Vb,e)}function F2(e,t,n){var i=su($o++,2);if(i.t=e,!i.__c&&(i.__=[Vb(void 0,t),function(s){var c=i.__N?i.__N[0]:i.__[0],u=i.t(c,s);c!==u&&(i.__N=[u,i.__[1]],i.__c.setState({}))}],i.__c=$t,!$t.__f)){var r=function(s,c,u){if(!i.__c.__H)return!0;var l=!1,f=i.__c.props!==s;if(i.__c.__H.__.some(function(d){if(d.__N){l=!0;var m=d.__[0];d.__=d.__N,d.__N=void 0,m!==d.__[0]&&(f=!0)}}),o){var p=o.call(this,s,c,u);return l?p||f:p}return!l||f};$t.__f=!0;var o=$t.shouldComponentUpdate,a=$t.componentWillUpdate;$t.componentWillUpdate=function(s,c,u){if(this.__e){var l=o;o=void 0,r(s,c,u),o=l}a&&a.call(this,s,c,u)},$t.shouldComponentUpdate=r}return i.__N||i.__}function cu(e,t){var n=su($o++,3);!Wt.__s&&Nf(n.__H,t)&&(n.__=e,n.u=t,$t.__H.__h.push(n))}function If(e,t){var n=su($o++,4);!Wt.__s&&Nf(n.__H,t)&&(n.__=e,n.u=t,$t.__h.push(n))}function uu(e){return Ga=5,Vi(function(){return{current:e}},[])}function Vi(e,t){var n=su($o++,7);return Nf(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function Va(e,t){return Ga=8,Vi(function(){return e},t)}function j2(){for(var e;e=Bb.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(lu),t.__h.some(Bf),t.__h=[]}catch(n){t.__h=[],Wt.__e(n,e.__v)}}}Wt.__b=function(e){$t=null,Nb&&Nb(e)},Wt.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),zb&&zb(e,t)},Wt.__r=function(e){$b&&$b(e),$o=0;var t=($t=e.__c).__H;t&&(Df===$t?(t.__h=[],$t.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(lu),t.__h.some(Bf),t.__h=[],$o=0)),Df=$t},Wt.diffed=function(e){Fb&&Fb(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Bb.push(t)!==1&&Ib===Wt.requestAnimationFrame||((Ib=Wt.requestAnimationFrame)||H2)(j2)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Df=$t=null},Wt.__c=function(e,t){t.some(function(n){try{n.__h.some(lu),n.__h=n.__h.filter(function(i){return!i.__||Bf(i)})}catch(i){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Wt.__e(i,n.__v)}}),jb&&jb(e,t)},Wt.unmount=function(e){Hb&&Hb(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(i){try{lu(i)}catch(r){t=r}}),n.__H=void 0,t&&Wt.__e(t,n.__v))};var Gb=typeof requestAnimationFrame=="function";function H2(e){var t,n=function(){clearTimeout(i),Gb&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,35);Gb&&(t=requestAnimationFrame(n))}function lu(e){var t=$t,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),$t=t}function Bf(e){var t=$t;e.__c=e.__(),$t=t}function Nf(e,t){return!e||e.length!==t.length||t.some(function(n,i){return n!==e[i]})}function Vb(e,t){return typeof t=="function"?t(e):t}function z2(e){const{navigationStack:t,setNavigationStack:n}=e,i=Vi(()=>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 lt`
12
12
  <div class="djs-popup-breadcrumbs">
13
- ${r&&ct`
13
+ ${r&&lt`
14
14
  <button
15
15
  type="button"
16
16
  class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--back"
@@ -23,7 +23,7 @@
23
23
  </svg>
24
24
  </button>
25
25
  `}
26
- ${i.map((a,s)=>ct`
26
+ ${i.map((a,s)=>lt`
27
27
  <button
28
28
  key=${s}
29
29
  type="button"
@@ -35,22 +35,22 @@
35
35
  </button>
36
36
  <span class="djs-popup-breadcrumbs-item--separator" aria-hidden="true"></span>
37
37
  `)}
38
- ${o&&ct`
38
+ ${o&&lt`
39
39
  <span class="djs-popup-breadcrumbs-item djs-popup-breadcrumbs-item--current" title=${o}>
40
40
  ${o}
41
41
  </span>
42
42
  `}
43
43
  </div>
44
- `}function zb(e){var t,n,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=zb(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function cu(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=zb(e))&&(i&&(i+=" "),i+=t);return i}function F2(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Gi(()=>j2(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return ct`
44
+ `}function Wb(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=Wb(e[t]))&&(i&&(i+=" "),i+=n)}else for(n in e)e[n]&&(i&&(i+=" "),i+=n);return i}function pu(){for(var e,t,n=0,i="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=Wb(e))&&(i&&(i+=" "),i+=t);return i}function G2(e){const{headerEntries:t,onSelect:n,selectedEntry:i,setSelectedEntry:r,title:o}=e,a=Vi(()=>V2(t),[t]),s=u=>u.action&&!u.disabled,c=(u,l)=>{if(s(l))return n(u,l)};return lt`
45
45
  <div class="djs-popup-header">
46
46
  <h3 class="djs-popup-title" title=${o}>${o}</h3>
47
- ${a.map(u=>ct`
47
+ ${a.map(u=>lt`
48
48
  <ul key=${u.id} class="djs-popup-header-group" data-header-group=${u.id}>
49
49
 
50
- ${u.entries.map(l=>ct`
50
+ ${u.entries.map(l=>lt`
51
51
  <li key=${l.id}>
52
52
  <${s(l)?"button":"span"}
53
- class=${H2(l,l===i)}
53
+ class=${W2(l,l===i)}
54
54
  onClick=${f=>c(f,l)}
55
55
  title=${l.title||l.label}
56
56
  data-id=${l.id}
@@ -60,8 +60,8 @@
60
60
  onFocus=${()=>s(l)&&r(l)}
61
61
  onBlur=${()=>s(l)&&r(null)}
62
62
  >
63
- ${l.imageUrl&&ct`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&ct`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
64
- ${l.label?ct`
63
+ ${l.imageUrl&&lt`<img class="djs-popup-entry-icon" src=${l.imageUrl} alt="" />`||l.imageHtml&&lt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:l.imageHtml}} />`}
64
+ ${l.label?lt`
65
65
  <span class="djs-popup-label">${l.label}</span>
66
66
  `:null}
67
67
  </${l.action?"button":"span"}>
@@ -70,11 +70,11 @@
70
70
  </ul>
71
71
  `)}
72
72
  </div>
73
- `}function j2(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 H2(e,t){return cu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Gb(e,t){return`${e}-entry-${t.id}`}function z2(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(u,l)=>{if(!n.disabled)return a(u,n,l)},c=!n.entries;return ct`
73
+ `}function V2(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 W2(e,t){return pu("entry",e.className,e.active?"active":"",e.disabled?"disabled":"",t?"selected":"")}function Ub(e,t){return`${e}-entry-${t.id}`}function U2(e){const{idPrefix:t,entry:n,selected:i,onMouseEnter:r,onMouseLeave:o,onAction:a}=e,s=(u,l)=>{if(!n.disabled)return a(u,n,l)},c=!n.entries;return lt`
74
74
  <li
75
- class=${cu("entry",{selected:i,disabled:n.disabled})}
75
+ class=${pu("entry",{selected:i,disabled:n.disabled})}
76
76
  data-id=${n.id}
77
- id=${Gb(t,n)}
77
+ id=${Ub(t,n)}
78
78
  role="option"
79
79
  aria-selected=${i||void 0}
80
80
  aria-haspopup=${n.entries?"true":void 0}
@@ -88,17 +88,17 @@
88
88
  >
89
89
  <div class="djs-popup-entry-content">
90
90
  <span
91
- class=${cu("djs-popup-entry-name",n.className)}
91
+ class=${pu("djs-popup-entry-name",n.className)}
92
92
  >
93
- ${n.imageUrl&&ct`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&ct`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
93
+ ${n.imageUrl&&lt`<img class="djs-popup-entry-icon" src=${n.imageUrl} alt="" />`||n.imageHtml&&lt`<div class="djs-popup-entry-icon" dangerouslySetInnerHTML=${{__html:n.imageHtml}} />`}
94
94
 
95
- ${n.label?ct`
95
+ ${n.label?lt`
96
96
  <span class="djs-popup-label">
97
97
  ${n.label}
98
98
  </span>
99
99
  `:null}
100
100
 
101
- ${n.documentationRef&&ct`
101
+ ${n.documentationRef&&lt`
102
102
  <a
103
103
  class="djs-popup-entry-docs"
104
104
  href=${n.documentationRef}
@@ -115,7 +115,7 @@
115
115
  </a>
116
116
  `}
117
117
  </span>
118
- ${n.description&&ct`
118
+ ${n.description&&lt`
119
119
  <span
120
120
  class="djs-popup-entry-description"
121
121
  >
@@ -123,7 +123,7 @@
123
123
  </span>
124
124
  `}
125
125
  </div>
126
- ${n.entries&&ct`
126
+ ${n.entries&&lt`
127
127
  <div class="djs-popup-entry-chevron" aria-hidden="true">
128
128
  <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
129
129
  <path fill-rule="evenodd" clip-rule="evenodd" d="M3.96967 1.46967C4.26256 1.17678 4.73744 1.17678 5.03033 1.46967L9.03033 5.46967C9.32322 5.76256 9.32322 6.23744 9.03033 6.53033L5.03033 10.5303C4.73744 10.8232 4.26256 10.8232 3.96967 10.5303C3.67678 10.2374 3.67678 9.76256 3.96967 9.46967L7.43934 6L3.96967 2.53033C3.67678 2.23744 3.67678 1.76256 3.96967 1.46967Z" fill="currentColor"/>
@@ -131,7 +131,7 @@
131
131
  </div>
132
132
  `}
133
133
  </li>
134
- `}function G2(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,f=au();Of(()=>{if(!r||!r.current)return;const h=f.current;if(!h)return;const g=h.querySelector(".selected");g&&V2(g)},[t]);const p=()=>{r.current=!1},d=h=>{r.current||n(h)},m=()=>{r.current||n(null)};return ct`
134
+ `}function Y2(e){const{selectedEntry:t,setSelectedEntry:n,groupedEntries:i,keyboardSelection:r,idPrefix:o,id:a,ariaLabel:s,tabIndex:c,ariaActivedescendant:u,...l}=e,f=uu();If(()=>{if(!r||!r.current)return;const h=f.current;if(!h)return;const g=h.querySelector(".selected");g&&q2(g)},[t]);const p=()=>{r.current=!1},d=h=>{r.current||n(h)},m=()=>{r.current||n(null)};return lt`
135
135
  <div
136
136
  class="djs-popup-results"
137
137
  ref=${f}
@@ -142,9 +142,9 @@
142
142
  aria-activedescendant=${u}
143
143
  onMouseMove=${p}
144
144
  >
145
- ${i.map(h=>ct`
146
- ${h.name&&ct`
147
- <div key=${h.id} id=${Vb(o,h)} class="entry-header" title=${h.name}>
145
+ ${i.map(h=>lt`
146
+ ${h.name&&lt`
147
+ <div key=${h.id} id=${Yb(o,h)} class="entry-header" title=${h.name}>
148
148
  ${h.name}
149
149
  </div>
150
150
  `}
@@ -152,10 +152,10 @@
152
152
  class="djs-popup-group"
153
153
  data-group=${h.id}
154
154
  role="group"
155
- aria-labelledby=${h.name?Vb(o,h):void 0}
155
+ aria-labelledby=${h.name?Yb(o,h):void 0}
156
156
  >
157
- ${h.entries.map(g=>ct`
158
- <${z2}
157
+ ${h.entries.map(g=>lt`
158
+ <${U2}
159
159
  key=${g.id}
160
160
  idPrefix=${o}
161
161
  entry=${g}
@@ -168,8 +168,8 @@
168
168
  </ul>
169
169
  `)}
170
170
  </div>
171
- `}function Vb(e,t){return`${e}-group-${t.id}`}function V2(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const W2=new To("djs-popup");function U2(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:f,entries:p,onOpened:d,onClosed:m}=e,[h,g]=kf([]);ou(()=>{g([])},[p]);const[y,v]=kf(""),b=y.trim().length>0,x=Gi(()=>K2(p),[p]),C=Gi(()=>Ft(u)?x.length>5:!1,[u,x]),P=Gi(()=>{const W=h.length?h[h.length-1].entries:p;return C?b?f(x.filter(({searchable:Y})=>Y!==!1),y,{keys:["label","search","description"]}).map(({item:Y})=>Y):W.filter(({rank:Y=0})=>Y>=0):W},[C,b,x,y,f,h,p]),O=Gi(()=>b?P.length?[{id:"default",entries:P}]:[]:X2(P),[P,b]),[A,I]=kf(P[0]),k=au(null),D=au(!1),H=Gi(()=>W2.next(),[]),ae=`${H}-results`,ye=A&&Gb(H,A);ou(()=>{const W=k.current;W&&P.includes(W)?I(W):I(P[0]),k.current=null},[P]);const We=za(W=>{const Y=q2(O);let Te=Y.indexOf(A)+W;Te<0&&(Te=Y.length-1),Te>=Y.length&&(Te=0),D.current=!0,I(Y[Te])},[O,A]),Fe=za(W=>{W>0&&A&&A.entries&&(D.current=!0,g(Y=>[...Y,A])),W<0&&h.length>0&&(D.current=!0,k.current=h[h.length+W],g(Y=>Y.slice(0,W)))},[A,h]),q=za((W,Y,J)=>{if(!(!Y||Y.disabled))return Y.entries?(W.preventDefault(),Fe(1)):n(W,Y,J)},[n,Fe]),ue=za(W=>{if(W.key==="Enter"&&A){const Y=W.target;return!!kr(Y,"a, button",!0)||A.disabled?void 0:q(W,A)}if(W.key==="Backspace"){const Y=W.target;if(!(gl(Y,"input")&&Y.value!==""))return Fe(-1),W.preventDefault()}if(W.key==="ArrowUp")return We(-1),W.preventDefault();if(W.key==="ArrowDown")return We(1),W.preventDefault();if(W.key==="ArrowRight")return Fe(1),W.preventDefault();if(W.key==="ArrowLeft")return Fe(-1),W.preventDefault()},[A,We,Fe,q]),oe=za(W=>{gl(W.target,"input")&&v(()=>W.target.value)},[v]);ou(()=>(d(),()=>{m()}),[]);const le=!b&&h.length>0,Me=(a||r.length>0)&&!le;return ct`
172
- <${Wb}
171
+ `}function Yb(e,t){return`${e}-group-${t.id}`}function q2(e){typeof e.scrollIntoViewIfNeeded=="function"?e.scrollIntoViewIfNeeded():e.scrollIntoView({scrollMode:"if-needed",block:"nearest"})}const K2=new ko("djs-popup");function X2(e){const{onClose:t,onSelect:n,className:i,headerEntries:r,position:o,title:a,width:s,scale:c,search:u,emptyPlaceholder:l,searchFn:f,entries:p,onOpened:d,onClosed:m}=e,[h,g]=Lf([]);cu(()=>{g([])},[p]);const[y,v]=Lf(""),b=y.trim().length>0,x=Vi(()=>J2(p),[p]),C=Vi(()=>Ht(u)?x.length>5:!1,[u,x]),P=Vi(()=>{const W=h.length?h[h.length-1].entries:p;return C?b?f(x.filter(({searchable:Y})=>Y!==!1),y,{keys:["label","search","description"]}).map(({item:Y})=>Y):W.filter(({rank:Y=0})=>Y>=0):W},[C,b,x,y,f,h,p]),D=Vi(()=>b?P.length?[{id:"default",entries:P}]:[]:ek(P),[P,b]),[T,I]=Lf(P[0]),k=uu(null),L=uu(!1),H=Vi(()=>K2.next(),[]),ae=`${H}-results`,ye=T&&Ub(H,T);cu(()=>{const W=k.current;W&&P.includes(W)?I(W):I(P[0]),k.current=null},[P]);const We=Va(W=>{const Y=Q2(D);let Te=Y.indexOf(T)+W;Te<0&&(Te=Y.length-1),Te>=Y.length&&(Te=0),L.current=!0,I(Y[Te])},[D,T]),Fe=Va(W=>{W>0&&T&&T.entries&&(L.current=!0,g(Y=>[...Y,T])),W<0&&h.length>0&&(L.current=!0,k.current=h[h.length+W],g(Y=>Y.slice(0,W)))},[T,h]),q=Va((W,Y,J)=>{if(!(!Y||Y.disabled))return Y.entries?(W.preventDefault(),Fe(1)):n(W,Y,J)},[n,Fe]),ue=Va(W=>{if(W.key==="Enter"&&T){const Y=W.target;return!!Or(Y,"a, button",!0)||T.disabled?void 0:q(W,T)}if(W.key==="Backspace"){const Y=W.target;if(!(bl(Y,"input")&&Y.value!==""))return Fe(-1),W.preventDefault()}if(W.key==="ArrowUp")return We(-1),W.preventDefault();if(W.key==="ArrowDown")return We(1),W.preventDefault();if(W.key==="ArrowRight")return Fe(1),W.preventDefault();if(W.key==="ArrowLeft")return Fe(-1),W.preventDefault()},[T,We,Fe,q]),oe=Va(W=>{bl(W.target,"input")&&v(()=>W.target.value)},[v]);cu(()=>(d(),()=>{m()}),[]);const le=!b&&h.length>0,ke=(a||r.length>0)&&!le;return lt`
172
+ <${qb}
173
173
  onClose=${t}
174
174
  onKeyup=${oe}
175
175
  onKeydown=${ue}
@@ -179,25 +179,25 @@
179
179
  scale=${c}
180
180
  navigationStack=${h}
181
181
  >
182
- ${Me&&ct`
183
- <${F2}
182
+ ${ke&&lt`
183
+ <${G2}
184
184
  headerEntries=${r}
185
185
  onSelect=${n}
186
- selectedEntry=${A}
186
+ selectedEntry=${T}
187
187
  setSelectedEntry=${I}
188
188
  title=${a}
189
189
  />
190
190
  `}
191
- ${le&&ct`
192
- <${$2}
191
+ ${le&&lt`
192
+ <${z2}
193
193
  navigationStack=${h}
194
194
  setNavigationStack=${g}
195
195
  />
196
196
  `}
197
- ${p.length>0&&ct`
197
+ ${p.length>0&&lt`
198
198
  <div class="djs-popup-body">
199
199
 
200
- ${C&&ct`
200
+ ${C&&lt`
201
201
  <div class="djs-popup-search">
202
202
  <svg class="djs-popup-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
203
203
  <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>
@@ -215,17 +215,17 @@
215
215
  </div>
216
216
  `}
217
217
 
218
- ${b&&ct`
218
+ ${b&&lt`
219
219
  <div class="djs-popup-search-count" aria-live="polite">
220
220
  ${P.length} ${P.length===1?"result":"results"} found
221
221
  </div>
222
222
  `}
223
223
 
224
- <${G2}
225
- groupedEntries=${O}
226
- selectedEntry=${A}
224
+ <${Y2}
225
+ groupedEntries=${D}
226
+ selectedEntry=${T}
227
227
  setSelectedEntry=${I}
228
- keyboardSelection=${D}
228
+ keyboardSelection=${L}
229
229
  onAction=${q}
230
230
  idPrefix=${H}
231
231
  id=${ae}
@@ -234,13 +234,13 @@
234
234
  ariaActivedescendant=${C?void 0:ye||void 0}
235
235
  />
236
236
 
237
- ${A&&A.documentationRef&&ct`
237
+ ${T&&T.documentationRef&&lt`
238
238
  <div class="djs-popup-footer">
239
239
  <a
240
240
  class="djs-popup-footer-docs"
241
- href=${A.documentationRef}
241
+ href=${T.documentationRef}
242
242
  onClick=${W=>W.stopPropagation()}
243
- aria-label=${A.label?`Open entry documentation for ${A.label}`:"Open entry documentation"}
243
+ aria-label=${T.label?`Open entry documentation for ${T.label}`:"Open entry documentation"}
244
244
  target="_blank"
245
245
  rel="noopener"
246
246
  >
@@ -254,14 +254,14 @@
254
254
  `}
255
255
  </div>
256
256
  `}
257
- ${l&&P.length===0&&ct`
258
- <div class="djs-popup-no-results">${Ut(l)?l(y):l}</div>
257
+ ${l&&P.length===0&&lt`
258
+ <div class="djs-popup-no-results">${qt(l)?l(y):l}</div>
259
259
  `}
260
- </${Wb}>
261
- `}function Wb(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=au();return Of(()=>{if(typeof s!="function")return;const u=c.current,l=s(u);u.style.left=`${l.x}px`,u.style.top=`${l.y}px`},[c.current,s]),Of(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),ou(()=>{const u=f=>{if(f.key==="Escape")return f.preventDefault(),t()},l=f=>{if(!kr(f.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),ct`
260
+ </${qb}>
261
+ `}function qb(e){const{onClose:t,onKeydown:n,onKeyup:i,className:r,children:o,navigationStack:a,position:s}=e,c=uu();return If(()=>{if(typeof s!="function")return;const u=c.current,l=s(u);u.style.left=`${l.x}px`,u.style.top=`${l.y}px`},[c.current,s]),If(()=>{const u=c.current;if(!u)return;(u.querySelector("input")||u.querySelector('[role="listbox"]')||u).focus()},[a]),cu(()=>{const u=f=>{if(f.key==="Escape")return f.preventDefault(),t()},l=f=>{if(!Or(f.target,".djs-popup",!0))return t()};return document.documentElement.addEventListener("keydown",u),document.body.addEventListener("click",l,!0),()=>{document.documentElement.removeEventListener("keydown",u),document.body.removeEventListener("click",l,!0)}},[]),lt`
262
262
  <div
263
- class=${cu("djs-popup",r)}
264
- style=${Y2(e)}
263
+ class=${pu("djs-popup",r)}
264
+ style=${Z2(e)}
265
265
  onKeydown=${n}
266
266
  onKeyup=${i}
267
267
  ref=${c}
@@ -269,8 +269,8 @@
269
269
  >
270
270
  ${o}
271
271
  </div>
272
- `}function Y2(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Ft(t)?n:void 0,maxWidth:Ft(t)?"unset":void 0,"transform-origin":"top left"}}function q2(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function K2(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function X2(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 Z2="data-id",Ub=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],Q2=1e3;function Et(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Ft(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()})}Et.$inject=["config.popupMenu","eventBus","canvas","search"],Et.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Yb(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),u=this._updateScale(this._current.container);Tb(ct`
273
- <${U2}
272
+ `}function Z2(e){const{width:t}=e,n=typeof t=="number"?`${t}px`:t;return{transform:`scale(${e.scale})`,width:Ht(t)?n:void 0,maxWidth:Ht(t)?"unset":void 0,"transform-origin":"top left"}}function Q2(e){const t=[];return e.forEach(n=>{n.entries.forEach(i=>{t.push(i)})}),t}function J2(e){const t=[];function n(i){i.forEach(r=>{if(r.entries){n(r.entries);return}t.push(r)})}return n(e),t}function ek(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 tk="data-id",Kb=["contextPad.close","canvas.viewbox.changing","commandStack.changed"],nk=1e3;function Rt(e,t,n,i){this._eventBus=t,this._canvas=n,this._search=i,this._current=null;var r=Ht(e&&e.scale)?e.scale:{min:1,max:1};this._config={scale:r},t.on("diagram.destroy",()=>{this.close()}),t.on("element.changed",o=>{const a=this.isOpen()&&this._current.target;o.element===a&&this.refresh()})}Rt.$inject=["config.popupMenu","eventBus","canvas","search"],Rt.prototype._render=function(){const{position:e,providerId:t,entries:n,headerEntries:i,emptyPlaceholder:r,options:o}=this._current,a=Xb(n),s=Object.entries(i).map(([p,d])=>({id:p,...d})),c=e&&(p=>this._ensureVisible(p,e)),u=this._updateScale(this._current.container);Ob(lt`
273
+ <${X2}
274
274
  onClose=${p=>this.close(p)}
275
275
  onSelect=${(p,d,m)=>this.trigger(p,d,m)}
276
276
  position=${c}
@@ -284,7 +284,7 @@
284
284
  searchFn=${this._search}
285
285
  ...${{...o}}
286
286
  />
287
- `,this._current.container)},Et.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()},Et.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()},Et.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)}},Et.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Et.prototype.reset=function(){const e=this._current.container;Tb(null,e),mi(e)},Et.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Et.prototype._onOpened=function(){this._emit("opened")},Et.prototype._onClosed=function(){this._emit("closed")},Et.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=mt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Et.prototype._bindAutoClose=function(){this._eventBus.once(Ub,this.close,this)},Et.prototype._unbindAutoClose=function(){this._eventBus.off(Ub,this.close,this)},Et.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),Ft(n)&&e<n&&(r=n),Ft(i)&&e>i&&(r=i)),r},Et.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}},Et.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},Et.prototype.registerProvider=function(e,t,n){n||(n=t,t=Q2),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Et.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Et.prototype._getEntries=function(e,t){var n={};return N(t,function(i){if(!i.getPopupMenuEntries){N(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=pi(o,["id"])});return}var r=i.getPopupMenuEntries(e);Ut(r)?n=r(n):N(r,function(o,a){n[a]=o})}),n},Et.prototype._getHeaderEntries=function(e,t){var n={};return N(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;N(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=pi(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);Ut(r)?n=r(n):N(r,function(o,a){n[a]=o})}),n},Et.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>Ut(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Et.prototype.isOpen=function(){return!!this._current},Et.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=kr(e.delegateTarget||e.target,".entry",!0),o=ln(r,Z2);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(Ut(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Et.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 Yb(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Yb(r.entries,[...t,...qb(r.search)]):t.length&&(r.search=[...t,...qb(r.search)]),r})}function qb(e){return e?De(e)?e:[e]:[]}function J2(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=ek(o,r,i);return a?{item:o,tokens:a}:[]}).sort(tk(i))}function ek(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=De(s)?s.reduce((l,f)=>{const{tokens:p,matchedWords:d}=Jb(f,t);return{tokens:[...l.tokens,p],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):Jb(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function tk(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=nk(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Kb;continue}const s=ik(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Kb;continue}}return i}}function nk(e,t){return Xb(t)-Xb(e)}const Kb=.5,No={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Xb(e){const t=e.reduce((s,c)=>s+Zb(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 Zb(e){if(De(e))return Math.max(...e.map(Zb));const t=Math.log(e.value.length);return e.match?(e.start?e.end?No.FULL:e.wordEnd?No.START_FULL_WORD:No.START_WORD_PART:e.wordStart?No.WORD_START:No.WORD_PART)*t:No.NO_MATCH*t}function Qb(e=""){return De(e)?e.join(", "):e}function ik(e,t){return Qb(e).localeCompare(Qb(t))}function Jb(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(rk),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,f=s.index,p=s.index+l.length,d=f===0,m=p===e.length,h=!!((u=s.groups)!=null&&u.all),g=d||/\s/.test(e.charAt(f-1)),y=m||/\s/.test(e.charAt(p));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:g,wordEnd:y,start:d,end:m,all:h});const v=h?t:[l];for(const b of v)i[b.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function rk(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const ex={search:["value",J2]},If={__depends__:[ex],__init__:["popupMenu"],popupMenu:["type",Et]};var tx={align:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">
287
+ `,this._current.container)},Rt.prototype.open=function(e,t,n,i){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");var r=this._eventBus.fire("popupMenu.open.allowed",{target:e,providerId:t});if(r===!1)return;this.isOpen()&&this.close();const{entries:o,headerEntries:a,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:o,headerEntries:a,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Rt.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:r}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:r},this._emit("refresh"),this._render()},Rt.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n),o=this._getEmptyPlaceholder(n);return{entries:i,headerEntries:r,emptyPlaceholder:o,empty:!(Object.keys(i).length||Object.keys(r).length)}},Rt.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Rt.prototype.reset=function(){const e=this._current.container;Ob(null,e),gi(e)},Rt.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Rt.prototype._onOpened=function(){this._emit("opened")},Rt.prototype._onClosed=function(){this._emit("closed")},Rt.prototype._createContainer=function(e){var t=this._canvas,n=t.getContainer();const i=yt(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return n.appendChild(i),i},Rt.prototype._bindAutoClose=function(){this._eventBus.once(Kb,this.close,this)},Rt.prototype._unbindAutoClose=function(){this._eventBus.off(Kb,this.close,this)},Rt.prototype._updateScale=function(){var e=this._canvas.zoom(),t=this._config.scale,n,i,r=e;return t!==!0&&(t===!1?(n=1,i=1):(n=t.min,i=t.max),Ht(n)&&e<n&&(r=n),Ht(i)&&e>i&&(r=i)),r},Rt.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,a=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,a=t.y-i.height):r.x?(o=t.x-i.width,a=t.y):r.y&&t.y<i.height?(o=t.x,a=10):r.y&&(o=t.x,a=t.y-i.height),t.y<n.top&&(a=t.y+i.height),{x:o,y:a}},Rt.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length?!0:this._getContext(e,t).empty},Rt.prototype.registerProvider=function(e,t,n){n||(n=t,t=nk),this._eventBus.on("popupMenu.getProviders."+e,t,function(i){i.providers.push(n)})},Rt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Rt.prototype._getEntries=function(e,t){var n={};return $(t,function(i){if(!i.getPopupMenuEntries){$(i.getEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=fi(o,["id"])});return}var r=i.getPopupMenuEntries(e);qt(r)?n=r(n):$(r,function(o,a){n[a]=o})}),n},Rt.prototype._getHeaderEntries=function(e,t){var n={};return $(t,function(i){if(!i.getPopupMenuHeaderEntries){if(!i.getHeaderEntries)return;$(i.getHeaderEntries(e),function(o){var a=o.id;if(!a)throw new Error("entry ID is missing");n[a]=fi(o,["id"])});return}var r=i.getPopupMenuHeaderEntries(e);qt(r)?n=r(n):$(r,function(o,a){n[a]=o})}),n},Rt.prototype._getEmptyPlaceholder=function(e){const t=e.find(n=>qt(n.getEmptyPlaceholder));return t&&t.getEmptyPlaceholder()},Rt.prototype.isOpen=function(){return!!this._current},Rt.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let r=Or(e.delegateTarget||e.target,".entry",!0),o=dn(r,tk);t={id:o,...this._getEntry(o)}}const i=t.action;if(this._emit("trigger",{entry:t,event:e})!==!1){if(qt(i)){if(n==="click")return i(e,t)}else if(i[n])return i[n](e,t)}},Rt.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};function Xb(e,t=[]){return Object.entries(e).map(([n,i])=>{const r={id:n,...i};return r.entries?r.entries=Xb(r.entries,[...t,...Zb(r.search)]):t.length&&(r.search=[...t,...Zb(r.search)]),r})}function Zb(e){return e?Le(e)?e:[e]:[]}function ik(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=rk(o,r,i);return a?{item:o,tokens:a}:[]}).sort(ok(i))}function rk(e,t,n){const{matchedWords:i,tokens:r}=n.reduce((o,a)=>{const s=e[a],{tokens:c,matchedWords:u}=Le(s)?s.reduce((l,f)=>{const{tokens:p,matchedWords:d}=nx(f,t);return{tokens:[...l.tokens,p],matchedWords:{...l.matchedWords,...d}}},{matchedWords:{},tokens:[]}):nx(s,t);return{tokens:{...o.tokens,[a]:c},matchedWords:{...o.matchedWords,...u}}},{matchedWords:{},tokens:{}});return Object.keys(i).length!==t.length?null:r}function ok(e){return(t,n)=>{let i=0,r=1;for(const o of e){const a=ak(t.tokens[o],n.tokens[o]);if(a!==0){i+=a*r,r*=Qb;continue}const s=sk(t.item[o],n.item[o]);if(s!==0){i+=s*r,r*=Qb;continue}}return i}}function ak(e,t){return Jb(t)-Jb(e)}const Qb=.5,Fo={FULL:131.9,START_FULL_WORD:8,START_WORD_PART:7.87,WORD_START:2.19,WORD_PART:1,NO_MATCH:-.07};function Jb(e){const t=e.reduce((s,c)=>s+ex(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 ex(e){if(Le(e))return Math.max(...e.map(ex));const t=Math.log(e.value.length);return e.match?(e.start?e.end?Fo.FULL:e.wordEnd?Fo.START_FULL_WORD:Fo.START_WORD_PART:e.wordStart?Fo.WORD_START:Fo.WORD_PART)*t:Fo.NO_MATCH*t}function tx(e=""){return Le(e)?e.join(", "):e}function sk(e,t){return tx(e).localeCompare(tx(t))}function nx(e,t){var u;if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(ck),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),a=new RegExp(o,"ig");let s,c=0;for(;s=a.exec(e);){const[l]=s,f=s.index,p=s.index+l.length,d=f===0,m=p===e.length,h=!!((u=s.groups)!=null&&u.all),g=d||/\s/.test(e.charAt(f-1)),y=m||/\s/.test(e.charAt(p));s.index>c&&n.push({value:e.slice(c,s.index),index:c}),n.push({value:l,index:s.index,match:!0,wordStart:g,wordEnd:y,start:d,end:m,all:h});const v=h?t:[l];for(const b of v)i[b.toLowerCase()]=!0;c=s.index+l.length}return c<e.length&&n.push({value:e.slice(c),index:c}),{tokens:n,matchedWords:i}}function ck(e){return e.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&")}const ix={search:["value",ik]},$f={__depends__:[ix],__init__:["popupMenu"],popupMenu:["type",Rt]};var rx={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>`},ok=900;function $o(e,t,n,i){e.registerProvider(ok,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}$o.$inject=["contextPad","popupMenu","translate","canvas"],$o.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},$o.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},$o.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${tx.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);V(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},$o.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 ak=["left","center","right","top","middle","bottom"];function Ga(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Ga.$inject=["popupMenu","alignElements","translate","rules"],Ga.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Ga.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ga.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return N(ak,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:tx[o],action:function(){t.trigger(e,o),i.close()}}}),r};function uu(e){Zn.call(this,e)}uu.$inject=["eventBus"],_e(uu,Zn),uu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Ue(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Os(n),n.length<2?!1:n})};const sk={__depends__:[v2,fb,If],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",$o],alignElementsMenuProvider:["type",Ga],bpmnAlignElements:["type",uu]};function Vi(e,t,n,i){te.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=Nu(Jr(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=eo(s,function(f){return f.parent.id});N(l,function(f,p){De(u)&&(f=f.filter(function(d){return pt(u,to({id:d.id}))})),r._expand(f,p)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}Vi.$inject=["eventBus","elementRegistry","modeling","rules"],_e(Vi,te),Vi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Ae(Dt(e)),o=Ae(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),Is(V({},o,a))},Vi.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(ck(i,t)){var r=uk(ai(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Vi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Vi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Vi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function ck(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function uk(e,t){var n="";return e=Ae(e),t=Ae(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 lu(e){e.invoke(Vi,this)}lu.$inject=["injector"],_e(lu,Vi),lu.prototype.resize=function(e,t,n){E(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Va(e){Zn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Va.$inject=["eventBus"],_e(Va,Zn),Va.prototype.canResize=function(e,t){return!1};function pu(e,t){Va.call(this,e),this._modeling=t}_e(pu,Va),pu.$inject=["eventBus","modeling"],pu.prototype.canResize=function(e,t){if(E(t.di,"bpmndi:BPMNPlane")||!E(t,"bpmn:Participant")&&!E(t,"bpmn:Lane")&&!E(t,"bpmn:SubProcess"))return!1;var n=!0;return N(e,function(i){if(E(i,"bpmn:Lane")||Ge(i)){n=!1;return}}),n};const lk={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",lu],bpmnAutoResizeProvider:["type",pu]};function Fo(e,t,n){this._canvas=n,this._opts=V({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Fo.$inject=["config.autoScroll","eventBus","canvas"],Fo.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++)pk(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 pk(e,t,n){return t<e&&e<n}Fo.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Fo.prototype.setOptions=function(e){this._opts=V({},this._opts,e)},Fo.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=Nr(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const fk={__depends__:[$i],__init__:["autoScroll"],autoScroll:["type",Fo]};var nx="djs-bendpoint",ix="djs-segment-dragger";function dk(e,t){var n=Nr(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 Bf(e,t,n){var i=dk(e,n),r=ep(t,i);return r}function Nf(e,t){var n=Pe("g");Xe(n).add(nx),je(e,n);var i=Pe("circle");we(i,{cx:0,cy:0,r:4}),Xe(i).add("djs-visual"),je(n,i);var r=Pe("circle");return we(r,{cx:0,cy:0,r:10}),Xe(r).add("djs-hit"),je(n,r),t&&Xe(n).add(t),n}function hk(e,t,n,i){var r=Pe("g");je(e,r);var o=18,a=6,s=11,c=gk(t,n,i),u=a+s,l=Pe("rect");we(l,{x:-o/2,y:-a/2,width:o,height:a}),Xe(l).add("djs-visual"),je(r,l);var f=Pe("rect");return we(f,{x:-c/2,y:-u/2,width:c,height:u}),Xe(f).add("djs-hit"),je(r,f),Mm(r,i==="v"?90:0),r}function rx(e,t,n){var i=Pe("g"),r=Tl(t,n),o=Oi(t,n);return je(e,i),hk(i,t,n,o),Xe(i).add(ix),Xe(i).add(o==="h"?"horizontal":"vertical"),tn(i,r.x,r.y),i}function $f(e){return Math.abs(Math.round(e*2/3))}function mk(e,t){var n=yk(e,t);return ap(e,n)}function gk(e,t,n){var i=t.x-e.x,r=t.y-e.y;return $f(n==="h"?i:r)}function yk(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=gg(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function ox(e,t,n,i,r){function o(b,x,C){var P=b.index,O=b.point,A,I,k,D,H,ae;return P<=0||b.bendpoint?!1:(A=x[P-1],I=x[P],k=Tl(A,I),D=Oi(A,I),H=Math.abs(O.x-k.x),ae=Math.abs(O.y-k.y),D&&H<=C&&ae<=C)}function a(b,x){var C=b.waypoints,P,O,A,I;return x.index<=0||x.bendpoint||(P={start:C[x.index-1],end:C[x.index]},O=Oi(P.start,P.end),!O)?null:(O==="h"?A=P.end.x-P.start.x:A=P.end.y-P.start.y,I=$f(A)/2,I)}function s(b,x){var C=x.waypoints,P=Bf(t,C,b),O;if(P){O=a(x,P);var A;if(o(P,C,O)?A=r.start(b,x,P.index):A=i.start(b,x,P.index,!P.bendpoint),A!==!1)return!0}}function c(b,x,C){$e.bind(b,x,function(P){n.triggerMouseEvent(x,P,C),P.stopPropagation()})}function u(b,x){var C=t.getLayer("overlays"),P=ot('.djs-bendpoints[data-element-id="'+$a(b.id)+'"]',C);return!P&&x&&(P=Pe("g"),we(P,{"data-element-id":b.id}),Xe(P).add("djs-bendpoints"),je(C,P),c(P,"mousedown",b),c(P,"click",b),c(P,"dblclick",b)),P}function l(b,x){return ot('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function f(b,x){x.waypoints.forEach(function(C,P){var O=Nf(b);je(b,O),tn(O,C.x,C.y)}),Nf(b,"floating")}function p(b,x){for(var C=x.waypoints,P,O,A,I=1;I<C.length;I++)P=C[I-1],O=C[I],Oi(P,O)&&(A=rx(b,P,O),we(A,{"data-segment-idx":I}),c(A,"mousemove",x))}function d(b){N(As("."+nx,b),function(x){Ht(x)})}function m(b){N(As("."+ix,b),function(x){Ht(x)})}function h(b){var x=u(b);return x||(x=u(b,!0),f(x,b),p(x,b)),x}function g(b){var x=u(b);x&&(m(x),d(x),p(x,b),f(x,b))}function y(b,x){var C=ot(".floating",b),P=x.point;C&&(tn(C,P.x,P.y),Xe(C).add("positioned"))}function v(b,x,C){var P=l(x.index,b),O=C[x.index-1],A=C[x.index],I=x.point,k=Tl(O,A),D=Oi(O,A),H,ae;P&&(H=vk(P),ae={x:I.x-k.x,y:I.y-k.y},D==="v"&&(ae={x:ae.y,y:ae.x}),tn(H,ae.x,ae.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&Ht(x)}),e.on("element.marker.update",function(b){var x=b.element,C;x.waypoints&&(C=h(x),b.add?Xe(C).add(b.marker):Xe(C).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,C=x.waypoints,P,O;if(C){if(P=u(x,!0),O=Bf(t,C,b.originalEvent),!O)return;y(P,O),O.bendpoint||v(P,O,C)}}),e.on("element.mousedown",function(b){if(cr(b)){var x=b.originalEvent,C=b.element;if(C.waypoints)return s(x,C)}}),e.on("selection.changed",function(b){var x=b.newSelection,C=x[0];C&&C.waypoints&&h(C)}),e.on("element.hover",function(b){var x=b.element;x.waypoints&&h(x)}),e.on("element.out",function(b){var x=b.element;if(x.waypoints){var C=u(x);if(C){var P=ot(".floating",C);P&&Xe(P).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,C=b.newId;if(x.waypoints){var P=u(x);P&&we(P,{"data-element-id":C})}}),this.addHandles=h,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}ox.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function vk(e){return ot(".djs-visual",e)}var ax=Math.round,Wr="reconnectStart",Ur="reconnectEnd",Wa="updateWaypoints";function Ff(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),f=s.source,p=s.target,d=s.waypoints,m;!u&&c===0?m=Wr:!u&&c===d.length-1?m=Ur:m=Wa;var h=m===Wa?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(h,{connection:s,source:f,target:p});if(g===!1&&(g=r.allowed(h,{connection:s,source:p,target:f})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:g,bendpointIndex:c,connection:s,source:f,target:p,insert:u,type:m}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,f=a.hover,p=s.type;s.hover=f;var d;if(f){var m=p===Wa?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(m,{connection:c,source:p===Wr?f:u,target:p===Ur?f:l}),d){s.source=p===Wr?f:u,s.target=p===Ur?f:l;return}d===!1&&(d=s.allowed=r.allowed(m,{connection:c,source:p===Ur?f:l,target:p===Wr?f:u})),d&&(s.source=p===Ur?f:l,s.target=p===Wr?f:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Wa&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,f=s.insert,p=l.waypoints.slice(),d=s.source,m=s.target,h=s.type,g=s.hints||{},y={x:ax(a.x),y:ax(a.y)};if(!c)return!1;h===Wa?(f?p.splice(u,0,y):p[u]=y,g.bendpointMove={insert:f,bendpointIndex:u},p=this.cropWaypoints(l,p),o.updateWaypoints(l,IS(p),g)):(h===Wr?(g.docking="source",fu(s)&&(g.docking="target",g.newWaypoints=p.reverse())):h===Ur&&(g.docking="target",fu(s)&&(g.docking="source",g.newWaypoints=p.reverse())),o.reconnect(l,d,m,y,g))},this)}Ff.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],Ff.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 fu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Wr)return t&&i&&t===i&&n!==i;if(r===Ur)return t&&n&&t===n&&n!==i}var bk="reconnectStart",xk="reconnectEnd",sx="updateWaypoints",Ua="connect-ok",du="connect-not-ok",cx="connect-hover",ux="djs-updating",lx="djs-dragging",px=1100;function fx(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,f=l.slice();a.waypoints=l,u&&f.splice(s,0,{x:o.x,y:o.y}),c.waypoints=f;var p=a.draggerGfx=Nf(i.getLayer("overlays"));Xe(p).add("djs-dragging"),i.addMarker(c,lx),i.addMarker(c,ux)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,u=a.type;if(c){if(i.addMarker(c,cx),u===sx)return;s?(i.removeMarker(c,du),i.addMarker(c,Ua)):s===!1&&(i.removeMarker(c,Ua),i.addMarker(c,du))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],px,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,cx),i.removeMarker(s,c?Ua:du))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,f=a.type,p=a.connection,d=p.source,m=p.target,h=p.waypoints.slice(),g={x:o.x,y:o.y},y=a.hints||{},v={};r&&(y.connectionStart&&(v.connectionStart=y.connectionStart),y.connectionEnd&&(v.connectionEnd=y.connectionEnd),f===bk?fu(a)?(v.connectionEnd=v.connectionEnd||g,v.source=m,v.target=l||d,h=h.reverse()):(v.connectionStart=v.connectionStart||g,v.source=l||d,v.target=m):f===xk?fu(a)?(v.connectionStart=v.connectionStart||g,v.source=l||m,v.target=d,h=h.reverse()):(v.connectionEnd=v.connectionEnd||g,v.source=d,v.target=l||m):(v.noCropping=!0,v.noLayout=!0,h[c]=g),f===sx&&(h=e.cropWaypoints(p,h)),v.waypoints=h,r.drawPreview(a,s,v)),tn(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],px,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,f=a.waypoints;s.waypoints=f,Ht(c),i.removeMarker(s,ux),i.removeMarker(s,lx),u&&(i.removeMarker(u,Ua),i.removeMarker(u,l?Ua:du)),r&&r.cleanUp(a)})}fx.$inject=["bendpointMove","injector","eventBus","canvas"];var dx="connect-hover",hx="djs-updating";function mx(e,t,n){return jf(e,t,e[t]+n)}function jf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function _k(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 jf(t,i,s)}function gx(e){return e==="x"?"y":"x"}function yx(e,t,n){var i,r;return e.original?e.original:(i=Le(t),r=gx(n),jf(e,r,i[r]))}function vx(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var m,h=n.getGraphics(p),g=d-1,y=d,v=p.waypoints,b=v[g],x=v[y],C=Bf(n,v,f),P,O,A;if(P=Oi(b,x),!!P)return O=P==="v"?"x":"y",g===0&&(b=yx(b,p.source,O)),y===v.length-1&&(x=yx(x,p.target,O)),C?A=C.point:A={x:(b.x+x.x)/2,y:(b.y+x.y)/2},m={connection:p,segmentStartIndex:g,segmentEndIndex:y,segmentStart:b,segmentEnd:x,axis:O,dragPosition:A},i.init(f,A,"connectionSegment.move",{cursor:O==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:h,context:m}})};function s(f,p){if(!a)return p;var d=f.waypoints,m;return f.waypoints=p,m=a.getCroppedWaypoints(f),f.waypoints=d,m}function c(f){r.update("connection",f.connection,f.connectionGfx)}function u(f,p,d){var m=f.newWaypoints,h=f.segmentStartIndex+p,g=m[h],y=f.segmentEndIndex+p,v=m[y],b=gx(f.axis),x=_k(d,g,v,b);tn(f.draggerGfx,x.x,x.y)}function l(f,p){var d=0,m=f.filter(function(h,g){return Al(f[g-1],f[g+1],h)?(d=g<=p?d-1:d,!1):!0});return{waypoints:m,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,m=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=rx(m,p.segmentStart,p.segmentEnd),Xe(p.draggerGfx).add("djs-dragging"),n.addMarker(d,hx)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,m=p.segmentStartIndex,h=p.segmentEndIndex,g=p.segmentStart,y=p.segmentEnd,v=p.axis,b=p.originalWaypoints.slice(),x=mx(g,v,f["d"+v]),C=mx(y,v,f["d"+v]),P=b.length,O=0;b[m]=x,b[h]=C;var A,I;m<2&&(A=en(d.source,x),m===1?A==="intersect"&&(b.shift(),b[0]=x,O--):A!=="intersect"&&(b.unshift(g),O++)),h>P-3&&(I=en(d.target,C),h===P-2?I==="intersect"&&(b.pop(),b[b.length-1]=C):I!=="intersect"&&b.push(y)),p.newWaypoints=d.waypoints=s(d,b),u(p,O,f),p.newSegmentStartIndex=m+O,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,dx)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,dx)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&Ht(p.draggerGfx),n.removeMarker(d,hx)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var p=f.context,d=p.connection;d.waypoints=p.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var p=f.context,d=p.connection,m=p.newWaypoints,h=p.newSegmentStartIndex;m=m.map(function(C){return{original:C.original,x:Math.round(C.x),y:Math.round(C.y)}});var g=l(m,h),y=g.waypoints,v=s(d,y),b=g.segmentOffset,x={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:h+b}};o.updateWaypoints(d,v,x)})}vx.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var wk=Math.abs,bx=Math.round;function Ek(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],wk(r-e)<=n)return r}function xx(e){return{x:e.x,y:e.y}}function _x(e){return{x:e.x+e.width,y:e.y+e.height}}function ti(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:bx(e.x+e.width/2),y:bx(e.y+e.height/2)}}function jo(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Nt(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 wx(e){return e.children||[]}var Sk=Math.abs,Ex=Math.round,Hf=10;function Sx(e){function t(o,a){if(De(o)){for(var s=o.length;s--;)if(Sk(o[s]-a)<=Hf)return o[s]}else{o=+o;var c=a%o;if(c<Hf)return a-c;if(c>o-Hf)return a-c+o}return a}function n(o,a){if(o.waypoints)return mk(a,o);if(o.width)return{x:Ex(o.width/2+o.x),y:Ex(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,m=a.axis;if(s)return s;var h=[u[f-1],l,p,u[d+1]];return f<2&&h.unshift(n(c.source,o)),d>u.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},N(h,function(g){g&&(g=g.original||g,m==="y"&&s.horizontal.push(g.y),m==="x"&&s.vertical.push(g.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var f=s-u,p=c-l;V(o,{dx:o.dx-f,dy:o.dy-p,x:u,y:l}),(f||a.vertical.indexOf(s)!==-1)&&Nt(o,"x",u),(p||a.horizontal.indexOf(c)!==-1)&&Nt(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},N(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!at(s)||!c||!c.x||!c.y||(Nt(o,"x",c.x),Nt(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,f=o.y,p,d;if(s){p=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,f);var m=l-p,h=f-d;V(o,{dx:o.dx-m,dy:o.dy-h,x:o.x-m,y:o.y-h}),(m||s.vertical.indexOf(l)!==-1)&&Nt(o,"x",p),(h||s.horizontal.indexOf(f)!==-1)&&Nt(o,"y",d)}})}Sx.$inject=["eventBus"];const Rk={__depends__:[$i,_i],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",ox],bendpointMove:["type",Ff],bendpointMovePreview:["type",fx],connectionSegmentMove:["type",vx],bendpointSnapping:["type",Sx]};function Rx(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!Qr(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!Qr(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},f=s.source,p=s.target;if(!c)return!1;var d=null,m={connectionStart:zf(s)?l:u,connectionEnd:zf(s)?u:l};Wt(c)&&(d=c),s.connection=n.connect(f,p,d,m)}),this.start=function(a,s,c,u){Wt(c)||(u=c,c=Le(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}Rx.$inject=["eventBus","dragging","modeling","rules"];function zf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var Ck=1100,Pk=900,Cx="connect-ok",Px="connect-not-ok";function Ax(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,f=o.target,p=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},m=p,h=d;zf(o)&&(m=d,h=p),i.drawPreview(o,a,{source:c||u,target:f||s,connectionStart:m,connectionEnd:h})}),t.on("connect.hover",Pk,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?Cx:Px)}),t.on(["connect.out","connect.cleanup"],Ck,function(r){var o=r.hover;o&&(n.removeMarker(o,Cx),n.removeMarker(o,Px))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}Ax.$inject=["injector","eventBus","canvas"];const Gf={__depends__:[Qn,_i,$i],__init__:["connectPreview"],connect:["type",Rx],connectPreview:["type",Ax]};var Ak="djs-dragger";function Wi(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)}Wi.$inject=["injector","canvas","graphicsFactory","elementFactory"],Wi.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,f=n.noCropping,p=n.noNoop,d,m=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ts(i),r||(r=e.getConnection=Tk(function(h,g,y){return m.getConnection(h,g,y)})),t&&(d=r(t,o,a)),!d){!p&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?Le(o):c,a?Le(a):u]),this._connectionDocking&&(o||a)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Wi.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Le(n),o=t.connectionEnd||Le(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);je(e,s)},Wi.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&&aa(o,s,!0)||e,t=i&&aa(a,s,!1)||t,[e,t]},Wi.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ht(e.connectionPreviewGfx)},Wi.prototype.getConnection=function(e){var t=Mk(e);return this._elementFactory.createConnection(t)},Wi.prototype.createConnectionPreviewGfx=function(){var e=Pe("g");return we(e,{pointerEvents:"none"}),Xe(e).add(Ak),je(this._canvas.getActiveLayer(),e),e},Wi.prototype.createNoopConnection=function(e,t){return na([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function Tk(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 Mk(e){return Wt(e)?e:{}}const kk={__init__:["connectionPreview"],connectionPreview:["type",Wi]},hu="complex-preview";class Tx{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(hu);n.filter(s=>!Ok(s)).forEach(s=>{let c;at(s)?(c=this._graphicsFactory._createContainer("connection",Pe("g")),this._graphicsFactory.drawConnection(Lr(c),s)):(c=this._graphicsFactory._createContainer("shape",Pe("g")),this._graphicsFactory.drawShape(Lr(c),s),tn(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);at(s)?tn(u,c.x,c.y):tn(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",Pe("g"));this._graphicsFactory.drawShape(Lr(u),s,{width:c.width,height:c.height}),tn(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Ts(this._canvas.getLayer(hu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(hu)}hide(){this._canvas.hideLayer(hu)}}Tx.$inject=["canvas","graphicsFactory","previewSupport"];function Ok(e){return e.hidden}const Dk={__depends__:[Mo],__init__:["complexPreview"],complexPreview:["type",Tx]},Mx=Math.round;function mu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}mu.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(V({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;V(u,{x:l.x-Mx(u.width/2),y:l.y-Mx(u.height/2)});const f=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let p=null;f&&(p=o.createConnection(f),p.waypoints=s.layoutConnection(p,{source:e,target:u}),p.waypoints=r.getCroppedWaypoints(p,e,u)),i.create({created:[u,p].filter(d=>!Qr(d))})},mu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},mu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const Lk={__depends__:[zc,Dk,mf],__init__:["appendPreview"],appendPreview:["type",mu]};var kx=Math.min,Ox=Math.max;function Vf(e){e.preventDefault()}function Ya(e){e.stopPropagation()}function Ik(e){return e.nodeType===Node.TEXT_NODE}function Bk(e){return[].slice.call(e)}function ui(e){this.container=e.container,this.parent=mt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ot("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=wn(this.autoResize,this),this.handlePaste=wn(this.handlePaste,this)}ui.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=ai(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);V(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=ai(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return V(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&V(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,$e.bind(a,"keydown",this.keyHandler),$e.bind(a,"mousedown",Ya),$e.bind(a,"paste",r.handlePaste),$e.bind(a,"focusout",this.focusoutHandler),i.autoResize&&$e.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},ui.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)}},ui.prototype.insertText=function(e){e=Nk(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},ui.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=Bk(a.childNodes),c,u;if(Ik(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var f=document.createTextNode(e);this.content.insertBefore(f,s[r]),c=f,u=f.textContent.length}else{var p=s.indexOf(n),d=s.indexOf(i);s.forEach(function(m,h){h===p?m.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>p&&h<=d&&mi(m)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},ui.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})}},ui.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){n=this.resizeHandle=mt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,f=function(m){Vf(m),Ya(m),s=m.clientX,c=m.clientY;var h=t.getBoundingClientRect();u=h.width,l=h.height,$e.bind(document,"mousemove",p),$e.bind(document,"mouseup",d)},p=function(m){Vf(m),Ya(m);var h=kx(Ox(u+m.clientX-s,i),o),g=kx(Ox(l+m.clientY-c,r),a);t.style.width=h+"px",t.style.height=g+"px",e.resizeHandler({width:u,height:l,dx:m.clientX-s,dy:m.clientY-c})},d=function(m){Vf(m),Ya(m),$e.unbind(document,"mousemove",p,!1),$e.unbind(document,"mouseup",d,!1)};$e.bind(n,"mousedown",f)}V(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},ui.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),$e.unbind(t,"keydown",this.keyHandler),$e.unbind(t,"mousedown",Ya),$e.unbind(t,"input",this.autoResize),$e.unbind(t,"paste",this.handlePaste),$e.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),mi(n)),mi(e)},ui.prototype.getValue=function(){return this.content.innerText.trim()},ui.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},ui.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 Nk(e){return e.replace(/\r\n|\r|\n/g,`
316
- `)}function Nn(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new ui({container:t.getContainer(),keyHandler:wn(this._handleKey,this),resizeHandler:wn(this._handleResize,this),focusoutHandler:wn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}Nn.$inject=["eventBus","canvas"],Nn.prototype.registerProvider=function(e){this._providers.push(e)},Nn.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},Nn.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Nn.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Nn.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},Nn.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},Nn.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()}},Nn.prototype.getValue=function(){return this._textbox.getValue()},Nn.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()},Nn.prototype._handleResize=function(e){this._fire("resize",e)},Nn.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},Nn.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=pt(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 Dx={__depends__:[vc],__init__:["directEditing"],directEditing:["type",Nn]};function $k(e){return function(t){var n=t.target,i=ie(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===Ke(e);return!o||!a||!s||!c}}const Fk={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 ee(e,t={}){var n=Fk[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var jk=[ee("none-start-event",{actionName:"replace-with-none-start"}),ee("none-intermediate-throwing"),ee("none-end-event",{actionName:"replace-with-none-end"}),ee("message-start"),ee("timer-start"),ee("conditional-start"),ee("signal-start")],Hk=[ee("none-start-event",{actionName:"replace-with-none-start"}),ee("none-intermediate-throwing"),ee("none-end-event",{actionName:"replace-with-none-end"})],zk=[ee("none-start-event",{actionName:"replace-with-none-start"}),ee("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ee("none-end-event",{actionName:"replace-with-none-end"}),ee("message-intermediate-catch"),ee("message-intermediate-throw"),ee("timer-intermediate-catch"),ee("escalation-intermediate-throw"),ee("conditional-intermediate-catch"),ee("link-intermediate-catch"),ee("link-intermediate-throw"),ee("compensation-intermediate-throw"),ee("signal-intermediate-catch"),ee("signal-intermediate-throw")],Gk=[ee("none-start-event",{actionName:"replace-with-none-start"}),ee("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ee("none-end-event",{actionName:"replace-with-none-end"}),ee("message-end"),ee("escalation-end"),ee("error-end"),ee("cancel-end"),ee("compensation-end"),ee("signal-end"),ee("terminate-end")],Vk=[ee("exclusive-gateway"),ee("parallel-gateway"),ee("inclusive-gateway"),ee("complex-gateway"),ee("event-based-gateway")],Wk=[ee("transaction"),ee("event-subprocess"),ee("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ee("collapsed-subprocess")],Uk=[ee("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ee("transaction"),ee("event-subprocess"),ee("collapsed-ad-hoc-subprocess")],Lx=[ee("transaction"),ee("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ee("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ee("event-subprocess")],Yk=Lx,Ix=[ee("task"),ee("user-task"),ee("service-task"),ee("send-task"),ee("receive-task"),ee("manual-task"),ee("rule-task"),ee("script-task"),ee("call-activity"),ee("collapsed-subprocess"),ee("expanded-subprocess"),ee("collapsed-ad-hoc-subprocess"),ee("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],qk=[ee("data-store-reference")],Kk=[ee("data-object-reference")],Xk=[ee("message-boundary"),ee("timer-boundary"),ee("escalation-boundary"),ee("conditional-boundary"),ee("error-boundary"),ee("cancel-boundary"),ee("signal-boundary"),ee("compensation-boundary"),ee("non-interrupting-message-boundary"),ee("non-interrupting-timer-boundary"),ee("non-interrupting-escalation-boundary"),ee("non-interrupting-conditional-boundary"),ee("non-interrupting-signal-boundary")],Zk=[ee("message-start"),ee("timer-start"),ee("conditional-start"),ee("signal-start"),ee("error-start"),ee("escalation-start"),ee("compensation-start"),ee("non-interrupting-message-start"),ee("non-interrupting-timer-start"),ee("non-interrupting-conditional-start"),ee("non-interrupting-signal-start"),ee("non-interrupting-escalation-start")],Qk=[{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"}],Jk=[ee("expanded-pool"),ee("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],eO={"bpmn:MessageEventDefinition":[ee("message-start"),ee("message-intermediate-catch"),ee("message-intermediate-throw"),ee("message-end")],"bpmn:TimerEventDefinition":[ee("timer-start"),ee("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[ee("conditional-start"),ee("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[ee("signal-start"),ee("signal-intermediate-catch"),ee("signal-intermediate-throw"),ee("signal-end")],"bpmn:ErrorEventDefinition":[ee("error-start"),ee("error-end")],"bpmn:EscalationEventDefinition":[ee("escalation-start"),ee("escalation-intermediate-throw"),ee("escalation-end")],"bpmn:CompensateEventDefinition":[ee("compensation-start"),ee("compensation-intermediate-throw"),ee("compensation-end")]};const Bx={"start-event-non-interrupting":`
315
+ </svg>`},uk=900;function jo(e,t,n,i){e.registerProvider(uk,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}jo.$inject=["contextPad","popupMenu","translate","canvas"],jo.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},jo.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},jo.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${rx.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);V(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},jo.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 lk=["left","center","right","top","middle","bottom"];function Wa(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}Wa.$inject=["popupMenu","alignElements","translate","rules"],Wa.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Wa.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Wa.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return $(lk,function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:rx[o],action:function(){t.trigger(e,o),i.close()}}}),r};function fu(e){Qn.call(this,e)}fu.$inject=["eventBus"],xe(fu,Qn),fu.prototype.init=function(){this.addRule("elements.align",function(e){var t=e.elements,n=Ue(t,function(i){return!(i.waypoints||i.host||i.labelTarget)});return n=Is(n),n.length<2?!1:n})};const pk={__depends__:[w2,mb,$f],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",jo],alignElementsMenuProvider:["type",Wa],bpmnAlignElements:["type",fu]};function Wi(e,t,n,i){te.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(o){var a=o.context,s=a.hints||{},c=a.shape,u=a.parent||a.newParent;s.autoResize!==!1&&r._expand([c],u)}),this.postExecuted(["elements.move"],function(o){var a=o.context,s=ju(to(a.closure.topLevel)),c=a.hints,u=c?c.autoResize:!0;if(u!==!1){var l=no(s,function(f){return f.parent.id});$(l,function(f,p){Le(u)&&(f=f.filter(function(d){return ft(u,io({id:d.id}))})),r._expand(f,p)})}}),this.postExecuted(["shape.toggleCollapse"],function(o){var a=o.context,s=a.hints,c=a.shape;s&&s.autoResize===!1||c.collapsed||r._expand(c.children||[],c)}),this.postExecuted(["shape.resize"],function(o){var a=o.context,s=a.hints,c=a.shape,u=c.parent;s&&s.autoResize===!1||u&&r._expand([c],u)})}Wi.$inject=["eventBus","elementRegistry","modeling","rules"],xe(Wi,te),Wi.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Ae(It(e)),o=Ae(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),$s(V({},o,a))},Wi.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(fk(i,t)){var r=dk(si(t,["x","y","width","height"]),i);this.resize(t,i,{autoResize:r});var o=t.parent;o&&this._expand([t],o)}}},Wi.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Wi.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Wi.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)};function fk(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function dk(e,t){var n="";return e=Ae(e),t=Ae(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 du(e){e.invoke(Wi,this)}du.$inject=["injector"],xe(du,Wi),du.prototype.resize=function(e,t,n){E(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)};function Ua(e){Qn.call(this,e);var t=this;this.addRule("element.autoResize",function(n){return t.canResize(n.elements,n.target)})}Ua.$inject=["eventBus"],xe(Ua,Qn),Ua.prototype.canResize=function(e,t){return!1};function hu(e,t){Ua.call(this,e),this._modeling=t}xe(hu,Ua),hu.$inject=["eventBus","modeling"],hu.prototype.canResize=function(e,t){if(E(t.di,"bpmndi:BPMNPlane")||!E(t,"bpmn:Participant")&&!E(t,"bpmn:Lane")&&!E(t,"bpmn:SubProcess"))return!1;var n=!0;return $(e,function(i){if(E(i,"bpmn:Lane")||Ge(i)){n=!1;return}}),n};const hk={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",du],bpmnAutoResizeProvider:["type",hu]};function Ho(e,t,n){this._canvas=n,this._opts=V({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(r){var o=i._toBorderPoint(r);i.startScroll(o)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}Ho.$inject=["config.autoScroll","eventBus","canvas"],Ho.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++)mk(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 mk(e,t,n){return t<e&&e<n}Ho.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Ho.prototype.setOptions=function(e){this._opts=V({},this._opts,e)},Ho.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=$r(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};const gk={__depends__:[Fi],__init__:["autoScroll"],autoScroll:["type",Ho]};var ox="djs-bendpoint",ax="djs-segment-dragger";function yk(e,t){var n=$r(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 Ff(e,t,n){var i=yk(e,n),r=ip(t,i);return r}function jf(e,t){var n=Pe("g");Xe(n).add(ox),je(e,n);var i=Pe("circle");_e(i,{cx:0,cy:0,r:4}),Xe(i).add("djs-visual"),je(n,i);var r=Pe("circle");return _e(r,{cx:0,cy:0,r:10}),Xe(r).add("djs-hit"),je(n,r),t&&Xe(n).add(t),n}function vk(e,t,n,i){var r=Pe("g");je(e,r);var o=18,a=6,s=11,c=xk(t,n,i),u=a+s,l=Pe("rect");_e(l,{x:-o/2,y:-a/2,width:o,height:a}),Xe(l).add("djs-visual"),je(r,l);var f=Pe("rect");return _e(f,{x:-c/2,y:-u/2,width:c,height:u}),Xe(f).add("djs-hit"),je(r,f),Dm(r,i==="v"?90:0),r}function sx(e,t,n){var i=Pe("g"),r=Ol(t,n),o=Di(t,n);return je(e,i),vk(i,t,n,o),Xe(i).add(ax),Xe(i).add(o==="h"?"horizontal":"vertical"),rn(i,r.x,r.y),i}function Hf(e){return Math.abs(Math.round(e*2/3))}function bk(e,t){var n=_k(e,t);return up(e,n)}function xk(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Hf(n==="h"?i:r)}function _k(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=bg(e,[a,s]);c<i&&(i=c,r=o)}return[n[r],n[r+1]]}function cx(e,t,n,i,r){function o(b,x,C){var P=b.index,D=b.point,T,I,k,L,H,ae;return P<=0||b.bendpoint?!1:(T=x[P-1],I=x[P],k=Ol(T,I),L=Di(T,I),H=Math.abs(D.x-k.x),ae=Math.abs(D.y-k.y),L&&H<=C&&ae<=C)}function a(b,x){var C=b.waypoints,P,D,T,I;return x.index<=0||x.bendpoint||(P={start:C[x.index-1],end:C[x.index]},D=Di(P.start,P.end),!D)?null:(D==="h"?T=P.end.x-P.start.x:T=P.end.y-P.start.y,I=Hf(T)/2,I)}function s(b,x){var C=x.waypoints,P=Ff(t,C,b),D;if(P){D=a(x,P);var T;if(o(P,C,D)?T=r.start(b,x,P.index):T=i.start(b,x,P.index,!P.bendpoint),T!==!1)return!0}}function c(b,x,C){$e.bind(b,x,function(P){n.triggerMouseEvent(x,P,C),P.stopPropagation()})}function u(b,x){var C=t.getLayer("overlays"),P=at('.djs-bendpoints[data-element-id="'+ja(b.id)+'"]',C);return!P&&x&&(P=Pe("g"),_e(P,{"data-element-id":b.id}),Xe(P).add("djs-bendpoints"),je(C,P),c(P,"mousedown",b),c(P,"click",b),c(P,"dblclick",b)),P}function l(b,x){return at('.djs-segment-dragger[data-segment-idx="'+b+'"]',x)}function f(b,x){x.waypoints.forEach(function(C,P){var D=jf(b);je(b,D),rn(D,C.x,C.y)}),jf(b,"floating")}function p(b,x){for(var C=x.waypoints,P,D,T,I=1;I<C.length;I++)P=C[I-1],D=C[I],Di(P,D)&&(T=sx(b,P,D),_e(T,{"data-segment-idx":I}),c(T,"mousemove",x))}function d(b){$(ks("."+ox,b),function(x){Gt(x)})}function m(b){$(ks("."+ax,b),function(x){Gt(x)})}function h(b){var x=u(b);return x||(x=u(b,!0),f(x,b),p(x,b)),x}function g(b){var x=u(b);x&&(m(x),d(x),p(x,b),f(x,b))}function y(b,x){var C=at(".floating",b),P=x.point;C&&(rn(C,P.x,P.y),Xe(C).add("positioned"))}function v(b,x,C){var P=l(x.index,b),D=C[x.index-1],T=C[x.index],I=x.point,k=Ol(D,T),L=Di(D,T),H,ae;P&&(H=wk(P),ae={x:I.x-k.x,y:I.y-k.y},L==="v"&&(ae={x:ae.y,y:ae.x}),rn(H,ae.x,ae.y))}e.on("connection.changed",function(b){g(b.element)}),e.on("connection.remove",function(b){var x=u(b.element);x&&Gt(x)}),e.on("element.marker.update",function(b){var x=b.element,C;x.waypoints&&(C=h(x),b.add?Xe(C).add(b.marker):Xe(C).remove(b.marker))}),e.on("element.mousemove",function(b){var x=b.element,C=x.waypoints,P,D;if(C){if(P=u(x,!0),D=Ff(t,C,b.originalEvent),!D)return;y(P,D),D.bendpoint||v(P,D,C)}}),e.on("element.mousedown",function(b){if(ur(b)){var x=b.originalEvent,C=b.element;if(C.waypoints)return s(x,C)}}),e.on("selection.changed",function(b){var x=b.newSelection,C=x[0];C&&C.waypoints&&h(C)}),e.on("element.hover",function(b){var x=b.element;x.waypoints&&h(x)}),e.on("element.out",function(b){var x=b.element;if(x.waypoints){var C=u(x);if(C){var P=at(".floating",C);P&&Xe(P).remove("positioned")}}}),e.on("element.updateId",function(b){var x=b.element,C=b.newId;if(x.waypoints){var P=u(x);P&&_e(P,{"data-element-id":C})}}),this.addHandles=h,this.updateHandles=g,this.getBendpointsContainer=u,this.getSegmentDragger=l}cx.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];function wk(e){return at(".djs-visual",e)}var ux=Math.round,Ur="reconnectStart",Yr="reconnectEnd",Ya="updateWaypoints";function zf(e,t,n,i,r,o){this._injector=e,this.start=function(a,s,c,u){var l=n.getGraphics(s),f=s.source,p=s.target,d=s.waypoints,m;!u&&c===0?m=Ur:!u&&c===d.length-1?m=Yr:m=Ya;var h=m===Ya?"connection.updateWaypoints":"connection.reconnect",g=r.allowed(h,{connection:s,source:f,target:p});if(g===!1&&(g=r.allowed(h,{connection:s,source:p,target:f})),g!==!1)return i.init(a,"bendpoint.move",{data:{connection:s,connectionGfx:l,context:{allowed:g,bendpointIndex:c,connection:s,source:f,target:p,insert:u,type:m}}})},t.on("bendpoint.move.hover",function(a){var s=a.context,c=s.connection,u=c.source,l=c.target,f=a.hover,p=s.type;s.hover=f;var d;if(f){var m=p===Ya?"connection.updateWaypoints":"connection.reconnect";if(d=s.allowed=r.allowed(m,{connection:c,source:p===Ur?f:u,target:p===Yr?f:l}),d){s.source=p===Ur?f:u,s.target=p===Yr?f:l;return}d===!1&&(d=s.allowed=r.allowed(m,{connection:c,source:p===Yr?f:l,target:p===Ur?f:u})),d&&(s.source=p===Yr?f:l,s.target=p===Ur?f:u)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(a){var s=a.context,c=s.type;s.hover=null,s.source=null,s.target=null,c!==Ya&&(s.allowed=!1)}),t.on("bendpoint.move.end",function(a){var s=a.context,c=s.allowed,u=s.bendpointIndex,l=s.connection,f=s.insert,p=l.waypoints.slice(),d=s.source,m=s.target,h=s.type,g=s.hints||{},y={x:ux(a.x),y:ux(a.y)};if(!c)return!1;h===Ya?(f?p.splice(u,0,y):p[u]=y,g.bendpointMove={insert:f,bendpointIndex:u},p=this.cropWaypoints(l,p),o.updateWaypoints(l,FS(p),g)):(h===Ur?(g.docking="source",mu(s)&&(g.docking="target",g.newWaypoints=p.reverse())):h===Yr&&(g.docking="target",mu(s)&&(g.docking="source",g.newWaypoints=p.reverse())),o.reconnect(l,d,m,y,g))},this)}zf.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],zf.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 mu(e){var t=e.hover,n=e.source,i=e.target,r=e.type;if(r===Ur)return t&&i&&t===i&&n!==i;if(r===Yr)return t&&n&&t===n&&n!==i}var Ek="reconnectStart",Sk="reconnectEnd",lx="updateWaypoints",qa="connect-ok",gu="connect-not-ok",px="connect-hover",fx="djs-updating",dx="djs-dragging",hx=1100;function mx(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",function(o){var a=o.context,s=a.bendpointIndex,c=a.connection,u=a.insert,l=c.waypoints,f=l.slice();a.waypoints=l,u&&f.splice(s,0,{x:o.x,y:o.y}),c.waypoints=f;var p=a.draggerGfx=jf(i.getLayer("overlays"));Xe(p).add("djs-dragging"),i.addMarker(c,dx),i.addMarker(c,fx)}),n.on("bendpoint.move.hover",function(o){var a=o.context,s=a.allowed,c=a.hover,u=a.type;if(c){if(i.addMarker(c,px),u===lx)return;s?(i.removeMarker(c,gu),i.addMarker(c,qa)):s===!1&&(i.removeMarker(c,qa),i.addMarker(c,gu))}}),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],hx,function(o){var a=o.context,s=a.hover,c=a.target;s&&(i.removeMarker(s,px),i.removeMarker(s,c?qa:gu))}),n.on("bendpoint.move.move",function(o){var a=o.context,s=a.allowed,c=a.bendpointIndex,u=a.draggerGfx,l=a.hover,f=a.type,p=a.connection,d=p.source,m=p.target,h=p.waypoints.slice(),g={x:o.x,y:o.y},y=a.hints||{},v={};r&&(y.connectionStart&&(v.connectionStart=y.connectionStart),y.connectionEnd&&(v.connectionEnd=y.connectionEnd),f===Ek?mu(a)?(v.connectionEnd=v.connectionEnd||g,v.source=m,v.target=l||d,h=h.reverse()):(v.connectionStart=v.connectionStart||g,v.source=l||d,v.target=m):f===Sk?mu(a)?(v.connectionStart=v.connectionStart||g,v.source=l||m,v.target=d,h=h.reverse()):(v.connectionEnd=v.connectionEnd||g,v.source=d,v.target=l||m):(v.noCropping=!0,v.noLayout=!0,h[c]=g),f===lx&&(h=e.cropWaypoints(p,h)),v.waypoints=h,r.drawPreview(a,s,v)),rn(u,o.x,o.y)},this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],hx,function(o){var a=o.context,s=a.connection,c=a.draggerGfx,u=a.hover,l=a.target,f=a.waypoints;s.waypoints=f,Gt(c),i.removeMarker(s,fx),i.removeMarker(s,dx),u&&(i.removeMarker(u,qa),i.removeMarker(u,l?qa:gu)),r&&r.cleanUp(a)})}mx.$inject=["bendpointMove","injector","eventBus","canvas"];var gx="connect-hover",yx="djs-updating";function vx(e,t,n){return Gf(e,t,e[t]+n)}function Gf(e,t,n){return{x:t==="x"?n:e.x,y:t==="y"?n:e.y}}function Rk(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 Gf(t,i,s)}function bx(e){return e==="x"?"y":"x"}function xx(e,t,n){var i,r;return e.original?e.original:(i=Ie(t),r=bx(n),Gf(e,r,i[r]))}function _x(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(f,p,d){var m,h=n.getGraphics(p),g=d-1,y=d,v=p.waypoints,b=v[g],x=v[y],C=Ff(n,v,f),P,D,T;if(P=Di(b,x),!!P)return D=P==="v"?"x":"y",g===0&&(b=xx(b,p.source,D)),y===v.length-1&&(x=xx(x,p.target,D)),C?T=C.point:T={x:(b.x+x.x)/2,y:(b.y+x.y)/2},m={connection:p,segmentStartIndex:g,segmentEndIndex:y,segmentStart:b,segmentEnd:x,axis:D,dragPosition:T},i.init(f,T,"connectionSegment.move",{cursor:D==="x"?"resize-ew":"resize-ns",data:{connection:p,connectionGfx:h,context:m}})};function s(f,p){if(!a)return p;var d=f.waypoints,m;return f.waypoints=p,m=a.getCroppedWaypoints(f),f.waypoints=d,m}function c(f){r.update("connection",f.connection,f.connectionGfx)}function u(f,p,d){var m=f.newWaypoints,h=f.segmentStartIndex+p,g=m[h],y=f.segmentEndIndex+p,v=m[y],b=bx(f.axis),x=Rk(d,g,v,b);rn(f.draggerGfx,x.x,x.y)}function l(f,p){var d=0,m=f.filter(function(h,g){return kl(f[g-1],f[g+1],h)?(d=g<=p?d-1:d,!1):!0});return{waypoints:m,segmentOffset:d}}t.on("connectionSegment.move.start",function(f){var p=f.context,d=f.connection,m=n.getLayer("overlays");p.originalWaypoints=d.waypoints.slice(),p.draggerGfx=sx(m,p.segmentStart,p.segmentEnd),Xe(p.draggerGfx).add("djs-dragging"),n.addMarker(d,yx)}),t.on("connectionSegment.move.move",function(f){var p=f.context,d=p.connection,m=p.segmentStartIndex,h=p.segmentEndIndex,g=p.segmentStart,y=p.segmentEnd,v=p.axis,b=p.originalWaypoints.slice(),x=vx(g,v,f["d"+v]),C=vx(y,v,f["d"+v]),P=b.length,D=0;b[m]=x,b[h]=C;var T,I;m<2&&(T=nn(d.source,x),m===1?T==="intersect"&&(b.shift(),b[0]=x,D--):T!=="intersect"&&(b.unshift(g),D++)),h>P-3&&(I=nn(d.target,C),h===P-2?I==="intersect"&&(b.pop(),b[b.length-1]=C):I!=="intersect"&&b.push(y)),p.newWaypoints=d.waypoints=s(d,b),u(p,D,f),p.newSegmentStartIndex=m+D,c(f)}),t.on("connectionSegment.move.hover",function(f){f.context.hover=f.hover,n.addMarker(f.hover,gx)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(f){var p=f.context.hover;p&&n.removeMarker(p,gx)}),t.on("connectionSegment.move.cleanup",function(f){var p=f.context,d=p.connection;p.draggerGfx&&Gt(p.draggerGfx),n.removeMarker(d,yx)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(f){var p=f.context,d=p.connection;d.waypoints=p.originalWaypoints,c(f)}),t.on("connectionSegment.move.end",function(f){var p=f.context,d=p.connection,m=p.newWaypoints,h=p.newSegmentStartIndex;m=m.map(function(C){return{original:C.original,x:Math.round(C.x),y:Math.round(C.y)}});var g=l(m,h),y=g.waypoints,v=s(d,y),b=g.segmentOffset,x={segmentMove:{segmentStartIndex:p.segmentStartIndex,newSegmentStartIndex:h+b}};o.updateWaypoints(d,v,x)})}_x.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Ck=Math.abs,wx=Math.round;function Pk(e,t,n){n=n===void 0?10:n;var i,r;for(i=0;i<t.length;i++)if(r=t[i],Ck(r-e)<=n)return r}function Ex(e){return{x:e.x,y:e.y}}function Sx(e){return{x:e.x+e.width,y:e.y+e.height}}function ni(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:wx(e.x+e.width/2),y:wx(e.y+e.height/2)}}function zo(e,t){var n=e.snapped;return n?typeof t=="string"?n[t]:n.x&&n.y:!1}function Ft(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 Rx(e){return e.children||[]}var Ak=Math.abs,Cx=Math.round,Vf=10;function Px(e){function t(o,a){if(Le(o)){for(var s=o.length;s--;)if(Ak(o[s]-a)<=Vf)return o[s]}else{o=+o;var c=a%o;if(c<Vf)return a-c;if(c>o-Vf)return a-c+o}return a}function n(o,a){if(o.waypoints)return bk(a,o);if(o.width)return{x:Cx(o.width/2+o.x),y:Cx(o.height/2+o.y)}}function i(o){var a=o.context,s=a.snapPoints,c=a.connection,u=c.waypoints,l=a.segmentStart,f=a.segmentStartIndex,p=a.segmentEnd,d=a.segmentEndIndex,m=a.axis;if(s)return s;var h=[u[f-1],l,p,u[d+1]];return f<2&&h.unshift(n(c.source,o)),d>u.length-3&&h.unshift(n(c.target,o)),a.snapPoints=s={horizontal:[],vertical:[]},$(h,function(g){g&&(g=g.original||g,m==="y"&&s.horizontal.push(g.y),m==="x"&&s.vertical.push(g.x))}),s}e.on("connectionSegment.move.move",1500,function(o){var a=i(o),s=o.x,c=o.y,u,l;if(a){u=t(a.vertical,s),l=t(a.horizontal,c);var f=s-u,p=c-l;V(o,{dx:o.dx-f,dy:o.dy-p,x:u,y:l}),(f||a.vertical.indexOf(s)!==-1)&&Ft(o,"x",u),(p||a.horizontal.indexOf(c)!==-1)&&Ft(o,"y",l)}});function r(o){var a=o.snapPoints,s=o.connection.waypoints,c=o.bendpointIndex;if(a)return a;var u=[s[c-1],s[c+1]];return o.snapPoints=a={horizontal:[],vertical:[]},$(u,function(l){l&&(l=l.original||l,a.horizontal.push(l.y),a.vertical.push(l.x))}),a}e.on(["connect.hover","connect.move","connect.end"],1500,function(o){var a=o.context,s=a.hover,c=s&&n(s,o);!ct(s)||!c||!c.x||!c.y||(Ft(o,"x",c.x),Ft(o,"y",c.y))}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(o){var a=o.context,s=r(a),c=a.hover,u=c&&n(c,o),l=o.x,f=o.y,p,d;if(s){p=t(u?s.vertical.concat([u.x]):s.vertical,l),d=t(u?s.horizontal.concat([u.y]):s.horizontal,f);var m=l-p,h=f-d;V(o,{dx:o.dx-m,dy:o.dy-h,x:o.x-m,y:o.y-h}),(m||s.vertical.indexOf(l)!==-1)&&Ft(o,"x",p),(h||s.horizontal.indexOf(f)!==-1)&&Ft(o,"y",d)}})}Px.$inject=["eventBus"];const Tk={__depends__:[Fi,wi],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",cx],bendpointMove:["type",zf],bendpointMovePreview:["type",mx],connectionSegmentMove:["type",_x],bendpointSnapping:["type",Px]};function Ax(e,t,n,i){function r(a,s){return i.allowed("connection.create",{source:a,target:s})}function o(a,s){return r(s,a)}e.on("connect.hover",function(a){var s=a.context,c=s.start,u=a.hover,l;if(s.hover=u,l=s.canExecute=r(c,u),!eo(l)){if(l!==!1){s.source=c,s.target=u;return}l=s.canExecute=o(c,u),!eo(l)&&l!==!1&&(s.source=u,s.target=c)}}),e.on(["connect.out","connect.cleanup"],function(a){var s=a.context;s.hover=null,s.source=null,s.target=null,s.canExecute=!1}),e.on("connect.end",function(a){var s=a.context,c=s.canExecute,u=s.connectionStart,l={x:a.x,y:a.y},f=s.source,p=s.target;if(!c)return!1;var d=null,m={connectionStart:Wf(s)?l:u,connectionEnd:Wf(s)?u:l};Yt(c)&&(d=c),s.connection=n.connect(f,p,d,m)}),this.start=function(a,s,c,u){Yt(c)||(u=c,c=Ie(s)),t.init(a,"connect",{autoActivate:u,data:{shape:s,context:{start:s,connectionStart:c}}})}}Ax.$inject=["eventBus","dragging","modeling","rules"];function Wf(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}var Mk=1100,kk=900,Tx="connect-ok",Mx="connect-not-ok";function kx(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(r){var o=r.context,a=o.canExecute,s=o.hover,c=o.source,u=o.start,l=o.startPosition,f=o.target,p=o.connectionStart||l,d=o.connectionEnd||{x:r.x,y:r.y},m=p,h=d;Wf(o)&&(m=d,h=p),i.drawPreview(o,a,{source:c||u,target:f||s,connectionStart:m,connectionEnd:h})}),t.on("connect.hover",kk,function(r){var o=r.context,a=r.hover,s=o.canExecute;s!==null&&n.addMarker(a,s?Tx:Mx)}),t.on(["connect.out","connect.cleanup"],Mk,function(r){var o=r.hover;o&&(n.removeMarker(o,Tx),n.removeMarker(o,Mx))}),i&&t.on("connect.cleanup",function(r){i.cleanUp(r.context)})}kx.$inject=["injector","eventBus","canvas"];const Uf={__depends__:[Jn,wi,Fi],__init__:["connectPreview"],connect:["type",Ax],connectPreview:["type",kx]};var Ok="djs-dragger";function Ui(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)}Ui.$inject=["injector","canvas","graphicsFactory","elementFactory"],Ui.prototype.drawPreview=function(e,t,n){n=n||{};var i=e.connectionPreviewGfx,r=e.getConnection,o=n.source,a=n.target,s=n.waypoints,c=n.connectionStart,u=n.connectionEnd,l=n.noLayout,f=n.noCropping,p=n.noNoop,d,m=this;if(i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Os(i),r||(r=e.getConnection=Dk(function(h,g,y){return m.getConnection(h,g,y)})),t&&(d=r(t,o,a)),!d){!p&&this.drawNoopPreview(i,n);return}d.waypoints=s||[],this._layouter&&!l&&(d.waypoints=this._layouter.layoutConnection(d,{source:o,target:a,connectionStart:c,connectionEnd:u,waypoints:n.waypoints||d.waypoints})),(!d.waypoints||!d.waypoints.length)&&(d.waypoints=[o?Ie(o):c,a?Ie(a):u]),this._connectionDocking&&(o||a)&&!f&&(d.waypoints=this._connectionDocking.getCroppedWaypoints(d,o,a)),this._graphicsFactory.drawConnection(i,d,{stroke:"var(--element-dragger-color)"})},Ui.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||Ie(n),o=t.connectionEnd||Ie(i),a=this.cropWaypoints(r,o,n,i),s=this.createNoopConnection(a[0],a[1]);je(e,s)},Ui.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&&ca(o,s,!0)||e,t=i&&ca(a,s,!1)||t,[e,t]},Ui.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Gt(e.connectionPreviewGfx)},Ui.prototype.getConnection=function(e){var t=Lk(e);return this._elementFactory.createConnection(t)},Ui.prototype.createConnectionPreviewGfx=function(){var e=Pe("g");return _e(e,{pointerEvents:"none"}),Xe(e).add(Ok),je(this._canvas.getActiveLayer(),e),e},Ui.prototype.createNoopConnection=function(e,t){return ra([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};function Dk(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 Lk(e){return Yt(e)?e:{}}const Ik={__init__:["connectionPreview"],connectionPreview:["type",Ui]},yu="complex-preview";class Ox{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(yu);n.filter(s=>!Bk(s)).forEach(s=>{let c;ct(s)?(c=this._graphicsFactory._createContainer("connection",Pe("g")),this._graphicsFactory.drawConnection(Ir(c),s)):(c=this._graphicsFactory._createContainer("shape",Pe("g")),this._graphicsFactory.drawShape(Ir(c),s),rn(c,s.x,s.y)),this._previewSupport.addDragger(s,a,c)}),i.forEach(({element:s,delta:c})=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"]);const u=this._previewSupport.addDragger(s,a);ct(s)?rn(u,c.x,c.y):rn(u,s.x+c.x,s.y+c.y)}),r.forEach(s=>{this._previewSupport.addDragger(s,a,void 0,"djs-dragging"),this._canvas.addMarker(s,"djs-element-hidden"),this._markers.push([s,"djs-element-hidden"])}),o.forEach(({shape:s,bounds:c})=>{this._canvas.addMarker(s,"djs-hidden"),this._markers.push([s,"djs-hidden"]),this._previewSupport.addDragger(s,a,void 0,"djs-dragging");const u=this._graphicsFactory._createContainer("shape",Pe("g"));this._graphicsFactory.drawShape(Ir(u),s,{width:c.width,height:c.height}),rn(u,c.x,c.y),this._previewSupport.addDragger(s,a,u)})}cleanUp(){Os(this._canvas.getLayer(yu)),this._markers.forEach(([t,n])=>this._canvas.removeMarker(t,n)),this._markers=[]}show(){this._canvas.showLayer(yu)}hide(){this._canvas.hideLayer(yu)}}Ox.$inject=["canvas","graphicsFactory","previewSupport"];function Bk(e){return e.hidden}const Nk={__depends__:[Oo],__init__:["complexPreview"],complexPreview:["type",Ox]},Dx=Math.round;function vu(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}vu.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,a=this._eventBus,s=this._layouter,c=this._rules,u=o.createShape(V({type:t},n)),l=a.fire("autoPlace",{source:e,shape:u});if(!l)return;V(u,{x:l.x-Dx(u.width/2),y:l.y-Dx(u.height/2)});const f=c.allowed("connection.create",{source:e,target:u,hints:{targetParent:e.parent}});let p=null;f&&(p=o.createConnection(f),p.waypoints=s.layoutConnection(p,{source:e,target:u}),p.waypoints=r.getCroppedWaypoints(p,e,u)),i.create({created:[u,p].filter(d=>!eo(d))})},vu.prototype.cleanUp=function(){this._complexPreview.cleanUp()},vu.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];const $k={__depends__:[Wc,Nk,vf],__init__:["appendPreview"],appendPreview:["type",vu]};var Lx=Math.min,Ix=Math.max;function Yf(e){e.preventDefault()}function Ka(e){e.stopPropagation()}function Fk(e){return e.nodeType===Node.TEXT_NODE}function jk(e){return[].slice.call(e)}function li(e){this.container=e.container,this.parent=yt('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=at("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.focusoutHandler=e.focusoutHandler||function(){},this.autoResize=Sn(this.autoResize,this),this.handlePaste=Sn(this.handlePaste,this)}li.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"]);V(o.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},c);var u=si(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return V(a.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},u),i.centerVertically&&V(a.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},u),a.innerText=n,$e.bind(a,"keydown",this.keyHandler),$e.bind(a,"mousedown",Ka),$e.bind(a,"paste",r.handlePaste),$e.bind(a,"focusout",this.focusoutHandler),i.autoResize&&$e.bind(a,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(o),this.setSelection(a.lastChild,a.lastChild&&a.lastChild.length),o},li.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)}},li.prototype.insertText=function(e){e=Hk(e);var t=document.execCommand("insertText",!1,e);t||this._insertTextIE(e)},li.prototype._insertTextIE=function(e){var t=this.getSelection(),n=t.startContainer,i=t.endContainer,r=t.startOffset,o=t.endOffset,a=t.commonAncestorContainer,s=jk(a.childNodes),c,u;if(Fk(a)){var l=n.textContent;n.textContent=l.substring(0,r)+e+l.substring(o),c=n,u=r+e.length}else if(n===this.content&&i===this.content){var f=document.createTextNode(e);this.content.insertBefore(f,s[r]),c=f,u=f.textContent.length}else{var p=s.indexOf(n),d=s.indexOf(i);s.forEach(function(m,h){h===p?m.textContent=n.textContent.substring(0,r)+e+i.textContent.substring(o):h>p&&h<=d&&gi(m)}),c=n,u=r+e.length}c&&u!==void 0&&setTimeout(function(){self.setSelection(c,u)})},li.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})}},li.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=yt('<div class="djs-direct-editing-resize-handle"></div>');var s,c,u,l,f=function(m){Yf(m),Ka(m),s=m.clientX,c=m.clientY;var h=t.getBoundingClientRect();u=h.width,l=h.height,$e.bind(document,"mousemove",p),$e.bind(document,"mouseup",d)},p=function(m){Yf(m),Ka(m);var h=Lx(Ix(u+m.clientX-s,i),o),g=Lx(Ix(l+m.clientY-c,r),a);t.style.width=h+"px",t.style.height=g+"px",e.resizeHandler({width:u,height:l,dx:m.clientX-s,dy:m.clientY-c})},d=function(m){Yf(m),Ka(m),$e.unbind(document,"mousemove",p,!1),$e.unbind(document,"mouseup",d,!1)};$e.bind(n,"mousedown",f)}V(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},li.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),$e.unbind(t,"keydown",this.keyHandler),$e.unbind(t,"mousedown",Ka),$e.unbind(t,"input",this.autoResize),$e.unbind(t,"paste",this.handlePaste),$e.unbind(t,"focusout",this.focusoutHandler),n&&(n.removeAttribute("style"),gi(n)),gi(e)},li.prototype.getValue=function(){return this.content.innerText.trim()},li.prototype.getSelection=function(){var e=window.getSelection(),t=e.getRangeAt(0);return t},li.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 Hk(e){return e.replace(/\r\n|\r|\n/g,`
316
+ `)}function $n(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new li({container:t.getContainer(),keyHandler:Sn(this._handleKey,this),resizeHandler:Sn(this._handleResize,this),focusoutHandler:Sn(this._handleFocusout,this)}),e.on(["diagram.clear","diagram.destroy"],()=>this._cleanup())}$n.$inject=["eventBus","canvas"],$n.prototype.registerProvider=function(e){this._providers.push(e)},$n.prototype.isActive=function(e){return!!(this._active&&(!e||this._active.element===e))},$n.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},$n.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},$n.prototype.close=function(){this._fire("deactivate"),this._cleanup(),this._canvas.restoreFocus&&this._canvas.restoreFocus()},$n.prototype._cleanup=function(){this._active&&(this._textbox.destroy(),this._active=null,this.resizable=void 0)},$n.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()}},$n.prototype.getValue=function(){return this._textbox.getValue()},$n.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()},$n.prototype._handleResize=function(e){this._fire("resize",e)},$n.prototype._handleFocusout=function(e){e.relatedTarget&&this._textbox.parent.contains(e.relatedTarget)||this.complete()},$n.prototype.activate=function(e){if(this.isActive()&&this.cancel(),this._eventBus.fire("directEditing.activate.allowed",{element:e})===!1)return!1;var t,n=ft(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 Bx={__depends__:[_c],__init__:["directEditing"],directEditing:["type",$n]};function zk(e){return function(t){var n=t.target,i=ie(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===Ke(e);return!o||!a||!s||!c}}const Gk={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 ee(e,t={}){var n=Gk[e];if(!n)throw new Error("unknown popup entry <"+e+">");return{...n,actionName:"replace-with-"+e,...t}}var Vk=[ee("none-start-event",{actionName:"replace-with-none-start"}),ee("none-intermediate-throwing"),ee("none-end-event",{actionName:"replace-with-none-end"}),ee("message-start"),ee("timer-start"),ee("conditional-start"),ee("signal-start")],Wk=[ee("none-start-event",{actionName:"replace-with-none-start"}),ee("none-intermediate-throwing"),ee("none-end-event",{actionName:"replace-with-none-end"})],Uk=[ee("none-start-event",{actionName:"replace-with-none-start"}),ee("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ee("none-end-event",{actionName:"replace-with-none-end"}),ee("message-intermediate-catch"),ee("message-intermediate-throw"),ee("timer-intermediate-catch"),ee("escalation-intermediate-throw"),ee("conditional-intermediate-catch"),ee("link-intermediate-catch"),ee("link-intermediate-throw"),ee("compensation-intermediate-throw"),ee("signal-intermediate-catch"),ee("signal-intermediate-throw")],Yk=[ee("none-start-event",{actionName:"replace-with-none-start"}),ee("none-intermediate-throwing",{actionName:"replace-with-none-intermediate-throw"}),ee("none-end-event",{actionName:"replace-with-none-end"}),ee("message-end"),ee("escalation-end"),ee("error-end"),ee("cancel-end"),ee("compensation-end"),ee("signal-end"),ee("terminate-end")],qk=[ee("exclusive-gateway"),ee("parallel-gateway"),ee("inclusive-gateway"),ee("complex-gateway"),ee("event-based-gateway")],Kk=[ee("transaction"),ee("event-subprocess"),ee("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ee("collapsed-subprocess")],Xk=[ee("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ee("transaction"),ee("event-subprocess"),ee("collapsed-ad-hoc-subprocess")],Nx=[ee("transaction"),ee("expanded-subprocess",{actionName:"replace-with-subprocess",label:"Sub-process"}),ee("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess",label:"Ad-hoc sub-process"}),ee("event-subprocess")],Zk=Nx,$x=[ee("task"),ee("user-task"),ee("service-task"),ee("send-task"),ee("receive-task"),ee("manual-task"),ee("rule-task"),ee("script-task"),ee("call-activity"),ee("collapsed-subprocess"),ee("expanded-subprocess"),ee("collapsed-ad-hoc-subprocess"),ee("expanded-ad-hoc-subprocess",{actionName:"replace-with-ad-hoc-subprocess"})],Qk=[ee("data-store-reference")],Jk=[ee("data-object-reference")],eO=[ee("message-boundary"),ee("timer-boundary"),ee("escalation-boundary"),ee("conditional-boundary"),ee("error-boundary"),ee("cancel-boundary"),ee("signal-boundary"),ee("compensation-boundary"),ee("non-interrupting-message-boundary"),ee("non-interrupting-timer-boundary"),ee("non-interrupting-escalation-boundary"),ee("non-interrupting-conditional-boundary"),ee("non-interrupting-signal-boundary")],tO=[ee("message-start"),ee("timer-start"),ee("conditional-start"),ee("signal-start"),ee("error-start"),ee("escalation-start"),ee("compensation-start"),ee("non-interrupting-message-start"),ee("non-interrupting-timer-start"),ee("non-interrupting-conditional-start"),ee("non-interrupting-signal-start"),ee("non-interrupting-escalation-start")],nO=[{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"}],iO=[ee("expanded-pool"),ee("collapsed-pool",{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t}})],rO={"bpmn:MessageEventDefinition":[ee("message-start"),ee("message-intermediate-catch"),ee("message-intermediate-throw"),ee("message-end")],"bpmn:TimerEventDefinition":[ee("timer-start"),ee("timer-intermediate-catch")],"bpmn:ConditionalEventDefinition":[ee("conditional-start"),ee("conditional-intermediate-catch")],"bpmn:SignalEventDefinition":[ee("signal-start"),ee("signal-intermediate-catch"),ee("signal-intermediate-throw"),ee("signal-end")],"bpmn:ErrorEventDefinition":[ee("error-start"),ee("error-end")],"bpmn:EscalationEventDefinition":[ee("escalation-start"),ee("escalation-intermediate-throw"),ee("escalation-end")],"bpmn:CompensateEventDefinition":[ee("compensation-start"),ee("compensation-intermediate-throw"),ee("compensation-end")]};const Fx={"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 ni(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()}ni.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],ni.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},ni.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(De(e)||!n.allowed("shape.replace",{element:e}))return{};var a=$k(e);return E(t,"bpmn:DataObjectReference")?this._createEntries(e,qk):E(t,"bpmn:DataStoreReference")&&!E(e.parent,"bpmn:Collaboration")?this._createEntries(e,Kk):(E(t,"bpmn:Event")&&!E(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=eO[r]||[],!fn(t.$parent)&&E(t.$parent,"bpmn:SubProcess")&&(i=Ue(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),E(t,"bpmn:StartEvent")&&!E(t.$parent,"bpmn:SubProcess")?(o=Ue(jk.concat(i),a),this._createEntries(e,o)):E(t,"bpmn:Participant")?(o=Ue(Jk,function(c){return Ke(e)!==c.target.isExpanded}),this._createEntries(e,o)):E(t,"bpmn:StartEvent")&&fn(t.$parent)?(o=Ue(Zk.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,f=t.isInterrupting===l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):E(t,"bpmn:StartEvent")&&!fn(t.$parent)&&E(t.$parent,"bpmn:SubProcess")?(o=Ue(Hk.concat(i),a),this._createEntries(e,o)):E(t,"bpmn:EndEvent")?(o=Ue(Gk.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!E(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):E(t,"bpmn:BoundaryEvent")?(o=Ue(Xk,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!E(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,f=t.cancelActivity==l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):E(t,"bpmn:IntermediateCatchEvent")||E(t,"bpmn:IntermediateThrowEvent")?(o=Ue(zk.concat(i),a),this._createEntries(e,o)):E(t,"bpmn:Gateway")?(o=Ue(Vk,a),this._createEntries(e,o)):E(t,"bpmn:Transaction")?(o=Ue(Lx,a),this._createEntries(e,o)):fn(t)&&Ke(e)?(o=Ue(Yk,a),this._createEntries(e,o)):E(t,"bpmn:AdHocSubProcess")&&Ke(e)?(o=Ue(Uk,a),this._createEntries(e,o)):E(t,"bpmn:SubProcess")&&Ke(e)?(o=Ue(Wk,a),this._createEntries(e,o)):E(t,"bpmn:SubProcess")&&!Ke(e)?(o=Ue(Ix,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):E(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Qk):E(t,"bpmn:FlowNode")?(o=Ue(Ix,a),this._createEntries(e,o)):{})},ni.prototype.getPopupMenuHeaderEntries=function(e){var t={};return E(e,"bpmn:Activity")&&!fn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),E(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),E(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),kg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},ni.prototype._createEntries=function(e,t){var n={},i=this;return N(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},ni.prototype._createSequenceFlowEntries=function(e,t){var n=ie(e),i={},r=this._modeling,o=this._moddle,a=this;return N(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(E(n.sourceRef,"bpmn:ExclusiveGateway")||E(n.sourceRef,"bpmn:InclusiveGateway")||E(n.sourceRef,"bpmn:ComplexGateway")||E(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&E(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:E(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(E(n.sourceRef,"bpmn:ExclusiveGateway")||E(n.sourceRef,"bpmn:InclusiveGateway")||E(n.sourceRef,"bpmn:ComplexGateway")||E(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},ni.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}},ni.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var f=e.businessObject.get("loopCharacteristics");f&&E(f,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,f,{isSequential:l.options.isSequential}):(f=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:f}))}var r=ie(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"}}}},ni.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}}},ni.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,u;c||(u=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:u})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},ni.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ie(e),i=this,r=Og(e),o=E(e,"bpmn:BoundaryEvent")?Bx["intermediate-event-non-interrupting"]:Bx["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 tO={__depends__:[If,Qy,zc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",ni]};function qa(e,t,n,i,r,o,a,s,c,u,l,f,p){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=f,this._eventBus=n,this._appendPreview=p,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var m=d.context,h=m.shape;if(!(!ba(d)||!i.isOpen(h))){var g=i.getEntries(h);g.replace&&g.replace.action.click(d,h)}}),n.on("contextPad.close",function(){p.cleanUp()})}qa.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],qa.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&V(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},qa.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return De(t)?Pr(e,n=>t.includes(n)):t},qa.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&V(l,m()),l;var f=e.businessObject;function p(b,x){r.start(b,x)}function d(b,x){n.removeElements([x])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(b){var x=5,C=t.getPad(b).html,P=C.getBoundingClientRect(),O={x:P.left,y:P.bottom+x};return O}function g(b,x,C,P){function O(k,D){var H=i.createShape(V({type:b},P));o.start(k,H,{source:D})}var A=s?function(k,D){var H=i.createShape(V({type:b},P));s.append(D,H)}:O,I=s?function(k,D){return u.create(D,b,P),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:C,action:{dragstart:O,click:A,hover:I}}}function y(b){return function(x,C){n.splitLane(C,b),t.open(C,!0)}}if(Ve(f,["bpmn:Lane","bpmn:Participant"])&&Ke(e)){var v=ar(e);V(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(b,x){n.addLane(x,"top")}}}}),v.length<2&&((qt(e)?e.height>=120:e.width>=120)&&V(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:y(2)}}}),(qt(e)?e.height>=180:e.width>=180)&&V(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:y(3)}}})),V(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(b,x){n.addLane(x,"bottom")}}}})}return E(f,"bpmn:FlowNode")&&(E(f,"bpmn:EventBasedGateway")?V(l,{"append.receive-task":g("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Nx(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?V(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!E(f,"bpmn:EndEvent")&&!f.isForCompensation&&!Nx(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!fn(f)&&V(l,{"append.end-event":g("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":g("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":g("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":g("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||V(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var C=V(h(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",C,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),E(f,"bpmn:SequenceFlow")&&V(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),E(f,"bpmn:MessageFlow")&&V(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Ve(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:p,dragstart:p}}}),E(f,"bpmn:TextAnnotation")&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),Ve(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:p,dragstart:p}}}),E(f,"bpmn:Group")&&V(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&V(l,m()),l};function Nx(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return N(o,function(a){a.$type===n&&(r=!0)}),i&&r}const nO={__depends__:[Lk,Dx,fb,Qn,Gf,xc,tO],__init__:["contextPadProvider"],contextPadProvider:["type",qa]};var iO={horizontal:["x","width"],vertical:["y","height"]},$x=5;function Ui(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return De(i)?i:i?n:[]})}Ui.$inject=["modeling","rules"],Ui.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Ui.prototype.trigger=function(e,t){var n=this._modeling,i,r;if(!(e.length<3)&&(this._setOrientation(t),r=this._filterElements(e),i=this._createGroups(r),!(i.length<=2)))return n.distributeElements(i,this._axis,this._dimension),i},Ui.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(N(t,function(o){r=o(r,n,i)}),r):e},Ui.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=li(e,i);return N(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Ui.prototype._setOrientation=function(e){var t=iO[e];this._axis=t[0],this._dimension=t[1]},Ui.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Ui.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+$x,max:t+n-$x}};const rO={__init__:["distributeElements"],distributeElements:["type",Ui]};function gu(e){Zn.call(this,e)}gu.$inject=["eventBus"],_e(gu,Zn),gu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ue(t,function(n){var i=Ve(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Os(t),t.length<3?!1:t})};var Fx={horizontal:`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">
327
+ </svg>`};function ii(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()}ii.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],ii.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},ii.prototype.getPopupMenuEntries=function(e){var s;var t=e.businessObject,n=this._rules,i=[],r,o=[];if(Le(e)||!n.allowed("shape.replace",{element:e}))return{};var a=zk(e);return E(t,"bpmn:DataObjectReference")?this._createEntries(e,Qk):E(t,"bpmn:DataStoreReference")&&!E(e.parent,"bpmn:Collaboration")?this._createEntries(e,Jk):(E(t,"bpmn:Event")&&!E(t,"bpmn:BoundaryEvent")&&(r=(s=t.get("eventDefinitions")[0])==null?void 0:s.$type,i=rO[r]||[],!mn(t.$parent)&&E(t.$parent,"bpmn:SubProcess")&&(i=Ue(i,function(c){return c.target.type!=="bpmn:StartEvent"}))),E(t,"bpmn:StartEvent")&&!E(t.$parent,"bpmn:SubProcess")?(o=Ue(Vk.concat(i),a),this._createEntries(e,o)):E(t,"bpmn:Participant")?(o=Ue(iO,function(c){return Ke(e)!==c.target.isExpanded}),this._createEntries(e,o)):E(t,"bpmn:StartEvent")&&mn(t.$parent)?(o=Ue(tO.concat(i),function(c){var u=c.target,l=u.isInterrupting!==!1,f=t.isInterrupting===l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):E(t,"bpmn:StartEvent")&&!mn(t.$parent)&&E(t.$parent,"bpmn:SubProcess")?(o=Ue(Wk.concat(i),a),this._createEntries(e,o)):E(t,"bpmn:EndEvent")?(o=Ue(Yk.concat(i),function(c){var u=c.target;return u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!E(t.$parent,"bpmn:Transaction")?!1:a(c)}),this._createEntries(e,o)):E(t,"bpmn:BoundaryEvent")?(o=Ue(eO,function(c){var u=c.target;if(u.eventDefinitionType=="bpmn:CancelEventDefinition"&&!E(t.attachedToRef,"bpmn:Transaction"))return!1;var l=u.cancelActivity!==!1,f=t.cancelActivity==l;return a(c)||!a(c)&&!f}),this._createEntries(e,o)):E(t,"bpmn:IntermediateCatchEvent")||E(t,"bpmn:IntermediateThrowEvent")?(o=Ue(Uk.concat(i),a),this._createEntries(e,o)):E(t,"bpmn:Gateway")?(o=Ue(qk,a),this._createEntries(e,o)):E(t,"bpmn:Transaction")?(o=Ue(Nx,a),this._createEntries(e,o)):mn(t)&&Ke(e)?(o=Ue(Zk,a),this._createEntries(e,o)):E(t,"bpmn:AdHocSubProcess")&&Ke(e)?(o=Ue(Xk,a),this._createEntries(e,o)):E(t,"bpmn:SubProcess")&&Ke(e)?(o=Ue(Kk,a),this._createEntries(e,o)):E(t,"bpmn:SubProcess")&&!Ke(e)?(o=Ue($x,function(c){var u=c.target.type===e.type,l=c.target.isExpanded===!0;return u===l}),this._createEntries(e,o)):E(t,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,nO):E(t,"bpmn:FlowNode")?(o=Ue($x,a),this._createEntries(e,o)):{})},ii.prototype.getPopupMenuHeaderEntries=function(e){var t={};return E(e,"bpmn:Activity")&&!mn(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),E(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),E(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Lg(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},ii.prototype._createEntries=function(e,t){var n={},i=this;return $(t,function(r){n[r.actionName]=i._createEntry(r,e)}),n},ii.prototype._createSequenceFlowEntries=function(e,t){var n=ie(e),i={},r=this._modeling,o=this._moddle,a=this;return $(t,function(s){switch(s.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(E(n.sourceRef,"bpmn:ExclusiveGateway")||E(n.sourceRef,"bpmn:InclusiveGateway")||E(n.sourceRef,"bpmn:ComplexGateway")||E(n.sourceRef,"bpmn:Activity"))&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:n})})});break;case"replace-with-conditional-flow":!n.conditionExpression&&E(n.sourceRef,"bpmn:Activity")&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){var c=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:c})})});break;default:E(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e,{conditionExpression:void 0})})}),(E(n.sourceRef,"bpmn:ExclusiveGateway")||E(n.sourceRef,"bpmn:InclusiveGateway")||E(n.sourceRef,"bpmn:ComplexGateway")||E(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[s.actionName]:a._createEntry(s,e,function(){r.updateProperties(e.source,{default:void 0})})})}}),i},ii.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}},ii.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(u,l){if(l.active){t._modeling.updateProperties(e,{loopCharacteristics:void 0});return}var f=e.businessObject.get("loopCharacteristics");f&&E(f,l.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,f,{isSequential:l.options.isSequential}):(f=t._moddle.create(l.options.loopCharacteristics,{isSequential:l.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:f}))}var r=ie(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"}}}},ii.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}}},ii.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;function r(a,s){var c=s.active,u;c||(u=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:u})}var o=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!o,action:r}}},ii.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=ie(e),i=this,r=Ig(e),o=E(e,"bpmn:BoundaryEvent")?Fx["intermediate-event-non-interrupting"]:Fx["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 oO={__depends__:[$f,tv,Wc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",ii]};function Xa(e,t,n,i,r,o,a,s,c,u,l,f,p){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=u,this._rules=l,this._translate=f,this._eventBus=n,this._appendPreview=p,e.autoPlace!==!1&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(d){var m=d.context,h=m.shape;if(!(!_a(d)||!i.isOpen(h))){var g=i.getEntries(h);g.replace&&g.replace.action.click(d,h)}}),n.on("contextPad.close",function(){p.cleanUp()})}Xa.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Xa.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&V(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(i,r){t.removeElements(r.slice())}}}}),n},Xa.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return Le(t)?Ar(e,n=>t.includes(n)):t},Xa.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._autoPlace,c=this._translate,u=this._appendPreview,l={};if(e.type==="label")return this._isDeleteAllowed([e])&&V(l,m()),l;var f=e.businessObject;function p(b,x){r.start(b,x)}function d(b,x){n.removeElements([x])}function m(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Delete"),action:{click:d}}}}function h(b){var x=5,C=t.getPad(b).html,P=C.getBoundingClientRect(),D={x:P.left,y:P.bottom+x};return D}function g(b,x,C,P){function D(k,L){var H=i.createShape(V({type:b},P));o.start(k,H,{source:L})}var T=s?function(k,L){var H=i.createShape(V({type:b},P));s.append(L,H)}:D,I=s?function(k,L){return u.create(L,b,P),()=>{u.cleanUp()}}:null;return{group:"model",className:x,title:C,action:{dragstart:D,click:T,hover:I}}}function y(b){return function(x,C){n.splitLane(C,b),t.open(C,!0)}}if(Ve(f,["bpmn:Lane","bpmn:Participant"])&&Ke(e)){var v=sr(e);V(l,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add lane above"),action:{click:function(b,x){n.addLane(x,"top")}}}}),v.length<2&&((Xt(e)?e.height>=120:e.width>=120)&&V(l,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two lanes"),action:{click:y(2)}}}),(Xt(e)?e.height>=180:e.width>=180)&&V(l,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three lanes"),action:{click:y(3)}}})),V(l,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add lane below"),action:{click:function(b,x){n.addLane(x,"bottom")}}}})}return E(f,"bpmn:FlowNode")&&(E(f,"bpmn:EventBasedGateway")?V(l,{"append.receive-task":g("bpmn:ReceiveTask","bpmn-icon-receive-task",c("Append receive task")),"append.message-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":g("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):jx(f,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?V(l,{"append.compensation-activity":g("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):!E(f,"bpmn:EndEvent")&&!f.isForCompensation&&!jx(f,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")&&!mn(f)&&V(l,{"append.end-event":g("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append end event")),"append.gateway":g("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append gateway")),"append.append-task":g("bpmn:Task","bpmn-icon-task",c("Append task")),"append.intermediate-event":g("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append intermediate/boundary event"))})),a.isEmpty(e,"bpmn-replace")||V(l,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change element"),action:{click:function(b,x){var C=V(h(x),{cursor:{x:b.x,y:b.y}});a.open(x,"bpmn-replace",C,{title:c("Change element"),width:"var(--bpmn-replace-popup-width, 300px)",search:!0})}}}}),E(f,"bpmn:SequenceFlow")&&V(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),E(f,"bpmn:MessageFlow")&&V(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),Ve(f,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect to other element"),action:{click:p,dragstart:p}}}),E(f,"bpmn:TextAnnotation")&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using association"),action:{click:p,dragstart:p}}}),Ve(f,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&V(l,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using data input association"),action:{click:p,dragstart:p}}}),E(f,"bpmn:Group")&&V(l,{"append.text-annotation":g("bpmn:TextAnnotation","bpmn-icon-text-annotation",c("Add text annotation"))}),this._isDeleteAllowed([e])&&V(l,m()),l};function jx(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return $(o,function(a){a.$type===n&&(r=!0)}),i&&r}const aO={__depends__:[$k,Bx,mb,Jn,Uf,Ec,oO],__init__:["contextPadProvider"],contextPadProvider:["type",Xa]};var sO={horizontal:["x","width"],vertical:["y","height"]},Hx=5;function Yi(e,t){this._modeling=e,this._filters=[],this.registerFilter(function(n){var i=t.allowed("elements.distribute",{elements:n});return Le(i)?i:i?n:[]})}Yi.$inject=["modeling","rules"],Yi.prototype.registerFilter=function(e){if(typeof e!="function")throw new Error("the filter has to be a function");this._filters.push(e)},Yi.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},Yi.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?($(t,function(o){r=o(r,n,i)}),r):e},Yi.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 $(o,function(a,s){var c=n._findRange(a,i,r),u,l=t[t.length-1];l&&n._hasIntersection(l.range,c)?t[t.length-1].elements.push(a):(u={range:c,elements:[a]},t.push(u))}),t},Yi.prototype._setOrientation=function(e){var t=sO[e];this._axis=t[0],this._dimension=t[1]},Yi.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)},Yi.prototype._findRange=function(e){var t=e[this._axis],n=e[this._dimension];return{min:t+Hx,max:t+n-Hx}};const cO={__init__:["distributeElements"],distributeElements:["type",Yi]};function bu(e){Qn.call(this,e)}bu.$inject=["eventBus"],xe(bu,Qn),bu.prototype.init=function(){this.addRule("elements.distribute",function(e){var t=e.elements;return t=Ue(t,function(n){var i=Ve(n,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(n.labelTarget||i)}),t=Is(t),t.length<3?!1:t})};var zx={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>`},oO=900;function Ka(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",oO,this)}Ka.$inject=["popupMenu","distributeElements","translate","rules"],Ka.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Ka.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Ka.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:Fx.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Fx.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const aO={__depends__:[If,rO],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",gu],distributeElementsMenuProvider:["type",Ka]};var jx="is not a registered action",sO="is already registered";function ii(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}ii.$inject=["eventBus","injector"],ii.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l});if(f!==!1){var p=De(f)?f:l;return o.cut(p.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l}),p;f!==!1&&(De(f)?p=f:p=l,p.length&&n.removeElements(p.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},ii.prototype.trigger=function(e,t){if(!this._actions[e])throw Wf(e,jx);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},ii.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);N(e,function(i,r){n._registerAction(r,i)})},ii.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Wf(e,sO);this._actions[e]=t},ii.prototype.unregister=function(e){if(!this.isRegistered(e))throw Wf(e,jx);this._actions[e]=void 0},ii.prototype.getActions=function(){return Object.keys(this._actions)},ii.prototype.isRegistered=function(e){return!!this._actions[e]};function Wf(e,t){return new Error(e+" "+t)}const cO={__init__:["editorActions"],editorActions:["type",ii]};function yu(e){e.invoke(ii,this)}_e(yu,ii),yu.$inject=["injector"],yu.prototype._registerDefaultActions=function(e){ii.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),f=e.get("searchPad",!1),p=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var m=t.getRootElement(),h=n.filter(function(g){return g!==m});return i.select(h),h}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(m){var h=i.get(),g=m.type;h.length&&c.trigger(h,g)}),i&&u&&this._registerAction("alignElements",function(m){var h=i.get(),g=[],y=m.type;h.length&&(g=Ue(h,function(v){return!E(v,"bpmn:Lane")}),u.trigger(g,y))}),i&&p&&this._registerAction("setColor",function(m){var h=i.get();h.length&&p.setColor(h,m)}),i&&l&&this._registerAction("directEditing",function(){var m=i.get();m.length&&l.activate(m[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),h,g;E(m,"bpmn:Collaboration")?g=n.filter(function(y){return E(y.parent,"bpmn:Collaboration")}):g=n.filter(function(y){return y!==m&&!E(y.parent,"bpmn:SubProcess")}),h=Dt(g),p.moveElements(g,{x:-h.x,y:-h.y},m)}),i&&d&&this._registerAction("replaceElement",function(m){d.triggerEntry("replace","click",m)})};const uO={__depends__:[cO],editorActions:["type",yu]};function Hx(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Ve(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}Hx.$inject=["eventBus"];function Yr(e,t){te.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;Cn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}Yr.$inject=["eventBus","gridSnapping","modeling"],_e(Yr,te),Yr.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},Yr.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},Yr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),V(e,o),e},Yr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),V(e,o),e};var lO=2e3;function zx(e,t){e.on(["spaceTool.move","spaceTool.end"],lO,function(n){var i=n.context;if(i.initialized){var r=i.axis,o;r==="x"?(o=t.snapValue(n.dx),n.x=n.x+o-n.dx,n.dx=o):(o=t.snapValue(n.dy),n.y=n.y+o-n.dy,n.dy=o)}})}zx.$inject=["eventBus","gridSnapping"];const pO={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",Yr],gridSnappingSpaceToolBehavior:["type",zx]};var vu=10;function Uf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var fO=1200,dO=800;function br(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",dO,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"],fO,function(o){var a=o.originalEvent;if(!(!r.active||a&&Dn(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},f=mO(o,u,e);f&&(l.offset=f);var p=hO(o,u);p&&V(l,p),jo(o,u)||r.snapEvent(o,u,l)})}})}br.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Nt(e,t,i)},br.prototype.getGridSpacing=function(){return vu},br.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Uf(e,vu);var i,r;return t&&t.min&&(i=t.min,Be(i)&&(i=Uf(i+n,vu,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Be(r)&&(r=Uf(r+n,vu,"floor"),e=Math.min(e,r))),e-=n,e},br.prototype.isActive=function(){return this.active},br.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},br.prototype.toggleActive=function(){this.setActive(!this.active)},br.$inject=["elementRegistry","eventBus","config.gridSnapping"];function hO(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&&(bu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,u=r.max;return c&&(bu(t)?Vx(s)?a.x.max=c.left:a.x.min=c.right:Gx(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(bu(t)?Vx(s)?a.x.min=u.left:a.x.max=u.right:Gx(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function mO(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Be(s[t])||(s||(s=o.snapOffset={}),Be(s[t])||(s[t]=0),!r)||(n.get(r.id)||(bu(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 bu(e){return e==="x"}function Gx(e){return e.indexOf("n")!==-1}function Vx(e){return e.indexOf("w")!==-1}const gO={__depends__:[pO],__init__:["gridSnapping"],gridSnapping:["type",br]};var yO=2e3;function Wx(e,t,n){e.on("autoPlace",yO,function(i){var r=i.source,o=Le(r),a=i.shape,s=Vv(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],E(a,"bpmn:TextAnnotation")&&(vO(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}Wx.$inject=["eventBus","gridSnapping","elementRegistry"];function vO(e){return e==="x"}var bO=1750;function Ux(e,t,n){t.on(["create.start","shape.move.start"],bO,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!E(o,"bpmn:Participant")||!E(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}Ux.$inject=["canvas","eventBus","gridSnapping"];var xO=3e3;function xu(e,t,n){te.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],xO,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||_O(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}xu.$inject=["eventBus","gridSnapping","modeling"],_e(xu,te),xu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=SO(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function _O(e){return e.length>3}function wO(e){return e==="h"}function EO(e){return e==="v"}function SO(e,t,n){var i=Oi(t,n),r={};return wO(i)&&(r.y=e.snapValue(t.y)),EO(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=V({},t,r),n=V({},n,r)),[t,n]}const RO={__depends__:[gO,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",Wx],gridSnappingParticipantBehavior:["type",Ux],gridSnappingLayoutConnectionBehavior:["type",xu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Hx]};var CO=30,Yx=30;function Xa(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(E(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(E(r,"bpmn:Participant"))return Ke(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(E(r,"bpmn:SubProcess"))return Ke(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Xa.$inject=["eventBus","interactionEvents"],Xa.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Xa.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=qt(e)?{width:CO,height:e.height}:{width:e.width,height:Yx};return this._interactionEvents.createBoxHit(t,"all",n),!0},Xa.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:Yx}),!0};const PO={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Xa]};function _u(e){e.invoke(Do,this)}_e(_u,Do),_u.$inject=["injector"],_u.prototype.registerBindings=function(e,t){Do.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 AO={__depends__:[xf],__init__:["keyboardBindings"],keyboardBindings:["type",_u]};var TO={moveSpeed:1,moveSpeedAccelerated:10},MO=1500,qx="left",Kx="up",Xx="right",Zx="down",kO={ArrowLeft:qx,Left:qx,ArrowUp:Kx,Up:Kx,ArrowRight:Xx,Right:Xx,ArrowDown:Zx,Down:Zx},OO={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 Qx(e,t,n,i,r){var o=this;this._config=V({},TO,e||{}),t.addListener(MO,function(a){var s=a.keyEvent,c=kO[s.key];if(c&&!t.isCmd(s)){var u=t.isShift(s);return o.moveSelection(c,u),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var u=this._config[s?"moveSpeedAccelerated":"moveSpeed"],l=OO[a](u),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,l)}}}Qx.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const DO={__depends__:[xf,Qn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Qx]};var Jx=10;function Za(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=u,d=TC(l,f,u),c.newBounds=kC(d,p),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:Ae(l)})}function s(c){var u=c.shape,l=c.canExecute,f=c.newBounds;if(l){if(f=gm(f),!LO(u,f))return;n.resizeShape(u,f)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}Za.prototype.canResize=function(e){var t=this._rules,n=ai(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Za.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=V({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,e_(t,o),"resize",{autoActivate:!0,cursor:IO(o),data:{shape:t,context:r}})},Za.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:Jx,height:Jx},r=ig(t,e.childrenBoxPadding),OC(n,t,i,r)},Za.$inject=["eventBus","rules","modeling","dragging"];function LO(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function e_(e,t){var n=Le(e),i=Ae(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 IO(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 t_="djs-resizing",n_="resize-not-ok",BO=500;function i_(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,t_)),s.width>5&&we(c,{x:s.x,width:s.width}),s.height>5&&we(c,{y:s.y,height:s.height}),o.canExecute?Xe(c).remove(n_):Xe(c).add(n_)}function r(o){var a=o.shape,s=o.frame;s&&Ht(o.frame),t.removeMarker(a,t_)}e.on("resize.move",BO,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}i_.$inject=["eventBus","canvas","previewSupport"];var wu=-6,Eu=8,Su=20,Qa="djs-resizer",NO=["n","w","s","e","nw","ne","se","sw"];function xr(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&&N(a,wn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}xr.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){cr(o)&&i.activate(o,e,n)}$e.bind(t,"mousedown",r),$e.bind(t,"touchstart",r)},xr.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=$O(i),a=Pe("g");Xe(a).add(Qa),Xe(a).add(Qa+"-"+e.id),Xe(a).add(Qa+"-"+i),je(r,a);var s=Pe("rect");we(s,{x:-Eu/2+o.x,y:-Eu/2+o.y,width:Eu,height:Eu}),Xe(s).add(Qa+"-visual"),je(a,s);var c=Pe("rect");return we(c,{x:-Su/2+o.x,y:-Su/2+o.y,width:Su,height:Su}),Xe(c).add(Qa+"-hit"),je(a,c),$s(a,t,n),a},xr.prototype.createResizer=function(e,t){var n=e_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},xr.prototype.addResizer=function(e){var t=this;at(e)||N(NO,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},xr.prototype.removeResizers=function(){var e=this._getResizersParent();Ts(e)},xr.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},xr.$inject=["eventBus","canvas","selection","resize"];function $O(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-wu:e.indexOf("w")!==-1&&(t.x=wu),e.indexOf("s")!==-1?t.y=-wu:e.indexOf("n")!==-1&&(t.y=wu),t}const r_={__depends__:[_i,$i,Mo],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Za],resizePreview:["type",i_],resizeHandles:["type",xr]};var FO=2e3;function Ja(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"],FO,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,f=c.context.canExecute,p=c.isTouch;p||f&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||Ve(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}Ja.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Ja.prototype.activate=function(e){var t=Wn(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);V(n,i);var r={},o=n.style||{};return V(o,{backgroundColor:null,border:null}),(Ve(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||o_(e))&&V(r,{centerVertically:!0}),rr(e)&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),E(e,"bpmn:TextAnnotation")&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),V(n,{options:r,style:o}),n}},Ja.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,f=s.fontSize*a,p=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(E(e,"bpmn:Lane")||zO(e)){var m=qt(e),h=m?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};V(o,h),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(HO(e)){var g=qt(e),y=g?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};V(o,y),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Ve(e,["bpmn:Task","bpmn:CallActivity"])||o_(e))&&(V(o,{width:i.width,height:i.height}),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),jO(e)&&(V(o,{width:i.width,x:i.x}),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var v=1,b=i.width+2*v;if(n.labelTarget&&(V(o,{width:b,height:i.height+2*v,x:i.x-v,y:i.y-v}),V(d,{fontSize:u+"px",lineHeight:l})),rr(n)&&!Hs(n)&&!Ge(n)){var x=Dl(e),C=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),P=u,O=Ir.width*a+2*v;V(o,{width:O,height:P+2*v,x:C.x-O/2,y:C.y-P/2-v}),V(d,{fontSize:u+"px",lineHeight:l})}return E(e,"bpmn:TextAnnotation")&&(V(o,{width:i.width+2*v,height:i.height+2*v,x:i.x-v,y:i.y-v,minWidth:30*a,minHeight:10*a}),V(d,{textAlign:"left",paddingTop:yo*a+"px",paddingBottom:yo*a+"px",paddingLeft:yo*a+"px",paddingRight:yo*a+"px",fontSize:f+"px",lineHeight:p})),{bounds:o,style:d}},Ja.prototype.update=function(e,t,n,i){var r,o;E(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),GO(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function o_(e){return E(e,"bpmn:SubProcess")&&!Ke(e)}function jO(e){return E(e,"bpmn:SubProcess")&&Ke(e)}function HO(e){return E(e,"bpmn:Participant")&&!Ke(e)}function zO(e){return E(e,"bpmn:Participant")&&Ke(e)}function GO(e){return!e||!e.trim()}var a_="djs-element-hidden",s_="djs-label-hidden";function c_(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,E(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Pe("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),f=i.path=Pe("path");we(f,{d:l,strokeWidth:2,stroke:VO(o)}),je(s,f),je(r,s),tn(s,o.x,o.y)}E(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,a_):(E(o,"bpmn:Task")||E(o,"bpmn:CallActivity")||E(o,"bpmn:SubProcess")||E(o,"bpmn:Participant")||E(o,"bpmn:Lane"))&&t.addMarker(o,s_)}),e.on("directEditing.resize",function(c){if(E(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,f=Math.max(o.height/a.height*(u+l),0),p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:f,position:{mx:0,my:0}});we(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,a_),t.removeMarker(o,s_)),o=void 0,a=void 0,s&&(Ht(s),s=void 0)})}c_.$inject=["eventBus","canvas","pathMap"];function VO(e,t){var n=Ze(e);return n.get("stroke")||t||"black"}const WO={__depends__:[Zp,r_,Dx],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Ja],labelEditingPreview:["type",c_]};var UO=500,YO=1e3;function Si(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){kS(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){N(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],UO,function(o){var a=o.element,s=o.gfx,c=ot(".djs-outline",s);c&&i.updateOutline(a,c)})}Si.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=ot(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),je(t,n),this.updateOutline(e,n)),n},Si.prototype._createOutlineGfx=function(){var e=Pe("rect");return we(e,V({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Si.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Si.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&N(i,function(r){n=n||r.updateOutline(t,e)}),n||we(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Si.prototype.updateConnectionOutline=function(e,t){var n=Dt(t);we(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Si.prototype.registerProvider=function(e,t){t||(t=e,e=YO),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Si.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Si.prototype.getOutline=function(e){var t,n=this._getProviders();return N(n,function(i){Ut(i.getOutline)&&(t=t||i.getOutline(e))}),t},Si.$inject=["eventBus","styles","elementRegistry"];var Ru=6;function Yf(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)})}Yf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Ts(t);var n=e.length>1,i=this._canvas.getContainer();if(Xe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=qO(Dt(e)),o=Pe("rect");we(o,V({rx:3},r)),Xe(o).add("djs-selection-outline"),je(t,o)}},Yf.$inject=["eventBus","canvas","selection"];function qO(e){return{x:e.x-Ru,y:e.y-Ru,width:e.width+Ru*2,height:e.height+Ru*2}}const qf={__depends__:[Qn],__init__:["outline","multiSelectionOutline"],outline:["type",Si],multiSelectionOutline:["type",Yf]},u_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],l_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},KO=15,Cu=2;function p_(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=>Ve(m,u_));if(p.length===1){const m=p[0];Ge(m)?a(m,m.labelTarget):(d=m.labels)!=null&&d.length&&a(m.labels[0],m)}if(p.length===2){const m=p.find(Ge),h=p.find(g=>{var y;return(y=g.labels)==null?void 0:y.includes(m)});m&&h&&a(m,h)}}),e.on("shape.changed",function({element:f}){var p;!Ve(f,u_)||!l(f)||(Ge(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=na([Le(p),Le(f)],l_),m=d.getAttribute("d"),g=r.isSelected(f)?c(f):u(f),y=aa(g,m);if(!y)return;const b=r.isSelected(p)?c(p):u(p),x=aa(b,m)||Le(p);ga(x,y)<KO||(Rl(d,[x,y]),je(o,d))}function s(){As(`.${l_.class}`,o).forEach(Ht)}function c(f){const p=i.getOutline(f);if(!p)return u(f);if(p.x){const d={x:f.x+_r(p,"x")-Cu,y:f.y+_r(p,"y")-Cu,width:_r(p,"width")+Cu*2,height:_r(p,"height")+Cu*2};return Il(d,_r(p,"rx"))}if(p.cx){const d=_r(p,"r"),m={x:f.x+_r(p,"cx")-d,y:f.y+_r(p,"cy")-d,width:d*2,height:d*2};return jm(m)}}function u(f){return n.getShapePath(f)}function l(f){return r.isSelected(f)}}p_.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function _r(e,t){return parseFloat(we(e,t)||0)}const XO={__depends__:[Qn,qf],__init__:["labelLink"],labelLink:["type",p_]};var ZO=new To("tt");function QO(e){var t=mt('<div class="djs-tooltip-container" />');return bn(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function JO(e,t,n){bn(e,{left:t+"px",top:n+"px"})}function Kf(e,t){e.style.display=t===!1?"none":""}var f_="djs-tooltip",Xf="."+f_;function Rn(e,t){this._eventBus=e,this._canvas=t,this._ids=ZO,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=QO(t.getContainer());var n=this;Mn.bind(this._tooltipRoot,Xf,"mousedown",function(i){i.stopPropagation()}),Mn.bind(this._tooltipRoot,Xf,"mouseover",function(i){n.trigger("mouseover",i)}),Mn.bind(this._tooltipRoot,Xf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Rn.$inject=["eventBus","canvas"],Rn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=V({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Rn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(ln(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Rn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Rn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Rn.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)}},Rn.prototype.remove=function(e){var t=this.get(e);t&&(mi(t.html),mi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Rn.prototype.show=function(){Kf(this._tooltipRoot)},Rn.prototype.hide=function(){Kf(this._tooltipRoot,!1)},Rn.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},Rn.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)),Cn(n)&&(n=mt(n)),i=mt('<div data-tooltip-id="'+t+'" class="'+f_+'">'),bn(i,{position:"absolute"}),i.appendChild(n),e.type&&bt(i).add("djs-tooltip-"+e.type),e.className&&bt(i).add(e.className),e.htmlContainer=i,r.appendChild(i),this._tooltips[t]=e,this._updateTooltip(e)},Rn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;JO(n,t.x,t.y)},Rn.prototype._updateTooltipVisibilty=function(e){N(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Kf(i,r))})},Rn.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 eD={__init__:["tooltips"],tooltips:["type",Rn]};var tD="flow elements must be children of pools/participants",nD="Data object must be placed within a pool/participant.";function d_(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;E(s,"bpmn:Collaboration")&&(E(a,"bpmn:FlowNode")?i(r,n(tD)):E(a,"bpmn:DataObjectReference")&&i(r,n(nD)))})}d_.$inject=["eventBus","tooltips","translate"];const iD={__depends__:[eD],__init__:["modelingFeedback"],modelingFeedback:["type",d_]};var rD=500,oD=1250,aD=1500,Pu=Math.round;function sD(e){return{x:e.x+Pu(e.width/2),y:e.y+Pu(e.height/2)}}function h_(e,t,n,i,r){function o(s,c,u,l){return r.allowed("elements.move",{shapes:s,delta:c,position:u,target:l})}e.on("shape.move.start",aD,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=cD(l),V(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",oD,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",rD,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,f={x:s.dx,y:s.dy},p={x:s.x,y:s.y},d;if(d=o(u,f,p,l),c.delta=f,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,f=l==="attach",p=c.shapes;if(l===!1)return!1;u.x=Pu(u.x),u.y=Pu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(p,u,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(cr(s)){var c=Ro(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Wt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Xe(s.target).has("djs-hit-no-move")){var f=sD(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(p!==!1)return!0}}this.start=a}h_.$inject=["eventBus","dragging","modeling","selection","rules"];function cD(e){var t=eo(e,"id");return Ue(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var m_=499,Zf="djs-dragging",g_="drop-ok",y_="drop-not-ok",v_="new-parent",b_="attach-ok";function x_(e,t,n,i){function r(c){var u=o(c),l=uD(u);return l}function o(c){var u=ia(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=u.concat(l),p=[...new Set(f)];return p}function a(c,u){[b_,g_,y_,v_].forEach(function(l){l===u?t.addMarker(c,l):t.removeMarker(c,l)})}function s(c,u,l){i.addDragger(u,c.dragGroup),l&&t.addMarker(u,Zf),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",m_,function(c){var u=c.context,l=u.shapes,f=u.allDraggedElements,p=r(l);if(!u.dragGroup){var d=Pe("g");we(d,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();je(m,d),u.dragGroup=d}p.forEach(function(h){i.addDragger(h,u.dragGroup)}),f?f=Nu([f,o(l)]):f=o(l),N(f,function(h){t.addMarker(h,Zf)}),u.allDraggedElements=f,u.differentParents=lD(l)}),e.on("shape.move.move",m_,function(c){var u=c.context,l=u.dragGroup,f=u.target,p=u.shape.parent,d=u.canExecute;f&&(d==="attach"?a(f,b_):u.canExecute&&p&&f.id!==p.id?a(f,v_):a(f,u.canExecute?g_:y_)),tn(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,f=u.dragGroup;N(l,function(p){t.removeMarker(p,Zf)}),f&&Ht(f)}),this.makeDraggable=s}x_.$inject=["eventBus","canvas","styles","previewSupport"];function uD(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ue(e,function(i){return at(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function lD(e){return Q0(eo(e,function(t){return t.parent&&t.parent.id}))!==1}const pD={__depends__:[vc,Qn,qf,_i,$i,Mo],__init__:["move","movePreview"],move:["type",h_],movePreview:["type",x_]};var __=".djs-palette-toggle",w_=".entry",fD=__+", "+w_,Qf="djs-palette-",dD="shown",Jf="open",E_="two-column",hD=1e3;function $t(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()})}$t.$inject=["eventBus","canvas"],$t.prototype.registerProvider=function(e,t){t||(t=e,e=hD),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},$t.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(gD,{})},$t.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},$t.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=mt($t.HTML_MARKUP);n.appendChild(i),bt(n).add(Qf+dD),Mn.bind(i,fD,"click",function(r){var o=r.delegateTarget;if(gl(o,__))return e.toggle();e.trigger("click",r)}),$e.bind(i,"mousedown",function(r){r.stopPropagation()}),Mn.bind(i,w_,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},$t.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},$t.prototype._toggleState=function(e){e=e||{};var t=this._getParentContainer(),n=this._container,i=this._eventBus,r,o=bt(n),a=bt(t);"twoColumn"in e?r=e.twoColumn:r=this._needsCollapse(t.clientHeight,this._entries||{}),o.toggle(E_,r),a.toggle(Qf+E_,r),"open"in e&&(o.toggle(Jf,e.open),a.toggle(Qf+Jf,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},$t.prototype._update=function(){var e=ot(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Cs(e),N(t,function(n,i){var r=n.group||"default",o=ot("[data-group="+$a(r)+"]",e);o||(o=mt('<div class="group"></div>'),ln(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=mt(a);if(o.appendChild(s),!n.separator&&(ln(s,"data-action",i),n.title&&ln(s,"title",n.title),n.className&&mD(s,n.className),n.imageUrl)){var c=mt("<img>");ln(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},$t.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=ln(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},$t.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(Ut(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},$t.prototype._layoutChanged=function(){this._toggleState({})},$t.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},$t.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},$t.prototype.open=function(){this._toggleState({open:!0})},$t.prototype.toggle=function(){this.isOpen()?this.close():this.open()},$t.prototype.isActiveTool=function(e){return e&&this._activeTool===e},$t.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=ot(".djs-palette-entries",this._container),this._toolsContainer=ot("[data-group=tools]",t)),n=this._toolsContainer,N(n.children,function(i){var r=i.getAttribute("data-action");if(r){var o=bt(i);r=r.replace("-tool",""),o.contains("entry")&&r===e?o.add("highlighted-entry"):o.remove("highlighted-entry")}})},$t.prototype.isOpen=function(){return bt(this._container).has(Jf)},$t.prototype._getParentContainer=function(){return this._canvas.getContainer()},$t.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function mD(e,t){var n=bt(e),i=De(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function gD(e,t){var n=t.getPaletteEntries();return Ut(n)?n(e):(N(n,function(i,r){e[r]=i}),e)}const yD={__init__:["palette"],palette:["type",$t]};var S_="crosshair",R_="selected",vD="djs-dragging-active-lasso";function wr(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=Pe("rect");we(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),je(p,d),u(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&we(p,{x:d.x,y:d.y,width:d.width,height:d.height});var m=f.marked,h=f.lastMarked;if(m&&h){for(const g of h)m.has(g)||t.removeMarker(g,R_);for(const g of m)h.has(g)||t.addMarker(g,R_)}},remove:function(f){this.update(f),f.frame&&Ht(f.frame),u(!1)}};function u(f){Xe(t.getContainer()).toggle(vD,f)}function l(f){var p=i.getAll();return new Set(Jr(po(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=C_(f),p.add=pc(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=C_(f),m=l(d),h=p.initialMarked.union(m);p.lastMarked=p.marked,p.marked=h,c.update(p)}),e.on("lasso.cleanup",function(f){var p=f.context;p.lastMarked=p.marked,p.marked=new Set(r.get()),c.remove(f.context)}),e.on("element.mousedown",1500,function(f){if(pc(f))return s.activateLasso(f.originalEvent),!0})}wr.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],wr.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:S_,data:{context:{}},keepSelection:!0})},wr.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:S_,data:{context:{}},keepSelection:!0})},wr.prototype._select=function(e){this._selection.select(e)},wr.prototype.select=function(e,t,n=[]){var i=Jr(po(e,t));this._select([...n,...i])},wr.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},wr.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function C_(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 bD={__depends__:[wc,wa],__init__:["lassoTool"],lassoTool:["type",wr]};var ed=1500,P_="grab";function Ho(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",ed,function(c){if(ba(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(ed,function(c){if(!(!A_(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(ed,function(c){!A_(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!ba(c)&&l&&e.once("hand.move.ended",function(f){a.activateHand(f.originalEvent,!0,!0)}),!1})}Ho.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ho.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:P_,data:{context:n||{}}})},Ho.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:P_,data:{context:{reactivate:n}}})},Ho.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ho.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function A_(e){return zt("Space",e)}const xD={__depends__:[wc,wa],__init__:["handTool"],handTool:["type",Ho]};var T_="connect-ok",M_="connect-not-ok";function zo(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,f=u.canStartConnect=s.canStartConnect(l);f!==null&&(u.startTarget=l,i.addMarker(l,f?T_:M_))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?T_:M_)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,f={x:c.x,y:c.y},p=s.canStartConnect(l);if(p)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,f)}),!1})}zo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],zo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},zo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},zo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},zo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const _D={__depends__:[Gf,_i,$i,wc,wa],globalConnect:["type",zo]};function td(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)}td.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],td.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(f,p,d,m,h){function g(y){var v=n.createShape(V({type:f},h));t.start(y,v)}return{group:p,className:d,title:m,action:{dragstart:g,click:g}}}function u(f){var p=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:p});t.start(f,[p,d],{hints:{autoSelect:[p]}})}function l(f){t.start(f,n.createParticipantShape())}return V(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(f){o.activateHand(f)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(f){r.activateSelection(f)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(f){i.activateSelection(f)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(f){a.start(f)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const wD={__depends__:[yD,xc,rv,bD,xD,_D,fa],__init__:["paletteProvider"],paletteProvider:["type",td]};var ED=250;function nd(e,t,n,i,r){te.call(this,e);function o(s){var c=s.canExecute.replacements;N(c,function(u){var l=u.oldElementId,f={type:u.newElementType};if(!s.visualReplacements[l]){var p=t.get(l);V(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var m=ot('[data-element-id="'+$a(p.id)+'"]',s.dragGroup);m&&we(m,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;N(c,function(u,l){var f=ot('[data-element-id="'+$a(l)+'"]',s.dragGroup);f&&we(f,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",ED,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}nd.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],_e(nd,te);const SD={__depends__:[Mo],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",nd]};var RD=1250,id=40,CD=20,PD=10,k_=20,O_=["x","y"],AD=Math.abs;function D_(e){e.on(["connect.hover","connect.move","connect.end"],RD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Dn(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&TD(t,o,DD(o)),o&&OD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=ti(r),Ve(o,["bpmn:Event","bpmn:Gateway"])&&L_(t,ti(o)),Ve(o,["bpmn:Task","bpmn:SubProcess"])&&MD(t,o),E(a,"bpmn:BoundaryEvent")&&s===a.host&&kD(t)):I_(i,"bpmn:MessageFlow")?(E(r,"bpmn:Event")&&(n.connectionStart=ti(r)),E(o,"bpmn:Event")&&L_(t,ti(o))):n.connectionStart=n.initialConnectionStart)})}D_.$inject=["eventBus"];function TD(e,t,n){O_.forEach(function(i){var r=B_(i,t);e[i]<t[i]+n?Nt(e,i,t[i]+n):e[i]>t[i]+r-n&&Nt(e,i,t[i]+r-n)})}function MD(e,t){var n=ti(t);O_.forEach(function(i){LD(e,t,i)&&Nt(e,i,n[i])})}function kD(e){var t=e.context,n=t.source,i=t.target;if(!ID(t)){var r=ti(n),o=en(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],u;AD(c-r[s])<id&&(c>r[s]?u=r[s]+id:u=r[s]-id,Nt(e,s,u))})}}function L_(e,t){Nt(e,"x",t.x),Nt(e,"y",t.y)}function I_(e,t){return e&&e.type===t}function OD(e,t){return Yi(t,function(n){return I_(e,n)})}function B_(e,t){return e==="x"?t.width:t.height}function DD(e){return E(e,"bpmn:Task")?PD:CD}function LD(e,t,n){return e[n]>t[n]+k_&&e[n]<t[n]+B_(n,t)-k_}function ID(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Er(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Er.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Er.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Er.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Er.prototype.getSnapLocations=function(){return this._snapLocations},Er.prototype.setSnapLocations=function(e){this._snapLocations=e},Er.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Au,n.initDefaults(this._defaultSnaps)),n};function Au(){this._snapValues={}}Au.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)},Au.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&Ek(e[n],r[n],i)},Au.prototype.initDefaults=function(e){var t=this;N(e||{},function(n,i){N(n,function(r){t.add(i,r)})})};var BD=1250;function Ri(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"],BD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Dn(r.originalEvent))&&!(jo(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Ri.$inject=["elementRegistry","eventBus","snapping"],Ri.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Er);var o;t.get(i.id)?o=ti(i,e):o={x:e.x+ti(i).x,y:e.y+ti(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),Ge(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},Ri.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return N(i,function(r){if(Ge(r)){Ge(t)&&e.add("mid",ti(r));return}if(at(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);N(o,function(a){e.add("mid",a)});return}e.add("mid",ti(r))}),!Be(t.x)||!Be(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",ti(t)),e},Ri.prototype.getSnapTargets=function(e,t){return wx(t).filter(function(n){return!ND(n)})};function ND(e){return!!e.hidden}var N_=1500;function Go(e,t){t.invoke(Ri,this),e.on(["create.move","create.end"],N_,HD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],N_,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!jo(n)&&$D(n,o)})}_e(Go,Ri),Go.$inject=["eventBus","injector"],Go.prototype.initSnap=function(e){var t=Ri.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return N(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",F_(o,i,e))}),N(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",F_(o,i,e))}),E(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Go.prototype.addSnapTargetPoints=function(e,t,n){Ri.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);N(i,function(o){(jD(o)||FD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",xx(o)),e.add("bottom-right",_x(o)))});var r=this._elementRegistry;return N(t.incoming,function(o){if(r.get(t.id)){$_(i,o.source)||e.add("mid",Le(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),N(t.outgoing,function(o){if(r.get(t.id)){$_(i,o.target)||e.add("mid",Le(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),E(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Go.prototype.getSnapTargets=function(e,t){return Ri.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!E(n,"bpmn:Lane")})};function $D(e,t){var n=Ae(t),i=ey(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Le(o),/top/.test(i)?Nt(e,"y",n.top-a.y):/bottom/.test(i)&&Nt(e,"y",n.bottom-a.y),/left/.test(i)?Nt(e,"x",n.left-a.x):/right/.test(i)&&Nt(e,"x",n.right-a.x)}function FD(e,t){return e.every(function(n){return E(n,t)})}function jD(e){return E(e,"bpmn:SubProcess")&&Ke(e)?!0:E(e,"bpmn:Participant")}function HD(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)&&Nt(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Nt(e,"y",e.y)}}function $_(e,t){return e.indexOf(t)!==-1}function F_(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var zD=1250;function es(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],zD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Dn(i.originalEvent))&&!jo(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),WD(s)&&Nt(i,"x",i.x),UD(s)&&Nt(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}es.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Er);var o=j_(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},es.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return N(r,function(o){e.add("corner",_x(o)),e.add("corner",xx(o))}),e.add("corner",j_(t,i)),e},es.$inject=["eventBus","snapping"],es.prototype.getSnapTargets=function(e,t){return wx(t).filter(function(n){return!GD(n,e)&&!at(n)&&!VD(n)&&!Ge(n)})};function j_(e,t){var n=Le(e),i=Ae(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 GD(e,t){return e.host===t}function VD(e){return!!e.hidden}function WD(e){return e==="n"||e==="s"}function UD(e){return e==="e"||e==="w"}var YD=7,qD=1e3;function Sr(e){this._canvas=e,this._asyncHide=Fu(wn(this.hide,this),qD)}Sr.$inject=["canvas"],Sr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:jo(e,"x"),y:jo(e,"y")};N(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if(N(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,YD),l!==void 0&&(o[u]={value:l,originValue:l-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),N(["x","y"],function(a){var s=o[a];Wt(s)&&Nt(e,a,s.originValue)})},Sr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Pe("path");return we(n,{d:"M0,0 L0,0"}),Xe(n).add("djs-snap-line"),je(t,n),{update:function(i){Be(i)?e==="horizontal"?we(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):we(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):we(n,{display:"none"})}}},Sr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Sr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Sr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Sr.prototype.hide=function(){N(this._snapLines,function(e){e.update()})};const KD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ri],resizeSnapping:["type",es],snapping:["type",Sr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",D_],createMoveSnapping:["type",Go]};var H_=300;function He(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=ot(He.INPUT_SELECTOR,this._container),this._resultsContainer=ot(He.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}He.$inject=["canvas","eventBus","selection","translate"],He.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:Mn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,He.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,He.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,He.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,He.INPUT_SELECTOR,"keydown",function(n){zt("ArrowUp",n)&&n.preventDefault(),zt("ArrowDown",n)&&n.preventDefault()}),t(this._container,He.INPUT_SELECTOR,"keyup",function(n){if(zt("Escape",n))return e.close();if(zt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(zt("ArrowUp",n))return e._scrollToDirection(!0);if(zt("ArrowDown",n))return e._scrollToDirection();zt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},He.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){Mn.unbind(e.el,e.type,e.listener)})},He.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=ot(He.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},He.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},He.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)}},He.prototype._clearResults=function(){Cs(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},He.prototype._getCurrentResult=function(){return ot(He.RESULT_SELECTED_SELECTOR,this._resultsContainer)},He.prototype._createResultNode=function(e,t){var n=mt(He.RESULT_HTML);return e.primaryTokens.length>0&&z_(n,e.primaryTokens,He.RESULT_PRIMARY_HTML),z_(n,e.secondaryTokens,He.RESULT_SECONDARY_HTML),ln(n,He.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},He.prototype.registerProvider=function(e){this._searchProvider=e},He.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,bt(this._canvas.getContainer()).add("djs-search-open"),bt(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},He.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,bt(this._canvas.getContainer()).remove("djs-search-open"),bt(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},He.prototype.toggle=function(){this.isOpen()?this.close():this.open()},He.prototype.isOpen=function(){return this._open},He.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&bt(t).remove(He.RESULT_SELECTED_CLASS);var n=ln(e,He.RESULT_ID_ATTRIBUTE),i=this._results[n].element;bt(e).add(He.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:H_}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},He.prototype._select=function(e){var t=ln(e,He.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:H_}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},He.prototype._getBoxHtml=function(){const e=mt(He.BOX_HTML),t=ot(He.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function z_(e,t,n){var i=XD(t),r=mt(n);r.innerHTML=i,e.appendChild(r)}function XD(e){var t="";return e.forEach(function(n){var i=Xv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+He.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}He.CONTAINER_SELECTOR=".djs-search-container",He.INPUT_SELECTOR=".djs-search-input input",He.RESULTS_CONTAINER_SELECTOR=".djs-search-results",He.RESULT_SELECTOR=".djs-search-result",He.RESULT_SELECTED_CLASS="djs-search-result-selected",He.RESULT_SELECTED_SELECTOR="."+He.RESULT_SELECTED_CLASS,He.RESULT_ID_ATTRIBUTE="data-result-id",He.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",He.BOX_HTML=`<div class="djs-search-container djs-scrollable">
335
+ </svg>`},uO=900;function Za(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",uO,this)}Za.$inject=["popupMenu","distributeElements","translate","rules"],Za.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&V(t,this._getEntries(e)),t},Za.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Za.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:zx.horizontal,action:function(o,a){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:zx.vertical,action:function(o,a){t.trigger(e,"vertical"),i.close()}}};return r};const lO={__depends__:[$f,cO],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",bu],distributeElementsMenuProvider:["type",Za]};var Gx="is not a registered action",pO="is already registered";function ri(e,t){this._eventBus=e,this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}ri.$inject=["eventBus","injector"],ri.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),u=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var l=i.get();if(l.length)return o.copy(l)}),o&&i&&this.register("duplicate",function(){var l=i.get();if(l.length)return o.duplicate(l)}),o&&this.register("paste",function(){o.paste()}),o&&i&&s&&this.register("cut",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l});if(f!==!1){var p=Le(f)?f:l;return o.cut(p.slice())}}}),r&&this.register("stepZoom",function(l){r.stepZoom(l.value)}),a&&this.register("zoom",function(l){a.zoom(l.value)}),n&&i&&s&&this.register("removeSelection",function(){var l=i.get();if(l.length){var f=s.allowed("elements.delete",{elements:l}),p;f!==!1&&(Le(f)?p=f:p=l,p.length&&n.removeElements(p.slice()))}}),c&&this.register("moveCanvas",function(l){c.moveCanvas(l)}),u&&this.register("moveSelection",function(l){u.moveSelection(l.direction,l.accelerated)})},ri.prototype.trigger=function(e,t){if(!this._actions[e])throw qf(e,Gx);var n=this._eventBus.fire("editorActions.allowed",{action:e,opts:t});if(n!==!1)return this._actions[e](t)},ri.prototype.register=function(e,t){var n=this;if(typeof e=="string")return this._registerAction(e,t);$(e,function(i,r){n._registerAction(r,i)})},ri.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw qf(e,pO);this._actions[e]=t},ri.prototype.unregister=function(e){if(!this.isRegistered(e))throw qf(e,Gx);this._actions[e]=void 0},ri.prototype.getActions=function(){return Object.keys(this._actions)},ri.prototype.isRegistered=function(e){return!!this._actions[e]};function qf(e,t){return new Error(e+" "+t)}const fO={__init__:["editorActions"],editorActions:["type",ri]};function xu(e){e.invoke(ri,this)}xe(xu,ri),xu.$inject=["injector"],xu.prototype._registerDefaultActions=function(e){ri.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),u=e.get("alignElements",!1),l=e.get("directEditing",!1),f=e.get("searchPad",!1),p=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",function(){var m=t.getRootElement(),h=n.filter(function(g){return g!==m});return i.select(h),h}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(m){var h=i.get(),g=m.type;h.length&&c.trigger(h,g)}),i&&u&&this._registerAction("alignElements",function(m){var h=i.get(),g=[],y=m.type;h.length&&(g=Ue(h,function(v){return!E(v,"bpmn:Lane")}),u.trigger(g,y))}),i&&p&&this._registerAction("setColor",function(m){var h=i.get();h.length&&p.setColor(h,m)}),i&&l&&this._registerAction("directEditing",function(){var m=i.get();m.length&&l.activate(m[0])}),f&&this._registerAction("find",function(){f.toggle()}),t&&p&&this._registerAction("moveToOrigin",function(){var m=t.getRootElement(),h,g;E(m,"bpmn:Collaboration")?g=n.filter(function(y){return E(y.parent,"bpmn:Collaboration")}):g=n.filter(function(y){return y!==m&&!E(y.parent,"bpmn:SubProcess")}),h=It(g),p.moveElements(g,{x:-h.x,y:-h.y},m)}),i&&d&&this._registerAction("replaceElement",function(m){d.triggerEntry("replace","click",m)})};const dO={__depends__:[fO],editorActions:["type",xu]};function Vx(e){e.on(["create.init","shape.move.init"],function(t){var n=t.context,i=t.shape;Ve(i,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(n.gridSnappingContext||(n.gridSnappingContext={}),n.gridSnappingContext.snapLocation="top-left")})}Vx.$inject=["eventBus"];function qr(e,t){te.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;Pn(a)?r.newBounds=n.snapComplex(c,a):r.newBounds=n.snapSimple(s,c)}})}qr.$inject=["eventBus","gridSnapping","modeling"],xe(qr,te),qr.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},qr.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},qr.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),V(e,o),e},qr.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),V(e,o),e};var hO=2e3;function Wx(e,t){e.on(["spaceTool.move","spaceTool.end"],hO,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)}})}Wx.$inject=["eventBus","gridSnapping"];const mO={__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",qr],gridSnappingSpaceToolBehavior:["type",Wx]};var _u=10;function Kf(e,t,n){return n||(n="round"),Math[n](e/t)*t}var gO=1200,yO=800;function xr(e,t,n){var i=!n||n.active!==!1;this._eventBus=t;var r=this;t.on("diagram.init",yO,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"],gO,function(o){var a=o.originalEvent;if(!(!r.active||a&&Ln(a))){var s=o.context,c=s.gridSnappingContext;c||(c=s.gridSnappingContext={}),["x","y"].forEach(function(u){var l={},f=bO(o,u,e);f&&(l.offset=f);var p=vO(o,u);p&&V(l,p),zo(o,u)||r.snapEvent(o,u,l)})}})}xr.prototype.snapEvent=function(e,t,n){var i=this.snapValue(e[t],n);Ft(e,t,i)},xr.prototype.getGridSpacing=function(){return _u},xr.prototype.snapValue=function(e,t){var n=0;t&&t.offset&&(n=t.offset),e+=n,e=Kf(e,_u);var i,r;return t&&t.min&&(i=t.min,Ne(i)&&(i=Kf(i+n,_u,"ceil"),e=Math.max(e,i))),t&&t.max&&(r=t.max,Ne(r)&&(r=Kf(r+n,_u,"floor"),e=Math.min(e,r))),e-=n,e},xr.prototype.isActive=function(){return this.active},xr.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},xr.prototype.toggleActive=function(){this.setActive(!this.active)},xr.$inject=["elementRegistry","eventBus","config.gridSnapping"];function vO(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&&(wu(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,u=r.max;return c&&(wu(t)?Yx(s)?a.x.max=c.left:a.x.min=c.right:Ux(s)?a.y.max=c.top:a.y.min=c.bottom),u&&(wu(t)?Yx(s)?a.x.min=u.left:a.x.max=u.right:Ux(s)?a.y.min=u.top:a.y.max=u.bottom),a[t]}function bO(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;return s&&Ne(s[t])||(s||(s=o.snapOffset={}),Ne(s[t])||(s[t]=0),!r)||(n.get(r.id)||(wu(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 wu(e){return e==="x"}function Ux(e){return e.indexOf("n")!==-1}function Yx(e){return e.indexOf("w")!==-1}const xO={__depends__:[mO],__init__:["gridSnapping"],gridSnapping:["type",xr]};var _O=2e3;function qx(e,t,n){e.on("autoPlace",_O,function(i){var r=i.source,o=Ie(r),a=i.shape,s=Yv(r,a,n);return["x","y"].forEach(function(c){var u={};s[c]!==o[c]&&(s[c]>o[c]?u.min=s[c]:u.max=s[c],E(a,"bpmn:TextAnnotation")&&(wO(c)?u.offset=-a.width/2:u.offset=-a.height/2),s[c]=t.snapValue(s[c],u))}),s})}qx.$inject=["eventBus","gridSnapping","elementRegistry"];function wO(e){return e==="x"}var EO=1750;function Kx(e,t,n){t.on(["create.start","shape.move.start"],EO,function(i){var r=i.context,o=r.shape,a=e.getRootElement();if(!(!E(o,"bpmn:Participant")||!E(a,"bpmn:Process")||!a.children.length)){var s=r.createConstraints;s&&(o.width=n.snapValue(o.width,{min:o.width}),o.height=n.snapValue(o.height,{min:o.height}))}})}Kx.$inject=["canvas","eventBus","gridSnapping"];var SO=3e3;function Eu(e,t,n){te.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],SO,function(r){var o=r.context,a=o.connection,s=o.hints||{},c=a.waypoints;s.connectionStart||s.connectionEnd||s.createElementsBehavior===!1||RO(c)&&n.updateWaypoints(a,i.snapMiddleSegments(c))})}Eu.$inject=["eventBus","gridSnapping","modeling"],xe(Eu,te),Eu.prototype.snapMiddleSegments=function(e){var t=this._gridSnapping,n;e=e.slice();for(var i=1;i<e.length-2;i++)n=AO(t,e[i],e[i+1]),e[i]=n[0],e[i+1]=n[1];return e};function RO(e){return e.length>3}function CO(e){return e==="h"}function PO(e){return e==="v"}function AO(e,t,n){var i=Di(t,n),r={};return CO(i)&&(r.y=e.snapValue(t.y)),PO(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=V({},t,r),n=V({},n,r)),[t,n]}const TO={__depends__:[xO,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",qx],gridSnappingParticipantBehavior:["type",Kx],gridSnappingLayoutConnectionBehavior:["type",Eu]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",Vx]};var MO=30,Xx=30;function Qa(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(i){var r=i.element,o=i.gfx;if(E(r,"bpmn:Lane"))return n._createParticipantHit(r,o);if(E(r,"bpmn:Participant"))return Ke(r)?n._createParticipantHit(r,o):n._createDefaultHit(r,o);if(E(r,"bpmn:SubProcess"))return Ke(r)?n._createSubProcessHit(r,o):n._createDefaultHit(r,o)})}Qa.$inject=["eventBus","interactionEvents"],Qa.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Qa.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=Xt(e)?{width:MO,height:e.height}:{width:e.width,height:Xx};return this._interactionEvents.createBoxHit(t,"all",n),!0},Qa.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:Xx}),!0};const kO={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Qa]};function Su(e){e.invoke(Io,this)}xe(Su,Io),Su.$inject=["injector"],Su.prototype.registerBindings=function(e,t){Io.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 OO={__depends__:[Ef],__init__:["keyboardBindings"],keyboardBindings:["type",Su]};var DO={moveSpeed:1,moveSpeedAccelerated:10},LO=1500,Zx="left",Qx="up",Jx="right",e_="down",IO={ArrowLeft:Zx,Left:Zx,ArrowUp:Qx,Up:Qx,ArrowRight:Jx,Right:Jx,ArrowDown:e_,Down:e_},BO={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 t_(e,t,n,i,r){var o=this;this._config=V({},DO,e||{}),t.addListener(LO,function(a){var s=a.keyEvent,c=IO[s.key];if(c&&!t.isCmd(s)){var u=t.isShift(s);return o.moveSelection(c,u),!0}}),this.moveSelection=function(a,s){var c=r.get();if(c.length){var u=this._config[s?"moveSpeedAccelerated":"moveSpeed"],l=BO[a](u),f=i.allowed("elements.move",{shapes:c,hints:{keyboardMove:!0}});f&&n.moveElements(c,l)}}}t_.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];const NO={__depends__:[Ef,Jn],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",t_]};var n_=10;function Ja(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(c,u){var l=c.shape,f=c.direction,p=c.resizeConstraints,d;c.delta=u,d=DC(l,f,u),c.newBounds=IC(d,p),c.canExecute=r.canResize(c)}function a(c){var u=c.resizeConstraints,l=c.minBounds;u===void 0&&(l===void 0&&(l=r.computeMinResizeBox(c)),c.resizeConstraints={min:Ae(l)})}function s(c){var u=c.shape,l=c.canExecute,f=c.newBounds;if(l){if(f=bm(f),!$O(u,f))return;n.resizeShape(u,f)}}e.on("resize.start",function(c){a(c.context)}),e.on("resize.move",function(c){var u={x:c.dx,y:c.dy};o(c.context,u)}),e.on("resize.end",function(c){s(c.context)})}Ja.prototype.canResize=function(e){var t=this._rules,n=si(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ja.prototype.activate=function(e,t,n){var i=this._dragging,r,o;if(typeof n=="string"&&(n={direction:n}),r=V({shape:t},n),o=r.direction,!o)throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");i.init(e,i_(t,o),"resize",{autoActivate:!0,cursor:FO(o),data:{shape:t,context:r}})},Ja.prototype.computeMinResizeBox=function(e){var t=e.shape,n=e.direction,i,r;return i=e.minDimensions||{width:n_,height:n_},r=ag(t,e.childrenBoxPadding),BC(n,t,i,r)},Ja.$inject=["eventBus","rules","modeling","dragging"];function $O(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}function i_(e,t){var n=Ie(e),i=Ae(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 FO(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 r_="djs-resizing",o_="resize-not-ok",jO=500;function a_(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,r_)),s.width>5&&_e(c,{x:s.x,width:s.width}),s.height>5&&_e(c,{y:s.y,height:s.height}),o.canExecute?Xe(c).remove(o_):Xe(c).add(o_)}function r(o){var a=o.shape,s=o.frame;s&&Gt(o.frame),t.removeMarker(a,r_)}e.on("resize.move",jO,function(o){i(o.context)}),e.on("resize.cleanup",function(o){r(o.context)})}a_.$inject=["eventBus","canvas","previewSupport"];var Ru=-6,Cu=8,Pu=20,es="djs-resizer",HO=["n","w","s","e","nw","ne","se","sw"];function _r(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(o){var a=o.newSelection;r.removeResizers(),a.length===1&&$(a,Sn(r.addResizer,r))}),e.on("shape.changed",function(o){var a=o.element;n.isSelected(a)&&(r.removeResizers(),r.addResizer(a))})}_r.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(o){ur(o)&&i.activate(o,e,n)}$e.bind(t,"mousedown",r),$e.bind(t,"touchstart",r)},_r.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=zO(i),a=Pe("g");Xe(a).add(es),Xe(a).add(es+"-"+e.id),Xe(a).add(es+"-"+i),je(r,a);var s=Pe("rect");_e(s,{x:-Cu/2+o.x,y:-Cu/2+o.y,width:Cu,height:Cu}),Xe(s).add(es+"-visual"),je(a,s);var c=Pe("rect");return _e(c,{x:-Pu/2+o.x,y:-Pu/2+o.y,width:Pu,height:Pu}),Xe(c).add(es+"-hit"),je(a,c),Hs(a,t,n),a},_r.prototype.createResizer=function(e,t){var n=i_(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},_r.prototype.addResizer=function(e){var t=this;ct(e)||$(HO,function(n){t._resize.canResize({shape:e,direction:n})&&t.createResizer(e,n)})},_r.prototype.removeResizers=function(){var e=this._getResizersParent();Os(e)},_r.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},_r.$inject=["eventBus","canvas","selection","resize"];function zO(e){var t={x:0,y:0};return e.indexOf("e")!==-1?t.x=-Ru:e.indexOf("w")!==-1&&(t.x=Ru),e.indexOf("s")!==-1?t.y=-Ru:e.indexOf("n")!==-1&&(t.y=Ru),t}const s_={__depends__:[wi,Fi,Oo],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ja],resizePreview:["type",a_],resizeHandles:["type",_r]};var GO=2e3;function ts(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"],GO,function(c){i.isActive(c.element)&&i.cancel()}),e.on(["commandStack.changed"],function(c){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(c){o.removeResizers()}),e.on("create.end",500,function(c){var u=c.context,l=u.shape,f=c.context.canExecute,p=c.isTouch;p||f&&(u.hints&&u.hints.createElementsBehavior===!1||s(l))}),e.on("autoPlace.end",500,function(c){s(c.shape)});function s(c,u){(u||Ve(c,["bpmn:Activity","bpmn:Event","bpmn:TextAnnotation","bpmn:Participant"]))&&i.activate(c)}}ts.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],ts.prototype.activate=function(e){var t=Un(e);if(t!==void 0){var n={text:t},i=this.getEditingBBox(e);V(n,i);var r={},o=n.style||{};return V(o,{backgroundColor:null,border:null}),(Ve(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||c_(e))&&V(r,{centerVertically:!0}),or(e)&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),E(e,"bpmn:TextAnnotation")&&(V(r,{resizable:!0,autoResize:!0}),V(o,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),V(n,{options:r,style:o}),n}},ts.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r={x:i.x+i.width/2,y:i.y+i.height/2},o={x:i.x,y:i.y},a=t.zoom(),s=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),u=c.fontSize*a,l=c.lineHeight,f=s.fontSize*a,p=s.lineHeight,d={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(E(e,"bpmn:Lane")||UO(e)){var m=Xt(e),h=m?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:r.y-30*a/2}:{width:i.width,height:30*a};V(o,h),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(WO(e)){var g=Xt(e),y=g?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r.x-i.height/2,y:r.y-i.width/2};V(o,y),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Ve(e,["bpmn:Task","bpmn:CallActivity"])||c_(e))&&(V(o,{width:i.width,height:i.height}),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),VO(e)&&(V(o,{width:i.width,x:i.x}),V(d,{fontSize:f+"px",lineHeight:p,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var v=1,b=i.width+2*v;if(n.labelTarget&&(V(o,{width:b,height:i.height+2*v,x:i.x-v,y:i.y-v}),V(d,{fontSize:u+"px",lineHeight:l})),or(n)&&!Vs(n)&&!Ge(n)){var x=Bl(e),C=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),P=u,D=Br.width*a+2*v;V(o,{width:D,height:P+2*v,x:C.x-D/2,y:C.y-P/2-v}),V(d,{fontSize:u+"px",lineHeight:l})}return E(e,"bpmn:TextAnnotation")&&(V(o,{width:i.width+2*v,height:i.height+2*v,x:i.x-v,y:i.y-v,minWidth:30*a,minHeight:10*a}),V(d,{textAlign:"left",paddingTop:bo*a+"px",paddingBottom:bo*a+"px",paddingLeft:bo*a+"px",paddingRight:bo*a+"px",fontSize:f+"px",lineHeight:p})),{bounds:o,style:d}},ts.prototype.update=function(e,t,n,i){var r,o;E(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),YO(t)&&(t=null),this._modeling.updateLabel(e,t,r)};function c_(e){return E(e,"bpmn:SubProcess")&&!Ke(e)}function VO(e){return E(e,"bpmn:SubProcess")&&Ke(e)}function WO(e){return E(e,"bpmn:Participant")&&!Ke(e)}function UO(e){return E(e,"bpmn:Participant")&&Ke(e)}function YO(e){return!e||!e.trim()}var u_="djs-element-hidden",l_="djs-label-hidden";function p_(e,t,n){var i=this,r=t.getDefaultLayer(),o,a,s;e.on("directEditing.activate",function(c){var u=c.active;if(o=u.element.label||u.element,E(o,"bpmn:TextAnnotation")){a=t.getAbsoluteBBox(o),s=Pe("g");var l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),f=i.path=Pe("path");_e(f,{d:l,strokeWidth:2,stroke:qO(o)}),je(s,f),je(r,s),rn(s,o.x,o.y)}E(o,"bpmn:TextAnnotation")||o.labelTarget?t.addMarker(o,u_):(E(o,"bpmn:Task")||E(o,"bpmn:CallActivity")||E(o,"bpmn:SubProcess")||E(o,"bpmn:Participant")||E(o,"bpmn:Lane"))&&t.addMarker(o,l_)}),e.on("directEditing.resize",function(c){if(E(o,"bpmn:TextAnnotation")){var u=c.height,l=c.dy,f=Math.max(o.height/a.height*(u+l),0),p=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:f,position:{mx:0,my:0}});_e(i.path,{d:p})}}),e.on(["directEditing.complete","directEditing.cancel"],function(c){var u=c.active;u&&(t.removeMarker(u.element.label||u.element,u_),t.removeMarker(o,l_)),o=void 0,a=void 0,s&&(Gt(s),s=void 0)})}p_.$inject=["eventBus","canvas","pathMap"];function qO(e,t){var n=Ze(e);return n.get("stroke")||t||"black"}const KO={__depends__:[ef,s_,Bx],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",ts],labelEditingPreview:["type",p_]};var XO=500,ZO=1e3;function Ri(e,t,n){this._eventBus=e,this._elementRegistry=n,this._outlineOffset=5,this._outlineStyle=t.cls("djs-outline",["no-fill"]);var i=this;function r(o){IS(o)||i.createOutline(o)}e.on("element.hover",function(o){r(o.element)}),e.on("selection.changed",function(o){$(o.newSelection,r)}),e.on(["shape.changed","connection.changed"],XO,function(o){var a=o.element,s=o.gfx,c=at(".djs-outline",s);c&&i.updateOutline(a,c)})}Ri.prototype.createOutline=function(e){var t=this._elementRegistry.getGraphics(e);if(!t)throw new Error("cannot create outline for non-rendered element");var n=at(".djs-outline",t);return n||(n=this.getOutline(e)||this._createOutlineGfx(),je(t,n),this.updateOutline(e,n)),n},Ri.prototype._createOutlineGfx=function(){var e=Pe("rect");return _e(e,V({x:0,y:0,rx:4,width:100,height:100},this._outlineStyle)),e},Ri.prototype.updateOutline=function(e,t){e.waypoints?this.updateConnectionOutline(t,e):this.updateShapeOutline(t,e)},Ri.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&$(i,function(r){n=n||r.updateOutline(t,e)}),n||_e(e,{x:-this._outlineOffset,y:-this._outlineOffset,width:t.width+this._outlineOffset*2,height:t.height+this._outlineOffset*2})},Ri.prototype.updateConnectionOutline=function(e,t){var n=It(t);_e(e,{x:n.x-this._outlineOffset,y:n.y-this._outlineOffset,width:n.width+this._outlineOffset*2,height:n.height+this._outlineOffset*2})},Ri.prototype.registerProvider=function(e,t){t||(t=e,e=ZO),this._eventBus.on("outline.getProviders",e,function(n){n.providers.push(t)})},Ri.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},Ri.prototype.getOutline=function(e){var t,n=this._getProviders();return $(n,function(i){qt(i.getOutline)&&(t=t||i.getOutline(e))}),t},Ri.$inject=["eventBus","styles","elementRegistry"];var Au=6;function Xf(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)})}Xf.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Os(t);var n=e.length>1,i=this._canvas.getContainer();if(Xe(i)[n?"add":"remove"]("djs-multi-select"),!!n){var r=QO(It(e)),o=Pe("rect");_e(o,V({rx:3},r)),Xe(o).add("djs-selection-outline"),je(t,o)}},Xf.$inject=["eventBus","canvas","selection"];function QO(e){return{x:e.x-Au,y:e.y-Au,width:e.width+Au*2,height:e.height+Au*2}}const Zf={__depends__:[Jn],__init__:["outline","multiSelectionOutline"],outline:["type",Ri],multiSelectionOutline:["type",Xf]},f_=["bpmn:Event","bpmn:SequenceFlow","bpmn:Gateway"],d_={class:"bjs-label-link",stroke:"var(--element-selected-outline-secondary-stroke-color)",strokeDasharray:"5, 5"},JO=15,Tu=2;function h_(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=>Ve(m,f_));if(p.length===1){const m=p[0];Ge(m)?a(m,m.labelTarget):(d=m.labels)!=null&&d.length&&a(m.labels[0],m)}if(p.length===2){const m=p.find(Ge),h=p.find(g=>{var y;return(y=g.labels)==null?void 0:y.includes(m)});m&&h&&a(m,h)}}),e.on("shape.changed",function({element:f}){var p;!Ve(f,f_)||!l(f)||(Ge(f)?a(f,f.labelTarget):(p=f.labels)!=null&&p.length&&a(f.labels[0],f))});function a(f,p){const d=ra([Ie(p),Ie(f)],d_),m=d.getAttribute("d"),g=r.isSelected(f)?c(f):u(f),y=ca(g,m);if(!y)return;const b=r.isSelected(p)?c(p):u(p),x=ca(b,m)||Ie(p);va(x,y)<JO||(Al(d,[x,y]),je(o,d))}function s(){ks(`.${d_.class}`,o).forEach(Gt)}function c(f){const p=i.getOutline(f);if(!p)return u(f);if(p.x){const d={x:f.x+wr(p,"x")-Tu,y:f.y+wr(p,"y")-Tu,width:wr(p,"width")+Tu*2,height:wr(p,"height")+Tu*2};return $l(d,wr(p,"rx"))}if(p.cx){const d=wr(p,"r"),m={x:f.x+wr(p,"cx")-d,y:f.y+wr(p,"cy")-d,width:d*2,height:d*2};return Gm(m)}}function u(f){return n.getShapePath(f)}function l(f){return r.isSelected(f)}}h_.$inject=["eventBus","canvas","graphicsFactory","outline","selection"];function wr(e,t){return parseFloat(_e(e,t)||0)}const eD={__depends__:[Jn,Zf],__init__:["labelLink"],labelLink:["type",h_]};var tD=new ko("tt");function nD(e){var t=yt('<div class="djs-tooltip-container" />');return _n(t,{position:"absolute",width:"0",height:"0"}),e.insertBefore(t,e.firstChild),t}function iD(e,t,n){_n(e,{left:t+"px",top:n+"px"})}function Qf(e,t){e.style.display=t===!1?"none":""}var m_="djs-tooltip",Jf="."+m_;function Cn(e,t){this._eventBus=e,this._canvas=t,this._ids=tD,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=nD(t.getContainer());var n=this;kn.bind(this._tooltipRoot,Jf,"mousedown",function(i){i.stopPropagation()}),kn.bind(this._tooltipRoot,Jf,"mouseover",function(i){n.trigger("mouseover",i)}),kn.bind(this._tooltipRoot,Jf,"mouseout",function(i){n.trigger("mouseout",i)}),this._init()}Cn.$inject=["eventBus","canvas"],Cn.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=V({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Cn.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(dn(n,"data-tooltip-id"));i&&(e==="mouseover"&&i.timeout&&this.clearTimeout(i),e==="mouseout"&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Cn.prototype.get=function(e){return typeof e!="string"&&(e=e.id),this._tooltips[e]},Cn.prototype.clearTimeout=function(e){if(e=this.get(e),!!e){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Cn.prototype.setTimeout=function(e){if(e=this.get(e),!!e){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},Cn.prototype.remove=function(e){var t=this.get(e);t&&(gi(t.html),gi(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Cn.prototype.show=function(){Qf(this._tooltipRoot)},Cn.prototype.hide=function(){Qf(this._tooltipRoot,!1)},Cn.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},Cn.prototype._addTooltip=function(e){var t=e.id,n=e.html,i,r=this._tooltipRoot;n.get&&n.constructor.prototype.jquery&&(n=n.get(0)),Pn(n)&&(n=yt(n)),i=yt('<div data-tooltip-id="'+t+'" class="'+m_+'">'),_n(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)},Cn.prototype._updateTooltip=function(e){var t=e.position,n=e.htmlContainer;iD(n,t.x,t.y)},Cn.prototype._updateTooltipVisibilty=function(e){$(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Qf(i,r))})},Cn.prototype._init=function(){var e=this;function t(n){e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}this._eventBus.on("canvas.viewbox.changing",function(n){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(n){t(n.viewbox)})};const rD={__init__:["tooltips"],tooltips:["type",Cn]};var oD="flow elements must be children of pools/participants",aD="Data object must be placed within a pool/participant.";function g_(e,t,n){function i(r,o,a){t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+o+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(r){var o=r.context,a=o.shape,s=o.target;E(s,"bpmn:Collaboration")&&(E(a,"bpmn:FlowNode")?i(r,n(oD)):E(a,"bpmn:DataObjectReference")&&i(r,n(aD)))})}g_.$inject=["eventBus","tooltips","translate"];const sD={__depends__:[rD],__init__:["modelingFeedback"],modelingFeedback:["type",g_]};var cD=500,uD=1250,lD=1500,Mu=Math.round;function pD(e){return{x:e.x+Mu(e.width/2),y:e.y+Mu(e.height/2)}}function y_(e,t,n,i,r){function o(s,c,u,l){return r.allowed("elements.move",{shapes:s,delta:c,position:u,target:l})}e.on("shape.move.start",lD,function(s){var c=s.context,u=s.shape,l=i.get().slice();l.indexOf(u)===-1&&(l=[u]),l=fD(l),V(c,{shapes:l,validatedShapes:l,shape:u})}),e.on("shape.move.start",uD,function(s){var c=s.context,u=c.validatedShapes,l;if(l=c.canExecute=o(u),!l)return!1}),e.on("shape.move.move",cD,function(s){var c=s.context,u=c.validatedShapes,l=s.hover,f={x:s.dx,y:s.dy},p={x:s.x,y:s.y},d;if(d=o(u,f,p,l),c.delta=f,c.canExecute=d,d===null){c.target=null;return}c.target=l}),e.on("shape.move.end",function(s){var c=s.context,u=c.delta,l=c.canExecute,f=l==="attach",p=c.shapes;if(l===!1)return!1;u.x=Mu(u.x),u.y=Mu(u.y),!(u.x===0&&u.y===0)&&n.moveElements(p,u,c.target,{primaryShape:c.shape,attach:f})}),e.on("element.mousedown",function(s){if(ur(s)){var c=Po(s);if(!c)throw new Error("must supply DOM mousedown event");return a(c,s.element)}});function a(s,c,u,l){if(Yt(u)&&(l=u,u=!1),!(c.waypoints||!c.parent)&&!Xe(s.target).has("djs-hit-no-move")){var f=pD(c),p=t.init(s,f,"shape.move",{cursor:"grabbing",autoActivate:u,data:{shape:c,context:l||{}}});if(p!==!1)return!0}}this.start=a}y_.$inject=["eventBus","dragging","modeling","selection","rules"];function fD(e){var t=no(e,"id");return Ue(e,function(n){for(;n=n.parent;)if(t[n.id])return!1;return!0})}var v_=499,ed="djs-dragging",b_="drop-ok",x_="drop-not-ok",__="new-parent",w_="attach-ok";function E_(e,t,n,i){function r(c){var u=o(c),l=dD(u);return l}function o(c){var u=oa(c),l=u.flatMap(d=>(d.incoming||[]).concat(d.outgoing||[])),f=u.concat(l),p=[...new Set(f)];return p}function a(c,u){[w_,b_,x_,__].forEach(function(l){l===u?t.addMarker(c,l):t.removeMarker(c,l)})}function s(c,u,l){i.addDragger(u,c.dragGroup),l&&t.addMarker(u,ed),c.allDraggedElements?c.allDraggedElements.push(u):c.allDraggedElements=[u]}e.on("shape.move.start",v_,function(c){var u=c.context,l=u.shapes,f=u.allDraggedElements,p=r(l);if(!u.dragGroup){var d=Pe("g");_e(d,n.cls("djs-drag-group",["no-events"]));var m=t.getActiveLayer();je(m,d),u.dragGroup=d}p.forEach(function(h){i.addDragger(h,u.dragGroup)}),f?f=ju([f,o(l)]):f=o(l),$(f,function(h){t.addMarker(h,ed)}),u.allDraggedElements=f,u.differentParents=hD(l)}),e.on("shape.move.move",v_,function(c){var u=c.context,l=u.dragGroup,f=u.target,p=u.shape.parent,d=u.canExecute;f&&(d==="attach"?a(f,w_):u.canExecute&&p&&f.id!==p.id?a(f,__):a(f,u.canExecute?b_:x_)),rn(l,c.dx,c.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(c){var u=c.context,l=u.target;l&&a(l,null)}),e.on("shape.move.cleanup",function(c){var u=c.context,l=u.allDraggedElements,f=u.dragGroup;$(l,function(p){t.removeMarker(p,ed)}),f&&Gt(f)}),this.makeDraggable=s}E_.$inject=["eventBus","canvas","styles","previewSupport"];function dD(e){var t=new Set;e.forEach(function(i){t.add(i.id)});var n=Ue(e,function(i){return ct(i)?t.has(i.source.id)&&t.has(i.target.id):!0});return n}function hD(e){return nw(no(e,function(t){return t.parent&&t.parent.id}))!==1}const mD={__depends__:[_c,Jn,Zf,wi,Fi,Oo],__init__:["move","movePreview"],move:["type",y_],movePreview:["type",E_]};var S_=".djs-palette-toggle",R_=".entry",gD=S_+", "+R_,td="djs-palette-",yD="shown",nd="open",C_="two-column",vD=1e3;function jt(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()})}jt.$inject=["eventBus","canvas"],jt.prototype.registerProvider=function(e,t){t||(t=e,e=vD),this._eventBus.on("palette.getProviders",e,function(n){n.providers.push(t)}),this._rebuild()},jt.prototype.getEntries=function(){var e=this._getProviders();return e.reduce(xD,{})},jt.prototype._rebuild=function(){if(this._diagramInitialized){var e=this._getProviders();e.length&&(this._container||this._init(),this._update())}},jt.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=yt(jt.HTML_MARKUP);n.appendChild(i),_t(n).add(td+yD),kn.bind(i,gD,"click",function(r){var o=r.delegateTarget;if(bl(o,S_))return e.toggle();e.trigger("click",r)}),$e.bind(i,"mousedown",function(r){r.stopPropagation()}),kn.bind(i,R_,"dragstart",function(r){e.trigger("dragstart",r)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},jt.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},jt.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(C_,r),a.toggle(td+C_,r),"open"in e&&(o.toggle(nd,e.open),a.toggle(td+nd,e.open)),i.fire("palette.changed",{twoColumn:r,open:this.isOpen()})},jt.prototype._update=function(){var e=at(".djs-palette-entries",this._container),t=this._entries=this.getEntries();Ts(e),$(t,function(n,i){var r=n.group||"default",o=at("[data-group="+ja(r)+"]",e);o||(o=yt('<div class="group"></div>'),dn(o,"data-group",r),e.appendChild(o));var a=n.html||(n.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=yt(a);if(o.appendChild(s),!n.separator&&(dn(s,"data-action",i),n.title&&dn(s,"title",n.title),n.className&&bD(s,n.className),n.imageUrl)){var c=yt("<img>");dn(c,"src",n.imageUrl),s.appendChild(c)}}),this.open()},jt.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=dn(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},jt.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(qt(a)){if(t==="click")return a(n,i)}else if(a[t])return a[t](n,i);n.preventDefault()}},jt.prototype._layoutChanged=function(){this._toggleState({})},jt.prototype._needsCollapse=function(e,t){var n=50,i=Object.keys(t).length*46;return e<i+n},jt.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},jt.prototype.open=function(){this._toggleState({open:!0})},jt.prototype.toggle=function(){this.isOpen()?this.close():this.open()},jt.prototype.isActiveTool=function(e){return e&&this._activeTool===e},jt.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=at(".djs-palette-entries",this._container),this._toolsContainer=at("[data-group=tools]",t)),n=this._toolsContainer,$(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")}})},jt.prototype.isOpen=function(){return _t(this._container).has(nd)},jt.prototype._getParentContainer=function(){return this._canvas.getContainer()},jt.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';function bD(e,t){var n=_t(e),i=Le(t)?t:t.split(/\s+/g);i.forEach(function(r){n.add(r)})}function xD(e,t){var n=t.getPaletteEntries();return qt(n)?n(e):($(n,function(i,r){e[r]=i}),e)}const _D={__init__:["palette"],palette:["type",jt]};var P_="crosshair",A_="selected",wD="djs-dragging-active-lasso";function Er(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=Pe("rect");_e(d,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),je(p,d),u(!0),this.update(f)},update:function(f){var p=f.frame,d=f.bbox;p&&d&&_e(p,{x:d.x,y:d.y,width:d.width,height:d.height});var m=f.marked,h=f.lastMarked;if(m&&h){for(const g of h)m.has(g)||t.removeMarker(g,A_);for(const g of m)h.has(g)||t.addMarker(g,A_)}},remove:function(f){this.update(f),f.frame&&Gt(f.frame),u(!1)}};function u(f){Xe(t.getContainer()).toggle(wD,f)}function l(f){var p=i.getAll();return new Set(to(ho(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=T_(f),p.add=hc(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=T_(f),m=l(d),h=p.initialMarked.union(m);p.lastMarked=p.marked,p.marked=h,c.update(p)}),e.on("lasso.cleanup",function(f){var p=f.context;p.lastMarked=p.marked,p.marked=new Set(r.get()),c.remove(f.context)}),e.on("element.mousedown",1500,function(f){if(hc(f))return s.activateLasso(f.originalEvent),!0})}Er.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Er.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:P_,data:{context:{}},keepSelection:!0})},Er.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:P_,data:{context:{}},keepSelection:!0})},Er.prototype._select=function(e){this._selection.select(e)},Er.prototype.select=function(e,t,n=[]){var i=to(ho(e,t));this._select([...n,...i])},Er.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Er.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};function T_(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 ED={__depends__:[Rc,Sa],__init__:["lassoTool"],lassoTool:["type",Er]};var id=1500,M_="grab";function Go(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",id,function(c){if(_a(c))return a.activateMove(c.originalEvent,!0),!1}),s&&s.addListener(id,function(c){if(!(!k_(c.keyEvent)||a.isActive())){var u=a._mouse.getLastMoveEvent();a.activateMove(u,!!u)}},"keyboard.keydown"),s&&s.addListener(id,function(c){!k_(c.keyEvent)||!a.isActive()||a.toggle()},"keyboard.keyup"),e.on("hand.end",function(c){var u=c.originalEvent.target;if(!c.hover&&!(u instanceof SVGElement))return!1;e.once("hand.ended",function(){a.activateMove(c.originalEvent,{reactivate:!0})})}),e.on("hand.move.move",function(c){var u=t.viewbox().scale;t.scroll({dx:c.dx*u,dy:c.dy*u})}),e.on("hand.move.end",function(c){var u=c.context,l=u.reactivate;return!_a(c)&&l&&e.once("hand.move.ended",function(f){a.activateHand(f.originalEvent,!0,!0)}),!1})}Go.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Go.prototype.activateMove=function(e,t,n){typeof t=="object"&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:M_,data:{context:n||{}}})},Go.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:M_,data:{context:{reactivate:n}}})},Go.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Go.prototype.isActive=function(){var e=this._dragging.context();return e?/^(hand|hand\.move)$/.test(e.prefix):!1};function k_(e){return Vt("Space",e)}const SD={__depends__:[Rc,Sa],__init__:["handTool"],handTool:["type",Go]};var O_="connect-ok",D_="connect-not-ok";function Vo(e,t,n,i,r,o,a){var s=this;this._dragging=t,this._rules=o,this._mouse=a,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(c){var u=c.context,l=c.hover,f=u.canStartConnect=s.canStartConnect(l);f!==null&&(u.startTarget=l,i.addMarker(l,f?O_:D_))}),e.on(["global-connect.out","global-connect.cleanup"],function(c){var u=c.context.startTarget,l=c.context.canStartConnect;u&&i.removeMarker(u,l?O_:D_)}),e.on(["global-connect.ended"],function(c){var u=c.context,l=u.startTarget,f={x:c.x,y:c.y},p=s.canStartConnect(l);if(p)return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,l,f)}),!1})}Vo.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Vo.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Vo.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Vo.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Vo.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};const RD={__depends__:[Uf,wi,Fi,Rc,Sa],globalConnect:["type",Vo]};function rd(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)}rd.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],rd.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,a=this._globalConnect,s=this._translate;function c(f,p,d,m,h){function g(y){var v=n.createShape(V({type:f},h));t.start(y,v)}return{group:p,className:d,title:m,action:{dragstart:g,click:g}}}function u(f){var p=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),d=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:p});t.start(f,[p,d],{hints:{autoSelect:[p]}})}function l(f){t.start(f,n.createParticipantShape())}return V(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:s("Activate hand tool"),action:{click:function(f){o.activateHand(f)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:s("Activate lasso tool"),action:{click:function(f){r.activateSelection(f)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:s("Activate create/remove space tool"),action:{click:function(f){i.activateSelection(f)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:s("Activate global connect tool"),action:{click:function(f){a.start(f)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":c("bpmn:StartEvent","event","bpmn-icon-start-event-none",s("Create start event")),"create.intermediate-event":c("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",s("Create intermediate/boundary event")),"create.end-event":c("bpmn:EndEvent","event","bpmn-icon-end-event-none",s("Create end event")),"create.exclusive-gateway":c("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",s("Create gateway")),"create.task":c("bpmn:Task","activity","bpmn-icon-task",s("Create task")),"create.data-object":c("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",s("Create data object reference")),"create.data-store":c("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",s("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:s("Create expanded sub-process"),action:{dragstart:u,click:u}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:s("Create pool/participant"),action:{dragstart:l,click:l}},"create.group":c("bpmn:Group","artifact","bpmn-icon-group",s("Create group"))}),e};const CD={__depends__:[_D,Ec,sv,ED,SD,RD,ha],__init__:["paletteProvider"],paletteProvider:["type",rd]};var PD=250;function od(e,t,n,i,r){te.call(this,e);function o(s){var c=s.canExecute.replacements;$(c,function(u){var l=u.oldElementId,f={type:u.newElementType};if(!s.visualReplacements[l]){var p=t.get(l);V(f,{x:p.x,y:p.y});var d=n.createShape(f);i.addShape(d,p.parent);var m=at('[data-element-id="'+ja(p.id)+'"]',s.dragGroup);m&&_e(m,{display:"none"});var h=r.addDragger(d,s.dragGroup);s.visualReplacements[l]=h,i.removeShape(d)}})}function a(s){var c=s.visualReplacements;$(c,function(u,l){var f=at('[data-element-id="'+ja(l)+'"]',s.dragGroup);f&&_e(f,{display:"inline"}),u.remove(),c[l]&&delete c[l]})}e.on("shape.move.move",PD,function(s){var c=s.context,u=c.canExecute;c.visualReplacements||(c.visualReplacements={}),u&&u.replacements?o(c):a(c)})}od.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],xe(od,te);const AD={__depends__:[Oo],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",od]};var TD=1250,ad=40,MD=20,kD=10,L_=20,I_=["x","y"],OD=Math.abs;function B_(e){e.on(["connect.hover","connect.move","connect.end"],TD,function(t){var n=t.context,i=n.canExecute,r=n.start,o=n.hover,a=n.source,s=n.target;t.originalEvent&&Ln(t.originalEvent)||(n.initialConnectionStart||(n.initialConnectionStart=n.connectionStart),i&&o&&DD(t,o,ND(o)),o&&BD(i,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.connectionStart=ni(r),Ve(o,["bpmn:Event","bpmn:Gateway"])&&N_(t,ni(o)),Ve(o,["bpmn:Task","bpmn:SubProcess"])&&LD(t,o),E(a,"bpmn:BoundaryEvent")&&s===a.host&&ID(t)):$_(i,"bpmn:MessageFlow")?(E(r,"bpmn:Event")&&(n.connectionStart=ni(r)),E(o,"bpmn:Event")&&N_(t,ni(o))):n.connectionStart=n.initialConnectionStart)})}B_.$inject=["eventBus"];function DD(e,t,n){I_.forEach(function(i){var r=F_(i,t);e[i]<t[i]+n?Ft(e,i,t[i]+n):e[i]>t[i]+r-n&&Ft(e,i,t[i]+r-n)})}function LD(e,t){var n=ni(t);I_.forEach(function(i){$D(e,t,i)&&Ft(e,i,n[i])})}function ID(e){var t=e.context,n=t.source,i=t.target;if(!FD(t)){var r=ni(n),o=nn(r,i,-10),a=[];/top|bottom/.test(o)&&a.push("x"),/left|right/.test(o)&&a.push("y"),a.forEach(function(s){var c=e[s],u;OD(c-r[s])<ad&&(c>r[s]?u=r[s]+ad:u=r[s]-ad,Ft(e,s,u))})}}function N_(e,t){Ft(e,"x",t.x),Ft(e,"y",t.y)}function $_(e,t){return e&&e.type===t}function BD(e,t){return qi(t,function(n){return $_(e,n)})}function F_(e,t){return e==="x"?t.width:t.height}function ND(e){return E(e,"bpmn:Task")?kD:MD}function $D(e,t,n){return e[n]>t[n]+L_&&e[n]<t[n]+F_(n,t)-L_}function FD(e){var t=e.hover,n=e.source;return t&&n&&t===n}function Sr(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}Sr.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Sr.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,this._snapLocations.indexOf(e)===-1&&this._snapLocations.push(e)},Sr.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Sr.prototype.getSnapLocations=function(){return this._snapLocations},Sr.prototype.setSnapLocations=function(e){this._snapLocations=e},Sr.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new ku,n.initDefaults(this._defaultSnaps)),n};function ku(){this._snapValues={}}ku.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)},ku.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&Pk(e[n],r[n],i)},ku.prototype.initDefaults=function(e){var t=this;$(e||{},function(n,i){$(n,function(r){t.add(i,r)})})};var jD=1250;function Ci(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"],jD,function(r){var o=r.context,a=o.shape,s=o.snapContext,c=o.target;if(!(r.originalEvent&&Ln(r.originalEvent))&&!(zo(r)||!c)){var u=s.pointsForTarget(c);u.initialized||(u=i.addSnapTargetPoints(u,a,c),u.initialized=!0),n.snap(r,u)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}Ci.$inject=["elementRegistry","eventBus","snapping"],Ci.prototype.initSnap=function(e){var t=this._elementRegistry,n=e.context,i=n.shape,r=n.snapContext;r||(r=n.snapContext=new Sr);var o;t.get(i.id)?o=ni(i,e):o={x:e.x+ni(i).x,y:e.y+ni(i).y};var a={x:o.x-i.width/2,y:o.y-i.height/2},s={x:o.x+i.width/2,y:o.y+i.height/2};return r.setSnapOrigin("mid",{x:o.x-e.x,y:o.y-e.y}),Ge(i)||(r.setSnapOrigin("top-left",{x:a.x-e.x,y:a.y-e.y}),r.setSnapOrigin("bottom-right",{x:s.x-e.x,y:s.y-e.y})),r},Ci.prototype.addSnapTargetPoints=function(e,t,n){var i=this.getSnapTargets(t,n);return $(i,function(r){if(Ge(r)){Ge(t)&&e.add("mid",ni(r));return}if(ct(r)){if(r.waypoints.length<3)return;var o=r.waypoints.slice(1,-1);$(o,function(a){e.add("mid",a)});return}e.add("mid",ni(r))}),!Ne(t.x)||!Ne(t.y)||this._elementRegistry.get(t.id)&&e.add("mid",ni(t)),e},Ci.prototype.getSnapTargets=function(e,t){return Rx(t).filter(function(n){return!HD(n)})};function HD(e){return!!e.hidden}var j_=1500;function Wo(e,t){t.invoke(Ci,this),e.on(["create.move","create.end"],j_,WD),e.on(["create.move","create.end","shape.move.move","shape.move.end"],j_,function(n){var i=n.context,r=i.canExecute,o=i.target,a=r&&(r==="attach"||r.attach);a&&!zo(n)&&zD(n,o)})}xe(Wo,Ci),Wo.$inject=["eventBus","injector"],Wo.prototype.initSnap=function(e){var t=Ci.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return $(n.outgoing,function(r){var o=r.waypoints[0];o=o.original||o,t.setSnapOrigin(r.id+"-docking",z_(o,i,e))}),$(n.incoming,function(r){var o=r.waypoints[r.waypoints.length-1];o=o.original||o,t.setSnapOrigin(r.id+"-docking",z_(o,i,e))}),E(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Wo.prototype.addSnapTargetPoints=function(e,t,n){Ci.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);$(i,function(o){(VD(o)||GD([t,o],"bpmn:TextAnnotation"))&&(e.add("top-left",Ex(o)),e.add("bottom-right",Sx(o)))});var r=this._elementRegistry;return $(t.incoming,function(o){if(r.get(t.id)){H_(i,o.source)||e.add("mid",Ie(o.source));var a=o.waypoints[0];e.add(o.id+"-docking",a.original||a)}}),$(t.outgoing,function(o){if(r.get(t.id)){H_(i,o.target)||e.add("mid",Ie(o.target));var a=o.waypoints[o.waypoints.length-1];e.add(o.id+"-docking",a.original||a)}}),E(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Wo.prototype.getSnapTargets=function(e,t){return Ci.prototype.getSnapTargets.call(this,e,t).filter(function(n){return!E(n,"bpmn:Lane")})};function zD(e,t){var n=Ae(t),i=iy(e,t),r=e.context,o=r.shape,a;o.parent?a={x:0,y:0}:a=Ie(o),/top/.test(i)?Ft(e,"y",n.top-a.y):/bottom/.test(i)&&Ft(e,"y",n.bottom-a.y),/left/.test(i)?Ft(e,"x",n.left-a.x):/right/.test(i)&&Ft(e,"x",n.right-a.x)}function GD(e,t){return e.every(function(n){return E(n,t)})}function VD(e){return E(e,"bpmn:SubProcess")&&Ke(e)?!0:E(e,"bpmn:Participant")}function WD(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)&&Ft(e,"x",e.x),(i&&i>=e.y||o&&o<=e.y)&&Ft(e,"y",e.y)}}function H_(e,t){return e.indexOf(t)!==-1}function z_(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}var UD=1250;function ns(e,t){var n=this;e.on(["resize.start"],function(i){n.initSnap(i)}),e.on(["resize.move","resize.end"],UD,function(i){var r=i.context,o=r.shape,a=o.parent,s=r.direction,c=r.snapContext;if(!(i.originalEvent&&Ln(i.originalEvent))&&!zo(i)){var u=c.pointsForTarget(a);u.initialized||(u=n.addSnapTargetPoints(u,o,a,s),u.initialized=!0),KD(s)&&Ft(i,"x",i.x),XD(s)&&Ft(i,"y",i.y),t.snap(i,u)}}),e.on(["resize.cleanup"],function(){t.hide()})}ns.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Sr);var o=G_(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},ns.prototype.addSnapTargetPoints=function(e,t,n,i){var r=this.getSnapTargets(t,n);return $(r,function(o){e.add("corner",Sx(o)),e.add("corner",Ex(o))}),e.add("corner",G_(t,i)),e},ns.$inject=["eventBus","snapping"],ns.prototype.getSnapTargets=function(e,t){return Rx(t).filter(function(n){return!YD(n,e)&&!ct(n)&&!qD(n)&&!Ge(n)})};function G_(e,t){var n=Ie(e),i=Ae(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 YD(e,t){return e.host===t}function qD(e){return!!e.hidden}function KD(e){return e==="n"||e==="s"}function XD(e){return e==="e"||e==="w"}var ZD=7,QD=1e3;function Rr(e){this._canvas=e,this._asyncHide=zu(Sn(this.hide,this),QD)}Rr.$inject=["canvas"],Rr.prototype.snap=function(e,t){var n=e.context,i=n.snapContext,r=i.getSnapLocations(),o={x:zo(e,"x"),y:zo(e,"y")};$(r,function(a){var s=i.getSnapOrigin(a),c={x:e.x+s.x,y:e.y+s.y};if($(["x","y"],function(u){var l;o[u]||(l=t.snap(c,a,u,ZD),l!==void 0&&(o[u]={value:l,originValue:l-s[u]}))}),o.x&&o.y)return!1}),this.showSnapLine("vertical",o.x&&o.x.value),this.showSnapLine("horizontal",o.y&&o.y.value),$(["x","y"],function(a){var s=o[a];Yt(s)&&Ft(e,a,s.originValue)})},Rr.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Pe("path");return _e(n,{d:"M0,0 L0,0"}),Xe(n).add("djs-snap-line"),je(t,n),{update:function(i){Ne(i)?e==="horizontal"?_e(n,{d:"M-100000,"+i+" L+100000,"+i,display:""}):_e(n,{d:"M "+i+",-100000 L "+i+", +100000",display:""}):_e(n,{display:"none"})}}},Rr.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Rr.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Rr.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Rr.prototype.hide=function(){$(this._snapLines,function(e){e.update()})};const JD={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Ci],resizeSnapping:["type",ns],snapping:["type",Rr]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",B_],createMoveSnapping:["type",Wo]};var V_=300;function He(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=at(He.INPUT_SELECTOR,this._container),this._resultsContainer=at(He.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}He.$inject=["canvas","eventBus","selection","translate"],He.prototype._bindEvents=function(){var e=this;function t(n,i,r,o){e._eventMaps.push({el:n,type:r,listener:kn.bind(n,i,r,o)})}t(document,"html","click",function(n){e.close(!1)}),t(this._container,He.INPUT_SELECTOR,"click",function(n){n.stopPropagation(),n.delegateTarget.focus()}),t(this._container,He.RESULT_SELECTOR,"mouseover",function(n){n.stopPropagation(),e._scrollToNode(n.delegateTarget),e._preselect(n.delegateTarget)}),t(this._container,He.RESULT_SELECTOR,"click",function(n){n.stopPropagation(),e._select(n.delegateTarget)}),t(this._container,He.INPUT_SELECTOR,"keydown",function(n){Vt("ArrowUp",n)&&n.preventDefault(),Vt("ArrowDown",n)&&n.preventDefault()}),t(this._container,He.INPUT_SELECTOR,"keyup",function(n){if(Vt("Escape",n))return e.close();if(Vt("Enter",n)){var i=e._getCurrentResult();return i?e._select(i):e.close(!1)}if(Vt("ArrowUp",n))return e._scrollToDirection(!0);if(Vt("ArrowDown",n))return e._scrollToDirection();Vt(["ArrowLeft","ArrowRight"],n)||e._search(n.delegateTarget.value)})},He.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){kn.unbind(e.el,e.type,e.listener)})},He.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=at(He.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}},He.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},He.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)}},He.prototype._clearResults=function(){Ts(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},He.prototype._getCurrentResult=function(){return at(He.RESULT_SELECTED_SELECTOR,this._resultsContainer)},He.prototype._createResultNode=function(e,t){var n=yt(He.RESULT_HTML);return e.primaryTokens.length>0&&W_(n,e.primaryTokens,He.RESULT_PRIMARY_HTML),W_(n,e.secondaryTokens,He.RESULT_SECONDARY_HTML),dn(n,He.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},He.prototype.registerProvider=function(e){this._searchProvider=e},He.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"))},He.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())},He.prototype.toggle=function(){this.isOpen()?this.close():this.open()},He.prototype.isOpen=function(){return this._open},He.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&_t(t).remove(He.RESULT_SELECTED_CLASS);var n=dn(e,He.RESULT_ID_ATTRIBUTE),i=this._results[n].element;_t(e).add(He.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:V_}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},He.prototype._select=function(e){var t=dn(e,He.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:V_}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},He.prototype._getBoxHtml=function(){const e=yt(He.BOX_HTML),t=at(He.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e};function W_(e,t,n){var i=eL(t),r=yt(n);r.innerHTML=i,e.appendChild(r)}function eL(e){var t="";return e.forEach(function(n){var i=Jv(n.value||n.matched||n.normal),r=n.match||n.matched;r?t+='<b class="'+He.RESULT_HIGHLIGHT_CLASS+'">'+i+"</b>":t+=i}),t!==""?t:null}He.CONTAINER_SELECTOR=".djs-search-container",He.INPUT_SELECTOR=".djs-search-input input",He.RESULTS_CONTAINER_SELECTOR=".djs-search-results",He.RESULT_SELECTOR=".djs-search-result",He.RESULT_SELECTED_CLASS="djs-search-result-selected",He.RESULT_SELECTED_SELECTOR="."+He.RESULT_SELECTED_CLASS,He.RESULT_ID_ATTRIBUTE="data-result-id",He.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",He.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>`,He.RESULT_HTML='<div class="djs-search-result"></div>',He.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',He.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const ZD={__depends__:[fa,Vc,Qn],searchPad:["type",He]};function rd(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}rd.$inject=["elementRegistry","searchPad","canvas","search"],rd.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Ge(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:Wn(i),id:i.id})),e,{keys:["label","id"]}).map(QD)};function QD(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const JD={__depends__:[ZD,ex],__init__:["bpmnSearch"],bpmnSearch:["type",rd]},eL="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",tL="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",nL={width:36,height:50},iL={width:50,height:50};function G_(e,t,n){return Pe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const ri=5;function Tu(e,t){this._styles=t,e.registerProvider(this)}Tu.$inject=["outline","styles"],Tu.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(PR(e))return n=Pe("rect"),we(n,V({x:-ri,y:-ri,rx:4,width:e.width+ri*2,height:e.height+ri*2},t)),n;if(!Ge(e))return E(e,"bpmn:Gateway")?(n=Pe("rect"),V(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),we(n,V({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Ve(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Pe("rect"),we(n,V({x:-ri,y:-ri,rx:14,width:e.width+ri*2,height:e.height+ri*2},t))):E(e,"bpmn:EndEvent")?(n=Pe("circle"),we(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ri+1},t))):E(e,"bpmn:Event")?(n=Pe("circle"),we(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+ri},t))):E(e,"bpmn:DataObjectReference")&&V_(e,"bpmn:DataObjectReference")?n=G_(eL,{x:-6,y:-6},t):E(e,"bpmn:DataStoreReference")&&V_(e,"bpmn:DataStoreReference")&&(n=G_(tL,{x:-6,y:-6},t)),n},Tu.prototype.updateOutline=function(e,t){if(!Ge(e))return Ve(e,["bpmn:SubProcess","bpmn:Group"])?(we(t,{width:e.width+ri*2,height:e.height+ri*2}),!0):!!Ve(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function V_(e,t){var n;return t==="bpmn:DataObjectReference"?n=nL:t==="bpmn:DataStoreReference"&&(n=iL),e.width===n.width&&e.height===n.height}const rL={__depends__:[qf],__init__:["outlineProvider"],outlineProvider:["type",Tu]};var oL='<?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 Ci(e){mo.call(this,e)}_e(Ci,mo),Ci.Viewer=yr,Ci.NavigatedViewer=Fa,Ci.prototype.createDiagram=function(){return this.importXML(oL)},Ci.prototype._interactionModules=[ib,ob,cb],Ci.prototype._modelingModules=[sk,zc,fk,lk,Rk,Gf,kk,nO,Yy,xc,aO,uO,RO,PO,AO,DO,WO,XO,mf,iD,pD,wD,SD,r_,KD,JD,rL],Ci.prototype._modules=[].concat(yr.prototype._modules,Ci.prototype._interactionModules,Ci.prototype._modelingModules);const aL=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Ot.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Ot.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),f=Ju(l);return r("imported",f),{warnings:f}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return Ot.onMounted(async()=>{a=new Ci({container:o.value,moddleExtensions:fs}),i.xml&&await s(i.xml),r("ready")}),Ot.watch(()=>i.xml,u=>{u&&a&&s(u)}),Ot.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(Ot.openBlock(),Ot.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);se.ADDABLE_FLOW_NODE_TYPES=rs,se.APPLY_BPMN_OPS_SCHEMA=q0,se.BPMN_MODDLE_EXTENSIONS=fs,se.BWL_MODDLE_SCHEMA=dd,se.BWL_NS=fd,se.BWL_PREFIX=Lu,se.BWL_SIDES=Iu,se.BpmnModelerView=aL,se.EDITOR=C1,se.FLOW_LABEL_INDENT=Yd,se.HEADLESS_BPMN_MODULES=Yv,se.HEADLESS_TEXT_METRICS=ro,se.I18N_NS=CE,se.I18N_PREFIX=$d,se.IR_FLOW_NODE_TYPES=Rr,se.LABEL_FORK_MARGIN=il,se.SYMBOLIC_OP_KINDS=gd,se.SYMBOLIC_OP_SCHEMA=yd,se.UNDO_EPISODE_COMMAND=Bu,se.applyBpmnOpBatch=jh,se.applyBpmnOps=Bh,se.approximateTextWidth=oo,se.auditBpmnGeometry=rh,se.auditBpmnGeometryXml=ZE,se.auditGeometry=vn,se.auditTargetsOf=zn,se.axisSegmentsOf=yn,se.blackBoxNameRect=tl,se.buildBpmnOpBatch=R1,se.buildRegistryIndex=ah,se.containerBoundarySegments=Qo,se.createBpmnEditorController=P1,se.createBpmnModdle=Fd,se.createHeadlessBpmnModeler=YM,se.crossedShapesOf=Qt,se.crossingCost=Hn,se.describeProcess=Fh,se.describeProcessXml=S1,se.edgeCrossCount=Jo,se.edgeCrossingPairsOf=ys,se.edgeCrossingStatsOf=Qd,se.executeAsUndoEpisode=md,se.forwardThreePointCandidates=bs,se.geometryFindingKey=En,se.installHeadlessBpmnDom=Hd,se.isAddableFlowNodeType=pd,se.isEdgeOverlapFinding=nl,se.isIrFlowNodeType=ld,se.labelRectsOf=co,se.lineCrossesLabel=Ti,se.lineThroughLabel=Kd,se.lineThroughShapeLabel=nh,se.loadBpmnXml=Qu,se.lowerOps=Ih,se.oppositeOverlapCount=FE,se.oppositeOverlapOf=Ud,se.planBackEdgeBoundaryClearance=mh,se.planCrossPoolRoute=fh,se.planEdgeRepair=sl,se.planLabelLineClearance=Rh,se.planLabelPlacement=Sh,se.planMiddleSegmentShifts=ch,se.planOppositeOverlapRepair=yh,se.planSegmentDetours=vs,se.planShapeLabelClearance=Ah,se.repairIntroducedBoundaryHugging=gh,se.repairIntroducedCrossings=cl,se.repairIntroducedEdgeCrossings=lh,se.repairIntroducedFakeMerges=bh,se.repairIntroducedLabelLines=Ch,se.repairIntroducedOppositeOverlaps=Eh,se.repairIntroducedShapeLabelLines=Th,se.repairIntroducedSharedSegmentLabels=Ph,se.rerouteIntroducedCrossPoolEdges=dh,se.resolverServicesOf=Dh,se.saveBpmnXml=PE,se.sceneCrossingCost=Zd,se.sceneFromDefinitions=ih,se.sceneFromRegistry=nt,se.sharedSegmentUnderLabel=gs,se.sharedSpansOf=ms,se.unreadableOverlapCount=jn,se.unreadableOverlapOf=ao,se.validateOps=Oh,se.warningMessages=Ju,Object.defineProperty(se,Symbol.toStringTag,{value:"Module"})}));
343
+ </div>`,He.RESULT_HTML='<div class="djs-search-result"></div>',He.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',He.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';const tL={__depends__:[ha,Yc,Jn],searchPad:["type",He]};function sd(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}sd.$inject=["elementRegistry","searchPad","canvas","search"],sd.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter(function(i){return!Ge(i)&&!t.includes(i)});return this._search(n.map(i=>({element:i,label:Un(i),id:i.id})),e,{keys:["label","id"]}).map(nL)};function nL(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}const iL={__depends__:[tL,ix],__init__:["bpmnSearch"],bpmnSearch:["type",sd]},rL="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",oL="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",aL={width:36,height:50},sL={width:50,height:50};function U_(e,t,n){return Pe("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}const oi=5;function Ou(e,t){this._styles=t,e.registerProvider(this)}Ou.$inject=["outline","styles"],Ou.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(kR(e))return n=Pe("rect"),_e(n,V({x:-oi,y:-oi,rx:4,width:e.width+oi*2,height:e.height+oi*2},t)),n;if(!Ge(e))return E(e,"bpmn:Gateway")?(n=Pe("rect"),V(n.style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),_e(n,V({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Ve(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?(n=Pe("rect"),_e(n,V({x:-oi,y:-oi,rx:14,width:e.width+oi*2,height:e.height+oi*2},t))):E(e,"bpmn:EndEvent")?(n=Pe("circle"),_e(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+oi+1},t))):E(e,"bpmn:Event")?(n=Pe("circle"),_e(n,V({cx:e.width/2,cy:e.height/2,r:e.width/2+oi},t))):E(e,"bpmn:DataObjectReference")&&Y_(e,"bpmn:DataObjectReference")?n=U_(rL,{x:-6,y:-6},t):E(e,"bpmn:DataStoreReference")&&Y_(e,"bpmn:DataStoreReference")&&(n=U_(oL,{x:-6,y:-6},t)),n},Ou.prototype.updateOutline=function(e,t){if(!Ge(e))return Ve(e,["bpmn:SubProcess","bpmn:Group"])?(_e(t,{width:e.width+oi*2,height:e.height+oi*2}),!0):!!Ve(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};function Y_(e,t){var n;return t==="bpmn:DataObjectReference"?n=aL:t==="bpmn:DataStoreReference"&&(n=sL),e.width===n.width&&e.height===n.height}const cL={__depends__:[Zf],__init__:["outlineProvider"],outlineProvider:["type",Ou]};var uL='<?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 Pi(e){yo.call(this,e)}xe(Pi,yo),Pi.Viewer=vr,Pi.NavigatedViewer=Ha,Pi.prototype.createDiagram=function(){return this.importXML(uL)},Pi.prototype._interactionModules=[ab,cb,pb],Pi.prototype._modelingModules=[pk,Wc,gk,hk,Tk,Uf,Ik,aO,Xy,Ec,lO,dO,TO,kO,OO,NO,KO,eD,vf,sD,mD,CD,AD,s_,JD,iL,cL],Pi.prototype._modules=[].concat(vr.prototype._modules,Pi.prototype._interactionModules,Pi.prototype._modelingModules);const lL=((e,t)=>{const n=e.__vccOpts||e;for(const[i,r]of t)n[i]=r;return n})(Lt.defineComponent({__name:"BpmnModelerView",props:{xml:{}},emits:["ready","imported","import-error"],setup(e,{expose:t,emit:n}){const i=e,r=n,o=Lt.ref();let a;async function s(u){if(!a)throw new Error("modeler not mounted");try{const{warnings:l}=await a.importXML(u),f=nl(l);return r("imported",f),{warnings:f}}catch(l){throw r("import-error",l),l}}async function c(){if(!a)throw new Error("modeler not mounted");const{xml:u}=await a.saveXML({format:!0});return u??""}return Lt.onMounted(async()=>{a=new Pi({container:o.value,moddleExtensions:ms}),i.xml&&await s(i.xml),r("ready")}),Lt.watch(()=>i.xml,u=>{u&&a&&s(u)}),Lt.onBeforeUnmount(()=>{a==null||a.destroy(),a=void 0}),t({importXml:s,saveXml:c,getModeler:()=>a}),(u,l)=>(Lt.openBlock(),Lt.createElementBlock("div",{ref_key:"container",ref:o,class:"bpmn-modeler-view"},null,512))}}),[["__scopeId","data-v-a9b41c97"]]);se.ADDABLE_FLOW_NODE_TYPES=ss,se.APPLY_BPMN_OPS_SCHEMA=Q0,se.BPMN_MODDLE_EXTENSIONS=ms,se.BWL_MODDLE_SCHEMA=gd,se.BWL_NS=md,se.BWL_PREFIX=Nu,se.BWL_SIDES=$u,se.BpmnModelerView=lL,se.EDITOR=M1,se.FLOW_LABEL_INDENT=Xd,se.HEADLESS_BPMN_MODULES=Xv,se.HEADLESS_TEXT_METRICS=ao,se.I18N_NS=ME,se.I18N_PREFIX=Hd,se.IR_FLOW_NODE_TYPES=Cr,se.LABEL_FORK_MARGIN=al,se.SYMBOLIC_OP_KINDS=bd,se.SYMBOLIC_OP_SCHEMA=xd,se.UNDO_EPISODE_COMMAND=Fu,se.applyBpmnOpBatch=Gh,se.applyBpmnOps=Fh,se.approximateTextWidth=so,se.auditBpmnGeometry=sh,se.auditBpmnGeometryXml=t1,se.auditGeometry=fn,se.auditTargetsOf=Gn,se.axisSegmentsOf=xn,se.blackBoxNameRect=rl,se.buildBpmnOpBatch=T1,se.buildRegistryIndex=uh,se.containerBoundarySegments=ea,se.createBpmnEditorController=k1,se.createBpmnModdle=zd,se.createHeadlessBpmnModeler=ZM,se.crossedShapesOf=en,se.crossingCost=zn,se.describeProcess=zh,se.describeProcessXml=A1,se.edgeCrossCount=ta,se.edgeCrossingPairsOf=xs,se.edgeCrossingStatsOf=th,se.executeAsUndoEpisode=vd,se.forwardThreePointCandidates=ws,se.geometryFindingKey=bn,se.installHeadlessBpmnDom=Vd,se.isAddableFlowNodeType=hd,se.isEdgeOverlapFinding=ol,se.isIrFlowNodeType=dd,se.labelRectsOf=lo,se.lineCrossesLabel=Mi,se.lineThroughLabel=Qd,se.lineThroughShapeLabel=oh,se.loadBpmnXml=tl,se.lowerOps=$h,se.oppositeOverlapCount=GE,se.oppositeOverlapOf=Kd,se.planBackEdgeBoundaryClearance=vh,se.planCrossPoolRoute=mh,se.planEdgeRepair=ll,se.planLabelLineClearance=Ah,se.planLabelPlacement=Ph,se.planMiddleSegmentShifts=ph,se.planOppositeOverlapRepair=xh,se.planSegmentDetours=_s,se.planShapeLabelClearance=kh,se.repairIntroducedBoundaryHugging=bh,se.repairIntroducedCrossings=pl,se.repairIntroducedEdgeCrossings=dh,se.repairIntroducedFakeMerges=wh,se.repairIntroducedLabelLines=Th,se.repairIntroducedOppositeOverlaps=Ch,se.repairIntroducedShapeLabelLines=Oh,se.repairIntroducedSharedSegmentLabels=Mh,se.rerouteIntroducedCrossPoolEdges=gh,se.resolverServicesOf=Bh,se.saveBpmnXml=kE,se.sceneCrossingCost=eh,se.sceneFromDefinitions=ah,se.sceneFromRegistry=nt,se.sharedSegmentUnderLabel=bs,se.sharedSpansOf=vs,se.unreadableOverlapCount=Hn,se.unreadableOverlapOf=co,se.validateOps=Ih,se.warningMessages=nl,Object.defineProperty(se,Symbol.toStringTag,{value:"Module"})}));